Skip to content

Commit fb9e364

Browse files
Jim MillerAndroid (Google) Code Review
authored andcommitted
Merge "Fix 5620754: don't show pattern unlock after SIM unlock if not enabled."
2 parents b14ecd2 + 93708af commit fb9e364

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

core/java/com/android/internal/widget/LockPatternUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public void clearLock(boolean isFallback) {
404404
saveLockPassword(null, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
405405
setLockPatternEnabled(false);
406406
saveLockPattern(null);
407-
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
407+
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
408408
setLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
409409
}
410410

policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,9 @@ private boolean isSecure() {
855855
case Password:
856856
secure = mLockPatternUtils.isLockPasswordEnabled();
857857
break;
858+
case Unknown:
859+
// This means no security is set up
860+
break;
858861
default:
859862
throw new IllegalStateException("unknown unlock mode " + unlockMode);
860863
}
@@ -877,8 +880,8 @@ private void updateScreen(Mode mode, boolean force) {
877880

878881
// Re-create the unlock screen if necessary. This is primarily required to properly handle
879882
// SIM state changes. This typically happens when this method is called by reset()
880-
if (mode == Mode.UnlockScreen) {
881-
final UnlockMode unlockMode = getUnlockMode();
883+
final UnlockMode unlockMode = getUnlockMode();
884+
if (mode == Mode.UnlockScreen && unlockMode != UnlockMode.Unknown) {
882885
if (force || mUnlockScreen == null || unlockMode != mUnlockScreenMode) {
883886
boolean restartFaceLock = stopFaceLockIfRunning();
884887
recreateUnlockScreen(unlockMode);
@@ -1052,11 +1055,15 @@ private UnlockMode getUnlockMode() {
10521055
break;
10531056
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
10541057
case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED:
1055-
// "forgot pattern" button is only available in the pattern mode...
1056-
if (mForgotPattern || mLockPatternUtils.isPermanentlyLocked()) {
1057-
currentMode = UnlockMode.Account;
1058+
if (mLockPatternUtils.isLockPatternEnabled()) {
1059+
// "forgot pattern" button is only available in the pattern mode...
1060+
if (mForgotPattern || mLockPatternUtils.isPermanentlyLocked()) {
1061+
currentMode = UnlockMode.Account;
1062+
} else {
1063+
currentMode = UnlockMode.Pattern;
1064+
}
10581065
} else {
1059-
currentMode = UnlockMode.Pattern;
1066+
currentMode = UnlockMode.Unknown;
10601067
}
10611068
break;
10621069
default:

0 commit comments

Comments
 (0)