Merge "Added flag to enable subscription manager service through adb"

This commit is contained in:
Treehugger Robot
2023-04-10 16:46:47 +00:00
committed by Gerrit Code Review
2 changed files with 30 additions and 6 deletions

View File

@@ -160,6 +160,10 @@ public class SubscriptionManager {
private static final String CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY = private static final String CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY =
"cache_key.telephony.subscription_manager_service"; "cache_key.telephony.subscription_manager_service";
/** The temporarily cache key to indicate whether subscription manager service is enabled. */
private static final String CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_ENABLED_PROPERTY =
"cache_key.telephony.subscription_manager_service_enabled";
/** @hide */ /** @hide */
public static final String GET_SIM_SPECIFIC_SETTINGS_METHOD_NAME = "getSimSpecificSettings"; public static final String GET_SIM_SPECIFIC_SETTINGS_METHOD_NAME = "getSimSpecificSettings";
@@ -317,6 +321,12 @@ public class SubscriptionManager {
CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY, CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY,
INVALID_PHONE_INDEX); INVALID_PHONE_INDEX);
//TODO: Removed before U AOSP public release.
private static VoidPropertyInvalidatedCache<Boolean> sIsSubscriptionManagerServiceEnabled =
new VoidPropertyInvalidatedCache<>(ISub::isSubscriptionManagerServiceEnabled,
CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_ENABLED_PROPERTY,
false);
/** /**
* Generates a content {@link Uri} used to receive updates on simInfo change * Generates a content {@link Uri} used to receive updates on simInfo change
* on the given subscriptionId * on the given subscriptionId
@@ -1335,8 +1345,6 @@ public class SubscriptionManager {
private final Context mContext; private final Context mContext;
private static boolean sIsSubscriptionManagerServiceEnabled = false;
// Cache of Resource that has been created in getResourcesForSubId. Key is a Pair containing // Cache of Resource that has been created in getResourcesForSubId. Key is a Pair containing
// the Context and subId. // the Context and subId.
private static final Map<Pair<Context, Integer>, Resources> sResourcesCache = private static final Map<Pair<Context, Integer>, Resources> sResourcesCache =
@@ -1422,9 +1430,6 @@ public class SubscriptionManager {
public SubscriptionManager(Context context) { public SubscriptionManager(Context context) {
if (DBG) logd("SubscriptionManager created"); if (DBG) logd("SubscriptionManager created");
mContext = context; mContext = context;
sIsSubscriptionManagerServiceEnabled = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_using_subscription_manager_service);
} }
/** /**
@@ -1433,8 +1438,9 @@ public class SubscriptionManager {
* *
* @hide * @hide
*/ */
//TODO: Removed before U AOSP public release.
public static boolean isSubscriptionManagerServiceEnabled() { public static boolean isSubscriptionManagerServiceEnabled() {
return sIsSubscriptionManagerServiceEnabled; return sIsSubscriptionManagerServiceEnabled.query(null);
} }
private NetworkPolicyManager getNetworkPolicyManager() { private NetworkPolicyManager getNetworkPolicyManager() {
@@ -3947,6 +3953,13 @@ public class SubscriptionManager {
PropertyInvalidatedCache.invalidateCache(CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY); PropertyInvalidatedCache.invalidateCache(CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY);
} }
/** @hide */
//TODO: Removed before U AOSP public release.
public static void invalidateSubscriptionManagerServiceEnabledCaches() {
PropertyInvalidatedCache.invalidateCache(
CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_ENABLED_PROPERTY);
}
/** /**
* Allows a test process to disable client-side caching operations. * Allows a test process to disable client-side caching operations.
* *
@@ -3968,6 +3981,8 @@ public class SubscriptionManager {
sGetSlotIndexCache.disableLocal(); sGetSlotIndexCache.disableLocal();
sGetSubIdCache.disableLocal(); sGetSubIdCache.disableLocal();
sGetPhoneIdCache.disableLocal(); sGetPhoneIdCache.disableLocal();
sIsSubscriptionManagerServiceEnabled.disableLocal();
} }
/** /**
@@ -3990,6 +4005,8 @@ public class SubscriptionManager {
sGetSlotIndexCache.clear(); sGetSlotIndexCache.clear();
sGetSubIdCache.clear(); sGetSubIdCache.clear();
sGetPhoneIdCache.clear(); sGetPhoneIdCache.clear();
sIsSubscriptionManagerServiceEnabled.clear();
} }
/** /**

View File

@@ -356,4 +356,11 @@ interface ISub {
* @hide * @hide
*/ */
List<SubscriptionInfo> getSubscriptionInfoListAssociatedWithUser(in UserHandle userHandle); List<SubscriptionInfo> getSubscriptionInfoListAssociatedWithUser(in UserHandle userHandle);
/**
* @return {@code true} if using SubscriptionManagerService instead of
* SubscriptionController.
*/
//TODO: Removed before U AOSP public release.
boolean isSubscriptionManagerServiceEnabled();
} }