History log of /frameworks/base/media/java/android/media/MediaFocusControl.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0212be5150fb9fb3c340f3c7e51f6126372cc6f9 24-Nov-2014 Jean-Michel Trivi <jmtrivi@google.com> Support collaborative audio focus handling

Add new flag for an app to define it doesn't duck, but rather
pauses when losing focus with AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK.
This flag is to be used when requesting focus.
Add support for AudioPolicy to specify whether it will implement
ducking itself, rather than it being handled by an app.
When ducking is handled by a policy, do not notify focus owners
when they lose audio focus with LOSS_TRANSIENT_CAN_DUCK, unless
they would have paused, as expressed with the
AUDIOFOCUS_FLAG_PAUSES_ON_DUCKABLE_LOSS flag.
Add a focus listener for a policy to be notified of focus changes
so it can properly implement its own ducking.

Bug 16010554

Change-Id: I11d7cdb85c52fd086128a44f4d938aaa44db5c25
/frameworks/base/media/java/android/media/MediaFocusControl.java
958876fe55ea0fdeb73c72240a2f2bab32833443 17-Nov-2014 Jean-Michel Trivi <jmtrivi@google.com> Add support for audio focus locking

New API for a registered AudioPolicy to lock/unlock the audio
focus stack and prevent any new grant of focus, similar to
the way phone calls behave.

Bug 16010554

Change-Id: If34a58ca9bd43d5479e94a2a7b540750b4c6efe9
/frameworks/base/media/java/android/media/MediaFocusControl.java
fd6ad747e6c268753d0edf7a5a59b6815b190854 10-Nov-2014 Jean-Michel Trivi <jmtrivi@google.com> Support for delayed audio focus

New internal API for an audio focus requester to always enter
the audio focus stack even if audio focus can't be granted
immediately (e.g. during a phone call).
Remap the "no delay" interface to the new "requestAudioFocus"
method signature and AIDL.

Bug 16010554

Change-Id: Iff91ddb0beb411cca1f8cf98300a9afc4178dc7f
/frameworks/base/media/java/android/media/MediaFocusControl.java
f2bbad1e7631bbe51c097fe943ab3a1ce346b4cd 24-Jul-2014 Jean-Michel Trivi <jmtrivi@google.com> Remove MediaFocusControl persisting media button receiver

MediaFocusControl doesn't handle media button receivers anymore,
so it should read and persist a receiver, and monitor
package addition/removals.
Also involved a security vulnerability, see bug

Bug 15428797

Change-Id: Ia2be01b20dc4a9820cc0cd3d0605ac03770b266b
/frameworks/base/media/java/android/media/MediaFocusControl.java
d09bd0c6eb8318e0122b14d7eb5324e481706e41 25-Jun-2014 RoboErik <epastern@google.com> Move VolumeController into AudioService

VolumeController was a hidden class only used by AudioService and
MediaFocusControl. Since we added a public VolumeProvider class
moving VolumeController to avoid confusion.

Change-Id: I6838daf9b83846e1393b1a8502d3b10345a4799a
/frameworks/base/media/java/android/media/MediaFocusControl.java
19c9518f6a817d53d5234de0020313cab6950b2f 24-Jun-2014 RoboErik <epastern@google.com> b/15729204 Pipe sessions through to VolumePanel

When remote volume is changed via volume buttons we need to notify
the system UI so it can show the slider. This also passes it the
controller to use so adjustments to the slider are sent back to
the correct session.

Change-Id: If5847bcd5db16c56e0e9904b88c94e5b28954c41
/frameworks/base/media/java/android/media/MediaFocusControl.java
6f0e4ddd66fcdcc13944d8970d0b560e2626508b 18-Jun-2014 RoboErik <epastern@google.com> Remove more dead audio service code

Hit a snag in remote volume changes. Trying off this round of
removal so I can work on fixing remote volume handling in a
separate CL.

Change-Id: I49b1ba4b75d770ba7c77da081755f3210a9e9483
/frameworks/base/media/java/android/media/MediaFocusControl.java
0d90876893c69a2e26867b775c76b45774c22390 30-Apr-2014 Jean-Michel Trivi <jmtrivi@google.com> Fix MediaFocusControl index management for PlayerRecord

When updating the PlayerRecord stack on playstate changes and
media button event receiver registrations, evaluate the index
of the stack entry to remove against the index of the last playing
entry as this index was valid before the entry was removed.
This affects the insertion index.

Change-Id: Iec58d2df6bcbd8f55925e9e0f9d48f698f7cf4e5
/frameworks/base/media/java/android/media/MediaFocusControl.java
8be88d114432c102264c0a73536efc537c6770ac 11-Apr-2014 Jean-Michel Trivi <jmtrivi@google.com> MediaFocusControl: priority to playing players for media button

When registering a media button event receiver (through
AudioManager.registerMediaButtonEventReceiver()), do not
always push the receiver to the top of the stack of event
receivers:
- only push to the top if the associated RemoteControlClient
is in a playing state
- otherwise push it below the entries at the top of the stack
that are in a playing state
When changing the playstate of a RemoteControlClient:
- push to the top of the stack the corresponding PlayerRecord
is the state is a playing state
- otherwise push it below the entries at the top of the stack
that are in a playing state

When AudioService starts (e.g. after boot) and the last media
button receiver is restored, it goes in the stack.
After this CL, this entry is not "orphaned" anymore after the
same application registers itself to receive media buttons:
the entry from the restoration is now properly associated with
the registration from the application.

Bug 10749554

Change-Id: I985f9cc17b64a60ed4f2f2f6d03e117fb4e27570
/frameworks/base/media/java/android/media/MediaFocusControl.java
f51e1134695c812ad8aa9f826a2a47d17526f244 11-Apr-2014 Jean-Michel Trivi <jmtrivi@google.com> MediaFocusControl: fix comment

Comment about role of audio focus isn't valid anymore.

Change-Id: I608d8cf9d5d9c4449384e2788e5eb5ea42c97eca
/frameworks/base/media/java/android/media/MediaFocusControl.java
b416838051adc3922ab3bd075d35563388d28820 09-Apr-2014 Jean-Michel Trivi <jmtrivi@google.com> Audio focus doesn't affect RemoteController

The top of the stack of PlayerRecord instances is the "promoted"
instance whose RemoteControlClient information is available
to RemoteController objects, only when it also has audio focus.

This change removes the condition on audio focus ownership:
- whenever the player record stack ordering changes, no need to
check if it also has audio focus
- since the player record and audio focus stacks operate separately,
there is no need to synchronize access to both stacks.

Change-Id: I668f2aa2950f19f8c2a30bc59c7352246edcc56e
/frameworks/base/media/java/android/media/MediaFocusControl.java
dda1c4040c034af14f21e54b1271e20b35620475 26-Mar-2014 Jean-Michel Trivi <jmtrivi@google.com> Continue refactoring MediaFocusControl

Rename MediaController to PlayerRecord.

Change-Id: Icf474b4107649f501341309bf7ec520aa1e71586
/frameworks/base/media/java/android/media/MediaFocusControl.java
7d3168cef2d1db8adf1123b1d3bc4205f8dc926a 25-Mar-2014 Jean-Michel Trivi <jmtrivi@google.com> Continue refactoring of MediaFocusControl

Move RemoteControlClient death handler and remote playback state
inside MediaController class.
Make MediaController data fields private. Document which accessors
can be removed once the audio focus and media button receiver
mechanisms are dissociated.

Change-Id: Icd14fb0d99bf74512c8f8552d124c0353ce1f06d
/frameworks/base/media/java/android/media/MediaFocusControl.java
223fd631f6abb536451d2db8935d314cf4fa399c 24-Mar-2014 Jean-Michel Trivi <jmtrivi@google.com> Continue refactoring of MediaFocusControl

Close external access to MediaFocusControl event handler.

Change-Id: Id82718399806c246b5ac2cb3b49189286dcd8e89
/frameworks/base/media/java/android/media/MediaFocusControl.java
de23f5636010143938e143809b70c28ab15aa1ef 21-Mar-2014 Jean-Michel Trivi <jmtrivi@google.com> Begin refactor of MediaFocusControl

Extract class that handles each entry in the remote control stack
and move it to another file, MediaController.java.
Rename RemoteControlStackEntry to MediaController as each instance
will not just encapsulate information about the corresponding
(if any) RemoteControlClient.
This is just a CL for the renaming and extraction into a new file
of existing code. Obvious required changes are labelled "FIXME".

Change-Id: Ifbdac1d70e4d279ab175eef03e9d792d44873c51
/frameworks/base/media/java/android/media/MediaFocusControl.java
01fe661ae5da3739215d93922412df4b24c859a2 13-Feb-2014 RoboErik <epastern@google.com> Initial round of MediaSession APIs

This is far from complete but puts the basic components in place
for an app to interact with media sessions.

Change-Id: Icfe313f90ad76ae56badbe42b0e43fc5f68db36f
/frameworks/base/media/java/android/media/MediaFocusControl.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/media/java/android/media/MediaFocusControl.java
320ad9fa1d45322e878496cc1c03137cabf20942 14-Nov-2013 Jean-Michel Trivi <jmtrivi@google.com> Fix RemoteController update in RemoteControlClient registration

A regression was introduced when trying to limit the number of
internal synchronization generation IDs that caused RCC
information to be shown only for applications that requested
audio focus after media button receiver and RCC registration,
(such as Play Music), not for applications that requested focus
first (such as Play Movies).
The correct behavior is to always check and update the
RemoteControllers (seen by MediaFocusControl as RCD interfaces)
whenever a RemoteControlClient is registered (even if it's a
re-registration) when it is associated when an entry at the top
of the remote control stack.

Bug 11657655

Change-Id: I30716e2028f7f718a31e13401b191178735229ff
/frameworks/base/media/java/android/media/MediaFocusControl.java
0b605349176e8667c52cf75ccdd33ed63398c224 23-Oct-2013 Jean-Michel Trivi <jmtrivi@google.com> Limit RemoteControlClient generation ID changes

At the beginning of each song, the Music app re-registers its
media button event and requests audio focus, which causes
the reevaluation of each corresponding stack of clients. Each
reevaluation is accompanied by the incrementation of the
RemoteControlClient generation ID, which causes RemoteController
to issue a notification that the client has changed. The lockscreen
correctly interprets this as a reason to dump the current
RemoteControlClient data (including the artwork) because it will
receive the new data if new one is available. This is what causes
the "flashing" of the wallpaper on the lockscreen: for an instant,
no client data is available.
The fix consists in not causing the client generation ID to be
incremented when registrations don't cause any change in the
RemoteControlClient stack. Even though Music re-registers everything,
nothing has changed: it still is the current media button receiver,
and it still has the same RemoteControlClient.

Bug 11307382

Change-Id: I4d2404b571e88aeedb0eca6bd19d39f7ec4fc8b1
/frameworks/base/media/java/android/media/MediaFocusControl.java
19566543c4833f50e7c22aff0c707388f8a338d2 08-Oct-2013 Jean-Michel Trivi <jmtrivi@google.com> Update RemoteController info when enabling/disabling it

When a RemoteController listener is disabled: send its listener
"blank" information (no artist, "stopped state"...)
When a RemoteController listener is enabled: have the current
RemoteControlClient send the current information.

Bug 8209392

Change-Id: I375bf3c42a425ada94c61453b51669d7e819dde4
/frameworks/base/media/java/android/media/MediaFocusControl.java
f108cdd9ee5efe354d87edd02a07b323298c116c 28-Sep-2013 Jean-Michel Trivi <jmtrivi@google.com> 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
/frameworks/base/media/java/android/media/MediaFocusControl.java
86142da1ce8c1341404a9f9e21be8acbcba69ab3 29-Sep-2013 Jean-Michel Trivi <jmtrivi@google.com> Improve RemoteControlDisplay registration

When a new RemoteControlDisplay gets registered, don't cause all
existing RemoteControlDisplays to re-receive RemoteControl
information they already have.

Bug 8417073

Change-Id: Icc8e7104d6870f748fddd702692789dbaef948ac
/frameworks/base/media/java/android/media/MediaFocusControl.java
a83487e8c618f3c267c3fe3a72d4eb9f1388d07e 18-Sep-2013 Jean-Michel Trivi <jmtrivi@google.com> Public API for RemoteController

Public API, under system|signature permission for access to
currently playing metadata and playback state.
Public API for sending media key events.

Bug 8209392

Change-Id: I39b9309ca3fb1bc305492bad98740df0ae0842b2
/frameworks/base/media/java/android/media/MediaFocusControl.java
7ddd226e7c6e759feaf2747a90be1cc06acf37a3 02-Sep-2013 Jean-Michel Trivi <jmtrivi@google.com> RemoteController class to expose IRemoteControlDisplay features

Wrap all the features of IRemoteControlDisplay.aidl in a
new class, RemoteController, that implements the
IRemoteControlDisplay interface.

The API functions to expose in the SDK are tagged with
"CANDIDATE FOR API"

Bug 8209392

Change-Id: I597bcd503ac93e73889c9ae8b47b16c4fcb363bc
/frameworks/base/media/java/android/media/MediaFocusControl.java
88183e67d4628e8c8a3310af0076b6f33f955cb2 07-Sep-2013 Jean-Michel Trivi <jmtrivi@google.com> Revise new public API for ratings in RemoteControlClient

Refactor RemoteControlClient.MetadataEditor to move functionality
in new abstract class MediaMetadataEditor, so it can be also
used on the "display" side of the RemoteControl functionality.
Compatibility of these changes has been tested against
existing Play applications which use the RemoteControlClient API.

Move the new constants and method definitions related to the
ratings feature to MediaMetadataEditor. This changes the
yet-to-be-published ratings API, so this doesn't break
compatibility.
Rating feature is handled by the new Rating class with a set
of constructors that handle the different rating models.

Bug 8440498

Change-Id: I9b6dc2204bfc48594bad5cd6449d357f8a485da0
/frameworks/base/media/java/android/media/MediaFocusControl.java
f823fc4dba2df5cf5f00e13361f2db93c81f6961 20-Aug-2013 Jean-Michel Trivi <jmtrivi@google.com> Ratings for RemoteControl

Add support for metadata of a RemoteControlClient that can be
updated:
- methods to control which keys can be edited,
- interface for an application to receive new values for a key.

Add definitions for ratings.
A rating is:
- a value between 0 and 100
- or a value indicating there is no rating
For a same piece of content, a rating can come from:
- the user
- "others" (i.e. not the user), to provide an average rating
Rating styles are:
- heart (a toggle)
- thumb up / down
- stars (with a configurable maximum number of stars)

Rating by user is editable metadata.

Bug 8440498

Change-Id: I1d45972f9ace4cb505ee0757e917f1d5dedd264e
/frameworks/base/media/java/android/media/MediaFocusControl.java
55e1bc6c58bbb7d08b8a197322dc1afbab9866a2 06-Aug-2013 Jean-Michel Trivi <jmtrivi@google.com> Event handler should be private in MediaFocusControl

Change-Id: I034224d42a3cfed8c49bfee55b332068796f9977
/frameworks/base/media/java/android/media/MediaFocusControl.java
73673ab7988adc80fc179e9910c7a19fcabef884 06-Aug-2013 Jean-Michel Trivi <jmtrivi@google.com> Reorder and comment MediaFocusControl code

Change-Id: Iacc03a7233789bd1588e9f7d2ca5df10a756fb0d
/frameworks/base/media/java/android/media/MediaFocusControl.java
3523a06375ab3fa1037eef23f2a6edaef2163c62 01-Aug-2013 Jean-Michel Trivi <jmtrivi@google.com> Remove outdated comment in MediaFocusControl

The stream type is used in audio focus to better deal with
RemoteControlClient/Display in the case of notifications
during media playback. This comment is therefore outdated.

Change-Id: Ifa33bc4c0fbf065d8288ff5fdfaf1bc67b2a337e
/frameworks/base/media/java/android/media/MediaFocusControl.java
2380566debfc57eb1cc07db1306ccee23b84ddd4 31-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> Notification muting conditional to exclusive audio focus request

Summary of feature:
Do not mute notifications when speech recognition recording is
active, but when an app has requested audio focus with
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE.

Implementation:
Move definition of AUDIOFOCUS_NONE to AudioManager where other
audio focus codes are defined.
Add support for querying the current audio focus type.
When audio focus is requested as GAIN_TRANSIENT_EXCLUSIVE, make
the corresponding loss by LOSS_TRANSIENT.
Before playing a notification, check whether GAIN_TRANSIENT_EXCLUSIVE
has been requested.

Bug 8251963

Change-Id: I41edc77326b70639d2fdcb4642c53109995b72a8
/frameworks/base/media/java/android/media/MediaFocusControl.java
cbb212ff6f06b004ae19dfb6958ee3852716bbdc 31-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> Focus gain sends focus loss through the focus stack

When a new focus owner lands on the stack, don't just make the
previous top of the stack lose focus, propagate the loss throughout
the stack.
Only dispatch focus loss on focus loss state change
Remove canDispatchFocus() method as it now doesn't need to be known
(and shouldn't be known) outside of the implementation.
Fix error where the focus code for a focus gain request should
always be a focus loss code.

Bug 8315302

Change-Id: I92c8f51fdcc090851d34d00fefed916e25da40c1
/frameworks/base/media/java/android/media/MediaFocusControl.java
83283f23eb1b7c1576e253c644b8aade6f657d0a 30-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> Audio focus request managed by FocusRequester class

Move all audio focus request functionality under a new class/file.
Clean up encapsulation of data related to the request.

Change-Id: I989796e1ee1a5fc99799a64e1612294e0e40fa6d
/frameworks/base/media/java/android/media/MediaFocusControl.java
00bf4b18173b8921d7a5cecbd8b8d3745470b5d0 27-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> More refactor of audio focus, keep track of focus loss

Move more audio focus-specific functionality into the class
representing each audio focus owner, FocusStackEntry.
Keep track of how each FocusStackEntry instance lost focus.

Change-Id: I35df0717765a26ec747cb0110e2e951d155d1525
/frameworks/base/media/java/android/media/MediaFocusControl.java
caa2c5bba82d3a515b1bb2830556a89299b2ccd0 24-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> More info in audio focus stack entry

Add fields in an audio focus stack entry to track what type of audio
focus was requested, and why it was lost.
Make audio focus dump easier to read.

Change-Id: I61f6e43c13a32328a07125a2ba0dce1053872c86
/frameworks/base/media/java/android/media/MediaFocusControl.java
2352228ff185722c62c95a64fdf0896603e19dc8 23-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> Merge "Launch voice-based searches as current user"
f47634edfe08fcebbf564a5df12a0a96906032c3 03-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> Fix dump formatting of RemoteControlClient playback state dump

Take into account the two types of undefined plyback position.
Only use "ms" unit when there is a position to write.
Fix misplaced ",".

Change-Id: I5033ec6ee7480f1ac525af7b7b0a9da259614783
/frameworks/base/media/java/android/media/MediaFocusControl.java
dcd40c0e57649ffbdb41c774aa6493648e1ac2b5 23-Jul-2013 Jean-Michel Trivi <jmtrivi@google.com> Launch voice-based searches as current user

Launch the voice-based interactions (voice search, web search) as
the current user.

Change-Id: I5a038feea24346c3c94f86097f574ffdc499cf60
/frameworks/base/media/java/android/media/MediaFocusControl.java
fa9a69805b001034aa04c3b33989a7ac21522371 28-Jun-2013 Jean-Michel Trivi <jmtrivi@google.com> Refactor for audio focus, remote control, media button handling

Extract audio focus, remote control and media button handling
outside of AudioService without any changes in functionality.
Moving logic to new class, MediaFocusControl.
Introduce interface for managing volum control logic, VolumeController.
The VolumePanel class implements this interface.

Change-Id: I72bda2e0670c26e61ff076fd729c15f9f1156dc5
/frameworks/base/media/java/android/media/MediaFocusControl.java