diff options
author | Haibo Huang <hhb@google.com> | 2021-03-05 07:23:31 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-03-05 07:23:31 +0000 |
commit | dd198057e4bd1f18ee8adaf2321bfa980cb77120 (patch) | |
tree | b54dcc3affa8f38ecc074298534aed597e339a37 | |
parent | 459e3da0102db5bc04bc4c0c425992d3077c555b (diff) | |
parent | 85a306c31315343de1b7123f76e28580330f6f63 (diff) | |
download | contexthub-dd198057e4bd1f18ee8adaf2321bfa980cb77120.tar.gz |
[contexthub] Use new jsoncpp API am: 06670e75e5 am: 65ec03c598 am: 7c50d08cf6 am: 85a306c313
Original change: https://android-review.googlesource.com/c/device/google/contexthub/+/1615047
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Icefc958ead47344f9ca461b513954bb0e9352e4c
-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()) { |