History log of /frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
21c23e30b434ba23aa489f89f94a32b77c46e35a 17-May-2018 Jaewan Kim <jaewan@google.com> Differentiate MediaController in a process for MediaSession

MediaSession#getCurrentControllerInfo() can have more fine grained
differentiation for multiple MediaController in a package/process

Bug: 79728675
Test: Run CtsMediaTestCases
Change-Id: I81e94736e795ee5e7fbd28cb6cd834cc3a3b8f98
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
77748b623c893f3c11714580d1a99fae934185ff 03-May-2018 Jaewan Kim <jaewan@google.com> MediaSessionService: Provide caller information for media key events

Current limitation is that we cannot distinguish between key events
from Window#injectInputEvent() and key presses from physical devices.

Bug: 79185725
Test: Manually verified with the test app, and Cts
Change-Id: I1c3da4a963238512eec8b57fbc2d825c7436b140
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
b1e344eaab519aa9bc9db20c891831dfe2bf92ab 22-Mar-2018 Hyundo Moon <hdmoon@google.com> MediaSession: Create getCurentControllerInfo()

Bug: 65739365
Test: Ran MediaControllerTest
Change-Id: I05c9179546d826e8fabb4fd4e4e03837dd4685ff
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
fa85b603ef2a89c985647e3395caa4467e0aab63 10-Oct-2017 Jaewan Kim <jaewan@google.com> Set the global priority session immediately after its flag is set

The MediaSessionService has set the global priority session only after
the session becomes active for the first time.

From the bug reports, com.android.settings (shares the UID with the
global priority session) made sound before that. So the global priority
session became the media button session before the service handle it
specially.

This CL fixes the issue by moving the global priority session
immediately after the FLAG_EXCLUSIVE_GLOBAL_PRIORITY is set.

Bug: 67322829
Test: Run CtsMediaTest and CtsMediaHostTest.
Also did the manual test described in the issue.
Change-Id: Iea9543b00a783b32dbc26f682d2352068c69e413
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
739d6c23d36b95f2ac5e466a119829384fcfd4e4 18-Sep-2017 Hyundo Moon <hdmoon@google.com> Prevent system crash when adjusting volume with illegal direction

The system process crashes when any of below methods is called with
illegal direction argument:
- MediaController.adjustVolume()
- AudioManager.adjustVolume()
- AudioManager.adjustSuggestedStreamVolume()

This CL fixes the crash.

Bug: 65755677
Test: Added test methods to CTS. Passed the tests.
Change-Id: I2fbf0459465c75e515110e1300630bda15e4a19e
(cherry picked from commit 153613263e5afbfa8f73717b5e903b4f2a6f7298)
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
39f479fe7e35028663e9663a9684a5d3600e8198 08-Jun-2017 Sungsoo <sungsoo@google.com> Fix the finding logic of MediaButtonSession

When we find a media button session with the given UID, we should
ignore the sessions whose playback state is not set.

Bug: 62373831
Test: passed CtsMediaTestCases
Change-Id: I484c888c5bdbceb85dd4524c1353906efc0c4f02
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
83c4635e12a18ede60a792795a7e2b7e9c1b90c9 30-Mar-2017 Jaewan Kim <jaewan@google.com> MediaSessionService: Clear calling identity for incoming calls from apps

This only clears calling identity if MediaSessionRecord calls
APIs of MediaSessionService.

Bug: 36682559
Test: Run CtsMediaTest (MediaSessionTest and MediaSessionManagerTest)
and Manual test (Checked that a media app that changes the active
state and supports cast doesn't crash)
Change-Id: Ia4a441b692ea7da606b1bafbe9a6c3f8fd690518
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
3e5a34ea8e90e013c7edd39675746130a6eea954 04-Apr-2017 Sungsoo <sungsoo@google.com> Revert "MediaSession: Add methods for setting shuffle and repeat modes"

This reverts commit ba11085635ea3ef9383b34dd44c43f2a6cd832ff.

Bug: 36844917, Bug: 36525228, Bug: 36525325
Test: Pass MediaSessionTest and MediaControllerTest
Change-Id: I4805ea58107b5fab8c9f5f0fcaffd1e0e4882ed8
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
7066c9e446bb626804789ac29f0e494aaf94f1bf 04-Apr-2017 Sungsoo <sungsoo@google.com> Revert "MediaSession: Add methods for queue managements"

This reverts commit 99c1f9f453b3b589b3f8f2c32ea4f947e309c089.

Bug: 36844917, Bug: 36524925
Test: Pass MediaControllerTest
Change-Id: I39425fd5f301e7825d6eab7c01ba94be2185ad01
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
0c1d448d1de41350080e7cae05728904f0121387 28-Mar-2017 Dongwon Kang <dwkang@google.com> MediaSession: clear identity before accessing service methods

Test: build and manually verified the issue is fixed.
Bug: 36669550
Change-Id: I44eda4e2fb08dd9aa6972b12ed4c4e82797ff587
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
92dea33bfebed04533264b06e036d04cc16b9608 02-Feb-2017 Jaewan Kim <jaewan@google.com> Simplify the media button handling logic

Here's the new media handling logic.

1. If the foreground app consumes the media key event
(Activity.onKeyDown/Up() or Activity.setMediaController()),
we stop here.
2. Find the media app whose AudioPlaybackConfiguration becomes
PLAYER_STATE_STARTED lastly across the boot. The media app is the app
with the media session.
- If its session is still alive, send the media key event
to the media session.
- If its session has been released but the session set the media
button receiver, send the media key event through the media button
receiver.
- If it has multiple media sessions, pick the media session whose
PlaybackState matches with the AudioPlaybackConfiguration's player
state.
3. Stop here. Don't try revive any other app.

This approach has two limitations.
1. If an app has multiple AudioPlaybackConfigurations and/or
media sessions, the MediaSessionService may pick the wrong media
session to send media key events.
2. If an app with a media session plays sound effects differently from
the SoundPool class, the MediaSessionService would consider the app
as the lastly played media app.

Bug: 33032080
Test: Manual tests as follows
1. Checked that the lastly played app receives the media key events
although the app's media session doesn't report its playback state.
2. Checked that the lastly played app receives the media key events
although the app's media session is released.
3. Checked that the lastly played app doesn't receive the media key
events if its playback is remote.
Change-Id: I1fd6f9eee0750da4dea9fcc7401fdb1c3f249a72
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
742e379863ff08a880cb6d9e5f274da7589f9a53 22-Mar-2017 Jaewan Kim <jaewan@google.com> Revisit logging in MediaRouter and MediaSessionRecord

This limits excessive logs from MediaRouter and MediaSessionRecord
- MediaRouter: Leave log only if there's change in the audio route.
- MediaSessionRecord: Leave log for the controller callback instead of
dumping verbose stack traces.

Bug: 36497125
Test: Manual test
Change-Id: Ie0fe9f33388d1aa9f25c26b3b3f7c71fec409ba8
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
99c1f9f453b3b589b3f8f2c32ea4f947e309c089 30-Nov-2016 Sungsoo <sungsoo@google.com> MediaSession: Add methods for queue managements

Bug: 30203831
Test: Passed MediaControllerTest
Change-Id: Ibc33572d21bd83d47660be8f41173b9cea206015
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
934a526e6823888fe6e51aa48e77e058eb2c137e 12-Sep-2016 Hyundo Moon <hdmoon@google.com> MediaSession: Rename methods related to shuffle mode

This CL remames following methods:
- MediaController.getShuffleMode() -> isShuffleModeEnabled()
- MediaController.TransportControls.setShuffleMode()
-> setShuffleModeEnabled()
- MediaSession.setShuffleMode() -> setShuffleModeEnabled()
- MediaSession.Callback.onSetShuffleMode() -> onSetShuffleModeEnabled()

Change-Id: Ifb1ef5b5355ddec60c3e9e84d53eb4ead4671b4f
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
ba11085635ea3ef9383b34dd44c43f2a6cd832ff 16-Jul-2016 Sungsoo Lim <sungsoo@google.com> MediaSession: Add methods for setting shuffle and repeat modes

Bug: 27317954
Change-Id: Ie83b25f40dd84e5b521a186077f23d343314201a
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
8f729087dfde6b1ceb6a451a5950e80176a7da2d 20-Jun-2016 Jaewan Kim <jaewan@google.com> MediaSessionService: Support managed profile

Bug: 22128930
Change-Id: Ied9761a36525996d2e494fd679499932df7069c0
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
1ea56832178b40ce5a54ee77e6a01108496dc6e9 23-Feb-2016 Donghyun Cho <donghyun@google.com> MediaSession: Add a way to get a calling package

Introduced a new method, MediaSession#getCallingPackage(), which returns
the name of the package that sent the last media button, transport
control, or command from controllers and the system.

Bug: 25208121
Change-Id: I90bc1fe3e5e432f6c95b4adfbef6ea6cea9244ff
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
22188f118754c3b31c13d2f94daf718f111d92af 02-Feb-2016 Donghyun Cho <donghyun@google.com> MediaSession: Add new methods for preparing media content

Introduced new methods for preparing media content: prepare,
prepareFromMediaId, prepareFromSearch, and prepareFromUri. These methods
allow MediaSession prepare media content rather than play
it. MediaSession will set up a queue or buffer their content during
these preparing requests.
The constants, FLAG_HANDLES_PREPARE_ONLY and EXTRA_PREPARE_ONLY, are
removed because the introduced methods can replace them.

Bug:25841735, Bug:25153060, Bug:25153353
Change-Id: I8fa2097c98fe2fba92b267d2865a9b75d118af09
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
30be970a8ecd984ace75354e00a8d969577d18e9 26-Nov-2015 Insun Kang <insun@google.com> MediaSession: Improve MediaSessionStack logic

There was an issue that media button events (play / pause) didn’t go
to the expected media session. If an app creates a media session during
all media sessions are paused, the next coming media play event is
consumed by the newly created media session. It makes sense in general,
but if the media session is created in a background process without any
visible UI, it causes unexpected results.

This patch resolves the issue by checking if a newly added session comes
from the most recent user-facing app.

Bug: 24990104
Change-Id: Ic9632bced37bffd28260afe3523d9a20ea4d3c21
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
500747bf8fe4785b0e875b971b547723c35301f9 21-Jul-2015 Dongwon Kang <dwkang@google.com> MediaSessionRecord: do not hold a lock when calling AudioSystem.isStreamActive

AudioSystem.isStreamActive() includes a blocking IPC, so it shouldn't be called
in MSR.adjustVolume() which is called from MediaSessionService while holding a
lock.

Bug: 22606983
Change-Id: I3ab94e73731176d9bf80dbc2121702025547114c
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
d2a8d71ce0eeb14034ec779a00e5ff6a0e173fb4 17-Jul-2015 Jae Seo <jaeseo@google.com> MediaSession: Do not lock on AudioManager.getStreamVolume

Locking on AudioManager.getStreamVolume method causes watchdog killing
system process for it makes a native call to get devices for stream,
which takes time. This change removes such locking.

Bug: 22404242
Change-Id: I23de3efe33642341205d65f58bc5b74542f1f506
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
a38e1f4ed997bea3cbfbf8094a52c23570d59d2a 17-Jun-2015 Dongwon Kang <dwkang@google.com> Make MediaSessionService not blocked by AudioService.

Backgroud: As noted in b/20823981, MediaSessionService calls some
audio service methods while holding a lock and the audio service
methods also talk to other system services. And, deadlock happens when
the other system service fires another request to MediaSessionService
while holding its lock.

Example1) --- resolved by the change in MediaSessionRecord.java
T1: MediaSessionService.dispatchAdjustVolumeLocked()
-> MediaSessionRecord.adjustVolume()
-> +++AudioServiceInternal.adjustSuggestedStreamVolumeForUid()+++
-> AudioService.adjustSuggestedStreamVolume()
-> telecom.TelecomManager.isInCall() --- blocked by lock in TelecomManager.
T2: telecom.ConnectionServiceWrapper.handleCreateConnectionComplete()
-> MediaSession.setActive()
-> MediaSessionRecord$SessionStub.setActive()
-> MediaSessionService.updateSession() --- blocked by lock in MediaSessionService.

Example2) --- resolved by the change in IAudioService.aidl
T1: MediaSessionService.dispatchAdjustVolumeLocked()
-> IAudioService.adjustSuggestedStreamVolume()
-> AudioService.adjustSuggestedStreamVolume()
-> telecom.TelecomManager.isInCall() --- blocked by lock in TelecomManager.
T2: telecom.ConnectionServiceWrapper.handleCreateConnectionComplete()
-> MediaSession.setActive()
-> MediaSessionRecord$SessionStub.setActive()
-> MediaSessionService.updateSession() --- blocked by lock in MediaSessionService.

Here, this change prevents the deadlock by making related audio IPC oneway
and calling the internal audio method without holding the lock.

Bug: 20823981
Change-Id: I4c4b2fc796f23d83be67f7edaacd7496c145d985
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
c05c1aeedf44b7019b6749758dffc03df7632225 05-May-2015 Jeff Brown <jeffbrown@google.com> Revert "Initial draft of new MediaRouter APIs."

This reverts commit 1a937b04e63539cb1fab1bde601031d415c7156f.

Bug: 20641986
Change-Id: I035d945d1561e5fc7c914aa9362635f763c83cfd
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
c2045470a343923b0d74ddbd6a6b80fcf6652d66 25-Mar-2015 P.Y. Laligand <pylaligand@google.com> Added MediaController.TransportControls#playFromUri.

b/19622238

Change-Id: I75d6258ccafb2266d5f8bdf3a279b3a2e9ef2bbf
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
bfa98599b79b2d48209d5ab79055d5ac599c7f04 10-Mar-2015 John Spurlock <jspurlock@google.com> MediaSession: Notify PlaybackInfo callbacks when playback type changes.

Bug: 19665979
Change-Id: I506a71330ca04a678027f5969638fd1685326b2d
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
ee5ad729b90deff435f9875337cbc434be4f8fe7 03-Mar-2015 John Spurlock <jspurlock@google.com> Audio: Remove the concept of master volume.

- Remove two config resources (use master volume, and volume ramp).
- Remove master volume adjustments / getters / intents.
- Retain @hidden setMasterMute, needed for device admin
- Remove master volume logic in AudioService.
- Remove master volume logic in VolumePanel.
- Rename "getMasterStreamType" to "getUiSoundsStreamType" to avoid confusion.

Bug: 19582978
Change-Id: Id02c8fa4898cff3b913147f5ac1b4038e2e7cc24
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
4197cb60bc74629fe4c04ab10cb3b1c9a7427d24 22-Jan-2015 RoboErik <epastern@google.com> Move mute/unmute handling to adjust volume paths

This deprecates the setStreamMute and setStreamSolo APIs. Soloing is no
longer supported and muting is redirected through the adjust volume APIs.

Also updates the hidden master versions of these APIs.

Change-Id: I65d2a5d5fc15b386bd497abf8ca6869fec75a26a
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
864c4f42f8e3a653a66e406b4c5d70d52a1dc30e 17-Jan-2015 RoboErik <epastern@google.com> am b2949e1b: am 694940be: am d5ff63ba: Merge "Notify the system of all remote volume changes" into lmp-mr1-dev

* commit 'b2949e1b957e8b74980a2c3124e834d13f53f29d':
Notify the system of all remote volume changes
9c5b7cb048699237b35dad7a2a634ed6efb997c7 16-Jan-2015 RoboErik <epastern@google.com> Notify the system of all remote volume changes

If a volume change occurred because it was sent through the MediaController directly
it wasn't showing the system's volume UI. This fixes things so the volume slider gets
shown for all volume requests with the SHOW_UI flag set.

bug:19036130
Change-Id: I1f7cb2e03386e2f3f7bc448cb4c38a71573775ff
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
2610d71251e3e376e2514f20986c81e5d55f1b55 07-Jan-2015 RoboErik <epastern@google.com> Don't unmute when trying to show volume UI. DO NOT MERGE

When a MediaSession is active the adjust volume event to show UI was
causing the stream to be unmuted. Since this happens after every mute
event you were unable to mute while a session was active. This change
doesn't unmute for events that just show the UI.

bug:18844550
Change-Id: Ic8b0f1ab1354646724ead4572a973c302c275eab
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
2b94d589c8ada05392d6fffe9c7118f685409c50 07-Jan-2015 RoboErik <epastern@google.com> Don't unmute when trying to show volume UI

When a MediaSession is active the adjust volume event to show UI was
causing the stream to be unmuted. Since this happens after every mute
event you were unable to mute while a session was active. This change
doesn't unmute for events that just show the UI.

bug:18844550
Change-Id: Ic8b0f1ab1354646724ead4572a973c302c275eab
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
2a38b6913fd28553abab67dfa0cfed7cabed6efa 20-Dec-2014 Eric Laurent <elaurent@google.com> am a1bd2d00: am 1ed9a88e: Merge "MediaSession: unmute stream when adjusting volume" into lmp-mr1-dev
automerge: 6d1cb48

* commit '6d1cb48da45f70c2e8f73277bfb219e80a329778':
MediaSession: unmute stream when adjusting volume
2b5208c3583b5fd82564523bfd9e85b4bf44afa0 19-Dec-2014 Eric Laurent <elaurent@google.com> MediaSession: unmute stream when adjusting volume

Bug: 18482488.

Change-Id: I3411f78551cba31aa7f91b5223e015f0b8c1bbb2
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
9053ce8c20ca25d1e0b7472c0198ba3bb8c63317 09-Dec-2014 RoboErik <epastern@google.com> am b22eea72: am 2d7a1b09: am d386d0f3: Merge "Route mute key events through MediaSessionService" into lmp-mr1-dev

* commit 'b22eea724b4f1d1ccbb1fd7ddd2eb3d9eb3204c8':
Route mute key events through MediaSessionService
7c82ced4fc5b66c09a19eed9a5499039530142fb 05-Dec-2014 RoboErik <epastern@google.com> Route mute key events through MediaSessionService

This sends mute keys to the MediaSessionService and handles them
by toggling the appropriate stream. Muting remote playback is still
not supported.

bug:17501993
Change-Id: I18c5b037cde2175acbb64b118dd708514acfd8c9
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
24228295e23ca60040d9b5ffa5491f1d2fc64fb7 21-Nov-2014 RoboErik <epastern@google.com> am 3ef3a9bf: am ac4af18b: Merge "Handle volume events on master volume devices correctly" into lmp-mr1-dev
automerge: bbf0f66

* commit 'bbf0f662a8a54e6c8c49a58b7a7273fe8756ff45':
Handle volume events on master volume devices correctly
519c7744b522aa07e12bc3244ac3de14aa2a4ad0 18-Nov-2014 RoboErik <epastern@google.com> Handle volume events on master volume devices correctly

We weren't passing volume events to the master volume correctly on
devices that only use a master volume. This fix checks if the device
only has a master volume and adjusts the master volume instead of the
stream's volume if that's the case.

bug:18305790
Change-Id: Iec35e0a7dc59e6d73c9dfc88da324660bb15b1f3
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
fd44643cf243eb2f348abdc8af8543e688e453c9 16-Oct-2014 RoboErik <epastern@google.com> am a56d6c31: am 5e1b92c0: am 56d8876f: am 0dfd86e0: am c7be69f1: Merge "Don\'t call size on a null metadata" into lmp-dev

* commit 'a56d6c3192ad7f4cf9664bb56821abd447362f79':
Don't call size on a null metadata
421c9df7ff52f8c43fd5356a59702931f39dc029 15-Oct-2014 RoboErik <epastern@google.com> Don't call size on a null metadata

bug:18002951
Change-Id: I3a2d2c781e7b235efbd8518d60eee7f44bbacd75
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
fb17acf432461c643ded45979ec2aa8d84efeb65 10-Oct-2014 RoboErik <epastern@google.com> am ee512f51: am d9be933f: am 51ff1c93: am f9122232: am a78601dc: Merge "Ensure metadata bundles are unparceled before making them available" into lmp-dev

* commit 'ee512f515fd0f7e36c5f9b78b8645d114dfc03db':
Ensure metadata bundles are unparceled before making them available
82df2c0839876d158889ea0e28e6f3adf0d4797d 08-Oct-2014 RoboErik <epastern@google.com> Ensure metadata bundles are unparceled before making them available

Bundles can't be read from multiple threads safely. This adds locking
around a read that had been previously overlooked and ensures that
unparcel is called on the metadata before it is even available to
other threads.

bug:17894033
Change-Id: I9a4b86a0d0af05b1dcba28a52df2e7a87c685704
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
583c6940d51dbd57bc200cecbd302ae5e7cf2279 01-Oct-2014 Jean-Michel Trivi <jmtrivi@google.com> am 40a47f6d: am 4b495477: am 9f1bca5f: am 0ed179d1: am 4a154af9: Merge "Send volume keys to the default stream if not actually playing" into lmp-dev

* commit '40a47f6dd7413e19c34869be17b029051c3b8d25':
Send volume keys to the default stream if not actually playing
4e7f4d8330a977f7603c8adc808144ce65512cd4 30-Sep-2014 RoboErik <epastern@google.com> am ce1a588e: am f614ecff: am 80aa626e: am a65a4f64: am 9eef5bf8: Merge "Be more paranoid about threading in MediaSessionRecord" into lmp-dev

* commit 'ce1a588e60517cfdb6fba0ba099348be48040b1e':
Be more paranoid about threading in MediaSessionRecord
165809b33198cd3926cc11e8cbc96b671d4c87d3 29-Sep-2014 RoboErik <epastern@google.com> Send volume keys to the default stream if not actually playing

This ensures that we'll only adjust volume on a session's stream if
that stream is actually in use.

bug:17690423
Change-Id: I5fce8265a015bbc5034afa16719d9a0bbf257598
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
df382cada180033e5bbde82998b73ef19e541ed2 29-Sep-2014 RoboErik <epastern@google.com> Be more paranoid about threading in MediaSessionRecord

This makes copies of objects with bundles before posting to another
thread and is more aggressive about locking before making assignments
of mutable objects.

bug:17692568
Change-Id: I28e8229718b862c485e870fd2ca06a3a18a7c454
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
d6bd213edca9d242854b5d2ef6d9f90472652222 05-Sep-2014 RoboErik <epastern@google.com> am e23b2ca8: am 8466b902: am 509d0b4e: Merge "send volume button events to adjustSuggestedStream instead of adjustStream" into lmp-dev

* commit 'e23b2ca8048927dc88aea2f2d832a50b7cbb8e06':
send volume button events to adjustSuggestedStream instead of adjustStream
272e161c1a200900cb10b5b0cdab8ae1f123cabd 05-Sep-2014 RoboErik <epastern@google.com> send volume button events to adjustSuggestedStream instead of adjustStream

This way the audio system can route the adjustments correctly when a bt
headset is connected.

bug:17281977
Change-Id: Ic41d038e47179baffc86e539562da285446148c7
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
b2f57cfd04e6c35a130028534500a875f1307bbb 03-Sep-2014 RoboErik <epastern@google.com> am a241a83d: am 720c772a: am d5ceabd3: Merge changes Id38bcf7c,I54f156d9 into lmp-dev

* commit 'a241a83d18530d3bb9010a36f8cc89e50ad20c7b':
Update MediaController comment to mention notification listeners
Don't play a sound when adjusting volume while telephony is active
7a18cb5672127bf12c8edac8a327f9b706b79ff7 03-Sep-2014 RoboErik <epastern@google.com> Don't play a sound when adjusting volume while telephony is active

bug:17106215
Change-Id: I54f156d91440ce777e5a4d473cdd47927479d084
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
d133303a5c3eaddcc5dd5b01f03916d754efaa8a 29-Aug-2014 RoboErik <epastern@google.com> am ab716047: am 86e941e6: am a70def9e: Merge "Update to MediaBrowser APIs per council feedback" into lmp-dev

* commit 'ab71604780c4cccf238e1c78b7b05310c4a49583':
Update to MediaBrowser APIs per council feedback
3625bf72cb8bcf3c7f8f8cd8d708d7206824cc62 28-Aug-2014 RoboErik <epastern@google.com> Update to MediaBrowser APIs per council feedback

Does all the updates in the bug except the loadIcon/loadBitmap
methods, which are removed per feedback from Sharkey.

bug:17205016
Change-Id: Ie84d4d25a59c6985ce16972c26c8d1e5c02ff5c9
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
6b171b36f87268cd954f753458c06704fe30d8bf 21-Aug-2014 RoboErik <epastern@google.com> am 666360cb: am 8961b5d5: am 7a754ab3: Merge "Api updates to MediaSession components" into lmp-dev

* commit '666360cbe70a3c482b16a0fd438a3f10d0fcf643':
Api updates to MediaSession components
d2b8c947ddfc6349a3ae6c3968b422b9cf50d7ed 19-Aug-2014 RoboErik <epastern@google.com> Api updates to MediaSession components

-renames get/setBufferPosition to get/setBufferedPosition
-renames getLaunchActivity to getSessionActivity
-adds doc link to setVolumeTo flags param
-renames setLaunchActivity to setSessionActivity
-hides setMediaRouter
-moves PLAYBACK_TYPE_ constants to MediaController.AudioInfo
-adds addOnActiveSessionsChangedListener version with a handler parameter
-renames AudioInfo to PlaybackInfo

bug:17114404
Change-Id: I0fbfe4eb979cb2af98e3f13095c654bb131f7ae5
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
b135d06cb83db03b1328b7a82f064de7868fb16f 20-Aug-2014 Jeff Brown <jeffbrown@google.com> Remove incomplete media router API. (DO NOT MERGE)

Change-Id: I310fadafb5a6b8190a32e5d87f3e1823c87bcef7
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
1d2a1c917f46b6854e91f9867a20abb76ecb794d 14-Aug-2014 RoboErik <epastern@google.com> Merge "Pipe caller's identity through volume methods" into lmp-dev
0dac35af2c6aa42bcd181981b041747cfd1afa5f 13-Aug-2014 RoboErik <epastern@google.com> Pipe caller's identity through volume methods

setStreamVolume and adjustStreamVolume were always being called
from the session service's uid/package. This adds the plumbing to
allow the original app's info to be passed in to the audio service
when volume is changed.

Change-Id: Ib36639dab1e518b435161dc453c8ba9351df3e9b
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
24762bffc3358762666079cd802040a316b3260d 14-Aug-2014 RoboErik <epastern@google.com> 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
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
7aef77bbf5b983b9f949936ed6cd174251697ca8 09-Aug-2014 RoboErik <epastern@google.com> Remove sessions listeners that are disabled

Removes sessions listeners when their notification listener is
disabled. Also updates the dump for media sessions.

bug:15549450

Change-Id: Ibe51a4a42ef333e75a09f0fffa0f2b9b8939b85c
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
75847b98f39e521a57042c50e69be9e142788d32 29-Jul-2014 RoboErik <epastern@google.com> 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
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
aa4e23bbb36994708ba72c5f4c83255025d99e07 25-Jul-2014 RoboErik <epastern@google.com> 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
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
b214efbb9170a9f6a4991684a63ca59680074cc7 24-Jul-2014 RoboErik <epastern@google.com> Expose a way to set a PendingIntent for restarting playback

This is to allow apps to set a PendingIntent to restart playback. This
is not persisted across reboots but will allow music to start playing
again for the life of the system. Only the most recent priority app with
a PI set will be cached. This also deprecates methods in AudioManager
that do this and unhides the unregister method in MediaSessionManager.

Change-Id: I66fbf5856333468d8cb8a3022809778ba00d426e
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
e34c09daf89fb888fe2638e71758573462d85173 24-Jul-2014 RoboErik <epastern@google.com> Finish plumbing for launch intents in sessions

This finishes out the plumbing for setting a launchable PendingIntent
on a session and getting it from a controller to launch an app's UI.

Change-Id: I0c9506e7c3f0ebf57070ca7e0d91324eb3fdd1e1
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
f364f944962c4ec66f5e5b33dafe8480f38f6db6 22-Jul-2014 Gabriel Peal <gpeal@google.com> Added Action to PlaybackState

Added the ability to discover MediaBrowsers

Change-Id: I925c8738ac73afd0bee3dada2ee7ff2d5047e63f
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
f0593bc17b61c872ae2d7705fb598c5e5056e679 22-Jul-2014 Gabriel Peal <gpeal@google.com> Added QueueState, playUri, and playFromSearch.

Added QueueState to MediaSession/MediaController
Added play(Uri) and playFromSearch(String) to MediaController.TransportControls

Change-Id: I1a8ad5c22d05015ab6ff5700dc8a758455f1d89b
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
9db9bf7034d7dcdf596dc22d521b18975d0dd2b9 21-Jul-2014 RoboErik <epastern@google.com> Switch Session APIs over to AudioAttributes

The session apis were using audioStream in several places. This
updates them to use AudioAttributes instead.

bug:16403289
Change-Id: Ic4da9ca5fbea2536e80c71503bd9a9bf7f346997
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
1ff5b1648a051e9650614f0c0f1b3f449777db81 16-Jul-2014 RoboErik <epastern@google.com> Change adjustVolumeBy to adjustVolume

This makes volume adjustments take a direction instead of a number of
steps and renames the API appropriately.

Change-Id: I6a31cbc42d889a38aa63446686a424cb2b8b2270
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
c785a78fb483fe54012175c53d3758b2412de7b9 14-Jul-2014 RoboErik <epastern@google.com> Make PlaybackState immutable with a builder

bug:15862252
Change-Id: I51f2e466bd2c41bbe80d20aa9785126a7ac6ab3f
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
1a937b04e63539cb1fab1bde601031d415c7156f 02-Jul-2014 Jeff Brown <jeffbrown@google.com> Initial draft of new MediaRouter APIs.

This patch introduces basic infrastructure for the new MediaRouter
API. The code is fully documented but incompletely implemented.
It is being submitted not to facilitate API reviews.

MediaRouter is a new class that applications used to discovery,
connect to, and control media devices as represented by media
destinations and their routes. Routes may offer a variety of
capabilities. This new class is a much more powerful replacement
for the existing MediaRouter.

MediaRouteService is a base class for creating media route services
which third-parties can implement to make routes available to
applications. It is analoguous to the MediaRouteProvider
infrastructure of the old media router support library but it
is designed to be integrated into the framework and enable a
variety of new usages such as remote display projection.

Stay tuned for more...

Change-Id: I2c7c6013d9f751d71e83697e7fc9e49bf7751fef
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
01a500ed1c6ae3fff66678144ae637aa8cad0ecc 11-Jul-2014 Jeff Brown <jeffbrown@google.com> Delete first draft of media routing APIs.

The new APIs will not be as tightly integrated into MediaSession.

Change-Id: I5cfd37d9d8d0c5d46c55edb5cf0772a8f1ef13ab
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
b2e93efcac593f5f27722219b274bd0fa5c1b0fe 11-Jul-2014 Erik Pasternak <roboerik@android.com> Revert "Make PlaybackState immutable with a builder"

Will resubmit tomorrow for Build Breakage Friday as this change needs new SDK prebuilts for unbundled app branches.

This reverts commit aa746b27610680a2c0fbdf7d81a6455c4597f05e.

Change-Id: I28ba7e1b09234a5eb1b725aed043b9de98e1bc16
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
5a4e01114361b7dad4fc5465b4da00fd444fc098 09-Jul-2014 RoboErik <epastern@google.com> Make PlaybackState immutable with a builder

bug:15862252
Change-Id: I8944b7753cd6a36a74b0091f71a386f77040c4ab
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
3c45c29109d23981d8b707c809b3b43ce2e20fc3 09-Jul-2014 RoboErik <epastern@google.com> Pipe volume keys to adjustVolume instead of sendMediaKeyEvent

We were calling sendMediaKeyEvent with a KEYCODE_VOLUME key, which was being
ignored because it's not a media key. This redirects the volume keys to use
the adjustVolume methods instead. It also sends the appropriate flags to
make the lock screen consistent with the home screen and the volume keys
only affect active playback when the screen is off.

bug:15900519
Change-Id: I9f3853a2385869353a58debae6e6ca9933ba06ce
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
f77b99f08afed6f6b8d8f5bc72978f2ff7b8db55 27-Jun-2014 RoboErik <epastern@google.com> clear calling identity when changing volume

bug: 15925039

Change-Id: I8596266109fd65d7c2de5718ccdda937694befba
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
e9466805e55595ce72c070c73e2fcae46e857850 26-Jun-2014 RoboErik <epastern@google.com> b/15892295 If playback is active don't play a beep

The old code removed the flag for playing a beep when changing volume
with active playback. This will do the same thing.

Change-Id: I708db66a1575d314b941166d4a6ca05d0a796dae
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.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/services/core/java/com/android/server/media/MediaSessionRecord.java
ef3c9e9b057a5aac2d0d012e8e6385660478e203 20-Jun-2014 RoboErik <epastern@google.com> Add volume handling APIs to sessions

This renames and moves the VolumeProvider and adds apis to
MediaController to get the current state of volume on a session and
to request changes to the volume.

Change-Id: I290e9efefb6676c805819a29e1d054c3192c6773
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.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/services/core/java/com/android/server/media/MediaSessionRecord.java
d3c8642dae9a1f6db60e2f8e5c7b32cd1b3169df 16-Jun-2014 RoboErik <epastern@google.com> 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
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
73e23e229dd1a2d25687b1c6a63c708665378e41 11-Jun-2014 RoboErik <epastern@google.com> b/15330955 Make RemoteController use the new session APIs

This moves RemoteController over to using Sessions instead of
the RCC/RCD framework. This also adds several hidden APIs to
help with translating between the two apis.

Change-Id: I0f50313db2b6190b16fa86ce670ac9250654ca05
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
fb442b03840245c7e52cf2a540a77c5fc6c54587 08-Jun-2014 RoboErik <epastern@google.com> Add a way to get the package/pid of the session

We need a package/pid to connect a session to a notification. This
adds a way to get those from the controller of a session.

Change-Id: I7700a341beebd46116dfb7dc82f1a667c718e728
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
b69ffd4dc2c8fa85e0064151141ebeee90de471e 30-May-2014 RoboErik <epastern@google.com> Minimum work to make volume handling work with sessions

This is the minimum change to make adjusting volume work with
MediaSessions. This only affects adjusting the volume and adjusting
the volume with a suggested stream. Adjusting a specific stream or
setting a specific stream will still use the same code.

This does not fix existing remote volume handling in RCC, which
will require a separate change to MediaController.

Change-Id: I5b957ff4bece1ee11e2364e1f216e1c08343c983
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
79fa4630bbca7c6c251eea99fe8997e4b45becee 28-May-2014 RoboErik <epastern@google.com> API changes to sessions

Changes requested by API Council review. A second CL will refactor
TransportController and TransportPerformer based on feedback.

Change-Id: Ie26a7d01d7021232a66c2edf1eb58120437fdfde
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
418c10ca9df1505509afeffd558cd92fc97bc635 19-May-2014 RoboErik <epastern@google.com> Add 5s timeout to wakelock

Also filed a b/15110168 to anr the app if it doesn't finish with the
button event in 5s.

Change-Id: I23906b4c7f17d3d3a29eef92b523d8653c87017e
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
42ea7eecd149161ed192d3029f0d77d1d08a4aa5 17-May-2014 RoboErik <epastern@google.com> Rename session classes to have media prefix, hide routes

This renames several of the core session classes to be prefixed
with Media. It also adds @hide to all route references for now.

Change-Id: Idb42897d490cf24626e4e93ca975b2cb93ec054c
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
8a2cfc309ab9126e90022916967c65a793c034f0 16-May-2014 RoboErik <epastern@google.com> Move media key processing to sessions

Send all media key events over to the MediaSessionService instead
of AudioManager. This does not affect volume handling yet, so it
is possible to get into a state where volume will be handled by
a different thing than media buttons. Except for corner cases
this shouldn't be noticable.

Change-Id: I00a576175d9c82937f0836e509b9a98d5cb77b83
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
4646d288821d62fdfe481be67d8b7fed7d7eabd8 13-May-2014 RoboErik <epastern@google.com> Add UserRecords to separate user interactions

Each user record maintains the list of sessions and providers that
are running under that user. Lifecycle for providers has been modified
to stop discovery when the user is no longer current but keep the
binder connection open so long as there's a session that has selected
a route from that provider. When a user is stopped all providers on
that user will be unbound even if they were still in use.

Change-Id: Iadf1efded3415f7ecf384d3a73513883de9c86b0
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
a5b02329209be355eafadbdf9ee685ffa58d3148 08-May-2014 RoboErik <epastern@google.com> Make sessions aware of user id

This tags all sessions with the user id that they were created for. It
also adds API for creating and querying sessions for a specific user.

This does not wrap providers per user yet which will be done in a
separate CL.

Change-Id: Icdaf701b0614a95301657998602c45208d548c27
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
a8f951462791a16f47e8c07e552232f31dcefac5 05-May-2014 RoboErik <epastern@google.com> Add a class for managing Session priority

Priority is given first to the system priorty session, then to
active local sessions, then to active remote sessions, then to
the rest of the sessions. Ordering within categories is by whoever
last performed an action we associate with the user.

The stack has methods for getting filtered sets of this priority.

This also:
-Changes publish to setActive(boolean)
-Adds a flag for handling media buttons.
-Adds a flag for transport controls instead of enabling once.
-Unhides the setFlags API.
-Updates the legacy helper to use the flags.

Change-Id: I6ebeb27410de1b24149fd6e1785613ac444f0774
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
e7880d8eb1903d42e4e2a90c99b58e2240e01e82 30-Apr-2014 RoboErik <epastern@google.com> Add APIs for creating a system priority session and getting controllers

This adds a hidden call to set flags and a flag for making a session an
exclusive high priority session. This will cause all media button events
to be sent to that session as long as it is stillr egistered. This
requires the MODIFY_PHONE_STATE permission like the old forCalls API.

This also adds a way to get controllers for all the ongoing sessions.
This is protected by the MEDIA_CONTENT_CONTROL permission like the
old RemoteController APIs.

Change-Id: I51540e8dcf3a7dbe02a0f8ee003821e40af653a3
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
66dea73906f24226a6f699759e79040726bde8b5 02-May-2014 RoboErik <epastern@google.com> Add playback state and metadata to dump

Change-Id: I813ff23c496f75776c8bd63f78bbe87683b19bc0
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
6e6a6e863df6cc5e7b930b1197b1f6743ba31d8e 01-May-2014 RoboErik <epastern@google.com> Merge "Add Session API calls to RCC and AudioManager"
f1372428f2df781c71c71caa2f6a4db6f847cf10 23-Apr-2014 RoboErik <epastern@google.com> Add Session API calls to RCC and AudioManager

This makes RCC and MediaButtonReceiver (via AudioManager) also use the new Session APIs in parallel to their existing code. This will allow us to bring up the Session compatibility pieces without disrupting the old behavior and then switch everything over to just using the new APIs when ready.

Change-Id: I33ce0a044dea3ec763f2302b91a5e415be27d4a4
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
a278ea7cecb59a73586e5dd74ec05e85caa370c5 24-Apr-2014 RoboErik <epastern@google.com> Add dump to MediaSessionService

Adds a dump implementation for debugging MediaSessionService. Also
fixes some synchronize calls that weren't using the same lock object.

Change-Id: I14343f853398749c8ce7ebf91f72729abc9132d9
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
07c7077c54717dbbf2c401ea32d00fa6df6d77c6 20-Mar-2014 RoboErik <epastern@google.com> Add RouteProviders to the new Media APIs

Compiles and works with OneMedia. This currently is a rough test of
the system for finding, connecting to, and sending messages to routes.
This will just connect to the first route it finds when a request to
open the route picker is made (and disconnect when another request is
made).

Change-Id: I5de5521a079471b9e02664be4654c0591dfd9a6d
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
8ae0f34db936a649ddaf9cdd086c224f6514efeb 25-Feb-2014 RoboErik <epastern@google.com> Adds a TransportController and TransportPerformer to session

This makes transport controls a primitive interface on sessions with
a way to create the performer, register callbacks, and send commands
and updates between controllers and performers. This still needs some
cleanup but has been tested with OneMedia.

Change-Id: I373d35f7ccc383b8421bd14044457467d80425f3
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.java
2f5b057da7d05d5d699a272aa24fd7c97cdda820 21-Feb-2014 RoboErik <epastern@google.com> Move Session apis to android.media.session

This is to make it easier to distinguish the new apis from the old
ones.

Change-Id: Ic5eaf65e8bd054a844f87b9118c4bb18f30ac8a7
/frameworks/base/services/core/java/com/android/server/media/MediaSessionRecord.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/services/core/java/com/android/server/media/MediaSessionRecord.java