Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 216dd850 authored by Sergej Salnikov's avatar Sergej Salnikov Committed by Android (Google) Code Review
Browse files

Merge "InputDevice.hasKeys also checks for key usage" into udc-dev

parents 4530ad4d e5420e79
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -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)) {
            if (device->hasKeycodeLocked(keyCodes[codeIndex])) {
                outFlags[codeIndex] = 1;
                    break;
                }
            }
        }
        return true;