@@ -202,8 +202,21 @@ enum UnlockMode {
202202
203203 private Runnable mRecreateRunnable = new Runnable () {
204204 public void run () {
205- updateScreen (mMode , true );
205+ Mode mode = mMode ;
206+ // If we were previously in a locked state but now it's Unknown, it means the phone
207+ // was previously locked because of SIM state and has since been resolved. This
208+ // bit of code checks this condition and dismisses keyguard.
209+ boolean dismissAfterCreation = false ;
210+ if (mode == Mode .UnlockScreen && getUnlockMode () == UnlockMode .Unknown ) {
211+ if (DEBUG ) Log .v (TAG , "Switch to Mode.LockScreen because SIM unlocked" );
212+ mode = Mode .LockScreen ;
213+ dismissAfterCreation = true ;
214+ }
215+ updateScreen (mode , true );
206216 restoreWidgetState ();
217+ if (dismissAfterCreation ) {
218+ mKeyguardScreenCallback .keyguardDone (false );
219+ }
207220 }
208221 };
209222
@@ -307,6 +320,7 @@ public boolean isVerifyUnlockOnly() {
307320 }
308321
309322 public void recreateMe (Configuration config ) {
323+ if (DEBUG ) Log .v (TAG , "recreateMe()" );
310324 removeCallbacks (mRecreateRunnable );
311325 post (mRecreateRunnable );
312326 }
@@ -524,6 +538,7 @@ protected void dispatchDraw(Canvas canvas) {
524538 public void reset () {
525539 mIsVerifyUnlockOnly = false ;
526540 mForgotPattern = false ;
541+ if (DEBUG ) Log .v (TAG , "reset()" );
527542 post (mRecreateRunnable );
528543 }
529544
@@ -673,6 +688,7 @@ protected void onConfigurationChanged(Configuration newConfig) {
673688 if (DEBUG_CONFIGURATION ) Log .v (TAG , "**** re-creating lock screen since config changed" );
674689 saveWidgetState ();
675690 removeCallbacks (mRecreateRunnable );
691+ if (DEBUG ) Log .v (TAG , "recreating lockscreen because config changed" );
676692 post (mRecreateRunnable );
677693 }
678694
0 commit comments