summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorMady Mellor <madym@google.com>2021-03-31 16:53:16 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-03-31 16:53:16 +0000
commit3da85d8e80a393ce2bd453a90d0a716c32111b0e (patch)
tree2c0735ccbf006516253f9c4c0654393020aee65d /core/java/android
parent65da93d3fd34dd545de4b57bac52812de10169b2 (diff)
parentc5561c9c5c8aac7b257adfcac7c66a872865cb8c (diff)
Merge "API: Expose whether bubbles are enabled or not" into sc-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/INotificationManager.aidl1
-rw-r--r--core/java/android/app/NotificationManager.java16
2 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index a5f8f103e437..d0e17f00e990 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -85,6 +85,7 @@ interface INotificationManager
void setBubblesAllowed(String pkg, int uid, int bubblePreference);
boolean areBubblesAllowed(String pkg);
+ boolean areBubblesEnabled(in UserHandle user);
int getBubblePreferenceForPackage(String pkg, int uid);
void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList);
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 6cce270bc5a3..f0d580f066d8 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -1326,7 +1326,6 @@ public class NotificationManager {
}
}
-
/**
* Gets whether all notifications posted by this app can appear outside of the
* notification shade, floating over other apps' content.
@@ -1348,6 +1347,21 @@ public class NotificationManager {
}
/**
+ * Returns whether bubbles are enabled at the feature level for the current user. When enabled,
+ * notifications able to bubble will display an affordance allowing the user to bubble them.
+ *
+ * @see Notification.Builder#setBubbleMetadata(Notification.BubbleMetadata)
+ */
+ public boolean areBubblesEnabled() {
+ INotificationManager service = getService();
+ try {
+ return service.areBubblesEnabled(mContext.getUser());
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Gets the bubble preference for the app. This preference only applies to notifications that
* have been properly configured to bubble.
*