Fix 6507787: fix MMI PUK unlock procedure

This fixes a bug where the user uses the MMI sequence (**05*PUK*PIN1*PIN1#)
from the EmergencyDialer to unlock their phone instead of the provided interface.

The code now recognizes when UnlockMode becomes invalid because it was previously
locked because of SIM state. It then dismisses the PUK unlock screen and advances
to the home screen.

Change-Id: I8902350e6f640cd2fa0af3460c3ea1a39d926c8a
This commit is contained in:
Jim Miller
2012-06-14 22:22:50 -07:00
parent d2ee4960c4
commit 2de5ee8463
2 changed files with 24 additions and 1 deletions

View File

@@ -105,6 +105,8 @@ public class KeyguardUpdateMonitor {
protected static final int MSG_DPM_STATE_CHANGED = 309;
protected static final int MSG_USER_CHANGED = 310;
protected static final boolean DEBUG_SIM_STATES = DEBUG || false;
/**
* When we receive a
* {@link com.android.internal.telephony.TelephonyIntents#ACTION_SIM_STATE_CHANGED} broadcast,
@@ -292,6 +294,10 @@ public class KeyguardUpdateMonitor {
MSG_BATTERY_UPDATE, new BatteryStatus(status, level, plugged, health));
mHandler.sendMessage(msg);
} else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) {
if (DEBUG_SIM_STATES) {
Log.v(TAG, "action " + action + " state" +
intent.getStringExtra(IccCard.INTENT_KEY_ICC_STATE));
}
mHandler.sendMessage(mHandler.obtainMessage(
MSG_SIM_STATE_CHANGE, SimArgs.fromIntent(intent)));
} else if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) {
@@ -407,6 +413,7 @@ public class KeyguardUpdateMonitor {
}
if (state != IccCard.State.UNKNOWN && state != mSimState) {
if (DEBUG_SIM_STATES) Log.v(TAG, "dispatching state: " + state);
mSimState = state;
for (int i = 0; i < mSimStateCallbacks.size(); i++) {
mSimStateCallbacks.get(i).onSimStateChanged(state);

View File

@@ -202,8 +202,21 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
private Runnable mRecreateRunnable = new Runnable() {
public void run() {
updateScreen(mMode, true);
Mode mode = mMode;
// If we were previously in a locked state but now it's Unknown, it means the phone
// was previously locked because of SIM state and has since been resolved. This
// bit of code checks this condition and dismisses keyguard.
boolean dismissAfterCreation = false;
if (mode == Mode.UnlockScreen && getUnlockMode() == UnlockMode.Unknown) {
if (DEBUG) Log.v(TAG, "Switch to Mode.LockScreen because SIM unlocked");
mode = Mode.LockScreen;
dismissAfterCreation = true;
}
updateScreen(mode, true);
restoreWidgetState();
if (dismissAfterCreation) {
mKeyguardScreenCallback.keyguardDone(false);
}
}
};
@@ -307,6 +320,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
}
public void recreateMe(Configuration config) {
if (DEBUG) Log.v(TAG, "recreateMe()");
removeCallbacks(mRecreateRunnable);
post(mRecreateRunnable);
}
@@ -524,6 +538,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
public void reset() {
mIsVerifyUnlockOnly = false;
mForgotPattern = false;
if (DEBUG) Log.v(TAG, "reset()");
post(mRecreateRunnable);
}
@@ -673,6 +688,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
if (DEBUG_CONFIGURATION) Log.v(TAG, "**** re-creating lock screen since config changed");
saveWidgetState();
removeCallbacks(mRecreateRunnable);
if (DEBUG) Log.v(TAG, "recreating lockscreen because config changed");
post(mRecreateRunnable);
}