Allow update_engine to skip post-install
The postinstall steps take long time to finish, even though most of them
are optional. Therefore, reuse the flag run_post_install in InstallPlan
to allow skipping optional postinstalls.
Bug: 136185424
Test: cancel the update during post-install, apply again with the header
"RUN_POST_INSTALL=0", check the optional post-installs are skipped
Change-Id: Ic5ab89b079dfd547714fd3d1664e044900f9eebe
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index 263498b..cc891e7 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -233,20 +233,8 @@
install_plan_.switch_slot_on_reboot =
GetHeaderAsBool(headers[kPayloadPropertySwitchSlotOnReboot], true);
- install_plan_.run_post_install = true;
- // Optionally skip post install if and only if:
- // a) we're resuming
- // b) post install has already succeeded before
- // c) RUN_POST_INSTALL is set to 0.
- if (install_plan_.is_resume && prefs_->Exists(kPrefsPostInstallSucceeded)) {
- bool post_install_succeeded = false;
- if (prefs_->GetBoolean(kPrefsPostInstallSucceeded,
- &post_install_succeeded) &&
- post_install_succeeded) {
- install_plan_.run_post_install =
- GetHeaderAsBool(headers[kPayloadPropertyRunPostInstall], true);
- }
- }
+ install_plan_.run_post_install =
+ GetHeaderAsBool(headers[kPayloadPropertyRunPostInstall], true);
// Skip writing verity if we're resuming and verity has already been written.
install_plan_.write_verity = true;