diff options
author | 2023-10-24 14:22:57 +0000 | |
---|---|---|
committer | 2023-10-24 14:22:57 +0000 | |
commit | 32a061e2aab426bccc23b66cfa0f1ed60d321971 (patch) | |
tree | d98b0490adf55ef6353a6bcf7efac5c3a6dcac5d | |
parent | 8e185db6735defa3fcae347ccd851f8113905f29 (diff) | |
parent | c62948ec5d29035a930c174f2105e8c76581629a (diff) |
Merge "Return unique_ptr from readFromParcel" into main
-rw-r--r-- | include/input/KeyCharacterMap.h | 2 | ||||
-rw-r--r-- | libs/input/KeyCharacterMap.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/input/KeyCharacterMap.h b/include/input/KeyCharacterMap.h index b2e8baade3..dfcf766402 100644 --- a/include/input/KeyCharacterMap.h +++ b/include/input/KeyCharacterMap.h @@ -146,7 +146,7 @@ public: #ifdef __linux__ /* Reads a key map from a parcel. */ - static std::shared_ptr<KeyCharacterMap> readFromParcel(Parcel* parcel); + static std::unique_ptr<KeyCharacterMap> readFromParcel(Parcel* parcel); /* Writes a key map to a parcel. */ void writeToParcel(Parcel* parcel) const; diff --git a/libs/input/KeyCharacterMap.cpp b/libs/input/KeyCharacterMap.cpp index a4cd239a92..e2feabcbbe 100644 --- a/libs/input/KeyCharacterMap.cpp +++ b/libs/input/KeyCharacterMap.cpp @@ -613,14 +613,14 @@ void KeyCharacterMap::addLockedMetaKey(Vector<KeyEvent>& outEvents, } #ifdef __linux__ -std::shared_ptr<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) { +std::unique_ptr<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) { if (parcel == nullptr) { ALOGE("%s: Null parcel", __func__); return nullptr; } std::string loadFileName = parcel->readCString(); - std::shared_ptr<KeyCharacterMap> map = - std::shared_ptr<KeyCharacterMap>(new KeyCharacterMap(loadFileName)); + std::unique_ptr<KeyCharacterMap> map = + std::make_unique<KeyCharacterMap>(KeyCharacterMap(loadFileName)); map->mType = static_cast<KeyCharacterMap::KeyboardType>(parcel->readInt32()); map->mLayoutOverlayApplied = parcel->readBool(); size_t numKeys = parcel->readInt32(); |