Loading services/inputflinger/InputDeviceMetricsSource.h +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ enum class InputDeviceUsageSource : int32_t { ftl_first = UNKNOWN, ftl_last = TRACKBALL, // Used by latency fuzzer kMaxValue = ftl_last }; /** Returns the InputDeviceUsageSource that corresponds to the key event. */ Loading services/inputflinger/dispatcher/InputDispatcher.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ #include <queue> #include <sstream> #include "../InputDeviceMetricsSource.h" #include "Connection.h" #include "DebugConfig.h" #include "InputDispatcher.h" Loading Loading @@ -4226,6 +4228,11 @@ std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent( return splitMotionEntry; } void InputDispatcher::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) { std::scoped_lock _l(mLock); mLatencyTracker.setInputDevices(args.inputDeviceInfos); } void InputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { if (debugInboundEventDetails()) { ALOGD("notifyConfigurationChanged - eventTime=%" PRId64, args.eventTime); Loading Loading @@ -4438,7 +4445,9 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { IdGenerator::getSource(args.id) == IdGenerator::Source::INPUT_READER && !mInputFilterEnabled) { const bool isDown = args.action == AMOTION_EVENT_ACTION_DOWN; mLatencyTracker.trackListener(args.id, isDown, args.eventTime, args.readTime); std::set<InputDeviceUsageSource> sources = getUsageSourcesForMotionArgs(args); mLatencyTracker.trackListener(args.id, isDown, args.eventTime, args.readTime, args.deviceId, sources); } needWake = enqueueInboundEventLocked(std::move(newEntry)); Loading services/inputflinger/dispatcher/InputDispatcher.h +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public: status_t start() override; status_t stop() override; void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override{}; void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; Loading services/inputflinger/dispatcher/InputEventTimeline.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "InputEventTimeline.h" #include "../InputDeviceMetricsSource.h" namespace android::inputdispatcher { ConnectionTimeline::ConnectionTimeline(nsecs_t deliveryTime, nsecs_t consumeTime, Loading Loading @@ -64,8 +66,15 @@ bool ConnectionTimeline::operator!=(const ConnectionTimeline& rhs) const { return !operator==(rhs); } InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime) : isDown(isDown), eventTime(eventTime), readTime(readTime) {} InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime, uint16_t vendorId, uint16_t productId, std::set<InputDeviceUsageSource> sources) : isDown(isDown), eventTime(eventTime), readTime(readTime), vendorId(vendorId), productId(productId), sources(sources) {} bool InputEventTimeline::operator==(const InputEventTimeline& rhs) const { if (connectionTimelines.size() != rhs.connectionTimelines.size()) { Loading @@ -80,7 +89,8 @@ bool InputEventTimeline::operator==(const InputEventTimeline& rhs) const { return false; } } return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime; return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime && vendorId == rhs.vendorId && productId == rhs.productId && sources == rhs.sources; } } // namespace android::inputdispatcher services/inputflinger/dispatcher/InputEventTimeline.h +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #pragma once #include "../InputDeviceMetricsSource.h" #include <binder/IBinder.h> #include <input/Input.h> #include <unordered_map> Loading Loading @@ -73,10 +75,14 @@ private: }; struct InputEventTimeline { InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime); InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime, uint16_t vendorId, uint16_t productId, std::set<InputDeviceUsageSource> sources); const bool isDown; // True if this is an ACTION_DOWN event const nsecs_t eventTime; const nsecs_t readTime; const uint16_t vendorId; const uint16_t productId; const std::set<InputDeviceUsageSource> sources; struct IBinderHash { std::size_t operator()(const sp<IBinder>& b) const { Loading Loading
services/inputflinger/InputDeviceMetricsSource.h +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ enum class InputDeviceUsageSource : int32_t { ftl_first = UNKNOWN, ftl_last = TRACKBALL, // Used by latency fuzzer kMaxValue = ftl_last }; /** Returns the InputDeviceUsageSource that corresponds to the key event. */ Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ #include <queue> #include <sstream> #include "../InputDeviceMetricsSource.h" #include "Connection.h" #include "DebugConfig.h" #include "InputDispatcher.h" Loading Loading @@ -4226,6 +4228,11 @@ std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent( return splitMotionEntry; } void InputDispatcher::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) { std::scoped_lock _l(mLock); mLatencyTracker.setInputDevices(args.inputDeviceInfos); } void InputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) { if (debugInboundEventDetails()) { ALOGD("notifyConfigurationChanged - eventTime=%" PRId64, args.eventTime); Loading Loading @@ -4438,7 +4445,9 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) { IdGenerator::getSource(args.id) == IdGenerator::Source::INPUT_READER && !mInputFilterEnabled) { const bool isDown = args.action == AMOTION_EVENT_ACTION_DOWN; mLatencyTracker.trackListener(args.id, isDown, args.eventTime, args.readTime); std::set<InputDeviceUsageSource> sources = getUsageSourcesForMotionArgs(args); mLatencyTracker.trackListener(args.id, isDown, args.eventTime, args.readTime, args.deviceId, sources); } needWake = enqueueInboundEventLocked(std::move(newEntry)); Loading
services/inputflinger/dispatcher/InputDispatcher.h +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public: status_t start() override; status_t stop() override; void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override{}; void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override; void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override; void notifyKey(const NotifyKeyArgs& args) override; void notifyMotion(const NotifyMotionArgs& args) override; Loading
services/inputflinger/dispatcher/InputEventTimeline.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include "InputEventTimeline.h" #include "../InputDeviceMetricsSource.h" namespace android::inputdispatcher { ConnectionTimeline::ConnectionTimeline(nsecs_t deliveryTime, nsecs_t consumeTime, Loading Loading @@ -64,8 +66,15 @@ bool ConnectionTimeline::operator!=(const ConnectionTimeline& rhs) const { return !operator==(rhs); } InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime) : isDown(isDown), eventTime(eventTime), readTime(readTime) {} InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime, uint16_t vendorId, uint16_t productId, std::set<InputDeviceUsageSource> sources) : isDown(isDown), eventTime(eventTime), readTime(readTime), vendorId(vendorId), productId(productId), sources(sources) {} bool InputEventTimeline::operator==(const InputEventTimeline& rhs) const { if (connectionTimelines.size() != rhs.connectionTimelines.size()) { Loading @@ -80,7 +89,8 @@ bool InputEventTimeline::operator==(const InputEventTimeline& rhs) const { return false; } } return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime; return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime && vendorId == rhs.vendorId && productId == rhs.productId && sources == rhs.sources; } } // namespace android::inputdispatcher
services/inputflinger/dispatcher/InputEventTimeline.h +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #pragma once #include "../InputDeviceMetricsSource.h" #include <binder/IBinder.h> #include <input/Input.h> #include <unordered_map> Loading Loading @@ -73,10 +75,14 @@ private: }; struct InputEventTimeline { InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime); InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime, uint16_t vendorId, uint16_t productId, std::set<InputDeviceUsageSource> sources); const bool isDown; // True if this is an ACTION_DOWN event const nsecs_t eventTime; const nsecs_t readTime; const uint16_t vendorId; const uint16_t productId; const std::set<InputDeviceUsageSource> sources; struct IBinderHash { std::size_t operator()(const sp<IBinder>& b) const { Loading