Merge changes from topic "gestures-lib-sysprop"

* changes:
  Use a sysprop to enable `TouchpadInputMapper`
  Add gestures library to whole_static_libs for input reader
diff --git a/services/inputflinger/reader/Android.bp b/services/inputflinger/reader/Android.bp
index f5ac8de..c93443a 100644
--- a/services/inputflinger/reader/Android.bp
+++ b/services/inputflinger/reader/Android.bp
@@ -116,6 +116,9 @@
         "libchrome-gestures_headers",
         "libinputreader_headers",
     ],
+    whole_static_libs: [
+        "libchrome-gestures",
+    ],
 }
 
 cc_library_shared {
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp
index 150a8aa..8d5377f 100644
--- a/services/inputflinger/reader/InputDevice.cpp
+++ b/services/inputflinger/reader/InputDevice.cpp
@@ -20,6 +20,9 @@
 
 #include <algorithm>
 
+#if defined(__ANDROID__)
+#include <android/sysprop/InputProperties.sysprop.h>
+#endif
 #include <ftl/flags.h>
 
 #include "CursorInputMapper.h"
@@ -209,9 +212,13 @@
     }
 
     // Touchscreens and touchpad devices.
-    // TODO(b/251196347): replace this with a proper flag.
-    constexpr bool ENABLE_NEW_TOUCHPAD_STACK = false;
-    if (ENABLE_NEW_TOUCHPAD_STACK && classes.test(InputDeviceClass::TOUCHPAD) &&
+    static const bool ENABLE_TOUCHPAD_GESTURES_LIBRARY =
+#if defined(__ANDROID__)
+            sysprop::InputProperties::enable_touchpad_gestures_library().value_or(false);
+#else
+            false;
+#endif
+    if (ENABLE_TOUCHPAD_GESTURES_LIBRARY && classes.test(InputDeviceClass::TOUCHPAD) &&
         classes.test(InputDeviceClass::TOUCH_MT)) {
         mappers.push_back(std::make_unique<TouchpadInputMapper>(*contextPtr));
     } else if (classes.test(InputDeviceClass::TOUCH_MT)) {