1## 7.2\. Input Devices
2
3Device implementations:
4
5*    [C-0-1] MUST include an input mechanism, such as a
6[touchscreen](#7_2_4_touchScreen_input) or [non-touch navigation](#7_2_2_non-touch_navigation),
7to navigate between the UI elements.
8
9### 7.2.1\. Keyboard
10
11If device implementations include support for third-party
12Input Method Editor (IME) applications, they:
13
14*   [C-1-1] MUST declare the [`android.software.input_methods`](https://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_INPUT_METHODS)
15feature flag.
16*   [C-1-2] MUST implement fully [`Input Management Framework`](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html)
17*   [C-1-3] MUST have a preloaded software keyboard.
18
19Device implementations:
20*   [C-0-1] MUST NOT include a hardware keyboard that does not match one of the
21    formats specified in [android.content.res.Configuration.keyboard](
22    http://developer.android.com/reference/android/content/res/Configuration.html)
23    (QWERTY or 12-key).
24*   SHOULD include additional soft keyboard implementations.
25*   MAY include a hardware keyboard.
26
27### 7.2.2\. Non-touch Navigation
28
29Android includes support for d-pad, trackball, and wheel as mechanisms for
30non-touch navigation.
31
32Device implementations:
33
34*   [C-0-1] MUST report the correct value for
35    [android.content.res.Configuration.navigation](
36    https://developer.android.com/reference/android/content/res/Configuration.html#navigation).
37
38If device implementations lack non-touch navigations, they:
39
40*   [C-1-1] MUST provide a reasonable alternative user interface mechanism for the
41    selection and editing of text, compatible with Input Management Engines. The
42    upstream Android open source implementation includes a selection mechanism
43    suitable for use with devices that lack non-touch navigation inputs.
44
45
46### 7.2.3\. Navigation Keys
47
48The [Home](http://developer.android.com/reference/android/view/KeyEvent.html#`KEYCODE_HOME`),
49[Recents](http://developer.android.com/reference/android/view/KeyEvent.html#`KEYCODE_APP_SWITCH`),
50and [Back](http://developer.android.com/reference/android/view/KeyEvent.html#`KEYCODE_BACK`)
51functions typically provided via an interaction with a dedicated physical button
52or a distinct portion of the touch screen, are essential to the Android
53navigation paradigm and therefore, device implementations:
54
55*   [C-0-1] MUST provide a user affordance to launch installed applications
56    that have an activity with the `<intent-filter>` set with `ACTION=MAIN` and
57    `CATEGORY=LAUNCHER` or `CATEGORY=LEANBACK_LAUNCHER` for Television device
58    implementations.
59    The Home function SHOULD be the mechanism for this user affordance.
60*   SHOULD provide buttons for the Recents and Back function.
61
62If the Home, Recents, or Back functions are provided, they:
63
64*   [C-1-1] MUST be accessible with a single action (e.g. tap, double-click or
65gesture) when any of them are accessible.
66*   [C-1-2] MUST provide a clear indication of which single action would trigger
67each function. Having a visible icon imprinted on the button, showing a software
68icon on the navigation bar portion of the screen, or walking the user through a
69guided step-by-step demo flow during the out-of-box setup experience are
70examples of such an indication.
71
72Device implementations:
73
74*    [SR] are STRONGLY RECOMMENDED to not provide the input mechanism for the
75[Menu function](http://developer.android.com/reference/android/view/KeyEvent.html#`KEYCODE_BACK`)
76as it is deprecated in favor of action bar since Android 4.0.
77
78If device implementations provide the Menu function, they:
79
80*    [C-2-1] MUST display the action overflow button whenever the action
81overflow menu popup is not empty and the action bar is visible.
82*    [C-2-2] MUST NOT modify the position of the action overflow popup
83displayed by selecting the overflow button in the action bar, but MAY render
84the action overflow popup at a modified position on the screen when it is
85displayed by selecting the Menu function.
86
87If device implementations do not provide the Menu function, for backwards
88compatibility, they:
89*    [C-3-1] MUST make the Menu function available to applications when
90`targetSdkVersion` is less than 10, either by a physical button, a software key,
91or gestures. This Menu function should be accessible unless hidden together with
92other navigation functions.
93
94If device implementations provide the [Assist function]((http://developer.android.com/reference/android/view/KeyEvent.html#`KEYCODE_ASSIST`),
95they:
96*    [C-4-1] MUST make the Assist function accessible with a single action
97(e.g. tap, double-click or gesture) when other navigation keys are accessible.
98*    [SR] STRONGLY RECOMMENDED to use long press on HOME function as this
99designated interaction.
100
101If device implementations use a distinct portion of the screen to display the
102navigation keys, they:
103
104*   [C-5-1] Navigation keys MUST use a distinct portion of the screen, not
105    available to applications, and MUST NOT obscure or otherwise interfere with
106    the portion of the screen available to applications.
107*   [C-5-2] MUST make available a portion of the display to applications that
108    meets the requirements defined in [section 7.1.1](#7_1_1_screen_configuration).
109*   [C-5-3] MUST honor the flags set by the app through the [`View.setSystemUiVisibility()`](https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility%28int%29)
110    API method, so that this distinct portion of the screen
111    (a.k.a. the navigation bar) is properly hidden away as documented in
112    the SDK.
113
114### 7.2.4\. Touchscreen Input
115
116Android includes support for a variety of pointer input systems, such as
117touchscreens, touch pads, and fake touch input devices.
118[Touchscreen-based device implementations](http://source.android.com/devices/tech/input/touch-devices.html)
119are associated with a display such that the user has the impression of directly
120manipulating items on screen. Since the user is directly touching the screen,
121the system does not require any additional affordances to indicate the objects
122being manipulated.
123
124Device implementations:
125
126*    SHOULD have a pointer input system of some kind
127     (either mouse-like or touch).
128*    SHOULD support fully independently tracked pointers.
129
130If device implementations include a touchscreen (single-touch or better), they:
131
132*    [C-1-1] MUST report `TOUCHSCREEN_FINGER` for the [`Configuration.touchscreen`](https://developer.android.com/reference/android/content/res/Configuration.html#touchscreen)
133     API field.
134*    [C-1-2] MUST report the `android.hardware.touchscreen` and
135     `android.hardware.faketouch` feature flags
136
137If device implementations include a touchscreen that can track more than
138a single touch, they:
139
140*    [C-2-1] MUST report the appropriate feature flags  `android.hardware.touchscreen.multitouch`,
141`android.hardware.touchscreen.multitouch.distinct`, `android.hardware.touchscreen.multitouch.jazzhand`
142corresponding to the type of the specific touchscreen on the device.
143
144If device implementations do not include a touchscreen (and rely on a pointer
145device only) and meet the fake touch requirements in
146[section 7.2.5](#7_2_5_fake_touch_input), they:
147
148*    [C-3-1] MUST NOT report any feature flag starting with
149`android.hardware.touchscreen` and MUST report only `android.hardware.faketouch`.
150
151### 7.2.5\. Fake Touch Input
152
153Fake touch interface provides a user input system that approximates a subset of
154touchscreen capabilities. For example, a  mouse or remote control that drives
155an on-screen cursor approximates touch, but requires the user to first point or
156focus then click. Numerous input devices like the mouse, trackpad, gyro-based
157air mouse, gyro-pointer, joystick, and multi-touch trackpad can support fake
158touch interactions. Android includes the feature constant
159android.hardware.faketouch, which corresponds to a high-fidelity non-touch
160(pointer-based) input device such as a mouse or trackpad that can adequately
161emulate touch-based input (including basic gesture support), and indicates that
162the device supports an emulated subset of touchscreen functionality.
163
164If device implementations do not include a touchscreen but include another
165pointer input system which they want to make available, they:
166
167*    SHOULD declare support for the `android.hardware.faketouch` feature flag.
168
169If device implementations declare support for `android.hardware.faketouch`,
170they:
171
172*   [C-1-1] MUST report the [absolute X and Y screen positions](
173http://developer.android.com/reference/android/view/MotionEvent.html)
174of the pointer location and display a visual pointer on the screen.
175*   [C-1-2] MUST report touch event with the action code that specifies the
176state change that occurs on the pointer [going down or up on the
177screen](http://developer.android.com/reference/android/view/MotionEvent.html).
178*   [C-1-3] MUST support pointer down and up on an object on the screen, which
179allows users to emulate tap on an object on the screen.
180*   [C-1-4] MUST support pointer down, pointer up, pointer down then pointer up
181in the same place on an object on the screen within a time threshold, which
182allows users to [emulate double tap](
183http://developer.android.com/reference/android/view/MotionEvent.html)
184on an object on the screen.
185*   [C-1-5] MUST support pointer down on an arbitrary point on the screen,
186pointer move to any other arbitrary point on the screen, followed by a pointer
187up, which allows users to emulate a touch drag.
188*   [C-1-6] MUST support pointer down then allow users to quickly move the
189object to a different position on the screen and then pointer up on the screen,
190which allows users to fling an object on the screen.
191*   [C-1-7] MUST report `TOUCHSCREEN_NOTOUCH` for the [`Configuration.touchscreen`](https://developer.android.com/reference/android/content/res/Configuration.html#touchscreen)
192API field.
193
194If device implementations declare support for
195`android.hardware.faketouch.multitouch.distinct`, they:
196
197*    [C-2-1] MUST declare support for `android.hardware.faketouch`.
198*    [C-2-2] MUST support distinct tracking of two or more independent pointer
199inputs.
200
201If device implementations declare support for
202`android.hardware.faketouch.multitouch.jazzhand`, they:
203
204*    [C-3-1] MUST declare support for `android.hardware.faketouch`.
205*    [C-3-2] MUST support distinct tracking of 5 (tracking a hand of fingers)
206or more pointer inputs fully independently.
207
208### 7.2.6\. Game Controller Support
209
210#### 7.2.6.1\. Button Mappings
211
212If device implementations declare the `android.hardware.gamepad` feature flag,
213they:
214*    [C-1-1] MUST have embed a controller or ship with a separate controller
215in the box, that would provide means to input all the events listed in the
216below tables.
217*    [C-1-2] MUST be capable to map HID events to it's associated Android
218`view.InputEvent` constants as listed in the below tables. The upstream Android
219implementation includes implementation for game controllers that satisfies this
220requirement.
221
222<table>
223 <tr>
224    <th>Button</th>
225    <th>HID Usage<sup>2</sup></th>
226    <th>Android Button</th>
227 </tr>
228 <tr>
229    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_A">A</a><sup>1</sup></td>
230    <td>0x09 0x0001</td>
231    <td>KEYCODE_BUTTON_A (96)</td>
232 </tr>
233 <tr>
234    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_B">B</a><sup>1</sup></td>
235    <td>0x09 0x0002</td>
236    <td>KEYCODE_BUTTON_B (97)</td>
237 </tr>
238 <tr>
239    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_X">X</a><sup>1</sup></td>
240    <td>0x09 0x0004</td>
241    <td>KEYCODE_BUTTON_X (99)</td>
242 </tr>
243 <tr>
244    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_Y">Y</a><sup>1</sup></td>
245    <td>0x09 0x0005</td>
246    <td>KEYCODE_BUTTON_Y (100)</td>
247 </tr>
248 <tr>
249    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_DPAD_UP">D-pad up</a><sup>1</sup><br />
250
251<a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_DPAD_DOWN">D-pad down</a><sup>1</sup></td>
252    <td>0x01 0x0039<sup>3</sup></td>
253    <td><a href="http://developer.android.com/reference/android/view/MotionEvent.html#AXIS_HAT_Y">AXIS_HAT_Y</a><sup>4</sup></td>
254 </tr>
255 <tr>
256    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_DPAD_LEFT">D-pad left</a>1<br />
257
258<a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_DPAD_RIGHT">D-pad right</a><sup>1</sup></td>
259    <td>0x01 0x0039<sup>3</sup></td>
260    <td><a href="http://developer.android.com/reference/android/view/MotionEvent.html#AXIS_HAT_X">AXIS_HAT_X</a><sup>4</sup></td>
261 </tr>
262 <tr>
263    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_L1">Left shoulder button</a><sup>1</sup></td>
264    <td>0x09 0x0007</td>
265    <td>KEYCODE_BUTTON_L1 (102)</td>
266 </tr>
267 <tr>
268    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_R1">Right shoulder button</a><sup>1</sup></td>
269    <td>0x09 0x0008</td>
270    <td>KEYCODE_BUTTON_R1 (103)</td>
271 </tr>
272 <tr>
273    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_THUMBL">Left stick click</a><sup>1</sup></td>
274    <td>0x09 0x000E</td>
275    <td>KEYCODE_BUTTON_THUMBL (106)</td>
276 </tr>
277 <tr>
278    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BUTTON_THUMBR">Right stick click</a><sup>1</sup></td>
279    <td>0x09 0x000F</td>
280    <td>KEYCODE_BUTTON_THUMBR (107)</td>
281 </tr>
282 <tr>
283    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_HOME">Home</a><sup>1</sup></td>
284    <td>0x0c 0x0223</td>
285    <td>KEYCODE_HOME (3)</td>
286 </tr>
287 <tr>
288    <td><a href="http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BACK">Back</a><sup>1</sup></td>
289    <td>0x0c 0x0224</td>
290    <td>KEYCODE_BACK (4)</td>
291 </tr>
292</table>
293
294
295<p class="table_footnote">1 <a href="http://developer.android.com/reference/android/view/KeyEvent.html">KeyEvent</a></p>
296
297<p class="table_footnote">2 The above HID usages must be declared within a Game
298pad CA (0x01 0x0005).</p>
299
300<p class="table_footnote">3 This usage must have a Logical Minimum of 0, a
301Logical Maximum of 7, a Physical Minimum of 0, a Physical Maximum of 315, Units
302in Degrees, and a Report Size of 4. The logical value is defined to be the
303clockwise rotation away from the vertical axis; for example, a logical value of
3040 represents no rotation and the up button being pressed, while a logical value
305of 1 represents a rotation of 45 degrees and both the up and left keys being
306pressed.</p>
307
308<p class="table_footnote">4 <a
309href="http://developer.android.com/reference/android/view/MotionEvent.html">MotionEvent</a></p>
310
311<table>
312 <tr>
313    <th>Analog Controls<sup>1</sup></th>
314    <th>HID Usage</th>
315    <th>Android Button</th>
316 </tr>
317 <tr>
318    <td><a href="http://developer.android.com/reference/android/view/MotionEvent.html#AXIS_LTRIGGER">Left Trigger</a></td>
319    <td>0x02 0x00C5</td>
320    <td>AXIS_LTRIGGER </td>
321 </tr>
322 <tr>
323    <td><a href="http://developer.android.com/reference/android/view/MotionEvent.html#AXIS_THROTTLE">Right Trigger</a></td>
324    <td>0x02 0x00C4</td>
325    <td>AXIS_RTRIGGER </td>
326 </tr>
327 <tr>
328    <td><a href="http://developer.android.com/reference/android/view/MotionEvent.html#AXIS_Y">Left Joystick</a></td>
329    <td>0x01 0x0030<br />
330
3310x01 0x0031</td>
332    <td>AXIS_X<br />
333
334AXIS_Y</td>
335 </tr>
336 <tr>
337    <td><a href="http://developer.android.com/reference/android/view/MotionEvent.html#AXIS_Z">Right Joystick</a></td>
338    <td>0x01 0x0032<br />
339
3400x01 0x0035</td>
341    <td>AXIS_Z<br />
342
343AXIS_RZ</td>
344 </tr>
345</table>
346
347
348<p class="table_footnote">1 <a
349href="http://developer.android.com/reference/android/view/MotionEvent.html">MotionEvent</a></p>
350
351### 7.2.7\. Remote Control
352
353See [Section 2.3.1](#2_3_1_hardware) for device-specific requirements.
354
355