recovery: do not update bootloader message for boot-fastboot

When booting to fastbootd using bootloader message:
boot.command=boot-fastboot, the boot command get overwritten to
boot-recovery by update_bootloader_message. If the daemon crash for
whatever reason before the bootloader message got clear, the daemon
would start in adb recovery mode instead of fastbootd after it
respawns. Only update bootloader message for boot-recovery command.

Bug: 332973437
Test: boot to fastbootd
Change-Id: I5747c62cf50d2347894d266f2665035f15ae5da0
This commit is contained in:
Roy Luo 2024-04-05 18:06:52 +00:00
parent 5aee6aca72
commit cdcdf52e7c

View file

@ -155,9 +155,13 @@ static std::vector<std::string> get_args(const int argc, char** const argv, std:
// Write the arguments (excluding the filename in args[0]) back into the // Write the arguments (excluding the filename in args[0]) back into the
// bootloader control block. So the device will always boot into recovery to // bootloader control block. So the device will always boot into recovery to
// finish the pending work, until FinishRecovery() is called. // finish the pending work, until FinishRecovery() is called.
std::vector<std::string> options(args.cbegin() + 1, args.cend()); // This should only be done for boot-recovery command so that other commands
if (!update_bootloader_message(options, &err)) { // won't be overwritten.
LOG(ERROR) << "Failed to set BCB message: " << err; if (boot_command == "boot-recovery") {
std::vector<std::string> options(args.cbegin() + 1, args.cend());
if (!update_bootloader_message(options, &err)) {
LOG(ERROR) << "Failed to set BCB message: " << err;
}
} }
// Finally, if no arguments were specified, check whether we should boot // Finally, if no arguments were specified, check whether we should boot