From 22dfe722dfb1094cfc5be0f155f3930bf39e5d61 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Wed, 7 Oct 2009 01:30:21 -0700 Subject: [PATCH] Cherry-pick from mr2 to eclair: DO NOT MERGE commit 149c0543a3d5f450686b7c3d142ac5f8fcf61ed4 BUG=2176949 Partial fix for 2069703: Fix race condition in KeyguardViewManager.hide() that could result in a blank screen. This fixes a race condition seen whenever show() is called before the timer in hide() triggers. This can happen for example if the user hits "Emergency Dial" followed by the back button before the 0.5s timeout completes. The result is a blank screen with no keyguard view and no means to recover on devices w/o a keyboard. The bug caused us to sometimes remove the newly created KeyguardView instead of the old one, leaving the view empty. The fix is to always remove the last view. --- .../internal/policy/impl/KeyguardViewManager.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/policy/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/com/android/internal/policy/impl/KeyguardViewManager.java index 910df8d0e8701..bac2fcada11f9 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewManager.java @@ -48,7 +48,7 @@ public class KeyguardViewManager implements KeyguardWindowController { private WindowManager.LayoutParams mWindowLayoutParams; private boolean mNeedsInput = false; - + private FrameLayout mKeyguardHost; private KeyguardViewBase mKeyguardView; @@ -154,7 +154,7 @@ public class KeyguardViewManager implements KeyguardWindowController { mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams); } } - + /** * Reset the state of the view. */ @@ -218,15 +218,13 @@ public class KeyguardViewManager implements KeyguardWindowController { // Don't do this right away, so we can let the view continue to animate // as it goes away. if (mKeyguardView != null) { - final View lastView = mKeyguardView; + final KeyguardViewBase lastView = mKeyguardView; + mKeyguardView = null; mKeyguardHost.postDelayed(new Runnable() { public void run() { synchronized (KeyguardViewManager.this) { - if (mKeyguardView == lastView) { - mKeyguardHost.removeView(mKeyguardView); - mKeyguardView.cleanUp(); - mKeyguardView = null; - } + mKeyguardHost.removeView(lastView); + lastView.cleanUp(); } } }, 500);