update_engine: Move scattering wait period store/load to PayloadState.
This is needed for decoupling the inference/use of this value from its
storing/loading, as we shift the former into the Update Manager.
BUG=chromium:384087
TEST=Unit tests.
Change-Id: I4b278dc817b6f148d5638122f934e9d1e280bfae
Reviewed-on: https://chromium-review.googlesource.com/221250
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 9a91d51..b36c11a 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -564,8 +564,8 @@
// fails, we'll still be able to scatter based on our in-memory value.
// The persistence only helps in ensuring a good overall distribution
// across multiple devices if they tend to reboot too often.
- prefs_->SetInt64(kPrefsWallClockWaitPeriod,
- omaha_request_params_->waiting_period().InSeconds());
+ system_state_->payload_state()->SetScatteringWaitPeriod(
+ omaha_request_params_->waiting_period());
}
void UpdateAttempter::BuildPostInstallActions(
@@ -979,7 +979,7 @@
// after reboot so that the same device is not favored or punished in any
// way.
prefs_->Delete(kPrefsUpdateCheckCount);
- prefs_->Delete(kPrefsWallClockWaitPeriod);
+ system_state_->payload_state()->SetScatteringWaitPeriod(TimeDelta());
prefs_->Delete(kPrefsUpdateFirstSeenAt);
SetStatusAndNotify(UPDATE_STATUS_UPDATED_NEED_REBOOT);