summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-04-23 20:46:25 +0200
committerxunchang <xunchang@google.com>2019-04-25 23:02:41 +0200
commitd9cb014d431fee946308bdb8979c8e8fa74b582f (patch)
tree1b468f56bbc5bfe34fae36e35f977f926a11f104 /recovery.cpp
parentMerge "Add TEST_MAPPING." (diff)
downloadandroid_bootable_recovery-d9cb014d431fee946308bdb8979c8e8fa74b582f.tar
android_bootable_recovery-d9cb014d431fee946308bdb8979c8e8fa74b582f.tar.gz
android_bootable_recovery-d9cb014d431fee946308bdb8979c8e8fa74b582f.tar.bz2
android_bootable_recovery-d9cb014d431fee946308bdb8979c8e8fa74b582f.tar.lz
android_bootable_recovery-d9cb014d431fee946308bdb8979c8e8fa74b582f.tar.xz
android_bootable_recovery-d9cb014d431fee946308bdb8979c8e8fa74b582f.tar.zst
android_bootable_recovery-d9cb014d431fee946308bdb8979c8e8fa74b582f.zip
Diffstat (limited to '')
-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;