const std::string path = getPmemPath(); if (path.empty()) {
ALOGE("%s: persistent key-value store path not available.", __FUNCTION__); return HWC3::Error::NoResources;
}
std::string content; if (!::android::base::ReadFileToString(path, &content)) {
ALOGE("%s: failed to read key-value store from %s", __FUNCTION__, path.c_str()); return HWC3::Error::NoResources;
}
if (content.empty() || content[0] == '\0') { return HWC3::Error::None;
}
Json::Reader reader; if (!reader.parse(content, *dictionary)) { const std::string error = reader.getFormattedErrorMessages();
ALOGE("%s: failed to parse key-value store from %s:%s", __FUNCTION__, path.c_str(),
error.c_str()); return HWC3::Error::NoResources;
}
return HWC3::Error::None;
}
HWC3::Error savePersistentKeyValues(const Json::Value& dictionary) { const std::string path = getPmemPath(); if (path.empty()) {
ALOGE("%s: persistent key-value store path not available.", __FUNCTION__); return HWC3::Error::NoResources;
}
const std::string contents = dictionary.toStyledString(); if (!::android::base::WriteStringToFile(contents, path)) {
ALOGE("%s: failed to write key-value store to %s", __FUNCTION__, path.c_str()); return HWC3::Error::NoResources;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.