summaryrefslogtreecommitdiff
path: root/core/java/android/app/Notification.java
diff options
context:
space:
mode:
authorMady Mellor <madym@google.com>2020-01-14 13:26:14 -0800
committerMady Mellor <madym@google.com>2020-01-27 10:46:41 -0800
commitf44b68378c2a1cdb6acb3ab3d275d8f58ff3ee0f (patch)
tree37842b1278a8aa72f12b0daf195bf28168ae1876 /core/java/android/app/Notification.java
parentd21c45fc95c64e3139016954bb099e057299037b (diff)
Bubble API: post update when bubble notification suppression flag changes
When bubbles are expanded or if the user dismisses the notification, the notification associated with the bubble is suppressed from the shade, but still technically active / in active notification list because of the bubble. We already have a concept of this with isNotificationSuppressed on BubbleMetadata, this just ensures that the flag is properly updated when the state changes in System UI. This allows other things showing notifications (e.g. long press on launcher app icon -> see notifs) to hide or show notifications consistently with the rest of system ui. I'm re-using the flag that apps may set to suppress notifications when they send a bubble that is foreground, since its the same concept. When this flag state changes a new update is sent with the flag adjusted. Added a notification delegate method to communicate the suppression changes back to NoMan. This is piped through a listener set on Bubble objects. Test: atest NotificationManagerTest NotificationTest NotificationManagerServiceTest Bug: 131926652 Bug: 144352570 Change-Id: I25e86849858cdfe2fb81ab51b1ff09980bf70944
Diffstat (limited to 'core/java/android/app/Notification.java')
-rw-r--r--core/java/android/app/Notification.java42
1 files changed, 33 insertions, 9 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 1af275fedd74..16898a08851a 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -8634,17 +8634,23 @@ public class Notification implements Parcelable
public static final int FLAG_AUTO_EXPAND_BUBBLE = 0x00000001;
/**
- * If set and the app posting the bubble is in the foreground, the bubble will
- * be posted <b>without</b> the associated notification in the notification shade.
+ * Indicates whether the notification associated with the bubble is being visually
+ * suppressed from the notification shade. When <code>true</code> the notification is
+ * hidden, when <code>false</code> the notification shows as normal.
*
- * <p>This flag has no effect if the app posting the bubble is not in the foreground.
- * The app is considered foreground if it is visible and on the screen, note that
- * a foreground service does not qualify.
- * </p>
+ * <p>Apps sending bubbles may set this flag so that the bubble is posted <b>without</b>
+ * the associated notification in the notification shade.</p>
*
- * <p>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.</p>
+ * <p>Apps sending bubbles can only apply this flag when the app is in the foreground,
+ * otherwise the flag is not respected. The app is considered foreground if it is visible
+ * and on the screen, note that a foreground service does not qualify.</p>
+ *
+ * <p>Generally this flag should only be set by the app 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. </p>
+ *
+ * <p>The system will also update this flag with <code>true</code> to hide the notification
+ * from the user once the bubble has been expanded. </p>
*
* @hide
*/
@@ -8762,6 +8768,24 @@ public class Notification implements Parcelable
}
/**
+ * Indicates whether the notification associated with the bubble is being visually
+ * suppressed from the notification shade. When <code>true</code> the notification is
+ * hidden, when <code>false</code> the notification shows as normal.
+ *
+ * <p>Apps sending bubbles may set this flag so that the bubble is posted <b>without</b>
+ * the associated notification in the notification shade.</p>
+ *
+ * <p>Apps sending bubbles can only apply this flag when the app is in the foreground,
+ * otherwise the flag is not respected. The app is considered foreground if it is visible
+ * and on the screen, note that a foreground service does not qualify.</p>
+ *
+ * <p>Generally the app should only set this flag 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. </p>
+ *
+ * <p>The system will update this flag with <code>true</code> to hide the notification
+ * from the user once the bubble has been expanded.</p>
+ *
* @return whether this bubble should suppress the notification when it is posted.
*
* @see BubbleMetadata.Builder#setSuppressNotification(boolean)