Add new `TouchpadInputMapper` class
This will replace `MultiTouchInputMapper` and `SingleTouchInputMapper`
for touchpad devices, and will be the wrapper for the gestures library.
Bug: 251196347
Test: connect Apple Magic Trackpad 2 to device, check logs come out
Test: atest inputflinger_tests
Change-Id: Ia8ee1779a40c6c6f98373e114c040bf13b7f213d
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp
index e6ab872..6ca6298 100644
--- a/services/inputflinger/reader/InputDevice.cpp
+++ b/services/inputflinger/reader/InputDevice.cpp
@@ -33,6 +33,7 @@
#include "SensorInputMapper.h"
#include "SingleTouchInputMapper.h"
#include "SwitchInputMapper.h"
+#include "TouchpadInputMapper.h"
#include "VibratorInputMapper.h"
using android::hardware::input::InputDeviceCountryCode;
@@ -208,7 +209,11 @@
}
// Touchscreens and touchpad devices.
- if (classes.test(InputDeviceClass::TOUCH_MT)) {
+ // 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)) {
+ mappers.push_back(std::make_unique<TouchpadInputMapper>(*contextPtr));
+ } else if (classes.test(InputDeviceClass::TOUCH_MT)) {
mappers.push_back(std::make_unique<MultiTouchInputMapper>(*contextPtr));
} else if (classes.test(InputDeviceClass::TOUCH)) {
mappers.push_back(std::make_unique<SingleTouchInputMapper>(*contextPtr));