make SampleCustomInputService -j64
adb install $OUT/target/product/emulator_car_x86/system/app/SampleCustomInputService/SampleCustomInputService.apk
adb shell am start-foreground-service com.android.car.custominput.sample/.SampleCustomInputService
Steps to run unit tests:
atest SampleCustomInputServiceTest
These are the test scripts to demonstrate how CustomInputEvent can be used to implement OEM partners non-standard events. They all represent hypothetical features for the sake of documentation only.
Note: Make sure SampleCustomInputService is installed and started. Especially if you've just ran tests. Depending on the configuration you use, running SampleCustomInputServiceTest may uninstall SampleCustomInputService.
For this example, press home first, then inject the event to start Maps activity by running:
adb shell cmd car_service inject-custom-input -d 0 f1
Parameters are:
-d 0
: sets target display type to main display;f1
: sets the OEM partner function f1
to execute. In this implementation, f1
argument represents the action used to launch Google maps app;Note: For this command to run, ensure that Google Maps app is installed first.
In this example, CustomInputEvents are send to accept or reject incoming calls. First cell phone must be connected to Android via Bluetooth. Then, to accept incoming calls, run:
adb shell cmd car_service inject-custom-input f2
Alternatively, to reject incoming calls, run:
adb shell cmd car_service inject-custom-input f3
To increase media volume, run:
adb shell cmd car_service inject-custom-input f4
To decrease media volume, run:
adb shell cmd car_service inject-custom-input f5
To increase alarm volume, run:
adb shell cmd car_service inject-custom-input f6
To decrease alarm volume, run:
adb shell cmd car_service inject-custom-input f7
To simulate pressing BACK HOME button, run:
adb shell cmd car_service inject-custom-input f8