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

Commit 1fb1cb25 authored by Jack Yu's avatar Jack Yu
Browse files

Added flag to enable subscription manager service through adb

Test: Boot up and basic phone testing
Test: adb root && adb shell device_config put telephony enable_subscription_manager_service true
      && adb shell device_config set_sync_disabled_for_tests persistent && sleep 3 && adb reboot
Fix: 266896752
Merged-In: Ib3b18b9a052de4d9f78e432f42b83d099f1b42a2
Change-Id: Ib3b18b9a052de4d9f78e432f42b83d099f1b42a2
parent fdbe2583
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";

@@ -317,6 +321,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
@@ -1335,8 +1345,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 =
@@ -1422,9 +1430,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);
    }

    /**
@@ -1433,8 +1438,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() {
@@ -3947,6 +3953,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.
     *
@@ -3968,6 +3981,8 @@ public class SubscriptionManager {
        sGetSlotIndexCache.disableLocal();
        sGetSubIdCache.disableLocal();
        sGetPhoneIdCache.disableLocal();

        sIsSubscriptionManagerServiceEnabled.disableLocal();
    }

    /**
@@ -3990,6 +4005,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();
}