summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorHu Guo <guohu@xiaomi.corp-partner.google.com>2023-11-15 09:50:04 +0000
committerHu Guo <guohu@xiaomi.corp-partner.google.com>2023-12-23 13:51:22 +0000
commit3cfa73870841ee0b0fdb041cca2819c6df0eae93 (patch)
treee3c60d7167a351acda14fdff36a0277985c669ba /services
parent767bb25c593706ddd2b8a143effba253930b1c03 (diff)
downloadnative-3cfa73870841ee0b0fdb041cca2819c6df0eae93.tar.gz
Cancel only the gesture corresponding to the dropped event
Test: atest inputflinger_tests Change-Id: Id5d8a9d9f107ae1393f0f645330242b79f8df79a
Diffstat (limited to 'services')
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 7981e9acb5..f2612cf92d 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -1326,6 +1326,9 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason
switch (entry.type) {
case EventEntry::Type::KEY: {
CancelationOptions options(CancelationOptions::Mode::CANCEL_NON_POINTER_EVENTS, reason);
+ const KeyEntry& keyEntry = static_cast<const KeyEntry&>(entry);
+ options.displayId = keyEntry.displayId;
+ options.deviceId = keyEntry.deviceId;
synthesizeCancelationEventsForAllConnectionsLocked(options);
break;
}
@@ -1333,10 +1336,14 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason
const MotionEntry& motionEntry = static_cast<const MotionEntry&>(entry);
if (motionEntry.source & AINPUT_SOURCE_CLASS_POINTER) {
CancelationOptions options(CancelationOptions::Mode::CANCEL_POINTER_EVENTS, reason);
+ options.displayId = motionEntry.displayId;
+ options.deviceId = motionEntry.deviceId;
synthesizeCancelationEventsForAllConnectionsLocked(options);
} else {
CancelationOptions options(CancelationOptions::Mode::CANCEL_NON_POINTER_EVENTS,
reason);
+ options.displayId = motionEntry.displayId;
+ options.deviceId = motionEntry.deviceId;
synthesizeCancelationEventsForAllConnectionsLocked(options);
}
break;