Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80e0d570 authored by Tianjie Xu's avatar Tianjie Xu Committed by android-build-merger
Browse files

Merge "init: Write the reason in BCB on "reboot recovery"" am: cccb573f

am: ae884a2c

Change-Id: I64d5bbc4739ce73db4a555d0684f203e8d9dda0b
parents 845b8ec4 ae884a2c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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"