diff options
author | John Wang <johnwang@google.com> | 2011-06-10 17:23:51 -0700 |
---|---|---|
committer | John Wang <johnwang@google.com> | 2011-06-14 16:50:03 -0700 |
commit | b0b24b3df50988d23f571b83d829fecc986ec497 (patch) | |
tree | 9c9d5ea3815f23957bd95332bc25712cd420ab3f /telephony | |
parent | 49572479a9cb479f2b323f011c1a9f8142ec1a46 (diff) | |
download | frameworks_base-b0b24b3df50988d23f571b83d829fecc986ec497.zip frameworks_base-b0b24b3df50988d23f571b83d829fecc986ec497.tar.gz frameworks_base-b0b24b3df50988d23f571b83d829fecc986ec497.tar.bz2 |
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
Diffstat (limited to 'telephony')
4 files changed, 69 insertions, 7 deletions
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index 5d8fc78..02617c8 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -84,6 +84,9 @@ public abstract class IccCard { static public final String INTENT_VALUE_LOCKED_ON_PUK = "PUK"; /* NETWORK means ICC is locked on NETWORK PERSONALIZATION */ static public final String INTENT_VALUE_LOCKED_NETWORK = "NETWORK"; + /* PERM_DISABLED means ICC is permanently disabled due to puk fails */ + static public final String INTENT_VALUE_ABSENT_ON_PERM_DISABLED = "PERM_DISABLED"; + protected static final int EVENT_ICC_LOCKED_OR_ABSENT = 1; private static final int EVENT_GET_ICC_STATUS_DONE = 2; @@ -112,7 +115,8 @@ public abstract class IccCard { PUK_REQUIRED, NETWORK_LOCKED, READY, - NOT_READY; + NOT_READY, + PERM_DISABLED; public boolean isPinLocked() { return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED)); @@ -120,7 +124,8 @@ public abstract class IccCard { public boolean iccCardExist() { return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED) - || (this == NETWORK_LOCKED) || (this == READY)); + || (this == NETWORK_LOCKED) || (this == READY) + || (this == PERM_DISABLED)); } } @@ -416,6 +421,7 @@ public abstract class IccCard { boolean transitionedIntoPinLocked; boolean transitionedIntoAbsent; boolean transitionedIntoNetworkLocked; + boolean transitionedIntoPermBlocked; boolean isIccCardRemoved; boolean isIccCardAdded; @@ -434,6 +440,8 @@ public abstract class IccCard { transitionedIntoAbsent = (oldState != State.ABSENT && newState == State.ABSENT); transitionedIntoNetworkLocked = (oldState != State.NETWORK_LOCKED && newState == State.NETWORK_LOCKED); + transitionedIntoPermBlocked = (oldState != State.PERM_DISABLED + && newState == State.PERM_DISABLED); isIccCardRemoved = (oldState != null && oldState.iccCardExist() && newState == State.ABSENT); isIccCardAdded = (oldState == State.ABSENT && @@ -454,6 +462,10 @@ public abstract class IccCard { mNetworkLockedRegistrants.notifyRegistrants(); broadcastIccStateChangedIntent(INTENT_VALUE_ICC_LOCKED, INTENT_VALUE_LOCKED_NETWORK); + } else if (transitionedIntoPermBlocked) { + if (mDbg) log("Notify SIM permanently disabled."); + broadcastIccStateChangedIntent(INTENT_VALUE_ICC_ABSENT, + INTENT_VALUE_ABSENT_ON_PERM_DISABLED); } if (isIccCardRemoved) { @@ -762,6 +774,9 @@ public abstract class IccCard { } // check if PIN required + if (app.pin1.isPermBlocked()) { + return IccCard.State.PERM_DISABLED; + } if (app.app_state.isPinRequired()) { return IccCard.State.PIN_REQUIRED; } diff --git a/telephony/java/com/android/internal/telephony/IccCardApplication.java b/telephony/java/com/android/internal/telephony/IccCardApplication.java index 434c484..abb740e 100644 --- a/telephony/java/com/android/internal/telephony/IccCardApplication.java +++ b/telephony/java/com/android/internal/telephony/IccCardApplication.java @@ -16,6 +16,8 @@ package com.android.internal.telephony; +import com.android.internal.telephony.IccCardStatus.PinState; + /** * See also RIL_AppStatus in include/telephony/ril.h @@ -104,8 +106,8 @@ public class IccCardApplication { public String app_label; // applicable to USIM and CSIM public int pin1_replaced; - public int pin1; - public int pin2; + public PinState pin1; + public PinState pin2; AppType AppTypeFromRILInt(int type) { AppType newType; @@ -177,6 +179,33 @@ public class IccCardApplication { return newSubState; } + PinState PinStateFromRILInt(int state) { + PinState newPinState; + switch(state) { + case 0: + newPinState = PinState.PINSTATE_UNKNOWN; + break; + case 1: + newPinState = PinState.PINSTATE_ENABLED_NOT_VERIFIED; + break; + case 2: + newPinState = PinState.PINSTATE_ENABLED_VERIFIED; + break; + case 3: + newPinState = PinState.PINSTATE_DISABLED; + break; + case 4: + newPinState = PinState.PINSTATE_ENABLED_BLOCKED; + break; + case 5: + newPinState = PinState.PINSTATE_ENABLED_PERM_BLOCKED; + break; + default: + throw new RuntimeException("Unrecognized RIL_PinState: " + state); + } + return newPinState; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -185,6 +214,12 @@ public class IccCardApplication { if (app_state == AppState.APPSTATE_SUBSCRIPTION_PERSO) { sb.append(",").append(perso_substate); } + if (app_type == AppType.APPTYPE_CSIM || + app_type == AppType.APPTYPE_USIM || + app_type == AppType.APPTYPE_ISIM) { + sb.append(",pin1=").append(pin1); + sb.append(",pin2=").append(pin2); + } sb.append("}"); return sb.toString(); } diff --git a/telephony/java/com/android/internal/telephony/IccCardStatus.java b/telephony/java/com/android/internal/telephony/IccCardStatus.java index e9de922..c751a21 100644 --- a/telephony/java/com/android/internal/telephony/IccCardStatus.java +++ b/telephony/java/com/android/internal/telephony/IccCardStatus.java @@ -42,7 +42,19 @@ public class IccCardStatus { PINSTATE_ENABLED_VERIFIED, PINSTATE_DISABLED, PINSTATE_ENABLED_BLOCKED, - PINSTATE_ENABLED_PERM_BLOCKED + PINSTATE_ENABLED_PERM_BLOCKED; + + boolean isPermBlocked() { + return this == PINSTATE_ENABLED_PERM_BLOCKED; + } + + boolean isPinRequired() { + return this == PINSTATE_ENABLED_NOT_VERIFIED; + } + + boolean isPukRequired() { + return this == PINSTATE_ENABLED_BLOCKED; + } } private CardState mCardState; diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 40a396e..2e8b709 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -2925,8 +2925,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { ca.aid = p.readString(); ca.app_label = p.readString(); ca.pin1_replaced = p.readInt(); - ca.pin1 = p.readInt(); - ca.pin2 = p.readInt(); + ca.pin1 = ca.PinStateFromRILInt(p.readInt()); + ca.pin2 = ca.PinStateFromRILInt(p.readInt()); status.addApplication(ca); } return status; |