Skip to content

Clink: map Android media play/pause keycodes 126/127 to play/pause - #31

Merged
riko2chen merged 1 commit into
OpenXPlay:mainfrom
hellowalker:clink-media-keys-126-127
Nov 5, 2026
Merged

riko2chen merged 1 commit into
OpenXPlay:mainfrom
hellowalker:clink-media-keys-126-127

Conversation

@hellowalker

Copy link
Copy Markdown
Contributor

Summary

UibcDecoder.key() only recognized KEYCODE_MEDIA_PLAY_PAUSE (85) as the
play/pause key. Head units that send KEYCODE_MEDIA_PLAY (126) or
KEYCODE_MEDIA_PAUSE (127) — as XPeng's steering wheel does — were silently
dropped (the mapping fell through to else -> null).

Change

Map 85, 126 and 127 all to KeyCode.PLAY_PAUSE, matching the existing
CarPlayMediaButton.forKeyCode mapping already used on the DiPlay/BYD side
(which treats KEYCODE_MEDIA_PLAY, KEYCODE_MEDIA_PAUSE and
KEYCODE_MEDIA_PLAY_PAUSE as the toggle).

Pure additive: keycode 85 is unchanged.

Verification

  • Captured Carlink control-channel traffic (method=12) while pressing the
    steering-wheel key; the head unit sends code=126 on key-down.
  • Before: the key was dropped before producing a ControlEvent.Key.
  • After: the relay logs media key code=PLAY_PAUSE index=3 sent=true and the
    phone toggles play/pause.

Note for maintainers

This is a dependency of a follow-up Relay PR that forwards steering-wheel
media keys. It does not depend on the open PR #30 (audio PTS anchor); it only
touches UibcDecoder.kt.

The Carlink key mapping only recognized KEYCODE_MEDIA_PLAY_PAUSE (85) as the
play/pause key. Head units that send KEYCODE_MEDIA_PLAY (126) or
KEYCODE_MEDIA_PAUSE (127) — as XPeng's steering wheel does — were silently
dropped. Map all three to KeyCode.PLAY_PAUSE, matching CarPlayMediaButton's
existing BYD mapping, so the relay can forward them as a CarPlay toggle.
@riko2chen
riko2chen merged commit a20f225 into OpenXPlay:main Nov 5, 2026
6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants