A car connecting stops the book instead of letting the headset carry on #36
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reported from the car on 2026-09-08: "when listening to headset, then android auto starts, the music in the headset stops, I want it to continue." Reported once before, on 2026-09-07. Tracked as
docs/risks.mdR-106.This is the oldest live defect on the Android Auto surface and the only one that actually interrupts listening, so it is the one worth doing properly.
Nothing in this app pauses the book
The pause is the platform's, through one of two mechanisms, and Media3 pauses for both and resumes neither:
ACTION_AUDIO_BECOMING_NOISY, broadcast when an A2DP sink is deactivated — which is exactly what a car taking the active A2DP slot does to a headset; orHeadsetHoldalready handles the routing half correctly: it remembers the headset the book was coming out of and reasserts it when a car binds, so the book does not migrate to the car. What it does not do — and cannot, by design — is un-pause. The route is preserved; the playback is not.An implementation exists and was deliberately withdrawn
CarArrivalContinuitywas written for this, reviewed five times, found to contain seven defects across those rounds, and lifted back out of GitHub #78 rather than shipped unverified. It is preserved at commit26f65f0onclaude/shelfplayer-android-auth-lk77fv.The reason it was withdrawn is worth keeping in view: each round fixed the defect in front of it and the next round found another, and round 5 produced a resume onto the phone speaker — strictly worse than the pause it was fixing. Resuming playback is a decision that can be wrong in ways silence cannot, so it should not be shipped on inference.
What is needed before restarting it
Two measurements from a single drive, both of which the app already logs:
PLAY_WHEN_READY_CHANGE_REASON_*word recorded for the pause says whether it was becoming-noisy or a focus loss. They need different handling and guessing between them is how round 5 happened.The new
"The car output actions were recomputed"line added in GitHub #78 gives the route state alongside it, so one drive now yields all three facts together.Acceptance
Related
docs/risks.mdR-10626f65f0HeadsetHoldredesign) — worth deciding whether that lands first, since both touch the same statePhysical acceptance record carried forward from #11
Device acceptance reported by the owner on 2026-09-19 after #11 / PR #59 was merged:
This record should be included in the eventual #36 PR/merge evidence.
Scope of this evidence: it validates #11's route preservation/ownership behavior only. It does not identify the Media3 pause cause for #36 (for example
becomingNoisyvsaudioFocusLoss) and should not be used to infer that cause.Merged prerequisite: PR #59, main
44cd4691ce9064392b8b8fb59338fc4c1e2a896e. Post-merge main Actions run #116 succeeded.Physical evidence captured 2026-09-19
A physical drive after #11 / PR #59 provides the missing #36 cause/correlation evidence.
Car start / Android Auto arrival
outputs=Speaker+Ambiguous*,onHeadset=true; the framework reports the Bluetooth/A2DP route active.playWhenReady=falsewithreason=audioFocusLoss. This is direct cause evidence; it is not inferred from timing.controller=com.google.android.projection.gearhead.A car connected and the book was held in the headset kind=bluetooth.outputs=Speaker+Ambiguous,onHeadset=true, with route observation temporarily unknown.reason=userRequest.Measured pause→first-car-bind interval: 2 seconds.
No user-request pause precedes the 15:37:25 stop; interval progress writes show playback was continuously advancing immediately beforehand. This establishes that the observed pause was system-caused.
The owner's physical observation also confirms #11's routing half: while wearing the headset, connecting Android Auto keeps the audiobook in that headset.
Car stop
playWhenReady=false reason=audioFocusLosswas observed when stopping the car.Implementation consequence
For the tested setup, #36 should correlate audio-focus-loss only with the first car-arrival transition, preserve the generation-bound headset ownership from #11, and must not generalize this evidence to every system pause or to
becomingNoisy.#36 implementation verification
PR #60 is open from
mcp/issue-36-car-arrival-continuityat exact head7f185ab895aa911b983d95d642d8c1dc4dcc1004.The earlier verifyDebug failure was fixed without changing the continuity policy:
CarArrivalResumeGate.takeForCarArrivalreturn count.Final production verification:
verifyDebug— BUILD SUCCESSFUL in 7m 58splayback:detektDebug— passedplayback:ktlintMainSourceSetCheck— passedplayback:testDebugUnitTest— passedMutation proof:
621b82d73102f4ad01425b4fb8bd02fa8b5b0102;CarArrivalResumeGateTestthen failed the expected resume assertions, including the main measured focus-loss + car-arrival case;PR #60 is mergeable and remains unmerged for owner review.
alexander referenced this issue2026-09-19 16:54:39 +02:00
Physical re-test after PR #60 — still reproduces
The 2026-09-19 18:15 drive reproduces #36 on merged main
62ec15362ca613854c111bd660727675af3081cb.Measured sequence:
playWhenReady=false reason=audioFocusLoss.controller=com.google.android.projection.gearhead.asked=bluetooth connected=true.The chosen audio output disconnected, so routing is automatic again kind=bluetooth; output snapshot collapses toSpeaker.A car connected and the book was held in the headset kind=bluetooth.Playback resumed after the car took audio focusnever appears.reason=userRequest.This exposes a post-#60 race: the pause candidate is valid and the #11 hold succeeds, but the current implementation re-reads
RouteHeardOwnership.heardRouteafter the transient device-list removal has retired it. The resume gate therefore rejects the candidate even though the same book generation and headset are still the intended continuity target.There is also a timing-model issue: the six-second correlation window is currently measured after the asynchronous route reassert/settle, not at the actual first car-bind timestamp. The observed focus-loss→first-bind interval here is about four seconds.
Follow-up should preserve the narrow measured trigger while:
heardRouteto survive Android Auto's transient output-list flap;CI follow-up for the second physical-drive fix:
b49d53acc3ffb354106714acd05b7c2f52e8d282failed only at:playback:detektDebug.PlaybackService.kt:1148—holdHeadsetAgainstCarhad 5 return statements, exceeding the repository ReturnCount limit of 4.4a60b729ffee61465cb10c5806b41317b284e379.Physical re-test — 2026-09-20 around 19:34–19:38
The owner re-tested the merged car/headset continuity work on the projected Android Auto setup.
Observed behavior
This means #36 is still reproduced physically and remains open.
Event-log evidence supplied with this drive
The supplied excerpt records the application/auth/sync lifecycle:
written=0.written=0.The excerpt does not contain a
playWhenReadytransition/reason,audioFocusLoss, Android Auto controller bind/disconnect, route/output diagnostics, or the #36 continuity-gate decision. It therefore does not independently identify the playback-stop mechanism and should not be used to attribute the pause/stop to sync or authentication.The zero-write progress refreshes and successful auth/realtime transitions also provide no evidence that the sync lifecycle itself intentionally stopped playback.
Investigation status
Earlier physical evidence in this issue already measured
playWhenReady=false reason=audioFocusLossimmediately before car arrival and exposed the Android Auto route-list flap/race during headset reassertion. The new drive confirms the user-visible defect remains after the merged work, including a car-exit stop as well as the short car-entry interruption, but this particular log slice does not narrow the lower-level cause further.A future diagnostic capture should include the Playback-category lines around both car entry and exit, especially:
playWhenReadychange reason;com.google.android.projection.gearheadcontroller bind/disconnect;The car output actions were recomputed;Keep the existing narrow safety requirements: never resume a deliberately paused book, never resume onto speaker/car when headset continuity was intended, and preserve profile/book/generation/output-selection guards.
Physical re-test — 2026-09-22, car arrival and departure both still stop playback
Reproduced again on a real drive. The audiobook was intended to remain on the Bluetooth headset throughout the car lifecycle, but playback stopped completely both when starting the car / Android Auto and when stopping the car.
This capture contains the Playback-category evidence that was missing from the previous drive.
Car arrival: continuity chain is lost
Relevant sequence:
playWhenReady=false reason=becomingNoisy.Speaker+Ambiguous* onHeadset=trueandSpeaker* onHeadset=false.playWhenReady=false reason=audioFocusLoss.source=audio-focus-loss phase=Arrival status=Rejected reason=NoQualifyingHeadset kind=none.controller=com.google.android.projection.gearhead firstArrival=true.source=first-car-bind phase=Arrival status=Rejected reason=NoPendingFocusLoss kind=none.reason=userRequest.onHeadset=true.This is a concrete failure mode in the current arrival state machine. The system pause begins with
becomingNoisy, route observation temporarily loses headset qualification, then the followingaudioFocusLosscannot arm the arrival candidate. By the time the first car bind arrives, there is no pending focus-loss candidate to consume.The headset route itself is not permanently lost; it is visible again immediately after the transition. The continuity correlation is what fails.
Car departure: focus-loss candidate arms but playback still stops
At the later car-stop transition:
playWhenReady=false reason=audioFocusLoss.source=audio-focus-loss phase=Departure status=Armed reason=FocusLossWaitingForBoundary kind=bluetooth.The supplied excerpt does not yet show a subsequent final-departure boundary decision after this arm, so the next investigation needs to determine whether the expected controller/route boundary never arrives, arrives in a shape the gate does not recognize, or is consumed/cancelled incorrectly.
Authentication noise is not the pause cause
Immediately after the 07:19:50 departure pause, position/session sync calls receive 401 responses and the session refreshes successfully at 07:19:56. Those failures affect progress synchronization, but the player log independently records
reason=audioFocusLossand the car lifecycle continuity decision at the moment playback stops. Do not attribute the playback interruption to authentication without separate evidence.Updated implementation requirements
The next #36 fix should treat arrival and departure as two separately proven failing paths.
For arrival:
becomingNoisy+audioFocusLosssequence with the first car bind without broadly resuming unrelated system pauses.For departure:
FocusLossWaitingForBoundarycandidate through controller disconnect / route boundary handling.Acceptance remains
Physical acceptance failed after PR #89 / APK 0.10.6.1-2272 — issue reopened
PR #89 is merged at
88ae231ddc01897d83e24968bed5443ea861aedd, and the tested APK0.10.6.1-2272was built from that exact commit. The 2026-09-24 physical drive therefore tests the merged #89 implementation, not an older APK.Arrival still pauses
Observed sequence:
playWhenReady=false reason=audioFocusLoss.source=audio-focus-loss phase=Arrival status=Armed reason=FocusLossWaitingForBoundary kind=bluetooth.controller=com.google.android.projection.gearhead firstArrival=true.source=first-car-bind phase=Arrival status=Ready reason=BoundaryMatchedFocusLoss kind=bluetooth.User-visible result: roughly three seconds of interruption, so the stronger projection-start path added in #89 did not shorten this transition.
Departure still stops
At 13:51:29:
playWhenReady=false reason=audioFocusLoss;source=audio-focus-loss phase=Departure status=Armed reason=FocusLossWaitingForBoundary kind=bluetooth.There is no subsequent
projection-disconnectcontinuity decision in the supplied trace. Playback later resumes through auserRequest/ resume-freshness path, not through car-continuity recovery.At 13:56:23,
becomingNoisyand Bluetooth disconnect/routing fallback occur while diagnostics still reportcarBound=true, again demonstrating that the legacy MediaSession controller lifetime remains stale relative to the physical car transition.Critical #89 reachability finding
The merged #89 code logs every
AndroidAutoProjectionMonitor.Updateas:Android Auto projection state changed previous=... current=... carBound=...The complete physical trace contains no such event at all.
Therefore the new projection monitor did not produce a usable state transition on this drive. Both entry and exit continued through fallback behavior. #89's state machine may be sound in unit tests, but its new external signal is not yet proven reachable on the physical device.
Current implementation manually queries the
androidx.car.app.connectionprovider but the installed app manifest has no package-visibility<queries>declaration for that provider. This is a concrete candidate cause and should be verified/fixed rather than assumed. Strong preference for the next repair: use the supported AndroidXCarConnectionimplementation instead of maintaining a partial hand-copy of its provider/receiver contract, unless repository constraints require otherwise.Required diagnostic expansion before/with the next repair
The next build should make projection reachability self-diagnosing. Do not log only successful state changes.
Projection monitor lifecycle
Log structured events for:
monitor start
receiver event
provider / CarConnection read result
initialorbroadcast;read failure
Unknown;monitor stop
Continuity coordinator snapshot
For every car lifecycle input — focus loss, projection edge, Gearhead bind/disconnect, noisy route event — log one compact state snapshot containing:
projectionOwnsCarLifecycle;carContinuitySessionEstablished;carBound;This should make one physical trace answer, without inference:
Correlation aid
Add a monotonic car-transition trace id (incremented when a new arrival/departure candidate begins) to all related lines. The current logs are good individually, but correlating focus, route, projection and controller events across several seconds is still more manual than necessary.
Acceptance requirement for the next repair
Do not close #36 merely because CI is green. Physical acceptance must show the projection signal itself becoming reachable.
For projected Android Auto, capture at least:
Projection(or equivalent supported API state);ProjectiontoNotConnected;If those projection events are absent, the build is diagnostically incomplete even if fallback recovery still works.
Issue remains open pending implementation and physical acceptance.
Diagnostics implementation staged — car/projection lifecycle trace
Implementation branch:
mcp/issues-36-88-android-auto-diagnosticsCurrent head:
70f9811f7fd92770865ce061540f9c7a1a708ac4Base:
main@68ac79ace9f9d38d450458ad28a1ffe4d0b632afBase relation at handoff: 0 behind main.
This is deliberately a diagnostics/event-handler change, not a new continuity-policy fix.
Added for #36
auto-Ntrace can begin as early asbecomingNoisy/audioFocusLossand is reused by the following Gearhead bind/projection edge within the bounded transition window.Projection observer is now self-diagnosing
The projection monitor no longer logs only a successful state transition. It records:
androidx.car.app.connectionis resolvable/visible;Safety remains unchanged: unreadable/failed state is
Unknown, never a manufactured disconnect and never authority to Play.The generic exception handling was deliberately narrowed to repository-approved platform exception types.
CI / PR state
No CI has been started.
No PR has been opened yet because current
.forgejo/workflows/pull-request.ymlautomatically launches the Quick gate onpull_request: opened. The owner explicitly asked to start CI manually, so opening a PR here would have started a run contrary to that instruction.Physical acceptance remains required after a build is available.