Bubble bar to ignore launcher state changes after destroy

When device is rotated, launcher is recreated and the existing
controllers are destroyed.
As part of handling the destroy signal, LauncherTaskbarUIController
updates the launcher state to in-app. This launcher state change is
handled by BubbleStashController which in turn notifies
BubbleBarViewController that bubble bar should be collapsed.
BubbleBarViewController then notifies WMShell that bubble bar should be
collapsed. And that state is stored in WMShell.
This causes bubble bar to collapse when it is expanded on home screen
and device is rotated.
Fix this by checking if the TaskbarActivityContext is already destroyed
when a launcher state change happens. And if it is, ignore those state
changes.

Bug: 357115534
Test: expand bubble bar on home screen, rotate device, check that bubble
  bar remains expanded
Flag: com.android.wm.shell.enable_bubble_bar
Change-Id: I7e019f8d1fd7935582d84a99d3afa3ffadd92799
This commit is contained in:
Ats Jenk committed 2025-04-23 16:18:57 -07:00
1 parent 8184e7116d
commit 7d28df80e8
1 file changed
+4
@@ -505,6 +505,10 @@ public class TaskbarLauncherStateController {
+ ", toAlignment: " + toAlignment);
}
mControllers.bubbleControllers.ifPresent(controllers -> {
// Ignore state changes when taskbar is destroyed
if (mControllers.taskbarActivityContext.isDestroyed()) {
return;
}
// Show the bubble bar when on launcher home (hotseat icons visible) or in overview
boolean onOverview = isInLauncher && mLauncherState == LauncherState.OVERVIEW;
boolean hotseatIconsVisible = isInLauncher && mLauncherState.areElementsVisible(