Use playback state to update remote control stack

The remote control stack in AudioService is responsible for handling
 which application receives media button events. When an application
 "registers" its media button receiver, it gets placed at the top
 of the remote control stack. If the app also has audio focus (is
 at top of focus stack), this will also cause the information of
 the attached remote control client (RCC) to be displayed on the
 lockscreen.
If an app doesn't re-register its button receiver when it wants
 to receive the button events, it might have lost its place at the
 top of the remote control stack, and would not show up in the
 lockscreen anymore.
This change consists in using the playstate reported by the RCC
 to change the remote control stack. If an RCC reports a "playing"
 state (e.g. playing, fast forwarding), it is safe to assume the
 application is actively being used, and should be the one that
 receives the transport control buttons. This CL uses the reported
 playstate to conditionally move the corresponding stack entry
 to the top of the stack.

Bug 7311023

Change-Id: I1505f01664c16e108b22d33e3f47f0056343676e
1 file changed