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

Commit 157b4d28 authored by Venkat Ram Prakash Kotni's avatar Venkat Ram Prakash Kotni Committed by Steve Kondik
Browse files

Register for RUIM ready and records loaded when Subscription set in RUIM

When the phone starts with NV mode then user change subscription to RUIM
mode, CDMAServiceStateTracker is not registered for RUIM ready and
records loaded

To fix this Register for RUIM ready and records loaded when Subscription
is set in RUIM mode.

Unregister for RUIM ready and records loaded when Subscription
is set in NV mode.

Change-Id: I21f0b3eb8bb9714cbff21ebae3c55fd2688ed749
CRs-Fixed: 452780
parent ccc8d831
Loading
Loading
Loading
Loading
+31 −15
Original line number Diff line number Diff line
@@ -226,8 +226,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        mCi.unregisterForVoiceNetworkStateChanged(this);
        mCi.unregisterForCdmaOtaProvision(this);
        mPhone.unregisterForEriFileLoaded(this);
        if (mUiccApplcation != null) {mUiccApplcation.unregisterForReady(this);}
        if (mIccRecords != null) {mIccRecords.unregisterForRecordsLoaded(this);}
        unregisterForRuimEvents();
        mCi.unSetOnNITZTime(this);
        mCr.unregisterContentObserver(mAutoTimeObserver);
        mCr.unregisterContentObserver(mAutoTimeZoneObserver);
@@ -534,8 +533,13 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            (newSubscriptionSource == CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM);
        saveCdmaSubscriptionSource(newSubscriptionSource);
        if (!mIsSubscriptionFromRuim) {
            // Unregister from any previous RUIM events if registered
            // (switching from RUIM/SIM to NV)
            unregisterForRuimEvents();
            // NV is ready when subscription source is NV
            sendMessage(obtainMessage(EVENT_NV_READY));
        } else {
            registerForRuimEvents();
        }
    }

@@ -1823,6 +1827,26 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        }
    }

    private void registerForRuimEvents() {
        log("registerForRuimEvents");
        if (mUiccApplcation != null) {
            mUiccApplcation.registerForReady(this, EVENT_RUIM_READY, null);
        }
        if (mIccRecords != null) {
            mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
        }
    }

    private void unregisterForRuimEvents() {
        log("unregisterForRuimEvents");
        if (mUiccApplcation != null) {
            mUiccApplcation.unregisterForReady(this);
        }
        if (mIccRecords != null) {
            mIccRecords.unregisterForRecordsLoaded(this);
        }
    }

    protected UiccCardApplication getUiccCardApplication() {
            return  mUiccController.getUiccCardApplication(mPhone.getPhoneId(),
                    UiccController.APP_FAM_3GPP2);
@@ -1837,24 +1861,16 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        UiccCardApplication newUiccApplication = getUiccCardApplication();

        if (mUiccApplcation != newUiccApplication) {
            if (mUiccApplcation != null) {
            log("Removing stale icc objects.");
                mUiccApplcation.unregisterForReady(this);
                if (mIccRecords != null) {
                    mIccRecords.unregisterForRecordsLoaded(this);
                }
            unregisterForRuimEvents();
            mIccRecords = null;
            mUiccApplcation = null;
            }
            if (newUiccApplication != null) {
                log("New card found");
                mUiccApplcation = newUiccApplication;
                mIccRecords = mUiccApplcation.getIccRecords();
                if (mIsSubscriptionFromRuim) {
                    mUiccApplcation.registerForReady(this, EVENT_RUIM_READY, null);
                    if (mIccRecords != null) {
                        mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
                    }
                    registerForRuimEvents();
                }
            }
        }
+8 −0
Original line number Diff line number Diff line
@@ -195,6 +195,14 @@ public abstract class IccRecords extends Handler implements IccConstants {
            return;
        }

        for (int i = mRecordsLoadedRegistrants.size() - 1; i >= 0 ; i--) {
            Registrant  r = (Registrant) mRecordsLoadedRegistrants.get(i);
            Handler rH = r.getHandler();

            if (rH != null && rH == h) {
                return;
            }
        }
        Registrant r = new Registrant(h, what, obj);
        mRecordsLoadedRegistrants.add(r);

+8 −0
Original line number Diff line number Diff line
@@ -412,6 +412,14 @@ public class UiccCardApplication {

    public void registerForReady(Handler h, int what, Object obj) {
        synchronized (mLock) {
            for (int i = mReadyRegistrants.size() - 1; i >= 0 ; i--) {
                Registrant  r = (Registrant) mReadyRegistrants.get(i);
                Handler rH = r.getHandler();

                if (rH != null && rH == h) {
                    return;
                }
            }
            Registrant r = new Registrant (h, what, obj);
            mReadyRegistrants.add(r);
            notifyReadyRegistrantsIfNeeded(r);