From b1c57994da213cefbc101a5a8a030e978b650d4e Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Wed, 27 Nov 2019 15:57:33 -0800 Subject: [PATCH 01/12] Do not use hidden isPrivilegedApp Remove usage of isPrivilegedApp as it is used only for logging. Bug: 140908357 Test: Build Merged-In: I510e10cd17546ebd4aa59f14a3b10738e37e912d Change-Id: I510e10cd17546ebd4aa59f14a3b10738e37e912d --- cmds/statsd/src/atoms.proto | 3 ++- .../android/internal/telephony/TelephonyPermissions.java | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index d9083886f8177..c72e89b481eee 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -6237,7 +6237,8 @@ message DeviceIdentifierAccessDenied { optional bool is_preinstalled = 3; // True if the package is privileged. - optional bool is_priv_app = 4; + // Starting from Android 11, this boolean is not set and will always be false. + optional bool is_priv_app = 4 [deprecated = true]; } /** diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java index 5beb06d8595a4..2077800cd808b 100644 --- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java +++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java @@ -365,7 +365,6 @@ public final class TelephonyPermissions { private static boolean reportAccessDeniedToReadIdentifiers(Context context, int subId, int pid, int uid, String callingPackage, String message) { boolean isPreinstalled = false; - boolean isPrivApp = false; ApplicationInfo callingPackageInfo = null; try { callingPackageInfo = context.getPackageManager().getApplicationInfoAsUser( @@ -373,9 +372,6 @@ public final class TelephonyPermissions { if (callingPackageInfo != null) { if (callingPackageInfo.isSystemApp()) { isPreinstalled = true; - if (callingPackageInfo.isPrivilegedApp()) { - isPrivApp = true; - } } } } catch (PackageManager.NameNotFoundException e) { @@ -398,10 +394,10 @@ public final class TelephonyPermissions { } invokedMethods.add(message); StatsLog.write(StatsLog.DEVICE_IDENTIFIER_ACCESS_DENIED, callingPackage, message, - isPreinstalled, isPrivApp); + isPreinstalled, false); } Log.w(LOG_TAG, "reportAccessDeniedToReadIdentifiers:" + callingPackage + ":" + message - + ":isPreinstalled=" + isPreinstalled + ":isPrivApp=" + isPrivApp); + + ":isPreinstalled=" + isPreinstalled); // if the target SDK is pre-Q then check if the calling package would have previously // had access to device identifiers. if (callingPackageInfo != null && ( From 7998fbc67eae129a469b422a9e2325e3781210ec Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Wed, 27 Nov 2019 08:02:15 -0800 Subject: [PATCH 02/12] Do not use hidden withCleanCallingIdentity Do not use hidden withCleanCallingIdentity Bug: 140908357 Test: Build Merged-In: Ic6cbd587c009df973d4602ff21e5b8a9c27293ff Change-Id: Ic6cbd587c009df973d4602ff21e5b8a9c27293ff --- .../telephony/util/TelephonyUtils.java | 37 +++++++++++++++ .../telephony/ims/ImsMmTelManager.java | 10 +++-- .../android/telephony/ims/ImsRcsManager.java | 10 +++-- .../telephony/ims/ProvisioningManager.java | 21 ++++++--- .../android/telephony/ims/RcsUceAdapter.java | 19 +++++--- .../telephony/ims/RegistrationManager.java | 45 ++++++++++++++----- .../telephony/ims/feature/RcsFeature.java | 12 ++--- 7 files changed, 117 insertions(+), 37 deletions(-) diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java index 0498d7c31406f..2abcc76fdccca 100644 --- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java +++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java @@ -28,6 +28,7 @@ import android.os.RemoteException; import android.os.SystemProperties; import java.io.PrintWriter; +import java.util.function.Supplier; /** * This class provides various util functions @@ -74,6 +75,42 @@ public final class TelephonyUtils { throw new IllegalStateException("Missing ComponentInfo!"); } + /** + * Convenience method for running the provided action enclosed in + * {@link Binder#clearCallingIdentity}/{@link Binder#restoreCallingIdentity} + * + * Any exception thrown by the given action will need to be handled by caller. + * + */ + public static void runWithCleanCallingIdentity( + @NonNull Runnable action) { + long callingIdentity = Binder.clearCallingIdentity(); + try { + action.run(); + } finally { + Binder.restoreCallingIdentity(callingIdentity); + } + } + + + /** + * Convenience method for running the provided action enclosed in + * {@link Binder#clearCallingIdentity}/{@link Binder#restoreCallingIdentity} and return + * the result. + * + * Any exception thrown by the given action will need to be handled by caller. + * + */ + public static T runWithCleanCallingIdentity( + @NonNull Supplier action) { + long callingIdentity = Binder.clearCallingIdentity(); + try { + return action.get(); + } finally { + Binder.restoreCallingIdentity(callingIdentity); + } + } + /** * Filter values in bundle to only basic types. */ diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java index ba8e90ff539b3..494009f35dbaa 100644 --- a/telephony/java/android/telephony/ims/ImsMmTelManager.java +++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java @@ -163,9 +163,13 @@ public class ImsMmTelManager implements RegistrationManager { public void onCapabilitiesStatusChanged(int config) { if (mLocalCallback == null) return; - Binder.withCleanCallingIdentity(() -> - mExecutor.execute(() -> mLocalCallback.onCapabilitiesStatusChanged( - new MmTelFeature.MmTelCapabilities(config)))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> mLocalCallback.onCapabilitiesStatusChanged( + new MmTelFeature.MmTelCapabilities(config))); + } finally { + restoreCallingIdentity(callingIdentity); + } } @Override diff --git a/telephony/java/android/telephony/ims/ImsRcsManager.java b/telephony/java/android/telephony/ims/ImsRcsManager.java index 5aa37bba7efe8..917f91fcf232f 100644 --- a/telephony/java/android/telephony/ims/ImsRcsManager.java +++ b/telephony/java/android/telephony/ims/ImsRcsManager.java @@ -75,9 +75,13 @@ public class ImsRcsManager implements RegistrationManager { public void onCapabilitiesStatusChanged(int config) { if (mLocalCallback == null) return; - Binder.withCleanCallingIdentity(() -> - mExecutor.execute(() -> mLocalCallback.onAvailabilityChanged( - new RcsFeature.RcsImsCapabilities(config)))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> mLocalCallback.onAvailabilityChanged( + new RcsFeature.RcsImsCapabilities(config))); + } finally { + restoreCallingIdentity(callingIdentity); + } } @Override diff --git a/telephony/java/android/telephony/ims/ProvisioningManager.java b/telephony/java/android/telephony/ims/ProvisioningManager.java index aa4f77d09212e..6125001850dbe 100644 --- a/telephony/java/android/telephony/ims/ProvisioningManager.java +++ b/telephony/java/android/telephony/ims/ProvisioningManager.java @@ -791,17 +791,24 @@ public class ProvisioningManager { @Override public final void onIntConfigChanged(int item, int value) { - Binder.withCleanCallingIdentity(() -> - mExecutor.execute(() -> - mLocalConfigurationCallback.onProvisioningIntChanged(item, value))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> + mLocalConfigurationCallback.onProvisioningIntChanged(item, value)); + } finally { + restoreCallingIdentity(callingIdentity); + } } @Override public final void onStringConfigChanged(int item, String value) { - Binder.withCleanCallingIdentity(() -> - mExecutor.execute(() -> - mLocalConfigurationCallback.onProvisioningStringChanged(item, - value))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> + mLocalConfigurationCallback.onProvisioningStringChanged(item, value)); + } finally { + restoreCallingIdentity(callingIdentity); + } } private void setExecutor(Executor executor) { diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java index d3f393ae11a2f..5e3847f1359af 100644 --- a/telephony/java/android/telephony/ims/RcsUceAdapter.java +++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java @@ -251,15 +251,22 @@ public class RcsUceAdapter { IRcsUceControllerCallback internalCallback = new IRcsUceControllerCallback.Stub() { @Override public void onCapabilitiesReceived(List contactCapabilities) { - Binder.withCleanCallingIdentity(() -> - executor.execute(() -> - c.onCapabilitiesReceived(contactCapabilities))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> + c.onCapabilitiesReceived(contactCapabilities)); + } finally { + restoreCallingIdentity(callingIdentity); + } } @Override public void onError(int errorCode) { - Binder.withCleanCallingIdentity(() -> - executor.execute(() -> - c.onError(errorCode))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> c.onError(errorCode)); + } finally { + restoreCallingIdentity(callingIdentity); + } } }; diff --git a/telephony/java/android/telephony/ims/RegistrationManager.java b/telephony/java/android/telephony/ims/RegistrationManager.java index a1f6b78ba7c50..5c86ba732701f 100644 --- a/telephony/java/android/telephony/ims/RegistrationManager.java +++ b/telephony/java/android/telephony/ims/RegistrationManager.java @@ -105,41 +105,62 @@ public interface RegistrationManager { public void onRegistered(int imsRadioTech) { if (mLocalCallback == null) return; - Binder.withCleanCallingIdentity(() -> mExecutor.execute(() -> - mLocalCallback.onRegistered(getAccessType(imsRadioTech)))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> + mLocalCallback.onRegistered(getAccessType(imsRadioTech))); + } finally { + restoreCallingIdentity(callingIdentity); + } } @Override public void onRegistering(int imsRadioTech) { if (mLocalCallback == null) return; - Binder.withCleanCallingIdentity(() -> mExecutor.execute(() -> - mLocalCallback.onRegistering(getAccessType(imsRadioTech)))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> + mLocalCallback.onRegistering(getAccessType(imsRadioTech))); + } finally { + restoreCallingIdentity(callingIdentity); + } } @Override public void onDeregistered(ImsReasonInfo info) { if (mLocalCallback == null) return; - Binder.withCleanCallingIdentity(() -> - mExecutor.execute(() -> mLocalCallback.onUnregistered(info))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> mLocalCallback.onUnregistered(info)); + } finally { + restoreCallingIdentity(callingIdentity); + } } @Override public void onTechnologyChangeFailed(int imsRadioTech, ImsReasonInfo info) { if (mLocalCallback == null) return; - Binder.withCleanCallingIdentity(() -> - mExecutor.execute(() -> mLocalCallback.onTechnologyChangeFailed( - getAccessType(imsRadioTech), info))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> mLocalCallback.onTechnologyChangeFailed( + getAccessType(imsRadioTech), info)); + } finally { + restoreCallingIdentity(callingIdentity); + } } public void onSubscriberAssociatedUriChanged(Uri[] uris) { if (mLocalCallback == null) return; - Binder.withCleanCallingIdentity(() -> - mExecutor.execute(() -> - mLocalCallback.onSubscriberAssociatedUriChanged(uris))); + long callingIdentity = Binder.clearCallingIdentity(); + try { + mExecutor.execute(() -> mLocalCallback.onSubscriberAssociatedUriChanged(uris)); + } finally { + restoreCallingIdentity(callingIdentity); + } } private void setExecutor(Executor executor) { diff --git a/telephony/java/android/telephony/ims/feature/RcsFeature.java b/telephony/java/android/telephony/ims/feature/RcsFeature.java index e4efc20437bb5..8e67621b2ea31 100644 --- a/telephony/java/android/telephony/ims/feature/RcsFeature.java +++ b/telephony/java/android/telephony/ims/feature/RcsFeature.java @@ -22,7 +22,6 @@ import android.annotation.NonNull; import android.annotation.SystemApi; import android.annotation.TestApi; import android.net.Uri; -import android.os.Binder; import android.os.RemoteException; import android.telephony.ims.RcsContactUceCapability; import android.telephony.ims.aidl.IImsCapabilityCallback; @@ -33,7 +32,7 @@ import android.telephony.ims.stub.RcsPresenceExchangeImplBase; import android.telephony.ims.stub.RcsSipOptionsImplBase; import android.util.Log; -import com.android.internal.util.FunctionalUtils; +import com.android.internal.telephony.util.TelephonyUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -43,6 +42,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; +import java.util.function.Supplier; /** * Base implementation of the RcsFeature APIs. Any ImsService wishing to support RCS should extend @@ -150,13 +150,13 @@ public class RcsFeature extends ImsFeature { // Call the methods with a clean calling identity on the executor and wait indefinitely for // the future to return. - private void executeMethodAsync(FunctionalUtils.ThrowingRunnable r, String errorLogName) + private void executeMethodAsync(Runnable r, String errorLogName) throws RemoteException { // call with a clean calling identity on the executor and wait indefinitely for the // future to return. try { CompletableFuture.runAsync( - () -> Binder.withCleanCallingIdentity(r), mExecutor).join(); + () -> TelephonyUtils.runWithCleanCallingIdentity(r), mExecutor).join(); } catch (CancellationException | CompletionException e) { Log.w(LOG_TAG, "RcsFeatureBinder - " + errorLogName + " exception: " + e.getMessage()); @@ -164,12 +164,12 @@ public class RcsFeature extends ImsFeature { } } - private T executeMethodAsyncForResult(FunctionalUtils.ThrowingSupplier r, + private T executeMethodAsyncForResult(Supplier r, String errorLogName) throws RemoteException { // call with a clean calling identity on the executor and wait indefinitely for the // future to return. CompletableFuture future = CompletableFuture.supplyAsync( - () -> Binder.withCleanCallingIdentity(r), mExecutor); + () -> TelephonyUtils.runWithCleanCallingIdentity(r), mExecutor); try { return future.get(); } catch (ExecutionException | InterruptedException e) { From 2f45d6dcc09c62025579a3e4f9cc94fcb8039562 Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Tue, 10 Dec 2019 19:29:01 -0800 Subject: [PATCH 03/12] Remove usage of hidden Parcel APIs Remove usage of hidden Parcel APIs Bug: 140908357 Test: Build Merged-In: Iccc072e03f05141370c4ad5cc49cb8e25929fcac Change-Id: Iccc072e03f05141370c4ad5cc49cb8e25929fcac --- .../android/telephony/NetworkScanRequest.java | 12 +++++++----- .../java/android/telephony/PhoneNumberRange.java | 16 ++++++++-------- .../java/android/telephony/SubscriptionInfo.java | 15 +++++++-------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/telephony/java/android/telephony/NetworkScanRequest.java b/telephony/java/android/telephony/NetworkScanRequest.java index 465b6aa79d404..0ceb103d0f273 100644 --- a/telephony/java/android/telephony/NetworkScanRequest.java +++ b/telephony/java/android/telephony/NetworkScanRequest.java @@ -20,10 +20,10 @@ import android.annotation.IntDef; import android.os.Parcel; import android.os.Parcelable; -import java.util.ArrayList; -import java.util.Arrays; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.ArrayList; +import java.util.Arrays; /** * Defines a request to peform a network scan. @@ -221,9 +221,11 @@ public final class NetworkScanRequest implements Parcelable { private NetworkScanRequest(Parcel in) { mScanType = in.readInt(); - mSpecifiers = (RadioAccessSpecifier[]) in.readParcelableArray( - Object.class.getClassLoader(), - RadioAccessSpecifier.class); + Parcelable[] tempSpecifiers = in.readParcelableArray(Object.class.getClassLoader()); + mSpecifiers = new RadioAccessSpecifier[tempSpecifiers.length]; + for (int i = 0; i < tempSpecifiers.length; i++) { + mSpecifiers[i] = (RadioAccessSpecifier) tempSpecifiers[i]; + } mSearchPeriodicity = in.readInt(); mMaxSearchTime = in.readInt(); mIncrementalResults = in.readBoolean(); diff --git a/telephony/java/android/telephony/PhoneNumberRange.java b/telephony/java/android/telephony/PhoneNumberRange.java index e6f107e28c981..2b199d2df1414 100644 --- a/telephony/java/android/telephony/PhoneNumberRange.java +++ b/telephony/java/android/telephony/PhoneNumberRange.java @@ -85,18 +85,18 @@ public final class PhoneNumberRange implements Parcelable { } private PhoneNumberRange(Parcel in) { - mCountryCode = in.readStringNoHelper(); - mPrefix = in.readStringNoHelper(); - mLowerBound = in.readStringNoHelper(); - mUpperBound = in.readStringNoHelper(); + mCountryCode = in.readString(); + mPrefix = in.readString(); + mLowerBound = in.readString(); + mUpperBound = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeStringNoHelper(mCountryCode); - dest.writeStringNoHelper(mPrefix); - dest.writeStringNoHelper(mLowerBound); - dest.writeStringNoHelper(mUpperBound); + dest.writeString(mCountryCode); + dest.writeString(mPrefix); + dest.writeString(mLowerBound); + dest.writeString(mUpperBound); } @Override diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index 2d8e2376b9d8b..832771daa409c 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -16,8 +16,6 @@ package android.telephony; -import com.android.telephony.Rlog; - import android.annotation.Nullable; import android.annotation.SystemApi; import android.compat.annotation.UnsupportedAppUsage; @@ -40,6 +38,7 @@ import android.util.DisplayMetrics; import android.util.Log; import com.android.internal.telephony.util.TelephonyUtils; +import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.Arrays; @@ -685,8 +684,8 @@ public class SubscriptionInfo implements Parcelable { int id = source.readInt(); String iccId = source.readString(); int simSlotIndex = source.readInt(); - CharSequence displayName = source.readCharSequence(); - CharSequence carrierName = source.readCharSequence(); + CharSequence displayName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); + CharSequence carrierName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); int nameSource = source.readInt(); int iconTint = source.readInt(); String number = source.readString(); @@ -705,8 +704,8 @@ public class SubscriptionInfo implements Parcelable { int carrierid = source.readInt(); int profileClass = source.readInt(); int subType = source.readInt(); - String[] ehplmns = source.readStringArray(); - String[] hplmns = source.readStringArray(); + String[] ehplmns = source.createStringArray(); + String[] hplmns = source.createStringArray(); String groupOwner = source.readString(); UiccAccessRule[] carrierConfigAccessRules = source.createTypedArray( UiccAccessRule.CREATOR); @@ -732,8 +731,8 @@ public class SubscriptionInfo implements Parcelable { dest.writeInt(mId); dest.writeString(mIccId); dest.writeInt(mSimSlotIndex); - dest.writeCharSequence(mDisplayName); - dest.writeCharSequence(mCarrierName); + TextUtils.writeToParcel(mDisplayName, dest, 0); + TextUtils.writeToParcel(mCarrierName, dest, 0); dest.writeInt(mNameSource); dest.writeInt(mIconTint); dest.writeString(mNumber); From c1fbe4dd390b49ce1e39f9b1416f52a0a994dfce Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Mon, 9 Dec 2019 17:19:53 -0800 Subject: [PATCH 04/12] Make requestModemActivityInfo a system api Make requestModemActivityInfo a system api Bug: 140908357 Test: Build Merged-In: Id3db96212af713de09ef761629db86ecd02cfe8a Change-Id: Id3db96212af713de09ef761629db86ecd02cfe8a --- api/system-current.txt | 1 + telephony/java/android/telephony/TelephonyManager.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/system-current.txt b/api/system-current.txt index b0fe30525f7d1..ab69bdc53d8c8 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -9529,6 +9529,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void reportDefaultNetworkStatus(boolean); method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback); + method public void requestModemActivityInfo(@NonNull android.os.ResultReceiver); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestNumberVerification(@NonNull android.telephony.PhoneNumberRange, long, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.NumberVerificationCallback); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void resetAllCarrierActions(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void resetCarrierKeysForImsiEncryption(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 3dff079497bf0..217c290139bec 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -9817,7 +9817,8 @@ public class TelephonyManager { * {@link android.telephony.ModemActivityInfo} object. * @hide */ - public void requestModemActivityInfo(ResultReceiver result) { + @SystemApi + public void requestModemActivityInfo(@NonNull ResultReceiver result) { try { ITelephony service = getITelephony(); if (service != null) { From 02f70c7476fcf116c9c1dd1851d74c977a60c81d Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Wed, 11 Dec 2019 10:02:08 -0800 Subject: [PATCH 05/12] Do not use hidden broadcast API of RemoteCallbackList Do not use hidden broadcast API of RemoteCallbackList Bug: 140908357 Bug: 146349977 Test: Build Merged-In: I5fa9b0f36f18c6073ad20867f6bf62d573f823b8 Change-Id: I5fa9b0f36f18c6073ad20867f6bf62d573f823b8 --- .../telephony/ims/feature/ImsFeature.java | 14 +++--- .../telephony/ims/stub/ImsConfigImplBase.java | 9 ++-- .../ims/stub/ImsRegistrationImplBase.java | 16 +++---- .../telephony/util/RemoteCallbackListExt.java | 46 +++++++++++++++++++ 4 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 telephony/java/com/android/internal/telephony/util/RemoteCallbackListExt.java diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java index 5d102cb4ac06d..e5779b315c933 100644 --- a/telephony/java/android/telephony/ims/feature/ImsFeature.java +++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java @@ -22,7 +22,6 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.Context; import android.os.IInterface; -import android.os.RemoteCallbackList; import android.os.RemoteException; import android.telephony.SubscriptionManager; import android.telephony.ims.aidl.IImsCapabilityCallback; @@ -31,6 +30,7 @@ import android.util.Log; import com.android.ims.internal.IImsFeatureStatusCallback; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.telephony.util.RemoteCallbackListExt; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -326,12 +326,12 @@ public abstract class ImsFeature { /** @hide */ protected final Object mLock = new Object(); - private final RemoteCallbackList mStatusCallbacks = - new RemoteCallbackList<>(); + private final RemoteCallbackListExt mStatusCallbacks = + new RemoteCallbackListExt<>(); private @ImsState int mState = STATE_UNAVAILABLE; private int mSlotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX; - private final RemoteCallbackList mCapabilityCallbacks = - new RemoteCallbackList<>(); + private final RemoteCallbackListExt mCapabilityCallbacks = + new RemoteCallbackListExt<>(); private Capabilities mCapabilityStatus = new Capabilities(); /** @@ -412,7 +412,7 @@ public abstract class ImsFeature { * Internal method called by ImsFeature when setFeatureState has changed. */ private void notifyFeatureState(@ImsState int state) { - mStatusCallbacks.broadcast((c) -> { + mStatusCallbacks.broadcastAction((c) -> { try { c.notifyImsFeatureStatus(state); } catch (RemoteException e) { @@ -491,7 +491,7 @@ public abstract class ImsFeature { synchronized (mLock) { mCapabilityStatus = caps.copy(); } - mCapabilityCallbacks.broadcast((callback) -> { + mCapabilityCallbacks.broadcastAction((callback) -> { try { callback.onCapabilitiesStatusChanged(caps.mCapabilities); } catch (RemoteException e) { diff --git a/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java b/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java index e0d576db4f14b..6a2638bc72216 100644 --- a/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java @@ -22,7 +22,6 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.Context; import android.os.PersistableBundle; -import android.os.RemoteCallbackList; import android.os.RemoteException; import android.telephony.ims.ProvisioningManager; import android.telephony.ims.aidl.IImsConfig; @@ -31,6 +30,7 @@ import android.util.Log; import com.android.ims.ImsConfig; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.telephony.util.RemoteCallbackListExt; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -257,7 +257,8 @@ public class ImsConfigImplBase { }) public @interface SetConfigResult {} - private final RemoteCallbackList mCallbacks = new RemoteCallbackList<>(); + private final RemoteCallbackListExt mCallbacks = + new RemoteCallbackListExt<>(); ImsConfigStub mImsConfigStub; /** @@ -298,7 +299,7 @@ public class ImsConfigImplBase { if (mCallbacks == null) { return; } - mCallbacks.broadcast(c -> { + mCallbacks.broadcastAction(c -> { try { c.onIntConfigChanged(item, value); } catch (RemoteException e) { @@ -312,7 +313,7 @@ public class ImsConfigImplBase { if (mCallbacks == null) { return; } - mCallbacks.broadcast(c -> { + mCallbacks.broadcastAction(c -> { try { c.onStringConfigChanged(item, value); } catch (RemoteException e) { diff --git a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java index c0f16e5f9fbc1..14a64d2585eda 100644 --- a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java @@ -20,7 +20,6 @@ import android.annotation.IntDef; import android.annotation.SystemApi; import android.annotation.TestApi; import android.net.Uri; -import android.os.RemoteCallbackList; import android.os.RemoteException; import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.RegistrationManager; @@ -29,6 +28,7 @@ import android.telephony.ims.aidl.IImsRegistrationCallback; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.telephony.util.RemoteCallbackListExt; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -94,8 +94,8 @@ public class ImsRegistrationImplBase { } }; - private final RemoteCallbackList mCallbacks - = new RemoteCallbackList<>(); + private final RemoteCallbackListExt mCallbacks = + new RemoteCallbackListExt<>(); private final Object mLock = new Object(); // Locked on mLock private @ImsRegistrationTech @@ -129,7 +129,7 @@ public class ImsRegistrationImplBase { */ public final void onRegistered(@ImsRegistrationTech int imsRadioTech) { updateToState(imsRadioTech, RegistrationManager.REGISTRATION_STATE_REGISTERED); - mCallbacks.broadcast((c) -> { + mCallbacks.broadcastAction((c) -> { try { c.onRegistered(imsRadioTech); } catch (RemoteException e) { @@ -147,7 +147,7 @@ public class ImsRegistrationImplBase { */ public final void onRegistering(@ImsRegistrationTech int imsRadioTech) { updateToState(imsRadioTech, RegistrationManager.REGISTRATION_STATE_REGISTERING); - mCallbacks.broadcast((c) -> { + mCallbacks.broadcastAction((c) -> { try { c.onRegistering(imsRadioTech); } catch (RemoteException e) { @@ -175,7 +175,7 @@ public class ImsRegistrationImplBase { */ public final void onDeregistered(ImsReasonInfo info) { updateToDisconnectedState(info); - mCallbacks.broadcast((c) -> { + mCallbacks.broadcastAction((c) -> { try { c.onDeregistered(info); } catch (RemoteException e) { @@ -194,7 +194,7 @@ public class ImsRegistrationImplBase { */ public final void onTechnologyChangeFailed(@ImsRegistrationTech int imsRadioTech, ImsReasonInfo info) { - mCallbacks.broadcast((c) -> { + mCallbacks.broadcastAction((c) -> { try { c.onTechnologyChangeFailed(imsRadioTech, info); } catch (RemoteException e) { @@ -210,7 +210,7 @@ public class ImsRegistrationImplBase { * @param uris */ public final void onSubscriberAssociatedUriChanged(Uri[] uris) { - mCallbacks.broadcast((c) -> { + mCallbacks.broadcastAction((c) -> { try { c.onSubscriberAssociatedUriChanged(uris); } catch (RemoteException e) { diff --git a/telephony/java/com/android/internal/telephony/util/RemoteCallbackListExt.java b/telephony/java/com/android/internal/telephony/util/RemoteCallbackListExt.java new file mode 100644 index 0000000000000..d66bda9117298 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/util/RemoteCallbackListExt.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony.util; + +import android.os.IInterface; +import android.os.RemoteCallbackList; + +import java.util.function.Consumer; + +/** + * Extension of RemoteCallbackList + * @param defines the type of registered callbacks + */ +public class RemoteCallbackListExt extends RemoteCallbackList { + /** + * Performs {@code action} on each callback, calling + * {@link RemoteCallbackListExt#beginBroadcast()} + * /{@link RemoteCallbackListExt#finishBroadcast()} before/after looping + * @param action to be performed on each callback + * + */ + public void broadcastAction(Consumer action) { + int itemCount = beginBroadcast(); + try { + for (int i = 0; i < itemCount; i++) { + action.accept(getBroadcastItem(i)); + } + } finally { + finishBroadcast(); + } + } +} From c834e855cb56680907bcc5f271ca06c33b15365c Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Mon, 16 Dec 2019 16:46:55 -0800 Subject: [PATCH 06/12] Fix testNetworkScanRequestParcel_Parcel CTS Allow mSpecifiers to be null in case the length of the specifier array is less than null Bug: 146363437 Test: Ran CTS cts-tradefed run cts -m CtsCarrierApiTestCases --test android.carrierapi.cts.NetworkScanApiTest Merged-In: Iad7d91d8813415bbd2f3b6cad02120e59441e08a Change-Id: Iad7d91d8813415bbd2f3b6cad02120e59441e08a --- .../java/android/telephony/NetworkScanRequest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/telephony/java/android/telephony/NetworkScanRequest.java b/telephony/java/android/telephony/NetworkScanRequest.java index 0ceb103d0f273..c8b8ffb9846b1 100644 --- a/telephony/java/android/telephony/NetworkScanRequest.java +++ b/telephony/java/android/telephony/NetworkScanRequest.java @@ -222,9 +222,13 @@ public final class NetworkScanRequest implements Parcelable { private NetworkScanRequest(Parcel in) { mScanType = in.readInt(); Parcelable[] tempSpecifiers = in.readParcelableArray(Object.class.getClassLoader()); - mSpecifiers = new RadioAccessSpecifier[tempSpecifiers.length]; - for (int i = 0; i < tempSpecifiers.length; i++) { - mSpecifiers[i] = (RadioAccessSpecifier) tempSpecifiers[i]; + if (tempSpecifiers != null) { + mSpecifiers = new RadioAccessSpecifier[tempSpecifiers.length]; + for (int i = 0; i < tempSpecifiers.length; i++) { + mSpecifiers[i] = (RadioAccessSpecifier) tempSpecifiers[i]; + } + } else { + mSpecifiers = null; } mSearchPeriodicity = in.readInt(); mMaxSearchTime = in.readInt(); From 05ba9bb324ef09c5511a8b0563524753bf254c3e Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Mon, 6 Jan 2020 11:20:20 -0800 Subject: [PATCH 07/12] Do not use hidden putIntForUser Do not use hidden Secure;->getIntForUser Secure;->putIntForUser Bug: 146354533 Test: unit test com.android.frameworks.telephonytests (25 Tests) [1/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_EmptyList: PASSED (379ms) [2/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Associated_Default: PASSED (77ms) [3/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Associated_DisabledUntilUsed: PASSED (0ms) [4/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Disabled: PASSED (26ms) [5/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_DisabledUser: PASSED (25ms) [6/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Enabled: PASSED (51ms) [7/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_MissingAssociated_Default: PASSED (26ms) [8/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_UpdatedApp: PASSED (26ms) [9/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_UpdatedAssociated_DisabledUntilUsed: PASSED (51ms) [10/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_MissingApp: PASSED (50ms) [11/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Associated_Default: PASSED (1ms) [12/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Associated_Default_AlreadyRun: PASSED (51ms) [13/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Disabled: PASSED (0ms) [14/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUntilUsed: PASSED (26ms) [15/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUser: PASSED (25ms) [16/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Enabled: PASSED (51ms) [17/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_EnabledAssociated_Default: PASSED (26ms) [18/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_UpdatedApp: PASSED (25ms) [19/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NonSystemApp: PASSED (26ms) [20/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_Default: PASSED (26ms) [21/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_Disabled: PASSED (25ms) [22/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_DisabledUntilUsed: PASSED (26ms) [23/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_DisabledUser: PASSED (25ms) [24/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_Enabled: PASSED (26ms) [25/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_UpdatedApp: PASSED (26ms) Merged-In: Ide97d443f759ee60a41ba55096b6f9769c6eea3a Change-Id: Ide97d443f759ee60a41ba55096b6f9769c6eea3a --- .../server/pm/PackageManagerService.java | 2 +- .../internal/telephony/CarrierAppUtils.java | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 7e7822cd978ef..d8f5dfbbaf488 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -21009,7 +21009,7 @@ public class PackageManagerService extends IPackageManager.Stub // Disable any carrier apps. We do this very early in boot to prevent the apps from being // disabled after already being started. CarrierAppUtils.disableCarrierAppsUntilPrivileged(mContext.getOpPackageName(), this, - mContext.getContentResolver(), UserHandle.USER_SYSTEM); + UserHandle.USER_SYSTEM, mContext); disableSkuSpecificApps(); diff --git a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java index 3f5aa0f86b752..8359589dcfb7e 100644 --- a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java +++ b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java @@ -18,16 +18,18 @@ package com.android.internal.telephony; import android.annotation.Nullable; import android.content.ContentResolver; +import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.res.Resources; import android.os.RemoteException; +import android.os.UserHandle; import android.provider.Settings; -import android.util.Log; import android.telephony.TelephonyManager; import android.util.ArrayMap; import android.util.ArraySet; +import android.util.Log; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; @@ -75,7 +77,7 @@ public final class CarrierAppUtils { */ public static synchronized void disableCarrierAppsUntilPrivileged(String callingPackage, IPackageManager packageManager, TelephonyManager telephonyManager, - ContentResolver contentResolver, int userId) { + int userId, Context context) { if (DEBUG) { Log.d(TAG, "disableCarrierAppsUntilPrivileged"); } @@ -84,6 +86,7 @@ public final class CarrierAppUtils { config.getDisabledUntilUsedPreinstalledCarrierApps(); ArrayMap> systemCarrierAssociatedAppsDisabledUntilUsed = config.getDisabledUntilUsedPreinstalledCarrierAssociatedApps(); + ContentResolver contentResolver = getContentResolverForUser(context, userId); disableCarrierAppsUntilPrivileged(callingPackage, packageManager, telephonyManager, contentResolver, userId, systemCarrierAppsDisabledUntilUsed, systemCarrierAssociatedAppsDisabledUntilUsed); @@ -101,7 +104,7 @@ public final class CarrierAppUtils { * Manager can kill it, and this can lead to crashes as the app is in an unexpected state. */ public static synchronized void disableCarrierAppsUntilPrivileged(String callingPackage, - IPackageManager packageManager, ContentResolver contentResolver, int userId) { + IPackageManager packageManager, int userId, Context context) { if (DEBUG) { Log.d(TAG, "disableCarrierAppsUntilPrivileged"); } @@ -112,15 +115,23 @@ public final class CarrierAppUtils { ArrayMap> systemCarrierAssociatedAppsDisabledUntilUsed = config.getDisabledUntilUsedPreinstalledCarrierAssociatedApps(); + ContentResolver contentResolver = getContentResolverForUser(context, userId); disableCarrierAppsUntilPrivileged(callingPackage, packageManager, null /* telephonyManager */, contentResolver, userId, systemCarrierAppsDisabledUntilUsed, systemCarrierAssociatedAppsDisabledUntilUsed); } + private static ContentResolver getContentResolverForUser(Context context, int userId) { + Context userContext = context.createContextAsUser(UserHandle.getUserHandleForUid(userId), + 0); + return userContext.getContentResolver(); + } + /** * Disable carrier apps until they are privileged * Must be public b/c framework unit tests can't access package-private methods. */ + // Must be public b/c framework unit tests can't access package-private methods. @VisibleForTesting public static void disableCarrierAppsUntilPrivileged(String callingPackage, IPackageManager packageManager, @Nullable TelephonyManager telephonyManager, @@ -139,9 +150,8 @@ public final class CarrierAppUtils { systemCarrierAssociatedAppsDisabledUntilUsed); List enabledCarrierPackages = new ArrayList<>(); - - boolean hasRunOnce = Settings.Secure.getIntForUser( - contentResolver, Settings.Secure.CARRIER_APPS_HANDLED, 0, userId) == 1; + boolean hasRunOnce = Settings.Secure.getInt(contentResolver, + Settings.Secure.CARRIER_APPS_HANDLED, 0) == 1; try { for (ApplicationInfo ai : candidates) { @@ -256,8 +266,7 @@ public final class CarrierAppUtils { // Mark the execution so we do not disable apps again. if (!hasRunOnce) { - Settings.Secure.putIntForUser( - contentResolver, Settings.Secure.CARRIER_APPS_HANDLED, 1, userId); + Settings.Secure.putInt(contentResolver, Settings.Secure.CARRIER_APPS_HANDLED, 1); } if (!enabledCarrierPackages.isEmpty()) { From 2d9f56982c1c9582508ca9c6c80f1d77ae6109f8 Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Mon, 16 Dec 2019 10:23:57 -0800 Subject: [PATCH 08/12] Do not use hidden enabledSetting Do not use hidden ApplicationInfo#enabledSetting Bug: 140908357 Test: unit test Test: unit test om.android.frameworks.telephonytests (25 Tests) [1/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_EmptyList: PASSED (379ms) [2/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Associated_Default: PASSED (25ms) [3/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Associated_DisabledUntilUsed: PASSED (1ms) [4/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Disabled: PASSED (25ms) [5/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_DisabledUser: PASSED (76ms) [6/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_Enabled: PASSED (26ms) [7/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_MissingAssociated_Default: PASSED (25ms) [8/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_UpdatedApp: PASSED (25ms) [9/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_HasPrivileges_UpdatedAssociated_DisabledUntilUsed: PASSED (26ms) [10/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_MissingApp: PASSED (26ms) [11/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Associated_Default: PASSED (25ms) [12/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Associated_Default_AlreadyRun: PASSED (26ms) [13/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Disabled: PASSED (25ms) [14/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUntilUsed: PASSED (51ms) [15/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_DisabledUser: PASSED (26ms) [16/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_Enabled: PASSED (50ms) [17/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_EnabledAssociated_Default: PASSED (26ms) [18/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NoPrivileges_UpdatedApp: PASSED (25ms) [19/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NonSystemApp: PASSED (26ms) [20/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_Default: PASSED (26ms) [21/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_Disabled: PASSED (26ms) [22/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_DisabledUntilUsed: PASSED (26ms) [23/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_DisabledUser: PASSED (26ms) [24/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_Enabled: PASSED (26ms) [25/25] com.android.internal.telephony.CarrierAppUtilsTest#testDisableCarrierAppsUntilPrivileged_NullPrivileges_UpdatedApp: PASSED (25ms) Summary ------- arm64-v8a FrameworksTelephonyTests: Passed: 25, Failed: 0, Ignored: 0, Assumption Failed: 0 Merged-In: I25d6c7ae0416dd96bf66dbd1615fba5ec87f80cf Change-Id: I25d6c7ae0416dd96bf66dbd1615fba5ec87f80cf --- .../internal/telephony/CarrierAppUtils.java | 82 +++++++++++++++---- 1 file changed, 67 insertions(+), 15 deletions(-) diff --git a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java index 8359589dcfb7e..3c1e707ab1dd5 100644 --- a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java +++ b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java @@ -138,8 +138,8 @@ public final class CarrierAppUtils { ContentResolver contentResolver, int userId, ArraySet systemCarrierAppsDisabledUntilUsed, ArrayMap> systemCarrierAssociatedAppsDisabledUntilUsed) { - List candidates = getDefaultCarrierAppCandidatesHelper(packageManager, - userId, systemCarrierAppsDisabledUntilUsed); + List candidates = getDefaultNotUpdatedCarrierAppCandidatesHelper( + packageManager, userId, systemCarrierAppsDisabledUntilUsed); if (candidates == null || candidates.isEmpty()) { return; } @@ -175,15 +175,16 @@ public final class CarrierAppUtils { } } + int enabledSetting = packageManager.getApplicationEnabledSetting(packageName, + userId); if (hasPrivileges) { // Only update enabled state for the app on /system. Once it has been // updated we shouldn't touch it. - if (!ai.isUpdatedSystemApp() - && (ai.enabledSetting + if (enabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT - || ai.enabledSetting + || enabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED - || (ai.flags & ApplicationInfo.FLAG_INSTALLED) == 0)) { + || (ai.flags & ApplicationInfo.FLAG_INSTALLED) == 0) { Log.i(TAG, "Update state(" + packageName + "): ENABLED for user " + userId); packageManager.setSystemAppInstallState( @@ -201,9 +202,12 @@ public final class CarrierAppUtils { // Also enable any associated apps for this carrier app. if (associatedAppList != null) { for (ApplicationInfo associatedApp : associatedAppList) { - if (associatedApp.enabledSetting + int associatedAppEnabledSetting = + packageManager.getApplicationEnabledSetting( + associatedApp.packageName, userId); + if (associatedAppEnabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT - || associatedApp.enabledSetting + || associatedAppEnabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED || (associatedApp.flags & ApplicationInfo.FLAG_INSTALLED) == 0) { @@ -228,8 +232,7 @@ public final class CarrierAppUtils { } else { // No carrier privileges // Only update enabled state for the app on /system. Once it has been // updated we shouldn't touch it. - if (!ai.isUpdatedSystemApp() - && ai.enabledSetting + if (enabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT && (ai.flags & ApplicationInfo.FLAG_INSTALLED) != 0) { Log.i(TAG, "Update state(" + packageName @@ -246,7 +249,10 @@ public final class CarrierAppUtils { if (!hasRunOnce) { if (associatedAppList != null) { for (ApplicationInfo associatedApp : associatedAppList) { - if (associatedApp.enabledSetting + int associatedAppEnabledSetting = + packageManager.getApplicationEnabledSetting( + associatedApp.packageName, userId); + if (associatedAppEnabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT && (associatedApp.flags & ApplicationInfo.FLAG_INSTALLED) != 0) { @@ -357,6 +363,31 @@ public final class CarrierAppUtils { return apps; } + private static List getDefaultNotUpdatedCarrierAppCandidatesHelper( + IPackageManager packageManager, + int userId, + ArraySet systemCarrierAppsDisabledUntilUsed) { + if (systemCarrierAppsDisabledUntilUsed == null) { + return null; + } + + int size = systemCarrierAppsDisabledUntilUsed.size(); + if (size == 0) { + return null; + } + + List apps = new ArrayList<>(size); + for (int i = 0; i < size; i++) { + String packageName = systemCarrierAppsDisabledUntilUsed.valueAt(i); + ApplicationInfo ai = + getApplicationInfoIfNotUpdatedSystemApp(packageManager, userId, packageName); + if (ai != null) { + apps.add(ai); + } + } + return apps; + } + private static Map> getDefaultCarrierAssociatedAppsHelper( IPackageManager packageManager, int userId, @@ -369,11 +400,11 @@ public final class CarrierAppUtils { systemCarrierAssociatedAppsDisabledUntilUsed.valueAt(i); for (int j = 0; j < associatedAppPackages.size(); j++) { ApplicationInfo ai = - getApplicationInfoIfSystemApp( + getApplicationInfoIfNotUpdatedSystemApp( packageManager, userId, associatedAppPackages.get(j)); // Only update enabled state for the app on /system. Once it has been updated we // shouldn't touch it. - if (ai != null && !ai.isUpdatedSystemApp()) { + if (ai != null) { List appList = associatedApps.get(carrierAppPackage); if (appList == null) { appList = new ArrayList<>(); @@ -386,6 +417,26 @@ public final class CarrierAppUtils { return associatedApps; } + @Nullable + private static ApplicationInfo getApplicationInfoIfNotUpdatedSystemApp( + IPackageManager packageManager, + int userId, + String packageName) { + try { + ApplicationInfo ai = packageManager.getApplicationInfo(packageName, + PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS + | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS + | PackageManager.MATCH_SYSTEM_ONLY + | PackageManager.MATCH_FACTORY_ONLY, userId); + if (ai != null) { + return ai; + } + } catch (RemoteException e) { + Log.w(TAG, "Could not reach PackageManager", e); + } + return null; + } + @Nullable private static ApplicationInfo getApplicationInfoIfSystemApp( IPackageManager packageManager, @@ -394,8 +445,9 @@ public final class CarrierAppUtils { try { ApplicationInfo ai = packageManager.getApplicationInfo(packageName, PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS - | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, userId); - if (ai != null && ai.isSystemApp()) { + | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS + | PackageManager.MATCH_SYSTEM_ONLY, userId); + if (ai != null) { return ai; } } catch (RemoteException e) { From 0d12117ebbc01246e746778145e6cc50951fb2dd Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Mon, 4 Nov 2019 13:07:23 -0800 Subject: [PATCH 09/12] Carrier config to switch data if primary is OOS Carrier config to switch data to primary from cbrs if primary is OOS Carrier config to specify back off time from cbrs to primary Bug: 143578171 Test: make Merged-In: I2fbec74b7f00dcb751e38b0f5a336fea8370cbee Change-Id: I2fbec74b7f00dcb751e38b0f5a336fea8370cbee --- .../telephony/CarrierConfigManager.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 71411d5461a2e..7ee521c24a986 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -2992,6 +2992,27 @@ public class CarrierConfigManager { */ public static final String KEY_5G_WATCHDOG_TIME_MS_LONG = "5g_watchdog_time_long"; + /** + * Controls whether to switch data to primary from opportunistic subscription + * if primary is out of service. This control only affects system or 1st party app + * initiated data switch, but will not override data switch initiated by privileged carrier apps + * This carrier config is used to disable this feature. + * @hide + */ + public static final String KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL = + "switch_data_to_primary_if_primary_is_oos_bool"; + + /** + * Controls back off time in milli seconds for switching back to + * opportunistic subscription. This time will be added to + * {@link CarrierConfigManager#KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_HYSTERESIS_TIME_LONG} to + * determine hysteresis time if there is frequent switching + * (determined by system app or 1st party app) between primary and opportunistic + * subscription. + * @hide + */ + public static final String KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG = + "opportunistic_network_backoff_time_long"; /** * Indicates zero or more emergency number prefix(es), because some carrier requires @@ -3816,6 +3837,9 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL, true); /* Default value is 1 hour. */ sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000); + sDefaults.putBoolean(KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL, true); + /* Default value is 10 seconds. */ + sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG, 10000); sDefaults.putAll(Gps.getDefaults()); sDefaults.putIntArray(KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY, new int[] { From 269b3331b8e8b23eb8582bcf7f4b409438846f23 Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Tue, 19 Nov 2019 10:23:22 -0800 Subject: [PATCH 10/12] Add back off timer configs as carrier config Add time to determine as ping pong as a carrier config Add max back off hysteresis time as a carrier config Test: build Bug: 143578171 Merged-In: I599aa88c4a8f29ca62aaa2948cc5c7f292b6a827 Change-Id: I599aa88c4a8f29ca62aaa2948cc5c7f292b6a827 --- .../telephony/CarrierConfigManager.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 7ee521c24a986..8ba026e412a47 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -3002,18 +3002,44 @@ public class CarrierConfigManager { public static final String KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL = "switch_data_to_primary_if_primary_is_oos_bool"; + /** + * Controls the ping pong determination of opportunistic network. + * If opportunistic network is determined as out of service or below + * #KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSRP_INT or + * #KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT within + * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG of switching to opportunistic network, + * it will be determined as ping pong situation by system app or 1st party app. + * @hide + */ + public static final String KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG = + "opportunistic_network_ping_pong_time_long"; /** * Controls back off time in milli seconds for switching back to * opportunistic subscription. This time will be added to * {@link CarrierConfigManager#KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_HYSTERESIS_TIME_LONG} to - * determine hysteresis time if there is frequent switching + * determine hysteresis time if there is ping pong situation * (determined by system app or 1st party app) between primary and opportunistic - * subscription. + * subscription. Ping ping situation is defined in + * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG. + * If ping pong situation continuous #KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG + * will be added to previously determined hysteresis time. * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG = "opportunistic_network_backoff_time_long"; + /** + * Controls the max back off time in milli seconds for switching back to + * opportunistic subscription. + * This time will be the max hysteresis that can be determined irrespective of there is + * continuous ping pong situation or not as described in + * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG and + * #KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG. + * @hide + */ + public static final String KEY_OPPORTUNISTIC_NETWORK_MAX_BACKOFF_TIME_LONG = + "opportunistic_network_max_backoff_time_long"; + /** * Indicates zero or more emergency number prefix(es), because some carrier requires * if users dial an emergency number address with a specific prefix, the combination of the @@ -3838,8 +3864,12 @@ public class CarrierConfigManager { /* Default value is 1 hour. */ sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000); sDefaults.putBoolean(KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL, true); + /* Default value is 60 seconds. */ + sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG, 60000); /* Default value is 10 seconds. */ sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG, 10000); + /* Default value is 60 seconds. */ + sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_MAX_BACKOFF_TIME_LONG, 60000); sDefaults.putAll(Gps.getDefaults()); sDefaults.putIntArray(KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY, new int[] { From cc2f579438a66681a08a5a3c6af3aa71c60f2e7d Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Wed, 22 Jan 2020 11:55:43 -0800 Subject: [PATCH 11/12] convert hidden configs to public convert hidden configs to public Test: these are existing configs, hence with build could confirm if they are accessible Bug: 143969391 Merged-In: I722e0bfe587bc21e18a6cfea2de3df0efc1018c9 Change-Id: I722e0bfe587bc21e18a6cfea2de3df0efc1018c9 --- api/current.txt | 8 ++++++++ .../java/android/telephony/CarrierConfigManager.java | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/current.txt b/api/current.txt index 22f014e8d948b..73a68b1ebfee3 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44686,6 +44686,7 @@ package android.telephony { 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"; @@ -44769,6 +44770,7 @@ package android.telephony { field public static final String KEY_DATA_LIMIT_NOTIFICATION_BOOL = "data_limit_notification_bool"; field public static final String KEY_DATA_LIMIT_THRESHOLD_BYTES_LONG = "data_limit_threshold_bytes_long"; field public static final String KEY_DATA_RAPID_NOTIFICATION_BOOL = "data_rapid_notification_bool"; + field public static final String KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG = "data_switch_validation_timeout_long"; field public static final String KEY_DATA_WARNING_NOTIFICATION_BOOL = "data_warning_notification_bool"; field public static final String KEY_DATA_WARNING_THRESHOLD_BYTES_LONG = "data_warning_threshold_bytes_long"; field public static final String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string"; @@ -44851,6 +44853,8 @@ package android.telephony { field public static final String KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL = "only_auto_select_in_home_network"; field public static final String KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY = "only_single_dc_allowed_int_array"; field public static final String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool"; + field public static final String KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG = "opportunistic_network_backoff_time_long"; + field public static final String KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_EXIT_HYSTERESIS_TIME_LONG = "opportunistic_network_data_switch_exit_hysteresis_time_long"; field public static final String KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_HYSTERESIS_TIME_LONG = "opportunistic_network_data_switch_hysteresis_time_long"; field public static final String KEY_OPPORTUNISTIC_NETWORK_ENTRY_OR_EXIT_HYSTERESIS_TIME_LONG = "opportunistic_network_entry_or_exit_hysteresis_time_long"; field public static final String KEY_OPPORTUNISTIC_NETWORK_ENTRY_THRESHOLD_BANDWIDTH_INT = "opportunistic_network_entry_threshold_bandwidth_int"; @@ -44858,6 +44862,9 @@ package android.telephony { field public static final String KEY_OPPORTUNISTIC_NETWORK_ENTRY_THRESHOLD_RSSNR_INT = "opportunistic_network_entry_threshold_rssnr_int"; field public static final String KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSRP_INT = "opportunistic_network_exit_threshold_rsrp_int"; field public static final String KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT = "opportunistic_network_exit_threshold_rssnr_int"; + field public static final String KEY_OPPORTUNISTIC_NETWORK_MAX_BACKOFF_TIME_LONG = "opportunistic_network_max_backoff_time_long"; + field public static final String KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG = "opportunistic_network_ping_pong_time_long"; + field public static final String KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL = "ping_test_before_data_switch_bool"; field public static final String KEY_PREFER_2G_BOOL = "prefer_2g_bool"; field public static final String KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL = "prevent_clir_activation_and_deactivation_code_bool"; field public static final String KEY_RADIO_RESTART_FAILURE_CAUSES_INT_ARRAY = "radio_restart_failure_causes_int_array"; @@ -44894,6 +44901,7 @@ package android.telephony { field public static final String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool"; field public static final String KEY_SUPPORT_TDSCDMA_BOOL = "support_tdscdma_bool"; field public static final String KEY_SUPPORT_TDSCDMA_ROAMING_NETWORKS_STRING_ARRAY = "support_tdscdma_roaming_networks_string_array"; + field public static final String KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL = "switch_data_to_primary_if_primary_is_oos_bool"; field public static final String KEY_TREAT_DOWNGRADED_VIDEO_CALLS_AS_VIDEO_CALLS_BOOL = "treat_downgraded_video_calls_as_video_calls_bool"; field public static final String KEY_TTY_SUPPORTED_BOOL = "tty_supported_bool"; field public static final String KEY_UNLOGGABLE_NUMBERS_STRING_ARRAY = "unloggable_numbers_string_array"; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 8ba026e412a47..1eed0e02f9bd1 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -2973,7 +2973,6 @@ public class CarrierConfigManager { /** * Controls hysteresis time in milli seconds for which OpportunisticNetworkService * will wait before switching data from opportunistic network to primary network. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_EXIT_HYSTERESIS_TIME_LONG = "opportunistic_network_data_switch_exit_hysteresis_time_long"; @@ -2981,14 +2980,12 @@ public class CarrierConfigManager { /** * Controls whether to do ping test before switching data to opportunistic network. * This carrier config is used to disable this feature. - * @hide */ public static final String KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL = "ping_test_before_data_switch_bool"; /** * 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"; @@ -2997,7 +2994,6 @@ public class CarrierConfigManager { * if primary is out of service. This control only affects system or 1st party app * initiated data switch, but will not override data switch initiated by privileged carrier apps * This carrier config is used to disable this feature. - * @hide */ public static final String KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL = "switch_data_to_primary_if_primary_is_oos_bool"; @@ -3009,7 +3005,6 @@ public class CarrierConfigManager { * #KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT within * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG of switching to opportunistic network, * it will be determined as ping pong situation by system app or 1st party app. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG = "opportunistic_network_ping_pong_time_long"; @@ -3023,7 +3018,6 @@ public class CarrierConfigManager { * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG. * If ping pong situation continuous #KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG * will be added to previously determined hysteresis time. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG = "opportunistic_network_backoff_time_long"; @@ -3035,7 +3029,6 @@ public class CarrierConfigManager { * continuous ping pong situation or not as described in * #KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG and * #KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG. - * @hide */ public static final String KEY_OPPORTUNISTIC_NETWORK_MAX_BACKOFF_TIME_LONG = "opportunistic_network_max_backoff_time_long"; @@ -3082,7 +3075,6 @@ public class CarrierConfigManager { * validation result, this value defines customized value of how long we wait for validation * success before we fail and revoke the switch. * Time out is in milliseconds. - * @hide */ public static final String KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG = "data_switch_validation_timeout_long"; From 889aec247c3bb770a54e61e509c2702f45ed5c5c Mon Sep 17 00:00:00 2001 From: Sooraj Sasindran Date: Tue, 21 Jan 2020 18:41:14 -0800 Subject: [PATCH 12/12] make sim_colors a system config make sim_colors a system config Bug: 143289541 Test: verified that symbol is accessible as android.R and values are still valid through logs. Merged-In: Ie0189ef3befff9f1e2da127a1f4cef69f8f7043e Change-Id: Ie0189ef3befff9f1e2da127a1f4cef69f8f7043e --- api/system-current.txt | 1 + core/res/res/values/arrays.xml | 2 +- core/res/res/values/public.xml | 4 ++++ core/res/res/values/symbols.xml | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index ab69bdc53d8c8..a3a9a0749b88b 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -226,6 +226,7 @@ package android { public static final class R.array { field public static final int config_keySystemUuidMapping = 17235973; // 0x1070005 + field public static final int simColors = 17235974; // 0x1070006 } public static final class R.attr { diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml index f05898561b8a6..567581e0ab71e 100644 --- a/core/res/res/values/arrays.xml +++ b/core/res/res/values/arrays.xml @@ -165,7 +165,7 @@ 中文 (繁體) - + @color/Teal_700 @color/Blue_700 @color/Indigo_700 diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index fb54566fc9593..8a7b515ee4363 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -3021,6 +3021,10 @@ + + + +