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

Commit 29cfb789 authored by Sarah Chin's avatar Sarah Chin
Browse files

DCT get SubscriptionPlans when initialized

Ensure mSubscriptionPlans is up-to-date even after reboot or phone
process crash

Test: atest DcTrackerTest and manual
Bug: 169187737
Change-Id: I7e1df7df734c2bb5373de6dc9693bedcaf3551aa
parent b1e6abcd
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ public class DcTracker extends Handler {
    private boolean mNrSaSub6Unmetered = false;
    private boolean mRoamingUnmetered = false;

    /* List of SubscriptionPlans, updated on SubscriptionManager.setSubscriptionPlans */
    /* List of SubscriptionPlans, updated when initialized and when plans are changed. */
    private List<SubscriptionPlan> mSubscriptionPlans = null;

    @SimState
@@ -421,6 +421,7 @@ public class DcTracker extends Handler {
            if (mPhone == null || mPhone.getSubId() != subId) return;

            mSubscriptionPlans = plans == null ? null : Arrays.asList(plans);
            if (DBG) log("SubscriptionPlans changed: " + mSubscriptionPlans);
            reevaluateUnmeteredConnections();
        }
    };
@@ -2358,6 +2359,13 @@ public class DcTracker extends Handler {
        setDefaultPreferredApnIfNeeded();
        read5GConfiguration();
        registerSettingsObserver();
        SubscriptionPlan[] plans = mNetworkPolicyManager.getSubscriptionPlans(
                mPhone.getSubId(), mPhone.getContext().getOpPackageName());
        if (plans != null) {
            mSubscriptionPlans = Arrays.asList(plans);
            if (DBG) log("SubscriptionPlans initialized: " + mSubscriptionPlans);
            reevaluateUnmeteredConnections();
        }
        mConfigReady = true;
    }