Loading services/inputflinger/dispatcher/Entry.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ static std::string keyActionToString(int32_t action) { // --- EventEntry --- EventEntry::EventEntry(uint32_t sequenceNum, int32_t type, nsecs_t eventTime, uint32_t policyFlags) EventEntry::EventEntry(uint32_t sequenceNum, Type type, nsecs_t eventTime, uint32_t policyFlags) : sequenceNum(sequenceNum), refCount(1), type(type), Loading Loading @@ -92,7 +92,7 @@ void EventEntry::releaseInjectionState() { // --- ConfigurationChangedEntry --- ConfigurationChangedEntry::ConfigurationChangedEntry(uint32_t sequenceNum, nsecs_t eventTime) : EventEntry(sequenceNum, TYPE_CONFIGURATION_CHANGED, eventTime, 0) {} : EventEntry(sequenceNum, Type::CONFIGURATION_CHANGED, eventTime, 0) {} ConfigurationChangedEntry::~ConfigurationChangedEntry() {} Loading @@ -103,7 +103,7 @@ void ConfigurationChangedEntry::appendDescription(std::string& msg) const { // --- DeviceResetEntry --- DeviceResetEntry::DeviceResetEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId) : EventEntry(sequenceNum, TYPE_DEVICE_RESET, eventTime, 0), deviceId(deviceId) {} : EventEntry(sequenceNum, Type::DEVICE_RESET, eventTime, 0), deviceId(deviceId) {} DeviceResetEntry::~DeviceResetEntry() {} Loading @@ -117,7 +117,7 @@ KeyEntry::KeyEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId, ui int32_t displayId, uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime) : EventEntry(sequenceNum, TYPE_KEY, eventTime, policyFlags), : EventEntry(sequenceNum, Type::KEY, eventTime, policyFlags), deviceId(deviceId), source(source), displayId(displayId), Loading Loading @@ -165,7 +165,7 @@ MotionEntry::MotionEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t device float xCursorPosition, float yCursorPosition, nsecs_t downTime, uint32_t pointerCount, const PointerProperties* pointerProperties, const PointerCoords* pointerCoords, float xOffset, float yOffset) : EventEntry(sequenceNum, TYPE_MOTION, eventTime, policyFlags), : EventEntry(sequenceNum, Type::MOTION, eventTime, policyFlags), eventTime(eventTime), deviceId(deviceId), source(source), Loading services/inputflinger/dispatcher/Entry.h +16 −3 Original line number Diff line number Diff line Loading @@ -33,11 +33,24 @@ namespace android::inputdispatcher { constexpr uint32_t SYNTHESIZED_EVENT_SEQUENCE_NUM = 0; struct EventEntry { enum { TYPE_CONFIGURATION_CHANGED, TYPE_DEVICE_RESET, TYPE_KEY, TYPE_MOTION }; enum class Type { CONFIGURATION_CHANGED, DEVICE_RESET, KEY, MOTION }; static const char* typeToString(Type type) { switch (type) { case Type::CONFIGURATION_CHANGED: return "CONFIGURATION_CHANGED"; case Type::DEVICE_RESET: return "DEVICE_RESET"; case Type::KEY: return "KEY"; case Type::MOTION: return "MOTION"; } } uint32_t sequenceNum; mutable int32_t refCount; int32_t type; Type type; nsecs_t eventTime; uint32_t policyFlags; InjectionState* injectionState; Loading Loading @@ -66,7 +79,7 @@ struct EventEntry { virtual void appendDescription(std::string& msg) const = 0; protected: EventEntry(uint32_t sequenceNum, int32_t type, nsecs_t eventTime, uint32_t policyFlags); EventEntry(uint32_t sequenceNum, Type type, nsecs_t eventTime, uint32_t policyFlags); virtual ~EventEntry(); void releaseInjectionState(); }; Loading services/inputflinger/dispatcher/InputDispatcher.cpp +55 −28 Original line number Diff line number Diff line Loading @@ -386,7 +386,7 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { } switch (mPendingEvent->type) { case EventEntry::TYPE_CONFIGURATION_CHANGED: { case EventEntry::Type::CONFIGURATION_CHANGED: { ConfigurationChangedEntry* typedEntry = static_cast<ConfigurationChangedEntry*>(mPendingEvent); done = dispatchConfigurationChangedLocked(currentTime, typedEntry); Loading @@ -394,14 +394,14 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { break; } case EventEntry::TYPE_DEVICE_RESET: { case EventEntry::Type::DEVICE_RESET: { DeviceResetEntry* typedEntry = static_cast<DeviceResetEntry*>(mPendingEvent); done = dispatchDeviceResetLocked(currentTime, typedEntry); dropReason = DropReason::NOT_DROPPED; // device resets are never dropped break; } case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { KeyEntry* typedEntry = static_cast<KeyEntry*>(mPendingEvent); if (isAppSwitchDue) { if (isAppSwitchKeyEvent(*typedEntry)) { Loading @@ -421,7 +421,7 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { MotionEntry* typedEntry = static_cast<MotionEntry*>(mPendingEvent); if (dropReason == DropReason::NOT_DROPPED && isAppSwitchDue) { dropReason = DropReason::APP_SWITCH; Loading @@ -435,10 +435,6 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { done = dispatchMotionLocked(currentTime, typedEntry, &dropReason, nextWakeupTime); break; } default: ALOG_ASSERT(false); break; } if (done) { Loading @@ -458,7 +454,7 @@ bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) { traceInboundQueueLengthLocked(); switch (entry->type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { // Optimize app switch latency. // If the application takes too long to catch up then we drop all events preceding // the app switch key. Loading @@ -480,7 +476,7 @@ bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) { break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { // Optimize case where the current application is unresponsive and the user // decides to touch a window in a different application. // If the application takes too long to catch up then we drop all events preceding Loading Loading @@ -508,6 +504,11 @@ bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) { } break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { // nothing to do break; } } return needWake; Loading Loading @@ -627,12 +628,12 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason } switch (entry.type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, reason); synthesizeCancelationEventsForAllConnectionsLocked(options); break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(entry); if (motionEntry.source & AINPUT_SOURCE_CLASS_POINTER) { CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, reason); Loading @@ -643,6 +644,11 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason } break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("Should not drop %s events", EventEntry::typeToString(entry.type)); break; } } } Loading Loading @@ -1174,18 +1180,19 @@ void InputDispatcher::resetANRTimeoutsLocked() { int32_t InputDispatcher::getTargetDisplayId(const EventEntry& entry) { int32_t displayId; switch (entry.type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { const KeyEntry& keyEntry = static_cast<const KeyEntry&>(entry); displayId = keyEntry.displayId; break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(entry); displayId = motionEntry.displayId; break; } default: { ALOGE("Unsupported event type '%" PRId32 "' for target display.", entry.type); case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { ALOGE("%s events do not have a target display", EventEntry::typeToString(entry.type)); return ADISPLAY_ID_NONE; } } Loading Loading @@ -1849,7 +1856,7 @@ std::string InputDispatcher::checkWindowReadyForMoreInputLocked( } // Ensure that the dispatch queues aren't too far backed up for this event. if (eventEntry.type == EventEntry::TYPE_KEY) { if (eventEntry.type == EventEntry::Type::KEY) { // If the event is a key event, then we must wait for all previous events to // complete before delivering it because previous events may have the // side-effect of transferring focus to a different window and we want to Loading Loading @@ -1937,7 +1944,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry& eventEntry) { int32_t eventType = USER_ACTIVITY_EVENT_OTHER; switch (eventEntry.type) { case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(eventEntry); if (motionEntry.action == AMOTION_EVENT_ACTION_CANCEL) { return; Loading @@ -1948,7 +1955,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry& eventEntry) { } break; } case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { const KeyEntry& keyEntry = static_cast<const KeyEntry&>(eventEntry); if (keyEntry.flags & AKEY_EVENT_FLAG_CANCELED) { return; Loading @@ -1956,6 +1963,12 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry& eventEntry) { eventType = USER_ACTIVITY_EVENT_BUTTON; break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("%s events are not user activity", EventEntry::typeToString(eventEntry.type)); break; } } std::unique_ptr<CommandEntry> commandEntry = Loading Loading @@ -1996,7 +2009,7 @@ void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime, // Split a motion event if needed. if (inputTarget->flags & InputTarget::FLAG_SPLIT) { ALOG_ASSERT(eventEntry->type == EventEntry::TYPE_MOTION); ALOG_ASSERT(eventEntry->type == EventEntry::Type::MOTION); const MotionEntry& originalMotionEntry = static_cast<const MotionEntry&>(*eventEntry); if (inputTarget->pointerIds.count() != originalMotionEntry.pointerCount) { Loading Loading @@ -2080,7 +2093,7 @@ void InputDispatcher::enqueueDispatchEntryLocked(const sp<Connection>& connectio // Apply target flags and update the connection's input state. switch (eventEntry->type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { const KeyEntry& keyEntry = static_cast<const KeyEntry&>(*eventEntry); dispatchEntry->resolvedAction = keyEntry.action; dispatchEntry->resolvedFlags = keyEntry.flags; Loading @@ -2097,7 +2110,7 @@ void InputDispatcher::enqueueDispatchEntryLocked(const sp<Connection>& connectio break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(*eventEntry); if (dispatchMode & InputTarget::FLAG_DISPATCH_AS_OUTSIDE) { dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_OUTSIDE; Loading Loading @@ -2147,6 +2160,12 @@ void InputDispatcher::enqueueDispatchEntryLocked(const sp<Connection>& connectio break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("%s events should not go to apps", EventEntry::typeToString(eventEntry->type)); break; } } // Remember that we are waiting for this dispatch to complete. Loading Loading @@ -2206,7 +2225,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, status_t status; EventEntry* eventEntry = dispatchEntry->eventEntry; switch (eventEntry->type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { KeyEntry* keyEntry = static_cast<KeyEntry*>(eventEntry); // Publish the key event. Loading @@ -2221,7 +2240,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { MotionEntry* motionEntry = static_cast<MotionEntry*>(eventEntry); PointerCoords scaledCoords[MAX_POINTERS]; Loading Loading @@ -2502,16 +2521,24 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( for (size_t i = 0; i < cancelationEvents.size(); i++) { EventEntry* cancelationEventEntry = cancelationEvents[i]; switch (cancelationEventEntry->type) { case EventEntry::TYPE_KEY: case EventEntry::Type::KEY: { logOutboundKeyDetails("cancel - ", static_cast<const KeyEntry&>(*cancelationEventEntry)); break; case EventEntry::TYPE_MOTION: } case EventEntry::Type::MOTION: { logOutboundMotionDetails("cancel - ", static_cast<const MotionEntry&>( *cancelationEventEntry)); 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; } } InputTarget target; sp<InputWindowHandle> windowHandle = Loading Loading @@ -4237,11 +4264,11 @@ void InputDispatcher::doDispatchCycleFinishedLockedInterruptible(CommandEntry* c } bool restartEvent; if (dispatchEntry->eventEntry->type == EventEntry::TYPE_KEY) { if (dispatchEntry->eventEntry->type == EventEntry::Type::KEY) { KeyEntry* keyEntry = static_cast<KeyEntry*>(dispatchEntry->eventEntry); restartEvent = afterKeyEventLockedInterruptible(connection, dispatchEntry, keyEntry, handled); } else if (dispatchEntry->eventEntry->type == EventEntry::TYPE_MOTION) { } else if (dispatchEntry->eventEntry->type == EventEntry::Type::MOTION) { MotionEntry* motionEntry = static_cast<MotionEntry*>(dispatchEntry->eventEntry); restartEvent = afterMotionEventLockedInterruptible(connection, dispatchEntry, motionEntry, handled); Loading services/inputflinger/reader/mapper/SwitchInputMapper.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,8 @@ void SwitchInputMapper::processSwitch(int32_t switchCode, int32_t switchValue) { void SwitchInputMapper::sync(nsecs_t when) { if (mUpdatedSwitchMask) { uint32_t updatedSwitchValues = mSwitchValues & mUpdatedSwitchMask; NotifySwitchArgs args(mContext->getNextSequenceNum(), when, 0, updatedSwitchValues, mUpdatedSwitchMask); NotifySwitchArgs args(mContext->getNextSequenceNum(), when, 0 /*policyFlags*/, updatedSwitchValues, mUpdatedSwitchMask); getListener()->notifySwitch(&args); mUpdatedSwitchMask = 0; Loading Loading
services/inputflinger/dispatcher/Entry.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ static std::string keyActionToString(int32_t action) { // --- EventEntry --- EventEntry::EventEntry(uint32_t sequenceNum, int32_t type, nsecs_t eventTime, uint32_t policyFlags) EventEntry::EventEntry(uint32_t sequenceNum, Type type, nsecs_t eventTime, uint32_t policyFlags) : sequenceNum(sequenceNum), refCount(1), type(type), Loading Loading @@ -92,7 +92,7 @@ void EventEntry::releaseInjectionState() { // --- ConfigurationChangedEntry --- ConfigurationChangedEntry::ConfigurationChangedEntry(uint32_t sequenceNum, nsecs_t eventTime) : EventEntry(sequenceNum, TYPE_CONFIGURATION_CHANGED, eventTime, 0) {} : EventEntry(sequenceNum, Type::CONFIGURATION_CHANGED, eventTime, 0) {} ConfigurationChangedEntry::~ConfigurationChangedEntry() {} Loading @@ -103,7 +103,7 @@ void ConfigurationChangedEntry::appendDescription(std::string& msg) const { // --- DeviceResetEntry --- DeviceResetEntry::DeviceResetEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId) : EventEntry(sequenceNum, TYPE_DEVICE_RESET, eventTime, 0), deviceId(deviceId) {} : EventEntry(sequenceNum, Type::DEVICE_RESET, eventTime, 0), deviceId(deviceId) {} DeviceResetEntry::~DeviceResetEntry() {} Loading @@ -117,7 +117,7 @@ KeyEntry::KeyEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId, ui int32_t displayId, uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime) : EventEntry(sequenceNum, TYPE_KEY, eventTime, policyFlags), : EventEntry(sequenceNum, Type::KEY, eventTime, policyFlags), deviceId(deviceId), source(source), displayId(displayId), Loading Loading @@ -165,7 +165,7 @@ MotionEntry::MotionEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t device float xCursorPosition, float yCursorPosition, nsecs_t downTime, uint32_t pointerCount, const PointerProperties* pointerProperties, const PointerCoords* pointerCoords, float xOffset, float yOffset) : EventEntry(sequenceNum, TYPE_MOTION, eventTime, policyFlags), : EventEntry(sequenceNum, Type::MOTION, eventTime, policyFlags), eventTime(eventTime), deviceId(deviceId), source(source), Loading
services/inputflinger/dispatcher/Entry.h +16 −3 Original line number Diff line number Diff line Loading @@ -33,11 +33,24 @@ namespace android::inputdispatcher { constexpr uint32_t SYNTHESIZED_EVENT_SEQUENCE_NUM = 0; struct EventEntry { enum { TYPE_CONFIGURATION_CHANGED, TYPE_DEVICE_RESET, TYPE_KEY, TYPE_MOTION }; enum class Type { CONFIGURATION_CHANGED, DEVICE_RESET, KEY, MOTION }; static const char* typeToString(Type type) { switch (type) { case Type::CONFIGURATION_CHANGED: return "CONFIGURATION_CHANGED"; case Type::DEVICE_RESET: return "DEVICE_RESET"; case Type::KEY: return "KEY"; case Type::MOTION: return "MOTION"; } } uint32_t sequenceNum; mutable int32_t refCount; int32_t type; Type type; nsecs_t eventTime; uint32_t policyFlags; InjectionState* injectionState; Loading Loading @@ -66,7 +79,7 @@ struct EventEntry { virtual void appendDescription(std::string& msg) const = 0; protected: EventEntry(uint32_t sequenceNum, int32_t type, nsecs_t eventTime, uint32_t policyFlags); EventEntry(uint32_t sequenceNum, Type type, nsecs_t eventTime, uint32_t policyFlags); virtual ~EventEntry(); void releaseInjectionState(); }; Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +55 −28 Original line number Diff line number Diff line Loading @@ -386,7 +386,7 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { } switch (mPendingEvent->type) { case EventEntry::TYPE_CONFIGURATION_CHANGED: { case EventEntry::Type::CONFIGURATION_CHANGED: { ConfigurationChangedEntry* typedEntry = static_cast<ConfigurationChangedEntry*>(mPendingEvent); done = dispatchConfigurationChangedLocked(currentTime, typedEntry); Loading @@ -394,14 +394,14 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { break; } case EventEntry::TYPE_DEVICE_RESET: { case EventEntry::Type::DEVICE_RESET: { DeviceResetEntry* typedEntry = static_cast<DeviceResetEntry*>(mPendingEvent); done = dispatchDeviceResetLocked(currentTime, typedEntry); dropReason = DropReason::NOT_DROPPED; // device resets are never dropped break; } case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { KeyEntry* typedEntry = static_cast<KeyEntry*>(mPendingEvent); if (isAppSwitchDue) { if (isAppSwitchKeyEvent(*typedEntry)) { Loading @@ -421,7 +421,7 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { MotionEntry* typedEntry = static_cast<MotionEntry*>(mPendingEvent); if (dropReason == DropReason::NOT_DROPPED && isAppSwitchDue) { dropReason = DropReason::APP_SWITCH; Loading @@ -435,10 +435,6 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { done = dispatchMotionLocked(currentTime, typedEntry, &dropReason, nextWakeupTime); break; } default: ALOG_ASSERT(false); break; } if (done) { Loading @@ -458,7 +454,7 @@ bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) { traceInboundQueueLengthLocked(); switch (entry->type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { // Optimize app switch latency. // If the application takes too long to catch up then we drop all events preceding // the app switch key. Loading @@ -480,7 +476,7 @@ bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) { break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { // Optimize case where the current application is unresponsive and the user // decides to touch a window in a different application. // If the application takes too long to catch up then we drop all events preceding Loading Loading @@ -508,6 +504,11 @@ bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) { } break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { // nothing to do break; } } return needWake; Loading Loading @@ -627,12 +628,12 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason } switch (entry.type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, reason); synthesizeCancelationEventsForAllConnectionsLocked(options); break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(entry); if (motionEntry.source & AINPUT_SOURCE_CLASS_POINTER) { CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, reason); Loading @@ -643,6 +644,11 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason } break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("Should not drop %s events", EventEntry::typeToString(entry.type)); break; } } } Loading Loading @@ -1174,18 +1180,19 @@ void InputDispatcher::resetANRTimeoutsLocked() { int32_t InputDispatcher::getTargetDisplayId(const EventEntry& entry) { int32_t displayId; switch (entry.type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { const KeyEntry& keyEntry = static_cast<const KeyEntry&>(entry); displayId = keyEntry.displayId; break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(entry); displayId = motionEntry.displayId; break; } default: { ALOGE("Unsupported event type '%" PRId32 "' for target display.", entry.type); case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { ALOGE("%s events do not have a target display", EventEntry::typeToString(entry.type)); return ADISPLAY_ID_NONE; } } Loading Loading @@ -1849,7 +1856,7 @@ std::string InputDispatcher::checkWindowReadyForMoreInputLocked( } // Ensure that the dispatch queues aren't too far backed up for this event. if (eventEntry.type == EventEntry::TYPE_KEY) { if (eventEntry.type == EventEntry::Type::KEY) { // If the event is a key event, then we must wait for all previous events to // complete before delivering it because previous events may have the // side-effect of transferring focus to a different window and we want to Loading Loading @@ -1937,7 +1944,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry& eventEntry) { int32_t eventType = USER_ACTIVITY_EVENT_OTHER; switch (eventEntry.type) { case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(eventEntry); if (motionEntry.action == AMOTION_EVENT_ACTION_CANCEL) { return; Loading @@ -1948,7 +1955,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry& eventEntry) { } break; } case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { const KeyEntry& keyEntry = static_cast<const KeyEntry&>(eventEntry); if (keyEntry.flags & AKEY_EVENT_FLAG_CANCELED) { return; Loading @@ -1956,6 +1963,12 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry& eventEntry) { eventType = USER_ACTIVITY_EVENT_BUTTON; break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("%s events are not user activity", EventEntry::typeToString(eventEntry.type)); break; } } std::unique_ptr<CommandEntry> commandEntry = Loading Loading @@ -1996,7 +2009,7 @@ void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime, // Split a motion event if needed. if (inputTarget->flags & InputTarget::FLAG_SPLIT) { ALOG_ASSERT(eventEntry->type == EventEntry::TYPE_MOTION); ALOG_ASSERT(eventEntry->type == EventEntry::Type::MOTION); const MotionEntry& originalMotionEntry = static_cast<const MotionEntry&>(*eventEntry); if (inputTarget->pointerIds.count() != originalMotionEntry.pointerCount) { Loading Loading @@ -2080,7 +2093,7 @@ void InputDispatcher::enqueueDispatchEntryLocked(const sp<Connection>& connectio // Apply target flags and update the connection's input state. switch (eventEntry->type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { const KeyEntry& keyEntry = static_cast<const KeyEntry&>(*eventEntry); dispatchEntry->resolvedAction = keyEntry.action; dispatchEntry->resolvedFlags = keyEntry.flags; Loading @@ -2097,7 +2110,7 @@ void InputDispatcher::enqueueDispatchEntryLocked(const sp<Connection>& connectio break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { const MotionEntry& motionEntry = static_cast<const MotionEntry&>(*eventEntry); if (dispatchMode & InputTarget::FLAG_DISPATCH_AS_OUTSIDE) { dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_OUTSIDE; Loading Loading @@ -2147,6 +2160,12 @@ void InputDispatcher::enqueueDispatchEntryLocked(const sp<Connection>& connectio break; } case EventEntry::Type::CONFIGURATION_CHANGED: case EventEntry::Type::DEVICE_RESET: { LOG_ALWAYS_FATAL("%s events should not go to apps", EventEntry::typeToString(eventEntry->type)); break; } } // Remember that we are waiting for this dispatch to complete. Loading Loading @@ -2206,7 +2225,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, status_t status; EventEntry* eventEntry = dispatchEntry->eventEntry; switch (eventEntry->type) { case EventEntry::TYPE_KEY: { case EventEntry::Type::KEY: { KeyEntry* keyEntry = static_cast<KeyEntry*>(eventEntry); // Publish the key event. Loading @@ -2221,7 +2240,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, break; } case EventEntry::TYPE_MOTION: { case EventEntry::Type::MOTION: { MotionEntry* motionEntry = static_cast<MotionEntry*>(eventEntry); PointerCoords scaledCoords[MAX_POINTERS]; Loading Loading @@ -2502,16 +2521,24 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( for (size_t i = 0; i < cancelationEvents.size(); i++) { EventEntry* cancelationEventEntry = cancelationEvents[i]; switch (cancelationEventEntry->type) { case EventEntry::TYPE_KEY: case EventEntry::Type::KEY: { logOutboundKeyDetails("cancel - ", static_cast<const KeyEntry&>(*cancelationEventEntry)); break; case EventEntry::TYPE_MOTION: } case EventEntry::Type::MOTION: { logOutboundMotionDetails("cancel - ", static_cast<const MotionEntry&>( *cancelationEventEntry)); 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; } } InputTarget target; sp<InputWindowHandle> windowHandle = Loading Loading @@ -4237,11 +4264,11 @@ void InputDispatcher::doDispatchCycleFinishedLockedInterruptible(CommandEntry* c } bool restartEvent; if (dispatchEntry->eventEntry->type == EventEntry::TYPE_KEY) { if (dispatchEntry->eventEntry->type == EventEntry::Type::KEY) { KeyEntry* keyEntry = static_cast<KeyEntry*>(dispatchEntry->eventEntry); restartEvent = afterKeyEventLockedInterruptible(connection, dispatchEntry, keyEntry, handled); } else if (dispatchEntry->eventEntry->type == EventEntry::TYPE_MOTION) { } else if (dispatchEntry->eventEntry->type == EventEntry::Type::MOTION) { MotionEntry* motionEntry = static_cast<MotionEntry*>(dispatchEntry->eventEntry); restartEvent = afterMotionEventLockedInterruptible(connection, dispatchEntry, motionEntry, handled); Loading
services/inputflinger/reader/mapper/SwitchInputMapper.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,8 @@ void SwitchInputMapper::processSwitch(int32_t switchCode, int32_t switchValue) { void SwitchInputMapper::sync(nsecs_t when) { if (mUpdatedSwitchMask) { uint32_t updatedSwitchValues = mSwitchValues & mUpdatedSwitchMask; NotifySwitchArgs args(mContext->getNextSequenceNum(), when, 0, updatedSwitchValues, mUpdatedSwitchMask); NotifySwitchArgs args(mContext->getNextSequenceNum(), when, 0 /*policyFlags*/, updatedSwitchValues, mUpdatedSwitchMask); getListener()->notifySwitch(&args); mUpdatedSwitchMask = 0; Loading