Allow metaState changes from keys not declared by the keyboard
Due to modifier remapping feature and Alt+Meta = CapsLock shortcut,
it is possible to change modifier state without there being an
actual key that generates the corresponding modifier keycode.
This is mainly affecting keyboards that declare the keys correctly
in their HID descriptor. Currently, only allowing this for
modifier keys since we only allow remapping those. We might need to
update hasKeycode API for more software key remappings or dynamic
remapping key combinations like Meta+Backspace = Back.
Test: manual
Bug: 368397939
Flag: EXEMPT bugfix
Change-Id: I64cde5b0c9870167cfc9488f6c622c4ec07b5736
diff --git a/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp b/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
index 38dcd65..21ecbcf 100644
--- a/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/KeyboardInputMapper.cpp
@@ -391,7 +391,7 @@
}
bool KeyboardInputMapper::updateMetaState(int32_t keyCode) {
- if (!android::isMetaKey(keyCode) || !getDeviceContext().hasKeyCode(keyCode)) {
+ if (!android::isMetaKey(keyCode)) {
return false;
}