update_engine: Add ping for DLCs in update_engine
Send ping to omaha with the metadata values 'active','date_last_active'
and 'date_last_rollcall'. Update engine resets the 'active' flag after
succesfully sending a ping to Omaha. The 'date_last_active' value is
sent and updated only when the DLC was active since the previous ping.
'date_last_rollcall' is sent on every ping.
BUG=chromium:912666
TEST=unittests
TEST=Test on DUT using Nebraska and forcing ping values by changing the
metadata files in /var/lib/dlc/dummy-dlc/.
Installed dlc using:dlcservice_util --dlc_ids="dummy-dlc" --install
Trigger the pings by calling: update_engine_client --check_for_update
Change-Id: I47eff8c7923f5b3a7e892c281933c9a12b619ee7
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2001095
Tested-by: Andrew Lassalle <andrewlassalle@chromium.org>
Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index 70867a3..e6d96a4 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -124,7 +124,7 @@
// Set the interactive flag accordingly.
interactive_ = in_interactive;
- dlc_module_ids_.clear();
+ dlc_apps_params_.clear();
// Set false so it will do update by default.
is_install_ = false;
return true;
@@ -215,6 +215,7 @@
void OmahaRequestParams::set_root(const string& root) {
root_ = root;
test::SetImagePropertiesRootPrefix(root_.c_str());
+ dlc_prefs_root_ = root + kDlcMetadataRootpath;
}
int OmahaRequestParams::GetChannelIndex(const string& channel) const {
@@ -248,4 +249,10 @@
: image_props_.product_id;
}
+string OmahaRequestParams::GetDlcAppId(std::string dlc_id) const {
+ // Create APP ID according to |dlc_id| (sticking the current AppID to the
+ // DLC module ID with an underscode).
+ return GetAppId() + "_" + dlc_id;
+}
+
} // namespace chromeos_update_engine