summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Liran Binyamin <liranb@google.com> 2023-12-14 12:01:40 -0500
committer Liran Binyamin <liranb@google.com> 2023-12-14 12:01:40 -0500
commitf75bc90c324d5cb50d93e8b3e3a02422d570d26c (patch)
treef5791ec40edfd28ee126230f0347818fa63b054a /libs
parent7a85cfb8ba66c51ab05c7c498885f6bb45599bed (diff)
Don't remove bubbles after mode switching
We currently remove TaskViews as part of mode switching cleanup, but that eventually removes existing bubbles which means bubbles are lost after mode switching. As a short term solution, this CL avoids removing the bubble if the task is removed as a result of mode switching. A longer term solution is to refactor the task views outside of the expanded views so they don't need to be removed as part of mode switching. See b/316358859. Fixes: 316358859 Test: Manual - Add bubbles - Switch modes - Observe that bubbles are not removed Change-Id: I382725e318bc441eb9e8b277e615ca21fdbdc871
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java30
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java3
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java3
3 files changed, 34 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
index 249f52bd6156..896bcaf98599 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
@@ -1481,6 +1481,36 @@ public class BubbleController implements ConfigurationChangeListener,
}
}
+ // TODO(b/316358859): remove this method after task views are shared across modes
+ /**
+ * Removes the bubble with the given key after task removal, unless the task was removed as
+ * a result of mode switching, in which case, the bubble isn't removed because it will be
+ * re-inflated for the new mode.
+ */
+ @MainThread
+ public void removeFloatingBubbleAfterTaskRemoval(String key, int reason) {
+ // if we're floating remove the bubble. otherwise, we're here because the task was removed
+ // after switching modes. See b/316358859
+ if (!isShowingAsBubbleBar()) {
+ removeBubble(key, reason);
+ }
+ }
+
+ // TODO(b/316358859): remove this method after task views are shared across modes
+ /**
+ * Removes the bubble with the given key after task removal, unless the task was removed as
+ * a result of mode switching, in which case, the bubble isn't removed because it will be
+ * re-inflated for the new mode.
+ */
+ @MainThread
+ public void removeBarBubbleAfterTaskRemoval(String key, int reason) {
+ // if we're showing as bubble bar remove the bubble. otherwise, we're here because the task
+ // was removed after switching modes. See b/316358859
+ if (isShowingAsBubbleBar()) {
+ removeBubble(key, reason);
+ }
+ }
+
/**
* Removes all the bubbles.
* <p>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
index a3eb429b1d7e..f3fe895bf9b4 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
@@ -313,7 +313,8 @@ public class BubbleExpandedView extends LinearLayout {
+ " bubble=" + getBubbleKey());
}
if (mBubble != null) {
- mController.removeBubble(mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
+ mController.removeFloatingBubbleAfterTaskRemoval(
+ mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
}
if (mTaskView != null) {
// Release the surface
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java
index da4a9898a44c..f6c382fb5b3d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java
@@ -188,7 +188,8 @@ public class BubbleTaskViewHelper {
+ " bubble=" + getBubbleKey());
}
if (mBubble != null) {
- mController.removeBubble(mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
+ mController.removeBarBubbleAfterTaskRemoval(
+ mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
}
}