aboutsummaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2015-12-08 16:24:35 -0800
committerTom Marshall <tdm@cyngn.com>2016-02-04 13:22:50 -0800
commitda584a2e6df7045c080aceca9d3a8a3fee0081db (patch)
treee60eea5963892e48c4b089f23dc115edbad011bf /recovery.cpp
parent3b963ad1b26694ae891f5f3a6ca0c569dbd71945 (diff)
downloadbootable_recovery-da584a2e6df7045c080aceca9d3a8a3fee0081db.zip
bootable_recovery-da584a2e6df7045c080aceca9d3a8a3fee0081db.tar.gz
bootable_recovery-da584a2e6df7045c080aceca9d3a8a3fee0081db.tar.bz2
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
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp18
1 files changed, 10 insertions, 8 deletions
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");