Suppress the initial notification when the app is foreground
Test: atest BubbleControllerTest
Bug: 123542531
Change-Id: I543df6d0a0c5af0f3feb0b3fe4cd9ef92e5a21c9
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 22c019f..e84c648 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -384,9 +384,11 @@
}
if (shouldAutoBubbleForFlags(mContext, entry) || shouldBubble(entry)) {
// TODO: handle group summaries
- // It's a new notif, it shows in the shade and as a bubble
entry.setIsBubble(true);
- entry.setShowInShadeWhenBubble(true);
+ boolean suppressNotification = entry.getBubbleMetadata() != null
+ && entry.getBubbleMetadata().getSuppressInitialNotification()
+ && isForegroundApp(entry.notification.getPackageName());
+ entry.setShowInShadeWhenBubble(!suppressNotification);
}
}