am 3643c88f: Merge "Send cancelation events to monitors when injection fails." into mnc-dev

* commit '3643c88f7b557e241d65c4857eaf49e28e7c03a2':
  Send cancelation events to monitors when injection fails.
This commit is contained in:
Michael Wright 2015-06-29 17:40:25 +00:00 committed by Android Git Automerger
commit fd0fdaf73b
2 changed files with 16 additions and 1 deletions

View File

@ -859,6 +859,13 @@ bool InputDispatcher::dispatchMotionLocked(
setInjectionResultLocked(entry, injectionResult); setInjectionResultLocked(entry, injectionResult);
if (injectionResult != INPUT_EVENT_INJECTION_SUCCEEDED) { if (injectionResult != INPUT_EVENT_INJECTION_SUCCEEDED) {
if (injectionResult != INPUT_EVENT_INJECTION_PERMISSION_DENIED) {
CancelationOptions::Mode mode(isPointerEvent ?
CancelationOptions::CANCEL_POINTER_EVENTS :
CancelationOptions::CANCEL_NON_POINTER_EVENTS);
CancelationOptions options(mode, "input event injection failed");
synthesizeCancelationEventsForMonitorsLocked(options);
}
return true; return true;
} }
@ -886,7 +893,7 @@ void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const M
"edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%lld", "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%lld",
prefix, prefix,
entry->eventTime, entry->deviceId, entry->source, entry->policyFlags, entry->eventTime, entry->deviceId, entry->source, entry->policyFlags,
entry->action, entry->actionButton entry->flags, entry->action, entry->actionButton, entry->flags,
entry->metaState, entry->buttonState, entry->metaState, entry->buttonState,
entry->edgeFlags, entry->xPrecision, entry->yPrecision, entry->edgeFlags, entry->xPrecision, entry->yPrecision,
entry->downTime); entry->downTime);
@ -2167,6 +2174,13 @@ void InputDispatcher::synthesizeCancelationEventsForAllConnectionsLocked(
} }
} }
void InputDispatcher::synthesizeCancelationEventsForMonitorsLocked(
const CancelationOptions& options) {
for (size_t i = 0; i < mMonitoringChannels.size(); i++) {
synthesizeCancelationEventsForInputChannelLocked(mMonitoringChannels[i], options);
}
}
void InputDispatcher::synthesizeCancelationEventsForInputChannelLocked( void InputDispatcher::synthesizeCancelationEventsForInputChannelLocked(
const sp<InputChannel>& channel, const CancelationOptions& options) { const sp<InputChannel>& channel, const CancelationOptions& options) {
ssize_t index = getConnectionIndexLocked(channel); ssize_t index = getConnectionIndexLocked(channel);

View File

@ -1076,6 +1076,7 @@ private:
void synthesizeCancelationEventsForAllConnectionsLocked( void synthesizeCancelationEventsForAllConnectionsLocked(
const CancelationOptions& options); const CancelationOptions& options);
void synthesizeCancelationEventsForMonitorsLocked(const CancelationOptions& options);
void synthesizeCancelationEventsForInputChannelLocked(const sp<InputChannel>& channel, void synthesizeCancelationEventsForInputChannelLocked(const sp<InputChannel>& channel,
const CancelationOptions& options); const CancelationOptions& options);
void synthesizeCancelationEventsForConnectionLocked(const sp<Connection>& connection, void synthesizeCancelationEventsForConnectionLocked(const sp<Connection>& connection,