Cancel flings before restarting them.

Test: atest SystemUITests
Change-Id: I68ed3beef526d93104bd9da809aa5f49d15a1e91
This commit is contained in:
Joshua Tsuji
2020-01-14 15:50:42 -05:00
parent aaace7f27c
commit 4ce22b5125

View File

@@ -416,8 +416,10 @@ class PhysicsAnimator<T> 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()
}