Merge "InputDevice.hasKeys also checks for key usage" into udc-dev am: 216dd8503b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/23167460
Change-Id: I5d5f9bb7df122796fc21b8c7b639101f648116b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
index 0eb4ad2..0354164 100644
--- a/services/inputflinger/reader/EventHub.cpp
+++ b/services/inputflinger/reader/EventHub.cpp
@@ -1072,16 +1072,8 @@
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;