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

Commit b0b24b3d authored by John Wang's avatar John Wang
Browse files

Support SIM permanently disabled state.

SIM card can get permanently disabled due to too many
PUK retries. The PERM_BLOCKED pin state of SIM application
represents this state.

This change decodes permanent disabled state and broadcasts it
via ICC_ABSENT intent with PERM_DISABLED reason. It also update
the lockscreen to show the prompt message.

bug:4392059
Change-Id: I5e60dd65f48f42aa2e54db4cdebf803d6e666b99
parent 49572479
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1728,6 +1728,9 @@
    <string name="lockscreen_missing_sim_instructions">Please insert a SIM card.</string>
    <!-- Shown in the lock screen to ask the user to insert a SIM card when sim is missing or not readable. -->
    <string name="lockscreen_missing_sim_instructions_long">The SIM card is missing or not readable. Please insert a SIM card.</string>
    <!-- Shown in the lock screen to inform the user to SIM card is permanently disabled. -->
    <string name="lockscreen_permanent_disabled_sim_instructions">Your SIM card is permanently disabled.\n
    Please contact your wireless service provider to obtain another SIM card.</string>

    <!-- Shown in the lock screen when there is emergency calls only mode. -->
    <string name="emergency_calls_only" msgid="2485604591272668370">Emergency calls only</string>
+9 −1
Original line number Diff line number Diff line
@@ -114,7 +114,15 @@ public class KeyguardUpdateMonitor {
            }
            String stateExtra = intent.getStringExtra(IccCard.INTENT_KEY_ICC_STATE);
            if (IccCard.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
                final String absentReason = intent
                    .getStringExtra(IccCard.INTENT_KEY_LOCKED_REASON);

                if (IccCard.INTENT_VALUE_ABSENT_ON_PERM_DISABLED.equals(
                        absentReason)) {
                    this.simState = IccCard.State.PERM_DISABLED;
                } else {
                    this.simState = IccCard.State.ABSENT;
                }
            } else if (IccCard.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
                this.simState = IccCard.State.READY;
            } else if (IccCard.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
+8 −3
Original line number Diff line number Diff line
@@ -581,7 +581,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
            final boolean provisioned = mUpdateMonitor.isDeviceProvisioned();
            final IccCard.State state = mUpdateMonitor.getSimState();
            final boolean lockedOrMissing = state.isPinLocked()
                    || ((state == IccCard.State.ABSENT) && requireSim);
                    || ((state == IccCard.State.ABSENT
                            || state == IccCard.State.PERM_DISABLED)
                            && requireSim);

            if (!lockedOrMissing && !provisioned) {
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned"
@@ -688,12 +690,15 @@ public class KeyguardViewMediator implements KeyguardViewCallback,

        switch (simState) {
            case ABSENT:
            case PERM_DISABLED:
                // only force lock screen in case of missing sim if user hasn't
                // gone through setup wizard
                if (!mUpdateMonitor.isDeviceProvisioned()) {
                    if (!isShowing()) {
                        if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_ABSENT and keygaurd isn't showing, we need "
                             + "to show the keyguard since the device isn't provisioned yet.");
                        if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_ABSENT "
                                + "or PERM_DISABLED and keygaurd isn't showing,"
                                + " we need to show the keyguard since the "
                                + "device isn't provisioned yet.");
                        doKeyguard();
                    } else {
                        resetStateLocked();
+2 −1
Original line number Diff line number Diff line
@@ -181,7 +181,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
    private boolean stuckOnLockScreenBecauseSimMissing() {
        return mRequiresSim
                && (!mUpdateMonitor.isDeviceProvisioned())
                && (mUpdateMonitor.getSimState() == IccCard.State.ABSENT);
                && (mUpdateMonitor.getSimState() == IccCard.State.ABSENT ||
                    mUpdateMonitor.getSimState() == IccCard.State.PERM_DISABLED);
    }

    /**
+4 −2
Original line number Diff line number Diff line
@@ -55,8 +55,10 @@ public class LockPatternKeyguardViewProperties implements KeyguardViewProperties

    private boolean isSimPinSecure() {
        final IccCard.State simState = mUpdateMonitor.getSimState();
        return (simState == IccCard.State.PIN_REQUIRED || simState == IccCard.State.PUK_REQUIRED
            || simState == IccCard.State.ABSENT);
        return (simState == IccCard.State.PIN_REQUIRED
                || simState == IccCard.State.PUK_REQUIRED
                || simState == IccCard.State.ABSENT
                || simState == IccCard.State.PERM_DISABLED);
    }

}
Loading