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

Commit 57e4a9bf authored by Chen Xu's avatar Chen Xu Committed by android-build-merger
Browse files

Merge "DO NOT MERGE CarrierIdentifier listen for simrecordsOverride event" into pi-dev

am: b84e5057

Change-Id: I4ce4f8a54e58767019db13a9c4a6e363996675d9
parents 40987f38 b84e5057
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -211,11 +211,13 @@ public class CarrierIdentifier extends Handler {
                    if (mIccRecords != null) {
                        logd("Removing stale icc objects.");
                        mIccRecords.unregisterForRecordsLoaded(this);
                        mIccRecords.unregisterForRecordsOverride(this);
                        mIccRecords = null;
                    }
                    if (newIccRecords != null) {
                        logd("new Icc object");
                        newIccRecords.registerForRecordsLoaded(this, SIM_LOAD_EVENT, null);
                        newIccRecords.registerForRecordsOverride(this, SIM_LOAD_EVENT, null);
                        mIccRecords = newIccRecords;
                    }
                }
+20 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
    protected RegistrantList mNewSmsRegistrants = new RegistrantList();
    protected RegistrantList mNetworkSelectionModeAutomaticRegistrants = new RegistrantList();
    protected RegistrantList mSpnUpdatedRegistrants = new RegistrantList();
    protected RegistrantList mRecordsOverrideRegistrants = new RegistrantList();

    protected int mRecordsToLoad;  // number of pending load requests

@@ -218,7 +219,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
        mCarrierTestOverride.override(mccmnc, imsi, iccid, gid1, gid2, pnn, spn);
        mTelephonyManager.setSimOperatorNameForPhone(mParentApp.getPhoneId(), spn);
        mTelephonyManager.setSimOperatorNumericForPhone(mParentApp.getPhoneId(), mccmnc);
        mRecordsLoadedRegistrants.notifyRegistrants();
        mRecordsOverrideRegistrants.notifyRegistrants();
    }

    /**
@@ -308,10 +309,28 @@ public abstract class IccRecords extends Handler implements IccConstants {
            r.notifyRegistrant(new AsyncResult(null, null, null));
        }
    }

    public void unregisterForRecordsLoaded(Handler h) {
        mRecordsLoadedRegistrants.remove(h);
    }

    public void unregisterForRecordsOverride(Handler h) {
        mRecordsOverrideRegistrants.remove(h);
    }

    public void registerForRecordsOverride(Handler h, int what, Object obj) {
        if (mDestroyed.get()) {
            return;
        }

        Registrant r = new Registrant(h, what, obj);
        mRecordsOverrideRegistrants.add(r);

        if (getRecordsLoaded()) {
            r.notifyRegistrant(new AsyncResult(null, null, null));
        }
    }

    /**
     * Register to be notified when records are loaded for a PIN or PUK locked SIM
     */