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

Commit a12de088 authored by Junda Liu's avatar Junda Liu Committed by Android Git Automerger
Browse files

am 07de07dc: Merge "dispose uicc card if modem is not available." into lmp-dev

* commit '07de07dc':
  dispose uicc card if modem is not available.
parents e5aa0a55 07de07dc
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -230,6 +230,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;
+10 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public class UiccController extends Handler {

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

    private CommandsInterface[] mCis;
    private UiccCard[] mUiccCards = new UiccCard[TelephonyManager.getDefault().getPhoneCount()];
@@ -128,6 +129,7 @@ public class UiccController extends Handler {
            mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, index);
            // TODO remove this once modem correctly notifies the unsols
            mCis[i].registerForAvailable(this, EVENT_ICC_STATUS_CHANGED, index);
            mCis[i].registerForNotAvailable(this, EVENT_RADIO_UNAVAILABLE, index);
        }
    }

@@ -257,6 +259,14 @@ public class UiccController extends Handler {
                    AsyncResult ar = (AsyncResult)msg.obj;
                    onGetIccCardStatusDone(ar, index);
                    break;
                case EVENT_RADIO_UNAVAILABLE:
                    if (DBG) log("EVENT_RADIO_UNAVAILABLE, dispose card");
                    if (mUiccCards[index] != null) {
                        mUiccCards[index].dispose();
                    }
                    mUiccCards[index] = null;
                    mIccChangedRegistrants.notifyRegistrants(new AsyncResult(null, index, null));
                    break;
                default:
                    Rlog.e(LOG_TAG, " Unknown Event " + msg.what);
            }