summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcore/res/res/values/strings.xml3
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java10
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java11
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java3
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java6
-rw-r--r--policy/src/com/android/internal/policy/impl/LockScreen.java25
-rw-r--r--telephony/java/com/android/internal/telephony/IccCard.java19
-rw-r--r--telephony/java/com/android/internal/telephony/IccCardApplication.java39
-rw-r--r--telephony/java/com/android/internal/telephony/IccCardStatus.java14
-rw-r--r--telephony/java/com/android/internal/telephony/RIL.java4
10 files changed, 118 insertions, 16 deletions
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 90b9ffac0c57..f24670c047a3 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1735,6 +1735,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>
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 72209f6d0e12..f385a23cc620 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -114,7 +114,15 @@ public class KeyguardUpdateMonitor {
}
String stateExtra = intent.getStringExtra(IccCard.INTENT_KEY_ICC_STATE);
if (IccCard.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
- this.simState = IccCard.State.ABSENT;
+ 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)) {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index e7a9eb1dec21..cfd0d4f9c233 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -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();
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 874acd0f4b54..eea30407af55 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -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);
}
/**
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java
index ed5a058b8315..19adb3ef5917 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java
@@ -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);
}
}
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index 88f4f23f9a35..0f187d45a2ed 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -126,7 +126,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
/**
* The sim card is locked.
*/
- SimLocked(true);
+ SimLocked(true),
+
+ /**
+ * The sim card is permanently disabled due to puk unlock failure
+ */
+ SimPermDisabled(false);
private final boolean mShowStatusLines;
@@ -450,7 +455,9 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
*/
private Status getCurrentStatus(IccCard.State simState) {
boolean missingAndNotProvisioned = (!mUpdateMonitor.isDeviceProvisioned()
- && simState == IccCard.State.ABSENT);
+ && (simState == IccCard.State.ABSENT
+ || simState == IccCard.State.PERM_DISABLED));
+
if (missingAndNotProvisioned) {
return Status.SimMissingLocked;
}
@@ -468,6 +475,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
return Status.SimPukLocked;
case READY:
return Status.Normal;
+ case PERM_DISABLED:
+ return Status.SimPermDisabled;
case UNKNOWN:
return Status.SimMissing;
}
@@ -542,6 +551,18 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
enableUnlock(); // do not need to show the e-call button; user may unlock
break;
+ case SimPermDisabled:
+ // text
+ mStatusView.setCarrierText(R.string.lockscreen_missing_sim_message_short);
+ mScreenLocked.setText(
+ R.string.lockscreen_permanent_disabled_sim_instructions);
+
+ // layout
+ mScreenLocked.setVisibility(View.VISIBLE);
+ mLockPatternUtils.updateEmergencyCallText(mEmergencyCallText);
+ enableUnlock(); // do not need to show the e-call button; user may unlock
+ break;
+
case SimMissingLocked:
// text
mStatusView.setCarrierText(
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java
index 5d8fc7884a65..02617c8083e2 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 434c484ebbdd..abb740ef0c32 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 e9de922a5cd9..c751a21f24de 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 40a396e58da3..2e8b70956230 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;