Resume explicit media play immediately - #5645
Conversation
|
Claude finished @joashrajin's task in 2m 37s —— View job Code Review — PR #5645: Resume explicit media play immediately
Overall this is a clean, well-targeted fix with good test coverage. The design correctly keeps A few observations, mostly minor: 1. Double/triple tap of
|
|
Claude finished @joashrajin's task in 2m 46s —— View job Code Review — PR #5645: Resume explicit media play immediately
This synchronize adds the The ordering fix is correct (and worth calling out)The key subtlety is
Observations (all minor / non-blocking)1. Immediate play now runs on the callback (main) thread rather than 2. Suppression still keyed implicitly on 3. Things I checked and found correct
No blocking issues — the items above are optional polish. Solid, well-tested fix. |
1809bc0 to
d14cf2c
Compare
|
Claude finished @joashrajin's task in 3m 21s —— View job Code Review — PR #5645: Resume explicit media play immediately
This latest sync wires both media-session paths through the shared Verified correct on the current diff
Minor observations (non-blocking)
TestsCoverage is solid: the Media3 suite now asserts immediate Nice, well-targeted iteration. 👍 |
|
Claude finished @joashrajin's task in 2m 15s —— View job Code Review — PR #5645: Resume explicit media play immediately
I re-reviewed the latest sync ( What changed since the last review (and is correct)
Things I re-verified end-to-end on the current diff
Remaining optional polish (non-blocking, unchanged from prior reviews)
Nice, well-tested iteration. LGTM. 👍 |
|
Version |
|
Version |
Stack / review order
media-button processor and its focused unit tests.
callbacks and adds the user-facing playback behavior.
This PR is intentionally based on
codex/serialize-media-button-events. After#5646 merges, retarget this PR to
main.Description
KEYCODE_MEDIA_PLAYcurrently waits for the 600 ms multi-tap window beforeresuming playback. When the phone has been idle with the screen off, that
coroutine can remain suspended for several seconds, so Bluetooth play controls
appear unresponsive until the device wakes.
This PR builds on #5646 and supersedes #5535:
sessions.
KEYCODE_MEDIA_PLAYevents nevertoggle active playback into a pause.
waiting for the multi-tap timeout.
configured headphone action.
KEYCODE_MEDIA_PLAYsome headphones sendafter
KEYCODE_MEDIA_NEXTorKEYCODE_MEDIA_PREVIOUS.The release-default phone path is the legacy media session unless Firebase Remote
Config enables
Media3 MediaSession; debug and prototype builds default toMedia3. Both paths have direct unit coverage.
Behavior notes
KEYCODE_MEDIA_PLAY, playback nowresumes immediately and the resolved double-tap action still runs. For example,
an
ADD_BOOKMARKdouble tap resumes and then bookmarks.KEYCODE_MEDIA_PLAYis intentionally play-only. While already playing it doesnot pause; headsets using a toggle command must send
KEYCODE_MEDIA_PLAY_PAUSEor
KEYCODE_MEDIA_PAUSEfor pause behavior.Fixes #5631
Testing Instructions
Automated
Run the focused suites:
Confirm all 57 focused tests pass.
Run
./gradlew :modules:services:repositories:testDebugUnitTestand confirm all860 tests pass.
Run
./gradlew spotlessCheck.Manual: test the release-default legacy path first
Media3 MediaSession off.
the process.
Legacy playback service created.and leave the phone idle for several minutes.
play command while already playing does not pause it.
NEXT/PREVIOUSstill run their configured actions and a followingspurious play event does not trigger a single-tap action.
configured double-tap action, including
ADD_BOOKMARK.for the Media3 path.
Manual result (2026-08-07)
Installed GitHub's stacked merge result
c20537ff7c021b7431c0f33c332cb52084505338on a physical Samsung SM-G990Erunning Android 16. Both the release-default legacy session and the Media3
session passed:
KEYCODE_MEDIA_PLAYresumed paused playback while the displayremained dozing; the explicit-play handler ran in approximately 5 ms on the
legacy path and 10 ms on Media3, rather than after the 600 ms tap window.
configured double-tap skip-forward action after the window.
NEXT/PREVIOUSfollowed immediately by the spuriousPLAYevent keptthe configured skip action and suppressed the trailing play action.
Playback was left paused, the Media3 beta flag was restored to its original
enabled state, and the display was returned to dozing. No Bluetooth audio
accessory was connected, so media keys were injected through Android's media-key
dispatcher with
adb. This verifies the app/session and screen-off behavior,but not a physical headset's Bluetooth transport behavior.
Screenshots or Screencast
Not applicable; there are no UI changes.
Checklist
./gradlew spotlessApplyto automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xmlI have tested any UI changes...
Not applicable; there are no UI changes.