From 5a3fcf3bbb77e31e445dc19bb23cf541c938c864 Mon Sep 17 00:00:00 2001 From: Shuming Hao Date: Wed, 5 Apr 2023 18:15:40 -0700 Subject: [PATCH] Add new method to differentiate custom notifications Bug: b/276963581 Test: manual test with Notify1.apk Change-Id: Ie70210abe4b7febf5ede96bca16de728f0cec70a --- core/java/android/app/Notification.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 96d785f0df9c4..d1cec688f58bc 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -6985,6 +6985,22 @@ public class Notification implements Parcelable return isMediaStyle && hasMediaSession; } + /** + * @return true for custom notifications, including notifications + * with DecoratedCustomViewStyle or DecoratedMediaCustomViewStyle, + * and other notifications with user-provided custom views. + * + * @hide + */ + public Boolean isCustomNotification() { + if (contentView == null + && bigContentView == null + && headsUpContentView == null) { + return false; + } + return true; + } + /** * @return true if this notification is showing as a bubble *