InputDispatcher: Use a single dispatch mode per target
Previously, the concept of dispatch mode was intertwined with
InputTarget flags. Since dispatch modes were part of the flags, it was
possible for an InputTarget of one event to be receive the event through
more than one dispatch mode.
Right now, there should be no use case for a target to have one event
dispatched through multiple dispatch modes. Even for the case in which
an ACTION_DOWN for a hovering pointer should generate both HOVER_EXIT
and ACTION_DOWN, this process is handled by using two InputTargets
instead of reusing one target to send both events.
We pull out the dispatch modes from the target flags into its own enum.
Dispatch modes are no longer flags, so each input target will have
exactly one dispatch mode. If an event should be dispatched via multiple
modes to the same window, mutiple InputTargets should be used.
Bug: 210460522
Test: atest inpuflinger_tests
Change-Id: I6c3f082ad48e312db6fcdeb7ef7c158d9dc53c2d
diff --git a/services/inputflinger/dispatcher/InputTarget.cpp b/services/inputflinger/dispatcher/InputTarget.cpp
index 343630c..c02c5d6 100644
--- a/services/inputflinger/dispatcher/InputTarget.cpp
+++ b/services/inputflinger/dispatcher/InputTarget.cpp
@@ -95,6 +95,7 @@
} else {
out << "<null>";
}
+ out << ", dispatchMode=" << ftl::enum_string(target.dispatchMode).c_str();
out << ", targetFlags=" << target.flags.string();
out << ", pointers=" << target.getPointerInfoString();
out << "}";