| <html devsite><head> |
| <title>USB 耳机:配件规范</title> |
| <meta name="project_path" value="/_project.yaml"/> |
| <meta name="book_path" value="/_book.yaml"/> |
| </head> |
| <body> |
| <!-- |
| Copyright 2017 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <p> |
| 本文档详细说明了 USB 耳机上各个按钮的行为,以使其在整个 Android 生态系统中保持一致。设备制造商还应参考 <a href="/devices/audio/usb.html">USB 数字音频</a>页面,以了解有关在 Android 设备上实现 USB 的更多信息;以及参考 <a href="http://source.android.com/compatibility/android-cdd.html">Android 兼容性定义文档 (CDD)</a>,以了解与 Android 设备相关的要求。 |
| </p> |
| <p>此外,本文档还介绍了 <a href="plug-headset-spec.html">3.5 毫米耳机</a>规范(适用于配件制造商)和 <a href="jack-headset-spec.html">3.5 毫米耳机插孔</a>规范(适用于设备制造商)。 |
| </p> |
| <p> |
| 本文档给出的是最低要求,我们鼓励配件制造商在满足这些要求的基础上添加新的功能。 |
| </p> |
| <h2 id="control-function-mapping">控件-功能映射</h2> |
| <table> |
| <tbody><tr> |
| <th>控制功能</th> |
| <th>配件支持</th> |
| <th>说明</th> |
| </tr> |
| <tr> |
| <td>A</td> |
| <td>必需</td> |
| <td>播放/暂停(短按)、启动语音命令(长按)、下一曲(按两下)</td> |
| </tr> |
| <tr> |
| <td>B</td> |
| <td>可选</td> |
| <td>调高音量</td> |
| </tr> |
| <tr> |
| <td>C</td> |
| <td>可选</td> |
| <td>调低音量</td> |
| </tr> |
| <tr> |
| <td>D</td> |
| <td>可选</td> |
| <td>启动语音命令</td> |
| </tr> |
| </tbody></table> |
| <p> |
| <strong>按钮功能分配如下:</strong> |
| </p> |
| <ul> |
| <li>所有单按钮耳机都必须实现功能 A。</li> |
| <li>多按钮耳机必须按照以下模式实现相关功能: |
| <ul> |
| <li>2 项功能:A 和 D</li> |
| <li>3 项功能:A、B、C</li> |
| <li>4 项功能:A、B、C、D</li> |
| </ul> |
| </li> |
| </ul> |
| <p class="note"> |
| <strong>注意</strong>:不允许按键锁定。最终用户每次按键时都必须生成相应的“按下”和“释放”按键事件,与最终用户的操作相匹配。换句话说,功能 A 到功能 D 所对应的按键一律不能被“锁定”,也不能用作切换开关(在这种情况下,当生成“按下”按键事件后,第二次按下按键时才会生成“释放”按键事件)。 |
| </p> |
| <h2 id="software-mapping">软件映射</h2> |
| <p> |
| 兼容的 USB 耳机需要支持耳机按钮的以下软件映射。以下软件映射需要设备支持。 |
| </p> |
| |
| <table> |
| <tbody><tr> |
| <th>功能</th> |
| <th>映射</th> |
| <th>环境</th> |
| <th>行为</th> |
| </tr> |
| <tr> |
| <td rowspan="6">A</td> |
| <td rowspan="6"><strong>HID 用途页</strong>:0x0C<br /> |
| <strong>HID 用途</strong>:0x0CD<br /> |
| <strong>内核按键</strong>:<code>KEY_PLAYPAUSE</code><br /> |
| <strong>Android 按键</strong>:<code>KEYCODE_MEDIA_PLAY_PAUSE</code></td> |
| <td rowspan="2">媒体播放</td> |
| <td><strong>输入</strong>:短按<br /> |
| <strong>输出</strong>:播放或暂停</td> |
| </tr> |
| <tr> |
| <td><strong>输入</strong>:长按<br /> |
| <strong>输出</strong>:启动语音命令<br /> |
| <strong>发送</strong>:<code>android.speech.action.VOICE_SEARCH_HANDS_FREE</code>(如果设备被锁定或其屏幕已关闭)。否则发送 <code>android.speech.RecognizerIntent.ACTION_WEB_SEARCH</code></td> |
| </tr> |
| <tr> |
| <td rowspan="2">来电</td> |
| <td><strong>输入</strong>:短按<br /> |
| <strong>输出</strong>:接听来电</td> |
| </tr> |
| <tr> |
| <td><strong>输入</strong>:长按<br /> |
| <strong>输出</strong>:拒绝来电</td> |
| </tr> |
| <tr> |
| <td rowspan="2">当前通话</td> |
| <td><strong>输入</strong>:短按<br /> |
| <strong>输出</strong>:结束通话</td> |
| </tr> |
| <tr> |
| <td><strong>输入</strong>:长按<br /> |
| <strong>输出</strong>:将麦克风设为静音或取消静音</td> |
| </tr> |
| <tr> |
| <td>B</td> |
| <td><strong>HID 用途页</strong>:0x0C<br /> |
| <strong>HID 用途</strong>:0x0E9<br /> |
| <strong>内核按键</strong>:<code>KEY_VOLUMEUP</code><br /> |
| <strong>Android 按键</strong>:<code>VOLUME_UP</code></td> |
| <td>媒体播放、当前通话</td> |
| <td><strong>输入</strong>:短按或长按<br /> |
| <strong>输出</strong>:调高系统或耳机的音量</td> |
| </tr> |
| <tr> |
| <td>C</td> |
| <td><strong>HID 用途页</strong>:0x0C<br /> |
| <strong>HID 用途</strong>:0x0EA<br /> |
| <strong>内核按键</strong>:<code>KEY_VOLUMEDOWN</code><br /> |
| <strong>Android 按键</strong>:<code>VOLUME_DOWN</code></td> |
| <td>媒体播放、当前通话</td> |
| <td><strong>输入</strong>:短按或长按<br /> |
| <strong>输出</strong>:调低系统或耳机的音量</td> |
| </tr> |
| <tr> |
| <td>D</td> |
| <td><strong>HID 用途页</strong>:0x0C<br /> |
| <strong>HID 用途</strong>:0x0CF<br /> |
| <strong>内核按键</strong>:<code>KEY_VOICECOMMAND</code><br /> |
| <strong>Android 按键</strong>:<code>KEYCODE_VOICE_ASSIST</code></td> |
| <td>所有。可在任何情况下触发。</td> |
| <td><strong>输入</strong>:短按或长按<br /> |
| <strong>输出</strong>:启动语音命令</td> |
| </tr> |
| </tbody></table> |
| |
| <p class="note">按键映射应在 HID 应用集合中声明。对于不带麦克风的配件,请使用耳机(用途页:消费者 (0x0C),用途:耳机 (0x05))。对于带有麦克风的配件,请使用耳麦(用途页:电话 (0x0B),用途:耳麦 (0x05))。</p> |
| |
| <h2 id="mechanical">机械</h2> |
| <p> |
| 配件制造商必须遵循 <a href="http://www.usb.org/">USB.org</a> 规定的对 USB 连接器的要求。 |
| </p> |
| <p> |
| 设备制造商必须遵循 Android CDD 的 <a href="/compatibility/android-cdd.html#7_7_usb">USB 部分</a>中的要求。 |
| </p> |
| |
| </body></html> |