Loading services/inputflinger/dispatcher/Entry.cpp +4 −20 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ VerifiedMotionEvent verifiedMotionEventFromMotionEntry(const MotionEntry& entry) EventEntry::EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policyFlags) : id(id), refCount(1), type(type), eventTime(eventTime), policyFlags(policyFlags), Loading @@ -70,15 +69,6 @@ EventEntry::~EventEntry() { releaseInjectionState(); } void EventEntry::release() { refCount -= 1; if (refCount == 0) { delete this; } else { ALOG_ASSERT(refCount > 0); } } void EventEntry::releaseInjectionState() { if (injectionState) { injectionState->release(); Loading Loading @@ -235,22 +225,16 @@ std::string MotionEntry::getDescription() const { volatile int32_t DispatchEntry::sNextSeqAtomic; DispatchEntry::DispatchEntry(EventEntry* eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor) DispatchEntry::DispatchEntry(std::shared_ptr<EventEntry> eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor) : seq(nextSeq()), eventEntry(eventEntry), eventEntry(std::move(eventEntry)), targetFlags(targetFlags), transform(transform), globalScaleFactor(globalScaleFactor), deliveryTime(0), resolvedAction(0), resolvedFlags(0) { eventEntry->refCount += 1; } DispatchEntry::~DispatchEntry() { eventEntry->release(); } resolvedFlags(0) {} uint32_t DispatchEntry::nextSeq() { // Sequence number 0 is reserved and will never be returned. Loading services/inputflinger/dispatcher/Entry.h +6 −14 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ struct EventEntry { } int32_t id; mutable int32_t refCount; Type type; nsecs_t eventTime; uint32_t policyFlags; Loading @@ -79,13 +78,12 @@ struct EventEntry { return isInjected() || IdGenerator::getSource(id) != IdGenerator::Source::INPUT_READER; } void release(); virtual std::string getDescription() const = 0; protected: EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policyFlags); virtual ~EventEntry(); protected: void releaseInjectionState(); }; Loading @@ -93,7 +91,6 @@ struct ConfigurationChangedEntry : EventEntry { explicit ConfigurationChangedEntry(int32_t id, nsecs_t eventTime); std::string getDescription() const override; protected: virtual ~ConfigurationChangedEntry(); }; Loading @@ -103,7 +100,6 @@ struct DeviceResetEntry : EventEntry { DeviceResetEntry(int32_t id, nsecs_t eventTime, int32_t deviceId); std::string getDescription() const override; protected: virtual ~DeviceResetEntry(); }; Loading @@ -116,7 +112,6 @@ struct FocusEntry : EventEntry { std::string_view reason); std::string getDescription() const override; protected: virtual ~FocusEntry(); }; Loading Loading @@ -149,7 +144,6 @@ struct KeyEntry : EventEntry { std::string getDescription() const override; void recycle(); protected: virtual ~KeyEntry(); }; Loading Loading @@ -182,7 +176,6 @@ struct MotionEntry : EventEntry { float xOffset, float yOffset); std::string getDescription() const override; protected: virtual ~MotionEntry(); }; Loading @@ -190,7 +183,7 @@ protected: struct DispatchEntry { const uint32_t seq; // unique sequence number, never 0 EventEntry* eventEntry; // the event to dispatch std::shared_ptr<EventEntry> eventEntry; // the event to dispatch int32_t targetFlags; ui::Transform transform; float globalScaleFactor; Loading @@ -205,9 +198,8 @@ struct DispatchEntry { int32_t resolvedAction; int32_t resolvedFlags; DispatchEntry(EventEntry* eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor); ~DispatchEntry(); DispatchEntry(std::shared_ptr<EventEntry> eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor); inline bool hasForegroundTarget() const { return targetFlags & InputTarget::FLAG_FOREGROUND; } Loading Loading @@ -252,7 +244,7 @@ struct CommandEntry { // parameters for the command (usage varies by command) sp<Connection> connection; nsecs_t eventTime; KeyEntry* keyEntry; std::shared_ptr<KeyEntry> keyEntry; std::shared_ptr<InputApplicationHandle> inputApplicationHandle; std::string reason; int32_t userActivityEventType; Loading Loading
services/inputflinger/dispatcher/Entry.cpp +4 −20 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ VerifiedMotionEvent verifiedMotionEventFromMotionEntry(const MotionEntry& entry) EventEntry::EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policyFlags) : id(id), refCount(1), type(type), eventTime(eventTime), policyFlags(policyFlags), Loading @@ -70,15 +69,6 @@ EventEntry::~EventEntry() { releaseInjectionState(); } void EventEntry::release() { refCount -= 1; if (refCount == 0) { delete this; } else { ALOG_ASSERT(refCount > 0); } } void EventEntry::releaseInjectionState() { if (injectionState) { injectionState->release(); Loading Loading @@ -235,22 +225,16 @@ std::string MotionEntry::getDescription() const { volatile int32_t DispatchEntry::sNextSeqAtomic; DispatchEntry::DispatchEntry(EventEntry* eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor) DispatchEntry::DispatchEntry(std::shared_ptr<EventEntry> eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor) : seq(nextSeq()), eventEntry(eventEntry), eventEntry(std::move(eventEntry)), targetFlags(targetFlags), transform(transform), globalScaleFactor(globalScaleFactor), deliveryTime(0), resolvedAction(0), resolvedFlags(0) { eventEntry->refCount += 1; } DispatchEntry::~DispatchEntry() { eventEntry->release(); } resolvedFlags(0) {} uint32_t DispatchEntry::nextSeq() { // Sequence number 0 is reserved and will never be returned. Loading
services/inputflinger/dispatcher/Entry.h +6 −14 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ struct EventEntry { } int32_t id; mutable int32_t refCount; Type type; nsecs_t eventTime; uint32_t policyFlags; Loading @@ -79,13 +78,12 @@ struct EventEntry { return isInjected() || IdGenerator::getSource(id) != IdGenerator::Source::INPUT_READER; } void release(); virtual std::string getDescription() const = 0; protected: EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policyFlags); virtual ~EventEntry(); protected: void releaseInjectionState(); }; Loading @@ -93,7 +91,6 @@ struct ConfigurationChangedEntry : EventEntry { explicit ConfigurationChangedEntry(int32_t id, nsecs_t eventTime); std::string getDescription() const override; protected: virtual ~ConfigurationChangedEntry(); }; Loading @@ -103,7 +100,6 @@ struct DeviceResetEntry : EventEntry { DeviceResetEntry(int32_t id, nsecs_t eventTime, int32_t deviceId); std::string getDescription() const override; protected: virtual ~DeviceResetEntry(); }; Loading @@ -116,7 +112,6 @@ struct FocusEntry : EventEntry { std::string_view reason); std::string getDescription() const override; protected: virtual ~FocusEntry(); }; Loading Loading @@ -149,7 +144,6 @@ struct KeyEntry : EventEntry { std::string getDescription() const override; void recycle(); protected: virtual ~KeyEntry(); }; Loading Loading @@ -182,7 +176,6 @@ struct MotionEntry : EventEntry { float xOffset, float yOffset); std::string getDescription() const override; protected: virtual ~MotionEntry(); }; Loading @@ -190,7 +183,7 @@ protected: struct DispatchEntry { const uint32_t seq; // unique sequence number, never 0 EventEntry* eventEntry; // the event to dispatch std::shared_ptr<EventEntry> eventEntry; // the event to dispatch int32_t targetFlags; ui::Transform transform; float globalScaleFactor; Loading @@ -205,9 +198,8 @@ struct DispatchEntry { int32_t resolvedAction; int32_t resolvedFlags; DispatchEntry(EventEntry* eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor); ~DispatchEntry(); DispatchEntry(std::shared_ptr<EventEntry> eventEntry, int32_t targetFlags, ui::Transform transform, float globalScaleFactor); inline bool hasForegroundTarget() const { return targetFlags & InputTarget::FLAG_FOREGROUND; } Loading Loading @@ -252,7 +244,7 @@ struct CommandEntry { // parameters for the command (usage varies by command) sp<Connection> connection; nsecs_t eventTime; KeyEntry* keyEntry; std::shared_ptr<KeyEntry> keyEntry; std::shared_ptr<InputApplicationHandle> inputApplicationHandle; std::string reason; int32_t userActivityEventType; Loading