From 62c3efd204acdf1f7bf3bde584e2a0dfd9ca046e Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Fri, 2 Sep 2011 15:45:19 -0700 Subject: [PATCH] Fix 2679658: Be more aggressive about recreating lock screen. In the past we were overly cautious about not recreating the lockscreen under steady state conditions. However, that allowed lockscreen to get into weird states where the screen orientation and the loaded layout disagree. Once in this state, the user could not recover because we would never reload the layout due to the fixed orientation of lock screen. This avoids the problem by being more aggressive about reloading the layout. It now recreates the lockscreen (for reals) whenever a view requests it via recreateMe(). In addition it serializes recreateMe() requests to ensure a pending configuration change event has a chance to propagate and be handled by the lockscreen looper. Change-Id: I86a54abba899eb314f7cc8dbf6cbb98266bc548a --- .../policy/impl/LockPatternKeyguardView.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index 62abf203fc07c..0de2de955c803 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -180,7 +180,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { private Runnable mRecreateRunnable = new Runnable() { public void run() { - updateScreen(mMode, false); + updateScreen(mMode, true); } }; @@ -400,7 +400,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { // then finish and get out if (mEnableFallback || mAccountIndex >= mAccounts.length) { if (mUnlockScreen == null) { - Log.w(TAG, "no unlock screen when trying to enable fallback"); + if (DEBUG) Log.w(TAG, "no unlock screen when trying to enable fallback"); } else if (mUnlockScreen instanceof PatternUnlockScreen) { ((PatternUnlockScreen)mUnlockScreen).setEnableFallback(mEnableFallback); } @@ -459,7 +459,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { public void reset() { mIsVerifyUnlockOnly = false; mForgotPattern = false; - updateScreen(getInitialMode(), false); + post(mRecreateRunnable); } @Override @@ -485,9 +485,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { private void recreateLockScreen() { if (mLockScreen != null) { - if (mLockScreen.getVisibility() == View.VISIBLE) { - ((KeyguardScreen) mLockScreen).onPause(); - } + ((KeyguardScreen) mLockScreen).onPause(); ((KeyguardScreen) mLockScreen).cleanUp(); removeView(mLockScreen); } @@ -499,9 +497,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { private void recreateUnlockScreen(UnlockMode unlockMode) { if (mUnlockScreen != null) { - if (mUnlockScreen.getVisibility() == View.VISIBLE) { - ((KeyguardScreen) mUnlockScreen).onPause(); - } + ((KeyguardScreen) mUnlockScreen).onPause(); ((KeyguardScreen) mUnlockScreen).cleanUp(); removeView(mUnlockScreen); } @@ -611,7 +607,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { private void updateScreen(Mode mode, boolean force) { if (DEBUG_CONFIGURATION) Log.v(TAG, "**** UPDATE SCREEN: mode=" + mode - + " last mode=" + mMode, new RuntimeException()); + + " last mode=" + mMode + ", force = " + force, new RuntimeException()); mMode = mode;