DO NOT MERGE Do not crash when invalid event is received
The inputlistener is sending some bad data to InputDispatcher. We
suspect it's coming from the InputReader, and is caused by uninitialized
data. While we are looking for the root cause and trying to address it
by refactoring, let's not crash and just skip handling of the bad event.
Bug: 256009910
Test: none
Change-Id: If7061e17837183b81e52f7d076b8d9a980d70ae0
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 43cac05..a4b81b7 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -4178,9 +4178,12 @@
args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION));
}
}
- LOG_ALWAYS_FATAL_IF(!validateMotionEvent(args->action, args->actionButton, args->pointerCount,
- args->pointerProperties),
- "Invalid event: %s", args->dump().c_str());
+
+ if (!validateMotionEvent(args->action, args->actionButton, args->pointerCount,
+ args->pointerProperties)) {
+ LOG(ERROR) << "Invalid event: " << args->dump();
+ return;
+ }
uint32_t policyFlags = args->policyFlags;
policyFlags |= POLICY_FLAG_TRUSTED;