summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-04-26 01:40:01 +0200
committerandroid-build-merger <android-build-merger@google.com>2019-04-26 01:40:01 +0200
commita4c38d860a0966fa4f2c3539efce207b673ae6c0 (patch)
treecc1376e94a9459e4e120f1eb14a89d61a298f34b /recovery.cpp
parentMerge "Add TEST_MAPPING." am: c6ebcaaad7 (diff)
parentMerge "Parse BCB command to enter rescue mode." (diff)
downloadandroid_bootable_recovery-a4c38d860a0966fa4f2c3539efce207b673ae6c0.tar
android_bootable_recovery-a4c38d860a0966fa4f2c3539efce207b673ae6c0.tar.gz
android_bootable_recovery-a4c38d860a0966fa4f2c3539efce207b673ae6c0.tar.bz2
android_bootable_recovery-a4c38d860a0966fa4f2c3539efce207b673ae6c0.tar.lz
android_bootable_recovery-a4c38d860a0966fa4f2c3539efce207b673ae6c0.tar.xz
android_bootable_recovery-a4c38d860a0966fa4f2c3539efce207b673ae6c0.tar.zst
android_bootable_recovery-a4c38d860a0966fa4f2c3539efce207b673ae6c0.zip
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 5bd9b1728..f9b3bfc0b 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -509,12 +509,14 @@ static Device::BuiltinAction prompt_and_wait(Device* device, int status) {
case Device::NO_ACTION:
break;
+ case Device::ENTER_FASTBOOT:
+ case Device::ENTER_RECOVERY:
case Device::REBOOT:
- case Device::SHUTDOWN:
case Device::REBOOT_BOOTLOADER:
+ case Device::REBOOT_FASTBOOT:
+ case Device::REBOOT_RECOVERY:
case Device::REBOOT_RESCUE:
- case Device::ENTER_FASTBOOT:
- case Device::ENTER_RECOVERY:
+ case Device::SHUTDOWN:
return chosen_action;
case Device::WIPE_DATA:
@@ -728,6 +730,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
{ "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 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
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 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
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 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
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;