Loading services/input/InputDispatcher.cpp +24 −6 Original line number Original line Diff line number Diff line Loading @@ -1914,10 +1914,21 @@ void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime, connection->getInputChannelName()); connection->getInputChannelName()); logOutboundMotionDetailsLocked(" ", splitMotionEntry); logOutboundMotionDetailsLocked(" ", splitMotionEntry); #endif #endif eventEntry = splitMotionEntry; enqueueDispatchEntriesLocked(currentTime, connection, splitMotionEntry, inputTarget, resumeWithAppendedMotionSample); splitMotionEntry->release(); return; } } } } // Not splitting. Enqueue dispatch entries for the event as is. enqueueDispatchEntriesLocked(currentTime, connection, eventEntry, inputTarget, resumeWithAppendedMotionSample); } void InputDispatcher::enqueueDispatchEntriesLocked(nsecs_t currentTime, const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample) { // Resume the dispatch cycle with a freshly appended motion sample. // Resume the dispatch cycle with a freshly appended motion sample. // First we check that the last dispatch entry in the outbound queue is for the same // First we check that the last dispatch entry in the outbound queue is for the same // motion event to which we appended the motion sample. If we find such a dispatch // motion event to which we appended the motion sample. If we find such a dispatch Loading Loading @@ -2054,9 +2065,6 @@ void InputDispatcher::enqueueDispatchEntryLocked( DispatchEntry* dispatchEntry = new DispatchEntry(eventEntry, // increments ref DispatchEntry* dispatchEntry = new DispatchEntry(eventEntry, // increments ref inputTargetFlags, inputTarget->xOffset, inputTarget->yOffset, inputTargetFlags, inputTarget->xOffset, inputTarget->yOffset, inputTarget->scaleFactor); inputTarget->scaleFactor); if (dispatchEntry->hasForegroundTarget()) { incrementPendingForegroundDispatchesLocked(eventEntry); } // Handle the case where we could not stream a new motion sample because the consumer has // Handle the case where we could not stream a new motion sample because the consumer has // already consumed the motion event (otherwise the corresponding dispatch entry would // already consumed the motion event (otherwise the corresponding dispatch entry would Loading Loading @@ -2085,6 +2093,7 @@ void InputDispatcher::enqueueDispatchEntryLocked( LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent key event", LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent key event", connection->getInputChannelName()); connection->getInputChannelName()); #endif #endif delete dispatchEntry; return; // skip the inconsistent event return; // skip the inconsistent event } } break; break; Loading Loading @@ -2126,12 +2135,18 @@ void InputDispatcher::enqueueDispatchEntryLocked( LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent motion event", LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent motion event", connection->getInputChannelName()); connection->getInputChannelName()); #endif #endif delete dispatchEntry; return; // skip the inconsistent event return; // skip the inconsistent event } } break; break; } } } } // Remember that we are waiting for this dispatch to complete. if (dispatchEntry->hasForegroundTarget()) { incrementPendingForegroundDispatchesLocked(eventEntry); } // Enqueue the dispatch entry. // Enqueue the dispatch entry. connection->outboundQueue.enqueueAtTail(dispatchEntry); connection->outboundQueue.enqueueAtTail(dispatchEntry); } } Loading Loading @@ -2470,14 +2485,17 @@ void InputDispatcher::synthesizeCancelationEventsForInputChannelLocked( void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( const sp<Connection>& connection, const CancelationOptions& options) { const sp<Connection>& connection, const CancelationOptions& options) { if (connection->status == Connection::STATUS_BROKEN) { return; } nsecs_t currentTime = now(); nsecs_t currentTime = now(); mTempCancelationEvents.clear(); mTempCancelationEvents.clear(); connection->inputState.synthesizeCancelationEvents(currentTime, connection->inputState.synthesizeCancelationEvents(currentTime, mTempCancelationEvents, options); mTempCancelationEvents, options); if (! mTempCancelationEvents.isEmpty() if (!mTempCancelationEvents.isEmpty()) { && connection->status != Connection::STATUS_BROKEN) { #if DEBUG_OUTBOUND_EVENT_DETAILS #if DEBUG_OUTBOUND_EVENT_DETAILS LOGD("channel '%s' ~ Synthesized %d cancelation events to bring channel back in sync " LOGD("channel '%s' ~ Synthesized %d cancelation events to bring channel back in sync " "with reality: %s, mode=%d.", "with reality: %s, mode=%d.", Loading services/input/InputDispatcher.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1070,6 +1070,9 @@ private: void prepareDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection, void prepareDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample); bool resumeWithAppendedMotionSample); void enqueueDispatchEntriesLocked(nsecs_t currentTime, const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample); void enqueueDispatchEntryLocked(const sp<Connection>& connection, void enqueueDispatchEntryLocked(const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample, int32_t dispatchMode); bool resumeWithAppendedMotionSample, int32_t dispatchMode); Loading Loading
services/input/InputDispatcher.cpp +24 −6 Original line number Original line Diff line number Diff line Loading @@ -1914,10 +1914,21 @@ void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime, connection->getInputChannelName()); connection->getInputChannelName()); logOutboundMotionDetailsLocked(" ", splitMotionEntry); logOutboundMotionDetailsLocked(" ", splitMotionEntry); #endif #endif eventEntry = splitMotionEntry; enqueueDispatchEntriesLocked(currentTime, connection, splitMotionEntry, inputTarget, resumeWithAppendedMotionSample); splitMotionEntry->release(); return; } } } } // Not splitting. Enqueue dispatch entries for the event as is. enqueueDispatchEntriesLocked(currentTime, connection, eventEntry, inputTarget, resumeWithAppendedMotionSample); } void InputDispatcher::enqueueDispatchEntriesLocked(nsecs_t currentTime, const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample) { // Resume the dispatch cycle with a freshly appended motion sample. // Resume the dispatch cycle with a freshly appended motion sample. // First we check that the last dispatch entry in the outbound queue is for the same // First we check that the last dispatch entry in the outbound queue is for the same // motion event to which we appended the motion sample. If we find such a dispatch // motion event to which we appended the motion sample. If we find such a dispatch Loading Loading @@ -2054,9 +2065,6 @@ void InputDispatcher::enqueueDispatchEntryLocked( DispatchEntry* dispatchEntry = new DispatchEntry(eventEntry, // increments ref DispatchEntry* dispatchEntry = new DispatchEntry(eventEntry, // increments ref inputTargetFlags, inputTarget->xOffset, inputTarget->yOffset, inputTargetFlags, inputTarget->xOffset, inputTarget->yOffset, inputTarget->scaleFactor); inputTarget->scaleFactor); if (dispatchEntry->hasForegroundTarget()) { incrementPendingForegroundDispatchesLocked(eventEntry); } // Handle the case where we could not stream a new motion sample because the consumer has // Handle the case where we could not stream a new motion sample because the consumer has // already consumed the motion event (otherwise the corresponding dispatch entry would // already consumed the motion event (otherwise the corresponding dispatch entry would Loading Loading @@ -2085,6 +2093,7 @@ void InputDispatcher::enqueueDispatchEntryLocked( LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent key event", LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent key event", connection->getInputChannelName()); connection->getInputChannelName()); #endif #endif delete dispatchEntry; return; // skip the inconsistent event return; // skip the inconsistent event } } break; break; Loading Loading @@ -2126,12 +2135,18 @@ void InputDispatcher::enqueueDispatchEntryLocked( LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent motion event", LOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent motion event", connection->getInputChannelName()); connection->getInputChannelName()); #endif #endif delete dispatchEntry; return; // skip the inconsistent event return; // skip the inconsistent event } } break; break; } } } } // Remember that we are waiting for this dispatch to complete. if (dispatchEntry->hasForegroundTarget()) { incrementPendingForegroundDispatchesLocked(eventEntry); } // Enqueue the dispatch entry. // Enqueue the dispatch entry. connection->outboundQueue.enqueueAtTail(dispatchEntry); connection->outboundQueue.enqueueAtTail(dispatchEntry); } } Loading Loading @@ -2470,14 +2485,17 @@ void InputDispatcher::synthesizeCancelationEventsForInputChannelLocked( void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( const sp<Connection>& connection, const CancelationOptions& options) { const sp<Connection>& connection, const CancelationOptions& options) { if (connection->status == Connection::STATUS_BROKEN) { return; } nsecs_t currentTime = now(); nsecs_t currentTime = now(); mTempCancelationEvents.clear(); mTempCancelationEvents.clear(); connection->inputState.synthesizeCancelationEvents(currentTime, connection->inputState.synthesizeCancelationEvents(currentTime, mTempCancelationEvents, options); mTempCancelationEvents, options); if (! mTempCancelationEvents.isEmpty() if (!mTempCancelationEvents.isEmpty()) { && connection->status != Connection::STATUS_BROKEN) { #if DEBUG_OUTBOUND_EVENT_DETAILS #if DEBUG_OUTBOUND_EVENT_DETAILS LOGD("channel '%s' ~ Synthesized %d cancelation events to bring channel back in sync " LOGD("channel '%s' ~ Synthesized %d cancelation events to bring channel back in sync " "with reality: %s, mode=%d.", "with reality: %s, mode=%d.", Loading
services/input/InputDispatcher.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -1070,6 +1070,9 @@ private: void prepareDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection, void prepareDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample); bool resumeWithAppendedMotionSample); void enqueueDispatchEntriesLocked(nsecs_t currentTime, const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample); void enqueueDispatchEntryLocked(const sp<Connection>& connection, void enqueueDispatchEntryLocked(const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget, EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample, int32_t dispatchMode); bool resumeWithAppendedMotionSample, int32_t dispatchMode); Loading