From f108cdd9ee5efe354d87edd02a07b323298c116c Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Fri, 27 Sep 2013 18:37:36 -0700 Subject: Also rely on enabled notification listeners for RemoteController registration Registration of a RemoteController may succeed only if: - the caller has the MEDIA_CONTENT_CONTROL permission, - or if the RemoteController.OnClientUpdateListener it registers if one of the enabled notification listeners. For using the "enabled notification listener" functionality, the CL involved: - making OnClientUpdateListener an interface so a 3rd-party application may have its implementation extend NotificationListenerService, which is required for a listener to be enabled by the user. - add the concept of "enabled" status in an IRemoteControlDisplay, so a RemoteController (which encapsulates the IRemoteControlDisplay implementation) may be registered, but later temporarily disabled by the user, as a result of a user action in the security settings, or a user switch. - making MediaFocusControl, the component tied to AudioService, monitor changes in enabled notification listeners, and act upon enable/disable changes. Bug 8209392 Change-Id: Ia8dfa2156c65668b2b0d4ae92048005912652d84 --- cmds/media/src/com/android/commands/media/Media.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmds/media/src') diff --git a/cmds/media/src/com/android/commands/media/Media.java b/cmds/media/src/com/android/commands/media/Media.java index 56af7d6..92c6a51 100644 --- a/cmds/media/src/com/android/commands/media/Media.java +++ b/cmds/media/src/com/android/commands/media/Media.java @@ -140,6 +140,11 @@ public class Media extends BaseCommand { } @Override + public void setEnabled(boolean enabled) { + System.out.println("New enable state= " + (enabled ? "enabled" : "disabled")); + } + + @Override public void setPlaybackState(int generationId, int state, long stateChangeTimeMs, long currentPosMs, float speed) { System.out.println("New state: id=" + generationId + " state=" + state -- cgit v1.1