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
diff --git a/include/input/KeyCharacterMap.h b/include/input/KeyCharacterMap.h
index 7ea34c2..0a9e74f 100644
--- a/include/input/KeyCharacterMap.h
+++ b/include/input/KeyCharacterMap.h
@@ -72,7 +72,7 @@
     };
 
     /* 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. */