From 4e512f9f98f50fe42f8fcd6b0fbe0b7f8aba2096 Mon Sep 17 00:00:00 2001 From: Michael Mikhail Date: Thu, 6 Oct 2022 18:33:55 +0000 Subject: [PATCH] Fixing animation behavior on UMO snapback If user tries to swipe While the snapback animation is going back, we need to cancel the ongoing animation. Bug: 247810047 Test: Checked the snapback animation and the translation of the UMO while swiping and releasing the UMO to go back. Change-Id: I0d6a70a04aeda29338c28ba37b11450aedc06dec --- .../com/android/systemui/media/MediaCarouselScrollHandler.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt index 5bf05353441fd..a776897b2fd5e 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt @@ -289,7 +289,10 @@ class MediaCarouselScrollHandler( return false } } - if (isUp || motionEvent.action == MotionEvent.ACTION_CANCEL) { + if (motionEvent.action == MotionEvent.ACTION_MOVE) { + // cancel on going animation if there is any. + PhysicsAnimator.getInstance(this).cancel() + } else if (isUp || motionEvent.action == MotionEvent.ACTION_CANCEL) { // It's an up and the fling didn't take it above val relativePos = scrollView.relativeScrollX % playerWidthPlusPadding val scrollXAmount: Int