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

Commit 956a6cee authored by Rishi Sikka's avatar Rishi Sikka
Browse files

inputflinger: Rework previous fix for KCM

Use haveKeyCharacterMap instead.

Bug: 372558955
Test: Does not crash on input device without character map
Flag: EXEMPT bugfix
Change-Id: Iac22460cb56e4bd1c36c8ee8014fb723f0129896
parent 521e071a
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -662,12 +662,10 @@ bool EventHub::Device::hasKeycodeLocked(int keycode) const {
    if (hasKeycodeInternalLocked(keycode)) {
        return true;
    }
    // Check the key character map first. Not all input devices will have one.
    const std::shared_ptr<KeyCharacterMap> kcm = getKeyCharacterMap();
    if (kcm == nullptr) {
    if (!keyMap.haveKeyCharacterMap()) {
        return false;
    }
    for (auto& fromKey : kcm->findKeyCodesMappedToKeyCode(keycode)) {
    for (auto& fromKey : getKeyCharacterMap()->findKeyCodesMappedToKeyCode(keycode)) {
        if (hasKeycodeInternalLocked(fromKey)) {
            return true;
        }