[Media ML] Replace observing changes in Settings value

Currently, MediaSessionService observes the
ENABLED_NOTIFICATION_LISTENERS value in Settings to be notified
when a previously "enabled" NotificationListener becomes "disabled".

Instead, this CL adds a new broadcast intent action that
NotificationManagerService can use to notify MediaSessionService
whenever the enabled value of a notification listener changes.

Bug: 160762852, Bug: 147019349
Test: Go to Settings > Apps & Notifications > Special app access
    > Notification access
    and check if allowing/disallowing Notification access for any
    app causes onEnabledChanged to be called.
Change-Id: I3aefa40083fedb78214ae884c7cccaf8de206663
This commit is contained in:
Jin Seok Park
2020-07-29 17:21:36 +09:00
parent 2ea424eac6
commit 643f3e419e
6 changed files with 39 additions and 25 deletions

View File

@@ -281,6 +281,16 @@ public class NotificationManager {
public static final String ACTION_INTERRUPTION_FILTER_CHANGED
= "android.app.action.INTERRUPTION_FILTER_CHANGED";
/**
* Intent that is broadcast when the state of
* {@link #hasEnabledNotificationListener(String, UserHandle)} changes.
* @hide
*/
@SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public static final String ACTION_NOTIFICATION_LISTENER_ENABLED_CHANGED =
"android.app.action.NOTIFICATION_LISTENER_ENABLED_CHANGED";
/**
* Intent that is broadcast when the state of getCurrentInterruptionFilter() changes.
* @hide