Fix car lifecycle headset continuity (#36) #72

Merged
alexander merged 42 commits from mcp/issue-36-car-lifecycle-continuity into main 2026-09-21 11:26:07 +02:00
Owner

Scope

Fixes the remaining issue #36 lifecycle seam without introducing generic focus-loss resume.

Investigation result

  • Arrival: Media3 audio-focus loss is measured before the first trustworthy Android Auto controller bind. BookWave must continue respecting ExoPlayer/Media3 audio-focus ownership and can resume only after the first 0→1 bind plus exact-headset route recovery.
  • Departure: current main has no 1→0 car-controller continuity path. A focus loss while the car is connected is currently captured by arrival-only logic and the disconnect callback only republishes buttons.
  • Android Auto can transiently omit A2DP while binding/unbinding, so stable captured listener intent must not be erased by live device enumeration.

Implementation

  • one lifecycle continuity owner distinguishes Arrival and Departure;
  • connected playback captures the last positively proven exact headset for departure;
  • departure pairs audioFocusLoss with the final car disconnect in either callback order;
  • the exact target remains generation- and explicit-selection-sequence guarded;
  • route recovery never substitutes speaker/car/another headset;
  • non-focus pauses, deliberate Pause, newer Play/output selection and book/session changes invalidate recovery;
  • diagnostics separate candidate arm/reject, first/subsequent bind, route absence/reappearance/reassert, final eligibility, Play issued, actual playback active, and final disconnect.

Physical Android Auto acceptance remains required. Do not close #36 from CI alone.

## Scope Fixes the remaining issue #36 lifecycle seam without introducing generic focus-loss resume. ### Investigation result - Arrival: Media3 audio-focus loss is measured before the first trustworthy Android Auto controller bind. BookWave must continue respecting ExoPlayer/Media3 audio-focus ownership and can resume only after the first 0→1 bind plus exact-headset route recovery. - Departure: current main has no 1→0 car-controller continuity path. A focus loss while the car is connected is currently captured by arrival-only logic and the disconnect callback only republishes buttons. - Android Auto can transiently omit A2DP while binding/unbinding, so stable captured listener intent must not be erased by live device enumeration. ### Implementation - one lifecycle continuity owner distinguishes Arrival and Departure; - connected playback captures the last positively proven exact headset for departure; - departure pairs audioFocusLoss with the final car disconnect in either callback order; - the exact target remains generation- and explicit-selection-sequence guarded; - route recovery never substitutes speaker/car/another headset; - non-focus pauses, deliberate Pause, newer Play/output selection and book/session changes invalidate recovery; - diagnostics separate candidate arm/reject, first/subsequent bind, route absence/reappearance/reassert, final eligibility, Play issued, actual playback active, and final disconnect. Physical Android Auto acceptance remains required. Do not close #36 from CI alone.
alexander deleted branch mcp/issue-36-car-lifecycle-continuity 2026-09-21 11:26:07 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
alexander/Audiobookshelf-Manager-Claude!72
No description provided.