diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 987937e976..5b3c233a8f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -405,8 +405,12 @@ public class BubbleBarController extends IBubblesListener.Stub { mBubbleBarViewController.showOverflow(true); } - // Adds and removals have happened, update visibility before any other visual changes. - mBubbleBarViewController.setHiddenForBubbles(mBubbles.isEmpty()); + // Update the visibility if this is the initial state or if there are no bubbles. + // If this is the initial bubble, the bubble bar will become visible as part of the + // animation. + if (update.initialState || mBubbles.isEmpty()) { + mBubbleBarViewController.setHiddenForBubbles(mBubbles.isEmpty()); + } mBubbleStashedHandleViewController.ifPresent( controller -> controller.setHiddenForBubbles(mBubbles.isEmpty())); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 67d7901cd3..9b8fc18884 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -170,7 +170,8 @@ public class BubbleBarViewController { mBubbleBarContainer, createFlyoutPositioner(), createFlyoutCallbacks()); mBubbleBarViewAnimator = new BubbleBarViewAnimator( mBarView, mBubbleStashController, mBubbleBarFlyoutController, - createBubbleBarParentViewController(), mBubbleBarController::showExpandedView); + createBubbleBarParentViewController(), mBubbleBarController::showExpandedView, + () -> setHiddenForBubbles(false)); mTaskbarViewPropertiesProvider = taskbarViewPropertiesProvider; onBubbleBarConfigurationChanged(/* animate= */ false); mActivity.addOnDeviceProfileChangeListener( 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 f5a6655070..a40013c6c4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt @@ -42,6 +42,7 @@ constructor( private val bubbleBarFlyoutController: BubbleBarFlyoutController, private val bubbleBarParentViewHeightUpdateNotifier: BubbleBarParentViewHeightUpdateNotifier, private val onExpanded: Runnable, + private val onBubbleBarVisible: Runnable, private val scheduler: Scheduler = HandlerScheduler(bubbleBarView), ) { @@ -397,6 +398,7 @@ constructor( // prepare the bubble bar for the animation bubbleBarView.translationY = bubbleBarView.height.toFloat() bubbleBarView.visibility = VISIBLE + onBubbleBarVisible.run() bubbleBarView.alpha = 1f bubbleBarView.scaleX = 1f bubbleBarView.scaleY = 1f 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 29d142f3ec..465aa5d716 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 @@ -23,6 +23,7 @@ import android.graphics.PointF import android.graphics.drawable.ColorDrawable import android.view.LayoutInflater import android.view.View +import android.view.View.INVISIBLE import android.view.View.VISIBLE import android.widget.FrameLayout import android.widget.TextView @@ -78,7 +79,7 @@ class BubbleBarViewAnimatorTest { private lateinit var flyoutContainer: FrameLayout private lateinit var bubbleStashController: BubbleStashController private lateinit var flyoutController: BubbleBarFlyoutController - private val onExpandedNoOp = Runnable {} + private val emptyRunnable = Runnable {} private val flyoutView: View? get() = flyoutContainer.findViewById(R.id.bubble_bar_flyout_view) @@ -106,7 +107,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -162,7 +164,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -217,7 +220,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -264,7 +268,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -316,7 +321,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -355,7 +361,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -401,7 +408,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -453,7 +461,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -504,17 +513,21 @@ class BubbleBarViewAnimatorTest { val barAnimator = PhysicsAnimator.getInstance(bubbleBarView) + var notifiedBubbleBarVisible = false + val onBubbleBarVisible = Runnable { notifiedBubbleBarVisible = true } val animator = BubbleBarViewAnimator( bubbleBarView, bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = onBubbleBarVisible, animatorScheduler, ) InstrumentationRegistry.getInstrumentation().runOnMainSync { + bubbleBarView.visibility = INVISIBLE animator.animateToInitialState(bubble, isInApp = true, isExpanding = false) } @@ -542,6 +555,8 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.alpha).isEqualTo(0) assertThat(handle.translationY).isEqualTo(0) assertThat(handle.alpha).isEqualTo(1) + assertThat(bubbleBarView.visibility).isEqualTo(VISIBLE) + assertThat(notifiedBubbleBarVisible).isTrue() verify(bubbleStashController).stashBubbleBarImmediate() } @@ -567,7 +582,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -603,7 +619,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -649,7 +666,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -699,7 +717,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -747,7 +766,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -803,7 +823,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -858,7 +879,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -923,7 +945,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpanded, + onExpanded = onExpanded, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -983,7 +1006,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -1053,7 +1077,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -1129,7 +1154,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -1216,7 +1242,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, ) @@ -1330,7 +1357,8 @@ class BubbleBarViewAnimatorTest { bubbleStashController, flyoutController, bubbleBarParentViewController, - onExpandedNoOp, + onExpanded = emptyRunnable, + onBubbleBarVisible = emptyRunnable, animatorScheduler, )