Merge "Check whether doze is enabled before starting the screen off animation." into sc-dev

This commit is contained in:
Josh Tsuji
2021-07-01 14:06:45 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 4 deletions

View File

@@ -223,8 +223,15 @@ public class DozeParameters implements TunerService.Tunable,
* then abruptly showing AOD. * then abruptly showing AOD.
*/ */
public boolean shouldControlUnlockedScreenOff() { public boolean shouldControlUnlockedScreenOff() {
return getAlwaysOn() && mFeatureFlags.useNewLockscreenAnimations() return mUnlockedScreenOffAnimationController.shouldPlayUnlockedScreenOffAnimation();
&& 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) { private boolean getBoolean(String propName, int resId) {

View File

@@ -45,7 +45,8 @@ class UnlockedScreenOffAnimationController @Inject constructor(
private val wakefulnessLifecycle: WakefulnessLifecycle, private val wakefulnessLifecycle: WakefulnessLifecycle,
private val statusBarStateControllerImpl: StatusBarStateControllerImpl, private val statusBarStateControllerImpl: StatusBarStateControllerImpl,
private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>, private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>,
private val keyguardStateController: KeyguardStateController private val keyguardStateController: KeyguardStateController,
private val dozeParameters: dagger.Lazy<DozeParameters>
) : WakefulnessLifecycle.Observer { ) : WakefulnessLifecycle.Observer {
private val handler = Handler() private val handler = Handler()
@@ -146,7 +147,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
} }
override fun onStartedGoingToSleep() { override fun onStartedGoingToSleep() {
if (shouldPlayUnlockedScreenOffAnimation()) { if (dozeParameters.get().shouldControlUnlockedScreenOff()) {
lightRevealAnimationPlaying = true lightRevealAnimationPlaying = true
lightRevealAnimator.start() lightRevealAnimator.start()
@@ -164,6 +165,10 @@ class UnlockedScreenOffAnimationController @Inject constructor(
* on the current state of the device. * on the current state of the device.
*/ */
fun shouldPlayUnlockedScreenOffAnimation(): Boolean { fun shouldPlayUnlockedScreenOffAnimation(): Boolean {
if (!dozeParameters.get().canControlUnlockedScreenOff()) {
return false
}
// We only play the unlocked screen off animation if we are... unlocked. // We only play the unlocked screen off animation if we are... unlocked.
if (statusBarStateControllerImpl.state != StatusBarState.SHADE) { if (statusBarStateControllerImpl.state != StatusBarState.SHADE) {
return false return false