Car action still does not show as selected when the car is the output #34
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, after GitHub #78: "The selected car is still not displaying as selected." This is the fourth report of the same symptom, and three separate app-side causes have already been found and fixed for it. Tracked as
docs/risks.mdR-107.What has been fixed already, and why none of it was enough
MediaSession.setMediaButtonPreferences(List)never refreshes the legacyPlaybackStateCompat, so a changed icon was not delivered to a car at all5574f52AudioDeviceCallback, so the icon was decided from a pre-drive route2532bdcAudioOutputRouter.resettleaddedcurrent()took the first active output inAudioManager.getDevicesenumeration order2532bdc2532bdcEach was a genuine defect. None of them closed the symptom.
What is settled and should not be re-litigated
PlaybackStateCompat.CustomActioncarries action / name / icon / extras and nothing else, andMediaConstantshas no toggle key. Google's own guidance is to publish a different icon for the different state. Swapping the drawable under one action id is the documented mechanism, so the design is right.getMediaNotificationControllerInfo(),MediaSessionLegacyStubrecomputescustomLayout, rebuilds a freshPlaybackStateCompatwithCustomAction.Builder(action, displayName, iconResId), and broadcasts it with no equality check at any layer. A changedsetCustomIconResIddoes reach the platform session on every republish.The remaining candidates
onCaris false on this device. Most likely.TYPE_BUS— the only type mapped toAudioOutputRole.Car— is the automotive HAL's own output and is not what a projecting phone exposes, so on projected Android Auto the only path that lights Car is the ambiguous-A2DP-dashboard case. If the phone reports the media route as a typeOutputDevices.roleOfsends toSpeaker/Other, or onekindOfdrops entirely, both glyphs correctly stay dark.routedIds()returns null,isActivedegenerates toid == chosen, and Car selects Automatic (null), so nothing is ever active. Check the test phone's API level before reading anything else.AndroidAutoConnectionStateObserverand aneedsButtonReservationWorkaroundForSeekbarbranch inside the method that buildscustomLayout, which is direct evidence that the Android Auto host deviates from what the API implies.The next step is a measurement, not a change
PlaybackService.republishOutputButtonsnow logs, on every recomputation:One drive with that line separates candidates 1–3 definitively. Capture it while the car is connected and the book is playing through the car.
onCar=trueand the glyph is still unlit → candidate 3 or 4, and it is a host problem, not an app one.onCar=false→ readoutputsfor which role the car's route actually got.apiis below 33 → candidate 2, and the feature cannot work on that phone at all.If it turns out to be the host
The cheapest probe is not two action ids — change the
displayNamealongside the icon and see whether the host redraws the label. That separates "the host ignored the new state object" from "the host redrew but the indicator is invisible".Two distinct action ids stay a last resort: they require granting the second
SessionCommandinonConnect(orcreatePlaybackStateCompatsilently drops the button), requireonCustomCommandto keep handling the old id forever because a cached host layout can send it, and change the action's identity in the phone notification and for every Media3 controller on every route change.Related
docs/risks.mdR-107alexander referenced this issue2026-09-19 00:24:09 +02:00
Implemented in PR #61. The Car action now publishes a distinct active command identity plus the existing active glyph and a
Playing in carlabel whenonCar=true. Both active and inactive command IDs remain granted and handled for cached Android Auto layouts. Route computation and the existing redaction-safe diagnostic are unchanged. Physical Android Auto acceptance is still required before closing.Physical re-test on PR #61 (2026-09-19) still showed Car unselected after pressing Car. This invalidated the cache-busting-only assumption. The branch now preserves Car as a distinct explicit semantic intent instead of collapsing it with generic Automatic (
selectedId=null), and explicit-intent changes republish the media buttons immediately. A confirmed headset route still overrides the Car presentation so #11/#36 ownership remains intact. Re-test required before closing.Implementation moved from stale PR #61 to replacement PR #67, recreated from current
mainso it is fast-forward clean. #67 retains the explicit semantic Car intent, immediate republish, active action identity, and the tightened rule that a Car press may bridge only a no-route/built-in-speaker observation gap; definite headset and known Other routes veto the selected-state fallback. Physical car acceptance remains required.Physical acceptance — 2026-09-20
Owner re-tested the merged Android Auto output-state work on the projected head unit.
Result: the Car action/icon now visibly displays the selected state correctly when the car is the output.
This is physical confirmation that the original #34 symptom is no longer reproducing on the tested setup. No new app-side change is requested from this field report.
Canonical acceptance — 2026-09-24
Reviewed main:
88ae231ddc01897d83e24968bed5443ea861aeddMerged implementation: PR #67, accepted head
20dae444aa5f8b4a41bd673d90f76b043027dc97, merge commitfea83c6abc1354e8d831a012881cc20f0afa81c0.Evidence reconciliation
main.AudioOutputRolesstill treats Car as a positive semantic state rather than “not Headset”: explicit Car can bridge only the projected no-route/built-in-speaker gap, while a definite headset or known Other route vetoes the Car-selected glyph.PlaybackServicestill republishes immediately when explicit output intent changes and still derivescarRequestedfromExplicitDestination.Car.MediaButtonPublishingstill republishes both globally and through Media3's media-notification controller so the legacy Android AutoPlaybackStateCompatis refreshed.main, including explicit-Car/no-route, headset/Other veto, route-role selection, active-action identity, and legacy republish coverage.PlaybackServiceintegration seam. Its exact head200b3d9e2a715273fbe32495479eb896e8974b7epassed Forgejo run #270:verifyDebug, 2606 tests / 0 failures, ktlint, detekt, Android Lint and Room schema checks. Current-main push run #271 also passed at88ae231d....Existing physical evidence
The issue already records owner projected-head-unit acceptance on 2026-09-20:
That evidence corresponds to the PR #67 behavior that is still present on current
main; no later change invalidated the mechanism. Repeating the same drive only for bookkeeping is unnecessary.Acceptance matrix
Remaining physical steps: none.
Result
ACCEPTED — CLOSE