Run some inputflinger_tests on host
Sometimes, it's convenient to execute the input tests without having a
connected device. This is especially useful when doing cherry-picks of
patch on a cloud device.
Allow input code to build for host, and enable the tests for running on
host.
Bug: 249591924
Test: atest --host --no-bazel-mode -c -m inputflinger_tests
Change-Id: Ib9be6a5fb6c35ffc450e41cb2a5688bfb2c8d01a
diff --git a/services/inputflinger/reader/Android.bp b/services/inputflinger/reader/Android.bp
index 0f87201..43259c0 100644
--- a/services/inputflinger/reader/Android.bp
+++ b/services/inputflinger/reader/Android.bp
@@ -23,6 +23,7 @@
cc_library_headers {
name: "libinputreader_headers",
+ host_supported: true,
export_include_dirs: [
"controller",
"include",
@@ -36,11 +37,9 @@
srcs: [
"EventHub.cpp",
"InputDevice.cpp",
+ "InputReader.cpp",
+ "TouchVideoDevice.cpp",
"controller/PeripheralController.cpp",
- "mapper/accumulator/CursorButtonAccumulator.cpp",
- "mapper/accumulator/CursorScrollAccumulator.cpp",
- "mapper/accumulator/SingleTouchMotionAccumulator.cpp",
- "mapper/accumulator/TouchButtonAccumulator.cpp",
"mapper/CursorInputMapper.cpp",
"mapper/ExternalStylusInputMapper.cpp",
"mapper/InputMapper.cpp",
@@ -53,8 +52,10 @@
"mapper/SwitchInputMapper.cpp",
"mapper/TouchInputMapper.cpp",
"mapper/VibratorInputMapper.cpp",
- "InputReader.cpp",
- "TouchVideoDevice.cpp",
+ "mapper/accumulator/CursorButtonAccumulator.cpp",
+ "mapper/accumulator/CursorScrollAccumulator.cpp",
+ "mapper/accumulator/SingleTouchMotionAccumulator.cpp",
+ "mapper/accumulator/TouchButtonAccumulator.cpp",
],
}
@@ -66,11 +67,9 @@
"libcap",
"libcrypto",
"libcutils",
- "libinput",
"liblog",
"libstatslog",
"libutils",
- "libPlatformProperties",
],
static_libs: [
"libc++fs",
@@ -80,10 +79,24 @@
"libbatteryservice_headers",
"libinputreader_headers",
],
+ target: {
+ android: {
+ shared_libs: [
+ "libPlatformProperties",
+ "libinput",
+ ],
+ },
+ host: {
+ static_libs: [
+ "libinput",
+ ],
+ },
+ },
}
cc_library_shared {
name: "libinputreader",
+ host_supported: true,
defaults: [
"inputflinger_defaults",
"libinputreader_defaults",
@@ -99,6 +112,14 @@
export_header_lib_headers: [
"libinputreader_headers",
],
+ target: {
+ host: {
+ include_dirs: [
+ "bionic/libc/kernel/android/uapi/",
+ "bionic/libc/kernel/uapi",
+ ],
+ },
+ },
static_libs: [
"libc++fs",
],