README.md
1# AOA Helper
2Java utility which allows a host computer to act as a [USB host to an Android device](https://developer.android.com/guide/topics/connectivity/usb/) using [Android Open Accessory Protocol 2.0](https://source.android.com/devices/accessories/aoa2). The host can then send commands (e.g. clicks, swipes, keystrokes, and more) to a connected device without the need for ADB.
3
4## Usage
5Connect to a device using its serial number.
6```
7AoaDeviceManager manager = new AoaDeviceManager();
8AoaDevice device = manager.getDevice("SERIAL");
9```
10
11Perform gestures using coordinates (`0 <= x <= 360` and `0 <= y <= 640`).
12```
13device.click(new Point(0, 0));
14device.scroll(new Point(0, 0), new Point(360, 640));
15```
16
17Write alphanumeric text, or press key combinations using [USB HID usages](https://source.android.com/devices/input/keyboard-devices).
18```
19device.write("hello world");
20device.key(0x52, 0x52, 0x51, 0x51, 0x50, 0x4F, 0x50, 0x4F, 0x05, 0x04);
21```
22
23Press the power `device.wakeUp()`, home `device.goHome()`, or back `device.goBack()` buttons.
24
25## Testing
26Run the unit tests using `atest aoa-helper-test --host`.