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/tests/Android.bp b/services/inputflinger/tests/Android.bp
index fcbb98f..b6d0709 100644
--- a/services/inputflinger/tests/Android.bp
+++ b/services/inputflinger/tests/Android.bp
@@ -23,6 +23,7 @@
 
 cc_test {
     name: "inputflinger_tests",
+    host_supported: true,
     defaults: [
         "inputflinger_defaults",
         // For all targets inside inputflinger, these tests build all of their sources using their
@@ -56,10 +57,36 @@
             "frameworks/native/libs/input",
         ],
     },
+    target: {
+        android: {
+            shared_libs: [
+                "libinput",
+                "libvintf",
+            ],
+        },
+        host: {
+            include_dirs: [
+                "bionic/libc/kernel/android/uapi/",
+                "bionic/libc/kernel/uapi",
+            ],
+            cflags: [
+                "-D__ANDROID_HOST__",
+            ],
+            static_libs: [
+                "libinput",
+            ],
+        },
+    },
     static_libs: [
         "libc++fs",
         "libgmock",
     ],
+    shared_libs: [
+        "libinputreader",
+    ],
     require_root: true,
+    test_options: {
+        unit_test: true,
+    },
     test_suites: ["device-tests"],
 }