diff options
49 files changed, 500 insertions, 395 deletions
diff --git a/Android.mk b/Android.mk index 09f2c40e7202..aea0c951052f 100644 --- a/Android.mk +++ b/Android.mk @@ -42,6 +42,8 @@ $(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_TEST_API_FILE)) $(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_API_FILE):apistubs/android/public/api/android.txt) $(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_SYSTEM_API_FILE):apistubs/android/system/api/android.txt) $(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_TEST_API_FILE):apistubs/android/test/api/android.txt) +$(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_MODULE_LIB_API_FILE):apistubs/android/module-lib/api/android.txt) +$(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_SYSTEM_SERVER_API_FILE):apistubs/android/system-server/api/android.txt) # sdk.atree needs to copy the whole dir: $(OUT_DOCS)/offline-sdk to the final zip. # So keep offline-sdk-timestamp target here, and unzip offline-sdk-docs.zip to diff --git a/StubLibraries.bp b/StubLibraries.bp index 9a52cf69ef3d..0931fd4b6a74 100644 --- a/StubLibraries.bp +++ b/StubLibraries.bp @@ -187,6 +187,7 @@ droidstubs { droidstubs { name: "module-lib-api", defaults: ["metalava-full-api-stubs-default"], + api_tag_name: "MODULE_LIB", arg_files: ["core/res/AndroidManifest.xml"], args: metalava_framework_docs_args + module_libs, check_api: { diff --git a/api/current.txt b/api/current.txt index 00a6c24f2c28..770be339a4e7 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44727,12 +44727,9 @@ package android.telephony { field public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX"; field public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX"; field public static final String IMSI_KEY_AVAILABILITY_INT = "imsi_key_availability_int"; - field public static final String KEY_5G_ICON_CONFIGURATION_STRING = "5g_icon_configuration_string"; - field public static final String KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT = "5g_icon_display_grace_period_sec_int"; field public static final String KEY_5G_NR_SSRSRP_THRESHOLDS_INT_ARRAY = "5g_nr_ssrsrp_thresholds_int_array"; field public static final String KEY_5G_NR_SSRSRQ_THRESHOLDS_INT_ARRAY = "5g_nr_ssrsrq_thresholds_int_array"; field public static final String KEY_5G_NR_SSSINR_THRESHOLDS_INT_ARRAY = "5g_nr_sssinr_thresholds_int_array"; - field public static final String KEY_5G_WATCHDOG_TIME_MS_LONG = "5g_watchdog_time_long"; field public static final String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool"; field public static final String KEY_ALLOW_ADDING_APNS_BOOL = "allow_adding_apns_bool"; field public static final String KEY_ALLOW_ADD_CALL_DURING_VIDEO_CALL_BOOL = "allow_add_call_during_video_call"; @@ -44925,7 +44922,6 @@ package android.telephony { field public static final String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool"; field public static final String KEY_SHOW_BLOCKING_PAY_PHONE_OPTION_BOOL = "show_blocking_pay_phone_option_bool"; field public static final String KEY_SHOW_CALL_BLOCKING_DISABLED_NOTIFICATION_ALWAYS_BOOL = "show_call_blocking_disabled_notification_always_bool"; - field public static final String KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING = "show_carrier_data_icon_pattern_string"; field public static final String KEY_SHOW_CDMA_CHOICES_BOOL = "show_cdma_choices_bool"; field public static final String KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL = "show_iccid_in_sim_status_bool"; field public static final String KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL = "show_ims_registration_status_bool"; @@ -45017,7 +45013,7 @@ package android.telephony { public final class CellIdentityLte extends android.telephony.CellIdentity { method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns(); - method @NonNull public java.util.List<java.lang.Integer> getBands(); + method @NonNull public int[] getBands(); method public int getBandwidth(); method public int getCi(); method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo(); @@ -45035,7 +45031,7 @@ package android.telephony { public final class CellIdentityNr extends android.telephony.CellIdentity { method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns(); - method @NonNull public java.util.List<java.lang.Integer> getBands(); + method @NonNull public int[] getBands(); method @Nullable public String getMccString(); method @Nullable public String getMncString(); method public long getNci(); @@ -45350,7 +45346,6 @@ package android.telephony { method @NonNull public java.util.List<java.lang.Integer> getAvailableServices(); method @Nullable public android.telephony.CellIdentity getCellIdentity(); method public int getDomain(); - method public int getNrState(); method @Nullable public String getRegisteredPlmn(); method public int getTransportType(); method public boolean isRegistered(); @@ -45877,7 +45872,7 @@ package android.telephony { method public long getDataLimitBytes(); method public long getDataUsageBytes(); method public long getDataUsageTime(); - method @Nullable public int[] getNetworkTypes(); + method @NonNull public int[] getNetworkTypes(); method @Nullable public CharSequence getSummary(); method @Nullable public CharSequence getTitle(); method public void writeToParcel(android.os.Parcel, int); @@ -45897,7 +45892,7 @@ package android.telephony { method public static android.telephony.SubscriptionPlan.Builder createRecurring(java.time.ZonedDateTime, java.time.Period); method public android.telephony.SubscriptionPlan.Builder setDataLimit(long, int); method public android.telephony.SubscriptionPlan.Builder setDataUsage(long, long); - method @NonNull public android.telephony.SubscriptionPlan.Builder setNetworkTypes(@Nullable int[]); + method @NonNull public android.telephony.SubscriptionPlan.Builder setNetworkTypes(@NonNull int[]); method public android.telephony.SubscriptionPlan.Builder setSummary(@Nullable CharSequence); method public android.telephony.SubscriptionPlan.Builder setTitle(@Nullable CharSequence); } @@ -46003,6 +45998,7 @@ package android.telephony { method public boolean setLine1NumberForDisplay(String, String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNetworkSelectionModeAutomatic(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(String, boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(@NonNull String, boolean, int); method public boolean setOperatorBrandOverride(String); method public boolean setPreferredNetworkTypeToGlobal(); method public void setPreferredOpportunisticDataSubscription(int, boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); @@ -46530,6 +46526,7 @@ package android.telephony.ims { public class ImsManager { method @NonNull public android.telephony.ims.ImsMmTelManager getImsMmTelManager(int); + method @NonNull public android.telephony.ims.ImsRcsManager getImsRcsManager(int); field public static final String ACTION_WFC_IMS_REGISTRATION_ERROR = "android.telephony.ims.action.WFC_IMS_REGISTRATION_ERROR"; field public static final String EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE = "android.telephony.ims.extra.WFC_REGISTRATION_FAILURE_MESSAGE"; field public static final String EXTRA_WFC_REGISTRATION_FAILURE_TITLE = "android.telephony.ims.extra.WFC_REGISTRATION_FAILURE_TITLE"; @@ -46558,6 +46555,15 @@ package android.telephony.ims { method public void onCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.MmTelFeature.MmTelCapabilities); } + public class ImsRcsManager implements android.telephony.ims.RegistrationManager { + method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); + method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); + method @NonNull public android.telephony.ims.RcsUceAdapter getUceAdapter(); + method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException; + method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback); + field public static final String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN = "android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN"; + } + public final class ImsReasonInfo implements android.os.Parcelable { ctor public ImsReasonInfo(int, int, @Nullable String); method public int describeContents(); @@ -46741,6 +46747,10 @@ package android.telephony.ims { field public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2; // 0x2 } + public class RcsUceAdapter { + method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException; + } + public interface RegistrationManager { method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); diff --git a/api/system-current.txt b/api/system-current.txt index 7c7bda53f39c..4e97dc5d8240 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -229,9 +229,6 @@ package android { public static final class R.array { field public static final int config_keySystemUuidMapping = 17235973; // 0x1070005 - field public static final int config_restrictedPreinstalledCarrierApps = 17235975; // 0x1070007 - field public static final int config_sms_enabled_locking_shift_tables = 17235977; // 0x1070009 - field public static final int config_sms_enabled_single_shift_tables = 17235976; // 0x1070008 field public static final int simColors = 17235974; // 0x1070006 } @@ -279,7 +276,6 @@ package android { field public static final int config_helpIntentNameKey = 17039390; // 0x104001e field public static final int config_helpPackageNameKey = 17039387; // 0x104001b field public static final int config_helpPackageNameValue = 17039388; // 0x104001c - field public static final int low_memory = 17039397; // 0x1040025 } public static final class R.style { @@ -324,7 +320,6 @@ package android.app { method @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS) public static void setPersistentVrThread(int); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean switchUser(@NonNull android.os.UserHandle); method public void unregisterHomeVisibilityObserver(@NonNull android.app.HomeVisibilityObserver); - method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public boolean updateMccMncConfiguration(@NonNull String, @NonNull String); } public static interface ActivityManager.OnUidImportanceListener { @@ -1542,7 +1537,6 @@ package android.content { field public static final String EUICC_CARD_SERVICE = "euicc_card"; field public static final String HDMI_CONTROL_SERVICE = "hdmi_control"; field public static final String NETD_SERVICE = "netd"; - field public static final String NETWORK_POLICY_SERVICE = "netpolicy"; field public static final String NETWORK_SCORE_SERVICE = "network_score"; field public static final String OEM_LOCK_SERVICE = "oem_lock"; field public static final String PERMISSION_SERVICE = "permission"; @@ -8013,27 +8007,6 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallAttributes> CREATOR; } - public final class CallForwardingInfo implements android.os.Parcelable { - ctor public CallForwardingInfo(int, int, @Nullable String, int); - method public int describeContents(); - method @Nullable public String getNumber(); - method public int getReason(); - method public int getStatus(); - method public int getTimeoutSeconds(); - field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallForwardingInfo> CREATOR; - field public static final int REASON_ALL = 4; // 0x4 - field public static final int REASON_ALL_CONDITIONAL = 5; // 0x5 - field public static final int REASON_BUSY = 1; // 0x1 - field public static final int REASON_NOT_REACHABLE = 3; // 0x3 - field public static final int REASON_NO_REPLY = 2; // 0x2 - field public static final int REASON_UNCONDITIONAL = 0; // 0x0 - field public static final int STATUS_ACTIVE = 1; // 0x1 - field public static final int STATUS_FDN_CHECK_FAILURE = 2; // 0x2 - field public static final int STATUS_INACTIVE = 0; // 0x0 - field public static final int STATUS_NOT_SUPPORTED = 4; // 0x4 - field public static final int STATUS_UNKNOWN_ERROR = 3; // 0x3 - } - public final class CallQuality implements android.os.Parcelable { ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int); ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, boolean); @@ -8521,7 +8494,6 @@ package android.telephony { public final class DataSpecificRegistrationInfo implements android.os.Parcelable { method public int describeContents(); method @NonNull public android.telephony.LteVopsSupportInfo getLteVopsSupportInfo(); - method public boolean isUsingCarrierAggregation(); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR; } @@ -8743,7 +8715,6 @@ package android.telephony { method public void onRadioPowerStateChanged(int); method public void onSrvccStateChanged(int); method public void onVoiceActivationStateChanged(int); - field @RequiresPermission(android.Manifest.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH) public static final int LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH = 512; // 0x200 field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_CALL_ATTRIBUTES_CHANGED = 67108864; // 0x4000000 field @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int LISTEN_OUTGOING_EMERGENCY_CALL = 268435456; // 0x10000000 field @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public static final int LISTEN_OUTGOING_EMERGENCY_SMS = 536870912; // 0x20000000 @@ -8774,7 +8745,6 @@ package android.telephony { } public final class PreciseDataConnectionState implements android.os.Parcelable { - ctor public PreciseDataConnectionState(int, int, int, @NonNull String, @Nullable android.net.LinkProperties, int, @Nullable android.telephony.data.ApnSetting); method @Deprecated @NonNull public String getDataConnectionApn(); method @Deprecated public int getDataConnectionApnTypeBitMask(); method @Deprecated public int getDataConnectionFailCause(); @@ -8887,7 +8857,6 @@ package android.telephony { method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int); method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForDomain(int); method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForTransportType(int); - method public int getNrFrequencyRange(); method @Nullable public String getOperatorAlphaLongRaw(); method @Nullable public String getOperatorAlphaShortRaw(); method @NonNull public static android.telephony.ServiceState newFromBundle(@NonNull android.os.Bundle); @@ -9119,8 +9088,6 @@ package android.telephony { method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int); method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypes(); - method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.CallForwardingInfo getCallForwarding(int); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCallWaitingStatus(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int); @@ -9203,15 +9170,12 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAlwaysAllowMmsData(boolean); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCallForwarding(@NonNull android.telephony.CallForwardingInfo); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCallWaitingStatus(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(@NonNull String, int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunisticNetworkState(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean); @@ -9245,10 +9209,6 @@ package android.telephony { field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; - field public static final int CALL_WAITING_STATUS_ACTIVE = 1; // 0x1 - field public static final int CALL_WAITING_STATUS_INACTIVE = 2; // 0x2 - field public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; // 0x4 - field public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; // 0x3 field public static final int CARD_POWER_DOWN = 0; // 0x0 field public static final int CARD_POWER_UP = 1; // 0x1 field public static final int CARD_POWER_UP_PASS_THROUGH = 2; // 0x2 @@ -9876,7 +9836,6 @@ package android.telephony.ims { } public class ImsManager { - method @NonNull public android.telephony.ims.ImsRcsManager getImsRcsManager(int); field public static final String ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION = "com.android.internal.intent.action.ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION"; } @@ -9904,10 +9863,6 @@ package android.telephony.ims { ctor @Deprecated public ImsMmTelManager.RegistrationCallback(); } - public class ImsRcsManager implements android.telephony.ims.RegistrationManager { - method @NonNull public android.telephony.ims.RcsUceAdapter getUceAdapter(); - } - public final class ImsReasonInfo implements android.os.Parcelable { field public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED = "Forbidden. Not Authorized for Service"; } @@ -10284,7 +10239,6 @@ package android.telephony.ims { } public class RcsUceAdapter { - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean) throws android.telephony.ims.ImsException; } diff --git a/api/system-lint-baseline.txt b/api/system-lint-baseline.txt index d2b3a6446346..306b8afaadae 100644 --- a/api/system-lint-baseline.txt +++ b/api/system-lint-baseline.txt @@ -165,12 +165,6 @@ PublicTypedef: android.content.integrity.Formula.Tag: Don't expose @IntDef: @Tag PublicTypedef: android.content.integrity.Rule.Effect: Don't expose @IntDef: @Effect must be hidden. -ResourceValueFieldName: android.R.array#config_sms_enabled_locking_shift_tables: - Expected resource name in `android.R.array` to be in the `fooBarBaz` style, was `config_sms_enabled_locking_shift_tables` -ResourceValueFieldName: android.R.array#config_sms_enabled_single_shift_tables: - Expected resource name in `android.R.array` to be in the `fooBarBaz` style, was `config_sms_enabled_single_shift_tables` - - SamShouldBeLast: android.accounts.AccountManager#addAccount(String, String, String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler): SamShouldBeLast: android.accounts.AccountManager#addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean): diff --git a/api/test-current.txt b/api/test-current.txt index 2d967871fc43..73abb27ec779 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -62,7 +62,6 @@ package android.app { method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener); method public static void resumeAppSwitches() throws android.os.RemoteException; method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int); - method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public boolean updateMccMncConfiguration(@NonNull String, @NonNull String); } public static interface ActivityManager.OnUidImportanceListener { @@ -3490,7 +3489,6 @@ package android.telephony.ims { } public class ImsManager { - method @NonNull public android.telephony.ims.ImsRcsManager getImsRcsManager(int); field public static final String ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION = "com.android.internal.intent.action.ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION"; } @@ -3518,10 +3516,6 @@ package android.telephony.ims { ctor @Deprecated public ImsMmTelManager.RegistrationCallback(); } - public class ImsRcsManager implements android.telephony.ims.RegistrationManager { - method @NonNull public android.telephony.ims.RcsUceAdapter getUceAdapter(); - } - public class ImsService extends android.app.Service { ctor public ImsService(); method public android.telephony.ims.feature.MmTelFeature createMmTelFeature(int); @@ -3894,7 +3888,6 @@ package android.telephony.ims { } public class RcsUceAdapter { - method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean) throws android.telephony.ims.ImsException; } diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 1e50077e1dc9..9d63bc2ef85a 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -3880,8 +3880,6 @@ public class ActivityManager { * {@code false} otherwise. * @hide */ - @SystemApi - @TestApi @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public boolean updateMccMncConfiguration(@NonNull String mcc, @NonNull String mnc) { if (mcc == null || mnc == null) { diff --git a/core/java/android/bluetooth/BluetoothHearingAid.java b/core/java/android/bluetooth/BluetoothHearingAid.java index e0674d75974a..fa62a02499e0 100644 --- a/core/java/android/bluetooth/BluetoothHearingAid.java +++ b/core/java/android/bluetooth/BluetoothHearingAid.java @@ -379,6 +379,7 @@ public final class BluetoothHearingAid implements BluetoothProfile { public boolean setConnectionPolicy(@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) { if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")"); + verifyDeviceNotNull(device, "setConnectionPolicy"); final IBluetoothHearingAid service = getService(); try { if (service != null && isEnabled() @@ -428,6 +429,7 @@ public final class BluetoothHearingAid implements BluetoothProfile { @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) { if (VDBG) log("getConnectionPolicy(" + device + ")"); + verifyDeviceNotNull(device, "getConnectionPolicy"); final IBluetoothHearingAid service = getService(); try { if (service != null && isEnabled() @@ -504,6 +506,7 @@ public final class BluetoothHearingAid implements BluetoothProfile { if (VDBG) { log("getHiSyncId(" + device + ")"); } + verifyDeviceNotNull(device, "getConnectionPolicy"); final IBluetoothHearingAid service = getService(); try { if (service == null) { @@ -577,6 +580,13 @@ public final class BluetoothHearingAid implements BluetoothProfile { return false; } + private void verifyDeviceNotNull(BluetoothDevice device, String methodName) { + if (device == null) { + Log.e(TAG, methodName + ": device param is null"); + throw new IllegalArgumentException("Device cannot be null"); + } + } + private boolean isValidDevice(BluetoothDevice device) { if (device == null) return false; diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 2f621c3cd1f6..b79965eb4c21 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3945,8 +3945,6 @@ public abstract class Context { */ public static final String NETWORK_STATS_SERVICE = "netstats"; /** {@hide} */ - @SystemApi - @SuppressLint("ServiceName") public static final String NETWORK_POLICY_SERVICE = "netpolicy"; /** {@hide} */ public static final String NETWORK_WATCHLIST_SERVICE = "network_watchlist"; diff --git a/core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl b/core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl index 0ae353d2741f..5d8f6d126a89 100644 --- a/core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl +++ b/core/java/android/os/incremental/IncrementalFileSystemControlParcel.aidl @@ -17,11 +17,12 @@ package android.os.incremental; /** - * Wraps two file descriptors that Incremental Service uses to communicate + * Wraps the file descriptors Incremental Service uses to communicate * with Incremental FileSystem. * @hide */ parcelable IncrementalFileSystemControlParcel { @nullable ParcelFileDescriptor cmd; + @nullable ParcelFileDescriptor pendingReads; @nullable ParcelFileDescriptor log; } diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java index ab31d247bb73..f8b9f584c6c9 100644 --- a/core/java/android/telephony/PhoneStateListener.java +++ b/core/java/android/telephony/PhoneStateListener.java @@ -176,7 +176,6 @@ public class PhoneStateListener { * @hide */ @RequiresPermission(android.Manifest.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH) - @SystemApi public static final int LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH = 0x00000200; /** diff --git a/core/java/android/telephony/SubscriptionPlan.java b/core/java/android/telephony/SubscriptionPlan.java index ff2f4ad5378c..901957f6ca4a 100644 --- a/core/java/android/telephony/SubscriptionPlan.java +++ b/core/java/android/telephony/SubscriptionPlan.java @@ -91,10 +91,11 @@ public final class SubscriptionPlan implements Parcelable { private long dataUsageBytes = BYTES_UNKNOWN; private long dataUsageTime = TIME_UNKNOWN; private @NetworkType int[] networkTypes; - private long networkTypesBitMask; private SubscriptionPlan(RecurrenceRule cycleRule) { this.cycleRule = Preconditions.checkNotNull(cycleRule); + this.networkTypes = Arrays.copyOf(TelephonyManager.getAllNetworkTypes(), + TelephonyManager.getAllNetworkTypes().length); } private SubscriptionPlan(Parcel source) { @@ -221,10 +222,10 @@ public final class SubscriptionPlan implements Parcelable { /** * Return an array containing all {@link NetworkType}s this SubscriptionPlan applies to. - * A null value means this SubscriptionPlan applies to all network types. + * @see TelephonyManager for network types values */ - public @Nullable @NetworkType int[] getNetworkTypes() { - return networkTypes; + public @NonNull @NetworkType int[] getNetworkTypes() { + return Arrays.copyOf(networkTypes, networkTypes.length); } /** @@ -361,14 +362,14 @@ public final class SubscriptionPlan implements Parcelable { } /** - * Set the network types this SubscriptionPlan applies to. + * Set the network types this SubscriptionPlan applies to. By default the plan will apply + * to all network types. An empty array means this plan applies to no network types. * - * @param networkTypes a set of all {@link NetworkType}s that apply to this plan. - * A null value means the plan applies to all network types, - * and an empty array means the plan applies to no network types. + * @param networkTypes an array of all {@link NetworkType}s that apply to this plan. + * @see TelephonyManager for network type values */ - public @NonNull Builder setNetworkTypes(@Nullable @NetworkType int[] networkTypes) { - plan.networkTypes = networkTypes; + public @NonNull Builder setNetworkTypes(@NonNull @NetworkType int[] networkTypes) { + plan.networkTypes = Arrays.copyOf(networkTypes, networkTypes.length); return this; } } diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java index 73cd708f43f7..e3620426049f 100644 --- a/core/java/android/telephony/TelephonyRegistryManager.java +++ b/core/java/android/telephony/TelephonyRegistryManager.java @@ -26,8 +26,10 @@ import android.os.ServiceManager; import android.telephony.Annotation.CallState; import android.telephony.Annotation.DataActivityType; import android.telephony.Annotation.DataFailureCause; +import android.telephony.Annotation.DisconnectCauses; import android.telephony.Annotation.NetworkType; import android.telephony.Annotation.PreciseCallStates; +import android.telephony.Annotation.PreciseDisconnectCauses; import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.Annotation.SrvccState; @@ -229,11 +231,9 @@ public class TelephonyRegistryManager { * invalid. * @param state latest call state. e.g, offhook, ringing * @param incomingNumber incoming phone number. - * - * @hide */ public void notifyCallStateChanged(int subId, int slotIndex, @CallState int state, - String incomingNumber) { + @Nullable String incomingNumber) { try { sRegistry.notifyCallState(slotIndex, subId, state, incomingNumber); } catch (RemoteException ex) { @@ -266,10 +266,8 @@ public class TelephonyRegistryManager { * @param slotIndex for which the service state changed. Can be derived from subId except * subId is invalid. * @param state service state e.g, in service, out of service or roaming status. - * - * @hide */ - public void notifyServiceStateChanged(int subId, int slotIndex, ServiceState state) { + public void notifyServiceStateChanged(int subId, int slotIndex, @NonNull ServiceState state) { try { sRegistry.notifyServiceStateForPhoneId(slotIndex, subId, state); } catch (RemoteException ex) { @@ -284,11 +282,9 @@ public class TelephonyRegistryManager { * @param slotIndex for which the signalstrength changed. Can be derived from subId except when * subId is invalid. * @param signalStrength e.g, signalstrength level {@see SignalStrength#getLevel()} - * - * @hide */ public void notifySignalStrengthChanged(int subId, int slotIndex, - SignalStrength signalStrength) { + @NonNull SignalStrength signalStrength) { try { sRegistry.notifySignalStrengthForPhoneId(slotIndex, subId, signalStrength); } catch (RemoteException ex) { @@ -305,8 +301,6 @@ public class TelephonyRegistryManager { * except when subId is invalid. * @param msgWaitingInd {@code true} indicates there is message-waiting indicator, {@code false} * otherwise. - * - * @hide */ public void notifyMessageWaitingChanged(int subId, int slotIndex, boolean msgWaitingInd) { try { @@ -322,8 +316,6 @@ public class TelephonyRegistryManager { * @param subId for which call forwarding status changed. * @param callForwardInd {@code true} indicates there is call forwarding, {@code false} * otherwise. - * - * @hide */ public void notifyCallForwardingChanged(int subId, boolean callForwardInd) { try { @@ -339,8 +331,6 @@ public class TelephonyRegistryManager { * @param subId for which data activity state changed. * @param dataActivityType indicates the latest data activity type e.g, {@link * TelephonyManager#DATA_ACTIVITY_IN} - * - * @hide */ public void notifyDataActivityChanged(int subId, @DataActivityType int dataActivityType) { try { @@ -361,10 +351,9 @@ public class TelephonyRegistryManager { * * @see android.telephony.PreciseDataConnection * @see TelephonyManager#DATA_DISCONNECTED - * @hide */ public void notifyDataConnectionForSubscriber(int slotIndex, int subId, - String apnType, PreciseDataConnectionState preciseState) { + String apnType, @Nullable PreciseDataConnectionState preciseState) { try { sRegistry.notifyDataConnectionForSubscriber( slotIndex, subId, apnType, preciseState); @@ -381,10 +370,8 @@ public class TelephonyRegistryManager { * subId is invalid. * @param callQuality Information about call quality e.g, call quality level * @param networkType associated with this data connection. e.g, LTE - * - * @hide */ - public void notifyCallQualityChanged(int subId, int slotIndex, CallQuality callQuality, + public void notifyCallQualityChanged(int subId, int slotIndex, @NonNull CallQuality callQuality, @NetworkType int networkType) { try { sRegistry.notifyCallQualityChanged(callQuality, slotIndex, subId, networkType); @@ -399,8 +386,6 @@ public class TelephonyRegistryManager { * @param subId for which emergency number list changed. * @param slotIndex for which emergency number list changed. Can be derived from subId except * when subId is invalid. - * - * @hide */ public void notifyEmergencyNumberList(int subId, int slotIndex) { try { @@ -417,8 +402,6 @@ public class TelephonyRegistryManager { * @param slotIndex for which radio power state changed. Can be derived from subId except when * subId is invalid. * @param radioPowerState the current modem radio state. - * - * @hide */ public void notifyRadioPowerStateChanged(int subId, int slotIndex, @RadioPowerState int radioPowerState) { @@ -433,10 +416,8 @@ public class TelephonyRegistryManager { * Notify {@link PhoneCapability} changed. * * @param phoneCapability the capability of the modem group. - * - * @hide */ - public void notifyPhoneCapabilityChanged(PhoneCapability phoneCapability) { + public void notifyPhoneCapabilityChanged(@NonNull PhoneCapability phoneCapability) { try { sRegistry.notifyPhoneCapabilityChanged(phoneCapability); } catch (RemoteException ex) { @@ -465,8 +446,6 @@ public class TelephonyRegistryManager { * @param slotIndex for which data activation state changed. Can be derived from subId except * when subId is invalid. * @param activationState sim activation state e.g, activated. - * - * @hide */ public void notifyDataActivationStateChanged(int subId, int slotIndex, @SimActivationState int activationState) { @@ -486,8 +465,6 @@ public class TelephonyRegistryManager { * @param slotIndex for which voice activation state changed. Can be derived from subId except * subId is invalid. * @param activationState sim activation state e.g, activated. - * - * @hide */ public void notifyVoiceActivationStateChanged(int subId, int slotIndex, @SimActivationState int activationState) { @@ -507,8 +484,6 @@ public class TelephonyRegistryManager { * @param slotIndex for which mobile data state has changed. Can be derived from subId except * when subId is invalid. * @param state {@code true} indicates mobile data is enabled/on. {@code false} otherwise. - * - * @hide */ public void notifyUserMobileDataStateChanged(int slotIndex, int subId, boolean state) { try { @@ -519,23 +494,6 @@ public class TelephonyRegistryManager { } /** - * TODO: this is marked as deprecated, can we move this one safely? - * - * @param subId - * @param slotIndex - * @param rawData - * - * @hide - */ - public void notifyOemHookRawEventForSubscriber(int subId, int slotIndex, byte[] rawData) { - try { - sRegistry.notifyOemHookRawEventForSubscriber(slotIndex, subId, rawData); - } catch (RemoteException ex) { - // system process is dead - } - } - - /** * Notify display info changed. * * @param slotIndex The SIM slot index for which display info has changed. Can be @@ -558,10 +516,8 @@ public class TelephonyRegistryManager { * * @param subId for which ims call disconnect. * @param imsReasonInfo the reason for ims call disconnect. - * - * @hide */ - public void notifyImsDisconnectCause(int subId, ImsReasonInfo imsReasonInfo) { + public void notifyImsDisconnectCause(int subId, @NonNull ImsReasonInfo imsReasonInfo) { try { sRegistry.notifyImsDisconnectCause(subId, imsReasonInfo); } catch (RemoteException ex) { @@ -578,11 +534,9 @@ public class TelephonyRegistryManager { * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN. * @param apn the APN {@link ApnSetting#getApnName()} of this data connection. * @param failCause data fail cause. - * - * @hide */ public void notifyPreciseDataConnectionFailed(int subId, int slotIndex, String apnType, - String apn, @DataFailureCause int failCause) { + @Nullable String apn, @DataFailureCause int failCause) { try { sRegistry.notifyPreciseDataConnectionFailed(slotIndex, subId, apnType, apn, failCause); } catch (RemoteException ex) { @@ -596,8 +550,6 @@ public class TelephonyRegistryManager { * * @param subId for which srvcc state changed. * @param state srvcc state - * - * @hide */ public void notifySrvccStateChanged(int subId, @SrvccState int state) { try { @@ -617,8 +569,6 @@ public class TelephonyRegistryManager { * @param ringCallPreciseState ringCall state. * @param foregroundCallPreciseState foreground call state. * @param backgroundCallPreciseState background call state. - * - * @hide */ public void notifyPreciseCallState(int subId, int slotIndex, @PreciseCallStates int ringCallPreciseState, @@ -642,10 +592,9 @@ public class TelephonyRegistryManager { * @param cause {@link DisconnectCause} for the disconnected call. * @param preciseCause {@link android.telephony.PreciseDisconnectCause} for the disconnected * call. - * - * @hide */ - public void notifyDisconnectCause(int slotIndex, int subId, int cause, int preciseCause) { + public void notifyDisconnectCause(int slotIndex, int subId, @DisconnectCauses int cause, + @PreciseDisconnectCauses int preciseCause) { try { sRegistry.notifyDisconnectCause(slotIndex, subId, cause, preciseCause); } catch (RemoteException ex) { @@ -658,10 +607,8 @@ public class TelephonyRegistryManager { * * <p>To be compatible with {@link TelephonyRegistry}, use {@link CellIdentity} which is * parcelable, and convert to CellLocation in client code. - * - * @hide */ - public void notifyCellLocation(int subId, CellIdentity cellLocation) { + public void notifyCellLocation(int subId, @NonNull CellIdentity cellLocation) { try { sRegistry.notifyCellLocationForSubscriber(subId, cellLocation); } catch (RemoteException ex) { @@ -675,10 +622,8 @@ public class TelephonyRegistryManager { * * @param subId for which cellinfo changed. * @param cellInfo A list of cellInfo associated with the given subscription. - * - * @hide */ - public void notifyCellInfoChanged(int subId, List<CellInfo> cellInfo) { + public void notifyCellInfoChanged(int subId, @NonNull List<CellInfo> cellInfo) { try { sRegistry.notifyCellInfoForSubscriber(subId, cellInfo); } catch (RemoteException ex) { @@ -687,8 +632,8 @@ public class TelephonyRegistryManager { } /** - * @param activeDataSubId - * @hide + * Notify that the active data subscription ID has changed. + * @param activeDataSubId The new subscription ID for active data */ public void notifyActiveDataSubIdChanged(int activeDataSubId) { try { diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 93080e9a8016..8a7b515ee436 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -3010,8 +3010,6 @@ </public-group> <public-group type="string" first-id="0x01040025"> - <!-- @hide @SystemApi --> - <public name="low_memory" /> </public-group> <public-group type="bool" first-id="0x01110005"> @@ -3026,14 +3024,7 @@ <public-group type="array" first-id="0x01070006"> <!-- @hide @SystemApi --> <public name="simColors" /> - <!-- @hide @SystemApi --> - <public name="config_restrictedPreinstalledCarrierApps" /> - <!-- @hide @SystemApi --> - <public name="config_sms_enabled_single_shift_tables" /> - <!-- @hide @SystemApi --> - <public name="config_sms_enabled_locking_shift_tables" /> </public-group> - <!-- =============================================================== DO NOT ADD UN-GROUPED ITEMS HERE diff --git a/data/etc/hiddenapi-package-whitelist.xml b/data/etc/hiddenapi-package-whitelist.xml index d282744bc3a0..e9de02e82432 100644 --- a/data/etc/hiddenapi-package-whitelist.xml +++ b/data/etc/hiddenapi-package-whitelist.xml @@ -57,7 +57,6 @@ platform cert need to be included, as apps signed with the platform cert are exe <hidden-api-whitelisted-app package="com.android.terminal" /> <hidden-api-whitelisted-app package="com.android.wallpaper" /> <hidden-api-whitelisted-app package="jp.co.omronsoft.openwnn" /> - <!-- STOPSHIP: Remove this when fixing all @hide usage for tethering.--> - <hidden-api-whitelisted-app package="com.android.networkstack.tethering" /> + <!-- TODO: Remove NetworkStack whitelisting --> <hidden-api-whitelisted-app package="com.android.networkstack" /> </config> diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 94d32c63edb1..59943eb546b4 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -4213,6 +4213,7 @@ public class AudioManager { * {@hide} */ @UnsupportedAppUsage + @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void setWiredDeviceConnectionState(int type, int state, String address, String name) { final IAudioService service = getService(); try { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java index d17f242d5d63..a1fba4a018e2 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java @@ -174,7 +174,7 @@ public class HearingAidProfile implements LocalBluetoothProfile { @Override public boolean isEnabled(BluetoothDevice device) { - if (mService == null) { + if (mService == null || device == null) { return false; } return mService.getConnectionPolicy(device) > CONNECTION_POLICY_FORBIDDEN; @@ -182,7 +182,7 @@ public class HearingAidProfile implements LocalBluetoothProfile { @Override public int getConnectionPolicy(BluetoothDevice device) { - if (mService == null) { + if (mService == null || device == null) { return CONNECTION_POLICY_FORBIDDEN; } return mService.getConnectionPolicy(device); @@ -191,7 +191,7 @@ public class HearingAidProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { boolean isEnabled = false; - if (mService == null) { + if (mService == null || device == null) { return false; } if (enabled) { @@ -213,7 +213,7 @@ public class HearingAidProfile implements LocalBluetoothProfile { } public long getHiSyncId(BluetoothDevice device) { - if (mService == null) { + if (mService == null || device == null) { return BluetoothHearingAid.HI_SYNC_ID_INVALID; } return mService.getHiSyncId(device); diff --git a/packages/Tethering/common/TetheringLib/Android.bp b/packages/Tethering/common/TetheringLib/Android.bp index 2fbba68f1e03..00d0d9c428ff 100644 --- a/packages/Tethering/common/TetheringLib/Android.bp +++ b/packages/Tethering/common/TetheringLib/Android.bp @@ -60,6 +60,7 @@ java_library { hostdex: true, // for hiddenapi check visibility: ["//frameworks/base/packages/Tethering:__subpackages__"], apex_available: ["com.android.tethering"], + permitted_packages: ["android.net"], } stubs_defaults { diff --git a/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java b/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java index b6f73a8a5fc4..020db5403e31 100644 --- a/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java +++ b/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java @@ -433,9 +433,7 @@ public class Tethering { // Called by wifi when the number of soft AP clients changed. @Override public void onConnectedClientsChanged(final List<WifiClient> clients) { - if (mConnectedClientsTracker.updateConnectedClients(mForwardedDownstreams, clients)) { - reportTetherClientsChanged(mConnectedClientsTracker.getLastTetheredClients()); - } + updateConnectedClients(clients); } } @@ -1575,6 +1573,7 @@ public class Tethering { mIPv6TetheringCoordinator.removeActiveDownstream(who); mOffload.excludeDownstreamInterface(who.interfaceName()); mForwardedDownstreams.remove(who); + updateConnectedClients(null /* wifiClients */); // If this is a Wi-Fi interface, tell WifiManager of any errors // or the inactive serving state. @@ -2157,6 +2156,12 @@ public class Tethering { return false; } + private void updateConnectedClients(final List<WifiClient> wifiClients) { + if (mConnectedClientsTracker.updateConnectedClients(mForwardedDownstreams, wifiClients)) { + reportTetherClientsChanged(mConnectedClientsTracker.getLastTetheredClients()); + } + } + private IpServer.Callback makeControlCallback() { return new IpServer.Callback() { @Override @@ -2171,10 +2176,7 @@ public class Tethering { @Override public void dhcpLeasesChanged() { - if (mConnectedClientsTracker.updateConnectedClients( - mForwardedDownstreams, null /* wifiClients */)) { - reportTetherClientsChanged(mConnectedClientsTracker.getLastTetheredClients()); - } + updateConnectedClients(null /* wifiClients */); } }; } diff --git a/services/Android.bp b/services/Android.bp index 8ebad4efc1b5..1ab23955610b 100644 --- a/services/Android.bp +++ b/services/Android.bp @@ -110,6 +110,7 @@ droidstubs { name: "services-stubs.sources", srcs: [":services-sources"], installable: false, + api_tag_name: "SYSTEM_SERVER", args: " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)" + " --hide-annotation android.annotation.Hide" + " --hide InternalClasses" + // com.android.* classes are okay in this interface @@ -138,7 +139,8 @@ droidstubs { } java_library { - name: "services-stubs", + name: "android_system_server_stubs_current", srcs: [":services-stubs.sources"], installable: false, + static_libs: ["android_module_lib_stubs_current"], } diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index fa8eda54e53c..11c1405d5905 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -106,9 +106,13 @@ class BluetoothManagerService extends IBluetoothManager.Stub { private static final int USER_SWITCHED_TIME_MS = 200; // Delay for the addProxy function in msec private static final int ADD_PROXY_DELAY_MS = 100; + // Delay for retrying enable and disable in msec + private static final int ENABLE_DISABLE_DELAY_MS = 300; private static final int MESSAGE_ENABLE = 1; private static final int MESSAGE_DISABLE = 2; + private static final int MESSAGE_HANDLE_ENABLE_DELAYED = 3; + private static final int MESSAGE_HANDLE_DISABLE_DELAYED = 4; private static final int MESSAGE_REGISTER_ADAPTER = 20; private static final int MESSAGE_UNREGISTER_ADAPTER = 21; private static final int MESSAGE_REGISTER_STATE_CHANGE_CALLBACK = 30; @@ -130,6 +134,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { private static final int RESTORE_SETTING_TO_OFF = 0; private static final int MAX_ERROR_RESTART_RETRIES = 6; + private static final int MAX_WAIT_FOR_ENABLE_DISABLE_RETRIES = 10; // Bluetooth persisted setting is off private static final int BLUETOOTH_OFF = 0; @@ -160,6 +165,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { private final ReentrantReadWriteLock mBluetoothLock = new ReentrantReadWriteLock(); private boolean mBinding; private boolean mUnbinding; + private int mWaitForEnableRetry; + private int mWaitForDisableRetry; private BluetoothAirplaneModeListener mBluetoothAirplaneModeListener; @@ -1597,8 +1604,18 @@ class BluetoothManagerService extends IBluetoothManager.Stub { break; case MESSAGE_ENABLE: + int quietEnable = msg.arg1; + if (mHandler.hasMessages(MESSAGE_HANDLE_DISABLE_DELAYED) + || mHandler.hasMessages(MESSAGE_HANDLE_ENABLE_DELAYED)) { + // We are handling enable or disable right now, wait for it. + mHandler.sendMessageDelayed(mHandler.obtainMessage(MESSAGE_ENABLE, + quietEnable, 0), ENABLE_DISABLE_DELAY_MS); + break; + } + if (DBG) { - Slog.d(TAG, "MESSAGE_ENABLE(" + msg.arg1 + "): mBluetooth = " + mBluetooth); + Slog.d(TAG, "MESSAGE_ENABLE(" + quietEnable + "): mBluetooth = " + + mBluetooth); } mHandler.removeMessages(MESSAGE_RESTART_BLUETOOTH_SERVICE); mEnable = true; @@ -1621,7 +1638,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mBluetoothLock.readLock().unlock(); } - mQuietEnable = (msg.arg1 == 1); + mQuietEnable = (quietEnable == 1); if (mBluetooth == null) { handleEnable(mQuietEnable); } else { @@ -1630,7 +1647,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { // the previous Bluetooth process has exited. The // waiting period has three components: // (a) Wait until the local state is STATE_OFF. This - // is accomplished by "waitForOnOff(false, true)". + // is accomplished by sending delay a message + // MESSAGE_HANDLE_ENABLE_DELAYED // (b) Wait until the STATE_OFF state is updated to // all components. // (c) Wait until the Bluetooth process exits, and @@ -1640,28 +1658,108 @@ class BluetoothManagerService extends IBluetoothManager.Stub { // message. The delay time is backed off if Bluetooth // continuously failed to turn on itself. // - waitForOnOff(false, true); - Message restartMsg = - mHandler.obtainMessage(MESSAGE_RESTART_BLUETOOTH_SERVICE); - mHandler.sendMessageDelayed(restartMsg, getServiceRestartMs()); + mWaitForEnableRetry = 0; + Message enableDelayedMsg = + mHandler.obtainMessage(MESSAGE_HANDLE_ENABLE_DELAYED); + mHandler.sendMessageDelayed(enableDelayedMsg, ENABLE_DISABLE_DELAY_MS); } break; case MESSAGE_DISABLE: + if (mHandler.hasMessages(MESSAGE_HANDLE_DISABLE_DELAYED) || mBinding + || mHandler.hasMessages(MESSAGE_HANDLE_ENABLE_DELAYED)) { + // We are handling enable or disable right now, wait for it. + mHandler.sendMessageDelayed(mHandler.obtainMessage(MESSAGE_DISABLE), + ENABLE_DISABLE_DELAY_MS); + break; + } + if (DBG) { - Slog.d(TAG, "MESSAGE_DISABLE: mBluetooth = " + mBluetooth); + Slog.d(TAG, "MESSAGE_DISABLE: mBluetooth = " + mBluetooth + + ", mBinding = " + mBinding); } mHandler.removeMessages(MESSAGE_RESTART_BLUETOOTH_SERVICE); + if (mEnable && mBluetooth != null) { - waitForOnOff(true, false); + mWaitForDisableRetry = 0; + Message disableDelayedMsg = + mHandler.obtainMessage(MESSAGE_HANDLE_DISABLE_DELAYED, 0, 0); + mHandler.sendMessageDelayed(disableDelayedMsg, ENABLE_DISABLE_DELAY_MS); + } else { mEnable = false; handleDisable(); - waitForOnOff(false, false); - } else { + } + break; + + case MESSAGE_HANDLE_ENABLE_DELAYED: { + // The Bluetooth is turning off, wait for STATE_OFF + if (mState != BluetoothAdapter.STATE_OFF) { + if (mWaitForEnableRetry < MAX_WAIT_FOR_ENABLE_DISABLE_RETRIES) { + mWaitForEnableRetry++; + Message enableDelayedMsg = + mHandler.obtainMessage(MESSAGE_HANDLE_ENABLE_DELAYED); + mHandler.sendMessageDelayed(enableDelayedMsg, ENABLE_DISABLE_DELAY_MS); + break; + } else { + Slog.e(TAG, "Wait for STATE_OFF timeout"); + } + } + // Either state is changed to STATE_OFF or reaches the maximum retry, we + // should move forward to the next step. + mWaitForEnableRetry = 0; + Message restartMsg = + mHandler.obtainMessage(MESSAGE_RESTART_BLUETOOTH_SERVICE); + mHandler.sendMessageDelayed(restartMsg, getServiceRestartMs()); + Slog.d(TAG, "Handle enable is finished"); + break; + } + + case MESSAGE_HANDLE_DISABLE_DELAYED: { + boolean disabling = (msg.arg1 == 1); + Slog.d(TAG, "MESSAGE_HANDLE_DISABLE_DELAYED: disabling:" + disabling); + if (!disabling) { + // The Bluetooth is turning on, wait for STATE_ON + if (mState != BluetoothAdapter.STATE_ON) { + if (mWaitForDisableRetry < MAX_WAIT_FOR_ENABLE_DISABLE_RETRIES) { + mWaitForDisableRetry++; + Message disableDelayedMsg = mHandler.obtainMessage( + MESSAGE_HANDLE_DISABLE_DELAYED, 0, 0); + mHandler.sendMessageDelayed(disableDelayedMsg, + ENABLE_DISABLE_DELAY_MS); + break; + } else { + Slog.e(TAG, "Wait for STATE_ON timeout"); + } + } + // Either state is changed to STATE_ON or reaches the maximum retry, we + // should move forward to the next step. + mWaitForDisableRetry = 0; mEnable = false; handleDisable(); + // Wait for state exiting STATE_ON + Message disableDelayedMsg = + mHandler.obtainMessage(MESSAGE_HANDLE_DISABLE_DELAYED, 1, 0); + mHandler.sendMessageDelayed(disableDelayedMsg, ENABLE_DISABLE_DELAY_MS); + } else { + // The Bluetooth is turning off, wait for exiting STATE_ON + if (mState == BluetoothAdapter.STATE_ON) { + if (mWaitForDisableRetry < MAX_WAIT_FOR_ENABLE_DISABLE_RETRIES) { + mWaitForDisableRetry++; + Message disableDelayedMsg = mHandler.obtainMessage( + MESSAGE_HANDLE_DISABLE_DELAYED, 1, 0); + mHandler.sendMessageDelayed(disableDelayedMsg, + ENABLE_DISABLE_DELAY_MS); + break; + } else { + Slog.e(TAG, "Wait for exiting STATE_ON timeout"); + } + } + // Either state is exited from STATE_ON or reaches the maximum retry, we + // should move forward to the next step. + Slog.d(TAG, "Handle disable is finished"); } break; + } case MESSAGE_RESTORE_USER_SETTING: if ((msg.arg1 == RESTORE_SETTING_TO_OFF) && mEnable) { @@ -2031,6 +2129,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { try { mBluetoothLock.writeLock().lock(); if ((mBluetooth == null) && (!mBinding)) { + Slog.d(TAG, "binding Bluetooth service"); //Start bind timeout and bind Message timeoutMsg = mHandler.obtainMessage(MESSAGE_TIMEOUT_BIND); mHandler.sendMessageDelayed(timeoutMsg, TIMEOUT_BIND_MS); @@ -2418,6 +2517,12 @@ class BluetoothManagerService extends IBluetoothManager.Stub { writer.println(" " + app.getPackageName()); } + writer.println("\nBluetoothManagerService:"); + writer.println(" mEnable:" + mEnable); + writer.println(" mQuietEnable:" + mQuietEnable); + writer.println(" mEnableExternal:" + mEnableExternal); + writer.println(" mQuietEnableExternal:" + mQuietEnableExternal); + writer.println(""); writer.flush(); if (args.length == 0) { diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java index 454941ccdb03..5f9d1d801441 100644 --- a/services/core/java/com/android/server/Watchdog.java +++ b/services/core/java/com/android/server/Watchdog.java @@ -115,6 +115,7 @@ public class Watchdog extends Thread { "android.hardware.media.c2@1.0::IComponentStore", "android.hardware.media.omx@1.0::IOmx", "android.hardware.media.omx@1.0::IOmxStore", + "android.hardware.neuralnetworks@1.0::IDevice", "android.hardware.power.stats@1.0::IPowerStats", "android.hardware.sensors@1.0::ISensors", "android.hardware.vr@1.0::IVr", diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index e5cd783f2047..fc6d9f7b7849 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -4318,6 +4318,7 @@ public class AudioService extends IAudioService.Stub public void setWiredDeviceConnectionState(int type, @ConnectionState int state, String address, String name, String caller) { + enforceModifyAudioRoutingPermission(); if (state != CONNECTION_STATE_CONNECTED && state != CONNECTION_STATE_DISCONNECTED) { throw new IllegalArgumentException("Invalid state " + state); diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index 99f3d8f22baa..22ed661b03c0 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -3091,17 +3091,38 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { private void enforceSubscriptionPlanValidity(SubscriptionPlan[] plans) { // nothing to check if no plans if (plans.length == 0) { + Log.d(TAG, "Received empty plans list. Clearing existing SubscriptionPlans."); return; } - final ArraySet<Integer> applicableNetworkTypes = new ArraySet<Integer>(); - boolean allNetworks = false; - for (SubscriptionPlan plan : plans) { - if (plan.getNetworkTypes() == null) { - allNetworks = true; + final int[] allNetworkTypes = TelephonyManager.getAllNetworkTypes(); + final ArraySet<Integer> allNetworksSet = new ArraySet<>(); + addAll(allNetworksSet, allNetworkTypes); + + final ArraySet<Integer> applicableNetworkTypes = new ArraySet<>(); + boolean hasGeneralPlan = false; + for (int i = 0; i < plans.length; i++) { + final int[] planNetworkTypes = plans[i].getNetworkTypes(); + final ArraySet<Integer> planNetworksSet = new ArraySet<>(); + for (int j = 0; j < planNetworkTypes.length; j++) { + // ensure all network types are valid + if (allNetworksSet.contains(planNetworkTypes[j])) { + // ensure no duplicate network types in the same SubscriptionPlan + if (!planNetworksSet.add(planNetworkTypes[j])) { + throw new IllegalArgumentException( + "Subscription plan contains duplicate network types."); + } + } else { + throw new IllegalArgumentException("Invalid network type: " + + planNetworkTypes[j]); + } + } + + if (planNetworkTypes.length == allNetworkTypes.length) { + hasGeneralPlan = true; } else { - final int[] networkTypes = plan.getNetworkTypes(); - if (!addAll(applicableNetworkTypes, networkTypes)) { + // ensure no network type applies to multiple plans + if (!addAll(applicableNetworkTypes, planNetworkTypes)) { throw new IllegalArgumentException( "Multiple subscription plans defined for a single network type."); } @@ -3109,7 +3130,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } // ensure at least one plan applies for every network type - if (!allNetworks) { + if (!hasGeneralPlan) { throw new IllegalArgumentException( "No generic subscription plan that applies to all network types."); } @@ -3118,12 +3139,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { /** * Adds all of the {@code elements} to the {@code set}. * - * @return {@code false} if any element is not added because the set already have the value. + * @return {@code false} if any element is not added because the set already has the value. */ - private static boolean addAll(@NonNull Set<Integer> set, @NonNull int... elements) { + private static boolean addAll(@NonNull ArraySet<Integer> set, @NonNull int... elements) { boolean result = true; - for (int element : elements) { - result &= set.add(element); + for (int i = 0; i < elements.length; i++) { + result &= set.add(elements[i]); } return result; } diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index c5fcf67c9be9..ead90bb4561f 100755 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -2075,6 +2075,17 @@ public final class Call { /** * Returns the child {@link Call} in a generic conference that is currently active. + * + * A "generic conference" is the mechanism used to support two simultaneous calls on a device + * in CDMA networks. It is effectively equivalent to having one call active and one call on hold + * in GSM or IMS calls. This method returns the currently active call. + * + * In a generic conference, the network exposes the conference to us as a single call, and we + * switch between talking to the two participants using a CDMA flash command. Since the network + * exposes no additional information about the call, the only way we know which caller we're + * currently talking to is by keeping track of the flash commands that we've sent to the + * network. + * * For calls that are not generic conferences, or when the generic conference has more than * 2 children, returns {@code null}. * @see Details#PROPERTY_GENERIC_CONFERENCE diff --git a/telecomm/java/android/telecom/ParcelableCallAnalytics.java b/telecomm/java/android/telecom/ParcelableCallAnalytics.java index 2b9213ba9dbc..b8ad9e2fbe6c 100644 --- a/telecomm/java/android/telecom/ParcelableCallAnalytics.java +++ b/telecomm/java/android/telecom/ParcelableCallAnalytics.java @@ -258,27 +258,6 @@ public class ParcelableCallAnalytics implements Parcelable { public static final int SIP_PHONE = 0x8; public static final int THIRD_PARTY_PHONE = 0x10; - /** - * Indicating the call source is not specified. - * - * @hide - */ - public static final int CALL_SOURCE_UNSPECIFIED = 0; - - /** - * Indicating the call is initiated via emergency dialer's dialpad. - * - * @hide - */ - public static final int CALL_SOURCE_EMERGENCY_DIALPAD = 1; - - /** - * Indicating the call is initiated via emergency dialer's shortcut button. - * - * @hide - */ - public static final int CALL_SOURCE_EMERGENCY_SHORTCUT = 2; - public static final long MILLIS_IN_5_MINUTES = 1000 * 60 * 5; public static final long MILLIS_IN_1_SECOND = 1000; @@ -343,7 +322,7 @@ public class ParcelableCallAnalytics implements Parcelable { private List<VideoEvent> videoEvents; // The source where user initiated this call. ONE OF the CALL_SOURCE_* constants. - private int callSource = CALL_SOURCE_UNSPECIFIED; + private int callSource = TelecomManager.CALL_SOURCE_UNSPECIFIED; public ParcelableCallAnalytics(long startTimeMillis, long callDurationMillis, int callType, boolean isAdditionalCall, boolean isInterrupted, int callTechnologies, diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index 6ae4a08abaa3..768c8eebf067 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -82,8 +82,10 @@ public final class PhoneAccount implements Parcelable { public static final String EXTRA_CALL_SUBJECT_CHARACTER_ENCODING = "android.telecom.extra.CALL_SUBJECT_CHARACTER_ENCODING"; - /** - * Indicating flag for phone account whether to use voip audio mode for voip calls + /** + * Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which + * indicates that all calls from this {@link PhoneAccount} should be treated as VoIP calls + * rather than cellular calls. * @hide */ public static final String EXTRA_ALWAYS_USE_VOIP_AUDIO_MODE = diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 19a1021e57e2..8be146dd02fe 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -312,6 +312,9 @@ public class TelecomManager { "android.telecom.extra.IS_USER_INTENT_EMERGENCY_CALL"; /** + * A mandatory extra containing a {@link Uri} to be passed in when calling + * {@link #addNewUnknownCall(PhoneAccountHandle, Bundle)}. The {@link Uri} value indicates + * the remote handle of the new call. * @hide */ public static final String EXTRA_UNKNOWN_CALL_HANDLE = @@ -373,8 +376,15 @@ public class TelecomManager { "android.telecom.extra.CONNECTION_SERVICE"; /** - * Optional extra for communicating the call technology used by a - * {@link com.android.internal.telephony.Connection} to Telecom + * Optional extra for communicating the call technology used by a {@link ConnectionService} + * to Telecom. Valid values are: + * <ul> + * <li>{@link TelephonyManager#PHONE_TYPE_CDMA}</li> + * <li>{@link TelephonyManager#PHONE_TYPE_GSM}</li> + * <li>{@link TelephonyManager#PHONE_TYPE_IMS}</li> + * <li>{@link TelephonyManager#PHONE_TYPE_THIRD_PARTY}</li> + * <li>{@link TelephonyManager#PHONE_TYPE_SIP}</li> + * </ul> * @hide */ public static final String EXTRA_CALL_TECHNOLOGY_TYPE = @@ -725,15 +735,16 @@ public class TelecomManager { /** * The lookup key for an int that indicates the current TTY mode. * Valid modes are: - * - {@link #TTY_MODE_OFF} - * - {@link #TTY_MODE_FULL} - * - {@link #TTY_MODE_HCO} - * - {@link #TTY_MODE_VCO} - * + * <ul> + * <li>{@link #TTY_MODE_OFF}</li> + * <li>{@link #TTY_MODE_FULL}</li> + * <li>{@link #TTY_MODE_HCO}</li> + * <li>{@link #TTY_MODE_VCO}</li> + * </ul> * @hide */ public static final String EXTRA_CURRENT_TTY_MODE = - "android.telecom.intent.extra.CURRENT_TTY_MODE"; + "android.telecom.extra.CURRENT_TTY_MODE"; /** * Broadcast intent action indicating that the TTY preferred operating mode has changed. An @@ -753,7 +764,7 @@ public class TelecomManager { * @hide */ public static final String EXTRA_TTY_PREFERRED_MODE = - "android.telecom.intent.extra.TTY_PREFERRED"; + "android.telecom.extra.TTY_PREFERRED_MODE"; /** * Broadcast intent action for letting custom component know to show the missed call @@ -822,16 +833,37 @@ public class TelecomManager { /** * Optional extra for {@link #placeCall(Uri, Bundle)} containing an integer that specifies * the source where user initiated this call. This data is used in metrics. - * Valid source are: - * {@link ParcelableCallAnalytics#CALL_SOURCE_UNSPECIFIED}, - * {@link ParcelableCallAnalytics#CALL_SOURCE_EMERGENCY_DIALPAD}, - * {@link ParcelableCallAnalytics#CALL_SOURCE_EMERGENCY_SHORTCUT}. + * Valid sources are: + * {@link TelecomManager#CALL_SOURCE_UNSPECIFIED}, + * {@link TelecomManager#CALL_SOURCE_EMERGENCY_DIALPAD}, + * {@link TelecomManager#CALL_SOURCE_EMERGENCY_SHORTCUT}. * * @hide */ public static final String EXTRA_CALL_SOURCE = "android.telecom.extra.CALL_SOURCE"; /** + * Indicating the call is initiated via emergency dialer's shortcut button. + * + * @hide + */ + public static final int CALL_SOURCE_EMERGENCY_SHORTCUT = 2; + + /** + * Indicating the call is initiated via emergency dialer's dialpad. + * + * @hide + */ + public static final int CALL_SOURCE_EMERGENCY_DIALPAD = 1; + + /** + * Indicating the call source is not specified. + * + * @hide + */ + public static final int CALL_SOURCE_UNSPECIFIED = 0; + + /** * The following 4 constants define how properties such as phone numbers and names are * displayed to the user. */ diff --git a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java index de0221c7c2b1..3c1e707ab1dd 100644 --- a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java +++ b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java @@ -31,6 +31,7 @@ import android.util.ArrayMap; import android.util.ArraySet; import android.util.Log; +import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.util.ArrayUtils; import com.android.server.SystemConfig; @@ -156,7 +157,7 @@ public final class CarrierAppUtils { for (ApplicationInfo ai : candidates) { String packageName = ai.packageName; String[] restrictedCarrierApps = Resources.getSystem().getStringArray( - android.R.array.config_restrictedPreinstalledCarrierApps); + R.array.config_restrictedPreinstalledCarrierApps); boolean hasPrivileges = telephonyManager != null && telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName) == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS diff --git a/telephony/common/com/android/internal/telephony/GsmAlphabet.java b/telephony/common/com/android/internal/telephony/GsmAlphabet.java index 2201452e9011..60cd40094950 100644 --- a/telephony/common/com/android/internal/telephony/GsmAlphabet.java +++ b/telephony/common/com/android/internal/telephony/GsmAlphabet.java @@ -19,10 +19,12 @@ package com.android.internal.telephony; import android.compat.annotation.UnsupportedAppUsage; import android.content.res.Resources; import android.os.Build; -import android.text.TextUtils; import android.util.Log; +import android.text.TextUtils; import android.util.SparseIntArray; +import com.android.internal.R; + import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.ArrayList; @@ -1085,10 +1087,8 @@ public class GsmAlphabet { private static void enableCountrySpecificEncodings() { Resources r = Resources.getSystem(); // See comments in frameworks/base/core/res/res/values/config.xml for allowed values - sEnabledSingleShiftTables = r.getIntArray( - android.R.array.config_sms_enabled_single_shift_tables); - sEnabledLockingShiftTables = r.getIntArray( - android.R.array.config_sms_enabled_locking_shift_tables); + sEnabledSingleShiftTables = r.getIntArray(R.array.config_sms_enabled_single_shift_tables); + sEnabledLockingShiftTables = r.getIntArray(R.array.config_sms_enabled_locking_shift_tables); if (sEnabledSingleShiftTables.length > 0) { sHighestEnabledSingleShiftCode = diff --git a/telephony/common/com/google/android/mms/util/SqliteWrapper.java b/telephony/common/com/google/android/mms/util/SqliteWrapper.java index 4871434ebc31..31fe4d7683d6 100644 --- a/telephony/common/com/google/android/mms/util/SqliteWrapper.java +++ b/telephony/common/com/google/android/mms/util/SqliteWrapper.java @@ -60,7 +60,8 @@ public final class SqliteWrapper { @UnsupportedAppUsage public static void checkSQLiteException(Context context, SQLiteException e) { if (isLowMemory(e)) { - Toast.makeText(context, android.R.string.low_memory, Toast.LENGTH_SHORT).show(); + Toast.makeText(context, com.android.internal.R.string.low_memory, + Toast.LENGTH_SHORT).show(); } else { throw e; } diff --git a/telephony/java/android/telephony/Annotation.java b/telephony/java/android/telephony/Annotation.java index 85db35d1ca08..ccda88f717c3 100644 --- a/telephony/java/android/telephony/Annotation.java +++ b/telephony/java/android/telephony/Annotation.java @@ -611,48 +611,6 @@ public class Annotation { } /** - * Call forwarding function status - */ - @IntDef(prefix = { "STATUS_" }, value = { - CallForwardingInfo.STATUS_ACTIVE, - CallForwardingInfo.STATUS_INACTIVE, - CallForwardingInfo.STATUS_UNKNOWN_ERROR, - CallForwardingInfo.STATUS_NOT_SUPPORTED, - CallForwardingInfo.STATUS_FDN_CHECK_FAILURE - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallForwardingStatus { - } - - /** - * Call forwarding reason types - */ - @IntDef(flag = true, prefix = { "REASON_" }, value = { - CallForwardingInfo.REASON_UNCONDITIONAL, - CallForwardingInfo.REASON_BUSY, - CallForwardingInfo.REASON_NO_REPLY, - CallForwardingInfo.REASON_NOT_REACHABLE, - CallForwardingInfo.REASON_ALL, - CallForwardingInfo.REASON_ALL_CONDITIONAL - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallForwardingReason { - } - - /** - * Call waiting function status - */ - @IntDef(prefix = { "CALL_WAITING_STATUS_" }, value = { - TelephonyManager.CALL_WAITING_STATUS_ACTIVE, - TelephonyManager.CALL_WAITING_STATUS_INACTIVE, - TelephonyManager.CALL_WAITING_STATUS_NOT_SUPPORTED, - TelephonyManager.CALL_WAITING_STATUS_UNKNOWN_ERROR - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallWaitingStatus { - } - - /** * UICC SIM Application Types */ @IntDef(prefix = { "APPTYPE_" }, value = { diff --git a/telephony/java/android/telephony/CallForwardingInfo.java b/telephony/java/android/telephony/CallForwardingInfo.java index 1dd7539420ac..7e777fae46eb 100644 --- a/telephony/java/android/telephony/CallForwardingInfo.java +++ b/telephony/java/android/telephony/CallForwardingInfo.java @@ -15,24 +15,24 @@ */ package android.telephony; + +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; -import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; -import android.telephony.Annotation.CallForwardingReason; -import android.telephony.Annotation.CallForwardingStatus; import com.android.telephony.Rlog; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** * Defines the call forwarding information. * @hide */ -@SystemApi public final class CallForwardingInfo implements Parcelable { private static final String TAG = "CallForwardingInfo"; @@ -41,7 +41,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_INACTIVE = 0; /** @@ -49,7 +48,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_ACTIVE = 1; /** @@ -58,7 +56,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_FDN_CHECK_FAILURE = 2; /** @@ -66,7 +63,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_UNKNOWN_ERROR = 3; /** @@ -74,7 +70,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public static final int STATUS_NOT_SUPPORTED = 4; /** @@ -83,7 +78,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_UNCONDITIONAL = 0; /** @@ -92,7 +86,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_BUSY = 1; /** @@ -101,7 +94,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_NO_REPLY = 2; /** @@ -110,7 +102,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_NOT_REACHABLE = 3; /** @@ -120,7 +111,6 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_ALL = 4; /** @@ -130,20 +120,48 @@ public final class CallForwardingInfo implements Parcelable { * and conditions +CCFC * @hide */ - @SystemApi public static final int REASON_ALL_CONDITIONAL = 5; /** + * Call forwarding function status + */ + @IntDef(prefix = { "STATUS_" }, value = { + STATUS_ACTIVE, + STATUS_INACTIVE, + STATUS_UNKNOWN_ERROR, + STATUS_NOT_SUPPORTED, + STATUS_FDN_CHECK_FAILURE + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CallForwardingStatus { + } + + /** + * Call forwarding reason types + */ + @IntDef(flag = true, prefix = { "REASON_" }, value = { + REASON_UNCONDITIONAL, + REASON_BUSY, + REASON_NO_REPLY, + REASON_NOT_REACHABLE, + REASON_ALL, + REASON_ALL_CONDITIONAL + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CallForwardingReason { + } + + /** * The call forwarding status. */ - private @CallForwardingStatus int mStatus; + private int mStatus; /** * The call forwarding reason indicates the condition under which calls will be forwarded. * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC */ - private @CallForwardingReason int mReason; + private int mReason; /** * The phone number to which calls will be forwarded. @@ -166,7 +184,6 @@ public final class CallForwardingInfo implements Parcelable { * @param timeSeconds the timeout (in seconds) before the forwarding is attempted * @hide */ - @SystemApi public CallForwardingInfo(@CallForwardingStatus int status, @CallForwardingReason int reason, @Nullable String number, int timeSeconds) { mStatus = status; @@ -182,7 +199,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public @CallForwardingStatus int getStatus() { return mStatus; } @@ -196,7 +212,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi public @CallForwardingReason int getReason() { return mReason; } @@ -209,7 +224,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi @Nullable public String getNumber() { return mNumber; @@ -227,7 +241,6 @@ public final class CallForwardingInfo implements Parcelable { * * @hide */ - @SystemApi @SuppressLint("MethodNameUnits") public int getTimeoutSeconds() { return mTimeSeconds; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index de35c00c8059..8cbeba14405b 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1553,6 +1553,7 @@ public class CarrierConfigManager { /** * The string is used to compare with operator name. * If it matches the pattern then show specific data icon. + * @hide */ public static final String KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING = "show_carrier_data_icon_pattern_string"; @@ -2967,9 +2968,9 @@ public class CarrierConfigManager { * UE wants to display 5G_Plus icon for scenario#1, and 5G icon for scenario#2; otherwise not * define. * The configuration is: "connected_mmwave:5G_Plus,connected:5G" + * @hide */ - public static final String KEY_5G_ICON_CONFIGURATION_STRING = - "5g_icon_configuration_string"; + public static final String KEY_5G_ICON_CONFIGURATION_STRING = "5g_icon_configuration_string"; /** * Timeout in seconds for displaying 5G icon, default value is 0 which means the timer is @@ -2981,12 +2982,14 @@ public class CarrierConfigManager { * * If 5G is reacquired during this timer, the timer is canceled and restarted when 5G is next * lost. Allows us to momentarily lose 5G without blinking the icon. + * @hide */ public static final String KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT = "5g_icon_display_grace_period_sec_int"; /** * Controls time in milliseconds until DcTracker reevaluates 5G connection state. + * @hide */ public static final String KEY_5G_WATCHDOG_TIME_MS_LONG = "5g_watchdog_time_long"; @@ -3723,7 +3726,7 @@ public class CarrierConfigManager { sDefaults.putInt(KEY_IMS_DTMF_TONE_DELAY_INT, 0); sDefaults.putInt(KEY_CDMA_DTMF_TONE_DELAY_INT, 100); sDefaults.putBoolean(KEY_CALL_FORWARDING_MAP_NON_NUMBER_TO_VOICEMAIL_BOOL, false); - sDefaults.putBoolean(KEY_IGNORE_RTT_MODE_SETTING_BOOL, false); + sDefaults.putBoolean(KEY_IGNORE_RTT_MODE_SETTING_BOOL, true); sDefaults.putInt(KEY_CDMA_3WAYCALL_FLASH_DELAY_INT , 0); sDefaults.putBoolean(KEY_SUPPORT_ADHOC_CONFERENCE_CALLS_BOOL, false); sDefaults.putBoolean(KEY_SUPPORT_ADD_CONFERENCE_PARTICIPANTS_BOOL, false); diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index d672c77bed01..b4ce162274fb 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -25,10 +25,9 @@ import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; import java.util.Set; @@ -56,7 +55,7 @@ public final class CellIdentityLte extends CellIdentity { // cell bandwidth, in kHz private final int mBandwidth; // cell bands - private final List<Integer> mBands; + private final int[] mBands; // a list of additional PLMN-IDs reported for this cell private final ArraySet<String> mAdditionalPlmns; @@ -73,7 +72,7 @@ public final class CellIdentityLte extends CellIdentity { mPci = CellInfo.UNAVAILABLE; mTac = CellInfo.UNAVAILABLE; mEarfcn = CellInfo.UNAVAILABLE; - mBands = Collections.emptyList(); + mBands = new int[] {}; mBandwidth = CellInfo.UNAVAILABLE; mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; @@ -91,7 +90,7 @@ public final class CellIdentityLte extends CellIdentity { */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) { - this(ci, pci, tac, CellInfo.UNAVAILABLE, Collections.emptyList(), CellInfo.UNAVAILABLE, + this(ci, pci, tac, CellInfo.UNAVAILABLE, new int[] {}, CellInfo.UNAVAILABLE, String.valueOf(mcc), String.valueOf(mnc), null, null, new ArraySet<>(), null); } @@ -112,16 +111,17 @@ public final class CellIdentityLte extends CellIdentity { * * @hide */ - public CellIdentityLte(int ci, int pci, int tac, int earfcn, List<Integer> bands, int bandwidth, - @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal, - @Nullable String alphas, @NonNull Collection<String> additionalPlmns, + public CellIdentityLte(int ci, int pci, int tac, int earfcn, @NonNull int[] bands, + int bandwidth, @Nullable String mccStr, @Nullable String mncStr, + @Nullable String alphal, @Nullable String alphas, + @NonNull Collection<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) { super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas); mCi = inRangeOrUnavailable(ci, 0, MAX_CI); mPci = inRangeOrUnavailable(pci, 0, MAX_PCI); mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN); - mBands = new ArrayList<>(bands); + mBands = bands; mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH); mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { @@ -134,13 +134,13 @@ public final class CellIdentityLte extends CellIdentity { /** @hide */ public CellIdentityLte(@NonNull android.hardware.radio.V1_0.CellIdentityLte cid) { - this(cid.ci, cid.pci, cid.tac, cid.earfcn, Collections.emptyList(), + this(cid.ci, cid.pci, cid.tac, cid.earfcn, new int[] {}, CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", new ArraySet<>(), null); } /** @hide */ public CellIdentityLte(@NonNull android.hardware.radio.V1_2.CellIdentityLte cid) { - this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, Collections.emptyList(), + this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, new int[] {}, cid.bandwidth, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, new ArraySet<>(), null); } @@ -148,9 +148,10 @@ public final class CellIdentityLte extends CellIdentity { /** @hide */ public CellIdentityLte(@NonNull android.hardware.radio.V1_5.CellIdentityLte cid) { this(cid.base.base.ci, cid.base.base.pci, cid.base.base.tac, cid.base.base.earfcn, - cid.bands, cid.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc, - cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, - cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null + cid.bands.stream().mapToInt(Integer::intValue).toArray(), cid.base.bandwidth, + cid.base.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong, + cid.base.operatorNames.alphaShort, cid.additionalPlmns, + cid.optionalCsgInfo.csgInfo() != null ? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null); } @@ -228,11 +229,11 @@ public final class CellIdentityLte extends CellIdentity { * * Reference: 3GPP TS 36.101 section 5.5 * - * @return List of band number or empty list if not available. + * @return Array of band number or empty array if not available. */ @NonNull - public List<Integer> getBands() { - return Collections.unmodifiableList(mBands); + public int[] getBands() { + return Arrays.copyOf(mBands, mBands.length); } /** @@ -314,8 +315,8 @@ public final class CellIdentityLte extends CellIdentity { @Override public int hashCode() { - return Objects.hash(mCi, mPci, mTac, - mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode()); + return Objects.hash(mCi, mPci, mTac, mEarfcn, Arrays.hashCode(mBands), + mBandwidth, mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode()); } @Override @@ -333,6 +334,7 @@ public final class CellIdentityLte extends CellIdentity { && mPci == o.mPci && mTac == o.mTac && mEarfcn == o.mEarfcn + && Arrays.equals(mBands, o.mBands) && mBandwidth == o.mBandwidth && TextUtils.equals(mMccStr, o.mMccStr) && TextUtils.equals(mMncStr, o.mMncStr) @@ -368,7 +370,7 @@ public final class CellIdentityLte extends CellIdentity { dest.writeInt(mPci); dest.writeInt(mTac); dest.writeInt(mEarfcn); - dest.writeList(mBands); + dest.writeIntArray(mBands); dest.writeInt(mBandwidth); dest.writeArraySet(mAdditionalPlmns); dest.writeParcelable(mCsgInfo, flags); @@ -381,7 +383,7 @@ public final class CellIdentityLte extends CellIdentity { mPci = in.readInt(); mTac = in.readInt(); mEarfcn = in.readInt(); - mBands = in.readArrayList(null); + mBands = in.createIntArray(); mBandwidth = in.readInt(); mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); mCsgInfo = in.readParcelable(null); diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java index cba500a00d3a..69cf7e7d4814 100644 --- a/telephony/java/android/telephony/CellIdentityNr.java +++ b/telephony/java/android/telephony/CellIdentityNr.java @@ -24,10 +24,9 @@ import android.telephony.AccessNetworkConstants.NgranBands.NgranBand; import android.telephony.gsm.GsmCellLocation; import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; import java.util.Set; @@ -46,7 +45,7 @@ public final class CellIdentityNr extends CellIdentity { private final int mPci; private final int mTac; private final long mNci; - private final List<Integer> mBands; + private final int[] mBands; // a list of additional PLMN-IDs reported for this cell private final ArraySet<String> mAdditionalPlmns; @@ -66,7 +65,7 @@ public final class CellIdentityNr extends CellIdentity { * * @hide */ - public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand List<Integer> bands, + public CellIdentityNr(int pci, int tac, int nrArfcn, @NonNull @NgranBand int[] bands, @Nullable String mccStr, @Nullable String mncStr, long nci, @Nullable String alphal, @Nullable String alphas, @NonNull Collection<String> additionalPlmns) { @@ -74,7 +73,8 @@ public final class CellIdentityNr extends CellIdentity { mPci = inRangeOrUnavailable(pci, 0, MAX_PCI); mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN); - mBands = new ArrayList<>(bands); + // TODO: input validation for bands + mBands = bands; mNci = inRangeOrUnavailable(nci, 0, MAX_NCI); mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { @@ -86,15 +86,16 @@ public final class CellIdentityNr extends CellIdentity { /** @hide */ public CellIdentityNr(@NonNull android.hardware.radio.V1_4.CellIdentityNr cid) { - this(cid.pci, cid.tac, cid.nrarfcn, Collections.emptyList(), cid.mcc, cid.mnc, cid.nci, + this(cid.pci, cid.tac, cid.nrarfcn, new int[] {}, cid.mcc, cid.mnc, cid.nci, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, new ArraySet<>()); } /** @hide */ public CellIdentityNr(@NonNull android.hardware.radio.V1_5.CellIdentityNr cid) { - this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, cid.bands, cid.base.mcc, cid.base.mnc, - cid.base.nci, cid.base.operatorNames.alphaLong, + this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, + cid.bands.stream().mapToInt(Integer::intValue).toArray(), cid.base.mcc, + cid.base.mnc, cid.base.nci, cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, cid.additionalPlmns); } @@ -119,18 +120,22 @@ public final class CellIdentityNr extends CellIdentity { @Override public int hashCode() { return Objects.hash(super.hashCode(), mPci, mTac, - mNrArfcn, mBands.hashCode(), mNci, mAdditionalPlmns.hashCode()); + mNrArfcn, Arrays.hashCode(mBands), mNci, mAdditionalPlmns.hashCode()); } @Override public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof CellIdentityNr)) { return false; } CellIdentityNr o = (CellIdentityNr) other; return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn - && mBands.equals(o.mBands) && mNci == o.mNci + && Arrays.equals(mBands, o.mBands) && mNci == o.mNci && mAdditionalPlmns.equals(o.mAdditionalPlmns); } @@ -163,12 +168,12 @@ public final class CellIdentityNr extends CellIdentity { * Reference: TS 38.101-1 table 5.2-1 * Reference: TS 38.101-2 table 5.2-1 * - * @return List of band number or empty list if not available. + * @return Array of band number or empty array if not available. */ @NgranBand @NonNull - public List<Integer> getBands() { - return Collections.unmodifiableList(mBands); + public int[] getBands() { + return Arrays.copyOf(mBands, mBands.length); } /** @@ -242,7 +247,7 @@ public final class CellIdentityNr extends CellIdentity { dest.writeInt(mPci); dest.writeInt(mTac); dest.writeInt(mNrArfcn); - dest.writeList(mBands); + dest.writeIntArray(mBands); dest.writeLong(mNci); dest.writeArraySet(mAdditionalPlmns); } @@ -253,7 +258,7 @@ public final class CellIdentityNr extends CellIdentity { mPci = in.readInt(); mTac = in.readInt(); mNrArfcn = in.readInt(); - mBands = in.readArrayList(null); + mBands = in.createIntArray(); mNci = in.readLong(); mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); } diff --git a/telephony/java/android/telephony/CellSignalStrengthCdma.java b/telephony/java/android/telephony/CellSignalStrengthCdma.java index 1c92705b9422..d00049c1ebe5 100644 --- a/telephony/java/android/telephony/CellSignalStrengthCdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthCdma.java @@ -314,6 +314,8 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements /** * Get the signal strength as dBm + * + * @return min(CDMA RSSI, EVDO RSSI) of the measured cell. */ @Override public int getDbm() { diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java index 76d2df918423..9d55f109f751 100644 --- a/telephony/java/android/telephony/CellSignalStrengthGsm.java +++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java @@ -145,6 +145,8 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P /** * Get the signal strength as dBm. + * + * @return the RSSI of the measured cell. */ @Override public int getDbm() { diff --git a/telephony/java/android/telephony/DataSpecificRegistrationInfo.java b/telephony/java/android/telephony/DataSpecificRegistrationInfo.java index 270eafe642b7..c667165e7a0e 100644 --- a/telephony/java/android/telephony/DataSpecificRegistrationInfo.java +++ b/telephony/java/android/telephony/DataSpecificRegistrationInfo.java @@ -208,7 +208,6 @@ public final class DataSpecificRegistrationInfo implements Parcelable { * @return {@code true} if using carrier aggregation. * @hide */ - @SystemApi public boolean isUsingCarrierAggregation() { return mIsUsingCarrierAggregation; } diff --git a/telephony/java/android/telephony/ImsManager.java b/telephony/java/android/telephony/ImsManager.java index b087bc69fb6a..34bac5de4c43 100644 --- a/telephony/java/android/telephony/ImsManager.java +++ b/telephony/java/android/telephony/ImsManager.java @@ -104,10 +104,7 @@ public class ImsManager { * @param subscriptionId The ID of the subscription that this ImsRcsManager will use. * @throws IllegalArgumentException if the subscription is invalid. * @return a ImsRcsManager instance with the specific subscription ID. - * @hide */ - @SystemApi - @TestApi @NonNull public ImsRcsManager getImsRcsManager(int subscriptionId) { if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) { diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java index b12faf75da21..93fbb00ff9d5 100644 --- a/telephony/java/android/telephony/NetworkRegistrationInfo.java +++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java @@ -367,6 +367,7 @@ public final class NetworkRegistrationInfo implements Parcelable { * Get the 5G NR connection state. * * @return the 5G NR connection state. + * @hide */ public @NRState int getNrState() { return mNrState; diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java index 708adebb6db3..a9abe89abab0 100644 --- a/telephony/java/android/telephony/PreciseDataConnectionState.java +++ b/telephony/java/android/telephony/PreciseDataConnectionState.java @@ -95,7 +95,6 @@ public final class PreciseDataConnectionState implements Parcelable { * if there is no valid APN setting for the specific type, then this will be null * @hide */ - @SystemApi public PreciseDataConnectionState(@DataState int state, @NetworkType int networkType, @ApnType int apnTypes, @NonNull String apn, diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 5cf33dec25ea..82470d41842d 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -1421,7 +1421,6 @@ public class ServiceState implements Parcelable { * @return the frequency range of 5G NR. * @hide */ - @SystemApi public @FrequencyRange int getNrFrequencyRange() { return mNrFrequencyRange; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 9ad9d322e7c7..0d0c7e956831 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -70,14 +70,13 @@ import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.Annotation.ApnType; -import android.telephony.Annotation.CallForwardingReason; import android.telephony.Annotation.CallState; -import android.telephony.Annotation.CallWaitingStatus; import android.telephony.Annotation.CarrierPrivilegeStatus; import android.telephony.Annotation.NetworkType; import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.Annotation.UiccAppType; +import android.telephony.CallForwardingInfo.CallForwardingReason; import android.telephony.VisualVoicemailService.VisualVoicemailTask; import android.telephony.data.ApnSetting; import android.telephony.data.ApnSetting.MvnoType; @@ -7933,21 +7932,19 @@ public class TelephonyManager { * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @param operatorNumeric the PLMN ID of the network to select. + * @param persistSelection whether the selection will persist until reboot. + * If true, only allows attaching to the selected PLMN until reboot; otherwise, + * attach to the chosen PLMN and resume normal network selection next time. * @param ran the initial suggested radio access network type. * If registration fails, the RAN is not available after, the RAN is not within the - * network types specified by {@link #setPreferredNetworkTypeBitmask}, or the value is + * network types specified by the preferred network types, or the value is * {@link AccessNetworkConstants.AccessNetworkType#UNKNOWN}, modem will select * the next best RAN for network registration. - * @param persistSelection whether the selection will persist until reboot. - * If true, only allows attaching to the selected PLMN until reboot; otherwise, - * attach to the chosen PLMN and resume normal network selection next time. * @return {@code true} on success; {@code false} on any failure. - * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) - @SystemApi public boolean setNetworkSelectionModeManual(@NonNull String operatorNumeric, - @AccessNetworkConstants.RadioAccessNetworkType int ran, boolean persistSelection) { + boolean persistSelection, @AccessNetworkConstants.RadioAccessNetworkType int ran) { return setNetworkSelectionModeManual(new OperatorInfo("" /* operatorAlphaLong */, "" /* operatorAlphaShort */, operatorNumeric, ran), persistSelection); } @@ -12605,7 +12602,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @NonNull public CallForwardingInfo getCallForwarding(@CallForwardingReason int callForwardingReason) { @@ -12652,7 +12648,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCallForwarding(@NonNull CallForwardingInfo callForwardingInfo) { if (callForwardingInfo == null) { @@ -12693,7 +12688,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_ACTIVE = 1; /** @@ -12701,7 +12695,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_INACTIVE = 2; /** @@ -12709,7 +12702,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; /** @@ -12717,10 +12709,24 @@ public class TelephonyManager { * * @hide */ - @SystemApi public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; /** + * Call waiting function status + * + * @hide + */ + @IntDef(prefix = { "CALL_WAITING_STATUS_" }, value = { + CALL_WAITING_STATUS_ACTIVE, + CALL_WAITING_STATUS_INACTIVE, + CALL_WAITING_STATUS_NOT_SUPPORTED, + CALL_WAITING_STATUS_UNKNOWN_ERROR + }) + @Retention(RetentionPolicy.SOURCE) + public @interface CallWaitingStatus { + } + + /** * Gets the status of voice call waiting function. Call waiting function enables the waiting * for the incoming call when it reaches the user who is busy to make another call and allows * users to decide whether to switch to the incoming call. @@ -12728,7 +12734,6 @@ public class TelephonyManager { * @return the status of call waiting function. * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public @CallWaitingStatus int getCallWaitingStatus() { try { @@ -12754,7 +12759,6 @@ public class TelephonyManager { * * @hide */ - @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCallWaitingStatus(boolean isEnable) { try { diff --git a/telephony/java/android/telephony/ims/ImsException.java b/telephony/java/android/telephony/ims/ImsException.java index 643f452d2e75..1c3d58d98b4a 100644 --- a/telephony/java/android/telephony/ims/ImsException.java +++ b/telephony/java/android/telephony/ims/ImsException.java @@ -47,11 +47,12 @@ public final class ImsException extends Exception { public static final int CODE_ERROR_SERVICE_UNAVAILABLE = 1; /** - * This device or carrier configuration does not support IMS for this subscription. + * This device or carrier configuration does not support this feature for this subscription. * <p> - * This is a permanent configuration error and there should be no retry. Usually this is - * because {@link PackageManager#FEATURE_TELEPHONY_IMS} is not available - * or the device has no ImsService implementation to service this request. + * This is a permanent configuration error and there should be no retry until the subscription + * changes if this operation is denied due to a carrier configuration. If this is due to a + * device configuration, the feature {@link PackageManager#FEATURE_TELEPHONY_IMS} is not + * available or the device has no ImsService implementation to service this request. */ public static final int CODE_ERROR_UNSUPPORTED_OPERATION = 2; diff --git a/telephony/java/android/telephony/ims/ImsRcsManager.java b/telephony/java/android/telephony/ims/ImsRcsManager.java index a2ad21c03f98..ed9b94b3d85e 100644 --- a/telephony/java/android/telephony/ims/ImsRcsManager.java +++ b/telephony/java/android/telephony/ims/ImsRcsManager.java @@ -20,14 +20,16 @@ import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.NonNull; import android.annotation.RequiresPermission; -import android.annotation.SystemApi; -import android.annotation.TestApi; +import android.annotation.SdkConstant; import android.content.Context; +import android.content.Intent; import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; +import android.provider.Settings; import android.telephony.AccessNetworkConstants; +import android.telephony.CarrierConfigManager; import android.telephony.SubscriptionManager; import android.telephony.ims.aidl.IImsCapabilityCallback; import android.telephony.ims.aidl.IImsRcsController; @@ -46,14 +48,34 @@ import java.util.function.Consumer; * (UCE) service, as well as managing user settings. * * Use {@link ImsManager#getImsRcsManager(int)} to create an instance of this manager. - * @hide */ -@SystemApi -@TestApi public class ImsRcsManager implements RegistrationManager { private static final String TAG = "ImsRcsManager"; /** + * Activity Action: Show the opt-in dialog for enabling or disabling RCS contact discovery + * using User Capability Exchange (UCE). + * <p> + * An application that depends on contact discovery being enabled may send this intent + * using {@link Context#startActivity(Intent)} to ask the user to opt-in for contacts upload for + * capability exchange if it is currently disabled. Whether or not this setting has been enabled + * can be queried using {@link RcsUceAdapter#isUceSettingEnabled()}. + * <p> + * This intent should only be sent if the carrier supports RCS capability exchange, which can be + * queried using the key {@link CarrierConfigManager#KEY_USE_RCS_PRESENCE_BOOL}. Otherwise, the + * setting will not be present. + * <p> + * Input: A mandatory {@link Settings#EXTRA_SUB_ID} extra containing the subscription that the + * setting will be be shown for. + * <p> + * Output: Nothing + * @see RcsUceAdapter + */ + @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN = + "android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN"; + + /** * Receives RCS availability status updates from the ImsService. * * @see #isAvailable(int) @@ -145,11 +167,10 @@ public class ImsRcsManager implements RegistrationManager { */ @NonNull public RcsUceAdapter getUceAdapter() { - return new RcsUceAdapter(mSubId); + return new RcsUceAdapter(mContext, mSubId); } /** - * {@inheritDoc} * @hide */ @Override @@ -181,7 +202,6 @@ public class ImsRcsManager implements RegistrationManager { } /** - * {@inheritDoc * @hide */ @Override @@ -206,7 +226,6 @@ public class ImsRcsManager implements RegistrationManager { } /** - * {@inheritDoc} * @hide */ @Override @@ -239,7 +258,6 @@ public class ImsRcsManager implements RegistrationManager { } /** - * {@inheritDoc} * @hide */ @Override diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java index 32fd8638f761..70edb758bb70 100644 --- a/telephony/java/android/telephony/ims/RcsUceAdapter.java +++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java @@ -43,10 +43,7 @@ import java.util.concurrent.Executor; * Manages RCS User Capability Exchange for the subscription specified. * * @see ImsRcsManager#getUceAdapter() for information on creating an instance of this class. - * @hide */ -@SystemApi -@TestApi public class RcsUceAdapter { private static final String TAG = "RcsUceAdapter"; @@ -216,6 +213,7 @@ public class RcsUceAdapter { } } + private final Context mContext; private final int mSubId; /** @@ -223,7 +221,8 @@ public class RcsUceAdapter { * {@link ImsRcsManager#getUceAdapter()} to instantiate this manager class. * @hide */ - RcsUceAdapter(int subId) { + RcsUceAdapter(Context context, int subId) { + mContext = context; mSubId = subId; } @@ -291,7 +290,8 @@ public class RcsUceAdapter { }; try { - imsRcsController.requestCapabilities(mSubId, contactNumbers, internalCallback); + imsRcsController.requestCapabilities(mSubId, mContext.getOpPackageName(), + null /*featureId*/, contactNumbers, internalCallback); } catch (RemoteException e) { Log.e(TAG, "Error calling IImsRcsController#requestCapabilities", e); throw new ImsException("Remote IMS Service is not available", @@ -341,7 +341,7 @@ public class RcsUceAdapter { * available. This can happen if the ImsService has crashed, for example, or if the subscription * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. */ - @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresPermission(Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws ImsException { IImsRcsController imsRcsController = getIImsRcsController(); if (imsRcsController == null) { @@ -349,9 +349,10 @@ public class RcsUceAdapter { throw new ImsException("Can not find remote IMS service", ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } - try { - return imsRcsController.isUceSettingEnabled(mSubId); + // Telephony.SimInfo#IMS_RCS_UCE_ENABLED can also be used to listen to changes to this. + return imsRcsController.isUceSettingEnabled(mSubId, mContext.getOpPackageName(), + null /*featureId*/); } catch (RemoteException e) { Log.e(TAG, "Error calling IImsRcsController#isUceSettingEnabled", e); throw new ImsException("Remote IMS Service is not available", @@ -362,6 +363,10 @@ public class RcsUceAdapter { /** * Change the user’s setting for whether or not UCE is enabled for the associated subscription. * <p> + * If an application Requires UCE, they may launch an Activity using the Intent + * {@link ImsRcsManager#ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN}, which will ask the user if + * they wish to enable this feature. + * <p> * Note: This setting does not affect whether or not the device publishes its service * capabilities if the subscription supports presence publication. * @@ -371,7 +376,10 @@ public class RcsUceAdapter { * {@link RcsUceAdapter} is valid, but the ImsService associated with the subscription is not * available. This can happen if the ImsService has crashed, for example, or if the subscription * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. + * @hide */ + @SystemApi + @TestApi @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean isEnabled) throws ImsException { IImsRcsController imsRcsController = getIImsRcsController(); diff --git a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl index 6f6aa44371fa..483c66eedc0c 100644 --- a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl +++ b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl @@ -42,8 +42,9 @@ interface IImsRcsController { boolean isAvailable(int subId, int capability); // ImsUceAdapter specific - void requestCapabilities(int subId, in List<Uri> contactNumbers, IRcsUceControllerCallback c); + void requestCapabilities(int subId, String callingPackage, String callingFeatureId, + in List<Uri> contactNumbers, IRcsUceControllerCallback c); int getUcePublishState(int subId); - boolean isUceSettingEnabled(int subId); + boolean isUceSettingEnabled(int subId, String callingPackage, String callingFeatureId); void setUceSettingEnabled(int subId, boolean isEnabled); } diff --git a/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java b/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java index f4f804aff08d..84805442e5c7 100644 --- a/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java +++ b/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java @@ -21,17 +21,31 @@ import static com.android.testutils.ParcelUtilsKt.assertParcelSane; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import android.content.Context; + +import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import java.util.Arrays; + @RunWith(AndroidJUnit4.class) @SmallTest public class ApfCapabilitiesTest { + private Context mContext; + + @Before + public void setUp() { + mContext = InstrumentationRegistry.getContext(); + } + @Test public void testConstructAndParcel() { final ApfCapabilities caps = new ApfCapabilities(123, 456, 789); @@ -59,4 +73,27 @@ public class ApfCapabilitiesTest { caps = new ApfCapabilities(4 /* apfVersionSupported */, 5, 6); assertTrue(caps.hasDataAccess()); } + + @Test + public void testGetApfDrop8023Frames() { + // Get com.android.internal.R.bool.config_apfDrop802_3Frames. The test cannot directly + // use R.bool.config_apfDrop802_3Frames because that is not a stable resource ID. + final int resId = mContext.getResources().getIdentifier("config_apfDrop802_3Frames", + "bool", "android"); + final boolean shouldDrop8023Frames = mContext.getResources().getBoolean(resId); + final boolean actual = ApfCapabilities.getApfDrop8023Frames(); + assertEquals(shouldDrop8023Frames, actual); + } + + @Test + public void testGetApfEtherTypeBlackList() { + // Get com.android.internal.R.array.config_apfEthTypeBlackList. The test cannot directly + // use R.array.config_apfEthTypeBlackList because that is not a stable resource ID. + final int resId = mContext.getResources().getIdentifier("config_apfEthTypeBlackList", + "array", "android"); + final int[] blacklistedEtherTypeArray = mContext.getResources().getIntArray(resId); + final int[] actual = ApfCapabilities.getApfEtherTypeBlackList(); + assertNotNull(actual); + assertTrue(Arrays.equals(blacklistedEtherTypeArray, actual)); + } } |