From 9d0fd9c9d6d428732fa597745676c98deb619d9a Mon Sep 17 00:00:00 2001 From: cncn Date: Wed, 20 Nov 2019 11:05:02 -0800 Subject: Make Notification.Builder.SetFlag public Bug: 144846447 Test: Build Successfully Change-Id: If25bede41eec1f7e7ca3ae8fc669df1964d7da05 --- core/java/android/app/Notification.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'core/java/android/app/Notification.java') diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index ceadd8510e44..47f0cf846c17 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 { -- cgit v1.2.3