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

Commit b8ec2c1d authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Change to make sure that code triggered by onSubscriptionsChanged() is

executed on popping out and putting same SIM back in.

Basically to handle the scenario where subId goes from X->invalid->X.
This is on top of ag/604848

Bug: 18718732
Change-Id: I42bd7906715e4a9702439c1498a17a3add4c25a6
parent a097459c
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ public abstract class ServiceStateTracker extends Handler {
    protected SubscriptionManager mSubscriptionManager;
    protected final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
            new OnSubscriptionsChangedListener() {
        private int lastActiveSubId = -1; // < 0 is invalid subId
        private int previousSubId = -1; // < 0 is invalid subId
        /**
         * Callback invoked when there is any change to any SubscriptionInfo. Typically
         * this method would invoke {@link SubscriptionManager#getActiveSubscriptionInfoList}
@@ -236,9 +236,9 @@ public abstract class ServiceStateTracker extends Handler {
            if (DBG) log("SubscriptionListener.onSubscriptionInfoChanged");
            // Set the network type, in case the radio does not restore it.
            int subId = mPhoneBase.getSubId();
            if (previousSubId != subId) {
                previousSubId = subId;
                if (SubscriptionManager.isValidSubscriptionId(subId)) {
                if (lastActiveSubId != subId) {
                    lastActiveSubId = subId;
                    int networkType = PhoneFactory.calculatePreferredNetworkType(
                            mPhoneBase.getContext(), subId);
                    mCi.setPreferredNetworkType(networkType, null);