summaryrefslogtreecommitdiff
path: root/include/input/KeyCharacterMap.h
diff options
context:
space:
mode:
author Linnan Li <lilinnan@xiaomi.corp-partner.google.com> 2024-09-13 21:54:37 +0800
committer Siarhei Vishniakou <svv@google.com> 2024-09-20 14:30:24 -0700
commite5657f27c9ffc22c9f198bc765dd92c0aac4240d (patch)
tree6a79895aab6d34bd7a1e995dcaf6657999b576f2 /include/input/KeyCharacterMap.h
parentec741152d29c44b91bd56abb3e848c97887509d7 (diff)
Move key remapping to InputReader thread(1/n)
Currently, the key remapping operation occurs on a non-Reader thread, which leads to concurrent operations on the KCM object by this thread and the Reader, causing unpredictable concurrency issues. Here, we move this operation to the Reader thread, aligning it with most configuration refresh methods, which can resolve the aforementioned issues. Additionally, we are removing the device traversal method on the Java side because we actually intend for the key remapping operation to apply to all full-keyboard devices. This can be fully achieved during the InputReader refresh, so we are also removing the deviceId parameter from the remapping interface. There should be no behavioral changes. Bug: 358042225 Test: atest CtsInputTestCases Test: atest InputTests Test: atest inputflinger_tests Flag: EXEMPT refactor Change-Id: I6ab802b70dc1242c796f672ac30672d10e34857f Signed-off-by: Linnan Li <lilinnan@xiaomi.corp-partner.google.com>
Diffstat (limited to 'include/input/KeyCharacterMap.h')
-rw-r--r--include/input/KeyCharacterMap.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/input/KeyCharacterMap.h b/include/input/KeyCharacterMap.h
index 92d5ec4d4e..67b37b1213 100644
--- a/include/input/KeyCharacterMap.h
+++ b/include/input/KeyCharacterMap.h
@@ -126,9 +126,9 @@ public:
bool getEvents(int32_t deviceId, const char16_t* chars, size_t numChars,
Vector<KeyEvent>& outEvents) const;
- /* Maps an Android key code to another Android key code. This mapping is applied after scanCode
- * and usageCodes are mapped to corresponding Android Keycode */
- void addKeyRemapping(int32_t fromKeyCode, int32_t toKeyCode);
+ /* Maps some Android key code to another Android key code. This mapping is applied after
+ * scanCode and usageCodes are mapped to corresponding Android Keycode */
+ void setKeyRemapping(const std::map<int32_t, int32_t>& keyRemapping);
/* Maps a scan code and usage code to a key code, in case this key map overrides
* the mapping in some way. */