Allow touch split enabled when no window touched
If no window can be touched by first touch down, it would still deliver
the event to the gesture monitor. So before gesture monitor pilfer the
touch, if a new window supports split touch, it can't recevied the new
point down event cause device looks unresponsive.
Test: atest inputflinger_test
Bug: 201647070
Change-Id: Ib0734ef7082bf673afb11eef9ec7bdb0b3f103ec
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index d5d906b..4b07a21 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -2103,7 +2103,7 @@
const std::vector<Monitor> newGestureMonitors = isDown
? selectResponsiveMonitorsLocked(
getValueByKey(mGestureMonitorsByDisplay, displayId))
- : std::vector<Monitor>{};
+ : tempTouchState.gestureMonitors;
if (newTouchedWindowHandle == nullptr && newGestureMonitors.empty()) {
ALOGI("Dropping event because there is no touchable window or gesture monitor at "
@@ -2139,6 +2139,10 @@
pointerIds.markBit(pointerId);
}
tempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds);
+ } else if (tempTouchState.windows.empty()) {
+ // If no window is touched, set split to true. This will allow the next pointer down to
+ // be delivered to a new window which supports split touch.
+ tempTouchState.split = true;
}
tempTouchState.addGestureMonitors(newGestureMonitors);
@@ -5546,6 +5550,7 @@
canceledWindows.c_str());
// Then clear the current touch state so we stop dispatching to them as well.
+ state.split = false;
state.filterNonMonitors();
}
return OK;