From 4ce22b5125d1920715835c420d88f19693bdda65 Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Tue, 14 Jan 2020 15:50:42 -0500 Subject: [PATCH] Cancel flings before restarting them. Test: atest SystemUITests Change-Id: I68ed3beef526d93104bd9da809aa5f49d15a1e91 --- .../com/android/systemui/util/animation/PhysicsAnimator.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/util/animation/PhysicsAnimator.kt b/packages/SystemUI/src/com/android/systemui/util/animation/PhysicsAnimator.kt index 8a1759d4d0cd6..0999c0ba02044 100644 --- a/packages/SystemUI/src/com/android/systemui/util/animation/PhysicsAnimator.kt +++ b/packages/SystemUI/src/com/android/systemui/util/animation/PhysicsAnimator.kt @@ -416,8 +416,10 @@ class PhysicsAnimator private constructor (val target: T) { max = max(currentValue, this.max) } - // Apply the configuration and start the animation. + // Apply the configuration and start the animation. Since flings can't be + // redirected while in motion, cancel it first. getFlingAnimation(animatedProperty) + .also { it.cancel() } .also { flingConfig.applyToAnimation(it) } .start() }