diff options
| author | 2021-07-01 14:06:45 +0000 | |
|---|---|---|
| committer | 2021-07-01 14:06:45 +0000 | |
| commit | ba255e63d852082134e4b945caa91bd02c0d6a87 (patch) | |
| tree | 51d7559ab54cd63f61803a61ccb7e324d8b1e16a | |
| parent | 7384ba771f5f881f0205516719735d314309043d (diff) | |
| parent | 9d28e79926147ad12cd93e89cc5669bc5f1ca065 (diff) | |
Merge "Check whether doze is enabled before starting the screen off animation." into sc-dev
2 files changed, 16 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java index c4d1abc1b74c..68024726c5de 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java @@ -223,8 +223,15 @@ public class DozeParameters implements TunerService.Tunable, * then abruptly showing AOD. */ public boolean shouldControlUnlockedScreenOff() { - return getAlwaysOn() && mFeatureFlags.useNewLockscreenAnimations() - && mUnlockedScreenOffAnimationController.shouldPlayUnlockedScreenOffAnimation(); + return mUnlockedScreenOffAnimationController.shouldPlayUnlockedScreenOffAnimation(); + } + + /** + * Whether we're capable of controlling the screen off animation if we want to. This isn't + * possible if AOD isn't even enabled or if the flag is disabled. + */ + public boolean canControlUnlockedScreenOff() { + return getAlwaysOn() && mFeatureFlags.useNewLockscreenAnimations(); } private boolean getBoolean(String propName, int resId) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt index 6b00dd4b49e8..c1f376286164 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt @@ -45,7 +45,8 @@ class UnlockedScreenOffAnimationController @Inject constructor( private val wakefulnessLifecycle: WakefulnessLifecycle, private val statusBarStateControllerImpl: StatusBarStateControllerImpl, private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>, - private val keyguardStateController: KeyguardStateController + private val keyguardStateController: KeyguardStateController, + private val dozeParameters: dagger.Lazy<DozeParameters> ) : WakefulnessLifecycle.Observer { private val handler = Handler() @@ -146,7 +147,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( } override fun onStartedGoingToSleep() { - if (shouldPlayUnlockedScreenOffAnimation()) { + if (dozeParameters.get().shouldControlUnlockedScreenOff()) { lightRevealAnimationPlaying = true lightRevealAnimator.start() @@ -164,6 +165,10 @@ class UnlockedScreenOffAnimationController @Inject constructor( * on the current state of the device. */ fun shouldPlayUnlockedScreenOffAnimation(): Boolean { + if (!dozeParameters.get().canControlUnlockedScreenOff()) { + return false + } + // We only play the unlocked screen off animation if we are... unlocked. if (statusBarStateControllerImpl.state != StatusBarState.SHADE) { return false |