From b94fce457eb6f7289583cbe39debd7cf4d89ffc7 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Thu, 5 Dec 2024 16:32:01 -0500 Subject: [PATCH] Fix handle color when interrupting the animation Pass the correct stash value to the controller after interrupting an ongoing animation due to stash state changing. We previously incorrectly passed a value that depended on the alpha value of the bubble bar. This allows sampling to happen and for the handle to have the correct color. Flag: com.android.wm.shell.enable_bubble_bar Fixes: 377604151 Test: atest BubbleBarViewAnimatorTest Test: manual 1. Create 1+ bubble 2. Receive new message and see the flyout 3. Open an app immediately (Don't wait until the flyout disappear) Change-Id: I739bcbd8fe4f7e02285244d78d7159c571be1ec2 --- .../taskbar/bubbles/animation/BubbleBarViewAnimator.kt | 2 +- .../taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 3bff58beeb..745c689541 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt @@ -531,7 +531,7 @@ constructor( bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning() resetBubbleBarPropertiesOnInterrupt() bubbleStashController.onNewBubbleAnimationInterrupted( - /* isStashed= */ bubbleBarView.alpha == 0f, + /* isStashed= */ bubbleStashController.isStashed, bubbleBarView.translationY, ) } 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 44070cf35d..5471072872 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 @@ -240,6 +240,7 @@ class BubbleBarViewAnimatorTest { // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() + whenever(bubbleStashController.isStashed).thenReturn(true) InstrumentationRegistry.getInstrumentation().runOnMainSync { animator.onStashStateChangingWhileAnimating() } @@ -249,7 +250,7 @@ class BubbleBarViewAnimatorTest { assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.scaleX).isEqualTo(1) assertThat(bubbleBarView.scaleY).isEqualTo(1) - verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any()) + verify(bubbleStashController).onNewBubbleAnimationInterrupted(eq(true), any()) // PhysicsAnimatorTestUtils posts the cancellation to the main thread so we need to wait // again