Misc fixes in InputDispatcher
Minor refactors to reduce the diff in the upcoming CLs
Bug: 211379801
Test: atest inputflinger_tests
Change-Id: I1f0fd663ba3b49fba4727a4e1a144f65ae3ad6f5
diff --git a/services/inputflinger/dispatcher/InputState.cpp b/services/inputflinger/dispatcher/InputState.cpp
index ccffe26..b21427d 100644
--- a/services/inputflinger/dispatcher/InputState.cpp
+++ b/services/inputflinger/dispatcher/InputState.cpp
@@ -83,6 +83,11 @@
}
}
+/**
+ * Return:
+ * true if the incoming event was correctly tracked,
+ * false if the incoming event should be dropped.
+ */
bool InputState::trackMotion(const MotionEntry& entry, int32_t action, int32_t flags) {
int32_t actionMasked = action & AMOTION_EVENT_ACTION_MASK;
switch (actionMasked) {
@@ -310,7 +315,7 @@
nsecs_t currentTime) {
std::vector<std::unique_ptr<EventEntry>> events;
for (MotionMemento& memento : mMotionMementos) {
- if (!(memento.source & AINPUT_SOURCE_CLASS_POINTER)) {
+ if (!isFromSource(memento.source, AINPUT_SOURCE_CLASS_POINTER)) {
continue;
}
@@ -443,7 +448,7 @@
MotionMemento& memento = mMotionMementos[i];
// Since we support split pointers we need to merge touch events
// from the same source + device + screen.
- if (memento.source & AINPUT_SOURCE_CLASS_POINTER) {
+ if (isFromSource(memento.source, AINPUT_SOURCE_CLASS_POINTER)) {
bool merged = false;
for (size_t j = 0; j < other.mMotionMementos.size(); j++) {
MotionMemento& otherMemento = other.mMotionMementos[j];