diff options
author | Haibo Huang <hhb@google.com> | 2021-03-05 05:08:54 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-03-05 05:08:54 +0000 |
commit | 65ec03c59836261eb6cb6f0ed3d676650703d36b (patch) | |
tree | 8d9c5d8df5b9ba8746cfd57a8a2048c28d401c08 | |
parent | f13087081087d363a930b477176ff582a651663d (diff) | |
parent | 06670e75e517399fe5c0659d53157560b52193a6 (diff) | |
download | contexthub-65ec03c59836261eb6cb6f0ed3d676650703d36b.tar.gz |
[contexthub] Use new jsoncpp API am: 06670e75e5android-s-beta-4android-s-beta-3android-s-beta-4
Original change: https://android-review.googlesource.com/c/device/google/contexthub/+/1615047
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I8cb2558b5ab8e7cbca6a681c12ef4191b9b53622
-rw-r--r-- | contexthubhal/system_comms.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contexthubhal/system_comms.cpp b/contexthubhal/system_comms.cpp index 87e5feef..30106995 100644 --- a/contexthubhal/system_comms.cpp +++ b/contexthubhal/system_comms.cpp @@ -1015,8 +1015,8 @@ bool SystemComm::AppManager::saveApps() } // Write the JSON string to disk. - Json::StyledWriter writer; - std::string serializedSettings(writer.write(*appsObject)); + Json::StreamWriterBuilder factory; + std::string serializedSettings(Json::writeString(factory, *appsObject)); size_t size = serializedSettings.size(); if ((err = saved_apps_file.write(serializedSettings.c_str(), size)) != (ssize_t)size) { ALOGW("saved_apps file write failed %d (%s)", @@ -1050,8 +1050,10 @@ bool SystemComm::AppManager::restoreApps() std::string str(buf); std::shared_ptr<Json::Value> in(new Json::Value); - Json::Reader reader; - bool valid = reader.parse(str, *in); + Json::CharReaderBuilder builder; + std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); + bool valid = reader->parse( + str.data(), str.data() + str.size(), in.get(), /* errorMessage = */ nullptr); free(buf); if (valid && in->isObject()) { |