fix(android): hold partial wake lock during playback so locked-screen audio survives Doze#161
Merged
Merged
Conversation
… audio survives Doze The zapstore (native Capacitor) build kept dying when the screen locked even after the v1.1 foreground service, while the PWA was fine. A foreground service only prevents the process from being killed; it does not stop the CPU from entering deep sleep during Doze on GrapheneOS/aggressive Android, which freezes the WebView's audio decode and the JS timers driving the ping-pong track transitions. PlaybackKeepAliveService now acquires a PARTIAL_WAKE_LOCK in onStartCommand and releases it in onDestroy (both wrapped in try/catch so wake-lock failure degrades to FGS-only rather than crashing the service). The WAKE_LOCK permission was already declared in the manifest since v1.1 but unused. Screen/keyboard still turn off; only the CPU stays awake. Bumped to versionCode 3 / versionName 1.2 — native changes only reach users via a new APK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmD4X4ZRbgRtfgReNHfZuj
… updates Downloads target limited-bandwidth users, so an accidental wipe forces a costly re-download. The persistence is already safe by construction (client-side Cache API + IndexedDB, origin-scoped; untouched by web deploys and preserved across same-key APK updates), but the guarantee was implicit. Add guard comments at the three load-bearing storage identifiers (stablekraft-downloads-v1, stablekraft-downloads-art-v1, StableKraftDownloadsDB) and at the IndexedDB onupgradeneeded handler warning that DB_VERSION bumps must stay additive, plus a CLAUDE.md invariant. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmD4X4ZRbgRtfgReNHfZuj
ChadFarrow
added a commit
that referenced
this pull request
Jul 21, 2026
…1.3) Combines the zapstore locked-screen wake-lock fix (#161) with a native MediaSessionCompat lock-screen player owned by PlaybackKeepAliveService (art, title/artist/album, prev/play-pause/next, seek bar, Bluetooth keys), suppressing Chromium's flaky element-bound session on native Android. Device-accepted on Pixel 6; ships as versionCode 4 / versionName 1.3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P6GRXrky69Bc7CNpN7HPn5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The zapstore (native Capacitor) build kept dying when the screen locked even
after the v1.1 foreground service, while the PWA was fine. A foreground service
only prevents the process from being killed; it does not stop the CPU from
entering deep sleep during Doze on GrapheneOS/aggressive Android, which freezes
the WebView's audio decode and the JS timers driving the ping-pong track
transitions.
PlaybackKeepAliveService now acquires a PARTIAL_WAKE_LOCK in onStartCommand and
releases it in onDestroy (both wrapped in try/catch so wake-lock failure degrades
to FGS-only rather than crashing the service). The WAKE_LOCK permission was
already declared in the manifest since v1.1 but unused. Screen/keyboard still
turn off; only the CPU stays awake. Bumped to versionCode 3 / versionName 1.2 —
native changes only reach users via a new APK.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01TmD4X4ZRbgRtfgReNHfZuj