summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputDeviceMetricsSource.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2025-02-27 15:26:26 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-27 15:26:26 -0800
commit818783174fe4053e5932a8dfb723333d74e88f6a (patch)
treeb6206c584174c2aef940a01d3d20fb6472afa0b6 /services/inputflinger/InputDeviceMetricsSource.cpp
parent72782217cefc24c7f4374b45bcab7e6bd50d964d (diff)
parent98bdc04b7658fde0a99403fc052d1d18e7d48ea6 (diff)
Merge "Merge 25Q1 (ab/12770256) to aosp-main-future" into aosp-main-future
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;