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

Commit 5befdff9 authored by Phil Yan's avatar Phil Yan
Browse files

Restore audio focus correctly after transient sounds

When multi-audio focus is enabled, media sound that is ducked by a
transient notification sound is not restored after the notification
ends.

The original logic in `notifyTopOfAudioFocusStack` only restored focus
to "locked" focus owners, not regular media players that experienced a
transient focus loss.

This change updates the logic to iterate through the multi-focus list
and restore focus to any requester that has experienced a transient
loss (`...CAN_DUCK` or `...TRANSIENT`). A helper method
`isLossReceivedTransient()` is added to `AudioFocusInfo`.

The change also preserves the original failsafe check for locked focus
owners.

Bug: 441513449
Test: Manually verified with logs that ducked media players are
restored successfully https://paste.googleplex.com/5371234006859776
Flag: android.media.audio.audio_focus_desktop

Change-Id: If3cf75fa980ac7d6791e919b50defa6997282c2d
parent 95436ef4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment