From 93708af1329bb278d83c1fac6a623629cb42a3d4 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Wed, 25 Jan 2012 18:26:12 -0800 Subject: 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 --- .../com/android/internal/widget/LockPatternUtils.java | 2 +- .../internal/policy/impl/LockPatternKeyguardView.java | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 905a1713add5..6893ffbaf6c5 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -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); } diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index 0d0461baed7b..1e9784c5cc79 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -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: -- cgit v1.2.3-59-g8ed1b