Blacklist versions as part of Rollback along with unittests.
This CL adds version blacklisting as part of AU Rollback. A few additional
things:
1) Since this pref must persist across rollback I have introduced a
powerwash_safe_prefs as part of system_state that will persist across
powerwashes.
2) Fixed bug where we needed to read the device policy (which is read during an
update_check before Rollback would work).
3) Some refactoring to move pref constants to constants.
4) Passing keepimg into our powerwash command so we don't wipe the old
partitions.
BUG=chromium:252589 chromium:254217
TEST=Unittests + test on device + using rollback with and without powerwash
checking preserve state.
Change-Id: I991fad944594944425fd9941e10b30a919f2b83b
Reviewed-on: https://gerrit.chromium.org/gerrit/59518
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 799cd20..ca6643b 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -544,14 +544,18 @@
}
}
-void UpdateAttempter::Rollback(bool powerwash) {
+bool UpdateAttempter::Rollback(bool powerwash) {
CHECK(!processor_->IsRunning());
processor_->set_delegate(this);
+ // TODO(sosa): crbug.com/252539 -- refactor channel into system_state and
+ // check for != stable-channel here.
+ RefreshDevicePolicy();
+
LOG(INFO) << "Setting rollback options.";
InstallPlan install_plan;
- TEST_AND_RETURN(utils::GetInstallDev(utils::BootDevice(),
- &install_plan.install_path));
+ TEST_AND_RETURN_FALSE(utils::GetInstallDev(utils::BootDevice(),
+ &install_plan.install_path));
install_plan.kernel_install_path = utils::BootKernelDevice(
install_plan.install_path);
install_plan.powerwash_required = powerwash;
@@ -563,6 +567,12 @@
new InstallPlanAction(install_plan));
actions_.push_back(shared_ptr<AbstractAction>(install_plan_action));
+ // Initialize the default request params.
+ if (!omaha_request_params_->Init("", "", true)) {
+ LOG(ERROR) << "Unable to initialize Omaha request params.";
+ return false;
+ }
+
BuildPostInstallActions(install_plan_action.get());
// Enqueue the actions
@@ -570,6 +580,10 @@
it != actions_.end(); ++it) {
processor_->EnqueueAction(it->get());
}
+
+ // Update the payload state for Rollback.
+ system_state_->payload_state()->Rollback();
+
SetStatusAndNotify(UPDATE_STATUS_ATTEMPTING_ROLLBACK,
kUpdateNoticeUnspecified);
@@ -578,6 +592,7 @@
// actions we just posted.
start_action_processor_ = true;
UpdateBootFlags();
+ return true;
}
void UpdateAttempter::CheckForUpdate(const string& app_version,