summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputDeviceMetricsSource.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2025-03-10 09:50:35 -0700
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-03-10 09:50:35 -0700
commit376c3cd45e7af8eeb8a4c13b4a01d65b44069c5d (patch)
treebe5796e7b3cc6383caf7987ab194e8d4a2ce9c20 /services/inputflinger/InputDeviceMetricsSource.cpp
parent67b445a490a71e01b870186315f54344b1f96466 (diff)
parent32ab7738564ffb5f327d2e70f7a8286584f7153f (diff)
Merge "Merge 25Q1 (ab/BP1A.250305.020) to AOSP main" into main
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;