diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/input/EventHub.cpp | 26 | ||||
-rw-r--r-- | services/input/EventHub.h | 7 |
2 files changed, 24 insertions, 9 deletions
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index b788e16..326dc32 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -443,11 +443,22 @@ status_t EventHub::mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode, AutoMutex _l(mLock); Device* device = getDeviceLocked(deviceId); - if (device && device->keyMap.haveKeyLayout()) { - status_t err = device->keyMap.keyLayoutMap->mapKey( - scanCode, usageCode, outKeycode, outFlags); - if (err == NO_ERROR) { - return NO_ERROR; + if (device) { + // Check the key character map first. + sp<KeyCharacterMap> kcm = device->getKeyCharacterMap(); + if (kcm != NULL) { + if (!kcm->mapKey(scanCode, usageCode, outKeycode)) { + *outFlags = 0; + return NO_ERROR; + } + } + + // Check the key layout next. + if (device->keyMap.haveKeyLayout()) { + if (!device->keyMap.keyLayoutMap->mapKey( + scanCode, usageCode, outKeycode, outFlags)) { + return NO_ERROR; + } } } @@ -531,10 +542,7 @@ sp<KeyCharacterMap> EventHub::getKeyCharacterMap(int32_t deviceId) const { AutoMutex _l(mLock); Device* device = getDeviceLocked(deviceId); if (device) { - if (device->combinedKeyMap != NULL) { - return device->combinedKeyMap; - } - return device->keyMap.keyCharacterMap; + return device->getKeyCharacterMap(); } return NULL; } diff --git a/services/input/EventHub.h b/services/input/EventHub.h index f885f4d..afc12ef 100644 --- a/services/input/EventHub.h +++ b/services/input/EventHub.h @@ -335,6 +335,13 @@ private: void close(); inline bool isVirtual() const { return fd < 0; } + + const sp<KeyCharacterMap>& getKeyCharacterMap() const { + if (combinedKeyMap != NULL) { + return combinedKeyMap; + } + return keyMap.keyCharacterMap; + } }; status_t openDeviceLocked(const char *devicePath); |