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

Commit 20070fdd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Handle Radio Unavailable event in Uicc classes."

parents 1cf1ce40 ecb8674b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -225,6 +225,9 @@ public class IccCardProxy extends Handler implements IccCard {
        switch (msg.what) {
            case EVENT_RADIO_OFF_OR_UNAVAILABLE:
                mRadioOn = false;
                if (CommandsInterface.RadioState.RADIO_UNAVAILABLE == mCi.getRadioState()) {
                    setExternalState(State.NOT_READY);
                }
                break;
            case EVENT_RADIO_ON:
                mRadioOn = true;
@@ -272,15 +275,15 @@ public class IccCardProxy extends Handler implements IccCard {
    protected void updateIccAvailability() {
        synchronized (mLock) {
            UiccCard newCard = mUiccController.getUiccCard();
            CardState state = CardState.CARDSTATE_ABSENT;
            UiccCardApplication newApp = null;
            IccRecords newRecords = null;
            if (newCard != null) {
                state = newCard.getCardState();
                newApp = newCard.getApplication(mCurrentAppType);
                if (newApp != null) {
                    newRecords = newApp.getIccRecords();
                }
            } else {
                log("No card available");
            }

            if (mIccRecords != newRecords || mUiccApplication != newApp || mUiccCard != newCard) {
+18 −2
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ public class UiccController extends Handler {

    protected static final int EVENT_ICC_STATUS_CHANGED = 1;
    protected static final int EVENT_GET_ICC_STATUS_DONE = 2;
    protected static final int EVENT_RADIO_UNAVAILABLE = 3;
    private static final int EVENT_REFRESH = 4;

    protected static final Object mLock = new Object();
@@ -198,6 +199,12 @@ public class UiccController extends Handler {
                    AsyncResult ar = (AsyncResult)msg.obj;
                    onGetIccCardStatusDone(ar);
                    break;
                case EVENT_RADIO_UNAVAILABLE:
                    if (DBG) log("EVENT_RADIO_UNAVAILABLE ");
                    disposeCard(mUiccCard);
                    mUiccCard = null;
                    mIccChangedRegistrants.notifyRegistrants();
                    break;
                case EVENT_REFRESH:
                    ar = (AsyncResult)msg.obj;
                    if (DBG) log("Sim REFRESH received");
@@ -213,6 +220,14 @@ public class UiccController extends Handler {
        }
    }

    // Destroys the card object
    protected synchronized void disposeCard(UiccCard uiccCard) {
        if (DBG) log("Disposing card");
        if (uiccCard != null) {
            uiccCard.dispose();
        }
    }

    private void handleRefresh(IccRefreshResponse refreshResponse){
        if (refreshResponse == null) {
            log("handleRefresh received without input");
@@ -233,6 +248,7 @@ public class UiccController extends Handler {
        mCi = ci;
        mCi.registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, null);
        mCi.registerForAvailable(this, EVENT_ICC_STATUS_CHANGED, null);
        mCi.registerForNotAvailable(this, EVENT_RADIO_UNAVAILABLE, null);
        mCi.registerForIccRefresh(this, EVENT_REFRESH, null);
    }

@@ -247,10 +263,10 @@ public class UiccController extends Handler {
        IccCardStatus status = (IccCardStatus)ar.result;

        if (mUiccCard == null) {
            //Create new card
            if (DBG) log("Creating a new card");
            mUiccCard = new UiccCard(mContext, mCi, status);
        } else {
            //Update already existing card
            if (DBG) log("Update already existing card");
            mUiccCard.update(mContext, mCi , status);
        }