@@ -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