diff options
| author | 2020-01-27 22:03:30 +0000 | |
|---|---|---|
| committer | 2020-01-27 22:03:30 +0000 | |
| commit | 01b59d86428c71b95f8009109ea1106685d03ddd (patch) | |
| tree | d37e591a9cf755095f56c91d8b44ff05034a0292 | |
| parent | 021c1d8b2c3bbec10030e34f0fee45ada4b9806a (diff) | |
| parent | bd11889b7b505374cc336525dd29ac2958e47551 (diff) | |
Merge "Reduce indentation of a method"
| -rw-r--r-- | services/inputflinger/dispatcher/InputDispatcher.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index 30fdf906fc..14bcbf70f7 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -2699,59 +2699,59 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( std::vector<EventEntry*> cancelationEvents = connection->inputState.synthesizeCancelationEvents(currentTime, options); - if (!cancelationEvents.empty()) { + if (cancelationEvents.empty()) { + return; + } #if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("channel '%s' ~ Synthesized %zu cancelation events to bring channel back in sync " - "with reality: %s, mode=%d.", - connection->getInputChannelName().c_str(), cancelationEvents.size(), options.reason, - options.mode); + ALOGD("channel '%s' ~ Synthesized %zu cancelation events to bring channel back in sync " + "with reality: %s, mode=%d.", + connection->getInputChannelName().c_str(), cancelationEvents.size(), options.reason, + options.mode); #endif - for (size_t i = 0; i < cancelationEvents.size(); i++) { - EventEntry* cancelationEventEntry = cancelationEvents[i]; - switch (cancelationEventEntry->type) { - case EventEntry::Type::KEY: { - logOutboundKeyDetails("cancel - ", - static_cast<const KeyEntry&>(*cancelationEventEntry)); - break; - } - case EventEntry::Type::MOTION: { - logOutboundMotionDetails("cancel - ", - static_cast<const MotionEntry&>( - *cancelationEventEntry)); - break; - } - case EventEntry::Type::FOCUS: { - LOG_ALWAYS_FATAL("Canceling focus events is not supported"); - break; - } - case EventEntry::Type::CONFIGURATION_CHANGED: - case EventEntry::Type::DEVICE_RESET: { - LOG_ALWAYS_FATAL("%s event should not be found inside Connections's queue", - EventEntry::typeToString(cancelationEventEntry->type)); - break; - } + for (size_t i = 0; i < cancelationEvents.size(); i++) { + EventEntry* cancelationEventEntry = cancelationEvents[i]; + switch (cancelationEventEntry->type) { + case EventEntry::Type::KEY: { + logOutboundKeyDetails("cancel - ", + static_cast<const KeyEntry&>(*cancelationEventEntry)); + break; } - - InputTarget target; - sp<InputWindowHandle> windowHandle = - getWindowHandleLocked(connection->inputChannel->getConnectionToken()); - if (windowHandle != nullptr) { - const InputWindowInfo* windowInfo = windowHandle->getInfo(); - target.setDefaultPointerInfo(-windowInfo->frameLeft, -windowInfo->frameTop, - windowInfo->windowXScale, windowInfo->windowYScale); - target.globalScaleFactor = windowInfo->globalScaleFactor; + case EventEntry::Type::MOTION: { + logOutboundMotionDetails("cancel - ", + static_cast<const MotionEntry&>(*cancelationEventEntry)); + break; } - target.inputChannel = connection->inputChannel; - target.flags = InputTarget::FLAG_DISPATCH_AS_IS; - - enqueueDispatchEntryLocked(connection, cancelationEventEntry, // increments ref - target, InputTarget::FLAG_DISPATCH_AS_IS); + case EventEntry::Type::FOCUS: { + LOG_ALWAYS_FATAL("Canceling focus events is not supported"); + break; + } + case EventEntry::Type::CONFIGURATION_CHANGED: + case EventEntry::Type::DEVICE_RESET: { + LOG_ALWAYS_FATAL("%s event should not be found inside Connections's queue", + EventEntry::typeToString(cancelationEventEntry->type)); + break; + } + } - cancelationEventEntry->release(); + InputTarget target; + sp<InputWindowHandle> windowHandle = + getWindowHandleLocked(connection->inputChannel->getConnectionToken()); + if (windowHandle != nullptr) { + const InputWindowInfo* windowInfo = windowHandle->getInfo(); + target.setDefaultPointerInfo(-windowInfo->frameLeft, -windowInfo->frameTop, + windowInfo->windowXScale, windowInfo->windowYScale); + target.globalScaleFactor = windowInfo->globalScaleFactor; } + target.inputChannel = connection->inputChannel; + target.flags = InputTarget::FLAG_DISPATCH_AS_IS; - startDispatchCycleLocked(currentTime, connection); + enqueueDispatchEntryLocked(connection, cancelationEventEntry, // increments ref + target, InputTarget::FLAG_DISPATCH_AS_IS); + + cancelationEventEntry->release(); } + + startDispatchCycleLocked(currentTime, connection); } MotionEntry* InputDispatcher::splitMotionEvent(const MotionEntry& originalMotionEntry, |