Move KeyCharacterMap from RefBase to shared_ptr.
Move KeyCharacterMap from RefBase and make it shared_ptr in EventHub
device when loaded from file.
A shared_ptr of KeyCharacterMap is returned by EventHub getKeyCharacterMap
to be shared in InputdeviceInfo.
Remove extra KeyCharacterMap in EventHub to save memory sapce.
Bug: 160010896
Test: atest inputflinger, atest libinput_tests
Change-Id: Ibb317ea0684e6af6e7a6d808f816fc4a05c7b421
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index 82157b6..b28b6ea 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -340,7 +340,8 @@
mDevicesChangedCondition.notify_all();
}
- virtual sp<KeyCharacterMap> getKeyboardLayoutOverlay(const InputDeviceIdentifier&) {
+ virtual std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay(
+ const InputDeviceIdentifier&) {
return nullptr;
}
@@ -814,11 +815,11 @@
}
}
- virtual sp<KeyCharacterMap> getKeyCharacterMap(int32_t) const {
+ virtual const std::shared_ptr<KeyCharacterMap> getKeyCharacterMap(int32_t) const {
return nullptr;
}
- virtual bool setKeyboardLayoutOverlay(int32_t, const sp<KeyCharacterMap>&) {
+ virtual bool setKeyboardLayoutOverlay(int32_t, std::shared_ptr<KeyCharacterMap>) {
return false;
}