summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorHridya Valsaraju <hridya@google.com>2018-09-12 19:25:01 +0200
committerHridya Valsaraju <hridya@google.com>2018-09-12 23:16:07 +0200
commiteb6f13aeb68368c0d0776173d63a29cf36fb17e8 (patch)
tree3d1c581e3e25d0e39d60ae7faa68af2768e7d284 /recovery.cpp
parentMerge "support mounting f2fs in recovery mode" (diff)
downloadandroid_bootable_recovery-eb6f13aeb68368c0d0776173d63a29cf36fb17e8.tar
android_bootable_recovery-eb6f13aeb68368c0d0776173d63a29cf36fb17e8.tar.gz
android_bootable_recovery-eb6f13aeb68368c0d0776173d63a29cf36fb17e8.tar.bz2
android_bootable_recovery-eb6f13aeb68368c0d0776173d63a29cf36fb17e8.tar.lz
android_bootable_recovery-eb6f13aeb68368c0d0776173d63a29cf36fb17e8.tar.xz
android_bootable_recovery-eb6f13aeb68368c0d0776173d63a29cf36fb17e8.tar.zst
android_bootable_recovery-eb6f13aeb68368c0d0776173d63a29cf36fb17e8.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 01bd83b5e..247cbf968 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -388,7 +388,7 @@ static bool wipe_data(Device* device) {
return success;
}
-static bool prompt_and_wipe_data(Device* device) {
+static InstallResult prompt_and_wipe_data(Device* device) {
// Use a single string and let ScreenRecoveryUI handles the wrapping.
std::vector<std::string> headers{
"Can't load Android system. Your data may be corrupt. "
@@ -409,13 +409,17 @@ static bool prompt_and_wipe_data(Device* device) {
// If ShowMenu() returned RecoveryUI::KeyError::INTERRUPTED, WaitKey() was interrupted.
if (chosen_item == static_cast<size_t>(RecoveryUI::KeyError::INTERRUPTED)) {
- return false;
+ return INSTALL_KEY_INTERRUPTED;
}
if (chosen_item != 1) {
- return true; // Just reboot, no wipe; not a failure, user asked for it
+ return INSTALL_SUCCESS; // Just reboot, no wipe; not a failure, user asked for it
}
if (ask_to_wipe_data(device)) {
- return wipe_data(device);
+ if (wipe_data(device)) {
+ return INSTALL_SUCCESS;
+ } else {
+ return INSTALL_ERROR;
+ }
}
}
}
@@ -1188,10 +1192,10 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
} else if (should_prompt_and_wipe_data) {
ui->ShowText(true);
ui->SetBackground(RecoveryUI::ERROR);
- if (!prompt_and_wipe_data(device)) {
- status = INSTALL_ERROR;
+ status = prompt_and_wipe_data(device);
+ if (status != INSTALL_KEY_INTERRUPTED) {
+ ui->ShowText(false);
}
- ui->ShowText(false);
} else if (should_wipe_cache) {
if (!wipe_cache(false, device)) {
status = INSTALL_ERROR;