update_engine: Make policy UpdateCheckParams processing easier
Currently there are a ton of arguments from UpdateCheckParams that is
passed around in the udpate_attampter.cc. With this CL UpdateCheckParams
is directy passed and this simplies the logic.
BUG=b:171829801
TEST=cros_workon_make --board reef --test update_enigne
Change-Id: If454f6393fc6e28d41fa5d14d184f0db32e8bd19
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2504453
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/update_manager/policy.h b/update_manager/policy.h
index 4b3bfc7..ad6994c 100644
--- a/update_manager/policy.h
+++ b/update_manager/policy.h
@@ -43,21 +43,22 @@
// Parameters of an update check. These parameters are determined by the
// UpdateCheckAllowed policy.
struct UpdateCheckParams {
- bool updates_enabled; // Whether the auto-updates are enabled on this build.
+ // Whether the auto-updates are enabled on this build.
+ bool updates_enabled{true};
// Attributes pertaining to the case where update checks are allowed.
//
// A target version prefix, if imposed by policy; otherwise, an empty string.
std::string target_version_prefix;
// Specifies whether rollback images are allowed by device policy.
- bool rollback_allowed;
+ bool rollback_allowed{false};
// Specifies if rollbacks should attempt to preserve some system state.
- bool rollback_data_save_requested;
+ bool rollback_data_save_requested{false};
// Specifies the number of Chrome milestones rollback should be allowed,
// starting from the stable version at any time. Value is -1 if unspecified
// (e.g. no device policy is available yet), in this case no version
// roll-forward should happen.
- int rollback_allowed_milestones;
+ int rollback_allowed_milestones{0};
// Whether a rollback with data save should be initiated on channel
// downgrade (e.g. beta to stable).
bool rollback_on_channel_downgrade{false};
@@ -67,7 +68,7 @@
std::string lts_tag;
// Whether the allowed update is interactive (user-initiated) or periodic.
- bool interactive;
+ bool interactive{false};
};
// Input arguments to UpdateCanStart.