summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputDeviceMetricsSource.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2025-03-08 16:09:49 -0800
committer Xin Li <delphij@google.com> 2025-03-08 16:09:49 -0800
commit32ab7738564ffb5f327d2e70f7a8286584f7153f (patch)
tree2d698f7db968ce5ebb03271b94a7488e3bfdd239 /services/inputflinger/InputDeviceMetricsSource.cpp
parent4b89f17ef1ba81b6822607760d1a83d069bf8533 (diff)
parentcadcf50fd804adb2765fd622c3d23589138d5a42 (diff)
Merge 25Q1 (ab/BP1A.250305.020) to AOSP main
Bug: 385190204 Merged-In: Ib562fdc672f09e92c646583840c324ad50e2fa39 Change-Id: Ie21212b27d78e41c9dacbfab510925d29653cfeb
Diffstat (limited to 'services/inputflinger/InputDeviceMetricsSource.cpp')
-rw-r--r--services/inputflinger/InputDeviceMetricsSource.cpp12
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;