update_engine: add utilities for update staging policy
Add staging_utils files that contain logic to decide what
to changes should be done to the state. This includes:
* Turn off staging if there is a forced update or if OOBE hasn't been
completed
* Keep the current staging state if no changes to the policy are
detected.
* Use a new waiting time if there have been changes to the policy.
* If there is a persisted value that is still valid, use it.
These changes aren't added to the update engine yet. The return value
of CalculateStagingCase will be used in update_attempter in
a switch statement to update the state based on the value.
BUG=chromium:858621
TEST=cros_workon_make update_engine --test
CQ-DEPEND=CL:1142480
Change-Id: Ib06365793618c3f2a357e3ace8c660fe51cdf950
Reviewed-on: https://chromium-review.googlesource.com/1138983
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/Android.mk b/Android.mk
index 2fc6f46..d1d8488 100644
--- a/Android.mk
+++ b/Android.mk
@@ -335,6 +335,7 @@
update_manager/real_system_provider.cc \
update_manager/real_time_provider.cc \
update_manager/real_updater_provider.cc \
+ update_manager/staging_utils.cc \
update_manager/state_factory.cc \
update_manager/update_manager.cc \
update_manager/update_time_restrictions_policy_impl.cc \
@@ -1021,6 +1022,7 @@
update_manager/real_system_provider_unittest.cc \
update_manager/real_time_provider_unittest.cc \
update_manager/real_updater_provider_unittest.cc \
+ update_manager/staging_utils_unittest.cc \
update_manager/umtest_utils.cc \
update_manager/update_manager_unittest.cc \
update_manager/update_time_restrictions_policy_impl_unittest.cc \