From a48fd33655b2d95c250f033eaf88999cfb66e8ea Mon Sep 17 00:00:00 2001 From: Tom Marshall Date: Tue, 25 Nov 2014 12:58:22 -0800 Subject: sr: Return to main menu after selection Change-Id: Ib6fd1904b6516a651ffaad20f66b2eaf42c31619 --- recovery.cpp | 54 ++++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/recovery.cpp b/recovery.cpp index 3a1fd61..d3b1aec 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -966,35 +966,33 @@ refresh: bool wipe_cache; int status = INSTALL_ERROR; - for (;;) { - int chosen = get_menu_selection(headers, menu_items, 0, 0, device); - for (i = 0; i < n; ++i) { - free(menu_items[i]); - } - if (chosen == Device::kRefresh) { - goto refresh; - } - if (chosen == Device::kGoBack) { - break; - } - if (chosen == item_sideload) { - static const char* headers[] = { "ADB Sideload", - "", - NULL - }; - static const char* list[] = { "Cancel sideload", NULL }; - - start_sideload(ui, &wipe_cache, TEMPORARY_INSTALL_FILE); - int item = get_menu_selection(headers, list, 0, 0, device); - if (item != Device::kNoAction) { - stop_sideload(); - } - status = wait_sideload(); - } - else { - std::string id = volumes[chosen - 1].mId; - status = apply_from_storage(device, id, &wipe_cache); + int chosen = get_menu_selection(headers, menu_items, 0, 0, device); + for (i = 0; i < n; ++i) { + free(menu_items[i]); + } + if (chosen == Device::kRefresh) { + goto refresh; + } + if (chosen == Device::kGoBack) { + return INSTALL_NONE; + } + if (chosen == item_sideload) { + static const char* headers[] = { "ADB Sideload", + "", + NULL + }; + static const char* list[] = { "Cancel sideload", NULL }; + + start_sideload(ui, &wipe_cache, TEMPORARY_INSTALL_FILE); + int item = get_menu_selection(headers, list, 0, 0, device); + if (item != Device::kNoAction) { + stop_sideload(); } + status = wait_sideload(); + } + else { + std::string id = volumes[chosen - 1].mId; + status = apply_from_storage(device, id, &wipe_cache); } return status; -- cgit v1.1