Adding the workflow for HW_CUSTOM_INPUT in Car Framework
Note: this CL depends on the other CLs under the same topic.
Test script:
1. Start emulator.
2. Build test service reference implementation:
```
make CustomInputTestService -j64
```
3. Install service reference implementation:
```
adb install -r $OUT/target/product/emulator_car_x86/system/app/CustomInputTestService/CustomInputTestService.apk
```
4. Start service
```
adb shell am start-foreground-service com.android.car.custominput/.CustomInputTestService
```
5. Send custom input events
To start activity maps on main display:
```adb shell cmd car_service inject-custom-input -d 0 f1```
See tests/CustomInputTestService/readme.md for a complete explanation on
inject-custom-input parameters.
Bug: 159623196
Test: manual (see test script above)
Test: atest CarServiceUnitTest
Test: atest CarServicesTest
Test: atest CustomInputTestServiceTest (requires CustomInputTestService.apk)
Change-Id: I20e95b2300f2a1db2756bbbd4fa692c91d5dc1ed
diff --git a/service/src/com/android/car/CarInputService.java b/service/src/com/android/car/CarInputService.java
index 409095a..74c1679 100644
--- a/service/src/com/android/car/CarInputService.java
+++ b/service/src/com/android/car/CarInputService.java
@@ -27,6 +27,7 @@
import android.bluetooth.BluetoothProfile;
import android.car.CarProjectionManager;
import android.car.input.CarInputManager;
+import android.car.input.CustomInputEvent;
import android.car.input.ICarInput;
import android.car.input.ICarInputCallback;
import android.car.input.RotaryEvent;
@@ -363,6 +364,17 @@
}
}
+ @Override
+ public void onCustomInputEvent(CustomInputEvent event) {
+ if (!mCaptureController.onCustomInputEvent(event)) {
+ Log.w(CarLog.TAG_INPUT, "Failed to propagate " + event);
+ return;
+ }
+ if (DBG) {
+ Log.d(CarLog.TAG_INPUT, "Succeed injecting " + event);
+ }
+ }
+
private static List<KeyEvent> rotaryEventToKeyEvents(RotaryEvent event) {
int numClicks = event.getNumberOfClicks();
int numEvents = numClicks * 2; // up / down per each click