diff options
author | Jim Miller <jaggies@google.com> | 2014-12-09 19:00:22 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2014-12-10 15:59:43 -0800 |
commit | a5faf2415d5760d2239f85271b889d655b5c271b (patch) | |
tree | 6c4d6462edb4bf6ba0537b5c9f460b096e89938f /policy/src/com | |
parent | 6c42ee470307eee56a21062ad67b67878aa9392d (diff) | |
download | frameworks_base-a5faf2415d5760d2239f85271b889d655b5c271b.zip frameworks_base-a5faf2415d5760d2239f85271b889d655b5c271b.tar.gz frameworks_base-a5faf2415d5760d2239f85271b889d655b5c271b.tar.bz2 |
Attempt to fix keyguard missing bug
This attempts to fix a bug where the device sometimes shows the home screen
before keyguard starts. The fix ensures we show the scrim when KeyguardServiceDelegate
is created and stays there until KeyguardService connects.
Fixes bug 18468369
Change-Id: Ib560889663c0c4dd84135d949fefc2b9819ce9a1
Diffstat (limited to 'policy/src/com')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java index 618ba1e..e499299 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java @@ -37,6 +37,7 @@ public class KeyguardServiceDelegate { private final Context mContext; private final View mScrim; // shown if keyguard crashes private final KeyguardState mKeyguardState = new KeyguardState(); + private ShowListener mShowListenerWhenConnect; /* package */ static final class KeyguardState { KeyguardState() { @@ -130,7 +131,13 @@ public class KeyguardServiceDelegate { // If the system is ready, it means keyguard crashed and restarted. mKeyguardService.onSystemReady(); // This is used to hide the scrim once keyguard displays. - mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(null)); + mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate( + mShowListenerWhenConnect)); + if (mShowListenerWhenConnect != null) { + Log.v(TAG, "*** hiding scrim because keyguard wasn't ready"); + mShowListenerWhenConnect = null; + hideScrim(); + } } if (mKeyguardState.bootCompleted) { mKeyguardService.onBootCompleted(); @@ -212,9 +219,10 @@ public class KeyguardServiceDelegate { } else { // try again when we establish a connection Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!"); - // This shouldn't happen, but if it does, invoke the listener immediately - // to avoid a dark screen... - showListener.onShown(null); + // This shouldn't happen, but if it does, show the scrim immediately and + // invoke the listener's callback after the service actually connects. + mShowListenerWhenConnect = showListener; + showScrim(); } mKeyguardState.screenIsOn = true; } @@ -280,7 +288,6 @@ public class KeyguardServiceDelegate { lp.setTitle("KeyguardScrim"); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.addView(view, lp); - view.setVisibility(View.GONE); // Disable pretty much everything in statusbar until keyguard comes back and we know // the state of the world. view.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME |