USB Port Reset API

To support the USB Hardware Abstraction Layer (HAL) API, device manufacturers must implement the corresponding USB HAL version. To use the USB HAL API, a system-privileged app is required.

The USB HAL supports the USB Port Reset API, which requires USB HAL v2.0 and is available for devices running Android 13 and higher. Use this API to reset the USB connection with the connected host.

Find the USB HAL and its APIs

Device manufacturers must implement the USB HAL to support the APIs.

  1. To find the default implementation of USB HAL, use the following paths:

    Version AIDL (latest): <aosp>/hardware/interfaces/usb/gadget/1.2/default/

  2. To find the hardware interface header file, use the following path:

    Version AIDL (latest): <aosp>/hardware/interfaces/usb/gadget/1.2/IUsbGadget.hal

  3. To find the APIs, use the following path to locate the APIs under the AIDL header file. This path is also the Android Framework entry point for the API:

    android.hardware.usb: <aosp>/core/java/android/hardware/usb

Implement the USB HAL

To work with the USB HAL API, implement the:

  1. Correct USB HAL version. No system UI implementation is required.

  2. USB AIDL HAL for the USB Port Reset API by resetting the USB connection between the target device and the host.

Understand the USB HAL API architecture

The USB HAL API is built into the android.hardware.usb package and leverages the USB HAL to interact with the device. Details about the architecture for the API is provided in the figure below.

USB Port Reset API

The following figure illustrates the code flow of the USB Port Reset API in a framework, including the implementation of the USB HAL.

Sample USB Port Reseat API code flow

Figure 1.1 Sample USB Port Reseat API code flow.

Validate your implementation

Each USB HAL version and its corresponding API is associated with a test case in the Vendor Test Suite (VTS).

USB Port Reset API

To find the VTS test case for the USB Port Reset API, go to:


The VTS test case for USB HAL v1.2 is a host-side test case you can use to perform these actions.

  • To invoke the USB Port Reset API, use the adb shell command (#svc usb resetUsbPort).

  • Confirm that the device under test (DUT) can disconnect and reconnect.