support or devices that do not have a trackball or enter button.
diff --git a/Android.mk b/Android.mk
index 41616d2..19f6b84 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,11 +26,15 @@
LOCAL_FORCE_STATIC_EXECUTABLE := true
-RECOVERY_VERSION := ClockworkMod Recovery v1.8.1.5
+RECOVERY_VERSION := ClockworkMod Recovery v1.8.1.6
LOCAL_CFLAGS := -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
RECOVERY_API_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
+ifeq $(BOARD_HAS_NO_SELECT_BUTTON,true)
+ LOCAL_CFLAGS += -DKEY_POWER_IS_SELECT_ITEM
+endif
+
# This binary is in the recovery ramdisk, which is otherwise a copy of root.
# It gets copied there in config/Makefile. LOCAL_MODULE_TAGS suppresses
# a (redundant) copy of the binary in /system/bin for user builds.
diff --git a/common.h b/common.h
index 594f6d6..81d9029 100644
--- a/common.h
+++ b/common.h
@@ -39,7 +39,7 @@
// Display some header text followed by a menu of items, which appears
// at the top of the screen (in place of any scrolling ui_print()
// output, if necessary).
-void ui_start_menu(char** headers, char** items);
+int ui_start_menu(char** headers, char** items);
// Set the menu highlight to the given index, and return it (capped to
// the range [0..numitems).
int ui_menu_select(int sel);
diff --git a/default_recovery_ui.c b/default_recovery_ui.c
index d97caa1..f189da4 100644
--- a/default_recovery_ui.c
+++ b/default_recovery_ui.c
@@ -37,7 +37,11 @@
if (alt && key_code == KEY_L)
return 1;
// allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
+#ifdef KEY_POWER_IS_SELECT_ITEM
+ return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
+#else
return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
+#endif
}
int device_reboot_now(volatile char* key_pressed, int key_code) {
@@ -55,6 +59,9 @@
case KEY_VOLUMEUP:
return HIGHLIGHT_UP;
+#ifdef KEY_POWER_IS_SELECT_ITEM
+ case KEY_POWER:
+#endif
case KEY_ENTER:
case BTN_MOUSE:
case KEY_CENTER:
@@ -63,7 +70,9 @@
case KEY_SEND:
return SELECT_ITEM;
+#ifndef KEY_POWER_IS_SELECT_ITEM
case KEY_POWER:
+#endif
case KEY_END:
case KEY_BACKSPACE:
case KEY_BACK:
diff --git a/recovery.c b/recovery.c
index 70d165c..ed2bbb9 100644
--- a/recovery.c
+++ b/recovery.c
@@ -310,7 +310,7 @@
// accidentally trigger menu items.
ui_clear_key_queue();
- ui_start_menu(headers, items);
+ int item_count = ui_start_menu(headers, items);
int selected = 0;
int chosen_item = -1;
@@ -332,6 +332,11 @@
break;
case SELECT_ITEM:
chosen_item = selected;
+#ifdef KEY_POWER_IS_SELECT_ITEM
+ if (chosen_item == item_count) {
+ chosen_item = GO_BACK;
+ }
+#endif
break;
case NO_ACTION:
break;
@@ -544,7 +549,7 @@
if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR;
if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed.\n");
} else {
- LOGI("Running extendedcommand...\n");
+ LOGI("Checking for extendedcommand...\n");
status = INSTALL_ERROR; // No command specified
// we are starting up in user initiated recovery here
// let's set up some default options
@@ -554,10 +559,13 @@
ui_set_show_text(1);
if (extendedcommand_file_exists()) {
+ LOGI("Running extendedcommand...\n");
if (0 == run_and_remove_extendedcommand()) {
status = INSTALL_SUCCESS;
ui_set_show_text(0);
}
+ } else {
+ LOGI("Skipping execution of extendedcommand, file not found...\n");
}
}
diff --git a/ui.c b/ui.c
index 039043e..651eea1 100644
--- a/ui.c
+++ b/ui.c
@@ -490,7 +490,7 @@
#define MENU_ITEM_HEADER " - "
#define MENU_ITEM_HEADER_LENGTH strlen(MENU_ITEM_HEADER)
-void ui_start_menu(char** headers, char** items) {
+int ui_start_menu(char** headers, char** items) {
int i;
pthread_mutex_lock(&gUpdateMutex);
if (text_rows > 0 && text_cols > 0) {
@@ -506,6 +506,10 @@
strncpy(menu[i] + MENU_ITEM_HEADER_LENGTH, items[i-menu_top], text_cols-1 - MENU_ITEM_HEADER_LENGTH);
menu[i][text_cols-1] = '\0';
}
+#ifdef KEY_POWER_IS_SELECT_ITEM
+ strcpy(menu[i], " - +++++Go Back+++++");
+ ++i;
+#endif
menu_items = i - menu_top;
show_menu = 1;
@@ -513,6 +517,11 @@
update_screen_locked();
}
pthread_mutex_unlock(&gUpdateMutex);
+#ifdef KEY_POWER_IS_SELECT_ITEM
+ return menu_items - 1;
+#else
+ return menu_items;
+#endif
}
int ui_menu_select(int sel) {