diff options
| author | 2024-10-09 00:07:23 +0000 | |
|---|---|---|
| committer | 2024-10-17 15:57:52 +0000 | |
| commit | 93ee540fcf178c7a852841e861ff10d704cb5f71 (patch) | |
| tree | 208f7d0ff14d36cb663f905e98e50346d52e2a6f /services/inputflinger/InputDeviceMetricsSource.cpp | |
| parent | b7e4701ca848e2d018ba68ff5dd96e31d96051bb (diff) | |
Use a single trackListener method in LatencyTracker
This simplifies the code for the caller (InputDispatcher) and reduces the API surface of LatencyTracker.
Bug: 270049345
Change-Id: Ia25e95a24b5e89abcfce8060893ec3cce0c7892e
Flag: EXEMPT refactor
Test: atest inputflinger_tests
Diffstat (limited to 'services/inputflinger/InputDeviceMetricsSource.cpp')
| -rw-r--r-- | services/inputflinger/InputDeviceMetricsSource.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/services/inputflinger/InputDeviceMetricsSource.cpp b/services/inputflinger/InputDeviceMetricsSource.cpp index dee4cb836e..70262fbb04 100644 --- a/services/inputflinger/InputDeviceMetricsSource.cpp +++ b/services/inputflinger/InputDeviceMetricsSource.cpp @@ -50,6 +50,18 @@ InputDeviceUsageSource getUsageSourceForKeyArgs(int32_t keyboardType, return InputDeviceUsageSource::BUTTONS; } +std::set<InputDeviceUsageSource> getUsageSourcesForKeyArgs( + const NotifyKeyArgs& args, const std::vector<InputDeviceInfo>& inputDevices) { + int32_t keyboardType = AINPUT_KEYBOARD_TYPE_NONE; + for (const InputDeviceInfo& inputDevice : inputDevices) { + if (args.deviceId == inputDevice.getId()) { + keyboardType = inputDevice.getKeyboardType(); + break; + } + } + return std::set{getUsageSourceForKeyArgs(keyboardType, args)}; +} + std::set<InputDeviceUsageSource> getUsageSourcesForMotionArgs(const NotifyMotionArgs& motionArgs) { LOG_ALWAYS_FATAL_IF(motionArgs.getPointerCount() < 1, "Received motion args without pointers"); std::set<InputDeviceUsageSource> sources; |