diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp index 34e44e4c8..336d489a8 100644 --- a/libs/ui/InputReader.cpp +++ b/libs/ui/InputReader.cpp @@ -547,9 +547,9 @@ int32_t InputReader::getState(int32_t deviceId, uint32_t sourceMask, int32_t cod for (size_t i = 0; i < numDevices; i++) { InputDevice* device = mDevices.valueAt(i); if (! device->isIgnored() && sourcesMatchMask(device->getSources(), sourceMask)) { - result = (device->*getStateFunc)(sourceMask, code); - if (result >= AKEY_STATE_DOWN) { - return result; + int32_t state = (device->*getStateFunc)(sourceMask, code); + if (state > result) { + result = state; } } } @@ -737,9 +737,9 @@ int32_t InputDevice::getState(uint32_t sourceMask, int32_t code, GetStateFunc ge for (size_t i = 0; i < numMappers; i++) { InputMapper* mapper = mMappers[i]; if (sourcesMatchMask(mapper->getSources(), sourceMask)) { - result = (mapper->*getStateFunc)(sourceMask, code); - if (result >= AKEY_STATE_DOWN) { - return result; + int32_t state = (mapper->*getStateFunc)(sourceMask, code); + if (state > result) { + result = state; } } }