Merge "Unable to unlock SIM with a PIN/PUK" into lmp-mr1-dev
This commit is contained in:
@@ -1303,16 +1303,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
// that don't return the complete set of values and have different types. In Keyguard we
|
// that don't return the complete set of values and have different types. In Keyguard we
|
||||||
// need IccCardConstants, but TelephonyManager would only give us
|
// need IccCardConstants, but TelephonyManager would only give us
|
||||||
// TelephonyManager.SIM_STATE*, so we retrieve it manually.
|
// TelephonyManager.SIM_STATE*, so we retrieve it manually.
|
||||||
final int phoneId = SubscriptionManager.getPhoneId(subId);
|
final TelephonyManager tele = TelephonyManager.from(mContext);
|
||||||
final String stateString = TelephonyManager.getTelephonyProperty(phoneId,
|
int simState = tele.getSimState(slotId);
|
||||||
TelephonyProperties.PROPERTY_SIM_STATE, "");
|
|
||||||
State state;
|
State state;
|
||||||
try {
|
try {
|
||||||
state = State.valueOf(stateString);
|
state = State.intToState(simState);
|
||||||
} catch(IllegalArgumentException ex) {
|
} catch(IllegalArgumentException ex) {
|
||||||
Log.w(TAG, "Unknown sim state: " + stateString);
|
Log.w(TAG, "Unknown sim state: " + simState);
|
||||||
state = State.UNKNOWN;
|
state = State.UNKNOWN;
|
||||||
}
|
}
|
||||||
mSimDatas.put(subId, new SimData(state, slotId, subId));
|
mSimDatas.put(subId, new SimData(state, slotId, subId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ public class IccCardConstants {
|
|||||||
static public final String INTENT_VALUE_ICC_CARD_IO_ERROR = "CARD_IO_ERROR";
|
static public final String INTENT_VALUE_ICC_CARD_IO_ERROR = "CARD_IO_ERROR";
|
||||||
/* LOCKED means ICC is locked by pin or by network */
|
/* LOCKED means ICC is locked by pin or by network */
|
||||||
public static final String INTENT_VALUE_ICC_LOCKED = "LOCKED";
|
public static final String INTENT_VALUE_ICC_LOCKED = "LOCKED";
|
||||||
|
//TODO: we can remove this state in the future if Bug 18489776 analysis
|
||||||
|
//#42's first race condition is resolved
|
||||||
|
/* INTERNAL LOCKED means ICC is locked by pin or by network */
|
||||||
|
public static final String INTENT_VALUE_ICC_INTERNAL_LOCKED = "INTERNAL_LOCKED";
|
||||||
/* READY means ICC is ready to access */
|
/* READY means ICC is ready to access */
|
||||||
public static final String INTENT_VALUE_ICC_READY = "READY";
|
public static final String INTENT_VALUE_ICC_READY = "READY";
|
||||||
/* IMSI means ICC IMSI is ready in property */
|
/* IMSI means ICC IMSI is ready in property */
|
||||||
@@ -81,5 +85,21 @@ public class IccCardConstants {
|
|||||||
|| (this == NETWORK_LOCKED) || (this == READY)
|
|| (this == NETWORK_LOCKED) || (this == READY)
|
||||||
|| (this == PERM_DISABLED) || (this == CARD_IO_ERROR));
|
|| (this == PERM_DISABLED) || (this == CARD_IO_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static State intToState(int state) throws IllegalArgumentException {
|
||||||
|
switch(state) {
|
||||||
|
case 0: return UNKNOWN;
|
||||||
|
case 1: return ABSENT;
|
||||||
|
case 2: return PIN_REQUIRED;
|
||||||
|
case 3: return PUK_REQUIRED;
|
||||||
|
case 4: return NETWORK_LOCKED;
|
||||||
|
case 5: return READY;
|
||||||
|
case 6: return NOT_READY;
|
||||||
|
case 7: return PERM_DISABLED;
|
||||||
|
case 8: return CARD_IO_ERROR;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user