Use libstatssocket_lazy to report stylus metrics

Report stylus prediction metrics using libstatssocket_lazy
as an interim solution while I working on untangling the
build dependency issues (b/338106546) that prevent us from using
libstatslog within libinput.

Test: `adb reboot`, then `adb logcat | egrep -i "statssocket|MotionPredictor"`
  → Shows no bootanimation linker error, and no other errors

Test: `statsd_testdrive -d 3000 718`, then draw with stylus
  → Shows reasonable metrics logged

Bug: 338106546
Bug: 311066949

Change-Id: I05ae5ffdd774d0b25cb7b2435015245d5f712c01
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index cc0649c..8f44b3a 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -289,6 +289,10 @@
                 "motion_predictor_model_prebuilt",
                 "motion_predictor_model_config",
             ],
+            static_libs: [
+                "libstatslog_libinput",
+                "libstatssocket_lazy",
+            ],
         },
         host: {
             include_dirs: [
@@ -299,6 +303,46 @@
     },
 }
 
+cc_library_static {
+    name: "libstatslog_libinput",
+    generated_sources: ["statslog_libinput.cpp"],
+    generated_headers: ["statslog_libinput.h"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    export_generated_headers: ["statslog_libinput.h"],
+    shared_libs: [
+        "libcutils",
+        "liblog",
+        "libutils",
+    ],
+    static_libs: [
+        "libstatssocket_lazy",
+    ],
+}
+
+genrule {
+    name: "statslog_libinput.h",
+    tools: ["stats-log-api-gen"],
+    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h " +
+        "--module libinput --namespace android,libinput",
+    out: [
+        "statslog_libinput.h",
+    ],
+}
+
+genrule {
+    name: "statslog_libinput.cpp",
+    tools: ["stats-log-api-gen"],
+    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp " +
+        "--module libinput --namespace android,libinput " +
+        "--importHeader statslog_libinput.h",
+    out: [
+        "statslog_libinput.cpp",
+    ],
+}
+
 cc_defaults {
     name: "libinput_fuzz_defaults",
     cpp_std: "c++20",