diff --git a/api/current.txt b/api/current.txt
index 03648ea01c78e..01edc71191f8e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5481,7 +5481,8 @@ package android.app {
method @DimenRes public int getDesiredHeightResId();
method @NonNull public android.graphics.drawable.Icon getIcon();
method @NonNull public android.app.PendingIntent getIntent();
- method public boolean getSuppressInitialNotification();
+ method @Deprecated public boolean getSuppressInitialNotification();
+ method public boolean getSuppressNotification();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator If the app creating the bubble is not in the foreground this flag has no effect. If the app posting the bubble is not in the foreground this flag has no effect. Generally this flag should only be set if the user has performed an action to request
- * or create a bubble.
Generally this flag should only be set if the user has performed an action to * request or create a bubble.
+ * + * @deprecated TO BE REMOVED, use {@link #setSuppressNotification(boolean)} instead. */ + @Deprecated @NonNull public BubbleMetadata.Builder setSuppressInitialNotification( boolean shouldSupressNotif) { - setFlag(FLAG_SUPPRESS_INITIAL_NOTIFICATION, shouldSupressNotif); + setFlag(FLAG_SUPPRESS_NOTIFICATION, shouldSupressNotif); + return this; + } + + /** + * If set and the app posting the bubble is in the foreground, the bubble will be + * posted without the associated notification in the notification shade. + * + *If the app posting the bubble is not in the foreground this flag has no effect. + *
+ * + *Generally this flag should only be set if the user has performed an action to + * request or create a bubble, or if the user has seen the content in the notification + * and the notification is no longer relevant.
+ */ + @NonNull + public BubbleMetadata.Builder setSuppressNotification(boolean shouldSupressNotif) { + setFlag(FLAG_SUPPRESS_NOTIFICATION, shouldSupressNotif); return this; } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 418d052e18580..89abd35ab92ef 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -397,11 +397,8 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe return; } if (shouldAutoBubbleForFlags(mContext, entry) || shouldBubble(entry)) { - // TODO: handle group summaries - boolean suppressNotification = entry.getBubbleMetadata() != null - && entry.getBubbleMetadata().getSuppressInitialNotification() - && isForegroundApp(entry.notification.getPackageName()); - entry.setShowInShadeWhenBubble(!suppressNotification); + // TODO: handle group summaries? + updateShowInShadeForSuppressNotification(entry); } } @@ -422,7 +419,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe } if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && alertAgain(entry, entry.notification.getNotification())) { - entry.setShowInShadeWhenBubble(true); + updateShowInShadeForSuppressNotification(entry); entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed updateBubble(entry); mStackView.updateDotVisibility(entry.key); @@ -589,6 +586,13 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe && isForegroundApp(entry.notification.getPackageName()); } + private void updateShowInShadeForSuppressNotification(NotificationEntry entry) { + boolean suppressNotification = entry.getBubbleMetadata() != null + && entry.getBubbleMetadata().getSuppressNotification() + && isForegroundApp(entry.notification.getPackageName()); + entry.setShowInShadeWhenBubble(!suppressNotification); + } + /** * Return true if the applications with the package name is running in foreground. *