Harden media button event sequencing - #5646
Draft
joashrajin wants to merge 3 commits into
Draft
Conversation
|
I'll analyze this and get back to you. |
Collaborator
Generated by 🚫 Danger |
6 tasks
Collaborator
|
Version |
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.

Description
Media-button callbacks currently launch queue work onto a shared multi-threaded
scope.
MediaEventQueuestores its tap jobs and counter in unsynchronized mutablestate, so concurrent callbacks can create multiple tap windows or observe events
out of order.
This PR is the first, independently tested part of the #5645 stack:
mutex across the 600 ms disambiguation window.
MediaButtonEventHandlerthat owns key-code mapping, errorhandling, and ordered event registration.
resolved media actions asynchronous on the supplied scope.
NEXT/PREVIOUSfollowed by spuriousPLAYsuppression.The follow-up PR #5645 wires this processor into the Media3 and legacy session
callbacks and contains the user-facing explicit-play behavior. Keeping the
processor and its unit tests here leaves both PRs below the 500-line review
threshold.
Related to #5631
Testing Instructions
Run:
Confirm all 19 focused tests pass.
Run
./gradlew :modules:services:repositories:testDebugUnitTestand confirmall 856 tests pass.
Run
./gradlew spotlessCheck.No manual playback verification is needed for this preparatory PR because the
handler is integrated into the application callbacks in #5645.
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.xml— no stringsI have tested any UI changes...
Not applicable; there are no UI changes.