update_engine: Add staging to update_attempter and omaha_request
Modify update_attempter and omaha_request so that they take the user's
staging settings into account. This includes:
* Turning off scattering if staging is on.
* Preserving scattering values if staging is off.
* Setting staging related persisted values if staging is on.
* Deleting the corresponding persisted values if staging is off.
* Making omaha use the max wait time for staging as its max scatter
period if staging is on.
* Add the corresponding unittests for this.
BUG=chromium:858621
TEST=cros_workon_make update_engine --test
Change-Id: I501f90d9e195b5ceef61d3eac67ab52051793ae9
Reviewed-on: https://chromium-review.googlesource.com/1141217
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Adolfo Higueros <adokar@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/update_attempter.h b/update_attempter.h
index a405abc..108a6c6 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -44,6 +44,7 @@
#include "update_engine/service_observer_interface.h"
#include "update_engine/system_state.h"
#include "update_engine/update_manager/policy.h"
+#include "update_engine/update_manager/staging_utils.h"
#include "update_engine/update_manager/update_manager.h"
namespace policy {
@@ -410,6 +411,8 @@
// Returns whether an update is currently running or scheduled.
bool IsUpdateRunningOrScheduled();
+ void CalculateStagingParams(bool interactive);
+
// Last status notification timestamp used for throttling. Use monotonic
// TimeTicks to ensure that notifications are sent even if the system clock is
// set back in the middle of an update.
@@ -510,6 +513,10 @@
std::string forced_app_version_;
std::string forced_omaha_url_;
+ // If this is not TimeDelta(), then that means staging is turned on.
+ base::TimeDelta staging_wait_time_;
+ chromeos_update_manager::StagingSchedule staging_schedule_;
+
DISALLOW_COPY_AND_ASSIGN(UpdateAttempter);
};