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

Commit 8add355d authored by Umashankar Godachi's avatar Umashankar Godachi Committed by Steve Kondik
Browse files

KeyGuard: Fix the wrong Plmn/SPN display.

Currently in KeyGuardUpdateMonitor, while handling the intent
SPN_STRING_UPDATED_ACTION, spn and plmn gets updated even before
MSG_SUBINFO_RECORD_UPDATED is handled. This results in wrong
updation of SPN and PLMN values.

Fix is to ensure plmn and spn are updated with right values got
from SPN_STRING_UPDATED_ACTION intent. This is done by copying
the original plmn and spn got from intent to the already updated
plmn and spn by MSG_SUBINFO_RECORD_UPDATED.

Change-Id: I34cfef19d437cb91fcaeae16b9c12bf08311f056
CRs-Fixed: 816911
parent 670d3df1
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -748,6 +748,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
                    mPlmn.put(subInfo.getSubscriptionId(), mPlmn.get(subId));
                    mPlmn.put(subInfo.getSubscriptionId(), mPlmn.get(subId));
                    mSpn.put(subInfo.getSubscriptionId(), mSpn.get(subId));
                    mSpn.put(subInfo.getSubscriptionId(), mSpn.get(subId));


                    // If there is race condition it is possible that mSpn and mPlmn updated
                    // by SPN_STRINGS_UPDATED_ACTION intent gets overwritten here with invalid
                    // values, hence copy the original plmn and spn values got from intent.
                    copyOriginalPlmnSpn(subInfo.getSubscriptionId());
                    final int count = mCallbacks.size();
                    final int count = mCallbacks.size();
                    for (int i = 0; i < count; i++) {
                    for (int i = 0; i < count; i++) {
                        KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
                        KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -766,6 +770,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        }
        }
    }
    }


    private void copyOriginalPlmnSpn(int subId) {
        // If mOriginalPlmn and mOriginalSpn are null here, then once
        // SPN_STRINGS_UPDATED_ACTION intent arrives mPlmn and mSpn will
        // get updated with right values.
        if (mOriginalPlmn.get(subId) != null) {
            mPlmn.put(subId, getLocaleString(mOriginalPlmn.get(subId).toString()));
        }

        if (mOriginalSpn.get(subId) != null) {
            mSpn.put(subId, getLocaleString(mOriginalSpn.get(subId).toString()));
        }
    }

    protected void handleSubInfoContentChange(SubInfoContent content) {
    protected void handleSubInfoContentChange(SubInfoContent content) {
        final int count = mCallbacks.size();
        final int count = mCallbacks.size();
        for (int i = 0; i < count; i++) {
        for (int i = 0; i < count; i++) {