Files
SpotiFLAC-Mobile/lib/utils
zarzet 8ebfbd4ed3 feat(playback): resume when headphones reconnect after a route loss
A Resume when headphones reconnect switch in the Automatic playback
group of Playback settings, off by default, on Android and iOS phones
and tablets (hidden on desktop and Android TV, also from search).

When headphones or a Bluetooth output go away while music plays, the
existing becoming-noisy pause now also records when it happened. If a
headphone-type output (wired, USB, Bluetooth A2DP or LE, hearing aid)
connects again within 30 minutes, that pause resumes once. Any other
transport change clears the record: Pause, Play, a skip or new song,
Stop, an audio interruption, a setting change or Cast. A song that was
already paused is never resumed, and the record lives in memory only,
so nothing resumes after the app was killed. Mute and audio focus still
block the resume, as for the other automations.

It reuses the audio_session device inventory that Play when headphones
connect already reads, so no permission is added. That broader switch
resumes on every connection, a user pause included; while it is on, the
new switch is disabled and its subtitle says it is covered. With both
on, the disconnect pause of the broader switch keeps the route-loss
record, so they do not conflict.

The window check is the pure `resumesNoisyPause`; the clock is
injectable for tests.
2026-11-08 16:45:26 +07:00
..