summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Liran Binyamin <liranb@google.com> 2023-12-14 19:48:31 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-12-14 19:48:31 +0000
commitfc050dfb0e9177e6412f640511564b5379ea5dbf (patch)
treea0a478ffac39ffda1f0e600f927ccd4ba348d3ae
parent511535534a5cd7d0b662bb5e93b6bc9e7fa45b42 (diff)
parentf75bc90c324d5cb50d93e8b3e3a02422d570d26c (diff)
Merge "Don't remove bubbles after mode switching" into main
-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);
}
}