Merge "Don't return true for controlling screen off once we've already returned false for this sleep." into sc-dev
This commit is contained in:
@@ -56,6 +56,13 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
private var lightRevealAnimationPlaying = false
|
private var lightRevealAnimationPlaying = false
|
||||||
private var aodUiAnimationPlaying = false
|
private var aodUiAnimationPlaying = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of our decision whether to play the screen off animation in
|
||||||
|
* [onStartedGoingToSleep], or null if we haven't made that decision yet or aren't going to
|
||||||
|
* sleep.
|
||||||
|
*/
|
||||||
|
private var decidedToAnimateGoingToSleep: Boolean? = null
|
||||||
|
|
||||||
private val lightRevealAnimator = ValueAnimator.ofFloat(1f, 0f).apply {
|
private val lightRevealAnimator = ValueAnimator.ofFloat(1f, 0f).apply {
|
||||||
duration = LIGHT_REVEAL_ANIMATION_DURATION
|
duration = LIGHT_REVEAL_ANIMATION_DURATION
|
||||||
interpolator = Interpolators.LINEAR
|
interpolator = Interpolators.LINEAR
|
||||||
@@ -120,11 +127,17 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
|
|
||||||
// Run the callback given to us by the KeyguardVisibilityHelper.
|
// Run the callback given to us by the KeyguardVisibilityHelper.
|
||||||
after.run()
|
after.run()
|
||||||
|
|
||||||
|
// Done going to sleep, reset this flag.
|
||||||
|
decidedToAnimateGoingToSleep = null
|
||||||
}
|
}
|
||||||
.start()
|
.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartedWakingUp() {
|
override fun onStartedWakingUp() {
|
||||||
|
// Waking up, so reset this flag.
|
||||||
|
decidedToAnimateGoingToSleep = null
|
||||||
|
|
||||||
lightRevealAnimator.cancel()
|
lightRevealAnimator.cancel()
|
||||||
handler.removeCallbacksAndMessages(null)
|
handler.removeCallbacksAndMessages(null)
|
||||||
}
|
}
|
||||||
@@ -148,6 +161,8 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
|
|
||||||
override fun onStartedGoingToSleep() {
|
override fun onStartedGoingToSleep() {
|
||||||
if (dozeParameters.get().shouldControlUnlockedScreenOff()) {
|
if (dozeParameters.get().shouldControlUnlockedScreenOff()) {
|
||||||
|
decidedToAnimateGoingToSleep = true
|
||||||
|
|
||||||
lightRevealAnimationPlaying = true
|
lightRevealAnimationPlaying = true
|
||||||
lightRevealAnimator.start()
|
lightRevealAnimator.start()
|
||||||
|
|
||||||
@@ -157,6 +172,8 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
// Show AOD. That'll cause the KeyguardVisibilityHelper to call #animateInKeyguard.
|
// Show AOD. That'll cause the KeyguardVisibilityHelper to call #animateInKeyguard.
|
||||||
statusBar.notificationPanelViewController.showAodUi()
|
statusBar.notificationPanelViewController.showAodUi()
|
||||||
}, ANIMATE_IN_KEYGUARD_DELAY)
|
}, ANIMATE_IN_KEYGUARD_DELAY)
|
||||||
|
} else {
|
||||||
|
decidedToAnimateGoingToSleep = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,6 +182,12 @@ 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 we explicitly already decided not to play the screen off animation, then never change
|
||||||
|
// our mind.
|
||||||
|
if (decidedToAnimateGoingToSleep == false) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if (!dozeParameters.get().canControlUnlockedScreenOff()) {
|
if (!dozeParameters.get().canControlUnlockedScreenOff()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -178,7 +201,8 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
// already expanded and showing notifications/QS, the animation looks really messy. For now,
|
// already expanded and showing notifications/QS, the animation looks really messy. For now,
|
||||||
// disable it if the notification panel is expanded.
|
// disable it if the notification panel is expanded.
|
||||||
if (!this::statusBar.isInitialized ||
|
if (!this::statusBar.isInitialized ||
|
||||||
statusBar.notificationPanelViewController.isFullyExpanded) {
|
statusBar.notificationPanelViewController.isFullyExpanded ||
|
||||||
|
statusBar.notificationPanelViewController.isExpanding) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user