From 67b29d5d498a497cf5164e0f840b30a8d197f716 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Fri, 9 Jun 2017 18:00:00 -0700 Subject: [PATCH] Fix wake-and-unlock animation Since okToDisplay was false when we started the keyguard exit animation, no animation was applied and we didn't create a starting window, which lead to flickering. We fix this by allowing animations from mScreenOnEarly. Furthermore, we synchronize the navigation bar better with the rest of the animation. We also need to apply no animation to the status bar window as we go through performShowLocked because we were waiting for it to draw. Test: go/wm-smoke Test: Wake-and-unlock Test: Make sure no other regression with screen on experience Change-Id: I5f264b74cc258e8d7f608978edfb1faa5ead385c Fixes: 38441599 --- .../phone/StatusBarKeyguardViewManager.java | 11 +++++++---- .../android/server/policy/PhoneWindowManager.java | 15 +++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index bb302bb21da43..47c469208d92e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -92,6 +92,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb private boolean mLastBouncerShowing; private boolean mLastBouncerDismissible; protected boolean mLastRemoteInputActive; + private boolean mLastDeferScrimFadeOut; private OnDismissAction mAfterKeyguardGoneAction; private final ArrayList mAfterKeyguardGoneRunnables = new ArrayList<>(); @@ -367,7 +368,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration); mFingerprintUnlockController.startKeyguardFadingAway(); mBouncer.hide(true /* destroyView */); - updateStates(); if (wakeUnlockPulsing) { mStatusBarWindowManager.setKeyguardFadingAway(true); mStatusBar.fadeKeyguardWhilePulsing(); @@ -399,6 +399,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mFingerprintUnlockController.finishKeyguardFadingAway(); } } + updateStates(); mStatusBarWindowManager.setKeyguardShowing(false); mViewMediatorCallback.keyguardGone(); } @@ -569,7 +570,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mLastBouncerShowing = bouncerShowing; mLastBouncerDismissible = bouncerDismissible; mLastRemoteInputActive = remoteInputActive; - + mLastDeferScrimFadeOut = mDeferScrimFadeOut; mStatusBar.onKeyguardViewManagerStatesUpdated(); } @@ -577,14 +578,16 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * @return Whether the navigation bar should be made visible based on the current state. */ protected boolean isNavBarVisible() { - return !(mShowing && !mOccluded) || mBouncer.isShowing() || mRemoteInputActive; + return (!(mShowing && !mOccluded) || mBouncer.isShowing() || mRemoteInputActive) + && !mDeferScrimFadeOut; } /** * @return Whether the navigation bar was made visible based on the last known state. */ protected boolean getLastNavBarVisible() { - return !(mLastShowing && !mLastOccluded) || mLastBouncerShowing || mLastRemoteInputActive; + return (!(mLastShowing && !mLastOccluded) || mLastBouncerShowing || mLastRemoteInputActive) + && !mLastDeferScrimFadeOut; } public boolean shouldDismissOnMenuPressed() { diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index c2c9123170e18..01eabd8f1403e 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -3072,13 +3072,18 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (PRINT_ANIM) Log.i(TAG, "selectAnimation in " + win + ": transit=" + transit); if (win == mStatusBar) { - boolean isKeyguard = (win.getAttrs().privateFlags & PRIVATE_FLAG_KEYGUARD) != 0; + final boolean isKeyguard = (win.getAttrs().privateFlags & PRIVATE_FLAG_KEYGUARD) != 0; + final boolean expanded = win.getAttrs().height == MATCH_PARENT + && win.getAttrs().width == MATCH_PARENT; + if (isKeyguard || expanded) { + return -1; + } if (transit == TRANSIT_EXIT || transit == TRANSIT_HIDE) { - return isKeyguard ? -1 : R.anim.dock_top_exit; + return R.anim.dock_top_exit; } else if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) { - return isKeyguard ? -1 : R.anim.dock_top_enter; + return R.anim.dock_top_enter; } } else if (win == mNavigationBar) { if (win.getAttrs().windowAnimations != 0) { @@ -6803,7 +6808,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public boolean isScreenOn() { - return mScreenOnFully; + synchronized (mLock) { + return mScreenOnEarly; + } } /** {@inheritDoc} */