Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bfba594 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

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
parent 41103f42
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -5548,12 +5548,14 @@ package android.app {
    method public void createNotificationChannelGroups(java.util.List<android.app.NotificationChannelGroup>);
    method public void createNotificationChannelGroups(java.util.List<android.app.NotificationChannelGroup>);
    method public void createNotificationChannels(java.util.List<android.app.NotificationChannel>);
    method public void createNotificationChannels(java.util.List<android.app.NotificationChannel>);
    method public void deleteNotificationChannel(java.lang.String);
    method public void deleteNotificationChannel(java.lang.String);
    method public void deleteNotificationChannelGroup(java.lang.String);
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.Map<java.lang.String, android.app.AutomaticZenRule> getAutomaticZenRules();
    method public java.util.Map<java.lang.String, android.app.AutomaticZenRule> getAutomaticZenRules();
    method public final int getCurrentInterruptionFilter();
    method public final int getCurrentInterruptionFilter();
    method public int getImportance();
    method public int getImportance();
    method public android.app.NotificationChannel getNotificationChannel(java.lang.String);
    method public android.app.NotificationChannel getNotificationChannel(java.lang.String);
    method public java.util.List<android.app.NotificationChannelGroup> getNotificationChannelGroups();
    method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
    method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public boolean isNotificationPolicyAccessGranted();
+2 −0
Original line number Original line Diff line number Diff line
@@ -5751,12 +5751,14 @@ package android.app {
    method public void createNotificationChannelGroups(java.util.List<android.app.NotificationChannelGroup>);
    method public void createNotificationChannelGroups(java.util.List<android.app.NotificationChannelGroup>);
    method public void createNotificationChannels(java.util.List<android.app.NotificationChannel>);
    method public void createNotificationChannels(java.util.List<android.app.NotificationChannel>);
    method public void deleteNotificationChannel(java.lang.String);
    method public void deleteNotificationChannel(java.lang.String);
    method public void deleteNotificationChannelGroup(java.lang.String);
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.Map<java.lang.String, android.app.AutomaticZenRule> getAutomaticZenRules();
    method public java.util.Map<java.lang.String, android.app.AutomaticZenRule> getAutomaticZenRules();
    method public final int getCurrentInterruptionFilter();
    method public final int getCurrentInterruptionFilter();
    method public int getImportance();
    method public int getImportance();
    method public android.app.NotificationChannel getNotificationChannel(java.lang.String);
    method public android.app.NotificationChannel getNotificationChannel(java.lang.String);
    method public java.util.List<android.app.NotificationChannelGroup> getNotificationChannelGroups();
    method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
    method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public boolean isNotificationPolicyAccessGranted();
+2 −0
Original line number Original line Diff line number Diff line
@@ -5558,6 +5558,7 @@ package android.app {
    method public void createNotificationChannelGroups(java.util.List<android.app.NotificationChannelGroup>);
    method public void createNotificationChannelGroups(java.util.List<android.app.NotificationChannelGroup>);
    method public void createNotificationChannels(java.util.List<android.app.NotificationChannel>);
    method public void createNotificationChannels(java.util.List<android.app.NotificationChannel>);
    method public void deleteNotificationChannel(java.lang.String);
    method public void deleteNotificationChannel(java.lang.String);
    method public void deleteNotificationChannelGroup(java.lang.String);
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.Map<java.lang.String, android.app.AutomaticZenRule> getAutomaticZenRules();
    method public java.util.Map<java.lang.String, android.app.AutomaticZenRule> getAutomaticZenRules();
@@ -5565,6 +5566,7 @@ package android.app {
    method public android.content.ComponentName getEffectsSuppressor();
    method public android.content.ComponentName getEffectsSuppressor();
    method public int getImportance();
    method public int getImportance();
    method public android.app.NotificationChannel getNotificationChannel(java.lang.String);
    method public android.app.NotificationChannel getNotificationChannel(java.lang.String);
    method public java.util.List<android.app.NotificationChannelGroup> getNotificationChannelGroups();
    method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
    method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public boolean isNotificationPolicyAccessGranted();
+2 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,8 @@ interface INotificationManager
    ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
    ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
    int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
    int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
    int getDeletedChannelCount(String pkg, int uid);
    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
    // TODO: Remove this when callers have been migrated to the equivalent
    // INotificationListener method.
    // INotificationListener method.
+24 −0
Original line number Original line Diff line number Diff line
@@ -497,6 +497,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
     * @hide
     */
     */
Loading