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

Commit 6c148c4e authored by Phil Yan's avatar Phil Yan
Browse files

Create hasAudioFocus to support multi-focus

Centralize the logic for checking audio focus state within
MediaFocusControl. Previously, consumers like AppStateHelper
implemented their own checks by directly inspecting the focus stack.
This approach was brittle and did not account for the multi-audio
focus list, leading to incorrect results when the feature was enabled.

This change introduces `hasAudioFocus` and updates `hasAudioFocusUsers`
in MediaFocusControl, making it the single source of truth for focus
state queries. These methods check both the main focus stack and the
multi-focus list.

By centralizing the logic, callers are now agnostic to the internal
implementation of focus management, making the system more robust and
easier to maintain.

Bug: 416963897
Flag: android.media.audio.audio_focus_desktop
Test: atest AudioFocusTest
Change-Id: I1e557df5ae59cecd813210334a6a2e5d6d9a2d77
parent b655c60a
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