summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeverly <beverlyt@google.com>2021-10-21 16:20:25 -0400
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-11-05 08:14:15 +0000
commit5d02508219507c5b581cf29c546070265c777266 (patch)
tree90a6d98d10f8b353dd4f83e0a04f641899c90d14
parent86c4845b87499e722a4485a5bb452630abcb7ac7 (diff)
downloadbase-5d02508219507c5b581cf29c546070265c777266.tar.gz
Ensure end action is called if keyguard animation is cancelled
Else, the dozing state may be inaccurate which will cause aod-buggyness Test: manual, builds and transition to AOD still works Bug: 202630143 Change-Id: I57af55792db76552d3f991204b185a9472abea58 Merged-In: I9984863d0acea1265d09dfcfac22d5e78c73a1fe Merged-In: I57af55792db76552d3f991204b185a9472abea58 (cherry picked from commit 0f63fa265b6999b6ffed8ce1c532dc19342dbfb7) (cherry picked from commit 9b971d6e1b4f538342568fb9faf0f89391a8a90f)
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt29
1 files changed, 17 insertions, 12 deletions
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 143aaba648da..e3f4b03dc4f2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt
@@ -145,22 +145,27 @@ class UnlockedScreenOffAnimationController @Inject constructor(
.setDuration(duration.toLong())
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.alpha(1f)
- .withEndAction {
- aodUiAnimationPlaying = false
+ .setListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationEnd(animation: Animator?) {
+ aodUiAnimationPlaying = false
- // Lock the keyguard if it was waiting for the screen off animation to end.
- keyguardViewMediatorLazy.get().maybeHandlePendingLock()
+ // Lock the keyguard if it was waiting for the screen off animation to end.
+ keyguardViewMediatorLazy.get().maybeHandlePendingLock()
- // Tell the StatusBar to become keyguard for real - we waited on that since it
- // is slow and would have caused the animation to jank.
- statusBar.updateIsKeyguard()
+ // Tell the StatusBar to become keyguard for real - we waited on that since
+ // it is slow and would have caused the animation to jank.
+ statusBar.updateIsKeyguard()
- // Run the callback given to us by the KeyguardVisibilityHelper.
- after.run()
+ // Run the callback given to us by the KeyguardVisibilityHelper.
+ after.run()
- // Done going to sleep, reset this flag.
- decidedToAnimateGoingToSleep = null
- }
+ // Done going to sleep, reset this flag.
+ decidedToAnimateGoingToSleep = null
+
+ // We need to unset the listener. These are persistent for future animators
+ keyguardView.animate().setListener(null)
+ }
+ })
.start()
}