From 75468e1ef1d605989c66c25ec7fb0fbff4691f72 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Wed, 30 Jun 2021 16:22:48 -0400 Subject: [PATCH] Update light reveal effect on wake/sleep so that the screen off animation works too. Screen off starts while we aren't yet dozing, so use wake/sleep instead. Bug: 181923218 Test: use power button and lift to wake and sleep device Test: use fingerprint, verify circle reveal still works Change-Id: I52f6244609c6c0c15b4787ecd3e69b19c92bc106 --- .../systemui/statusbar/phone/StatusBar.java | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) 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 61a0d637e79d0..a319bf4ece449 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3894,15 +3894,6 @@ public class StatusBar extends SystemUI implements DemoMode, updateQsExpansionEnabled(); mKeyguardViewMediator.setDozing(mDozing); - if ((isDozing && mWakefulnessLifecycle.getLastSleepReason() - == PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON) - || (!isDozing && mWakefulnessLifecycle.getLastWakeReason() - == PowerManager.WAKE_REASON_POWER_BUTTON)) { - mLightRevealScrim.setRevealEffect(mPowerButtonReveal); - } else if (!(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)) { - mLightRevealScrim.setRevealEffect(LiftReveal.INSTANCE); - } - mNotificationsController.requestNotificationUpdate("onDozingChanged"); updateDozingState(); mDozeServiceHost.updateDozing(); @@ -3911,6 +3902,27 @@ public class StatusBar extends SystemUI implements DemoMode, Trace.endSection(); } + /** + * Updates the light reveal effect to reflect the reason we're waking or sleeping (for example, + * from the power button). + * @param wakingUp Whether we're updating because we're waking up (true) or going to sleep + * (false). + */ + private void updateRevealEffect(boolean wakingUp) { + if (mLightRevealScrim == null) { + return; + } + + if (wakingUp && mWakefulnessLifecycle.getLastWakeReason() + == PowerManager.WAKE_REASON_POWER_BUTTON + || !wakingUp && mWakefulnessLifecycle.getLastSleepReason() + == PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON) { + mLightRevealScrim.setRevealEffect(mPowerButtonReveal); + } else if (!(mLightRevealScrim.getRevealEffect() instanceof CircleReveal)) { + mLightRevealScrim.setRevealEffect(LiftReveal.INSTANCE); + } + } + public LightRevealScrim getLightRevealScrim() { return mLightRevealScrim; } @@ -4043,6 +4055,7 @@ public class StatusBar extends SystemUI implements DemoMode, public void onStartedGoingToSleep() { String tag = "StatusBar#onStartedGoingToSleep"; DejankUtils.startDetectingBlockingIpcs(tag); + updateRevealEffect(false /* wakingUp */); updateNotificationPanelTouchState(); notifyHeadsUpGoingToSleep(); dismissVolumeDialog(); @@ -4074,6 +4087,7 @@ public class StatusBar extends SystemUI implements DemoMode, // This is intentionally below the stopDozing call above, since it avoids that we're // unnecessarily animating the wakeUp transition. Animations should only be enabled // once we fully woke up. + updateRevealEffect(true /* wakingUp */); updateNotificationPanelTouchState(); mPulseExpansionHandler.onStartedWakingUp();