Merge "Fix bubble bar flicker in initial animation" into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
index 987937e..5b3c233 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 @@
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 67d7901..9b8fc18 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 @@
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 6f8943f..fdd04eb 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 @@
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 @@
// 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 06227e2..44070cf 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.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 @@
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 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -162,7 +164,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -219,7 +222,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -268,7 +272,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -320,7 +325,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -359,7 +365,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -405,7 +412,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -457,7 +465,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -508,17 +517,21 @@
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)
}
@@ -546,6 +559,8 @@
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()
}
@@ -571,7 +586,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -607,7 +623,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -653,7 +670,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -703,7 +721,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -751,7 +770,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -807,7 +827,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -862,7 +883,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -927,7 +949,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpanded,
+ onExpanded = onExpanded,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -987,7 +1010,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -1057,7 +1081,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -1133,7 +1158,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -1220,7 +1246,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)
@@ -1334,7 +1361,8 @@
bubbleStashController,
flyoutController,
bubbleBarParentViewController,
- onExpandedNoOp,
+ onExpanded = emptyRunnable,
+ onBubbleBarVisible = emptyRunnable,
animatorScheduler,
)