Add glue for Gestures logging, and link gestures stack in input reader.

Bug: 251196347
Test: Treehugger
Change-Id: I4307f577ecd4338d16af8264fe05293c1d2e5920
diff --git a/services/inputflinger/reader/Android.bp b/services/inputflinger/reader/Android.bp
index cf02016..46e86de 100644
--- a/services/inputflinger/reader/Android.bp
+++ b/services/inputflinger/reader/Android.bp
@@ -58,6 +58,7 @@
         "mapper/accumulator/MultiTouchMotionAccumulator.cpp",
         "mapper/accumulator/SingleTouchMotionAccumulator.cpp",
         "mapper/accumulator/TouchButtonAccumulator.cpp",
+        "mapper/gestures/GesturesLogging.cpp",
     ],
 }
 
@@ -69,12 +70,14 @@
         "libcap",
         "libcrypto",
         "libcutils",
+        "libjsoncpp",
         "liblog",
         "libstatslog",
         "libutils",
     ],
     static_libs: [
         "libc++fs",
+        "libchrome-gestures",
         "libui-types",
     ],
     header_libs: [
diff --git a/services/inputflinger/reader/mapper/gestures/GesturesLogging.cpp b/services/inputflinger/reader/mapper/gestures/GesturesLogging.cpp
new file mode 100644
index 0000000..81b4968
--- /dev/null
+++ b/services/inputflinger/reader/mapper/gestures/GesturesLogging.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LOG_TAG
+#define LOG_TAG "Gestures"
+#endif
+
+#include <stdio.h>
+
+#include <log/log.h>
+
+#include "include/gestures.h"
+
+extern "C" {
+
+void gestures_log(int verb, const char* fmt, ...) {
+    va_list args;
+    va_start(args, fmt);
+    if (verb == GESTURES_LOG_ERROR) {
+        LOG_PRI_VA(ANDROID_LOG_ERROR, LOG_TAG, fmt, args);
+    } else if (verb == GESTURES_LOG_INFO) {
+        LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, fmt, args);
+    } else {
+        LOG_PRI_VA(ANDROID_LOG_DEBUG, LOG_TAG, fmt, args);
+    }
+    va_end(args);
+}
+}