Merge "Allow switch to fastbootd when userdata wipe is required"
am: 16147d1bd6
Change-Id: I475f0f48b4deab9c858fb7e5bd699e94d9a1b89e
This commit is contained in:
@@ -23,8 +23,15 @@
|
|||||||
|
|
||||||
#include <ziparchive/zip_archive.h>
|
#include <ziparchive/zip_archive.h>
|
||||||
|
|
||||||
enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE, INSTALL_SKIPPED,
|
enum InstallResult {
|
||||||
INSTALL_RETRY };
|
INSTALL_SUCCESS,
|
||||||
|
INSTALL_ERROR,
|
||||||
|
INSTALL_CORRUPT,
|
||||||
|
INSTALL_NONE,
|
||||||
|
INSTALL_SKIPPED,
|
||||||
|
INSTALL_RETRY,
|
||||||
|
INSTALL_KEY_INTERRUPTED
|
||||||
|
};
|
||||||
|
|
||||||
// Installs the given update package. If INSTALL_SUCCESS is returned and *wipe_cache is true on
|
// Installs the given update package. If INSTALL_SUCCESS is returned and *wipe_cache is true on
|
||||||
// exit, caller should wipe the cache partition.
|
// exit, caller should wipe the cache partition.
|
||||||
|
|||||||
+11
-7
@@ -394,7 +394,7 @@ static bool wipe_data(Device* device) {
|
|||||||
return success;
|
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.
|
// Use a single string and let ScreenRecoveryUI handles the wrapping.
|
||||||
std::vector<std::string> headers{
|
std::vector<std::string> headers{
|
||||||
"Can't load Android system. Your data may be corrupt. "
|
"Can't load Android system. Your data may be corrupt. "
|
||||||
@@ -415,13 +415,17 @@ static bool prompt_and_wipe_data(Device* device) {
|
|||||||
|
|
||||||
// If ShowMenu() returned RecoveryUI::KeyError::INTERRUPTED, WaitKey() was interrupted.
|
// If ShowMenu() returned RecoveryUI::KeyError::INTERRUPTED, WaitKey() was interrupted.
|
||||||
if (chosen_item == static_cast<size_t>(RecoveryUI::KeyError::INTERRUPTED)) {
|
if (chosen_item == static_cast<size_t>(RecoveryUI::KeyError::INTERRUPTED)) {
|
||||||
return false;
|
return INSTALL_KEY_INTERRUPTED;
|
||||||
}
|
}
|
||||||
if (chosen_item != 1) {
|
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)) {
|
if (ask_to_wipe_data(device)) {
|
||||||
return wipe_data(device);
|
if (wipe_data(device)) {
|
||||||
|
return INSTALL_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return INSTALL_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1194,10 +1198,10 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
|
|||||||
} else if (should_prompt_and_wipe_data) {
|
} else if (should_prompt_and_wipe_data) {
|
||||||
ui->ShowText(true);
|
ui->ShowText(true);
|
||||||
ui->SetBackground(RecoveryUI::ERROR);
|
ui->SetBackground(RecoveryUI::ERROR);
|
||||||
if (!prompt_and_wipe_data(device)) {
|
status = prompt_and_wipe_data(device);
|
||||||
status = INSTALL_ERROR;
|
if (status != INSTALL_KEY_INTERRUPTED) {
|
||||||
|
ui->ShowText(false);
|
||||||
}
|
}
|
||||||
ui->ShowText(false);
|
|
||||||
} else if (should_wipe_cache) {
|
} else if (should_wipe_cache) {
|
||||||
if (!wipe_cache(false, device)) {
|
if (!wipe_cache(false, device)) {
|
||||||
status = INSTALL_ERROR;
|
status = INSTALL_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user