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

Commit e16ec244 authored by Sandeep Kunta's avatar Sandeep Kunta
Browse files

Handle ICC IO error

Following changes have been made as part of this:
-> At present in Android all ICC Card states other than ICC
   PRESENT are treated as ICC ABSENT. Adding functionality
   to handle ICC IO error card state.
->IccCardProxy broadcasts card error intent when application index
  received from UIM is invalid(i.e.mUiccAplication is null) during
  initialization of card for fraction of time. As a result of which
  "Invalid Card" is displayed on UI momentarily.

  To fix this, When app index received from UIM is invalid broadcast
  "NOT_READY" intent.

Change-Id: I229bd80cb5e487f4345bef9fb7fee60850f085d9
Bug: 10643652
parent 53f70140
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -281,9 +281,13 @@ public class IccCardProxy extends Handler implements IccCard {
            return;
        }

        if (mUiccCard.getCardState() == CardState.CARDSTATE_ERROR ||
                mUiccApplication == null) {
            setExternalState(State.UNKNOWN);
        if (mUiccCard.getCardState() == CardState.CARDSTATE_ERROR) {
            setExternalState(State.CARD_IO_ERROR);
            return;
        }

        if (mUiccApplication == null) {
            setExternalState(State.NOT_READY);
            return;
        }

@@ -419,12 +423,13 @@ public class IccCardProxy extends Handler implements IccCard {
            case READY: return IccCardConstants.INTENT_VALUE_ICC_READY;
            case NOT_READY: return IccCardConstants.INTENT_VALUE_ICC_NOT_READY;
            case PERM_DISABLED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case CARD_IO_ERROR: return IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR;
            default: return IccCardConstants.INTENT_VALUE_ICC_UNKNOWN;
        }
    }

    /**
     * Locked state have a reason (PIN, PUK, NETWORK, PERM_DISABLED)
     * Locked state have a reason (PIN, PUK, NETWORK, PERM_DISABLED, CARD_IO_ERROR)
     * @return reason
     */
    private String getIccStateReason(State state) {
@@ -433,6 +438,7 @@ public class IccCardProxy extends Handler implements IccCard {
            case PUK_REQUIRED: return IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK;
            case NETWORK_LOCKED: return IccCardConstants.INTENT_VALUE_LOCKED_NETWORK;
            case PERM_DISABLED: return IccCardConstants.INTENT_VALUE_ABSENT_ON_PERM_DISABLED;
            case CARD_IO_ERROR: return IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR;
            default: return null;
       }
    }