Audio focus: fade out active playbacks on FOCUS_LOSS
When an application loses audio focus with AUDIOFOCUS_LOSS and its
active players (on usage GAME or MEDIA, but not SPEECH) qualify to
be faded out with a VolumeShaper:
- apply the fade on the active players
- remove the focus loser from the stack
- delay the dispatch of focus loss by the duration of the fade
Management of who is being faded out is in the FadingManager class.
When an app requests audio focus and the request is granted, undo
the fade.
When a player from an app being faded out starts, apply the fade
but skip the volume ramp (essentially muting the player).
Bug: 181910599
Test: cts-tradefed run cts -m CtsMediaTestCases -t android.media.cts.AudioFocusTest
Change-Id: I5f7b466d30057ce03466ac2edc950a02aca767d6
5 files changed