Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6530594c authored by Jack Yu's avatar Jack Yu Committed by Android (Google) Code Review
Browse files

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

parents 3be1c1e9 4967f98b
Loading
Loading
Loading
Loading
+23 −6
Original line number Diff line number Diff line
@@ -160,6 +160,10 @@ public class SubscriptionManager {
    private static final String CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY =
            "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 */
    public static final String GET_SIM_SPECIFIC_SETTINGS_METHOD_NAME = "getSimSpecificSettings";

@@ -340,6 +344,12 @@ public class SubscriptionManager {
                    CACHE_KEY_SUBSCRIPTION_MANAGER_SERVICE_PROPERTY,
                    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
     * on the given subscriptionId
@@ -1358,8 +1368,6 @@ public class SubscriptionManager {

    private final Context mContext;

    private static boolean sIsSubscriptionManagerServiceEnabled = false;

    // Cache of Resource that has been created in getResourcesForSubId. Key is a Pair containing
    // the Context and subId.
    private static final Map<Pair<Context, Integer>, Resources> sResourcesCache =
@@ -1445,9 +1453,6 @@ public class SubscriptionManager {
    public SubscriptionManager(Context context) {
        if (DBG) logd("SubscriptionManager created");
        mContext = context;

        sIsSubscriptionManagerServiceEnabled = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_using_subscription_manager_service);
    }

    /**
@@ -1456,8 +1461,9 @@ public class SubscriptionManager {
     *
     * @hide
     */
    //TODO: Removed before U AOSP public release.
    public static boolean isSubscriptionManagerServiceEnabled() {
        return sIsSubscriptionManagerServiceEnabled;
        return sIsSubscriptionManagerServiceEnabled.query(null);
    }

    private NetworkPolicyManager getNetworkPolicyManager() {
@@ -3971,6 +3977,13 @@ public class SubscriptionManager {
        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.
     *
@@ -3992,6 +4005,8 @@ public class SubscriptionManager {
        sGetSlotIndexCache.disableLocal();
        sGetSubIdCache.disableLocal();
        sGetPhoneIdCache.disableLocal();

        sIsSubscriptionManagerServiceEnabled.disableLocal();
    }

    /**
@@ -4014,6 +4029,8 @@ public class SubscriptionManager {
        sGetSlotIndexCache.clear();
        sGetSubIdCache.clear();
        sGetPhoneIdCache.clear();

        sIsSubscriptionManagerServiceEnabled.clear();
    }

    /**
+7 −0
Original line number Diff line number Diff line
@@ -356,4 +356,11 @@ interface ISub {
       * @hide
       */
       List<SubscriptionInfo> getSubscriptionInfoListAssociatedWithUser(in UserHandle userHandle);

       /**
        * @return {@code true} if using SubscriptionManagerService instead of
        * SubscriptionController.
        */
       //TODO: Removed before U AOSP public release.
       boolean isSubscriptionManagerServiceEnabled();
}