Fix AAOS steering-wheel skip buttons after Android 14 update#5318
Closed
joashrajin wants to merge 1 commit into
Closed
Fix AAOS steering-wheel skip buttons after Android 14 update#5318joashrajin wants to merge 1 commit into
joashrajin wants to merge 1 commit into
Conversation
After the Media3 migration, the player no longer advertised COMMAND_SEEK_TO_NEXT / COMMAND_SEEK_TO_PREVIOUS, and the onMediaButtonEvent handler did not recognise KEYCODE_MEDIA_FAST_FORWARD, KEYCODE_MEDIA_REWIND, or the Android 14 AAOS fallback KEYCODE_MEDIA_STOP that GM's car-media service sends when no skip action is reachable. As a result, steering-wheel skip buttons on Chevrolet Equinox EV (and likely other AAOS vehicles after the Android 14 vehicle-OS update) did nothing. Expose SEEK_TO_NEXT / SEEK_TO_PREVIOUS on both TRANSPORT_PLAYER_COMMANDS and PocketCastsForwardingPlayer.getAvailableCommands() so AAOS routes the steering-wheel skip buttons through seekToNext()/seekToPrevious() (already wired to PlaybackManager.skipForwardSuspend / skipBackwardSuspend via onSkipForward / onSkipBack). Add explicit handlers for KEYCODE_MEDIA_FAST_FORWARD / KEYCODE_MEDIA_REWIND as a defence-in-depth for controllers that still dispatch raw key events. On automotive, bypass the headphone multi-tap queue for KEYCODE_MEDIA_NEXT / KEYCODE_MEDIA_PREVIOUS so a single press of the steering-wheel skip button triggers an immediate skip rather than waiting on the 250 ms multi-tap timeout.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes AAOS steering-wheel skip controls becoming unresponsive after the Media3 migration / Android 14 AAOS rollout by ensuring Media3 controllers can discover and dispatch skip actions, and by handling additional automotive-specific key event behaviors.
Changes:
- Advertise
COMMAND_SEEK_TO_NEXT/COMMAND_SEEK_TO_PREVIOUSfrom bothPocketCastsForwardingPlayerandMedia3SessionCallbackso AAOS routes steering-wheel skip buttons toseekToNext()/seekToPrevious()instead of falling back to STOP. - Handle
KEYCODE_MEDIA_FAST_FORWARD/KEYCODE_MEDIA_REWINDas direct skip-forward/skip-back inonMediaButtonEvent. - On Automotive, bypass the headphone multi-tap queue for
KEYCODE_MEDIA_NEXT/KEYCODE_MEDIA_PREVIOUSto avoid the 250ms delay and ensure immediate response.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/PocketCastsForwardingPlayer.kt | Exposes seek-to-next/previous commands to make skip reachable for external controllers (AAOS). |
| modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/Media3SessionCallback.kt | Expands advertised transport commands and improves media-button handling for AAOS keycodes and automotive latency expectations. |
| modules/services/repositories/src/test/java/au/com/shiftyjelly/pocketcasts/repositories/playback/PocketCastsForwardingPlayerTest.kt | Updates command-exposure expectations to include seek-to-next/previous (including after swapPlayer). |
| modules/services/repositories/src/test/java/au/com/shiftyjelly/pocketcasts/repositories/playback/Media3SessionCallbackTest.kt | Adds coverage for FAST_FORWARD/REWIND handling and the Automotive multi-tap bypass for NEXT/PREVIOUS. |
Member
|
@sztomek would you mind reviewing this as it's related to Media 3. |
Contributor
Author
|
Moving this off my fork to get Buildkite CI to run — superseded by #5328. |
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
Fixes https://linear.app/a8c/issue/PCDROID-560/aaos-steering-wheel-skip-forwardback-buttons-unresponsive-in-pocket
After the Media3 migration, the AAOS Pocket Casts session stopped advertising
COMMAND_SEEK_TO_NEXT/COMMAND_SEEK_TO_PREVIOUS, and theonMediaButtonEventhandler didn't recogniseKEYCODE_MEDIA_FAST_FORWARD,KEYCODE_MEDIA_REWIND, or the fallbackKEYCODE_MEDIA_STOPthat GM's car-media service sends when no skip action is reachable. After the Android 14 vehicle-OS rollout on Chevrolet Equinox EV (and likely other AAOS platforms), the steering-wheel skip-forward / skip-back buttons became completely unresponsive — the user reportedMedia3 media button event: keyCode=86(KEYCODE_MEDIA_STOP) in their log when pressing skip. Spotify and Amazon Music kept working because they advertise the skip commands.Changes
PocketCastsForwardingPlayer.getAvailableCommands()— exposeCOMMAND_SEEK_TO_NEXTandCOMMAND_SEEK_TO_PREVIOUS. The existingseekToNext()/seekToPrevious()overrides already route toonSkipForward/onSkipBack(→PlaybackManager.skipForwardSuspend/skipBackwardSuspend), so no wiring change is needed.Media3SessionCallback.TRANSPORT_PLAYER_COMMANDS— same two commands added so connecting Media3 controllers (AAOS, MediaController test clients) see skip support.Media3SessionCallback.onMediaButtonEvent— handleKEYCODE_MEDIA_FAST_FORWARDandKEYCODE_MEDIA_REWINDas direct skip-forward / skip-back (defence-in-depth for controllers that still dispatch raw key events).Media3SessionCallback.onMediaButtonEvent— on Android Automotive OS, bypass the headphone multi-tap queue forKEYCODE_MEDIA_NEXTandKEYCODE_MEDIA_PREVIOUS. The 250 ms multi-tap window is correct for Pixel Buds but wrong for a steering-wheel button, which fires once per press.Testing Instructions
Automated tests
./gradlew :modules:services:repositories:testDebugUnitTest --tests "au.com.shiftyjelly.pocketcasts.repositories.playback.Media3SessionCallbackTest"./gradlew :modules:services:repositories:testDebugUnitTest --tests "au.com.shiftyjelly.pocketcasts.repositories.playback.PocketCastsForwardingPlayerTest"KEYCODE_MEDIA_FAST_FORWARD calls skipForwardSuspend directlyKEYCODE_MEDIA_REWIND calls skipBackwardSuspend directlyon automotive, KEYCODE_MEDIA_NEXT skips forward immediatelyon automotive, KEYCODE_MEDIA_PREVIOUS skips backward immediatelyManual — AAOS emulator
./gradlew :automotive:assembleDebug.KEYCODE_MEDIA_NEXTkey event viaadb shell input keyevent 87(and88for previous,90for fast-forward,89for rewind).Media3: stop → pauselog line is emitted.Manual — mobile regression check
debugvariant.headphoneControlsNextAction/headphoneControlsPreviousActionafter the 250 ms window — the automotive bypass only applies whenUtil.isAutomotive(context)is true.Checklist
./gradlew spotlessApplyto automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xml(no string changes)Note
Tests were not executed locally — the current
mainbranch pulls in acrashlogging:6.0.8dependency compiled to Java 21 class files, butlibs.versions.tomlstill pinsjava = "17". Without a local JDK 21 install,:modules:services:crashlogging:compileDebugJavaWithJavacfails before any test code runs. Pre-existing issue, not caused by this PR — relying on CI for verification.