summaryrefslogtreecommitdiff
path: root/include/input/KeyCharacterMap.h
diff options
context:
space:
mode:
author Linnan Li <lilinnan@xiaomi.corp-partner.google.com> 2024-10-15 15:50:01 +0000
committer Siarhei Vishniakou <svv@google.com> 2024-10-17 11:18:52 -0700
commitd78dd9b184cc700b9a887820056e5ed6a4c0ea56 (patch)
tree90153e42bb447df6b0068aab23e3f7c4cfd90c70 /include/input/KeyCharacterMap.h
parent93ee540fcf178c7a852841e861ff10d704cb5f71 (diff)
Copy KeyCharacterMap object when we fill InputDeviceInfo(1/n)
Currently, in InputDeviceInfo, we store the KeyCharacterMap object, which is actually the original KeyCharacterMap from the EventHub. This could potentially lead to issues where two threads operate on the same KeyCharacterMap object simultaneously, resulting in thread safety problems. To avoid potential risks in the future, we make a copy of the original KeyCharacterMap when generating InputDeviceInfo. This change should not introduce any behavioral changes. Bug: 373011069 Flag: EXEMPT refactor Test: presubmit Signed-off-by: Linnan Li <lilinnan@xiaomi.corp-partner.google.com> (cherry picked from https://partner-android-review.googlesource.com/q/commit:1be9c1ce7400e38cf3f45921d7181e947929f91c) Merged-In: I0d0155133f95b0f1dc925422eda0da04c6f196ea Change-Id: I0d0155133f95b0f1dc925422eda0da04c6f196ea
Diffstat (limited to 'include/input/KeyCharacterMap.h')
-rw-r--r--include/input/KeyCharacterMap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/input/KeyCharacterMap.h b/include/input/KeyCharacterMap.h
index 7ea34c2566..0a9e74f73b 100644
--- a/include/input/KeyCharacterMap.h
+++ b/include/input/KeyCharacterMap.h
@@ -72,7 +72,7 @@ public:
};
/* Loads a key character map from a file. */
- static base::Result<std::shared_ptr<KeyCharacterMap>> load(const std::string& filename,
+ static base::Result<std::unique_ptr<KeyCharacterMap>> load(const std::string& filename,
Format format);
/* Loads a key character map from its string contents. */