Skip to content

Fix boot network error skip chain#29

Merged
chamika merged 2 commits into
mainfrom
fix-boot-network-error-skip-chain
Jul 2, 2026
Merged

Fix boot network error skip chain#29
chamika merged 2 commits into
mainfrom
fix-boot-network-error-skip-chain

Conversation

@chamika

@chamika chamika commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Fixes the "Something went wrong — Check that Google Play is enabled…" dialog that appeared repeatedly at infotainment boot on Volvo XC40 (firmware 5.1.17), and the half-broken media state it left behind. Two separate problems were involved; this PR carries the code fix and the release that also ships the Play Console fix.

Fix 1 — Google Play automatic integrity protection (Play Console, no code)

The dialog itself is not produced by DashTune or the car's Media Center: the exact wording matches the dialog injected into Play-delivered APKs by Google Play's automatic protection ("Installer check"). At infotainment boot, the car's CarMediaService spawns DashTune's process in the background to restore the last media source. The injected check runs at process start, can't reach Play (no connectivity yet, stale Play state after the car has been parked), fails, shows the dialog, and blocks the app. The car retries the reconnect a few times — hence the repeated prompts — then gives up, leaving the media card broken until the app is opened manually.

  • Resolution: Installer check turned off in Play Console (App integrity → Automatic protection). The check is baked into the APKs Play serves per release, so a new release must roll out before the dialog disappears — that's the Release v1.2.8(24) commit in this PR.
  • The March 2026 occurrence of the same dialog was misdiagnosed as a Firebase/GMS crash (the guard added in 6ed091e only wrapped debug-only code). Firebase is innocent and stays.

Fix 2 — Don't skip-chain the queue on transient network errors (code)

Separately, onPlayerError advanced to the next item on every playback error and, at the end of the queue, called stop() + clearMediaItems(). During a cold boot with no connectivity, a resumed queue would fail track by track and end up wiped — contributing to the same "half broken until I manually play something" state.

Changes in DashTuneMusicService:

  • ERROR_CODE_IO_NETWORK_CONNECTION_FAILED / _TIMEOUT now retry the current item in place every 5 s, up to 24 attempts (~2 min, covering the head unit bringing up its data connection), before falling back to the old skip/stop behaviour.
  • The existing ConnectivityManager callback triggers an immediate retry the moment the network comes back, so playback resumes without waiting out the poll interval. The retry runnable is guarded (STATE_IDLE + playerError != null) so it no-ops in any other state.
  • Other error codes (bad HTTP status, decode failures, missing files) keep the existing skip-to-next recovery — those are per-track problems where skipping is correct.
  • Retry counter resets when playback starts; pending retries are cancelled in onDestroy.

Testing

  • New unit tests for isTransientNetworkError (retry-worthy vs skip-worthy error codes) and a guard that the retry window stays ≥ 2 minutes.
  • Full unit test suite passes; debug APK builds cleanly.

Release

Includes Release v1.2.8(24) so the unprotected, fixed build can roll out immediately after merge.

🤖 Generated with Claude Code

chamika and others added 2 commits July 2, 2026 08:55
onPlayerError previously advanced to the next item on every playback
error and, at the end of the queue, stopped and cleared it. During a
cold boot the car has no connectivity for the first minutes, so a
resumed queue would fail track by track and end up wiped, leaving the
session empty until the user manually rebuilt a queue.

Network connection failed/timeout errors now retry the current item in
place every 5 seconds (up to ~2 minutes) and retry immediately when the
network callback reports connectivity, falling back to the old skip
behaviour only after the retry budget is exhausted. Other error codes
(bad HTTP status, decode failures, missing files) keep the existing
skip-to-next recovery.

Co-Authored-By: Claude Fable 5 <[email protected]>
More reliable playback resume when the car starts without an internet connection

Full release notes:

- Fix the restored play queue being skipped through and wiped when the car starts before its internet connection is up — the app now keeps retrying the current track and resumes automatically as soon as connectivity returns (for up to ~2 minutes)
- Tracks that genuinely fail to play (server errors, unplayable files) are still skipped as before
@chamika chamika merged commit 7b9ff32 into main Jul 2, 2026
1 check passed
@chamika chamika deleted the fix-boot-network-error-skip-chain branch July 2, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant