Skip to content

fix(android): hold partial wake lock during playback so locked-screen audio survives Doze#161

Merged
ChadFarrow merged 2 commits into
mainfrom
claude/zap-store-audio-locked-screen-abe75d
Jul 21, 2026
Merged

fix(android): hold partial wake lock during playback so locked-screen audio survives Doze#161
ChadFarrow merged 2 commits into
mainfrom
claude/zap-store-audio-locked-screen-abe75d

Conversation

@ChadFarrow

Copy link
Copy Markdown
Owner

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

claude added 2 commits July 21, 2026 08:47
… 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
@ChadFarrow
ChadFarrow merged commit 661c743 into main Jul 21, 2026
@ChadFarrow
ChadFarrow deleted the claude/zap-store-audio-locked-screen-abe75d branch July 21, 2026 22:10
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.

2 participants