diff options
author | 2019-11-21 18:41:27 -0800 | |
---|---|---|
committer | 2019-11-21 18:41:27 -0800 | |
commit | dca2d45630db4905e7b353fff30f8b7dad76a10b (patch) | |
tree | 5e01ec6ea14388e01abd2d7807af66e5c3a37c56 | |
parent | 55e22074085ef2e53b571d109295d4f10c7f4543 (diff) | |
parent | c8bd4aecb3958082b9f72ea236d3405f62d50e6e (diff) |
Merge "Make Notification.Builder.SetFlag public"
am: c8bd4aecb3
Change-Id: I3b8ff8e7c754b12778e40a9abcc829fb7a12671b
-rw-r--r-- | api/current.txt | 1 | ||||
-rw-r--r-- | core/java/android/app/Notification.java | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt index f0be63994873..c657756ba3e9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5552,6 +5552,7 @@ package android.app { method @Deprecated public android.app.Notification.Builder setDefaults(int); method @NonNull public android.app.Notification.Builder setDeleteIntent(android.app.PendingIntent); method @NonNull public android.app.Notification.Builder setExtras(android.os.Bundle); + method @NonNull public android.app.Notification.Builder setFlag(int, boolean); method @NonNull public android.app.Notification.Builder setFullScreenIntent(android.app.PendingIntent, boolean); method @NonNull public android.app.Notification.Builder setGroup(String); method @NonNull public android.app.Notification.Builder setGroupAlertBehavior(int); diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index a4c98e88cbc7..412ef04c2284 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -628,6 +628,13 @@ public class Notification implements Parcelable */ public static final int FLAG_BUBBLE = 0x00001000; + /** @hide */ + @IntDef({FLAG_SHOW_LIGHTS, FLAG_ONGOING_EVENT, FLAG_INSISTENT, FLAG_ONLY_ALERT_ONCE, + FLAG_AUTO_CANCEL, FLAG_NO_CLEAR, FLAG_FOREGROUND_SERVICE, FLAG_HIGH_PRIORITY, + FLAG_LOCAL_ONLY, FLAG_GROUP_SUMMARY, FLAG_AUTOGROUP_SUMMARY, FLAG_BUBBLE}) + @Retention(RetentionPolicy.SOURCE) + public @interface NotificationFlags{}; + public int flags; /** @hide */ @@ -4537,10 +4544,15 @@ public class Notification implements Parcelable } /** - * @hide + * Set the value for a notification flag + * + * @param mask Bit mask of the flag + * @param value Status (on/off) of the flag + * + * @return The same Builder. */ @NonNull - public Builder setFlag(int mask, boolean value) { + public Builder setFlag(@NotificationFlags int mask, boolean value) { if (value) { mN.flags |= mask; } else { |