Fix 5620754: don't show pattern unlock after SIM unlock if not enabled.

This fixes a bug where the device would show pattern unlock after the user
entered the SIM PUK unlock code.  The code now correctly determines that
the device isn't secure and thus shouldn't show the unlock screen.

Change-Id: I49fd749592154a4c5840038b92d54ca7ca086074
This commit is contained in:
Jim Miller
2012-01-25 18:26:12 -08:00
parent 2ca25cd6d6
commit 93708af132
2 changed files with 14 additions and 7 deletions

View File

@@ -404,7 +404,7 @@ public class LockPatternUtils {
saveLockPassword(null, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
setLockPatternEnabled(false);
saveLockPattern(null);
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
setLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
}

View File

@@ -855,6 +855,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
case Password:
secure = mLockPatternUtils.isLockPasswordEnabled();
break;
case Unknown:
// This means no security is set up
break;
default:
throw new IllegalStateException("unknown unlock mode " + unlockMode);
}
@@ -877,8 +880,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
// Re-create the unlock screen if necessary. This is primarily required to properly handle
// SIM state changes. This typically happens when this method is called by reset()
if (mode == Mode.UnlockScreen) {
final UnlockMode unlockMode = getUnlockMode();
final UnlockMode unlockMode = getUnlockMode();
if (mode == Mode.UnlockScreen && unlockMode != UnlockMode.Unknown) {
if (force || mUnlockScreen == null || unlockMode != mUnlockScreenMode) {
boolean restartFaceLock = stopFaceLockIfRunning();
recreateUnlockScreen(unlockMode);
@@ -1052,11 +1055,15 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
break;
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED:
// "forgot pattern" button is only available in the pattern mode...
if (mForgotPattern || mLockPatternUtils.isPermanentlyLocked()) {
currentMode = UnlockMode.Account;
if (mLockPatternUtils.isLockPatternEnabled()) {
// "forgot pattern" button is only available in the pattern mode...
if (mForgotPattern || mLockPatternUtils.isPermanentlyLocked()) {
currentMode = UnlockMode.Account;
} else {
currentMode = UnlockMode.Pattern;
}
} else {
currentMode = UnlockMode.Pattern;
currentMode = UnlockMode.Unknown;
}
break;
default: