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
Loading
Please register or sign in to comment