Loading
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