Add more dispatcher tests for appearing windows
It has been suggested that a window that appears while the gesture is
active may cause incorrect behaviour in dispatcher if it then touched
with additional new pointers.
These tests attempt to check some of those scenarios. Currently, there's
no evidence that this could lead to a crash.
Flag: TEST_ONLY
Bug: 341869464
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_break_on_failure --gtest_filter="*SplitTouches*"
Change-Id: I856907958684e84d08858aa4b92199a28095e58a
diff --git a/services/inputflinger/tests/FakeWindows.h b/services/inputflinger/tests/FakeWindows.h
index ee65d3a..3a3238a 100644
--- a/services/inputflinger/tests/FakeWindows.h
+++ b/services/inputflinger/tests/FakeWindows.h
@@ -304,6 +304,13 @@
WithFlags(expectedFlags)));
}
+ inline void consumeMotionPointerDown(int32_t pointerIdx,
+ const ::testing::Matcher<MotionEvent>& matcher) {
+ const int32_t action = AMOTION_EVENT_ACTION_POINTER_DOWN |
+ (pointerIdx << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
+ consumeMotionEvent(testing::AllOf(WithMotionAction(action), matcher));
+ }
+
inline void consumeMotionPointerUp(int32_t pointerIdx,
const ::testing::Matcher<MotionEvent>& matcher) {
const int32_t action = AMOTION_EVENT_ACTION_POINTER_UP |