For USB headsets to work seamlessly across the Android ecosystem, Android devices must support them uniformly. This documentation specifies USB behavior to support USB headsets and adapters across the Android ecosystem.
Software mapping
Compatible USB headsets are required to support compatible HID mappings. Device support is required for the following keycode mappings.
Function | Mappings | Context | Behavior |
---|---|---|---|
A | HID usage page: 0x0C HID usage: 0x0CD Kernel key: KEY_PLAYPAUSE Android key: KEYCODE_MEDIA_PLAY_PAUSE |
Media playback | Input: Short press Output: Play or pause |
Input: Long press Output: Launch voice command Sends: android.speech.action.VOICE_SEARCH_HANDS_FREE if the device
is locked or its screen is off. Sends
android.speech.RecognizerIntent.ACTION_WEB_SEARCH otherwise |
|||
Incoming call | Input: Short press Output: Accept call |
||
Input: Long press Output: Reject call |
|||
Ongoing call | Input: Short press Output: End call |
||
Input: Long press Output: Mute or unmute microphone |
|||
B | HID usage page: 0x0C HID usage: 0x0E9 Kernel key: KEY_VOLUMEUP Android key: VOLUME_UP |
Media playback, Ongoing call | Input: Short or long press Output: Increases the system or headset volume |
C | HID usage page: 0x0C HID usage: 0x0EA Kernel key: KEY_VOLUMEDOWN Android key: VOLUME_DOWN |
Media playback, Ongoing call | Input: Short or long press Output: Decreases the system or headset volume |
D | HID usage page: 0x0C HID usage: 0x0CF Kernel key: KEY_VOICECOMMAND Android key: KEYCODE_VOICE_ASSIST |
All. Can be triggered in any instance. | Input: Short or long press Output: Launch voice command |
Hardware
Device manufacturers should also see USB digital audio for more information about USB implementation on Android. Device manufacturers must also follow the requirements in the USB section of the Android CDD.