support or devices that do not have a trackball or enter button.
This commit is contained in:
parent
cd9e3ce55b
commit
f4e3a67a38
@ -26,11 +26,15 @@ LOCAL_MODULE := recovery
|
||||
|
||||
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.
|
||||
|
2
common.h
2
common.h
@ -39,7 +39,7 @@ void ui_set_show_text(int value);
|
||||
// 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);
|
||||
|
@ -37,7 +37,11 @@ int device_toggle_display(volatile char* key_pressed, int key_code) {
|
||||
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 @@ int device_handle_key(int key_code, int visible) {
|
||||
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 @@ int device_handle_key(int key_code, int visible) {
|
||||
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:
|
||||
|
12
recovery.c
12
recovery.c
@ -310,7 +310,7 @@ get_menu_selection(char** headers, char** items, int menu_only) {
|
||||
// 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 @@ get_menu_selection(char** headers, char** items, int menu_only) {
|
||||
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 @@ main(int argc, char **argv)
|
||||
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 @@ main(int argc, char **argv)
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
11
ui.c
11
ui.c
@ -490,7 +490,7 @@ void ui_reset_text_col()
|
||||
#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 @@ void ui_start_menu(char** headers, char** items) {
|
||||
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 @@ void ui_start_menu(char** headers, char** items) {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user