aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2023-08-04 22:09:53 +0200
committerLuK1337 <priv.luk@gmail.com>2023-08-04 22:14:56 +0200
commit2a70656faaed1b7c2c63d9af9676154f3ee90bf7 (patch)
tree6325c602178c55e55e03f607c932d3094c135c40
parent107dfac7c0d7fd7cad6e7d41368d8878ea9ba2b0 (diff)
recovery: Clear BCB before rebooting to recovery
This should clear update_in_progress flag. Change-Id: Idc5b99a77d6f1368fa37cf664a1fb5b6b19886db
-rw-r--r--install/install.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/install/install.cpp b/install/install.cpp
index ff256a0a..0bd2ea11 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -46,6 +46,7 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
+#include "bootloader_message/bootloader_message.h"
#include "install/snapshot_utils.h"
#include "install/spl_check.h"
#include "install/wipe_data.h"
@@ -384,10 +385,17 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
return INSTALL_ERROR;
}
+ const auto reboot_to_recovery = [] {
+ if (std::string err; !clear_bootloader_message(&err)) {
+ LOG(ERROR) << "Failed to clear BCB message: " << err;
+ }
+ Reboot("userrequested,recovery,ui");
+ };
+
static bool ab_package_installed = false;
if (ab_package_installed) {
if (ask_to_ab_reboot(device)) {
- Reboot("userrequested,recovery,ui");
+ reboot_to_recovery();
}
return INSTALL_ERROR;
}
@@ -580,7 +588,7 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
ab_package_installed = true;
PerformPowerwashIfRequired(zip, device);
if (ask_to_ab_reboot(device)) {
- Reboot("userrequested,recovery,ui");
+ reboot_to_recovery();
}
}