From 102451972f7ce761f5867dd3489f57c373a0605a Mon Sep 17 00:00:00 2001 From: Sergey Serokurov Date: Sat, 30 Oct 2021 21:47:22 -0700 Subject: [PATCH] Hide bubbles when focus mode is enabled Bug: 191211593 Test: Manual, verifed that pre-existing bubbles are not visible once focus mode is eanbled and vice versa. Test: Screen recording: https://drive.google.com/file/d/1oVwgQhv7yyzy5UFnidNYPVyE2pvEE39J/view?usp=sharing Change-Id: I7c287b9d00ecaa0dba582b49f70a9f8fb7701782 --- .../wm/shell/bubbles/BubbleController.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 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 b6d65bebff28c..f38001b15a7cd 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 @@ -1028,13 +1028,16 @@ public class BubbleController { // If this entry is no longer allowed to bubble, dismiss with the BLOCKED reason. // This means that the app or channel's ability to bubble has been revoked. mBubbleData.dismissBubbleWithKey(key, DISMISS_BLOCKED); - } else if (isActiveBubble && !shouldBubbleUp) { - // If this entry is allowed to bubble, but cannot currently bubble up, dismiss it. - // This happens when DND is enabled and configured to hide bubbles. Dismissing with - // the reason DISMISS_NO_BUBBLE_UP will retain the underlying notification, so that - // the bubble will be re-created if shouldBubbleUp returns true. + } else if (isActiveBubble && (!shouldBubbleUp || entry.getRanking().isSuspended())) { + // If this entry is allowed to bubble, but cannot currently bubble up or is + // suspended, dismiss it. This happens when DND is enabled and configured to hide + // bubbles, or focus mode is enabled and the app is designated as distracting. + // Dismissing with the reason DISMISS_NO_BUBBLE_UP will retain the underlying + // notification, so that the bubble will be re-created if shouldBubbleUp returns + // true. mBubbleData.dismissBubbleWithKey(key, DISMISS_NO_BUBBLE_UP); - } else if (entry != null && mTmpRanking.isBubble() && !isActiveBubble) { + } else if (entry != null && mTmpRanking.isBubble() && !isActiveBubble + && !entry.getRanking().isSuspended()) { entry.setFlagBubble(true); onEntryUpdated(entry, true /* shouldBubbleUp */); }