Fix bubble bar position on recreate
When device is rotated, taskbar goes through recreate flow.
LauncherTaskbarUIController restores the state for taskbar in-app
display multiprop.
Ensure that bubble bar is positioned within the taskbar bounds.
The multiprop values in LauncherTaskbarUIController for taskbar in-app
display progress can be restored from shared state when the device
rotates. But this means when we receive updates to various indexes, the
progress for that index may not match what is the actual value of the
multiprop. As it relies on the max function.
Make sure we pass along the actual value for in-app display progress
when updating bubble bar and not the value for the index that got
updated.
Also make sure bubble bar translation always updates when updates are
received as this is the only path for bubble bar to receive updates.
Make sure that when we do override bubble bar translation using in-app
display progress, any existing animation for bubble bar translation y is
cancelled. Otherwise the unlock animation was animating the bubble bar
to the incorrect position after unlock.
Bug: 377621110
Flag: com.android.wm.shell.enable_bubble_bar
Test: atest PersistentBubbleStashControllerTest
Test: manual, have bubble bar with 3 button nav, swipe to -1 and rotate
the device, observe that bubble bar is in the correct position
Test: manual, repeat same test with all apps open, observe that bubble
bar has correct position after rotation
Test: manual, with gesture navigation, observe that bubble bar has
correct position on home screen, -1 and all apps after rotation
Change-Id: I66138e003c4b371299e40558fdadc142fbdbbcd5
diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
index b1cb2c6..4a94be7 100644
--- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
@@ -362,20 +362,21 @@
// This method can be called before init() is called.
return;
}
- if (mControllers.uiController.isIconAlignedWithHotseat()
- && !mTaskbarLauncherStateController.isAnimatingToLauncher()) {
- // Only animate the nav buttons while home and not animating home, otherwise let
- // the TaskbarViewController handle it.
- mControllers.navbarButtonsViewController
- .getTaskbarNavButtonTranslationYForInAppDisplay()
- .updateValue(mLauncher.getDeviceProfile().getTaskbarOffsetY()
- * mTaskbarInAppDisplayProgress.value);
- mControllers.navbarButtonsViewController
- .getOnTaskbarBackgroundNavButtonColorOverride().updateValue(progress);
-
+ if (mControllers.uiController.isIconAlignedWithHotseat()) {
+ if (!mTaskbarLauncherStateController.isAnimatingToLauncher()) {
+ // Only animate the nav buttons while home and not animating home, otherwise let
+ // the TaskbarViewController handle it.
+ mControllers.navbarButtonsViewController
+ .getTaskbarNavButtonTranslationYForInAppDisplay()
+ .updateValue(mLauncher.getDeviceProfile().getTaskbarOffsetY()
+ * mTaskbarInAppDisplayProgress.value);
+ mControllers.navbarButtonsViewController
+ .getOnTaskbarBackgroundNavButtonColorOverride().updateValue(progress);
+ }
if (isBubbleBarEnabled()) {
mControllers.bubbleControllers.ifPresent(
- c -> c.bubbleStashController.setInAppDisplayOverrideProgress(progress));
+ c -> c.bubbleStashController.setInAppDisplayOverrideProgress(
+ mTaskbarInAppDisplayProgress.value));
}
}
}
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 9a68335..6632721 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt
@@ -119,7 +119,10 @@
if (field == value) return
field = value
if (launcherState == BubbleLauncherState.HOME) {
- bubbleBarViewController.bubbleBarTranslationY.updateValue(bubbleBarTranslationY)
+ if (bubbleBarTranslationYAnimator.isAnimating) {
+ bubbleBarTranslationYAnimator.cancelAnimation()
+ }
+ bubbleBarTranslationYAnimator.updateValue(bubbleBarTranslationY)
if (value == 0f || value == 1f) {
// Update insets only when we reach the end values
taskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged()
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 e3d41e7..b7ee6c4 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
@@ -284,6 +284,21 @@
}
@Test
+ fun inAppDisplayOverrideProgress_onHome_cancelExistingAnimation() {
+ whenever(bubbleBarViewController.hasBubbles()).thenReturn(false)
+ persistentTaskBarStashController.launcherState = BubbleLauncherState.HOME
+
+ bubbleBarViewController.bubbleBarTranslationY.animateToValue(100f)
+ advanceTimeBy(10)
+ assertThat(bubbleBarViewController.bubbleBarTranslationY.isAnimating).isTrue()
+
+ getInstrumentation().runOnMainSync {
+ persistentTaskBarStashController.inAppDisplayOverrideProgress = 0.5f
+ }
+ assertThat(bubbleBarViewController.bubbleBarTranslationY.isAnimating).isFalse()
+ }
+
+ @Test
fun inAppDisplayProgressUpdate_inApp_noTranslationUpdate() {
whenever(bubbleBarViewController.hasBubbles()).thenReturn(false)
persistentTaskBarStashController.launcherState = BubbleLauncherState.IN_APP