diff options
28 files changed, 359 insertions, 48 deletions
diff --git a/Android.bp b/Android.bp index 8b8139ed16a7..cd7f98dbd777 100644 --- a/Android.bp +++ b/Android.bp @@ -621,6 +621,8 @@ java_defaults { "core/java/com/android/server/DropboxLogTags.logtags", "core/java/org/chromium/arc/EventLogTags.logtags", + ":platform-properties", + ":framework-statslog-gen", ], @@ -1561,6 +1563,7 @@ droidstubs { ], dex_mapping_filename: "dex-mapping.txt", args: metalava_framework_docs_args + + " --hide ReferencesHidden " + " --show-unannotated " + " --show-annotation android.annotation.SystemApi " + " --show-annotation android.annotation.TestApi " diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index e061b1548e58..543f0edbf835 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -1,13 +1,5 @@ [Hook Scripts] checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT} - -fw core/java/android/ - graphics/java/android - core/tests/coretests/src/android/ - packages/PrintRecommendationService/ - packages/PrintSpooler/ - services/print/ - services/usb/ - telephony/ api_lint_hook = ${REPO_ROOT}/frameworks/base/tools/apilint/apilint_sha.sh ${PREUPLOAD_COMMIT} diff --git a/api/current.txt b/api/current.txt index 236288ccb82e..e4f95fd1719f 100755 --- a/api/current.txt +++ b/api/current.txt @@ -27783,6 +27783,7 @@ package android.net { method public abstract boolean isRelative(); method public android.net.Uri normalizeScheme(); method public static android.net.Uri parse(java.lang.String); + method public java.lang.String toSafeString(); method public abstract java.lang.String toString(); method public static android.net.Uri withAppendedPath(android.net.Uri, java.lang.String); method public static void writeToParcel(android.os.Parcel, android.net.Uri); @@ -41115,8 +41116,9 @@ package android.telecom { method public void swapConference(); method public void unhold(); method public void unregisterCallback(android.telecom.Call.Callback); - field public static final java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts"; + field public static final deprecated java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts"; field public static final java.lang.String EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS = "android.telecom.extra.LAST_EMERGENCY_CALLBACK_TIME_MILLIS"; + field public static final java.lang.String EXTRA_SUGGESTED_PHONE_ACCOUNTS = "android.telecom.extra.SUGGESTED_PHONE_ACCOUNTS"; field public static final int STATE_ACTIVE = 4; // 0x4 field public static final int STATE_CONNECTING = 9; // 0x9 field public static final int STATE_DIALING = 1; // 0x1 @@ -41687,6 +41689,20 @@ package android.telecom { field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountHandle> CREATOR; } + public final class PhoneAccountSuggestion implements android.os.Parcelable { + method public int describeContents(); + method public android.telecom.PhoneAccountHandle getPhoneAccountHandle(); + method public int getReason(); + method public boolean shouldAutoSelect(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountSuggestion> CREATOR; + field public static final int REASON_FREQUENT = 2; // 0x2 + field public static final int REASON_INTRA_CARRIER = 1; // 0x1 + field public static final int REASON_NONE = 0; // 0x0 + field public static final int REASON_OTHER = 4; // 0x4 + field public static final int REASON_USER_SET = 3; // 0x3 + } + public final class RemoteConference { method public void disconnect(); method public java.util.List<android.telecom.RemoteConnection> getConferenceableConnections(); @@ -43085,6 +43101,7 @@ package android.telephony { field public static final int NETWORK_TYPE_IDEN = 11; // 0xb field public static final int NETWORK_TYPE_IWLAN = 18; // 0x12 field public static final int NETWORK_TYPE_LTE = 13; // 0xd + field public static final int NETWORK_TYPE_NR = 20; // 0x14 field public static final int NETWORK_TYPE_TD_SCDMA = 17; // 0x11 field public static final int NETWORK_TYPE_UMTS = 3; // 0x3 field public static final int NETWORK_TYPE_UNKNOWN = 0; // 0x0 diff --git a/api/system-current.txt b/api/system-current.txt index 4aaed7a83ffb..aa66133c2330 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5022,6 +5022,10 @@ package android.telecom { field public static final int CAPABILITY_MULTI_USER = 32; // 0x20 } + public final class PhoneAccountSuggestion implements android.os.Parcelable { + ctor public PhoneAccountSuggestion(android.telecom.PhoneAccountHandle, int, boolean); + } + public final class RemoteConference { method public deprecated void setAudioState(android.telecom.AudioState); } @@ -5439,6 +5443,7 @@ package android.telephony { field public static final int NETWORK_TYPE_BITMASK_HSUPA = 512; // 0x200 field public static final int NETWORK_TYPE_BITMASK_LTE = 8192; // 0x2000 field public static final int NETWORK_TYPE_BITMASK_LTE_CA = 524288; // 0x80000 + field public static final int NETWORK_TYPE_BITMASK_NR = 1048576; // 0x100000 field public static final int NETWORK_TYPE_BITMASK_TD_SCDMA = 131072; // 0x20000 field public static final int NETWORK_TYPE_BITMASK_UMTS = 8; // 0x8 field public static final int NETWORK_TYPE_BITMASK_UNKNOWN = 1; // 0x1 diff --git a/api/test-current.txt b/api/test-current.txt index 8466ef037142..b5b128a94727 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -963,6 +963,10 @@ package android.telecom { ctor public CallAudioState(boolean, int, int, android.bluetooth.BluetoothDevice, java.util.Collection<android.bluetooth.BluetoothDevice>); } + public final class PhoneAccountSuggestion implements android.os.Parcelable { + ctor public PhoneAccountSuggestion(android.telecom.PhoneAccountHandle, int, boolean); + } + } package android.telephony { diff --git a/core/java/android/annotation/UnsupportedAppUsage.java b/core/java/android/annotation/UnsupportedAppUsage.java index 65e3f25f8fb6..ac3daaf638ad 100644 --- a/core/java/android/annotation/UnsupportedAppUsage.java +++ b/core/java/android/annotation/UnsupportedAppUsage.java @@ -26,16 +26,32 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; /** - * Indicates that a class member, that is not part of the SDK, is used by apps. - * Since the member is not part of the SDK, such use is not supported. + * Indicates that this non-SDK interface is used by apps. A non-SDK interface is a + * class member (field or method) that is not part of the public SDK. Since the + * member is not part of the SDK, usage by apps is not supported. * - * <p>This annotation acts as a heads up that changing a given method or field + * <h2>If you are an Android App developer</h2> + * + * This annotation indicates that you may be able to access the member, but that + * this access is discouraged and not supported by Android. If there is a value + * for {@link #maxTargetSdk()} on the annotation, access will be restricted based + * on the {@code targetSdkVersion} value set in your manifest. + * + * <p>Fields and methods annotated with this are likely to be restricted, changed + * or removed in future Android releases. If you rely on these members for + * functionality that is not otherwise supported by Android, consider filing a + * <a href="http://g.co/dev/appcompat">feature request</a>. + * + * <h2>If you are an Android OS developer</h2> + * + * This annotation acts as a heads up that changing a given method or field * may affect apps, potentially breaking them when the next Android version is * released. In some cases, for members that are heavily used, this annotation * may imply restrictions on changes to the member. * * <p>This annotation also results in access to the member being permitted by the - * runtime, with a warning being generated in debug builds. + * runtime, with a warning being generated in debug builds. Which apps can access + * the member is determined by the value of {@link #maxTargetSdk()}. * * <p>For more details, see go/UnsupportedAppUsage. * diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index d09f33bcb755..af3ee0911d2f 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -374,11 +374,12 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { public abstract String toString(); /** - * Return a string representation of the URI that is safe to print - * to logs and other places where PII should be avoided. - * @hide + * Return a string representation of this URI that has common forms of PII redacted, + * making it safer to use for logging purposes. For example, {@code tel:800-466-4411} is + * returned as {@code tel:xxx-xxx-xxxx} and {@code http://example.com/path/to/item/} is + * returned as {@code http://example.com/...}. + * @return the common forms PII redacted string of this URI */ - @UnsupportedAppUsage public String toSafeString() { String scheme = getScheme(); String ssp = getSchemeSpecificPart(); diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 91888949829f..6932aa70267e 100644..100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -1113,7 +1113,8 @@ public class Build { * null (if, for instance, the radio is not currently on). */ public static String getRadioVersion() { - return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null); + String propVal = SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION); + return TextUtils.isEmpty(propVal) ? null : propVal; } private static String getString(String property) { diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index d072d02741ed..6b5927992677 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -52,6 +52,7 @@ import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; import android.os.SystemProperties; import android.provider.Settings; +import android.sysprop.VoldProperties; import android.system.ErrnoException; import android.system.Os; import android.system.OsConstants; @@ -1465,7 +1466,7 @@ public class StorageManager { * framework, so no service needs to check for changes during their lifespan */ public static boolean isBlockEncrypting() { - final String state = SystemProperties.get("vold.encrypt_progress", ""); + final String state = VoldProperties.encrypt_progress().orElse(""); return !"".equalsIgnoreCase(state); } @@ -1481,7 +1482,7 @@ public class StorageManager { * framework, so no service needs to check for changes during their lifespan */ public static boolean inCryptKeeperBounce() { - final String status = SystemProperties.get("vold.decrypt"); + final String status = VoldProperties.decrypt().orElse(""); return "trigger_restart_min_framework".equals(status); } diff --git a/core/proto/android/telephony/enums.proto b/core/proto/android/telephony/enums.proto index fba2e51937b3..477716982008 100644 --- a/core/proto/android/telephony/enums.proto +++ b/core/proto/android/telephony/enums.proto @@ -51,6 +51,7 @@ enum NetworkTypeEnum { NETWORK_TYPE_TD_SCDMA = 17; NETWORK_TYPE_IWLAN = 18; NETWORK_TYPE_LTE_CA = 19; + NETWORK_TYPE_NR = 20; } // Signal strength levels, primarily used by android/telephony/SignalStrength.java. diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java index 8f254e9735da..a7de631cd6fa 100644 --- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java +++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java @@ -200,7 +200,7 @@ class MtpManager { } if (objectInfo.getFormat() != MtpConstants.FORMAT_ASSOCIATION) { if (!device.sendObject(sendObjectInfoResult.getObjectHandle(), - sendObjectInfoResult.getCompressedSize(), source)) { + sendObjectInfoResult.getCompressedSizeLong(), source)) { throw new IOException("Failed to send contents of a document"); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java index 639e50cf4e58..9c099f91bc8d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java @@ -16,7 +16,7 @@ package com.android.systemui.statusbar.policy; -import android.os.SystemProperties; +import android.sysprop.VoldProperties; /** * Helper for determining whether the phone is decrypted yet. @@ -26,7 +26,7 @@ public class EncryptionHelper { public static final boolean IS_DATA_ENCRYPTED = isDataEncrypted(); private static boolean isDataEncrypted() { - String voldState = SystemProperties.get("vold.decrypt"); + String voldState = VoldProperties.decrypt().orElse(""); return "1".equals(voldState) || "trigger_restart_min_framework".equals(voldState); } } diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index a3e6ea2518a6..371e5177ede3 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -99,6 +99,7 @@ import android.os.storage.VolumeInfo; import android.os.storage.VolumeRecord; import android.provider.MediaStore; import android.provider.Settings; +import android.sysprop.VoldProperties; import android.text.TextUtils; import android.text.format.DateUtils; import android.util.ArrayMap; @@ -973,7 +974,7 @@ class StorageManagerService extends IStorageManager.Stub // On an encrypted device we can't see system properties yet, so pull // the system locale out of the mount service. - if ("".equals(SystemProperties.get("vold.encrypt_progress"))) { + if ("".equals(VoldProperties.encrypt_progress().orElse(""))) { copyLocaleFromMountService(); } } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index a411af254510..5df2c64c8a3d 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -364,6 +364,7 @@ import android.provider.Downloads; import android.provider.Settings; import android.service.voice.IVoiceInteractionSession; import android.service.voice.VoiceInteractionManagerInternal; +import android.sysprop.VoldProperties; import android.telecom.TelecomManager; import android.text.TextUtils; import android.text.format.DateUtils; @@ -7958,8 +7959,8 @@ public class ActivityManagerService extends IActivityManager.Stub SystemProperties.set("sys.boot_completed", "1"); // And trigger dev.bootcomplete if we are not showing encryption progress - if (!"trigger_restart_min_framework".equals(SystemProperties.get("vold.decrypt")) - || "".equals(SystemProperties.get("vold.encrypt_progress"))) { + if (!"trigger_restart_min_framework".equals(VoldProperties.decrypt().orElse("")) + || "".equals(VoldProperties.encrypt_progress().orElse(""))){ SystemProperties.set("dev.bootcomplete", "1"); } mUserController.sendBootCompleted( diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index 3c14393ca740..d75601be23e3 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -944,10 +944,11 @@ public class Tethering extends BaseNetworkObserver { public boolean hasTetherableConfiguration() { final TetheringConfiguration cfg = mConfig; final boolean hasDownstreamConfiguration = - (cfg.tetherableUsbRegexs.length != 0) || - (cfg.tetherableWifiRegexs.length != 0) || - (cfg.tetherableBluetoothRegexs.length != 0); - final boolean hasUpstreamConfiguration = !cfg.preferredUpstreamIfaceTypes.isEmpty(); + (cfg.tetherableUsbRegexs.length != 0) + || (cfg.tetherableWifiRegexs.length != 0) + || (cfg.tetherableBluetoothRegexs.length != 0); + final boolean hasUpstreamConfiguration = !cfg.preferredUpstreamIfaceTypes.isEmpty() + || cfg.chooseUpstreamAutomatically; return hasDownstreamConfiguration && hasUpstreamConfiguration; } diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index de0f29851da5..25ca27836aa7 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -1082,13 +1082,14 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { assertRunOnServiceThread(); if (!canStartArcUpdateAction(message.getSource(), true)) { - if (getAvrDeviceInfo() == null) { + HdmiDeviceInfo avrDeviceInfo = getAvrDeviceInfo(); + if (avrDeviceInfo == null) { // AVR may not have been discovered yet. Delay the message processing. mDelayedMessageBuffer.add(message); return true; } mService.maySendFeatureAbortCommand(message, Constants.ABORT_REFUSED); - if (!isConnectedToArcPort(message.getSource())) { + if (!isConnectedToArcPort(avrDeviceInfo.getPhysicalAddress())) { displayOsd(OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT); } return true; diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 80b0e6f4fca7..65ee52a0d876 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -48,6 +48,7 @@ import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.os.storage.IStorageManager; +import android.sysprop.VoldProperties; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Slog; @@ -625,7 +626,7 @@ public final class SystemServer { traceEnd(); // Only run "core" apps if we're encrypting the device. - String cryptState = SystemProperties.get("vold.decrypt"); + String cryptState = VoldProperties.decrypt().orElse(""); if (ENCRYPTING_STATE.equals(cryptState)) { Slog.w(TAG, "Detected encryption in progress - only parsing core apps"); mOnlyCore = true; diff --git a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java index 3b0850533ad3..423909921e21 100644 --- a/services/usb/java/com/android/server/usb/UsbDebuggingManager.java +++ b/services/usb/java/com/android/server/usb/UsbDebuggingManager.java @@ -34,10 +34,10 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; -import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.service.usb.UsbDebuggingManagerProto; +import android.sysprop.VoldProperties; import android.util.Base64; import android.util.Slog; @@ -263,7 +263,7 @@ public class UsbDebuggingManager { case MESSAGE_ADB_CONFIRM: { if ("trigger_restart_min_framework".equals( - SystemProperties.get("vold.decrypt"))) { + VoldProperties.decrypt().orElse(""))) { Slog.d(TAG, "Deferring adb confirmation until after vold decrypt"); if (mThread != null) { mThread.sendResponse("NO"); diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 4da7285bcf2d..aa93c6b9cb89 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -69,6 +69,7 @@ import android.os.storage.StorageVolume; import android.provider.Settings; import android.service.usb.UsbDeviceManagerProto; import android.service.usb.UsbHandlerProto; +import android.sysprop.VoldProperties; import android.util.Pair; import android.util.Slog; @@ -285,7 +286,7 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver mControlFds.put(UsbManager.FUNCTION_PTP, ptpFd); boolean secureAdbEnabled = SystemProperties.getBoolean("ro.adb.secure", false); - boolean dataEncrypted = "1".equals(SystemProperties.get("vold.decrypt")); + boolean dataEncrypted = "1".equals(VoldProperties.decrypt().orElse("")); if (secureAdbEnabled && !dataEncrypted) { mDebuggingManager = new UsbDebuggingManager(context); } diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index cef998651cfe..bf0ffb94b252 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -123,10 +123,21 @@ public final class Call { * The key to retrieve the optional {@code PhoneAccount}s Telecom can bundle with its Call * extras. Used to pass the phone accounts to display on the front end to the user in order to * select phone accounts to (for example) place a call. + * @deprecated Use the list from {@link #EXTRA_SUGGESTED_PHONE_ACCOUNTS} instead. */ + @Deprecated public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts"; /** + * Key for extra used to pass along a list of {@link PhoneAccountSuggestion}s to the in-call + * UI when a call enters the {@link #STATE_SELECT_PHONE_ACCOUNT} state. The list included here + * will have the same length and be in the same order as the list passed with + * {@link #AVAILABLE_PHONE_ACCOUNTS}. + */ + public static final String EXTRA_SUGGESTED_PHONE_ACCOUNTS = + "android.telecom.extra.SUGGESTED_PHONE_ACCOUNTS"; + + /** * Extra key used to indicate the time (in milliseconds since midnight, January 1, 1970 UTC) * when the last outgoing emergency call was made. This is used to identify potential emergency * callbacks. diff --git a/telecomm/java/android/telecom/PhoneAccountSuggestion.java b/telecomm/java/android/telecom/PhoneAccountSuggestion.java new file mode 100644 index 000000000000..4e6a178c8170 --- /dev/null +++ b/telecomm/java/android/telecom/PhoneAccountSuggestion.java @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telecom; + +import android.annotation.IntDef; +import android.annotation.SystemApi; +import android.annotation.TestApi; +import android.os.Parcel; +import android.os.Parcelable; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +public final class PhoneAccountSuggestion implements Parcelable { + + /** @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(value = {REASON_NONE, REASON_INTRA_CARRIER, REASON_FREQUENT, + REASON_USER_SET, REASON_OTHER}, prefix = { "REASON_" }) + public @interface SuggestionReason {} + + /** + * Indicates that this account is not suggested for use, but is still available. + */ + public static final int REASON_NONE = 0; + + /** + * Indicates that the {@link PhoneAccountHandle} is suggested because the number we're calling + * is on the same carrier, and therefore may have lower rates. + */ + public static final int REASON_INTRA_CARRIER = 1; + + /** + * Indicates that the {@link PhoneAccountHandle} is suggested because the user uses it + * frequently for the number that we are calling. + */ + public static final int REASON_FREQUENT = 2; + + /** + * Indicates that the {@link PhoneAccountHandle} is suggested because the user explicitly + * specified that it be used for the number we are calling. + */ + public static final int REASON_USER_SET = 3; + + /** + * Indicates that the {@link PhoneAccountHandle} is suggested for a reason not otherwise + * enumerated here. + */ + public static final int REASON_OTHER = 4; + + private PhoneAccountHandle mHandle; + private int mReason; + private boolean mShouldAutoSelect; + + /** + * @hide + */ + @SystemApi + @TestApi + public PhoneAccountSuggestion(PhoneAccountHandle handle, @SuggestionReason int reason, + boolean shouldAutoSelect) { + this.mHandle = handle; + this.mReason = reason; + this.mShouldAutoSelect = shouldAutoSelect; + } + + private PhoneAccountSuggestion(Parcel in) { + mHandle = in.readParcelable(PhoneAccountHandle.class.getClassLoader()); + mReason = in.readInt(); + mShouldAutoSelect = in.readByte() != 0; + } + + public static final Creator<PhoneAccountSuggestion> CREATOR = + new Creator<PhoneAccountSuggestion>() { + @Override + public PhoneAccountSuggestion createFromParcel(Parcel in) { + return new PhoneAccountSuggestion(in); + } + + @Override + public PhoneAccountSuggestion[] newArray(int size) { + return new PhoneAccountSuggestion[size]; + } + }; + + /** + * @return The {@link PhoneAccountHandle} for this suggestion. + */ + public PhoneAccountHandle getPhoneAccountHandle() { + return mHandle; + } + + /** + * @return The reason for this suggestion + */ + public @SuggestionReason int getReason() { + return mReason; + } + + /** + * Suggests whether the dialer should automatically place the call using this account without + * user interaction. This may be set on multiple {@link PhoneAccountSuggestion}s, and the dialer + * is free to choose which one to use. + * @return {@code true} if the hint is to auto-select, {@code false} otherwise. + */ + public boolean shouldAutoSelect() { + return mShouldAutoSelect; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeParcelable(mHandle, flags); + dest.writeInt(mReason); + dest.writeByte((byte) (mShouldAutoSelect ? 1 : 0)); + } +} diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index a0064e250136..e72d67b20160 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -78,6 +78,15 @@ public class CarrierConfigManager { // system image, that can be added in packages/apps/CarrierConfig. /** + * Specifies a value that identifies the version of the carrier configuration that is + * currently in use. This string is displayed on the UI. + * The format of the string is not specified. + * @hide + */ + public static final String KEY_CARRIER_CONFIG_VERSION_STRING = + "carrier_config_version_string"; + + /** * This flag specifies whether VoLTE availability is based on provisioning. By default this is * false. */ @@ -2328,6 +2337,7 @@ public class CarrierConfigManager { static { sDefaults = new PersistableBundle(); + sDefaults.putString(KEY_CARRIER_CONFIG_VERSION_STRING, ""); sDefaults.putBoolean(KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL, true); sDefaults.putBoolean(KEY_CARRIER_ALLOW_DEFLECT_IMS_CALL_BOOL, false); sDefaults.putBoolean(KEY_ALWAYS_PLAY_REMOTE_HOLD_TONE_BOOL, false); diff --git a/telephony/java/android/telephony/DataSpecificRegistrationStates.java b/telephony/java/android/telephony/DataSpecificRegistrationStates.java index b6e6cbae8c26..5d809d0b7c36 100644 --- a/telephony/java/android/telephony/DataSpecificRegistrationStates.java +++ b/telephony/java/android/telephony/DataSpecificRegistrationStates.java @@ -33,17 +33,31 @@ public class DataSpecificRegistrationStates implements Parcelable{ */ public final boolean isNrAvailable; + /** + * Indicates that if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving + * cell. + * + * True the primary serving cell is LTE cell and the plmn-InfoList-r15 is present in SIB2 and + * at least one bit in this list is true, otherwise this value should be false. + * + * Reference: 3GPP TS 36.331 v15.2.2 6.3.1 System information blocks. + */ + public final boolean isEnDcAvailable; + DataSpecificRegistrationStates( - int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable) { + int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable, + boolean isEnDcAvailable) { this.maxDataCalls = maxDataCalls; this.isDcNrRestricted = isDcNrRestricted; this.isNrAvailable = isNrAvailable; + this.isEnDcAvailable = isEnDcAvailable; } private DataSpecificRegistrationStates(Parcel source) { maxDataCalls = source.readInt(); isDcNrRestricted = source.readBoolean(); isNrAvailable = source.readBoolean(); + isEnDcAvailable = source.readBoolean(); } @Override @@ -51,6 +65,7 @@ public class DataSpecificRegistrationStates implements Parcelable{ dest.writeInt(maxDataCalls); dest.writeBoolean(isDcNrRestricted); dest.writeBoolean(isNrAvailable); + dest.writeBoolean(isEnDcAvailable); } @Override @@ -65,13 +80,14 @@ public class DataSpecificRegistrationStates implements Parcelable{ .append(" maxDataCalls = " + maxDataCalls) .append(" isDcNrRestricted = " + isDcNrRestricted) .append(" isNrAvailable = " + isNrAvailable) + .append(" isEnDcAvailable = " + isEnDcAvailable) .append(" }") .toString(); } @Override public int hashCode() { - return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable); + return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable, isEnDcAvailable); } @Override @@ -83,7 +99,8 @@ public class DataSpecificRegistrationStates implements Parcelable{ DataSpecificRegistrationStates other = (DataSpecificRegistrationStates) o; return this.maxDataCalls == other.maxDataCalls && this.isDcNrRestricted == other.isDcNrRestricted - && this.isNrAvailable == other.isNrAvailable; + && this.isNrAvailable == other.isNrAvailable + && this.isEnDcAvailable == other.isEnDcAvailable; } public static final Parcelable.Creator<DataSpecificRegistrationStates> CREATOR = diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationState.java index aee744fac20c..b00665e26ff2 100644 --- a/telephony/java/android/telephony/NetworkRegistrationState.java +++ b/telephony/java/android/telephony/NetworkRegistrationState.java @@ -219,12 +219,13 @@ public class NetworkRegistrationState implements Parcelable { public NetworkRegistrationState(int domain, int transportType, int regState, int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls, - boolean isDcNrRestricted, boolean isNrAvailable) { + boolean isDcNrRestricted, boolean isNrAvailable, boolean isEndcAvailable) { this(domain, transportType, regState, accessNetworkTechnology, rejectCause, emergencyOnly, availableServices, cellIdentity); mDataSpecificStates = new DataSpecificRegistrationStates( - maxDataCalls, isDcNrRestricted, isNrAvailable); + maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable); + updateNrStatus(mDataSpecificStates); } protected NetworkRegistrationState(Parcel source) { @@ -448,6 +449,34 @@ public class NetworkRegistrationState implements Parcelable { dest.writeInt(mNrStatus); } + /** + * Use the 5G NR Non-Standalone indicators from the network registration state to update the + * NR status. There are 3 indicators in the network registration state: + * + * 1. if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving cell. + * 2. if NR is supported by the selected PLMN. + * 3. if the use of dual connectivity with NR is restricted. + * + * The network has 5G NR capability if E-UTRA-NR Dual Connectivity is supported by the primary + * serving cell. + * + * The use of NR 5G is not restricted If the network has 5G NR capability and both the use of + * DCNR is not restricted and NR is supported by the selected PLMN. Otherwise the use of 5G + * NR is restricted. + * + * @param state data specific registration state contains the 5G NR indicators. + */ + private void updateNrStatus(DataSpecificRegistrationStates state) { + mNrStatus = NR_STATUS_NONE; + if (state.isEnDcAvailable) { + if (!state.isDcNrRestricted && state.isNrAvailable) { + mNrStatus = NR_STATUS_NOT_RESTRICTED; + } else { + mNrStatus = NR_STATUS_RESTRICTED; + } + } + } + public static final Parcelable.Creator<NetworkRegistrationState> CREATOR = new Parcelable.Creator<NetworkRegistrationState>() { @Override diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java index da3acc2eedfe..448207424d59 100644 --- a/telephony/java/android/telephony/RadioAccessFamily.java +++ b/telephony/java/android/telephony/RadioAccessFamily.java @@ -460,6 +460,9 @@ public class RadioAccessFamily implements Parcelable { if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA)) != 0) { networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA; } + if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_NR)) != 0) { + networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_NR; + } return (networkTypeRaf == 0) ? TelephonyManager.NETWORK_TYPE_UNKNOWN : networkTypeRaf; } diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 777d219449a2..13fbeaaa02b7 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -223,9 +223,15 @@ public class ServiceState implements Parcelable { public static final int RIL_RADIO_TECHNOLOGY_LTE_CA = 19; /** - * Number of radio technologies for GSM, UMTS and CDMA. + * NR(New Radio) 5G. + * @hide + */ + public static final int RIL_RADIO_TECHNOLOGY_NR = 20; + + /** + * The number of the radio technologies. */ - private static final int NEXT_RIL_RADIO_TECHNOLOGY = 20; + private static final int NEXT_RIL_RADIO_TECHNOLOGY = 21; /** @hide */ public static final int RIL_RADIO_CDMA_TECHNOLOGY_BITMASK = diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index bacfe61a1a10..dacc5d86e9ae 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -155,6 +155,14 @@ public class SubscriptionInfo implements Parcelable { private boolean mIsMetered; /** + * Whether group of the subscription is disabled. + * This is only useful if it's a grouped opportunistic subscription. In this case, if all + * primary (non-opportunistic) subscriptions in the group are deactivated (unplugged pSIM + * or deactivated eSIM profile), we should disable this opportunistic subscription. + */ + private boolean mIsGroupDisabled = false; + + /** * @hide */ public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName, @@ -174,6 +182,18 @@ public class SubscriptionInfo implements Parcelable { Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded, @Nullable UiccAccessRule[] accessRules, String cardId, boolean isOpportunistic, @Nullable String groupUUID, boolean isMetered) { + this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, + roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardId, + isOpportunistic, groupUUID, isMetered, false); + } + /** + * @hide + */ + public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName, + CharSequence carrierName, int nameSource, int iconTint, String number, int roaming, + Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded, + @Nullable UiccAccessRule[] accessRules, String cardId, boolean isOpportunistic, + @Nullable String groupUUID, boolean isMetered, boolean isGroupDisabled) { this.mId = id; this.mIccId = iccId; this.mSimSlotIndex = simSlotIndex; @@ -193,6 +213,7 @@ public class SubscriptionInfo implements Parcelable { this.mIsOpportunistic = isOpportunistic; this.mGroupUUID = groupUUID; this.mIsMetered = isMetered; + this.mIsGroupDisabled = isGroupDisabled; } @@ -494,6 +515,22 @@ public class SubscriptionInfo implements Parcelable { return this.mCardId; } + /** + * Set whether the subscription's group is disabled. + * @hide + */ + public void setGroupDisabled(boolean isGroupDisabled) { + this.mIsGroupDisabled = isGroupDisabled; + } + + /** + * Return whether the subscription's group is disabled. + * @hide + */ + public boolean isGroupDisabled() { + return mIsGroupDisabled; + } + public static final Parcelable.Creator<SubscriptionInfo> CREATOR = new Parcelable.Creator<SubscriptionInfo>() { @Override public SubscriptionInfo createFromParcel(Parcel source) { @@ -516,10 +553,12 @@ public class SubscriptionInfo implements Parcelable { boolean isOpportunistic = source.readBoolean(); String groupUUID = source.readString(); boolean isMetered = source.readBoolean(); + boolean isGroupDisabled = source.readBoolean(); return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso, - isEmbedded, accessRules, cardId, isOpportunistic, groupUUID, isMetered); + isEmbedded, accessRules, cardId, isOpportunistic, groupUUID, isMetered, + isGroupDisabled); } @Override @@ -549,6 +588,7 @@ public class SubscriptionInfo implements Parcelable { dest.writeBoolean(mIsOpportunistic); dest.writeString(mGroupUUID); dest.writeBoolean(mIsMetered); + dest.writeBoolean(mIsGroupDisabled); } @Override @@ -582,14 +622,15 @@ public class SubscriptionInfo implements Parcelable { + " mnc " + mMnc + "mCountryIso=" + mCountryIso + " isEmbedded " + mIsEmbedded + " accessRules " + Arrays.toString(mAccessRules) + " cardId=" + cardIdToPrint + " isOpportunistic " + mIsOpportunistic - + " mGroupUUID=" + mGroupUUID + " isMetered=" + mIsMetered + "}"; + + " mGroupUUID=" + mGroupUUID + " isMetered=" + mIsMetered + + " mIsGroupDisabled=" + mIsGroupDisabled + "}"; } @Override public int hashCode() { return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded, mIsOpportunistic, mGroupUUID, mIsMetered, mIccId, mNumber, mMcc, mMnc, - mCountryIso, mCardId, mDisplayName, mCarrierName, mAccessRules); + mCountryIso, mCardId, mDisplayName, mCarrierName, mAccessRules, mIsGroupDisabled); } @Override @@ -611,6 +652,7 @@ public class SubscriptionInfo implements Parcelable { && mDataRoaming == toCompare.mDataRoaming && mIsEmbedded == toCompare.mIsEmbedded && mIsOpportunistic == toCompare.mIsOpportunistic + && mIsGroupDisabled == toCompare.mIsGroupDisabled && Objects.equals(mGroupUUID, toCompare.mGroupUUID) && mIsMetered == toCompare.mIsMetered && Objects.equals(mIccId, toCompare.mIccId) @@ -623,4 +665,4 @@ public class SubscriptionInfo implements Parcelable { && TextUtils.equals(mCarrierName, toCompare.mCarrierName) && Arrays.equals(mAccessRules, toCompare.mAccessRules); } -}
\ No newline at end of file +} diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 585c0e40d478..a976fe6ef2fe 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -2218,9 +2218,11 @@ public class TelephonyManager { /** Current network is LTE_CA {@hide} */ @UnsupportedAppUsage public static final int NETWORK_TYPE_LTE_CA = TelephonyProtoEnums.NETWORK_TYPE_LTE_CA; // = 19. + /** Current network is NR(New Radio) 5G. */ + public static final int NETWORK_TYPE_NR = TelephonyProtoEnums.NETWORK_TYPE_NR; // 20. /** Max network type number. Update as new types are added. Don't add negative types. {@hide} */ - public static final int MAX_NETWORK_TYPE = NETWORK_TYPE_LTE_CA; + public static final int MAX_NETWORK_TYPE = NETWORK_TYPE_NR; /** @hide */ @IntDef({ @@ -2244,6 +2246,7 @@ public class TelephonyManager { NETWORK_TYPE_TD_SCDMA, NETWORK_TYPE_IWLAN, NETWORK_TYPE_LTE_CA, + NETWORK_TYPE_NR, }) @Retention(RetentionPolicy.SOURCE) public @interface NetworkType{} @@ -9272,6 +9275,7 @@ public class TelephonyManager { NETWORK_TYPE_BITMASK_TD_SCDMA, NETWORK_TYPE_BITMASK_LTE, NETWORK_TYPE_BITMASK_LTE_CA, + NETWORK_TYPE_BITMASK_NR, }) public @interface NetworkTypeBitMask {} @@ -9388,6 +9392,13 @@ public class TelephonyManager { public static final int NETWORK_TYPE_BITMASK_LTE_CA = (1 << NETWORK_TYPE_LTE_CA); /** + * network type bitmask indicating the support of radio tech NR(New Radio) 5G. + * @hide + */ + @SystemApi + public static final int NETWORK_TYPE_BITMASK_NR = (1 << NETWORK_TYPE_NR); + + /** * @return Modem supported radio access family bitmask * * <p>Requires permission: {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} or |