Parse BCB command to enter rescue mode.
bootloader will set `boot-rescue` in BCB command field to indicate
booting into rescue mode. This CL adds the matching parsing code.
This CL changes the on-screen UI to display the default image while
waiting for each sideload / rescue command.
It also changes the minadbd reboot handlers to use REBOOT_ instead of
the previous ENTER_ actions. This ensures a reboot going through
bootloader, which may load a newly installed bootloader/recovery.
Bug: 128505466
Test: Boot into rescue mode. Run `adb rescue getprop` and `adb rescue
install`. Check the UI. Then run `adb reboot rescue`.
Change-Id: I5b7de9dfd898ed8e14bea0d4ad7385a9bae26e94
diff --git a/recovery.cpp b/recovery.cpp
index 5bd9b17..f9b3bfc 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -509,12 +509,14 @@
case Device::NO_ACTION:
break;
- case Device::REBOOT:
- case Device::SHUTDOWN:
- case Device::REBOOT_BOOTLOADER:
- case Device::REBOOT_RESCUE:
case Device::ENTER_FASTBOOT:
case Device::ENTER_RECOVERY:
+ case Device::REBOOT:
+ case Device::REBOOT_BOOTLOADER:
+ case Device::REBOOT_FASTBOOT:
+ case Device::REBOOT_RECOVERY:
+ case Device::REBOOT_RESCUE:
+ case Device::SHUTDOWN:
return chosen_action;
case Device::WIPE_DATA:
@@ -728,6 +730,7 @@
{ "locale", required_argument, nullptr, 0 },
{ "prompt_and_wipe_data", no_argument, nullptr, 0 },
{ "reason", required_argument, nullptr, 0 },
+ { "rescue", no_argument, nullptr, 0 },
{ "retry_count", required_argument, nullptr, 0 },
{ "security", no_argument, nullptr, 0 },
{ "show_text", no_argument, nullptr, 't' },
@@ -750,6 +753,7 @@
size_t wipe_package_size = 0;
bool sideload = false;
bool sideload_auto_reboot = false;
+ bool rescue = false;
bool just_exit = false;
bool shutdown_after = false;
bool fsck_unshare_blocks = false;
@@ -783,6 +787,8 @@
should_prompt_and_wipe_data = true;
} else if (option == "reason") {
reason = optarg;
+ } else if (option == "rescue") {
+ rescue = true;
} else if (option == "retry_count") {
android::base::ParseInt(optarg, &retry_count, 0);
} else if (option == "security") {
@@ -946,6 +952,10 @@
status = INSTALL_REBOOT;
ui->Print("Rebooting automatically.\n");
}
+ } else if (rescue) {
+ save_current_log = true;
+ status = ApplyFromAdb(ui, true /* rescue_mode */, &next_action);
+ ui->Print("\nInstall from ADB complete (status: %d).\n", status);
} else if (fsck_unshare_blocks) {
if (!do_fsck_unshare_blocks()) {
status = INSTALL_ERROR;