diff --git a/Android.mk b/Android.mk index 688acb9..2e565bb 100644 --- a/Android.mk +++ b/Android.mk @@ -25,7 +25,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_API_VERSION := 2 +RECOVERY_API_VERSION := 1.4 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) # This binary is in the recovery ramdisk, which is otherwise a copy of root. diff --git a/default_recovery_ui.c b/default_recovery_ui.c index d832794..2b78e0c 100644 --- a/default_recovery_ui.c +++ b/default_recovery_ui.c @@ -20,9 +20,7 @@ #include "common.h" #include "extendedcommands.h" -char* MENU_HEADERS[] = { "Android system recovery utility", - "", - NULL }; +char* MENU_HEADERS[] = { NULL }; char* MENU_ITEMS[] = { "reboot system now", "apply sdcard:update.zip", diff --git a/nandroid/nandroid-mobile.sh b/nandroid/nandroid-mobile.sh index 6de3a8c..3f516d6 100755 --- a/nandroid/nandroid-mobile.sh +++ b/nandroid/nandroid-mobile.sh @@ -55,7 +55,6 @@ RECOVERY=foo echo "nandroid-mobile v2.1" -echo here > /etc/foo mkfstab.sh > /etc/fstab if [ "$1" == "" ]; then @@ -193,7 +192,7 @@ case $FAIL in 3) echo "Error mounting sdcard read-write"; umount /system /data /sdcard; exit 15;; esac -TIMESTAMP="`date +%Y%m%d-%H%M`" +TIMESTAMP="`date +%Y-%m-%d-%H%M`" BASEDIR=/sdcard/nandroid if [ ! -z "$2" ]; then BASEDIR=$2 diff --git a/recovery.c b/recovery.c index 45911ea..6b16470 100644 --- a/recovery.c +++ b/recovery.c @@ -136,7 +136,7 @@ fopen_root_path(const char *root_path, const char *mode) { if (strchr("wa", mode[0])) dirCreateHierarchy(path, 0777, NULL, 1); FILE *fp = fopen(path, mode); - if (fp == NULL) LOGE("Can't open %s\n", path); + if (fp == NULL && root_path != COMMAND_FILE) LOGE("Can't open %s\n", path); return fp; } @@ -284,8 +284,8 @@ erase_root(const char *root) static char** prepend_title(char** headers) { - char* title[] = { "Android system recovery <" - EXPAND(RECOVERY_API_VERSION) "e>", + char* title[] = { "ClockworkMod Recovery v" + EXPAND(RECOVERY_API_VERSION), "", NULL }; @@ -393,7 +393,8 @@ static void prompt_and_wait() { char** headers = prepend_title(MENU_HEADERS); - + ui_print("ClockworkMod Recovery v"EXPAND(RECOVERY_API_VERSION)"\n"); + for (;;) { finish_recovery(NULL); ui_reset_progress(); diff --git a/ui.c b/ui.c index 70ddc33..fdb11f4 100644 --- a/ui.c +++ b/ui.c @@ -164,6 +164,10 @@ static void draw_text_line(int row, const char* t) { } } +#define MENU_TEXT_COLOR 7, 133, 74, 255 +#define NORMAL_TEXT_COLOR 200, 200, 200, 255 +#define HEADER_TEXT_COLOR NORMAL_TEXT_COLOR + // Redraw everything on the screen. Does not flip pages. // Should only be called with gUpdateMutex locked. static void draw_screen_locked(void) @@ -177,15 +181,21 @@ static void draw_screen_locked(void) int i = 0; if (show_menu) { - gr_color(64, 96, 255, 255); + gr_color(MENU_TEXT_COLOR); gr_fill(0, (menu_top+menu_sel) * CHAR_HEIGHT, gr_fb_width(), (menu_top+menu_sel+1)*CHAR_HEIGHT+1); + gr_color(HEADER_TEXT_COLOR); + int is_drawing_header = 1; for (; i < menu_top + menu_items; ++i) { + if (is_drawing_header && strcmp(menu[i], "") == 0) { + gr_color(MENU_TEXT_COLOR); + is_drawing_header = 0; + } if (i == menu_top + menu_sel) { gr_color(255, 255, 255, 255); draw_text_line(i, menu[i]); - gr_color(64, 96, 255, 255); + gr_color(MENU_TEXT_COLOR); } else { draw_text_line(i, menu[i]); } @@ -195,7 +205,7 @@ static void draw_screen_locked(void) ++i; } - gr_color(255, 255, 0, 255); + gr_color(NORMAL_TEXT_COLOR); for (; i < text_rows; ++i) { draw_text_line(i, text[(i+text_top) % text_rows]); @@ -458,6 +468,9 @@ void ui_print(const char *fmt, ...) pthread_mutex_unlock(&gUpdateMutex); } +#define MENU_ITEM_HEADER " - " +#define MENU_ITEM_HEADER_LENGTH strlen(MENU_ITEM_HEADER) + void ui_start_menu(char** headers, char** items) { int i; pthread_mutex_lock(&gUpdateMutex); @@ -470,7 +483,8 @@ void ui_start_menu(char** headers, char** items) { menu_top = i; for (; i < text_rows; ++i) { if (items[i-menu_top] == NULL) break; - strncpy(menu[i], items[i-menu_top], text_cols-1); + strcpy(menu[i], MENU_ITEM_HEADER); + strncpy(menu[i] + MENU_ITEM_HEADER_LENGTH, items[i-menu_top], text_cols-1 - MENU_ITEM_HEADER_LENGTH); menu[i][text_cols-1] = '\0'; } menu_items = i - menu_top;