From c21852a186358f5f028988cfaee6334893f28624 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Fri, 5 Apr 2024 14:09:32 -0400 Subject: [PATCH 1/2] Suppress animation for bubbles that auto expand Check whether the state update indicates that the bubble bar is expanding, and pass that to the bubblebarviewcontroller so that we can suppress the new bubble animation if we're expanding from stashed. Note that in some cases the notification service may not include the auto expand flag on the message it sends to sysui, so launcher will end up getting 2 separate messages. We may need to handle that separately. Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT Bug: 280605846 Test: manual - create bubble that auto expands - observe that the bubble does not animate - note that in some cases the notification service may not include the auto expand flag, will look into that separately. Change-Id: Id7e2db5fd32d391413c57d83effb4b23b1085125 --- .../launcher3/taskbar/bubbles/BubbleBarController.java | 7 ++++--- .../launcher3/taskbar/bubbles/BubbleBarViewController.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 1f3c4839ab..77b3f9a29e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -237,7 +237,7 @@ public class BubbleBarController extends IBubblesListener.Stub { // we're on the main executor now, so check that the overflow hasn't been created // again to avoid races. if (mOverflowBubble == null) { - mBubbleBarViewController.addBubble(overflow); + mBubbleBarViewController.addBubble(overflow, /* isExpanding= */ false); mOverflowBubble = overflow; } }); @@ -306,6 +306,7 @@ public class BubbleBarController extends IBubblesListener.Stub { private void applyViewChanges(BubbleBarViewUpdate update) { final boolean isCollapsed = (update.expandedChanged && !update.expanded) || (!update.expandedChanged && !mBubbleBarViewController.isExpanded()); + final boolean isExpanding = update.expandedChanged && update.expanded; BubbleBarItem previouslySelectedBubble = mSelectedBubble; BubbleBarBubble bubbleToSelect = null; if (!update.removedBubbles.isEmpty()) { @@ -322,7 +323,7 @@ public class BubbleBarController extends IBubblesListener.Stub { } if (update.addedBubble != null) { mBubbles.put(update.addedBubble.getKey(), update.addedBubble); - mBubbleBarViewController.addBubble(update.addedBubble); + mBubbleBarViewController.addBubble(update.addedBubble, isExpanding); if (isCollapsed) { // If we're collapsed, the most recently added bubble will be selected. bubbleToSelect = update.addedBubble; @@ -335,7 +336,7 @@ public class BubbleBarController extends IBubblesListener.Stub { BubbleBarBubble bubble = update.currentBubbles.get(i); if (bubble != null) { mBubbles.put(bubble.getKey(), bubble); - mBubbleBarViewController.addBubble(bubble); + mBubbleBarViewController.addBubble(bubble, isExpanding); if (isCollapsed) { // If we're collapsed, the most recently added bubble will be selected. bubbleToSelect = bubble; diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 96d91eae49..e2c1dc450d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -315,7 +315,7 @@ public class BubbleBarViewController { /** * Adds the provided bubble to the bubble bar. */ - public void addBubble(BubbleBarItem b) { + public void addBubble(BubbleBarItem b, boolean isExpanding) { if (b != null) { mBarView.addView(b.getView(), 0, new FrameLayout.LayoutParams(mIconSize, mIconSize, Gravity.LEFT)); @@ -324,7 +324,8 @@ public class BubbleBarViewController { boolean isStashedOrGone = mBubbleStashController.isStashed() || mBarView.getVisibility() != VISIBLE; - if (b instanceof BubbleBarBubble && isStashedOrGone) { + // don't animate the new bubble if we're auto expanding from stashed + if (b instanceof BubbleBarBubble && isStashedOrGone && !isExpanding) { mBubbleBarViewAnimator.animateBubbleInForStashed((BubbleBarBubble) b); } } else { From 0701ab166df1fed6cbe973284257e7ae85f1812c Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Fri, 5 Apr 2024 20:15:52 -0400 Subject: [PATCH 2/2] Don't animate bubbles in the initial state update When launcher receives the initial bubble state update from sysui, don't animate the bubbles. The initial update is sent when bubble bar is created and not when new bubbles are created. Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT Bug: 280605846 Test: manual Change-Id: I74b09220be22d7382fa6d7c1351d5e60a799a054 --- .../launcher3/taskbar/bubbles/BubbleBarController.java | 10 +++++++--- .../taskbar/bubbles/BubbleBarViewController.java | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 77b3f9a29e..6e8b0de58b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -237,7 +237,8 @@ public class BubbleBarController extends IBubblesListener.Stub { // we're on the main executor now, so check that the overflow hasn't been created // again to avoid races. if (mOverflowBubble == null) { - mBubbleBarViewController.addBubble(overflow, /* isExpanding= */ false); + mBubbleBarViewController.addBubble( + overflow, /* isExpanding= */ false, /* suppressAnimation= */ true); mOverflowBubble = overflow; } }); @@ -307,6 +308,9 @@ public class BubbleBarController extends IBubblesListener.Stub { final boolean isCollapsed = (update.expandedChanged && !update.expanded) || (!update.expandedChanged && !mBubbleBarViewController.isExpanded()); final boolean isExpanding = update.expandedChanged && update.expanded; + // don't animate bubbles if this is the initial state because we may be unfolding or + // enabling gesture nav + final boolean suppressAnimation = update.initialState; BubbleBarItem previouslySelectedBubble = mSelectedBubble; BubbleBarBubble bubbleToSelect = null; if (!update.removedBubbles.isEmpty()) { @@ -323,7 +327,7 @@ public class BubbleBarController extends IBubblesListener.Stub { } if (update.addedBubble != null) { mBubbles.put(update.addedBubble.getKey(), update.addedBubble); - mBubbleBarViewController.addBubble(update.addedBubble, isExpanding); + mBubbleBarViewController.addBubble(update.addedBubble, isExpanding, suppressAnimation); if (isCollapsed) { // If we're collapsed, the most recently added bubble will be selected. bubbleToSelect = update.addedBubble; @@ -336,7 +340,7 @@ public class BubbleBarController extends IBubblesListener.Stub { BubbleBarBubble bubble = update.currentBubbles.get(i); if (bubble != null) { mBubbles.put(bubble.getKey(), bubble); - mBubbleBarViewController.addBubble(bubble, isExpanding); + mBubbleBarViewController.addBubble(bubble, isExpanding, suppressAnimation); if (isCollapsed) { // If we're collapsed, the most recently added bubble will be selected. bubbleToSelect = bubble; diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index e2c1dc450d..256e2f08eb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -315,13 +315,17 @@ public class BubbleBarViewController { /** * Adds the provided bubble to the bubble bar. */ - public void addBubble(BubbleBarItem b, boolean isExpanding) { + public void addBubble(BubbleBarItem b, boolean isExpanding, boolean suppressAnimation) { if (b != null) { mBarView.addView(b.getView(), 0, new FrameLayout.LayoutParams(mIconSize, mIconSize, Gravity.LEFT)); b.getView().setOnClickListener(mBubbleClickListener); mBubbleDragController.setupBubbleView(b.getView()); + if (suppressAnimation) { + return; + } + boolean isStashedOrGone = mBubbleStashController.isStashed() || mBarView.getVisibility() != VISIBLE; // don't animate the new bubble if we're auto expanding from stashed