diff options
| author | 2017-05-23 16:16:50 -0700 | |
|---|---|---|
| committer | 2017-05-23 16:16:50 -0700 | |
| commit | 88e61aad090a05e482e8f007cb5d92bcb338a2c1 (patch) | |
| tree | 061842f90b2fb3641aabfafa460ed5d6ce96d283 | |
| parent | a239ed1c79a55f5dc650a528a21fb696752c8049 (diff) | |
AOD: Fix wakeAndUnlockPulsing transition
Change-Id: Ia5d999f1756050a972f986357d563703abce7172
Fixes: 37878458
Test: Double-tap to trigger Ambient Display, use fingerprint to unlock. Verify transition is Buttery Smooth
5 files changed, 42 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java index c5f23c5e066a..6b276f8691e3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java @@ -53,6 +53,7 @@ public class DozeScrimController { private float mInFrontTarget; private float mBehindTarget; private boolean mDozingAborted; + private boolean mWakeAndUnlocking; public DozeScrimController(ScrimController scrimController, Context context) { mContext = context; @@ -63,6 +64,7 @@ public class DozeScrimController { public void setDozing(boolean dozing, boolean animate) { if (mDozing == dozing) return; mDozing = dozing; + mWakeAndUnlocking = false; if (mDozing) { mDozingAborted = false; abortAnimations(); @@ -85,6 +87,16 @@ public class DozeScrimController { } } + public void setWakeAndUnlocking() { + // Immediately abort the doze scrims in case of wake-and-unlock + // for pulsing so the Keyguard fade-out animation scrim can take over. + if (!mWakeAndUnlocking) { + mWakeAndUnlocking = true; + mScrimController.setDozeBehindAlpha(0f); + mScrimController.setDozeInFrontAlpha(0f); + } + } + /** When dozing, fade screen contents in and out using the front scrim. */ public void pulse(@NonNull DozeHost.PulseCallback callback, int reason) { if (callback == null) { @@ -109,7 +121,7 @@ public class DozeScrimController { */ public void abortPulsing() { cancelPulsing(); - if (mDozing) { + if (mDozing && !mWakeAndUnlocking) { mScrimController.setDozeBehindAlpha(1f); mScrimController.setDozeInFrontAlpha( mDozeParameters.getAlwaysOn() && !mDozingAborted ? 0f : 1f); @@ -244,6 +256,9 @@ public class DozeScrimController { } private void setDozeAlpha(boolean inFront, float alpha) { + if (mWakeAndUnlocking) { + return; + } if (inFront) { mScrimController.setDozeInFrontAlpha(alpha); } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java index f216d6c4480f..6cb722fa65ce 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java @@ -98,7 +98,6 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { private StatusBar mStatusBar; private final UnlockMethodCache mUnlockMethodCache; private final Context mContext; - private boolean mGoingToSleep; private int mPendingAuthenticatedUserId = -1; public FingerprintUnlockController(Context context, @@ -213,17 +212,19 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { Trace.endSection(); break; case MODE_WAKE_AND_UNLOCK_PULSING: - Trace.beginSection("MODE_WAKE_AND_UNLOCK_PULSING"); - mStatusBar.updateMediaMetaData(false /* metaDataChanged */, - true /* allowEnterAnimation */); - // Fall through. - Trace.endSection(); case MODE_WAKE_AND_UNLOCK: - Trace.beginSection("MODE_WAKE_AND_UNLOCK"); + if (mMode == MODE_WAKE_AND_UNLOCK_PULSING) { + Trace.beginSection("MODE_WAKE_AND_UNLOCK_PULSING"); + mStatusBar.updateMediaMetaData(false /* metaDataChanged */, + true /* allowEnterAnimation */); + } else { + Trace.beginSection("MODE_WAKE_AND_UNLOCK"); + mDozeScrimController.abortDoze(); + } mStatusBarWindowManager.setStatusBarFocusable(false); - mDozeScrimController.abortDoze(); mKeyguardViewMediator.onWakeAndUnlocking(); mScrimController.setWakeAndUnlocking(); + mDozeScrimController.setWakeAndUnlocking(); if (mStatusBar.getNavigationBarView() != null) { mStatusBar.getNavigationBarView().setWakeAndUnlocking(true); } @@ -302,10 +303,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { } private void cleanup() { - mMode = MODE_NONE; releaseFingerprintWakeLock(); - mStatusBarWindowManager.setForceDozeBrightness(false); - mStatusBar.notifyFpAuthModeChanged(); } public void startKeyguardFadingAway() { @@ -321,6 +319,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { public void finishKeyguardFadingAway() { mMode = MODE_NONE; + mStatusBarWindowManager.setForceDozeBrightness(false); if (mStatusBar.getNavigationBarView() != null) { mStatusBar.getNavigationBarView().setWakeAndUnlocking(false); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 0fa8afadea6c..af2f7e98bb1b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -2401,17 +2401,26 @@ public class NotificationPanelView extends PanelView implements @Override public void setAlpha(float alpha) { super.setAlpha(alpha); - updateFullyVisibleState(); + updateFullyVisibleState(false /* forceNotFullyVisible */); + } + + /** + * Must be called before starting a ViewPropertyAnimator alpha animation because those + * do NOT call setAlpha and therefore don't properly update the fullyVisibleState. + */ + public void notifyStartFading() { + updateFullyVisibleState(true /* forceNotFullyVisible */); } @Override public void setVisibility(int visibility) { super.setVisibility(visibility); - updateFullyVisibleState(); + updateFullyVisibleState(false /* forceNotFullyVisible */); } - private void updateFullyVisibleState() { - mNotificationStackScroller.setParentNotFullyVisible(getAlpha() != 1.0f + private void updateFullyVisibleState(boolean forceNotFullyVisible) { + mNotificationStackScroller.setParentNotFullyVisible(forceNotFullyVisible + || getAlpha() != 1.0f || getVisibility() != VISIBLE); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index d798fbf416df..699d367b6da4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -4138,6 +4138,7 @@ public class StatusBar extends SystemUI implements DemoMode, * fading. */ public void fadeKeyguardWhilePulsing() { + mNotificationPanel.notifyStartFading(); mNotificationPanel.animate() .alpha(0f) .setStartDelay(0) @@ -4356,12 +4357,7 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardIndicationController.setDozing(mDozing); mNotificationPanel.setDark(mDozing, animate); updateQsExpansionEnabled(); - - // Immediately abort the dozing from the doze scrim controller in case of wake-and-unlock - // for pulsing so the Keyguard fade-out animation scrim can take over. - mDozeScrimController.setDozing(mDozing && - mFingerprintUnlockController.getMode() - != FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING, animate); + mDozeScrimController.setDozing(mDozing, animate); updateRowStates(); Trace.endSection(); } 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 2a69c1e663bb..15aee6a41cff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -381,6 +381,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else { mScrimController.animateGoingToFullShade(delay, fadeoutDuration); mStatusBar.finishKeyguardFadingAway(); + mFingerprintUnlockController.finishKeyguardFadingAway(); } } mStatusBarWindowManager.setKeyguardShowing(false); |