Support optional bubble overflow in bubble bar

This is similar to the animations that add / remove a bubble at the
same time -- the overflow is generally added when a bubble is removed.
The overflow is generally removed when a bubble is added (i.e. user
promotes a bubble out of the overflow).

There are a couple of additional cases:
- when bubbles are first added to the bar -- if there were saved
  bubbles in the overflow, the view should be added
- an app could cancel its bubbles / remove its shortcuts and not have
  any in the stack but could have some in the overflow & it could
  become empty without an addition.

Flag: com.android.wm.shell.enable_optional_bubble_overflow
Flag: com.android.wm.shell.enable_bubble_bar
Test: manual - add bubbles to the bubble bar for first time
             => observe there is no overflow
             - dismiss a bubble
             => observe the overflow is added, tap on it, tap on the
                bubble in it
             => observe that bubble is added & the overflow disappears
             - dismiss all the bubbles
             - add a bubble
             => observe the overflow is there & has the previously
                dismissed bubbles
             - cancel all the bubbles that are in the overflow via
               adb
             => observe the overflow is remvoed
Bug: 334175587
Change-Id: I2b6e855e65520b4b2b1fde7757d46f00a468b4a6
This commit is contained in:
Mady Mellor committed 2024-08-05 12:25:33 -07:00
1 parent d9873c1039
commit 8c629fd8b5
4 files changed
+121 -40

No files matched your search

@@ -74,6 +74,7 @@ public class BubbleView extends ConstraintLayout {
private boolean mOnLeft = false;
private BubbleBarItem mBubble;
private boolean mIsOverflow;
private Bitmap mIcon;
@@ -271,12 +272,18 @@ public class BubbleView extends ConstraintLayout {
*/
public void setOverflow(BubbleBarOverflow overflow, Bitmap bitmap) {
mBubble = overflow;
mIsOverflow = true;
mIcon = bitmap;
updateBubbleIcon();
mAppIcon.setVisibility(GONE); // Overflow doesn't show the app badge
setContentDescription(getResources().getString(R.string.bubble_bar_overflow_description));
}
/** Whether this view represents the overflow button. */
public boolean isOverflow() {
return mIsOverflow;
}
/** Returns the bubble being rendered in this view. */
@Nullable
public BubbleBarItem getBubble() {