1## 7.7\. USB
2
3If device implementations have a USB port, they:
4
5*    SHOULD support USB peripheral mode and SHOULD support USB host mode.
6
7### 7.7.1\. USB peripheral mode
8
9If device implementations include a USB port supporting peripheral mode:
10
11*    [C-1-1] The port MUST be connectable to a USB host that has a standard
12type-A or type-C USB port.
13*    [C-1-2] MUST report the correct value of `iSerialNumber` in USB standard
14device descriptor through `android.os.Build.SERIAL`.
15*    [C-1-3]  MUST detect 1.5A and 3.0A chargers per the Type-C resistor
16standard and MUST detect changes in the advertisement if they support
17Type-C USB.
18*    [SR] The port SHOULD use micro-B, micro-AB or Type-C USB form factor.
19Existing and new Android devices are **STRONGLY RECOMMENDED to meet these
20requirements** so they will be able to upgrade to the future platform releases.
21*    [SR] The port SHOULD be located on the bottom of the device
22(according to natural orientation) or enable software screen rotation for
23all apps (including home screen), so that the display draws correctly when
24the device is oriented with the port at bottom. Existing and new Android
25devices are **STRONGLY RECOMMENDED to meet these requirements** so they will
26be able to upgrade to future platform releases.
27*    [SR] SHOULD implement support to draw 1.5 A current during HS chirp
28and traffic as specified in the [USB Battery Charging specification, revision 1.2](http://www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip).
29Existing and new Android devices are **STRONGLY RECOMMENDED to meet these
30requirements** so they will be able to upgrade to the future platform releases.
31*    [SR] STRONGLY RECOMMENDED to not support proprietary
32charging methods that modify Vbus voltage beyond default levels, or alter
33sink/source roles as such may result in interoperability issues with the
34chargers or devices that support the standard USB Power Delivery methods. While
35this is called out as "STRONGLY RECOMMENDED", in future Android versions we
36might REQUIRE all type-C devices to support full interoperability with standard
37type-C chargers.
38*    [SR] STRONGLY RECOMMENDED to support Power Delivery for data and
39power role swapping when they support Type-C USB and USB host mode.
40*    SHOULD support Power Delivery for high-voltage charging and support for
41Alternate Modes such as display out.
42*    SHOULD implement the Android Open Accessory (AOA) API and specification as
43documented in the Android SDK documentation.
44
45If device implementations including a USB port, implement the AOA specification,
46they:
47
48*    [C-2-1] MUST declare support for the hardware feature
49[`android.hardware.usb.accessory`](http://developer.android.com/guide/topics/connectivity/usb/accessory.html).
50*    [C-2-2] The USB mass storage class MUST include the string "android" at the
51end of the interface description `iInterface` string of the USB mass storage
52*    SHOULD NOT implement [AOAv2 audio](https://source.android.com/devices/accessories/aoa2#audio-support)
53documented in the Android Open Accessory Protocol 2.0 documentation. AOAv2 audio
54is deprecated as of Android version 8.0 (API level 26).
55
56
57### 7.7.2\. USB host mode
58
59If device implementations include a USB port supporting host mode, they:
60
61*   [C-1-1] MUST implement the Android USB host API as documented in the
62Android SDK and MUST declare support for the hardware feature
63[`android.hardware.usb.host`](http://developer.android.com/guide/topics/connectivity/usb/host.html).
64*   [C-1-2] MUST implement support to connect standard USB peripherals,
65in other words, they MUST either:
66     *   Have an on-device type C port or ship with cable(s) adapting an on-device
67     proprietary port to a standard USB type-C port (USB Type-C device).
68     *   Have an on-device type A or ship with cable(s) adapting an on-device
69     proprietary port to a standard USB type-A port.
70     *   Have an on-device micro-AB port, which SHOULD ship with a cable adapting
71     to a standard type-A port.
72*   [C-1-3] MUST NOT ship with an adapter converting from USB type A or
73micro-AB ports to a type-C port (receptacle).
74*   [SR] STRONGLY RECOMMENDED to implement the [USB audio class](
75http://developer.android.com/reference/android/hardware/usb/UsbConstants.html#USB_CLASS_AUDIO)
76as documented in the Android SDK documentation.
77*   SHOULD support charging the connected USB peripheral device while in host
78    mode; advertising a source current of at least 1.5A as specified in the
79    Termination Parameters section of the
80    [USB Type-C Cable and Connector Specification Revision 1.2](
81    http://www.usb.org/developers/docs/usb_31_021517.zip) for USB Type-C
82    connectors or using Charging Downstream Port(CDP) output current range as
83    specified in the [USB Battery Charging specifications, revision 1.2](
84    http://www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip)
85    for Micro-AB connectors.
86*   SHOULD implement and support USB Type-C standards.
87
88If device implementations include a USB port supporting host mode and the USB
89audio class, they:
90
91*    [C-2-1] MUST support the [USB HID class](https://developer.android.com/reference/android/hardware/usb/UsbConstants.html#USB_CLASS_HID).
92*    [C-2-2] MUST support the detection and mapping of the following HID data
93fields specified in the [USB HID Usage Tables](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
94and the [Voice Command Usage Request](http://www.usb.org/developers/hidpage/Voice_Command_Usage.pdf)
95to the [`KeyEvent`](https://developer.android.com/reference/android/view/KeyEvent.html)
96constants as below:
97       *   Usage Page (0xC) Usage ID (0x0CD): `KEYCODE_MEDIA_PLAY_PAUSE`
98       *   Usage Page (0xC) Usage ID (0x0E9): `KEYCODE_VOLUME_UP`
99       *   Usage Page (0xC) Usage ID (0x0EA): `KEYCODE_VOLUME_DOWN`
100       *   Usage Page (0xC) Usage ID (0x0CF): `KEYCODE_VOICE_ASSIST`
101
102
103If device implementations include a USB port supporting host mode and
104the Storage Access Framework (SAF), they:
105
106*   [C-3-1] MUST recognize any remotely connected MTP (Media Transfer Protocol)
107devices and make their contents accessible through the `ACTION_GET_CONTENT`,
108`ACTION_OPEN_DOCUMENT`, and `ACTION_CREATE_DOCUMENT` intents. .
109
110If device implementations include a USB port supporting host mode and USB
111Type-C, they:
112
113*   [C-4-1] MUST implement Dual Role Port functionality as defined by the USB
114Type-C specification (section 4.5.1.3.3).
115*   [SR] STRONGLY RECOMMENDED to support DisplayPort, SHOULD support USB
116SuperSpeed Data Rates, and are STRONGLY RECOMMENDED to support Power Delivery
117for data and power role swapping.
118*   [SR] STRONGLY RECOMMENDED to NOT support Audio Adapter Accessory Mode as
119described in the Appendix A of the
120[USB Type-C Cable and Connector Specification Revision 1.2](
121http://www.usb.org/developers/docs/).
122*   SHOULD implement the Try.\* model that is most appropriate for the
123device form factor. For example a handheld device SHOULD implement the
124Try.SNK model.
125