Take bubble selection from the shell update.

Prior to this change, the bubble bar controller determined which bubble
to select. With this change, the selection is now determined by the
update received from the shell.

Test: Manual. Tested the add overflow and remove bubble flows, add
bubble and remove overflow flows, and add bubble and remove bubble flows
Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 359952121

Change-Id: I8ec01d6976b1e1cd0129071fd1765041eeb10b83
This commit is contained in:
mpodolian committed 2025-01-09 12:17:47 -08:00
1 parent db7aa238a0
commit f62b45e5f0
4 files changed
+40 -40

No files matched your search

@@ -843,11 +843,12 @@ public class BubbleBarViewController {
}
/** Adds a new bubble and removes an old bubble at the same time. */
public void addBubbleAndRemoveBubble(BubbleBarBubble addedBubble,
BubbleBarBubble removedBubble, boolean isExpanding, boolean suppressAnimation,
boolean addOverflowToo) {
public void addBubbleAndRemoveBubble(BubbleBarBubble addedBubble, BubbleBarBubble removedBubble,
@Nullable BubbleBarBubble bubbleToSelect, boolean isExpanding,
boolean suppressAnimation, boolean addOverflowToo) {
BubbleView bubbleToSelectView = bubbleToSelect == null ? null : bubbleToSelect.getView();
mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), removedBubble.getView(),
addOverflowToo ? () -> showOverflow(true) : null);
bubbleToSelectView, addOverflowToo ? () -> showOverflow(true) : null);
addedBubble.getView().setOnClickListener(mBubbleClickListener);
addedBubble.getView().setController(mBubbleViewController);
removedBubble.getView().setController(null);
@@ -878,22 +879,26 @@ public class BubbleBarViewController {
}
/** Adds the overflow view to the bubble bar while animating a view away. */
public void addOverflowAndRemoveBubble(BubbleBarBubble removedBubble) {
public void addOverflowAndRemoveBubble(BubbleBarBubble removedBubble,
@Nullable BubbleBarBubble bubbleToSelect) {
if (mOverflowAdded) return;
mOverflowAdded = true;
BubbleView bubbleToSelectView = bubbleToSelect == null ? null : bubbleToSelect.getView();
mBarView.addBubbleAndRemoveBubble(mOverflowBubble.getView(), removedBubble.getView(),
null /* onEndRunnable */);
bubbleToSelectView, null /* onEndRunnable */);
mOverflowBubble.getView().setOnClickListener(mBubbleClickListener);
mOverflowBubble.getView().setController(mBubbleViewController);
removedBubble.getView().setController(null);
}
/** Removes the overflow view to the bubble bar while animating a view in. */
public void removeOverflowAndAddBubble(BubbleBarBubble addedBubble) {
public void removeOverflowAndAddBubble(BubbleBarBubble addedBubble,
@Nullable BubbleBarBubble bubbleToSelect) {
if (!mOverflowAdded) return;
mOverflowAdded = false;
BubbleView bubbleToSelectView = bubbleToSelect == null ? null : bubbleToSelect.getView();
mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), mOverflowBubble.getView(),
null /* onEndRunnable */);
bubbleToSelectView, null /* onEndRunnable */);
addedBubble.getView().setOnClickListener(mBubbleClickListener);
addedBubble.getView().setController(mBubbleViewController);
mOverflowBubble.getView().setController(null);