init: Write the reason in BCB on "reboot recovery"
Without this change "adb reboot recovery" leads to normal boot. Bug: 137523800 Test: peform factory reset, adb reboot recovery Change-Id: Ie791c8107d3434bf4ae6f5785b24e7d97921a7a9
This commit is contained in:
parent
137943d31b
commit
5e98b633a7
1 changed files with 14 additions and 0 deletions
|
@ -669,6 +669,20 @@ bool HandlePowerctlMessage(const std::string& command) {
|
|||
"bootloader_message: "
|
||||
<< err;
|
||||
}
|
||||
} else if (reboot_target == "recovery") {
|
||||
bootloader_message boot = {};
|
||||
if (std::string err; !read_bootloader_message(&boot, &err)) {
|
||||
LOG(ERROR) << "Failed to read bootloader message: " << err;
|
||||
}
|
||||
// Update the boot command field if it's empty, and preserve
|
||||
// the other arguments in the bootloader message.
|
||||
if (boot.command[0] == '\0') {
|
||||
strlcpy(boot.command, "boot-recovery", sizeof(boot.command));
|
||||
if (std::string err; !write_bootloader_message(boot, &err)) {
|
||||
LOG(ERROR) << "Failed to set bootloader message: " << err;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (reboot_target == "sideload" || reboot_target == "sideload-auto-reboot" ||
|
||||
reboot_target == "fastboot") {
|
||||
std::string arg = reboot_target == "sideload-auto-reboot" ? "sideload_auto_reboot"
|
||||
|
|
Loading…
Reference in a new issue