Loading services/inputflinger/dispatcher/Entry.h +1 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ struct KeyEntry : EventEntry { mutable InterceptKeyResult interceptKeyResult; // set based on the interception result mutable nsecs_t interceptKeyWakeupTime; // used with INTERCEPT_KEY_RESULT_TRY_AGAIN_LATER mutable int32_t flags; // TODO(b/328618922): Refactor key repeat generation to make repeatCount non-mutable. mutable int32_t repeatCount; KeyEntry(int32_t id, std::shared_ptr<InjectionState> injectionState, nsecs_t eventTime, Loading services/inputflinger/dispatcher/trace/InputTracer.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -107,6 +107,10 @@ void InputTracer::eventProcessingComplete(const EventTrackerInterface& cookie) { void InputTracer::traceEventDispatch(const DispatchEntry& dispatchEntry, const EventTrackerInterface* cookie) { const EventEntry& entry = *dispatchEntry.eventEntry; // TODO(b/328618922): Remove resolved key repeats after making repeatCount non-mutable. // The KeyEntry's repeatCount is mutable and can be modified after an event is initially traced, // so we need to find the repeatCount at the time of dispatching to trace it accurately. int32_t resolvedKeyRepeatCount = 0; TracedEvent traced; if (entry.type == EventEntry::Type::MOTION) { Loading @@ -114,6 +118,7 @@ void InputTracer::traceEventDispatch(const DispatchEntry& dispatchEntry, traced = createTracedEvent(motion); } else if (entry.type == EventEntry::Type::KEY) { const auto& key = static_cast<const KeyEntry&>(entry); resolvedKeyRepeatCount = key.repeatCount; traced = createTracedEvent(key); } else { LOG(FATAL) << "Cannot trace EventEntry of type: " << ftl::enum_string(entry.type); Loading @@ -133,7 +138,7 @@ void InputTracer::traceEventDispatch(const DispatchEntry& dispatchEntry, mBackend->traceWindowDispatch({std::move(traced), dispatchEntry.deliveryTime, dispatchEntry.resolvedFlags, dispatchEntry.targetUid, vsyncId, windowId, dispatchEntry.transform, dispatchEntry.rawTransform, /*hmac=*/{}}); /*hmac=*/{}, resolvedKeyRepeatCount}); } InputTracer::EventState& InputTracer::getState(const EventTrackerInterface& cookie) { Loading services/inputflinger/dispatcher/trace/InputTracingBackendInterface.h +1 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public: ui::Transform transform; ui::Transform rawTransform; std::array<uint8_t, 32> hmac; int32_t resolvedKeyRepeatCount; }; virtual void traceWindowDispatch(const WindowDispatchArgs&) = 0; }; Loading services/inputflinger/tests/FakeInputTracingBackend.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,8 @@ KeyEvent toInputEvent(const trace::TracedKeyEvent& e, const std::array<uint8_t, 32>& hmac) { KeyEvent traced; traced.initialize(e.id, e.deviceId, e.source, e.displayId, hmac, e.action, dispatchArgs.resolvedFlags, e.keyCode, e.scanCode, e.metaState, e.repeatCount, e.downTime, e.eventTime); dispatchArgs.resolvedFlags, e.keyCode, e.scanCode, e.metaState, dispatchArgs.resolvedKeyRepeatCount, e.downTime, e.eventTime); return traced; } Loading Loading
services/inputflinger/dispatcher/Entry.h +1 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ struct KeyEntry : EventEntry { mutable InterceptKeyResult interceptKeyResult; // set based on the interception result mutable nsecs_t interceptKeyWakeupTime; // used with INTERCEPT_KEY_RESULT_TRY_AGAIN_LATER mutable int32_t flags; // TODO(b/328618922): Refactor key repeat generation to make repeatCount non-mutable. mutable int32_t repeatCount; KeyEntry(int32_t id, std::shared_ptr<InjectionState> injectionState, nsecs_t eventTime, Loading
services/inputflinger/dispatcher/trace/InputTracer.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -107,6 +107,10 @@ void InputTracer::eventProcessingComplete(const EventTrackerInterface& cookie) { void InputTracer::traceEventDispatch(const DispatchEntry& dispatchEntry, const EventTrackerInterface* cookie) { const EventEntry& entry = *dispatchEntry.eventEntry; // TODO(b/328618922): Remove resolved key repeats after making repeatCount non-mutable. // The KeyEntry's repeatCount is mutable and can be modified after an event is initially traced, // so we need to find the repeatCount at the time of dispatching to trace it accurately. int32_t resolvedKeyRepeatCount = 0; TracedEvent traced; if (entry.type == EventEntry::Type::MOTION) { Loading @@ -114,6 +118,7 @@ void InputTracer::traceEventDispatch(const DispatchEntry& dispatchEntry, traced = createTracedEvent(motion); } else if (entry.type == EventEntry::Type::KEY) { const auto& key = static_cast<const KeyEntry&>(entry); resolvedKeyRepeatCount = key.repeatCount; traced = createTracedEvent(key); } else { LOG(FATAL) << "Cannot trace EventEntry of type: " << ftl::enum_string(entry.type); Loading @@ -133,7 +138,7 @@ void InputTracer::traceEventDispatch(const DispatchEntry& dispatchEntry, mBackend->traceWindowDispatch({std::move(traced), dispatchEntry.deliveryTime, dispatchEntry.resolvedFlags, dispatchEntry.targetUid, vsyncId, windowId, dispatchEntry.transform, dispatchEntry.rawTransform, /*hmac=*/{}}); /*hmac=*/{}, resolvedKeyRepeatCount}); } InputTracer::EventState& InputTracer::getState(const EventTrackerInterface& cookie) { Loading
services/inputflinger/dispatcher/trace/InputTracingBackendInterface.h +1 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public: ui::Transform transform; ui::Transform rawTransform; std::array<uint8_t, 32> hmac; int32_t resolvedKeyRepeatCount; }; virtual void traceWindowDispatch(const WindowDispatchArgs&) = 0; }; Loading
services/inputflinger/tests/FakeInputTracingBackend.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,8 @@ KeyEvent toInputEvent(const trace::TracedKeyEvent& e, const std::array<uint8_t, 32>& hmac) { KeyEvent traced; traced.initialize(e.id, e.deviceId, e.source, e.displayId, hmac, e.action, dispatchArgs.resolvedFlags, e.keyCode, e.scanCode, e.metaState, e.repeatCount, e.downTime, e.eventTime); dispatchArgs.resolvedFlags, e.keyCode, e.scanCode, e.metaState, dispatchArgs.resolvedKeyRepeatCount, e.downTime, e.eventTime); return traced; } Loading