update_engine: Populate UpdateCheckParams with rollback policies.
These are the policies introduced in crrev.com/c/916563,
controlling what should happen if target_version_prefix is
earlier than the current Chrome OS version, and how long Chrome
OS rollback protection should be postponed.
BUG=chromium:813036
TEST='cros_run_unit_tests --board=cyan --packages update_engine'
Change-Id: I33cf3b8975b52ca4b647a4b69a2d7879a9115d3c
Reviewed-on: https://chromium-review.googlesource.com/929321
Commit-Ready: Marton Hunyady <hunyadym@chromium.org>
Tested-by: Marton Hunyady <hunyadym@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/update_manager/boxed_value.cc b/update_manager/boxed_value.cc
index a437c02..b2505ee 100644
--- a/update_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -26,6 +26,7 @@
#include "update_engine/common/utils.h"
#include "update_engine/connection_utils.h"
+#include "update_engine/update_manager/rollback_prefs.h"
#include "update_engine/update_manager/shill_provider.h"
#include "update_engine/update_manager/updater_provider.h"
@@ -133,6 +134,25 @@
return "Unknown";
}
+template <>
+string BoxedValue::ValuePrinter<RollbackToTargetVersion>(const void* value) {
+ const RollbackToTargetVersion* val =
+ reinterpret_cast<const RollbackToTargetVersion*>(value);
+ switch (*val) {
+ case RollbackToTargetVersion::kUnspecified:
+ return "Unspecified";
+ case RollbackToTargetVersion::kDisabled:
+ return "Disabled";
+ case RollbackToTargetVersion::kRollbackWithFullPowerwash:
+ return "Rollback with full powerwash";
+ case RollbackToTargetVersion::kMaxValue:
+ NOTREACHED();
+ return "Max value";
+ }
+ NOTREACHED();
+ return "Unknown";
+}
+
template<>
string BoxedValue::ValuePrinter<Stage>(const void* value) {
const Stage* val = reinterpret_cast<const Stage*>(value);