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/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index c24590e..47b1947 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -58,8 +58,8 @@
install_plan_ = GetInputObject();
if (install_plan_.powerwash_required) {
- if (utils::CreatePowerwashMarkerFile(powerwash_marker_file_)) {
- powerwash_marker_created_ = true;
+ if (hardware_->SchedulePowerwash()) {
+ powerwash_scheduled_ = true;
} else {
return CompletePostinstall(ErrorCode::kPostinstallPowerwashError);
}
@@ -327,9 +327,9 @@
if (error_code != ErrorCode::kSuccess) {
LOG(ERROR) << "Postinstall action failed.";
- // Undo any changes done to trigger Powerwash using clobber-state.
- if (powerwash_marker_created_)
- utils::DeletePowerwashMarkerFile(powerwash_marker_file_);
+ // Undo any changes done to trigger Powerwash.
+ if (powerwash_scheduled_)
+ hardware_->CancelPowerwash();
return;
}