自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
USB 耳機:裝置規格
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
為了讓 USB 耳機在 Android 生態系統中順暢運作,Android 裝置必須一致支援這些耳機。本文件說明 USB 行為,以便在 Android 生態系統中支援 USB 耳機和轉接器。
軟體對應
相容的 USB 耳機必須支援相容的 HID 對應項目。下列按鍵碼對應項目需要裝置支援。
函式 |
對應 |
背景資訊 |
行為 |
A |
HID 使用頁面:0x0C
HID 用途:0x0CD
核心鍵:KEY_PLAYPAUSE
Android 鍵:KEYCODE_MEDIA_PLAY_PAUSE |
媒體播放 |
輸入:短按
輸出:播放或暫停 |
輸入:長按
輸出:啟動語音指令
傳送:如果裝置處於鎖定或螢幕關閉狀態,則傳送 android.speech.action.VOICE_SEARCH_HANDS_FREE 。否則傳送 android.speech.RecognizerIntent.ACTION_WEB_SEARCH |
來電 |
輸入:短按
輸出:接聽來電 |
輸入:長按
輸出:拒接來電 |
通話中 |
輸入:短按
輸出:結束通話 |
輸入:長按
輸出:將麥克風設為靜音或取消靜音 |
B |
HID 使用頁面:0x0C
HID 用途:0x0E9
核心鍵:KEY_VOLUMEUP
Android 鍵:VOLUME_UP |
媒體播放、通話中 |
輸入:短按或長按
輸出:調高系統或耳機音量 |
C |
HID 使用頁面:0x0C
HID 用途:0x0EA
核心鍵:KEY_VOLUMEDOWN
Android 鍵:VOLUME_DOWN |
媒體播放、通話中 |
輸入:短按或長按
輸出:降低系統或耳機音量 |
D |
HID 使用頁面:0x0C
HID 用途:0x0CF
核心鍵:KEY_VOICECOMMAND
Android 鍵:KEYCODE_VOICE_ASSIST |
。可在任何例項中觸發。 |
輸入:短按或長按
輸出:啟動語音指令 |
硬體
裝置製造商也應參閱「USB 數位音訊」,進一步瞭解 Android 上的 USB 導入方式。裝置製造商也必須遵守 Android CDD USB 專區中的規定。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# USB headset: Device specification\n\nFor USB headsets to work seamlessly across the Android ecosystem, Android\ndevices must support them uniformly. This documentation specifies USB\nbehavior to support USB headsets and adapters across the Android ecosystem.\n\nSoftware mapping\n----------------\n\n\nCompatible USB headsets are required to support compatible HID mappings.\nDevice support is required for the following keycode mappings.\n\n| Function | Mappings | Context | Behavior |\n|----------|-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 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 |\n| A | **HID usage page** : 0x0C **HID usage** : 0x0CD **Kernel key** : `KEY_PLAYPAUSE` **Android key** : `KEYCODE_MEDIA_PLAY_PAUSE` | Media playback | **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 |\n| A | **HID usage page** : 0x0C **HID usage** : 0x0CD **Kernel key** : `KEY_PLAYPAUSE` **Android key** : `KEYCODE_MEDIA_PLAY_PAUSE` | Incoming call | **Input** : Short press **Output**: Accept call |\n| A | **HID usage page** : 0x0C **HID usage** : 0x0CD **Kernel key** : `KEY_PLAYPAUSE` **Android key** : `KEYCODE_MEDIA_PLAY_PAUSE` | Incoming call | **Input** : Long press **Output**: Reject call |\n| A | **HID usage page** : 0x0C **HID usage** : 0x0CD **Kernel key** : `KEY_PLAYPAUSE` **Android key** : `KEYCODE_MEDIA_PLAY_PAUSE` | Ongoing call | **Input** : Short press **Output**: End call |\n| A | **HID usage page** : 0x0C **HID usage** : 0x0CD **Kernel key** : `KEY_PLAYPAUSE` **Android key** : `KEYCODE_MEDIA_PLAY_PAUSE` | Ongoing call | **Input** : Long press **Output**: Mute or unmute microphone |\n| 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 |\n| 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 |\n| 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 |\n\nHardware\n--------\n\n\nDevice manufacturers should also see\n[USB digital audio](/docs/core/audio/usb) for more\ninformation about USB implementation on Android. Device manufacturers must also\nfollow the requirements in the\n[USB section](/docs/compatibility/13/android-13-cdd#77_usb) of the Android CDD."]]