diff options
author | 2024-07-01 16:42:49 -0700 | |
---|---|---|
committer | 2024-07-06 20:42:37 +0000 | |
commit | b0058744c3d701845ef149c5605f2fee50006f10 (patch) | |
tree | f3e6f5e079265b56bd51e19d6bcf6b2b7afa970c | |
parent | 19ad7d0ec189c8e0e524e0783519701bca964c2f (diff) |
Dump dispatcher state during publisher error
When publisher encounters an error, it crashes. Today, those crashes
lack the corresponding dispatcher context.
In this CL, we change the pipeline so that the dispatcher crashes
instead. This would help us see the dump of the dispatcher state and get
better idea of how things went wrong.
Bug: 347700797
Flag: EXEMPT refactor
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_break_on_failure --gtest_filter="*SpyThatPreventsSplittingWithApplication*"
Change-Id: Iac148751703de833503c2638ef20dcb4cb137297
-rw-r--r-- | include/input/InputTransport.h | 3 | ||||
-rw-r--r-- | libs/input/InputTransport.cpp | 3 | ||||
-rw-r--r-- | services/inputflinger/dispatcher/InputDispatcher.cpp | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/include/input/InputTransport.h b/include/input/InputTransport.h index b26a194a0e..7d11f76c85 100644 --- a/include/input/InputTransport.h +++ b/include/input/InputTransport.h @@ -363,7 +363,8 @@ public: * Returns OK on success. * Returns WOULD_BLOCK if the channel is full. * Returns DEAD_OBJECT if the channel's peer has been closed. - * Returns BAD_VALUE if seq is 0 or if pointerCount is less than 1 or greater than MAX_POINTERS. + * Returns BAD_VALUE if seq is 0 or if pointerCount is less than 1 or greater than MAX_POINTERS, + * or if the verifier is enabled and the event failed verification upon publishing. * Other errors probably indicate that the channel is broken. */ status_t publishMotionEvent(uint32_t seq, int32_t eventId, int32_t deviceId, int32_t source, diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp index bac681df85..68cee0b211 100644 --- a/libs/input/InputTransport.cpp +++ b/libs/input/InputTransport.cpp @@ -590,7 +590,8 @@ status_t InputPublisher::publishMotionEvent( mInputVerifier.processMovement(deviceId, source, action, pointerCount, pointerProperties, pointerCoords, flags); if (!result.ok()) { - LOG(FATAL) << "Bad stream: " << result.error(); + LOG(ERROR) << "Bad stream: " << result.error(); + return BAD_VALUE; } } if (debugTransportPublisher()) { diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index a2e50d7d87..e76f098fb1 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -3830,6 +3830,10 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, } const MotionEntry& motionEntry = static_cast<const MotionEntry&>(eventEntry); status = publishMotionEvent(*connection, *dispatchEntry); + if (status == BAD_VALUE) { + logDispatchStateLocked(); + LOG(FATAL) << "Publisher failed for " << motionEntry; + } if (mTracer) { ensureEventTraced(motionEntry); mTracer->traceEventDispatch(*dispatchEntry, *motionEntry.traceTracker); |