Reset the bubble bar scale when the animation is interrupted
Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 381283214
Test: atest BubbleBarViewAnimatorTest
Test: manual
- have a bubble in the bubble bar
- launch an app
- set animator scale to 5x to slow down animation
- send a bubble
- when the bubble bar animates interrupt the animation by
touching the bubble bar
- observe the bubble bar scale is reset correctly
Change-Id: I1abd81e3df987ba749a13eb1b7506d5c1d8fdddd
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
index f5a6655..6f8943f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
@@ -511,23 +511,21 @@
/** Interrupts the animation due to touching the bubble bar or flyout. */
fun interruptForTouch() {
+ animatingBubble?.hideAnimation?.let { scheduler.cancel(it) }
PhysicsAnimator.getInstance(bubbleBarView).cancelIfRunning()
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
cancelFlyout()
- val hideAnimation = animatingBubble?.hideAnimation ?: return
- scheduler.cancel(hideAnimation)
- bubbleBarView.relativePivotY = 1f
+ resetBubbleBarPropertiesOnInterrupt()
clearAnimatingBubble()
}
/** Notifies the animator that the taskbar area was touched during an animation. */
fun onStashStateChangingWhileAnimating() {
+ animatingBubble?.hideAnimation?.let { scheduler.cancel(it) }
cancelFlyout()
- val hideAnimation = animatingBubble?.hideAnimation ?: return
- scheduler.cancel(hideAnimation)
clearAnimatingBubble()
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
- bubbleBarView.relativePivotY = 1f
+ resetBubbleBarPropertiesOnInterrupt()
bubbleStashController.onNewBubbleAnimationInterrupted(
/* isStashed= */ bubbleBarView.alpha == 0f,
bubbleBarView.translationY,
@@ -541,7 +539,7 @@
scheduler.cancel(hideAnimation)
animatingBubble = null
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
- bubbleBarView.relativePivotY = 1f
+ resetBubbleBarPropertiesOnInterrupt()
// stash the bubble bar since the IME is now visible
bubbleStashController.onNewBubbleAnimationInterrupted(
/* isStashed= */ true,
@@ -679,6 +677,12 @@
bubbleStashController.showBubbleBarImmediate()
}
+ private fun resetBubbleBarPropertiesOnInterrupt() {
+ bubbleBarView.relativePivotY = 1f
+ bubbleBarView.scaleX = 1f
+ bubbleBarView.scaleY = 1f
+ }
+
private fun <T> PhysicsAnimator<T>?.cancelIfRunning() {
if (this?.isRunning() == true) cancel()
}
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
index 29d142f..06227e2 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
@@ -197,6 +197,8 @@
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(animatorScheduler.delayedBlock).isNull()
assertThat(bubbleBarView.alpha).isEqualTo(1)
+ assertThat(bubbleBarView.scaleX).isEqualTo(1)
+ assertThat(bubbleBarView.scaleY).isEqualTo(1)
assertThat(bubbleBarView.visibility).isEqualTo(VISIBLE)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isFalse()
@@ -241,6 +243,8 @@
// verify that the hide animation was canceled
assertThat(animatorScheduler.delayedBlock).isNull()
assertThat(animator.isAnimating).isFalse()
+ assertThat(bubbleBarView.scaleX).isEqualTo(1)
+ assertThat(bubbleBarView.scaleY).isEqualTo(1)
verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any())
// PhysicsAnimatorTestUtils posts the cancellation to the main thread so we need to wait