aboutsummaryrefslogtreecommitdiff
path: root/install/install.cpp
diff options
context:
space:
mode:
authorJulian Veit <Claymore1298@gmail.com>2024-06-13 08:17:58 +0200
committerJulian Veit <Claymore1298@gmail.com>2024-06-13 08:17:58 +0200
commit090e278f122777078f470fe87e11ad1212db90ef (patch)
tree5473ec2fd9a90bdf60757ffcb5ade48b088cb4ed /install/install.cpp
parent6d486b1f5660f2a9fc3f4559c03d9d4989af2c99 (diff)
parent8904d2a254c5263caded20af8fde209f8b37f22d (diff)
Merge branch 'lineage-20.0' of https://github.com/LineageOS/android_bootable_recovery into HEADHEADt13.0
Change-Id: Ic0aae25ab32e81f4ebf802693f8c9a2fdc283beb
Diffstat (limited to 'install/install.cpp')
-rw-r--r--install/install.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/install/install.cpp b/install/install.cpp
index dab919b2..ed5200be 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"
@@ -62,6 +63,7 @@
using namespace std::chrono_literals;
+bool ask_to_ab_reboot(Device* device);
bool ask_to_continue_unverified(Device* device);
bool ask_to_continue_downgrade(Device* device);
@@ -382,6 +384,21 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
LOG(WARNING) << "This is SPL downgrade";
}
+ const auto reboot_to_recovery = [] {
+ if (std::string err; !clear_bootloader_message(&err)) {
+ LOG(ERROR) << "Failed to clear BCB message: " << err;
+ }
+ Reboot("recovery");
+ };
+
+ static bool ab_package_installed = false;
+ if (ab_package_installed) {
+ if (ask_to_ab_reboot(device)) {
+ reboot_to_recovery();
+ }
+ return INSTALL_ERROR;
+ }
+
if (package_is_ab) {
CHECK(package->GetType() == PackageType::kFile);
}
@@ -567,7 +584,11 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
LOG(FATAL) << "Invalid status code " << status;
}
if (package_is_ab) {
+ ab_package_installed = true;
PerformPowerwashIfRequired(zip, device);
+ if (!ui->IsSideloadAutoReboot() && ask_to_ab_reboot(device)) {
+ reboot_to_recovery();
+ }
}
return INSTALL_SUCCESS;