Add FLAG_CANCELED for all ACTION_CANCEL events
We are supposed to set FLAG_CANCELED for all ACTION_CANCEL events, but
before this CL, some events didn't have this flag set.
This became apparent when some of the tests were converted to use the
new matcher syntax for consuming the events.
In this CL, add the missing flag.
Bug: 266705421
Test: m inputflinger_tests && $ANDROID_HOST_OUT/nativetest64/inputflinger_tests/inputflinger_tests
Change-Id: Ic17ff1e8d1480c4cbd5c812d9ce0a4ce14627b5e
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index dc9f02a..5d9ee5f 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -3165,6 +3165,9 @@
}
dispatchEntry->resolvedFlags = motionEntry.flags;
+ if (dispatchEntry->resolvedAction == AMOTION_EVENT_ACTION_CANCEL) {
+ dispatchEntry->resolvedFlags |= AMOTION_EVENT_FLAG_CANCELED;
+ }
if (dispatchEntry->targetFlags.test(InputTarget::Flags::WINDOW_IS_OBSCURED)) {
dispatchEntry->resolvedFlags |= AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED;
}