Permalink
Browse files

Separate extras into extras and options. Options will have all the

configrable options, allow the Nandroid location to be saved to sdcard
and set in one place.
  • Loading branch information...
1 parent ce35641 commit 9609c946250b54b84a2b8d9dff1eb3b338f2df19 @raidzero committed Dec 10, 2011
Showing with 233 additions and 228 deletions.
  1. +9 −9 Android.mk
  2. +6 −4 default_recovery_ui.c
  3. +137 −18 extras_menu.c
  4. +2 −0 extras_menu.h
  5. +64 −191 nandroid_menu.c
  6. +8 −0 recovery.c
  7. +2 −1 recovery_ui.h
  8. +5 −5 ui.c
View
@@ -29,15 +29,6 @@ LOCAL_SRC_FILES := \
##the world just isnt ready for API level 3 yet
RECOVERY_API_VERSION := 2
-BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_INVERTED_VOLUME
-
-$(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
- $(if $($(board_define)), \
- $(eval LOCAL_CFLAGS += -D$(board_define)=\"$($(board_define))\") \
- ) \
- )
-
-
##generate the recovery version file
TARGET_DEVICE := $(shell echo $$TARGET_PRODUCT | cut -d '_' -f2)
RECOVERY_VERSION := "2.1.4"
@@ -56,6 +47,15 @@ LOCAL_STATIC_LIBRARIES += libext4_utils libz
LOCAL_STATIC_LIBRARIES += libminzip libunz libmincrypt
LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils liberase_image libdump_image libflash_image
+
+BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_INVERTED_VOLUME
+
+$(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
+ $(if $($(board_define)), \
+ $(eval LOCAL_CFLAGS += -D$(board_define)=\"$($(board_define))\") \
+ ) \
+)
+
LOCAL_STATIC_LIBRARIES += libstdc++ libc
LOCAL_C_INCLUDES += system/extras/ext4_utils
include $(BUILD_EXECUTABLE)
View
@@ -34,6 +34,7 @@ char *MENU_ITEMS[] = { "Reboot android",
"Mount menu",
"Nandroid menu",
"Install from sdcard",
+ "Options menu",
"Extras menu",
NULL
};
@@ -61,12 +62,12 @@ device_handle_key (int key_code)
return HIGHLIGHT_DOWN;
case KEY_VOLUMEDOWN: //114
- if (backwards_volume_keys_toggled()) return HIGHLIGHT_UP;
- if (!backwards_volume_keys_toggled()) return HIGHLIGHT_DOWN;
+ if (backwardsVolume_toggled()) return HIGHLIGHT_UP;
+ if (!backwardsVolume_toggled()) return HIGHLIGHT_DOWN;
case KEY_VOLUMEUP: //115
- if (backwards_volume_keys_toggled()) return HIGHLIGHT_DOWN;
- if (!backwards_volume_keys_toggled()) return HIGHLIGHT_UP;
+ if (backwardsVolume_toggled()) return HIGHLIGHT_DOWN;
+ if (!backwardsVolume_toggled()) return HIGHLIGHT_UP;
case KEY_LEFTSHIFT:
case 51: //galaxy s 4g
@@ -82,6 +83,7 @@ device_handle_key (int key_code)
case KEY_CENTER:
case KEY_HOME: //102
case KEY_MENU:
+ case KEY_SEARCH:
case 272: //trackball press
return SELECT_ITEM;
View
@@ -8,6 +8,13 @@
#include "recovery_ui.h"
#include "plugins_menu.h"
+char* backuppath = "/sdcard/nandroid";
+
+char* return_nandroid_path()
+{
+ return backuppath;
+}
+
void show_battstat ()
{
FILE *fs = fopen ("/sys/class/power_supply/battery/status", "r");
@@ -92,6 +99,128 @@ int plugins_present(const char* sdpath)
return 0;
}
}
+
+void show_nandroid_dir_menu()
+{
+ char *headers[] = { "Choose a nandroid directory",
+ "",
+ NULL
+ };
+
+ char *items[] = { "/sdcard/nandroid",
+ "/sdcard/external_sdcard",
+ "/emmc/nandroid",
+ "/data/media",
+ NULL
+ };
+
+#define sdcard_nandroid 0
+#define sdcard_external 1
+#define emmc 2
+#define data_media 3
+
+ int chosen_item = -1;
+ while (chosen_item != ITEM_BACK)
+ {
+ chosen_item = get_menu_selection (headers, items, 0, chosen_item < 0 ? 0 : chosen_item);
+ if (chosen_item == ITEM_BACK)
+ {
+ return;
+ }
+ switch (chosen_item)
+ {
+ case sdcard_nandroid:
+ backuppath = "/sdcard/nandroid";
+ break;
+ case sdcard_external:
+ backuppath = "/sdcard/external_sdcard";
+ break;
+ case emmc:
+ backuppath = "/emmc/nandroid";
+ break;
+ case data_media:
+ backuppath = "/data/media/nandroid";
+ break;
+ }
+
+ int status = set_backuppath(backuppath);
+
+ if (status != -1)
+ {
+ ui_print("Nandroid directory: %s\n", backuppath);
+ return;
+ }
+ else
+ {
+ ui_print("Invalid selection: %s!\n", backuppath);
+ }
+ }
+}
+
+int set_backuppath(const char* sdpath)
+{
+ char path[PATH_MAX] = "";
+ DIR *dir;
+ struct dirent *de;
+ int total = 0;
+
+ if (ensure_path_mounted (sdpath) != 0) return -1;
+
+ dir = opendir (sdpath);
+ if (dir == NULL) return -1;
+
+ ensure_path_mounted("/sdcard");
+ FILE *fp;
+ fp = fopen("/sdcard/RZR/nandloc", "w");
+ fprintf(fp, "%s\0", backuppath);
+ fclose(fp);
+
+ return 0;
+}
+
+void show_options_menu()
+{
+ static char *headers[] = { "Options",
+ "",
+ NULL
+ };
+
+ static char *items[] = {
+ "Custom Colors",
+ "Recovery Overclocking",
+ "Nandroid Location",
+ NULL
+ };
+
+#define OPT_COLORS 0
+#define OPT_OVRCLCK 1
+#define OPT_NANDLOC 2
+
+ int chosen_item = -1;
+ while (chosen_item != ITEM_BACK)
+ {
+ chosen_item =
+ get_menu_selection (headers, items, 0,
+ chosen_item < 0 ? 0 : chosen_item);
+
+
+ switch (chosen_item)
+ {
+ case OPT_COLORS:
+ show_colors_menu ();
+ break;
+ case OPT_OVRCLCK:
+ show_overclock_menu ();
+ break;
+ case OPT_NANDLOC:
+ show_nandroid_dir_menu();
+ break;
+ }
+ }
+}
+
+
+
void
show_extras_menu ()
@@ -102,22 +231,18 @@ show_extras_menu ()
};
char* items[6];
- items[0] = "Custom Colors";
- items[1] = "Show Battery Status";
- items[2] = "Recovery Overclocking";
- items[3] = "View Log";
+ items[0] = "Show Battery Status";
+ items[1] = "View Log";
if (plugins_present("/sdcard/RZR/plugins"))
{
- items[4] = "Plugins";
- items[5] = NULL;
+ items[2] = "Plugins";
+ items[3] = NULL;
}
- else items[4] = NULL;
+ else items[2] = NULL;
-#define COLORS 0
-#define BATT 1
-#define OVERCLOCK 2
-#define VIEW_LOG 3
-#define PLUGINS 4
+#define BATT 0
+#define VIEW_LOG 1
+#define PLUGINS 2
int chosen_item = -1;
@@ -130,15 +255,9 @@ show_extras_menu ()
switch (chosen_item)
{
- case COLORS:
- show_colors_menu ();
- break;
case BATT:
show_battstat ();
break;
- case OVERCLOCK:
- show_overclock_menu ();
- break;
case VIEW_LOG:
view_log();
break;
View
@@ -1 +1,3 @@
void show_extras_menu ();
+void show_options_menu ();
+char* return_nandroid_path(char* sdpath);
Oops, something went wrong.

0 comments on commit 9609c94

Please sign in to comment.