From 6c7cb1a5f005391a3e3cd8fef9e546cf057779e9 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Fri, 25 Apr 2025 16:24:43 -0700 Subject: [PATCH] Do not animate bubbles from initial update [4/N] Bubbles that are restored with initial update should not be animated in. If we restore the bubble bar after rotation, we need to show it immediately. Attempting to animate the bubbles from initial update causes the UI to flicker. Bug: 357115534 Test: on home screen, have bubble bar expanded, rotate device, check bubble bar bubbles do not flicker after rotation Test: have no bubbles in bubble bar, trigger a bubble, check it is animated Flag: com.android.wm.shell.enable_bubble_bar Change-Id: I3da2bc22588c0f5d2dd9c7a3adfcd2c19c339809 --- .../launcher3/taskbar/bubbles/BubbleBarView.java | 9 +++++---- .../taskbar/bubbles/BubbleBarViewController.java | 4 ++-- .../taskbar/bubbles/BubbleBarViewScreenshotTest.kt | 12 ++++++------ .../stashing/TransientBubbleStashControllerTest.kt | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index a572d73f5a..d973432d56 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -715,8 +715,8 @@ public class BubbleBarView extends FrameLayout { } /** Add a new bubble to the bubble bar without updating the selected bubble. */ - public void addBubble(BubbleView bubble) { - addBubble(bubble, /* bubbleToSelect = */ null); + public void addBubble(BubbleView bubble, boolean suppressAnimation) { + addBubble(bubble, /* bubbleToSelect = */ null, suppressAnimation); } /** @@ -725,12 +725,13 @@ public class BubbleBarView extends FrameLayout { * @param bubble bubble to add * @param bubbleToSelect if {@code null}, then selected bubble does not change */ - public void addBubble(BubbleView bubble, @Nullable BubbleView bubbleToSelect) { + public void addBubble(BubbleView bubble, @Nullable BubbleView bubbleToSelect, + boolean suppressAnimation) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams((int) mIconSize, (int) mIconSize, Gravity.LEFT); final int index = bubble.isOverflow() ? getChildCount() : 0; - if (isExpanded()) { + if (isExpanded() && !suppressAnimation) { // if we're expanded scale the new bubble in bubble.setScaleX(0f); bubble.setScaleY(0f); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index e22577d262..6623e0642a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -1110,7 +1110,7 @@ public class BubbleBarViewController { if (mOverflowAdded == showOverflow) return; mOverflowAdded = showOverflow; if (mOverflowAdded) { - mBarView.addBubble(mOverflowBubble.getView()); + mBarView.addBubble(mOverflowBubble.getView(), /* suppressAnimation= */ true); mOverflowBubble.getView().setOnClickListener(mBubbleClickListener); mOverflowBubble.getView().setController(mBubbleViewController); } else { @@ -1157,7 +1157,7 @@ public class BubbleBarViewController { if (b != null) { BubbleView bubbleToSelectView = bubbleToSelect == null ? null : bubbleToSelect.getView(); - mBarView.addBubble(b.getView(), bubbleToSelectView); + mBarView.addBubble(b.getView(), bubbleToSelectView, suppressAnimation); b.getView().setOnClickListener(mBubbleClickListener); mBubbleDragController.setupBubbleView(b.getView()); b.getView().setController(mBubbleViewController); diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt index a206d4e18b..2a391a1833 100644 --- a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt +++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt @@ -70,7 +70,7 @@ class BubbleBarViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { screenshotRule.screenshotTest("bubbleBarView_collapsed_oneBubble") { activity -> activity.actionBar?.hide() setupBubbleBarView() - bubbleBarView.addBubble(createBubble("key1", Color.GREEN)) + bubbleBarView.addBubble(createBubble("key1", Color.GREEN), false) val container = FrameLayout(context) val lp = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) container.layoutParams = lp @@ -84,8 +84,8 @@ class BubbleBarViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { screenshotRule.screenshotTest("bubbleBarView_collapsed_twoBubbles") { activity -> activity.actionBar?.hide() setupBubbleBarView() - bubbleBarView.addBubble(createBubble("key1", Color.GREEN)) - bubbleBarView.addBubble(createBubble("key2", Color.CYAN)) + bubbleBarView.addBubble(createBubble("key1", Color.GREEN), false) + bubbleBarView.addBubble(createBubble("key2", Color.CYAN), false) val container = FrameLayout(context) val lp = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) container.layoutParams = lp @@ -106,9 +106,9 @@ class BubbleBarViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { ) { activity -> activity.actionBar?.hide() setupBubbleBarView() - bubbleBarView.addBubble(createBubble("key1", Color.GREEN)) - bubbleBarView.addBubble(createBubble("key2", Color.CYAN)) - bubbleBarView.addBubble(createBubble("key3", Color.MAGENTA)) + bubbleBarView.addBubble(createBubble("key1", Color.GREEN), false) + bubbleBarView.addBubble(createBubble("key2", Color.CYAN), false) + bubbleBarView.addBubble(createBubble("key3", Color.MAGENTA), false) val container = FrameLayout(context) val lp = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) container.layoutParams = lp 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 c721af0a0f..d2baec12a7 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 @@ -580,7 +580,7 @@ class TransientBubbleStashControllerTest { } ) bubbleView = BubbleView(context) - bubbleBarView.addBubble(bubbleView) + bubbleBarView.addBubble(bubbleView, false) bubbleBarView.layout(0, 0, BUBBLE_BAR_WIDTH, BUBBLE_BAR_HEIGHT) } }