summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java11
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java13
2 files changed, 16 insertions, 8 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 15350fb19209..96aaf02cb5e3 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
@@ -1799,11 +1799,12 @@ public class BubbleController implements ConfigurationChangeListener,
@Override
public void removeBubble(Bubble removedBubble) {
if (mLayerView != null) {
- mLayerView.removeBubble(removedBubble);
- if (!mBubbleData.hasBubbles() && !isStackExpanded()) {
- mLayerView.setVisibility(INVISIBLE);
- removeFromWindowManagerMaybe();
- }
+ mLayerView.removeBubble(removedBubble, () -> {
+ if (!mBubbleData.hasBubbles() && !isStackExpanded()) {
+ mLayerView.setVisibility(INVISIBLE);
+ removeFromWindowManagerMaybe();
+ }
+ });
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java
index 78a41f759d96..42799d975e1b 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java
@@ -242,13 +242,17 @@ public class BubbleBarLayerView extends FrameLayout
}
/** Removes the given {@code bubble}. */
- public void removeBubble(Bubble bubble) {
+ public void removeBubble(Bubble bubble, Runnable endAction) {
+ Runnable cleanUp = () -> {
+ bubble.cleanupViews();
+ endAction.run();
+ };
if (mBubbleData.getBubbles().isEmpty()) {
// we're removing the last bubble. collapse the expanded view and cleanup bubble views
// at the end.
- collapse(bubble::cleanupViews);
+ collapse(cleanUp);
} else {
- bubble.cleanupViews();
+ cleanUp.run();
}
}
@@ -264,6 +268,9 @@ public class BubbleBarLayerView extends FrameLayout
*/
public void collapse(@Nullable Runnable endAction) {
if (!mIsExpanded) {
+ if (endAction != null) {
+ endAction.run();
+ }
return;
}
mIsExpanded = false;