Repository navigation
fix(player): stop lockscreen media tile from showing a duplicate Play button - #511
Conversation
… button COMMAND_PLAY_PAUSE was left in availablePlayerCommands on the assumption that the system tile's central glyph is driven only by PlaybackStateCompat.state. On some devices/Android versions the system also derives a standalone play/pause action bit from that command, duplicating the custom-layout's own Play/Pause button and pushing "Next" out of the five-slot row. Remove it, same treatment already given to the overlapping seek/skip commands. Closes #509
|
Status update: implementation complete, PR marked ready for review. Local verification (mirroring CI):
Note: GitHub Actions checks on this PR still show the stale "skipping" results from when it was opened as a draft — no new workflow run appears to have been triggered by the |
QA verification — PR #511 vs issue #509Acceptance criteria (bug report — no explicit checklist, so: repro no longer reproduces + regression test proves it):
What I ran:
AGENTS.md conventions:
No gaps found. This is a low-risk, well-targeted fix that matches the issue's own root-cause analysis and suggested direction, with a test that is proven (not assumed) to catch the regression. QA verdict: PASS |
|
Pipeline is at capacity (3/3 active runs) — skipping this review run. Re-apply status:needs-review once activity settles, or re-trigger manually via workflow_dispatch. |
|
Human-merge sweep: this PR's last comment is a Phase 4 concurrency-cap skip ( |
…pacity skip) (#522) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Principal review — verdict: human-merge
Risk label check: risk:low is correctly applied — diff is 110 lines (102 additions/8 deletions, well under the 400-line max_auto_mergeable_diff_lines threshold), and neither changed file (feature/player/.../LibravaultMediaCallback.kt, plus a new test file) matches any sensitive_paths glob in .github/agent-policy.yml. No status:blocked on the PR or issue #509. No new networking dependency/call. Nothing on sensitive_paths touched.
Despite that, this gets human-merge because of a CONFIRMED correctness finding below — per the persona's policy, a CONFIRMED finding forces human-merge regardless of risk tier.
CONFIRMED: this fix almost certainly breaks external play/pause control (Bluetooth, headset button, Android Auto, Assistant) — filed as #523
The change removes Player.COMMAND_PLAY_PAUSE from the availablePlayerCommands bitmask onConnect returns for every connecting controller. I verified against the exact androidx.media3:media3-session:1.11.0 source this repo pins (gradle/libs.versions.toml) rather than speculating:
MediaSessionLegacyStub.onPlay()/onPause()— the callbacks invoked for Bluetooth AVRCP, wired-headset media buttons, Android Auto, Google Assistant voice commands, and Wear OS (anything going through the legacyMediaSessionCompat.Callbackbridge Media3 auto-creates) — both route throughdispatchSessionTaskWithPlayerCommand(COMMAND_PLAY_PAUSE, ...), which doesif (!connectedControllersManager.isPlayerCommandAvailable(controller, command)) { ...; return; }(MediaSessionLegacyStub.java~line 863) — a silent no-op, no exception, no other signal.isPlayerCommandAvailable(ConnectedControllersManager.java~line 307) checksinfo.playerCommands, which is exactly thePlayer.CommandssetonConnectreturned for that controller at connect time. This app'sonConnectdoesn't branch by controller identity, so the legacy-stub controller gets the identical restricted set — now with noCOMMAND_PLAY_PAUSE.
Net effect: pressing play/pause on a Bluetooth headset or car head unit, a wired remote, Android Auto's own UI, or saying "Hey Google, pause" would all silently stop working — only tapping the on-screen custom Play/Pause button in the notification/lockscreen tile would still respond (it dispatches via the custom SessionCommand-based PLAY_PAUSE action in onCustomCommand, unaffected by this bitmask). For an audiobook app routinely used hands-free, that's a materially worse regression than the cosmetic duplicate-button bug being fixed.
This is exactly the risk issue #509's own "suggested triage direction" flagged as needing verification before merging ("verify... whether that breaks something else the KDoc's assumption was protecting against... needs on-device verification"). The PR's "Verification caveat" section only addresses whether the tile visually renders 5 buttons — it doesn't mention this functional path, and no on-device/emulator check of external transport controls was done. The new LibravaultMediaCallbackConnectTest only asserts the bitmask no longer contains COMMAND_PLAY_PAUSE — it can't observe this regression (Robolectric doesn't model the legacy compat dispatch path), so it would pass either way.
Suggested direction (left for the follow-up, not resolved here): keep COMMAND_PLAY_PAUSE available and fix the duplicate-glyph/misplaced-Next issue via CommandButton/setMediaButtonPreferences slot control instead — the newer Media3 API this file's own KDoc already notes it hasn't migrated to. Full writeup and code references in #523.
Other checks (no findings)
- CI vs local claims: the real
jvm-tests.yml"Unit & Integration Tests (JVM)" job never actually ran for this PR's commit — it was skipped both while the PR was a draft and (per the dev agent's own comment) again on theready_for_reviewtransition, which apparently didn't retrigger the workflow in this environment. Both the dev agent's and QA agent's "tests pass" claims rest solely on self-reported local./gradlewruns, not a live CI run. I ran./gradlew :feature:player:testDebugUnitTest --continuemyself in this review and confirmed BUILD SUCCESSFUL, with both new tests inLibravaultMediaCallbackConnectTestgenuinely executing and passing (test-results XML checked, not just console output). So the underlying claim holds up under independent verification — flagging the CI-didn't-run gap for visibility, not as a blocker. AGENTS.mdtest conventions: the new test uses JUnit4 (org.junit.Test+RobolectricTestRunner) rather than this repo's default JUnit5 — but that matches the existing precedent for Robolectric tests in this same module (PlaybackServiceTest.ktuses the identical pattern), so not a deviation.- No sensitive paths, no new dependencies, diff well under the size threshold — risk:low is the right mechanical classification, independent of the finding above.
Closes nothing by itself — routing to a human per policy on the CONFIRMED finding.
Summary
On Android, the lockscreen / status-bar media notification control row showed a duplicate Play button and dropped/misplaced the "skip to next" button.
LibravaultMediaCallback.onConnectpublishes a 5-buttoncustomLayout([Prev | −seek | PlayPause | +seek | Next]) and strips the overlapping standard seek/skip commands fromavailablePlayerCommandsso the system doesn't also derive standard-action buttons for the same controls.Player.COMMAND_PLAY_PAUSEwas deliberately left in, on the assumption that the system tile's central glyph is driven byPlaybackStateCompat.statealone, not a separate action slot.That assumption doesn't hold on every device/Android version — the system additionally derives a standalone play/pause action bit from
COMMAND_PLAY_PAUSEbeing present, producing a duplicate Play button and pushing "Next" out of the five-slot row.Fix
Remove
Player.COMMAND_PLAY_PAUSEfromavailablePlayerCommandsinLibravaultMediaCallback.onConnect— same treatment already given to the overlapping seek/skip commands. The custom-layout's own Play/Pause button (slot 3) still drives the central glyph viaPlaybackStateCompat.state, which is set independently of this command.Testing
LibravaultMediaCallbackConnectTest(Robolectric —onConnectreads the realandroid.os.Bundle.EMPTYstatic field, which isnullunder this module's plain-JVMisReturnDefaultValuesstub, so a plain-JUnit5 test NPEs before reaching the assertion). Confirmed red on the pre-fix code, green after the fix../gradlew :feature:player:testDebugUnitTestpasses locally.Verification caveat
This is presentation-layer behavior driven by the OS's own MediaStyle notification rendering (as the issue itself calls out) — not something a JVM/Robolectric test can fully observe. The unit test proves the command bitmask is correct; it cannot confirm the on-device tile actually renders 5 distinct buttons with Next visible on the reporter's device/Android version. That needs on-device/emulator verification, which isn't available in this environment. Flagging explicitly rather than claiming full verification.
Closes #509