1page.title=USB Headset: Accessory Specification 2@jd:body 3 4<!-- 5 Copyright 2016 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18--> 19<div id="qv-wrapper"> 20 <div id="qv"> 21 <h2>In this document</h2> 22 <ol id="auto-toc"> 23 </ol> 24 </div> 25</div> 26 27<p> 28This documentation specifies USB headset buttons behavior to function uniformly 29across the Android ecosystem. Device manufacturers should also consult the 30<a href="{@docRoot}devices/audio/usb.html">USB 31Digital Audio</a> page for more information about USB implementation on Android 32and the <a href="http://source.android.com/compatibility/android-cdd.html">Android 33Compatibility Definition Document (CDD)</a> for requirements related to Android 34devices. 35</p> 36<p>There are also specifications for 37<a href="plug-headset-spec.html">3.5 mm headsets</a> for accessory manufacturers and 38<a href="jack-headset-spec.html">3.5 mm jacks</a> for device manufacturers. 39</p> 40<p> 41This documentation specifies the minimum requirements: accessory manufacturers 42are encouraged to add features while keeping these requirements in mind. 43</p> 44<h2 id="control-function-mapping">Control-function mapping</h2> 45<table> 46 <tr> 47 <th>Control Function</th> 48 <th>Accessory Support</th> 49 <th>Description</th> 50 </tr> 51 <tr> 52 <td>Function A</td> 53 <td>Required</td> 54 <td>Play/pause (short press), launch voice assistance (long press), next (double 55 press)</td> 56 </tr> 57 <tr> 58 <td>Function B</td> 59 <td>Optional</td> 60 <td>Vol+</td> 61 </tr> 62 <tr> 63 <td>Function C</td> 64 <td>Optional</td> 65 <td>Vol-</td> 66 </tr> 67 <tr> 68 <td>Function D</td> 69 <td>Optional</td> 70 <td>Launch voice assistance</td> 71 </tr> 72</table> 73<p> 74<strong>Assign functions to buttons as follows:</strong> 75</p> 76<ul> 77 <li>All one-button headsets must implement Function A.</li> 78 <li>Headsets with multiple buttons must implement functions according to the 79 following pattern: 80 <ul> 81 <li>2 functions: A and D</li> 82 <li>3 functions: A, B, C</li> 83 <li>4 functions: A, B, C, D</li> 84 </ul> 85 </li> 86</ul> 87<p class="note"> 88<strong>Note</strong>: No key latching allowed. Each key press by the end user 89must generate the corresponding "down" and "up" key event, matching the end user 90action. In other words, the keys for functions A through D are never "latched" 91or implemented to be used as a toggle (where the "up" event only follows "down" 92on a second key press). 93</p> 94<h2 id="software-mapping">Software mapping</h2> 95<p> 96Compatible USB headsets are required to support the following software mappings 97for the headset buttons. Device support is required for the following software 98mappings. 99</p> 100 101<table> 102 <tr> 103 <th>Function</th> 104 <th>Mappings</th> 105 <th>Context</th> 106 <th>Behavior</th> 107 </tr> 108 <tr> 109 <td rowspan="6">Function A</td> 110 <td rowspan="6"><strong>HID usage page</strong>: 0x0C<br> 111 <strong>HID usage</strong>: 0x0CD<br> 112 <strong>Kernel key</strong>: <code>KEY_PLAYPAUSE</code><br> 113 <strong>Android key</strong>: <code>KEYCODE_MEDIA_PLAY_PAUSE</code></td> 114 <td rowspan="2">Media playback</td> 115 <td><strong>Input</strong>: Short press<br> 116 <strong>Output</strong>: Play or pause</td> 117 </tr> 118 <tr> 119 <td><strong>Input</strong>: Long press<br> 120 <strong>Output</strong>: Launch voice assistance<br> 121 <strong>Sends</strong>: 122 <code>android.intent.action.VOICE_SEARCH_HANDS_FREE</code></td> 123 </tr> 124 <tr> 125 <td rowspan="2">Incoming call</td> 126 <td><strong>Input</strong>: Short press<br> 127 <strong>Output</strong>: Accept call</td> 128 </tr> 129 <tr> 130 <td><strong>Input</strong>: Long press<br> 131 <strong>Output</strong>: Reject call</td> 132 </tr> 133 <tr> 134 <td rowspan="2">Ongoing call</td> 135 <td><strong>Input</strong>: Short press<br> 136 <strong>Output</strong>: End call</td> 137 </tr> 138 <tr> 139 <td><strong>Input</strong>: Long press<br> 140 <strong>Output</strong>: Mute or unmute microphone</td> 141 </tr> 142 <tr> 143 <td>Function B</td> 144 <td><strong>HID usage page</strong>: 0x0C<br> 145 <strong>HID usage</strong>: 0x0E9<br> 146 <strong>Kernel key</strong>: <code>KEY_VOLUMEUP</code><br> 147 <strong>Android key</strong>: <code>VOLUME_UP</code></td> 148 <td>Media playback, Ongoing call</td> 149 <td><strong>Input</strong>: Short or long press<br> 150 <strong>Output</strong>: Increases the system or headset volume</td> 151 </tr> 152 <tr> 153 <td>Function C</td> 154 <td><strong>HID usage page</strong>: 0x0C<br> 155 <strong>HID usage</strong>: 0x0EA<br> 156 <strong>Kernel key</strong>: <code>KEY_VOLUMEDOWN</code><br> 157 <strong>Android key</strong>: <code>VOLUME_DOWN</code></td> 158 <td>Media playback, Ongoing call</td> 159 <td><strong>Input</strong>: Short or long press<br> 160 <strong>Output</strong>: Decreases the system or headset volume</td> 161 </tr> 162 <tr> 163 <td>Function D</td> 164 <td><strong>HID usage page</strong>: 0x0C<br> 165 <strong>HID usage</strong>: 0x0CF<br> 166 <strong>Kernel key</strong>: <code>KEY_VOICECOMMAND</code><br> 167 <strong>Android key</strong>: <code>KEYCODE_VOICE_ASSIST</code></td> 168 <td>All. Can be triggered in any instance.</td> 169 <td><strong>Input</strong>: Short or long press<br> 170 <strong>Output</strong>: Launch voice assistance</td> 171 </tr> 172</table> 173 174<h2 id="mechanical">Mechanical</h2> 175<p> 176Accessory manufacturers must follow the requirements for USB connectors 177as specified by <a href="http://www.usb.org/">USB.org</a>. 178</p> 179<p> 180Device manufacturers must follow the requirements in the 181<a href="{@docRoot}compatibility/android-cdd.html#7_7_usb">USB section</a> of 182the Android CDD. 183</p> 184