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

Commit 6c497f69 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed that no service was shown after boot up

The SPN information came too early before the subscription
id is valid hence the SPN info was ignored by MobileSignalController.
We need to send the SPN update intent again after subscription info
is valid.

bug: 23366812
Change-Id: I11ab185d2ffbd34a8d0f3d4096179aee13138f3f
parent 7059f27c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@ public abstract class ServiceStateTracker extends Handler {
    protected String mCurPlmn = null;
    protected boolean mCurShowPlmn = false;
    protected boolean mCurShowSpn = false;
    protected int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;

    private boolean mImsRegistered = false;

@@ -303,6 +304,11 @@ public abstract class ServiceStateTracker extends Handler {
                        editor.remove(PhoneBase.NETWORK_SELECTION_SHORT_KEY);
                        editor.commit();
                    }

                    // Once sub id becomes valid, we need to update the service provider name
                    // displayed on the UI again. The old SPN update intents sent to
                    // MobileSignalController earlier were actually ignored due to invalid sub id.
                    updateSpnDisplay();
                }
            }
        }
+9 −2
Original line number Diff line number Diff line
@@ -572,7 +572,13 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        String plmn = mSS.getOperatorAlphaLong();
        boolean showPlmn = false;

        if (!TextUtils.equals(plmn, mCurPlmn)) {
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        int[] subIds = SubscriptionManager.getSubId(mPhone.getPhoneId());
        if (subIds != null && subIds.length > 0) {
            subId = subIds[0];
        }

        if (mSubId != subId || !TextUtils.equals(plmn, mCurPlmn)) {
            // Allow A blank plmn, "" to set showPlmn to true. Previously, we
            // would set showPlmn to true only if plmn was not empty, i.e. was not
            // null and not blank. But this would cause us to incorrectly display
@@ -580,7 +586,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            showPlmn = plmn != null;
            if (DBG) {
                log(String.format("updateSpnDisplay: changed sending intent" +
                            " showPlmn='%b' plmn='%s'", showPlmn, plmn));
                            " showPlmn='%b' plmn='%s' subId='%d'", showPlmn, plmn, subId));
            }
            Intent intent = new Intent(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION);
            intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
@@ -597,6 +603,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            }
        }

        mSubId = subId;
        mCurShowSpn = false;
        mCurShowPlmn = showPlmn;
        mCurSpn = "";
+11 −3
Original line number Diff line number Diff line
@@ -645,8 +645,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            showSpn = false;
        }

        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        int[] subIds = SubscriptionManager.getSubId(mPhone.getPhoneId());
        if (subIds != null && subIds.length > 0) {
            subId = subIds[0];
        }

        // Update SPN_STRINGS_UPDATED_ACTION IFF any value changes
        if (showPlmn != mCurShowPlmn
        if (mSubId != subId ||
                showPlmn != mCurShowPlmn
                || showSpn != mCurShowSpn
                || !TextUtils.equals(spn, mCurSpn)
                || !TextUtils.equals(dataSpn, mCurDataSpn)
@@ -654,8 +661,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            if (DBG) {
                log(String.format("updateSpnDisplay: changed" +
                        " sending intent rule=" + rule +
                        " showPlmn='%b' plmn='%s' showSpn='%b' spn='%s' dataSpn='%s'",
                        showPlmn, plmn, showSpn, spn, dataSpn));
                        " showPlmn='%b' plmn='%s' showSpn='%b' spn='%s' dataSpn='%s' subId='%d'",
                        showPlmn, plmn, showSpn, spn, dataSpn, subId));
            }
            Intent intent = new Intent(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION);
            intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
@@ -673,6 +680,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            }
        }

        mSubId = subId;
        mCurShowSpn = showSpn;
        mCurShowPlmn = showPlmn;
        mCurSpn = spn;