Improves PIN/PUK handling events in keyguard
am: 4b2f6e2816
Change-Id: I8358bc35d236e47aeb716d2764c3e1db995e25f8
This commit is contained in:
@@ -67,17 +67,6 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
public void onSimStateChanged(int subId, int slotId, State simState) {
|
public void onSimStateChanged(int subId, int slotId, State simState) {
|
||||||
if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
|
if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
|
||||||
switch(simState) {
|
switch(simState) {
|
||||||
// If the SIM is removed, then we must remove the keyguard. It will be put up
|
|
||||||
// again when the PUK locked SIM is re-entered.
|
|
||||||
case ABSENT: {
|
|
||||||
KeyguardUpdateMonitor.getInstance(getContext()).reportSimUnlocked(mSubId);
|
|
||||||
// onSimStateChanged callback can fire when the SIM PIN lock is not currently
|
|
||||||
// active and mCallback is null.
|
|
||||||
if (mCallback != null) {
|
|
||||||
mCallback.dismiss(true, KeyguardUpdateMonitor.getCurrentUser());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case READY: {
|
case READY: {
|
||||||
mRemainingAttempts = -1;
|
mRemainingAttempts = -1;
|
||||||
resetState();
|
resetState();
|
||||||
|
|||||||
@@ -70,14 +70,11 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
public void onSimStateChanged(int subId, int slotId, State simState) {
|
public void onSimStateChanged(int subId, int slotId, State simState) {
|
||||||
if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
|
if (DEBUG) Log.v(TAG, "onSimStateChanged(subId=" + subId + ",state=" + simState + ")");
|
||||||
switch(simState) {
|
switch(simState) {
|
||||||
// If the SIM is removed, then we must remove the keyguard. It will be put up
|
|
||||||
// again when the PUK locked SIM is re-entered.
|
|
||||||
case ABSENT:
|
|
||||||
// intentional fall-through
|
|
||||||
// If the SIM is unlocked via a key sequence through the emergency dialer, it will
|
// If the SIM is unlocked via a key sequence through the emergency dialer, it will
|
||||||
// move into the READY state and the PUK lock keyguard should be removed.
|
// move into the READY state and the PUK lock keyguard should be removed.
|
||||||
case READY: {
|
case READY: {
|
||||||
KeyguardUpdateMonitor.getInstance(getContext()).reportSimUnlocked(mSubId);
|
mRemainingAttempts = -1;
|
||||||
|
mShowDefaultMessage = true;
|
||||||
// mCallback can be null if onSimStateChanged callback is called when keyguard
|
// mCallback can be null if onSimStateChanged callback is called when keyguard
|
||||||
// isn't active.
|
// isn't active.
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
|
|||||||
@@ -1582,6 +1582,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
// Even though the subscription is not valid anymore, we need to notify that the
|
// Even though the subscription is not valid anymore, we need to notify that the
|
||||||
// SIM card was removed so we can update the UI.
|
// SIM card was removed so we can update the UI.
|
||||||
becameAbsent = true;
|
becameAbsent = true;
|
||||||
|
for (SimData data : mSimDatas.values()) {
|
||||||
|
// Set the SIM state of all SimData associated with that slot to ABSENT se we
|
||||||
|
// do not move back into PIN/PUK locked and not detect the change below.
|
||||||
|
if (data.slotId == slotId) {
|
||||||
|
data.simState = State.ABSENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -461,8 +461,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
boolean simWasLocked;
|
boolean simWasLocked;
|
||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
IccCardConstants.State lastState = mLastSimStates.get(slotId);
|
IccCardConstants.State lastState = mLastSimStates.get(slotId);
|
||||||
simWasLocked = (lastState == PIN_REQUIRED || lastState == PUK_REQUIRED)
|
simWasLocked = (lastState == PIN_REQUIRED || lastState == PUK_REQUIRED);
|
||||||
&& simState == READY;
|
|
||||||
mLastSimStates.append(slotId, simState);
|
mLastSimStates.append(slotId, simState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,6 +486,8 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
// so we should only lock when they are ABSENT.
|
// so we should only lock when they are ABSENT.
|
||||||
onSimAbsentLocked();
|
onSimAbsentLocked();
|
||||||
if (simWasLocked) {
|
if (simWasLocked) {
|
||||||
|
if (DEBUG_SIM_STATES) Log.d(TAG, "SIM moved to ABSENT when the "
|
||||||
|
+ "previous state was locked. Reset the state.");
|
||||||
resetStateLocked();
|
resetStateLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,6 +524,8 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
if (DEBUG_SIM_STATES) Log.d(TAG, "READY, reset state? " + mShowing);
|
if (DEBUG_SIM_STATES) Log.d(TAG, "READY, reset state? " + mShowing);
|
||||||
if (mShowing && simWasLocked) {
|
if (mShowing && simWasLocked) {
|
||||||
|
if (DEBUG_SIM_STATES) Log.d(TAG, "SIM moved to READY when the "
|
||||||
|
+ "previous state was locked. Reset the state.");
|
||||||
resetStateLocked();
|
resetStateLocked();
|
||||||
}
|
}
|
||||||
mLockWhenSimRemoved = true;
|
mLockWhenSimRemoved = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user