11 Commits

Author SHA1 Message Date
RoboErik
03fce072ca Allow null queues to be set in MediaSession
Also add some test code for it to OneMedia.

bug:17593962
Change-Id: I074e2bb0329d9a97f623e4309bb7dada157b8324
2014-09-24 14:35:32 -07:00
RoboErik
78c64cdbd8 Fix crash in legacy apps that register without a looper
Some legacy apps registered their media button receiver in a thread
without a looper. If this happens we need to use the main looper to
prevent a crash.

bug: 16306226
Change-Id: Idf472e649393e2a7ce2a3e1cbb3476003ab17f34
2014-08-14 18:42:54 -07:00
RoboErik
24762bffc3 Add an onSessionDestroyed callback to MediaController.Callback
Callbacks on the controller need to know when the session ceases
to exist.

bug:17009030
Change-Id: I0f1c1cfc51f7dd2203955287cc269667d3765ee4
2014-08-13 15:00:21 -07:00
RoboErik
75847b98f3 Add display metadata and change strings to CharSequences
This adds some fields for display purposes to MediaMetadata and also
makes the default for all text CharSequence instead of String. Also
adds a hidden method for getting a Description for the metadata.

bug: 11708293
Change-Id: I0ed58d9ac3aeff41325c4ccf5fed0539bbf03b4d
2014-08-05 14:30:27 -07:00
RoboErik
031149cd5f Add context to MediaController constructor
This also adds a convenience method to MediaSession to allow getting
a controller instead of having to create and cache your own.

bug:16561220
Change-Id: I87f551a7474e71f1cf2f07e0e541c3a4515cd977
2014-07-28 11:02:15 -07:00
RoboErik
aa4e23bbb3 Add getPackageName to MediaController
This removes the MediaSessionInfo class and adds a method on the
controller to get the package name. This also converts code that
depended on the session's UUID to use the token for comparison or
the Tag in the case of test code that needs a string identifier.

Change-Id: Icb8dc76c70e23e897da8fd07651c524b96372bf9
2014-07-25 16:22:59 -07:00
RoboErik
8b4bffcac9 Make MediaSession and MediaController constructors public
This makes the MediaSession/Controller constructors public and registers
with the system behind the scenes.

This also adds a bit about needing to call setActive(true) to start receiving
commands in MediaSession's docs.

Change-Id: If882d229b54c36bf0831aca0255052dda667a2bc
2014-07-16 12:03:45 -07:00
Jeff Brown
01a500ed1c Delete first draft of media routing APIs.
The new APIs will not be as tightly integrated into MediaSession.

Change-Id: I5cfd37d9d8d0c5d46c55edb5cf0772a8f1ef13ab
2014-07-14 04:06:44 -07:00
RoboErik
d3c8642dae Remove some more old code and fix Media command
Removes some more hidden apis from AudioService/Manager. This also
fixes up Media.java to support commands for the new service to help
with debugging. Also fixes a couple bugs that were found while fixing
up Media.

Change-Id: I68e4aa80a4de430b98236aafc883664b9432c62b
2014-06-19 10:37:00 -07:00
Jean-Michel Trivi
f108cdd9ee 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
2013-10-04 17:50:44 -07:00
Dianne Hackborn
79f7ec70eb Have audio service clean up new receivers in crashing processes.
The new media button receiver with only a pending intent (no
component name) could be left hanging if the process that
registered it went away.  These semantically need to be tied
to the calling process's lifetime; we now clean them up when
the calling process goes away.

Also added some additional cleanup of media button receivers
when packages change (updated, cleared).

And on top of that, a new "media" command for doing media
things.  Currently lets you send media keys and monitor
remote display data.

Oh and finally added a new BaseCommand base class for
implementing these command line utilities.

Change-Id: Iba1d56f10bab1eec4a94a7bb1d1c2ae614c8bcf5
2013-04-08 13:08:37 -07:00