From da584a2e6df7045c080aceca9d3a8a3fee0081db Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Tue, 8 Dec 2015 16:24:35 -0800 Subject: recovery: Menu rewrites and cleanups * Introduce a menu stack for navigating sub-menus. The menu data structure format is a bit messy, but necessary in order to provide a string list for the ui. * Create "advanced" sub-menu for rarely used and dangerous commands. * Create "factory reset" sub-menu for various reset and wipe commands. * Separate "wipe data" and "factory reset" items. Change-Id: Ib9bc6967b98d022880cfe7fa8e324cd64b07d248 --- recovery.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'recovery.cpp') diff --git a/recovery.cpp b/recovery.cpp index 5c9f43f..3ecd5db 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -1025,8 +1025,6 @@ refresh: return status; } -int ui_root_menu = 0; - // Return REBOOT, SHUTDOWN, or REBOOT_BOOTLOADER. Returning NO_ACTION // means to take the default, which is to reboot or shutdown depending // on if the --shutdown_after flag was passed to recovery. @@ -1034,7 +1032,6 @@ static Device::BuiltinAction prompt_and_wait(Device* device, int status) { for (;;) { finish_recovery(NULL); - ui_root_menu = 1; switch (status) { case INSTALL_SUCCESS: case INSTALL_NONE: @@ -1049,7 +1046,6 @@ prompt_and_wait(Device* device, int status) { ui->SetProgressType(RecoveryUI::EMPTY); int chosen_item = get_menu_selection(nullptr, device->GetMenuItems(), 0, 0, device); - ui_root_menu = 0; // device-specific code may take some action here. It may // return one of the core actions handled in the switch @@ -1064,6 +1060,7 @@ prompt_and_wait(Device* device, int status) { case Device::REBOOT: case Device::SHUTDOWN: + case Device::REBOOT_RECOVERY: case Device::REBOOT_BOOTLOADER: return chosen_action; @@ -1072,13 +1069,13 @@ prompt_and_wait(Device* device, int status) { if (!ui->IsTextVisible()) return Device::NO_ACTION; break; - case Device::WIPE_CACHE: - wipe_cache(ui->IsTextVisible(), device); + case Device::WIPE_FULL: + wipe_data(ui->IsTextVisible(), device, true); if (!ui->IsTextVisible()) return Device::NO_ACTION; break; - case Device::WIPE_MEDIA: - wipe_media(ui->IsTextVisible(), device); + case Device::WIPE_CACHE: + wipe_cache(ui->IsTextVisible(), device); if (!ui->IsTextVisible()) return Device::NO_ACTION; break; @@ -1516,6 +1513,11 @@ main(int argc, char **argv) { property_set(ANDROID_RB_PROPERTY, "shutdown,"); break; + case Device::REBOOT_RECOVERY: + ui->Print("Rebooting recovery...\n"); + property_set(ANDROID_RB_PROPERTY, "reboot,recovery"); + break; + case Device::REBOOT_BOOTLOADER: #ifdef DOWNLOAD_MODE ui->Print("Rebooting to download mode...\n"); -- cgit v1.1