History log of /frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2a28126af931554a8621341149b86cc54773c71a 24-Apr-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioPlaybackConfiguration release/death: notify listeners

When a player dies or is released, dispatch an update to the
AudioPlaybackConfiguration listeners.

Bug: 70195346
Test: atest AudioPlaybackConfiguration#testCallbackMediaPlayerRelease
Change-Id: Id0b62abb32879d3166da26f20a334d0447183ac0
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
9228af6bc20c27b9949df36684f9c06ca9cdb27d 06-Jan-2018 Jean-Michel Trivi <jmtrivi@google.com> AudioFocusRequest: add ability to force ducking for a11y

New API to specify an accessbility service wants to force ducking
in its focus request, regardless of the framework's evaluation
of whether or not it should duck the other players.
Use of this API is restricted to requests coming from services
bound to the A11y service, or root

Bug: 62194333
Test: play a podcast in GPM and "adb shell claf --gain 3 --usage 11 --forceDuck"

Change-Id: I85f26afa14fe233a3b870f86c9084613203494b8
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
d51d398383c99aa0e1c84e46aafa593006d5120d 11-Oct-2017 Jean-Michel Trivi <jmtrivi@google.com> Fix alarm preview volume

SeekBarVolumizer: do not use FLAG_BYPASS_INTERRUPTION_POLICY as
there is no need to bypass DnD modes in seek bar for volume
since they are disabled according to the DnD mode.
AudioService (PlaybackActivityMonitor): check both
AudioAttributes flags BYPASS_INTERRUPTION_POLICY and
BYPASS_MUTE for forced alarm playback (see b/63617557).

Test: see bug
Bug: 67578783
Change-Id: Iaf43f16d96d1ad8a1eacc73a050db767004ba96b
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
df3e2be715511a68c588f59cbf62e2b7aac50e0e 04-Oct-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioService: log ducking and incall muting of audio players" into oc-mr1-dev
74a5596a8aeb4c112a6c024e9613d58ba662a5b5 03-Oct-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: log ducking and incall muting of audio players

Event logger: add support for logging the text of the event in
the logcat at the same time to avoid having the duplicate the
logcat entry and the logger event. See printLog() method.
AudioPlaybackMonitor: log ducking and incall muting.

Test: play media and notification, verify logs appear in logcat and dumpsys audio
Bug:65363602
Change-Id: I2af0c2bbd2fde428f07761ca45e7950a16843604
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
e5a351cb9213b59026efd602011a4d9e99c85649 28-Sep-2017 Eric Laurent <elaurent@google.com> Fix Cell broadcast sound in total silence

PlayerBase:
Update player volume when the audio attributes are updated in case
we need to unmute
PlaybackActivityMonitor:
Unmute alarm stream if needed when an alarm with flag
FLAG_BYPASS_INTERRUPTION_POLICY starts from an app with
privileged permission MODIFY_PHONE_STATE.

Bug: 63617557
Test: check sound with cell broadcast in total silence
Change-Id: Ifacb1d96a2d8d44047d9f9642d1e672fcf756cda
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
776a39931499d7d118eba916aba017032cde49a9 13-Sep-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioPlaybackConfiguration: prevent race condition on mIPlayerShell

Synchronize changes to mIPlayerShell after release of corresponding
player.
Flush binder commands when a player is released, in AudioService
and in the clients that have an AudioPlaybackCallback implementation.
Do the same in MediaSessionService, which directly implements
the IPlaybackConfigDispatcher interface, without going through
the AudioPlaybackCallback registration and notification
mechanisms.

Test: adb shell /system/bin/write_sine_callback -m2 -pl
Bug: 65450109
Change-Id: I2f0697e0e164283284ce30d2cc736c4f8df270c4
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
c2e7ceb2a3794646e1722605593fe01a9fa18a96 05-Sep-2017 Jean-Michel Trivi <jmtrivi@google.com> audio: Fix for IPlayerShell object leak.

IPlayerShell object is created for each MediaPlayer object and
this will register to linkToDeath, which will have global
reference. IPlayerShell release method is unregistering to Death
monitor. Here IPlayerShell object is not released at all, when
application releases mediaplayer object. As linkToDeath will have
global reference for each IPlayerShell object, GC will not be able
to clear this object.

Fix is to call IPlayerShell release when application releases
mediaplayer object.

authored-by: Divya Narayanan Poojary <dnaray@codeaurora.org>
Test: manual
Bug: 65374542

Change-Id: Icbd7632d462d44efdbb851c1c8a662bdef0e551c
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
3120059d5bdc52fb5ef2c90d9662562e92cd4df9 28-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: log changes in OP_PLAY_AUDIO

Log changes to AppOpsManager.OP_PLAY_AUDIO in live player

Test: "adb shell dumpsys audio" after entering silence mode
Bug: 62258749
Bug: 64286665
Change-Id: Ia1c202c5b8b25e14f7c2e85060a256dc69433909
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
011f39e7c7a16424260310fb9f580c727b72e8d8 20-Aug-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio event logging

New class AudioEventLogger to store a configurable number of the
last audio events. It hosts a circular buffer of lightweight
event objects, an abstract class whose implementations are
event-specific, and does the heavier string manipulations
at the time of the dump, not during normal operation.
Add logging for:
- phone state (a.k.a. audio mode) changes
- wired device connections
- playback activity monitor
- force use

Test: adb shell dumpsys audio
Bug: 64470715
Change-Id: I8dbd936e2ffec39134f1a8837191c74f5cb9fc56
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
56266190e8d74bcf1d5525634f50368efb845676 18-Jul-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService dump: sort player piids

In AudioService dump, sort player piids (the lower the piid the
older the player).

Test: adb shell dumpsys audio
Change-Id: Icebb35f8034bd26a9cafc685594a3390d19d07fa
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
8f81919093ba38b945fdc3cac781222bc4bea096 28-Jun-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioService: internal API for disabling audio playback for a UID" into oc-dr1-dev
92ed7bf41235c95b2c71648a631ce7aaa65f8943 27-Jun-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: internal API for disabling audio playback for a UID

Internal API, available through AudioManagerInternal, to flag
a UID as having lost the ability to play audio. When that
happens, all players associated with this UID are paused, and
future players are immediately paused when they report they
started.
Users of this API must "enable" a previously banned UID when
it is no longer in use.

Test: upcoming manual test with background apps
Bug: 34471029
Change-Id: Ic1c103aabe8f3897072b3ce938d84cb949540e23
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
83271bd70e21d420e1258d2473e7b4594915a48f 24-Jun-2017 Jean-Michel Trivi <jmtrivi@google.com> Do not duck AAudio streams as a result of focus loss

Not all AAudio streams support VolumeShaper, so do not have
the framework duck AAudio players in audio focus management.

Test: play audio through AAudio and play notification
Bug: 62027849
Change-Id: Ibe7293bf2347b75c8abd2194b6863ee3f5944003
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
2e48fb55122ad11f7416a65b04034ef30c3a42f5 17-May-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus: start players in ducked state when focus is already lost

The volume ramp for ducking is only to be heard when a player is
playing while focus is lost. When a player is starting when
focus is already lost (and ducking is applicable), it should
play at the same level as that reached after a duck. This is
implemented using the VolumeShaper.Operation time offset
(a.k.a. XOffset), set to 1, i.e. the end of the duck.

Test: see bug
Bug: 38353147
Change-Id: Iec36fbe002b183d6d70c258d9ab26b577dc1d2ce
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
087b672797b23d6c7451f975ca7f825d64fb1bd9 10-May-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus: fix focus loss notification for older SDKs

The feature of ducking enforced by the framework is gated by the
SDK version of the focus owner. The check was performed by
asking the SDK target level of the players to duck.
But if there were no players in the STARTED state at
the time, the check didn't report that the ducking
shouldn't be performed by the framework, and thus the
focus loss wasn't reported to the application.
The fix consists in moving the SDK check at the focus owner
level, so the check can happen regardless of whether there
are active players or not.
Add more informative logs where piids are logged (uid+pid).
In the FocusRequester class, initialize mFocusLossWasNotified
to true for the focus gain path, and don't set it to false
after gaining focus, it is properly updated instead in
the focus loss code path.

Test: launch Audible, play then pause, play a notification, verify in the logs Audible is notified of the focus loss
Bug: 37987086

Change-Id: I7c44d824b2563e71cf288ae1f256d001662a6a59
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
cb84fc010998462b222fa5f784bcc54c9a829b36 03-May-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio service: only duck started players + refactor

Refactor management of list of ducked players:
DuckingManager has a list of DuckedApps, which reference
the ducked players per uid.
Only consider ducking a player when it is in STARTED state.
When a player is released, remove it from the list of ducked players.

Test: play audio in GPM while having driving directions, music ducks
Bug: 37433811
Change-Id: I038a963432c0df6c9470a3a4fb80049d55e8719c
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
461922fcfc8572415aa39c43c06afce685bd998d 26-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus enforcement: duck automatically apps for SDK O+

Enforce automatic ducking only for apps written for an SDK target
level above 25 (N-MR1)

Test: play notification while Podcast Addict is playing, verify it pauses instead of being ducked
Bug: 37506138
Change-Id: Id7e01a92a51308bd7a3f24abc417d2434b532c12
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
44515357ceba18ecd799a822608c032fdd3f0724 25-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Merge "VolumeShaper: API change for duration" into oc-dev
4c86efa1e3fd8f467f4053b8027a9db12eee584c 21-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> VolumeShaper: API change for duration

Time in milliseconds is a long.
Update API to not specify the unit in the setter/getter for
the VolumeShaper duration.

Test: cts-tradefed run cts CtsMediaTestCases -t android.media.cts.VolumeShaperTest

Change-Id: If5f95cc43418d831105cbef2c43b6e9cfcf9082b
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
c2769ab2ac908b4ea344cf22cfe8ff968a906649 24-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: make PlaybackActivityMonitor less log-chatty

Do not log error messages on release errors.
Do not try to terminate VolumeShaper when releasing a player.
Use coding convention for "private" and "static" keywords.

Test: make
Change-Id: Ic1ff376c1ce4750708c368756f7b4a8a2c05c50c
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
0dfbd1569dcf451abfa9ea59a9c478b4cd2d90d2 12-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> VolumeShaper: update API, use "Millis" instead of "Ms"

Test: make
Bug: 36785428
Change-Id: Ib77ff448bb8454453b1bd39f1491b0189b4ff15b
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
cafed63e3acfebe1c633433c9e3a6013bb1f47cc 04-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus: duck new players during the ducked phase

Keep a list of all UIDs whose players should be ducked.
Whenever a new player is created or started, and their
UID matches one in the list, add them to the ducked
players.
The bug observed was when Play Music transitioned from one
song to another while music should have been ducked: the
new song wasn't unducked because it wasn't in the list
of players to unduck, as it wasn't active when the ducking
occured.

Test: request focus while Play Music transitions from one song to another
Bug: 36232742
Bug: 30258418
Change-Id: If8bd47128e6177731406f39e77d049b0d6f34f5d
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
40101efd1a36dbb739a7adb6eda3528b89b4859f 09-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Audio focus: framework enforces ducking"
952f2341abc398d245f3c0a577ebe1b28f93f368 07-Mar-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus: framework enforces ducking

When an application requests audio focus with AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK
automatically duck any active players of the current focus owner, unless:
- the player is a SoundPool
- the player plays content of type AudioAttributes.CONTENT_TYPE_SPEECH
- the focus owner requested focus with an AudioFocusRequest which
returns true for willPauseWhenDucked().
- the focus owner and requester share the same UID

Test: cts-tradefed run cts -m CtsMediaTestCases -t android.media.cts.AudioFocusTest#testAudioFocusRequestGainLossTransient
Bug: 30258418

Change-Id: I997905089252be410d58e03b350b6aa8a0d98e61
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
31901bd920008d5101bc0324b3d430f138fad8bd 06-Mar-2017 Jean-Michel Trivi <jmtrivi@google.com> PlaybackActivityMonitor: fix comment typo

Test: no test for typo
Change-Id: If2c5cc6c634d044c2b92347783c068aedbfbd890
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
0b30c5a64a59724d8935ef6e7a772999111a4eb3 28-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: fix volume shaper release

Catch exception when applying a volume shaper to cancel any remaining
volume shaper for release

Test: see bug
Bug: 35842573
Change-Id: Ic724a43fad6df599540369c095498c8adb2c73a8
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
7da0e98219501cb5ab49331878c7b2cdde541497 22-Feb-2017 Andy Hung <hunga@google.com> VolumeShaper: Remove PlayerProxy constructor

Use of the VolumeShaper through PlayerProxy requires system ids,
which is different enough from PlayerBase that we don't allow
direct construction.

Test: Ducking
Bug: 31015569
Change-Id: Ia98ec5396047ae39e78237bb7e485d07f2eb1efd
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
0f49f82e9777b7878fbc4566779dbe29191141ba 16-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> VideoView: option for audio focus, support for AudioAttributes

Add API for VideoView to select whether it uses audio focus during
playback, and how.
Add support for AudioAttributes

Test: cts-tradefed run cts -m CtsWidgetTestCases -t android.widget.cts.VideoViewTest
Bug 30955183
Bug 30258418

Change-Id: I581d32c79c78b8197ded2319e0d5bfdc35b93c5e
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
bd39cfaf97106bb8b9ea702d8e1cd5965537da16 18-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: prevent NPE on an invalid PIID

When looking for the AudioPlaybackConfiguration to act on a player,
check that the PIID is valid.
(Note that this is also handled in checkConfigurationCaller())

Test: see bug
Bug 35484407

Change-Id: Ic46ad10f9730593f6600175ab3ca8f496cc6d972
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
dce82ab7bfd5ec7c1ef658825c18506a89e567d6 08-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio focus enforcement: use VolumeShaper for ducking

When ducking players, check whether their content type
is speech, or the player is a SoundPool. If yes, do
not enforce ducking and leave it to the app. Otherwise
use a VolumeShaper to duck, and keep it in a list
so it can be reused to unduck (by using the REVERSE
operation).

Test: play a notification while an AudioTrack is playing
Bug 30258418

Change-Id: I7e0204ad38d4ef48e88ffc45533caccfc6e279b5
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
f1d82761ee0a4a0bb32a565f01127534cc9ab7db 14-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> Player activity notification: SoundPool not ready for activity reporting

Some plumbing is missing to accurately report SoundPool's playback
state, do not report it

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioPlaybackConfigurationTest
Bug: 35263297
Change-Id: I93389c87e5136912bfd11831b87d80495c3a1c3e
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
579c511765a23211a33a1b2f90010942ada2bccb 10-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> Fix PlaybackActivityMonitor unmute path

Clear the list of muted played after iterating over it.

Test: see repro test in b/35229719
Bug 35229719

Change-Id: I2e9860f8afbb625933091e45ea705903c74d629e
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
62b8634f06b32f17eced8020ecd9240f70838124 05-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService: mute media/game players during phone calls

When the device is ringing or in a call, mute all media/game audio
players.

Test: run a MediaPlayer, receive call
Bug 30258418

Change-Id: Idb3bd8d33f89aea6ac3293d21801b4b3387d969a
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
13d9ed6481500cf9e20b4d6a7fa0c993b735d9ea 03-Feb-2017 Jean-Michel Trivi <jmtrivi@google.com> Debug flag off on audio service PlaybackActivityMonitor

Test: check no logs from PlaybackActivityMonitor when playing audio
Bug 34974646
Change-Id: I6f67abc5a5e80cf61dc3ca4d0dc29f6fe902c4a7
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
99489ccf740d369193a8ffc7eeb4bbde6919bd65 26-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> Notification playback synchronized with audio focus

PlayerProxy: more control options (pan, delayed start),
remove exceptions in method signatures.
Use delayed start on notification playback for better sync
between media apps and notifications
Disabled for now: support for AudioService (through
MediaFocusControl and PlaybackActivityMonitor) to enforce
audio ducking of focus owners losing audio focus with
AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK, and who don't
play audio that has a content labelled as CONTENT_TYPE_SPEECH.
This feature will be enabled when setting a VolumeShaper
on a player works.

Test: play music and play notification
Bug 30258418

Change-Id: I4e4d911645306bbde17f74288f3b61781fe0e3fe
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
9dc22c227cb5c01136a6aa1b52c7dfa3383c0bd7 06-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioPlaybackConfiguration has a player control interface

An AudioPlaybackConfiguration contains an IPlayer
interface for system control of a player. It is not
exposed to non-system signature components.
AudioService, through PlaybackActivityMonitor, is monitoring
the death of the IPlayer so the matching player can get
unregistered in case it meets its maker.

Test: use vendor/google_toolbox/team/audio/cmds/ClPlaybackActivity
Bug: 30258418

Change-Id: Ibf3bceba91882ff16bffbf1219c55a1f89ccb13f
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
46e310b34f73fe87a6dd1e7357b486f1cf7cacbc 05-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> AudioService playback activity notif: check origin of player updates

When receiving updates about players, check the validity of the call:
- the piid must be valid
- the uid of the caller and that of the player must match

Test: adb shell dumpsys audio
Bug: 30955183
Change-Id: Id15e2b69764ed7db0b93e2c0c96472c30b1d2070
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
44a8f53f94808fdc5ac35a249d21ff2ba23e9419 02-Jan-2017 Jean-Michel Trivi <jmtrivi@google.com> Player activity notification: move some intialization server-side

Make beginning of player tracking synchronous, init uid/pid/piid
on the server side, and return the piid.
Anonymize configurations in the getter of active configurations
when the client isn't privileged.

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioPlaybackConfigurationTest
Bug: 30955183

Change-Id: I1610ae0067fd26d297057663352e679c8963a2d7
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java
292a6a4e9934a94eea97b018befde3baed895f7d 01-Dec-2016 Jean-Michel Trivi <jmtrivi@google.com> Notification of playback activity

AudioService keeps track of status of implementations of PlayerBase.
AudioService's PlaybackActivityMonitor maintains a list of
playback configurations for each PlayerBase, and a list
of clients that want to receive updates about the playback.
Playback activity clients can query the playback configuration
of the system through AudioManager, or register a callback
for updates. For clients with MODIFY_AUDIO_ROUTING permission
(system), the playback configurations contain more information
about each player (player type, uid, pid, state), and can see
all players, not just the "active" ones. The act of stripping
off data about the players that is not supposed to be seen
by non-system clients, is referred to as "anonymization". It
is implemented in system server, so no system data is ever
sent to playback activity clients without system permission.
More information about the AudioPlaybackConfiguration is
available in the SystemApi (uid, pid, player type, player state).

Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioPlaybackConfigurationTest
Bug: 30955183

Change-Id: I85997594c0378216419f5f0fdaa0714996fd3573
/frameworks/base/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java