Cancel ongoing touchpad move gesture if user starts typing
To improve touchpad palm rejection while typing, this change will cancel
any ongoing touchpad move gesture if user starts typing on keyboard. In
this change we:
1. Introduce a new flag to gaurd this change
2. Add behaviour to cancel ongoing gesture
Bug: 301055381
Test: atest inputflinger_tests
Change-Id: I0830cb24f2046380e140cddd71096b8a611c51de
diff --git a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
index 34ca0b3..d331d55 100644
--- a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
@@ -449,6 +449,9 @@
if (mPointerCaptured) {
return mCapturedEventConverter.process(*rawEvent);
}
+ if (mMotionAccumulator.getActiveSlotsCount() == 0) {
+ mGestureStartTime = rawEvent->when;
+ }
std::optional<SelfContainedHardwareState> state = mStateConverter.processRawEvent(rawEvent);
if (state) {
updatePalmDetectionMetrics();
@@ -514,7 +517,7 @@
if (mDisplayId) {
MetricsAccumulator& metricsAccumulator = MetricsAccumulator::getInstance();
for (Gesture& gesture : mGesturesToProcess) {
- out += mGestureConverter.handleGesture(when, readTime, gesture);
+ out += mGestureConverter.handleGesture(when, readTime, mGestureStartTime, gesture);
metricsAccumulator.processGesture(mMetricsId, gesture);
}
}