Implement powerwash on Android.
Powerwash, the name for the equivalent of a factory reset or /data wipe,
can be triggered in Android by writing the desired command to the
recovery command file and rebooting into recovery.
This patch moves the powerwash scheduling/canceling logic to the
HardwareInterface and implements it on Android.
Bug: 28700985
TEST=Called update_engine_client passing POWERWASH=1, BCB is stored up
to offset 832.
Change-Id: If737fd4b9b3e2ed9bce709b3b59f22e9f0a3dc9a
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index 87c7e0d..2e7fda6 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -168,7 +168,11 @@
install_plan_.source_slot = boot_control_->GetCurrentSlot();
install_plan_.target_slot = install_plan_.source_slot == 0 ? 1 : 0;
- install_plan_.powerwash_required = false;
+
+ int data_wipe = 0;
+ install_plan_.powerwash_required =
+ base::StringToInt(headers[kPayloadPropertyPowerwash], &data_wipe) &&
+ data_wipe != 0;
LOG(INFO) << "Using this install plan:";
install_plan_.Dump();
@@ -403,7 +407,7 @@
new FilesystemVerifierAction());
shared_ptr<PostinstallRunnerAction> postinstall_runner_action(
- new PostinstallRunnerAction(boot_control_));
+ new PostinstallRunnerAction(boot_control_, hardware_));
download_action->set_delegate(this);
download_action_ = download_action;