Tell WMShell when bubble bar is active or not active

Use new Bubbles aidl method to tell WMShell when bubble bar is used or
not used.
Allows to better handle cases where taskbar (and bubble bar) get
recreated during rotation.

Bug: 357115534
Test: open an app, expand bubble bar, rotate device, check bubble
  remains expanded
Flag: com.android.wm.shell.enable_bubble_bar
Change-Id: I1c77eecb2b574b3d9b33aadafd1585e1aca26bdb
This commit is contained in:
Ats Jenk
2025-03-28 13:30:43 -07:00
parent 8184e7116d
commit 96e3fd6713
3 changed files with 14 additions and 5 deletions
@@ -785,8 +785,9 @@ public class TaskbarManagerImpl implements DisplayDecorationListener {
+ " dp.isTaskbarPresent=" + (dp == null ? "null" : dp.isTaskbarPresent)
+ " displayExists=" + displayExists, displayId);
if (!isTaskbarEnabled || !isLargeScreenTaskbar || !displayExists) {
SystemUiProxy.INSTANCE.get(mBaseContext)
.notifyTaskbarStatus(/* visible */ false, /* stashed */ false);
SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(mBaseContext);
systemUiProxy.notifyTaskbarStatus(/* visible */ false, /* stashed */ false);
systemUiProxy.setHasBubbleBar(false);
if (!isTaskbarEnabled || !displayExists) {
debugTaskbarManager(
"recreateTaskbarForDisplay: exiting bc (!isTaskbarEnabled || "
@@ -221,6 +221,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
mBubbleBarViewController.getBubbleBarLocation());
if (sBubbleBarEnabled) {
mSystemUiProxy.setBubblesListener(this);
mSystemUiProxy.setHasBubbleBar(true);
}
});
}
@@ -352,9 +353,6 @@ public class BubbleBarController extends IBubblesListener.Stub {
BubbleBarBubble newlySelected = mBubbles.get(update.selectedBubbleKey);
if (newlySelected != null) {
bubbleToSelect = newlySelected;
} else {
Log.w(TAG, "trying to select bubble that doesn't exist:"
+ update.selectedBubbleKey);
}
}
}
@@ -423,6 +421,9 @@ public class BubbleBarController extends IBubblesListener.Stub {
for (int i = update.currentBubbles.size() - 1; i >= 0; i--) {
BubbleBarBubble bubble = update.currentBubbles.get(i);
if (bubble != null) {
if (bubble.getKey().equals(update.selectedBubbleKey)) {
bubbleToSelect = bubble;
}
addBubbleInternally(bubble, isExpanding, suppressAnimation);
if (isCollapsed && bubbleToSelect == null) {
// If we're collapsed, the most recently added bubble will be selected.
@@ -698,6 +698,13 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context:
}
}
/** Tells SysUI whether bubble bar is used or not. */
fun setHasBubbleBar(hasBubbleBar: Boolean) {
executeWithErrorLog({ "Failed call setHasBubbleBar" }) {
bubbles?.setHasBubbleBar(hasBubbleBar)
}
}
//
// Splitscreen
//