diff options
-rw-r--r-- | install.h | 11 | ||||
-rw-r--r-- | minui/graphics.cpp | 6 | ||||
-rw-r--r-- | recovery.cpp | 21 | ||||
-rw-r--r-- | recovery_main.cpp | 4 |
4 files changed, 30 insertions, 12 deletions
@@ -23,8 +23,15 @@ #include <ziparchive/zip_archive.h> -enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE, INSTALL_SKIPPED, - INSTALL_RETRY }; +enum InstallResult { + 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 // exit, caller should wipe the cache partition. diff --git a/minui/graphics.cpp b/minui/graphics.cpp index 4fe0fdc7b..e6367d950 100644 --- a/minui/graphics.cpp +++ b/minui/graphics.cpp @@ -342,7 +342,7 @@ void gr_flip() { int gr_init() { // pixel_format needs to be set before loading any resources or initializing backends. - std::string format = android::base::GetProperty("ro.recovery.ui.pixel_format", ""); + std::string format = android::base::GetProperty("ro.minui.pixel_format", ""); if (format == "ABGR_8888") { pixel_format = PixelFormat::ABGR; } else if (format == "RGBX_8888") { @@ -378,7 +378,7 @@ int gr_init() { gr_backend = backend.release(); - int overscan_percent = android::base::GetIntProperty("ro.recovery.ui.overscan_percent", 0); + int overscan_percent = android::base::GetIntProperty("ro.minui.overscan_percent", 0); overscan_offset_x = gr_draw->width * overscan_percent / 100; overscan_offset_y = gr_draw->height * overscan_percent / 100; @@ -390,7 +390,7 @@ int gr_init() { } std::string rotation_str = - android::base::GetProperty("ro.recovery.ui.default_rotation", "ROTATION_NONE"); + android::base::GetProperty("ro.minui.default_rotation", "ROTATION_NONE"); if (rotation_str == "ROTATION_RIGHT") { gr_rotate(GRRotation::RIGHT); } else if (rotation_str == "ROTATION_DOWN") { diff --git a/recovery.cpp b/recovery.cpp index 5934b61d7..7cc344bce 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -394,7 +394,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. " @@ -415,13 +415,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; + } } } } @@ -1192,12 +1196,15 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri status = INSTALL_ERROR; } } else if (should_prompt_and_wipe_data) { + // Trigger the logging to capture the cause, even if user chooses to not wipe data. + modified_flash = true; + 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; diff --git a/recovery_main.cpp b/recovery_main.cpp index c3168fc23..29a5865a2 100644 --- a/recovery_main.cpp +++ b/recovery_main.cpp @@ -425,6 +425,10 @@ int main(int argc, char** argv) { device->RemoveMenuItemForAction(Device::WIPE_CACHE); } + if (!android::base::GetBoolProperty("ro.boot.logical_partitions", false)) { + device->RemoveMenuItemForAction(Device::ENTER_FASTBOOT); + } + ui->SetBackground(RecoveryUI::NONE); if (show_text) ui->ShowText(true); |