summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sergej Salnikov <skill@google.com> 2023-05-11 11:52:54 +0000
committer Sergej Salnikov <skill@google.com> 2023-05-12 14:46:57 +0000
commite5420e792426eb46e74e3fa7ba1aef66365097e8 (patch)
treea65e1e9409cab58383256d1f1184a0d7b58584c7
parenta04c0f68ee7623c59f1900b40fa9b464dbfd061a (diff)
InputDevice.hasKeys also checks for key usage
Bug: 277216611 Bug: 282028956 Change-Id: I854888951ae0dd1287b8c519b92d9db36bbd28bf
-rw-r--r--services/inputflinger/reader/EventHub.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
index 0eb4ad25ee..0354164155 100644
--- a/services/inputflinger/reader/EventHub.cpp
+++ b/services/inputflinger/reader/EventHub.cpp
@@ -1072,16 +1072,8 @@ bool EventHub::markSupportedKeyCodes(int32_t deviceId, const std::vector<int32_t
Device* device = getDeviceLocked(deviceId);
if (device != nullptr && device->keyMap.haveKeyLayout()) {
for (size_t codeIndex = 0; codeIndex < keyCodes.size(); codeIndex++) {
- std::vector<int32_t> scanCodes =
- device->keyMap.keyLayoutMap->findScanCodesForKey(keyCodes[codeIndex]);
-
- // check the possible scan codes identified by the layout map against the
- // map of codes actually emitted by the driver
- for (const int32_t scanCode : scanCodes) {
- if (device->keyBitmask.test(scanCode)) {
- outFlags[codeIndex] = 1;
- break;
- }
+ if (device->hasKeycodeLocked(keyCodes[codeIndex])) {
+ outFlags[codeIndex] = 1;
}
}
return true;