Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0058744 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

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
parent 19ad7d0e
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -363,7 +363,8 @@ public:
     * Returns OK on success.
     * Returns OK on success.
     * Returns WOULD_BLOCK if the channel is full.
     * Returns WOULD_BLOCK if the channel is full.
     * Returns DEAD_OBJECT if the channel's peer has been closed.
     * 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.
     * Other errors probably indicate that the channel is broken.
     */
     */
    status_t publishMotionEvent(uint32_t seq, int32_t eventId, int32_t deviceId, int32_t source,
    status_t publishMotionEvent(uint32_t seq, int32_t eventId, int32_t deviceId, int32_t source,
+2 −1
Original line number Original line Diff line number Diff line
@@ -590,7 +590,8 @@ status_t InputPublisher::publishMotionEvent(
                mInputVerifier.processMovement(deviceId, source, action, pointerCount,
                mInputVerifier.processMovement(deviceId, source, action, pointerCount,
                                               pointerProperties, pointerCoords, flags);
                                               pointerProperties, pointerCoords, flags);
        if (!result.ok()) {
        if (!result.ok()) {
            LOG(FATAL) << "Bad stream: " << result.error();
            LOG(ERROR) << "Bad stream: " << result.error();
            return BAD_VALUE;
        }
        }
    }
    }
    if (debugTransportPublisher()) {
    if (debugTransportPublisher()) {
+4 −0
Original line number Original line Diff line number Diff line
@@ -3830,6 +3830,10 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime,
                }
                }
                const MotionEntry& motionEntry = static_cast<const MotionEntry&>(eventEntry);
                const MotionEntry& motionEntry = static_cast<const MotionEntry&>(eventEntry);
                status = publishMotionEvent(*connection, *dispatchEntry);
                status = publishMotionEvent(*connection, *dispatchEntry);
                if (status == BAD_VALUE) {
                    logDispatchStateLocked();
                    LOG(FATAL) << "Publisher failed for " << motionEntry;
                }
                if (mTracer) {
                if (mTracer) {
                    ensureEventTraced(motionEntry);
                    ensureEventTraced(motionEntry);
                    mTracer->traceEventDispatch(*dispatchEntry, *motionEntry.traceTracker);
                    mTracer->traceEventDispatch(*dispatchEntry, *motionEntry.traceTracker);