Skip to content

Commit

Permalink
recovery: Clear BCB before rebooting to recovery
Browse files Browse the repository at this point in the history
This should clear update_in_progress flag.

Change-Id: Idc5b99a77d6f1368fa37cf664a1fb5b6b19886db
  • Loading branch information
luk1337 authored and basamaryan committed Aug 10, 2023
1 parent cd951bc commit c6ea4e5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions install/install.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -383,10 +384,17 @@ 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("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;
}
Expand Down Expand Up @@ -579,7 +587,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();
}
}

Expand Down

0 comments on commit c6ea4e5

Please sign in to comment.