summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorJulia Reynolds <juliacr@google.com>2017-03-15 14:03:55 -0400
committerJulia Reynolds <juliacr@google.com>2017-03-16 14:32:50 +0000
commit9bfba59417fd0789023005064565d744ed7483d2 (patch)
tree16c55db219f777c1e29c1af32dac135c7286d775 /core/java/android
parent41103f42126acbd602de81ac87a2e605492ff528 (diff)
Better deletions
- Allow apps to delete notification groups (which cascade to delete all channels therein) - Allow apps to get their groups, so they know what they might want to delete - Don't throw if someone tries to delete something that already doesn't exist. Change-Id: I5f6e25497c5da1e57b52737586e86097332f88f9 Fixes: 36245468 Fixes: 36127382 Test: runtest systemui-notification, cts
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/INotificationManager.aidl2
-rw-r--r--core/java/android/app/NotificationManager.java24
2 files changed, 26 insertions, 0 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 896f56c9f4d9..5ea24804e0fd 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -67,6 +67,8 @@ interface INotificationManager
ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
int getDeletedChannelCount(String pkg, int uid);
+ void deleteNotificationChannelGroup(String pkg, String channelGroupId);
+ ParceledListSlice getNotificationChannelGroups(String pkg);
// TODO: Remove this when callers have been migrated to the equivalent
// INotificationListener method.
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 2a78b6b7b143..0379970762ab 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -498,6 +498,30 @@ public class NotificationManager
}
/**
+ * Returns all notification channel groups belonging to the calling app.
+ */
+ public List<NotificationChannelGroup> getNotificationChannelGroups() {
+ INotificationManager service = getService();
+ try {
+ return service.getNotificationChannelGroups(mContext.getPackageName()).getList();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Deletes the given notification channel group.
+ */
+ public void deleteNotificationChannelGroup(String groupId) {
+ INotificationManager service = getService();
+ try {
+ service.deleteNotificationChannelGroup(mContext.getPackageName(), groupId);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* @hide
*/
@TestApi