From a81817cbd8d0e7e5e845b6489edae1d87ac9a1d5 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Tue, 23 Jul 2013 11:55:16 -0700 Subject: more headless fixes Change-Id: I25243f67b8bcbef41867497b442d1b7f38f638dd --- Android.mk | 2 +- recovery.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Android.mk b/Android.mk index 2e0966f..3556218 100644 --- a/Android.mk +++ b/Android.mk @@ -38,7 +38,7 @@ RECOVERY_NAME := CWM-based Recovery endif endif -RECOVERY_VERSION := $(RECOVERY_NAME) v6.0.3.3 +RECOVERY_VERSION := $(RECOVERY_NAME) v6.0.3.4 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 diff --git a/recovery.c b/recovery.c index 7281c15..6e8555e 100644 --- a/recovery.c +++ b/recovery.c @@ -680,6 +680,15 @@ wipe_data(int confirm) { ui_print("Data wipe complete.\n"); } +static void headless_wait() { + ui_show_text(0); + char** headers = prepend_title((const char**)MENU_HEADERS); + for (;;) { + finish_recovery(NULL); + get_menu_selection(headers, MENU_ITEMS, 0, 0); + } +} + int ui_menu_level = 1; int ui_root_menu = 0; static void @@ -962,8 +971,10 @@ main(int argc, char **argv) { signature_check_enabled = 0; script_assert_enabled = 0; is_user_initiated_recovery = 1; - ui_set_show_text(1); - ui_set_background(BACKGROUND_ICON_CLOCKWORK); + if (!headless) { + ui_set_show_text(1); + ui_set_background(BACKGROUND_ICON_CLOCKWORK); + } if (extendedcommand_file_exists()) { LOGI("Running extendedcommand...\n"); @@ -982,11 +993,14 @@ main(int argc, char **argv) { setup_adbd(); + if (headless) { + headless_wait(); + } if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) { ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_ERROR); } - if (status != INSTALL_SUCCESS || ui_text_visible()) { + else if (status != INSTALL_SUCCESS || ui_text_visible()) { prompt_and_wait(); } -- cgit v1.1