自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
耳机预期行为
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本文详细介绍了 3.5 毫米插头耳机和 USB 耳机的功能要求。
在验证设备和音频耳机的行为时,请注意以下要求:
- 仅在没有其他可用音频配件(如蓝牙)时适用
- 涵盖设备的默认行为,不适用于使用音频导向 API 来选择要使用的音频外设的应用
如果用户在播放媒体时将耳机连接到设备,则只能通过耳机听到音频输出(声音)。
例如,当使用开源通用音乐播放器播放媒体时,按播放/暂停按钮应暂停播放。在媒体暂停时按同一按钮应继续播放。
如果耳机具有音量控制按钮:
- 每次按下音量调高按钮都应逐渐调高音量,直到达到最大音量。如果一直按住音量调高按钮,音量应逐渐增加到最大音量设置。
- 每次按下音量调低按钮都应逐渐调低音量,直到完全静音。如果一直按住音量调低按钮,音量应逐渐降低至静音。
- 在静音状态下按下音量调高按钮,应从静音开始一次增加一个等级的音量。
针对应用的建议:断开耳机连接时,声音输出应停止,且播放应暂停。在重新连接时,播放不应再次开始,除非用户按下播放按钮。按下播放时,应再次限于通过耳机输出声音。
图 1. 单按钮耳机处理媒体流的按钮功能。
图 2. 双按钮耳机处理媒体流的按钮功能。
图 3. 三按钮耳机处理媒体流的按钮功能。
图 4. 四按钮耳机处理媒体流的按钮功能。
电话
如果用户在通话过程中将耳机连接到设备,则应在耳机上继续通话。通话不应被打断,且麦克风不应静音。音量按钮(如果存在)的行为应与媒体播放完全相同。
注意:静音和挂断电话的操作可能会因 Android 设备而异。本文描述的是最常见的行为;但对于某些设备,短按耳机按钮会使通话静音,而长按会挂断电话。
图 5. 单按钮耳机处理通话的按钮功能。
图 6. 双按钮耳机处理通话的按钮功能。
图 7. 三按钮耳机处理通话的按钮功能。
图 8. 四按钮耳机处理通话的按钮功能。
语音指令
语音指令按钮是一种新的内嵌控制标准,用于从任何已获批的穿戴式音频设备一致且方便地访问语音指令功能。通过按下此处定义的按钮,用户将听到双音信号耳标,表示设备正在聆听并准备好接收查询。
无论是内嵌到多功能按钮中还是单独采用单个按钮,都应可快速访问,符合人体工程学,并按照以下部分所述放置在显著位置。
下图描述了 Android 语音指令按钮的可接受配置。
选项
图 9. 按钮配置选项。
按钮应始终朝向前方且隔开,以便只通过触摸便可轻松找到它们。
间距
按钮直径必须大于 5 毫米,并且按钮之间的距离必须至少为 5 毫米。对于四按钮耳机,按钮 D 与其他按钮集群之间必须至少有 9 毫米的间隔。
图 10. 按钮间距要求。
图标
在下图中,A 未标记或用圆点进行标记。B 用 + 或向上箭头进行标记。C 用 - 或向下箭头进行标记。D 用选定的按钮图标进行标记。
图 11. 按钮图标要求。
大小
下图显示了按钮图标与其周围空间的比例。
图 12. 语音搜索按钮图标大小要求。
麦克风端口
在操作按钮时,麦克风绝不应被遮挡。将端口放在远离手指操作区域的位置。
图 13. 麦克风位置。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Headset expected behavior\n\nThis article details the functional requirements for\n[3.5 mm plug](/docs/core/interaction/accessories/headset/plug-headset-spec) and\n[USB](/docs/core/interaction/accessories/headset/usb-headset-spec) headsets.\n\n\nWhen verifying the behaviors of the device and the audio headset, note these\nrequirements:\n\n- only apply when no other audio accessories (e.g. Bluetooth) are available\n- cover the default behavior for devices and do not apply to applications that use audio routing APIs to select which audio peripheral to use\n\nMedia\n-----\n\nIf a user connects a headset to the device while playing media, the audio\noutput (sound) should be heard only via the headset.\n\nFor example, while playing media with the [open\nsource](https://github.com/googlesamples/android-UniversalMusicPlayer) [Universal\nMusic Player](https://android-developers.blogspot.com/2015/03/a-new-reference-app-for-multi-device.html), pressing the play/pause button should pause playback.\nPressing the same button when media is paused should resume playback.\n\nIf the headset has volume control buttons:\n\n- Pressing the volume-up button should increase the volume incrementally each time the button is pressed until maximum volume is reached. If the volume-up button is pressed and held, the volume should gradually increase to maximum volume setting.\n- Pressing the volume-down button should decrease the volume incrementally each time the button is pressed until entirely muted. If the volume-down button is pressed and held, the volume should gradually decrease to silent.\n- Pressing the volume-up button when in a muted state should increase the volume one notch at a time starting from silent.\n\n**Recommended for Apps**: On disconnecting the headset, sound output should stop and playback should\npause. On reconnecting, playback should not start again unless the user presses\nthe play button. Upon pressing play, sound output should again be limited to\nthe headset.\n\n### One button\n\n**Figure 1.** Button functions for one-button headsets handling a media stream.\n\n### Two buttons\n\n**Figure 2.** Button functions for two-button headsets handling a media stream.\n\n### Three buttons\n\n**Figure 3.** Button functions for three-button headsets handling a media stream.\n\n### Four buttons\n\n**Figure 4.** Button functions for four-button headsets handling a media stream.\n\nTelephony\n---------\n\nIf a user connects a headset to the device while a call is in progress, the\nconversation should continue on the headset. The call should not get\ndisconnected, and the microphone should not be muted. If present, volume\nbuttons should behave identically to media playback.\n\n**Note**: The actions to mute and hang up a phone\ncall may differ across Android devices. This documents the most common behavior;\nbut for some devices, a short press on the headset mutes the call, and a long\npress hangs up.\n\n### One button\n\n**Figure 5.** Button functions for one-button headsets handling a phone call.\n\n### Two buttons\n\n**Figure 6.** Button functions for two-button headsets handling a phone call.\n\n### Three buttons\n\n**Figure 7.** Button functions for three-button headsets handling a phone call.\n\n### Four buttons\n\n**Figure 8.** Button functions for four-button headsets handling a phone call.\n\nVoice commands\n--------------\n\nThe voice command button is a new inline control standard for consistently\nand conveniently accessing a voice command feature from any approved wearable\naudio device. By pressing the button defined here, users will hear the two-tone\nsignature [earcon](http://en.wikipedia.org/wiki/Earcon) indicating\nthat the device is listening and ready to receive the query.\n\nWhether embedded into a multi-function button or highlighted as a single\nbutton, it should always be quickly accessible, ergonomically correct, and\nplaced intuitively as described in the following section.\n\nButtons and function mapping recommendations\n--------------------------------------------\n\nThe following diagrams depict the acceptable configuration of the Android voice\ncommand button.\n\n### Options\n\n**Figure 9.** Button configuration options.\n\nButtons should always be front facing and spaced out so they can be easily\nlocated by touch only.\n\n### Spacing\n\nButtons must be more than 5 mm and must have at least 5 mm distance between\nbuttons. For four-button headsets, there must be at least 9 mm of space between\nbutton D and the cluster of other buttons.\n\n**Figure 10.** Button spacing requirements.\n\n### Icon\n\nIn the following diagram, A is unlabeled or labeled with a dot. B is labeled\nwith a + or an arrow pointing up. C is labeled with a - or an arrow pointing\ndown. D is labeled with the selected button icon.\n\n**Figure 11.** Button icon requirements.\n\n### Sizing\n\nThe following diagram shows the ratio of button icon to the space around it.\n\n**Figure 12.** Voice search button icon sizing requirements.\n\n### Microphone port\n\nThe microphone should never be obstructed when operating the buttons. Place the\nport away from finger interface area.\n:microphone:\n\n**Figure 13.** Microphone placement."]]