Update setting taskbar window height
Updated the logic to set the taskbar window height to accommodate the
bubble bar with its maximum flyout height before the bubble bar
animation begins. The height is reverted to the default value once the
animation is completed.
Fixes: 378400160
Flag: com.android.wm.shell.enable_bubble_bar
Test: Manual. Set 3-button navigation mode and have the QSB placed
above the hotseat. Send a notification that will display a bubble, and
observe the bubble bar animation and final placement aligned with the
QSB.
Next, set gesture navigation mode and repeat the flow above. Observe
that the bubble bar is aligned with the hotseat icons.
Felix video:
http://recall/-/gx8ASgewUeUS3QYohfrd1J/gYMVt0sH4si0KOpaBxIPem
Tangor video:
http://recall/-/gx8ASgewUeUS3QYohfrd1J/fz95MbjcjW3awStnuOl8BJ
Change-Id: I239f935743c3936fed44822c3c62652073ffefe2
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 2df520a..82c0357 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -1138,6 +1138,10 @@
return getSetupWindowSize();
}
+ int bubbleBarTop = mControllers.bubbleControllers.map(bubbleControllers ->
+ bubbleControllers.bubbleBarViewController.getBubbleBarWithFlyoutMaximumHeight()
+ ).orElse(0);
+ int taskbarWindowSize;
boolean shouldTreatAsTransient = DisplayController.isTransientTaskbar(this)
|| (enableTaskbarPinning() && !isThreeButtonNav());
@@ -1154,16 +1158,18 @@
DeviceProfile transientTaskbarDp = mDeviceProfile.toBuilder(this)
.setIsTransientTaskbar(true).build();
- return transientTaskbarDp.taskbarHeight
+ taskbarWindowSize = transientTaskbarDp.taskbarHeight
+ (2 * transientTaskbarDp.taskbarBottomMargin)
+ Math.max(extraHeightForTaskbarTooltips, resources.getDimensionPixelSize(
R.dimen.transient_taskbar_shadow_blur));
+ return Math.max(taskbarWindowSize, bubbleBarTop);
}
- return mDeviceProfile.taskbarHeight
+ taskbarWindowSize = mDeviceProfile.taskbarHeight
+ getCornerRadius()
+ extraHeightForTaskbarTooltips;
+ return Math.max(taskbarWindowSize, bubbleBarTop);
}
public int getSetupWindowSize() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarParentViewHeightUpdateNotifier.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarParentViewHeightUpdateNotifier.kt
new file mode 100644
index 0000000..f69ad74
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarParentViewHeightUpdateNotifier.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.taskbar.bubbles
+
+/** Controls the parent view height. */
+interface BubbleBarParentViewHeightUpdateNotifier {
+
+ /** Notify parent that top boundary should be updated. */
+ fun updateTopBoundary()
+}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
index 3c146b7..610459a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
@@ -171,7 +171,7 @@
mBubbleBarContainer, createFlyoutPositioner(), createFlyoutCallbacks());
mBubbleBarViewAnimator = new BubbleBarViewAnimator(
mBarView, mBubbleStashController, mBubbleBarFlyoutController,
- mBubbleBarController::showExpandedView);
+ createBubbleBarParentViewController(), mBubbleBarController::showExpandedView);
mTaskbarViewPropertiesProvider = taskbarViewPropertiesProvider;
onBubbleBarConfigurationChanged(/* animate= */ false);
mActivity.addOnDeviceProfileChangeListener(
@@ -319,17 +319,6 @@
private FlyoutCallbacks createFlyoutCallbacks() {
return new FlyoutCallbacks() {
@Override
- public void extendTopBoundary(int space) {
- int defaultSize = mActivity.getDefaultTaskbarWindowSize();
- mActivity.setTaskbarWindowSize(defaultSize + space);
- }
-
- @Override
- public void resetTopBoundary() {
- mActivity.setTaskbarWindowSize(mActivity.getDefaultTaskbarWindowSize());
- }
-
- @Override
public void flyoutClicked() {
interruptAnimationForTouch();
expandBubbleBar();
@@ -337,6 +326,15 @@
};
}
+ private BubbleBarParentViewHeightUpdateNotifier createBubbleBarParentViewController() {
+ return new BubbleBarParentViewHeightUpdateNotifier() {
+ @Override
+ public void updateTopBoundary() {
+ mActivity.setTaskbarWindowSize(mActivity.getDefaultTaskbarWindowSize());
+ }
+ };
+ }
+
private void onBubbleClicked(BubbleView bubbleView) {
if (mBubbleBarPinning.isAnimating()) return;
bubbleView.markSeen();
@@ -585,6 +583,19 @@
return mHiddenForNoBubbles;
}
+ /** Returns maximum height of the bubble bar with the flyout view. */
+ public int getBubbleBarWithFlyoutMaximumHeight() {
+ if (!isBubbleBarVisible()) return 0;
+ int bubbleBarTopOnHome = (int) (mBubbleStashController.getBubbleBarVerticalCenterForHome()
+ + mBarView.getBubbleBarCollapsedHeight() / 2);
+ int result = (int) (bubbleBarTopOnHome + mBarView.getArrowHeight());
+ if (isAnimatingNewBubble()) {
+ // when animating new bubble add the maximum height of the flyout view
+ result += mBubbleBarFlyoutController.getMaximumFlyoutHeight();
+ }
+ return result;
+ }
+
/**
* Sets whether the bubble bar should be hidden because there are no bubbles.
*/
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 447dad1..f5a6655 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
@@ -25,6 +25,7 @@
import androidx.dynamicanimation.animation.SpringForce
import com.android.launcher3.R
import com.android.launcher3.taskbar.bubbles.BubbleBarBubble
+import com.android.launcher3.taskbar.bubbles.BubbleBarParentViewHeightUpdateNotifier
import com.android.launcher3.taskbar.bubbles.BubbleBarView
import com.android.launcher3.taskbar.bubbles.BubbleView
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController
@@ -39,6 +40,7 @@
private val bubbleBarView: BubbleBarView,
private val bubbleStashController: BubbleStashController,
private val bubbleBarFlyoutController: BubbleBarFlyoutController,
+ private val bubbleBarParentViewHeightUpdateNotifier: BubbleBarParentViewHeightUpdateNotifier,
private val onExpanded: Runnable,
private val scheduler: Scheduler = HandlerScheduler(bubbleBarView),
) {
@@ -342,7 +344,7 @@
scheduler.post(buildHandleToBubbleBarAnimation(initialVelocity = finalVelocity))
return@addEndListener
}
- animatingBubble = null
+ clearAnimatingBubble()
if (!canceled) bubbleStashController.stashBubbleBarImmediate()
bubbleBarView.relativePivotY = 1f
bubbleBarView.scaleY = 1f
@@ -378,7 +380,7 @@
moveToState(AnimatingBubble.State.ANIMATING_OUT)
bubbleBarFlyoutController.collapseFlyout {
onFlyoutRemoved()
- animatingBubble = null
+ clearAnimatingBubble()
}
bubbleStashController.showBubbleBarImmediate()
bubbleStashController.updateTaskbarTouchRegion()
@@ -437,7 +439,7 @@
moveToState(AnimatingBubble.State.ANIMATING_OUT)
bubbleBarFlyoutController.collapseFlyout {
onFlyoutRemoved()
- animatingBubble = null
+ clearAnimatingBubble()
}
bubbleStashController.showBubbleBarImmediate()
bubbleStashController.updateTaskbarTouchRegion()
@@ -515,7 +517,7 @@
val hideAnimation = animatingBubble?.hideAnimation ?: return
scheduler.cancel(hideAnimation)
bubbleBarView.relativePivotY = 1f
- animatingBubble = null
+ clearAnimatingBubble()
}
/** Notifies the animator that the taskbar area was touched during an animation. */
@@ -523,7 +525,7 @@
cancelFlyout()
val hideAnimation = animatingBubble?.hideAnimation ?: return
scheduler.cancel(hideAnimation)
- animatingBubble = null
+ clearAnimatingBubble()
bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
bubbleBarView.relativePivotY = 1f
bubbleStashController.onNewBubbleAnimationInterrupted(
@@ -672,7 +674,7 @@
private fun cancelHideAnimation() {
val hideAnimation = animatingBubble?.hideAnimation ?: return
scheduler.cancel(hideAnimation)
- animatingBubble = null
+ clearAnimatingBubble()
bubbleBarView.relativePivotY = 1f
bubbleStashController.showBubbleBarImmediate()
}
@@ -700,6 +702,14 @@
private fun moveToState(state: AnimatingBubble.State) {
val animatingBubble = this.animatingBubble ?: return
this.animatingBubble = animatingBubble.copy(state = state)
+ if (state == AnimatingBubble.State.ANIMATING_IN) {
+ bubbleBarParentViewHeightUpdateNotifier.updateTopBoundary()
+ }
+ }
+
+ private fun clearAnimatingBubble() {
+ animatingBubble = null
+ bubbleBarParentViewHeightUpdateNotifier.updateTopBoundary()
}
private fun expandBubbleBar() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt
index 908e97c..63db012 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt
@@ -35,6 +35,8 @@
private val flyoutScheduler: FlyoutScheduler = HandlerScheduler(container),
) {
+ val maximumFlyoutHeight: Int = BubbleBarFlyoutView.getMaximumViewHeight(container.context)
+
private companion object {
const val EXPAND_ANIMATION_DURATION_MS = 400L
const val COLLAPSE_ANIMATION_DURATION_MS = 350L
@@ -61,6 +63,8 @@
return rect
}
+ fun getFlyoutMaxHeight(): Int = BubbleBarFlyoutView.getMaximumViewHeight(container.context)
+
fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onInit: () -> Unit, onEnd: () -> Unit) {
flyout?.let(container::removeView)
val flyout = BubbleBarFlyoutView(container.context, positioner, flyoutScheduler)
@@ -102,11 +106,10 @@
}
}
animator.addListener(
- onStart = { extendTopBoundary() },
onEnd = {
endAction()
flyout.setOnClickListener { callbacks.flyoutClicked() }
- },
+ }
)
animator.start()
}
@@ -114,14 +117,13 @@
fun updateFlyoutFullyExpanded(message: BubbleBarFlyoutMessage, onEnd: () -> Unit) {
val flyout = flyout ?: return
hideFlyout(AnimationType.FADE) {
- callbacks.resetTopBoundary()
flyout.updateData(message) { showFlyout(AnimationType.FADE, onEnd) }
}
}
fun updateFlyoutWhileExpanding(message: BubbleBarFlyoutMessage) {
val flyout = flyout ?: return
- flyout.updateData(message) { extendTopBoundary() }
+ flyout.updateData(message) {}
}
fun updateFlyoutWhileCollapsing(message: BubbleBarFlyoutMessage, onEnd: () -> Unit) {
@@ -131,14 +133,6 @@
flyout.updateData(message) { showFlyout(AnimationType.MORPH, onEnd) }
}
- private fun extendTopBoundary() {
- val flyout = flyout ?: return
- val flyoutTop = flyout.top + flyout.translationY
- // If the top position of the flyout is negative, then it's bleeding over the
- // top boundary of its parent view
- if (flyoutTop < 0) callbacks.extendTopBoundary(space = -flyoutTop.toInt())
- }
-
fun cancelFlyout(endAction: () -> Unit) {
hideFlyout(AnimationType.FADE) {
cleanupFlyoutView()
@@ -184,7 +178,6 @@
private fun cleanupFlyoutView() {
container.removeView(flyout)
this@BubbleBarFlyoutController.flyout = null
- callbacks.resetTopBoundary()
}
fun hasFlyout() = flyout != null
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
index f9f5a15..71e95c7 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
@@ -18,6 +18,7 @@
import android.content.Context
import android.content.res.Configuration
+import android.content.res.Resources
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Outline
@@ -44,11 +45,27 @@
scheduler: FlyoutScheduler? = null,
) : ConstraintLayout(context) {
- private companion object {
- // the minimum progress of the expansion animation before the content starts fading in.
- const val MIN_EXPANSION_PROGRESS_FOR_CONTENT_ALPHA = 0.75f
+ companion object {
// the rate multiple for the background color animation relative to the morph animation.
const val BACKGROUND_COLOR_CHANGE_RATE = 5
+ // the minimum progress of the expansion animation before the content starts fading in.
+ private const val MIN_EXPANSION_PROGRESS_FOR_CONTENT_ALPHA = 0.75f
+
+ private const val TEXT_ROW_HEIGHT_SP = 20
+ private const val MAX_ROWS_COUNT = 3
+
+ /** Returns the maximum possible height of the flyout view. */
+ fun getMaximumViewHeight(context: Context): Int {
+ val verticalPaddings = getFlyoutPadding(context) * 2
+ val textSizeSp = TEXT_ROW_HEIGHT_SP * MAX_ROWS_COUNT
+ val textSizePx = textSizeSp * Resources.getSystem().displayMetrics.scaledDensity
+ val triangleHeight =
+ context.resources.getDimensionPixelSize(R.dimen.bubblebar_flyout_triangle_height)
+ return verticalPaddings + textSizePx.toInt() + triangleHeight
+ }
+
+ private fun getFlyoutPadding(context: Context) =
+ context.resources.getDimensionPixelSize(R.dimen.bubblebar_flyout_padding)
}
private val scheduler: FlyoutScheduler = scheduler ?: HandlerScheduler(this)
@@ -61,10 +78,7 @@
private val message: TextView by
lazy(LazyThreadSafetyMode.NONE) { findViewById(R.id.bubble_flyout_text) }
- private val flyoutPadding by
- lazy(LazyThreadSafetyMode.NONE) {
- context.resources.getDimensionPixelSize(R.dimen.bubblebar_flyout_padding)
- }
+ private val flyoutPadding by lazy(LazyThreadSafetyMode.NONE) { getFlyoutPadding(context) }
private val triangleHeight by
lazy(LazyThreadSafetyMode.NONE) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/FlyoutCallbacks.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/FlyoutCallbacks.kt
index e2f010a..0804a62 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/FlyoutCallbacks.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/FlyoutCallbacks.kt
@@ -18,11 +18,6 @@
/** Callbacks that the flyout uses to notify of events. */
interface FlyoutCallbacks {
- /** Requests to extend the top boundary of the parent to fully include the flyout. */
- fun extendTopBoundary(space: Int)
-
- /** Resets the top boundary of the parent. */
- fun resetTopBoundary()
/** The flyout was clicked. */
fun flyoutClicked()
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt
index b91718e..b8bcf00 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt
@@ -74,6 +74,9 @@
val isBubblesShowingOnOverview: Boolean
get() = launcherState == BubbleLauncherState.OVERVIEW
+ /** Bubble bar vertical center for launcher home. */
+ var bubbleBarVerticalCenterForHome: Int
+
/** Updated when sysui locked state changes, when locked, bubble bar is not shown. */
var isSysuiLocked: Boolean
@@ -121,9 +124,6 @@
/** Set a bubble bar location */
fun setBubbleBarLocation(bubbleBarLocation: BubbleBarLocation)
- /** Set the bubble bar vertical center for launcher home. */
- fun setBubbleBarVerticalCenterForHome(verticalCenter: Int)
-
/**
* Stashes the bubble bar (transform to the handle view), or just shrink width of the expanded
* bubble bar based on the controller implementation.
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt
index 31f17c4..9f89305 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt
@@ -47,7 +47,7 @@
private lateinit var bubbleBarAlphaAnimator: MultiPropertyFactory<View>.MultiProperty
private lateinit var bubbleBarScaleAnimator: AnimatedFloat
private lateinit var controllersAfterInitAction: ControllersAfterInitAction
- private var verticalCenterForHome: Int = 0
+ override var bubbleBarVerticalCenterForHome: Int = 0
override var launcherState: BubbleLauncherState = BubbleLauncherState.IN_APP
set(state) {
@@ -97,7 +97,7 @@
override val bubbleBarTranslationYForHotseat: Float
get() {
val bubbleBarHeight = bubbleBarViewController.bubbleBarCollapsedHeight
- return -verticalCenterForHome + bubbleBarHeight / 2
+ return -bubbleBarVerticalCenterForHome + bubbleBarHeight / 2
}
override val bubbleBarTranslationY: Float
@@ -159,10 +159,6 @@
animatorSet.setDuration(BAR_STASH_DURATION).start()
}
- override fun setBubbleBarVerticalCenterForHome(verticalCenter: Int) {
- verticalCenterForHome = verticalCenter
- }
-
override fun showBubbleBarImmediate() = showBubbleBarImmediate(bubbleBarTranslationY)
override fun showBubbleBarImmediate(bubbleBarTranslationY: Float) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt
index cb7fefc..688b2c9 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt
@@ -78,7 +78,7 @@
context.resources.getDimensionPixelSize(R.dimen.bubblebar_stashed_size) / 2f
private var animator: AnimatorSet? = null
- private var verticalCenterForHome: Int = 0
+ override var bubbleBarVerticalCenterForHome: Int = 0
override var isStashed: Boolean = false
@VisibleForTesting set
@@ -124,7 +124,7 @@
override val bubbleBarTranslationYForHotseat: Float
get() {
val bubbleBarHeight = bubbleBarViewController.bubbleBarCollapsedHeight
- return -verticalCenterForHome + bubbleBarHeight / 2
+ return -bubbleBarVerticalCenterForHome + bubbleBarHeight / 2
}
override val bubbleBarTranslationYForTaskbar: Float =
@@ -182,10 +182,6 @@
.start()
}
- override fun setBubbleBarVerticalCenterForHome(verticalCenter: Int) {
- verticalCenterForHome = verticalCenter
- }
-
override fun showBubbleBarImmediate() {
showBubbleBarImmediate(bubbleBarTranslationY)
}
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 e12876f..fa9c556 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
@@ -36,6 +36,7 @@
import com.android.launcher3.R
import com.android.launcher3.taskbar.bubbles.BubbleBarBubble
import com.android.launcher3.taskbar.bubbles.BubbleBarOverflow
+import com.android.launcher3.taskbar.bubbles.BubbleBarParentViewHeightUpdateNotifier
import com.android.launcher3.taskbar.bubbles.BubbleBarView
import com.android.launcher3.taskbar.bubbles.BubbleView
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController
@@ -69,6 +70,7 @@
private val context = ApplicationProvider.getApplicationContext<Context>()
private lateinit var animatorScheduler: TestBubbleBarViewAnimatorScheduler
+ private lateinit var bubbleBarParentViewController: TestBubbleBarParentViewHeightUpdateNotifier
private lateinit var overflowView: BubbleView
private lateinit var bubbleView: BubbleView
private lateinit var bubble: BubbleBarBubble
@@ -84,6 +86,7 @@
@Before
fun setUp() {
animatorScheduler = TestBubbleBarViewAnimatorScheduler()
+ bubbleBarParentViewController = TestBubbleBarParentViewHeightUpdateNotifier()
PhysicsAnimatorTestUtils.prepareForTest()
setupFlyoutController()
}
@@ -102,6 +105,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -122,7 +126,7 @@
assertThat(bubbleBarView.scaleY).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isTrue()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
// execute the hide bubble animation
@@ -135,6 +139,7 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(handle.alpha).isEqualTo(1)
assertThat(handle.translationY).isEqualTo(0)
assertThat(bubbleBarView.alpha).isEqualTo(0)
@@ -156,6 +161,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -178,7 +184,7 @@
assertThat(animator.isAnimating).isTrue()
verify(bubbleStashController, atLeastOnce()).updateTaskbarTouchRegion()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
// verify the hide bubble animation is pending
@@ -188,6 +194,7 @@
waitForFlyoutToHide()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(animatorScheduler.delayedBlock).isNull()
assertThat(bubbleBarView.alpha).isEqualTo(1)
assertThat(bubbleBarView.visibility).isEqualTo(VISIBLE)
@@ -209,6 +216,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -255,6 +263,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -266,7 +275,7 @@
// let the animation start and wait for it to complete
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
// execute the hide bubble animation
@@ -282,7 +291,7 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.onStashStateChangingWhileAnimating()
}
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(animator.isAnimating).isFalse()
verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any())
@@ -306,6 +315,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -344,6 +354,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -389,6 +400,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -440,6 +452,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -454,7 +467,7 @@
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
assertThat(animator.isAnimating).isTrue()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
// verify the hide bubble animation is pending
@@ -469,6 +482,7 @@
waitForFlyoutToHide()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(handle.alpha).isEqualTo(0)
assertThat(handle.translationY)
.isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR)
@@ -495,6 +509,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -510,7 +525,7 @@
assertThat(animator.isAnimating).isTrue()
assertThat(bubbleBarView.alpha).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(animatorScheduler.delayedBlock).isNotNull()
@@ -522,6 +537,7 @@
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(animator.isAnimating).isFalse()
assertThat(bubbleBarView.alpha).isEqualTo(0)
assertThat(handle.translationY).isEqualTo(0)
@@ -550,6 +566,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -585,6 +602,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -600,7 +618,7 @@
assertThat(animator.isAnimating).isTrue()
assertThat(bubbleBarView.alpha).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(animatorScheduler.delayedBlock).isNotNull()
@@ -608,6 +626,7 @@
waitForFlyoutToHide()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(animator.isAnimating).isFalse()
assertThat(bubbleBarView.alpha).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
@@ -629,6 +648,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -678,6 +698,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -689,7 +710,7 @@
// wait for the animation to start
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(animator.isAnimating).isTrue()
@@ -704,6 +725,7 @@
// verify that the hide animation was canceled
assertThat(animatorScheduler.delayedBlock).isNull()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT)
assertThat(animator.isAnimating).isFalse()
@@ -724,6 +746,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -745,7 +768,7 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
barAnimator.assertIsRunning()
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(animatorScheduler.delayedBlock).isNotNull()
@@ -754,6 +777,7 @@
waitForFlyoutToHide()
assertThat(animator.isAnimating).isFalse()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
// the bubble bar translation y should be back to its initial value
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
@@ -778,6 +802,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -830,6 +855,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -893,6 +919,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpanded,
animatorScheduler,
)
@@ -918,7 +945,7 @@
// verify there is a pending hide animation
assertThat(animatorScheduler.delayedBlock).isNotNull()
assertThat(animator.isAnimating).isTrue()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
InstrumentationRegistry.getInstrumentation().runOnMainSync {
@@ -930,6 +957,7 @@
waitForFlyoutToHide()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(animator.isAnimating).isFalse()
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
assertThat(bubbleBarView.isExpanded).isTrue()
@@ -951,6 +979,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -983,7 +1012,7 @@
assertThat(bubbleBarView.scaleY).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isTrue()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
.isEqualTo("updated message")
@@ -998,6 +1027,7 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(handle.alpha).isEqualTo(1)
assertThat(handle.translationY).isEqualTo(0)
assertThat(bubbleBarView.alpha).isEqualTo(0)
@@ -1019,6 +1049,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -1039,7 +1070,7 @@
assertThat(bubbleBarView.scaleY).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isTrue()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
@@ -1072,6 +1103,7 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(handle.alpha).isEqualTo(1)
assertThat(handle.translationY).isEqualTo(0)
assertThat(bubbleBarView.alpha).isEqualTo(0)
@@ -1093,6 +1125,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -1113,7 +1146,7 @@
assertThat(bubbleBarView.scaleY).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isTrue()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
@@ -1134,6 +1167,7 @@
// the flyout should now reverse and expand
animatorTestRule.advanceTimeBy(400)
}
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
.isEqualTo("updated message")
@@ -1156,6 +1190,7 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(3)
assertThat(handle.alpha).isEqualTo(1)
assertThat(handle.translationY).isEqualTo(0)
assertThat(bubbleBarView.alpha).isEqualTo(0)
@@ -1177,6 +1212,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -1197,7 +1233,7 @@
assertThat(bubbleBarView.scaleY).isEqualTo(1)
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isTrue()
-
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
waitForFlyoutToShow()
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
@@ -1213,7 +1249,6 @@
PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) {
bubbleBarView.alpha < 0.5
}
-
// we're about to interrupt the animation which will cancel the current animation and start
// a new one. pause the scheduler to delay starting the new animation. this allows us to run
// the test deterministically
@@ -1226,9 +1261,11 @@
animator.animateBubbleInForStashed(updatedBubble, isExpanding = false)
}
+ // since animation was interrupted there shouldn`t be additional calls to adjust window
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
+
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
-
// verify there's a new job scheduled and start it. this is starting the animation from the
// handle back to the bar
assertThat(animatorScheduler.pausedBlock).isNotNull()
@@ -1237,9 +1274,9 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
-
waitForFlyoutToShow()
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
.isEqualTo("updated message")
assertThat(handle.alpha).isEqualTo(0)
@@ -1255,7 +1292,6 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync(animatorScheduler.delayedBlock!!)
waitForFlyoutToHide()
-
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
// verify the hide animation was rescheduled and run it
@@ -1268,6 +1304,7 @@
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
+ assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(3)
assertThat(handle.alpha).isEqualTo(1)
assertThat(handle.translationY).isEqualTo(0)
assertThat(bubbleBarView.alpha).isEqualTo(0)
@@ -1289,6 +1326,7 @@
bubbleBarView,
bubbleStashController,
flyoutController,
+ bubbleBarParentViewController,
onExpandedNoOp,
animatorScheduler,
)
@@ -1389,10 +1427,6 @@
}
val flyoutCallbacks =
object : FlyoutCallbacks {
- override fun extendTopBoundary(space: Int) {}
-
- override fun resetTopBoundary() {}
-
override fun flyoutClicked() {}
}
val flyoutScheduler = FlyoutScheduler { block -> block.invoke() }
@@ -1475,6 +1509,16 @@
delayedBlock = null
}
}
+
+ private class TestBubbleBarParentViewHeightUpdateNotifier :
+ BubbleBarParentViewHeightUpdateNotifier {
+
+ var timesInvoked: Int = 0
+
+ override fun updateTopBoundary() {
+ timesInvoked++
+ }
+ }
}
private const val DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS = -20f
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
index 103c769..91fe6a6 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
@@ -128,46 +128,6 @@
}
@Test
- fun showFlyout_extendsTopBoundary() {
- // set negative translation for the flyout so that it will request to extend the top
- // boundary
- flyoutTy = -50f
- InstrumentationRegistry.getInstrumentation().runOnMainSync {
- setupAndShowFlyout()
- assertThat(flyoutContainer.childCount).isEqualTo(1)
- }
- InstrumentationRegistry.getInstrumentation().waitForIdleSync()
- InstrumentationRegistry.getInstrumentation().runOnMainSync {
- animatorTestRule.advanceTimeBy(showAnimationDuration)
- }
- assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
- }
-
- @Test
- fun showFlyout_withinBoundary() {
- InstrumentationRegistry.getInstrumentation().runOnMainSync {
- setupAndShowFlyout()
- assertThat(flyoutContainer.childCount).isEqualTo(1)
- }
- InstrumentationRegistry.getInstrumentation().waitForIdleSync()
- InstrumentationRegistry.getInstrumentation().runOnMainSync {
- animatorTestRule.advanceTimeBy(showAnimationDuration)
- }
- assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(0)
- }
-
- @Test
- fun collapseFlyout_resetsTopBoundary() {
- InstrumentationRegistry.getInstrumentation().runOnMainSync {
- setupAndShowFlyout()
- assertThat(flyoutContainer.childCount).isEqualTo(1)
- flyoutController.collapseFlyout {}
- animatorTestRule.advanceTimeBy(hideAnimationDuration)
- }
- assertThat(flyoutCallbacks.topBoundaryReset).isTrue()
- }
-
- @Test
fun cancelFlyout_fadesOutFlyout() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
setupAndShowFlyout()
@@ -178,7 +138,6 @@
animatorTestRule.advanceTimeBy(hideAnimationDuration)
assertThat(flyoutView.alpha).isEqualTo(0f)
}
- assertThat(flyoutCallbacks.topBoundaryReset).isTrue()
}
@Test
@@ -217,7 +176,6 @@
assertThat(flyout.findViewById<TextView>(R.id.bubble_flyout_text).text)
.isEqualTo("new message")
}
- assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
}
@Test
@@ -246,7 +204,6 @@
animatorTestRule.advanceTimeBy(showAnimationDuration)
assertThat(flyout.alpha).isEqualTo(1)
}
- assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
}
@Test
@@ -290,18 +247,8 @@
class FakeFlyoutCallbacks : FlyoutCallbacks {
- var topBoundaryExtendedSpace = 0
- var topBoundaryReset = false
var flyoutClicked = false
- override fun extendTopBoundary(space: Int) {
- topBoundaryExtendedSpace = space
- }
-
- override fun resetTopBoundary() {
- topBoundaryReset = true
- }
-
override fun flyoutClicked() {
flyoutClicked = true
}
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt
index 4b9c721..fdf8615 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt
@@ -76,7 +76,7 @@
PersistentBubbleStashController(DefaultDimensionsProvider())
setUpBubbleBarView()
setUpBubbleBarController()
- persistentTaskBarStashController.setBubbleBarVerticalCenterForHome(HOTSEAT_VERTICAL_CENTER)
+ persistentTaskBarStashController.bubbleBarVerticalCenterForHome = HOTSEAT_VERTICAL_CENTER
persistentTaskBarStashController.init(
taskbarInsetsController,
bubbleBarViewController,
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt
index 5a64b68..25763d5 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt
@@ -109,7 +109,7 @@
setUpStashedHandleView()
setUpBubbleStashedHandleViewController()
PhysicsAnimatorTestUtils.prepareForTest()
- mTransientBubbleStashController.setBubbleBarVerticalCenterForHome(HOTSEAT_VERTICAL_CENTER)
+ mTransientBubbleStashController.bubbleBarVerticalCenterForHome = HOTSEAT_VERTICAL_CENTER
mTransientBubbleStashController.init(
taskbarInsetsController,
bubbleBarViewController,