Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a97cd681 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Muting notifications due to focus is conditional on recording

Legacy behavior is to mute notification while an app has
requested audio focus with GAIN_TRANSIENT_EXCLUSIVE.
The new behavior under flag is to enforce that the muting
happens only when the focus requester is also recording audio.

Implementation uses a new AudioManager method that contains
all audio framework-side evaluation of whether the notification
should play, and avoid code duplication in
NotificationManagerService and NotificationAttentionHelper.

Annotated AudioAttributes field in NotificationRecord
to document that they are never null (so always available
to be consumed by AudioManager.shouldNotificationSoundPlay).

Updated unit tests to also mock AudioManager's response
for shouldNotificationPlaySound such that it's compliant
with the ringer mode and volume set on the mock in the
existing test. This way the test is independent of the flag
state.

Flag: android.media.audio.focus_exclusive_with_recording
Test: atest android.media.audio.cts.AudioFocusTest
Test: atest BuzzBeepBlinkTest NotificationAttentionHelperTest
Bug: 316414750
Change-Id: I54147c0dcccd7785589f4c9882582f42cf1a2d65
parent 3f6fad2a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment