update_engine: Move DLC metadata ownership to update_engine
Add dbus messages so dlcservice can let update_engine know when a DLC is
installed or uninstalled.
BUG=chromium:912666
TEST=unittests, install and uninstall DLCs on DUT.
Cq-Depend: chromium:2112994,chromium:2113254
Change-Id: I35374504afcdaf96b099e343cabe072fc18f1022
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2113134
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Tested-by: Andrew Lassalle <andrewlassalle@chromium.org>
Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 58e7f47..8890c7c 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -414,7 +414,6 @@
return num_days;
}
-// static
void OmahaRequestAction::StorePingReply(
const OmahaParserData& parser_data) const {
for (const auto& app : parser_data.apps) {
@@ -430,24 +429,15 @@
base::FilePath metadata_path =
base::FilePath(params_->dlc_prefs_root()).Append(dlc_params.name);
- if (!base::PathExists(metadata_path)) {
- LOG(ERROR) << "Metadata path (" << metadata_path.value() << ") "
- << "doesn't exist.";
- // Skip this DLC if the metadata directory is missing.
- continue;
- }
Prefs prefs;
- if (!prefs.Init(metadata_path)) {
+ if (!base::CreateDirectory(metadata_path) || !prefs.Init(metadata_path)) {
LOG(ERROR) << "Failed to initialize the preferences path:"
<< metadata_path.value() << ".";
continue;
}
// Reset the active metadata value to |kPingInactiveValue|.
- // Only write into this file if the file exists, otherwise the file will be
- // created with different owner/permissions.
- if (prefs.Exists(kPrefsPingActive) &&
- !prefs.SetInt64(kPrefsPingActive, kPingInactiveValue))
+ if (!prefs.SetInt64(kPrefsPingActive, kPingInactiveValue))
LOG(ERROR) << "Failed to set the value of ping metadata '"
<< kPrefsPingActive << "'.";