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
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
index 117b384..f8cd973 100644
--- a/services/inputflinger/reader/EventHub.cpp
+++ b/services/inputflinger/reader/EventHub.cpp
@@ -662,12 +662,10 @@
     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;
         }