summaryrefslogtreecommitdiff
path: root/services/inputflinger/EventHub.cpp
diff options
context:
space:
mode:
author Puneet Kumar <puneetster@google.com> 2015-10-08 17:34:30 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-10-08 17:34:30 +0000
commita42832ef53aa10e3192bb2cf7b6572b047ef39e6 (patch)
treec690ce9112461df8990b970a7c4fcdc1e1a29c84 /services/inputflinger/EventHub.cpp
parent4ea0de334f5d287ed9eb777e5700f04a50a299d4 (diff)
parent1f8b6b57b25635011c70e5e7aaebb60bdb3b97af (diff)
am 1f8b6b57: am 98d740d7: am 94973aeb: am a2f78b44: Merge "Inputflinger: hook up key event replacement processing" into mnc-dr-dev
* commit '1f8b6b57b25635011c70e5e7aaebb60bdb3b97af': Inputflinger: hook up key event replacement processing
Diffstat (limited to 'services/inputflinger/EventHub.cpp')
-rw-r--r--services/inputflinger/EventHub.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp
index 6b60c7cf71..5859606284 100644
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -438,10 +438,12 @@ bool EventHub::markSupportedKeyCodes(int32_t deviceId, size_t numCodes,
return false;
}
-status_t EventHub::mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode,
- int32_t* outKeycode, uint32_t* outFlags) const {
+status_t EventHub::mapKey(int32_t deviceId,
+ int32_t scanCode, int32_t usageCode, int32_t metaState,
+ int32_t* outKeycode, int32_t* outMetaState, uint32_t* outFlags) const {
AutoMutex _l(mLock);
Device* device = getDeviceLocked(deviceId);
+ status_t status = NAME_NOT_FOUND;
if (device) {
// Check the key character map first.
@@ -449,22 +451,34 @@ status_t EventHub::mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode,
if (kcm != NULL) {
if (!kcm->mapKey(scanCode, usageCode, outKeycode)) {
*outFlags = 0;
- return NO_ERROR;
+ status = NO_ERROR;
}
}
// Check the key layout next.
- if (device->keyMap.haveKeyLayout()) {
+ if (status != NO_ERROR && device->keyMap.haveKeyLayout()) {
if (!device->keyMap.keyLayoutMap->mapKey(
scanCode, usageCode, outKeycode, outFlags)) {
- return NO_ERROR;
+ status = NO_ERROR;
+ }
+ }
+
+ if (status == NO_ERROR) {
+ if (kcm != NULL) {
+ kcm->tryRemapKey(*outKeycode, metaState, outKeycode, outMetaState);
+ } else {
+ *outMetaState = metaState;
}
}
}
- *outKeycode = 0;
- *outFlags = 0;
- return NAME_NOT_FOUND;
+ if (status != NO_ERROR) {
+ *outKeycode = 0;
+ *outFlags = 0;
+ *outMetaState = metaState;
+ }
+
+ return status;
}
status_t EventHub::mapAxis(int32_t deviceId, int32_t scanCode, AxisInfo* outAxisInfo) const {