mirror of
https://github.com/CTCaer/CTCaer-CWM.git
synced 2024-11-23 01:49:57 +00:00
Add wipe options
- wipe system - wipe data - wipe cache - wipe dalvik cache - wipe system and data - wipe cache and dalvik cache
This commit is contained in:
parent
ff8508f635
commit
84f8428085
@ -22,14 +22,12 @@
|
||||
|
||||
char* MENU_HEADERS[] = { NULL };
|
||||
|
||||
char* MENU_ITEMS[] = { "reboot system now",
|
||||
"install zip from sdcard",
|
||||
"install zip from sideload",
|
||||
"wipe data/factory reset",
|
||||
"wipe cache partition",
|
||||
"backup and restore",
|
||||
"mounts and storage",
|
||||
"advanced",
|
||||
char* MENU_ITEMS[] = { "Install Zip",
|
||||
"Wipe Options",
|
||||
"Backup and Restore",
|
||||
"Mounts and Storage",
|
||||
"Advanced",
|
||||
"Reboot Options",
|
||||
NULL };
|
||||
|
||||
void device_ui_init(UIParameters* ui_parameters) {
|
||||
|
@ -1473,14 +1473,13 @@ void show_advanced_menu()
|
||||
|
||||
static char* list[] = { "Aroma File Manager",
|
||||
"Wipe Battery Stats",
|
||||
"wipe dalvik cache",
|
||||
"report error",
|
||||
"key test",
|
||||
"show log",
|
||||
"fix permissions",
|
||||
"partition sdcard",
|
||||
"partition external sdcard",
|
||||
"partition internal sdcard",
|
||||
"Report Error",
|
||||
"Key Test",
|
||||
"Show Log",
|
||||
"Fix Permissions",
|
||||
"Partition SD card",
|
||||
"Partition External SD card",
|
||||
"Partition Internal SD card",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -1511,24 +1510,11 @@ void show_advanced_menu()
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
if (0 != ensure_path_mounted("/data"))
|
||||
break;
|
||||
ensure_path_mounted("/sd-ext");
|
||||
ensure_path_mounted("/cache");
|
||||
if (confirm_selection( "Confirm wipe?", "Yes - Wipe Dalvik Cache")) {
|
||||
__system("rm -r /data/dalvik-cache");
|
||||
__system("rm -r /cache/dalvik-cache");
|
||||
__system("rm -r /sd-ext/dalvik-cache");
|
||||
ui_print("Dalvik Cache wiped.\n");
|
||||
}
|
||||
ensure_path_unmounted("/data");
|
||||
break;
|
||||
case 3:
|
||||
handle_failure(1);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
{
|
||||
ui_print("Outputting key codes.\n");
|
||||
ui_print("Outputting key codes...\n");
|
||||
ui_print("Go back to end debugging.\n");
|
||||
int key;
|
||||
int action;
|
||||
@ -1541,29 +1527,121 @@ void show_advanced_menu()
|
||||
while (action != GO_BACK);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
case 4:
|
||||
ui_printlogtail(12);
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
ensure_path_mounted("/system");
|
||||
ensure_path_mounted("/data");
|
||||
ui_print("Fixing permissions...\n");
|
||||
__system("fix_permissions");
|
||||
ui_print("Done!\n");
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
partition_sdcard("/sdcard");
|
||||
break;
|
||||
case 8:
|
||||
case 7:
|
||||
partition_sdcard("/external_sd");
|
||||
break;
|
||||
case 9:
|
||||
case 8:
|
||||
partition_sdcard("/emmc");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void show_wipeall_menu()
|
||||
{
|
||||
|
||||
|
||||
static char* headers[] = { "Wipe Options",
|
||||
"",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char* list[] = { "Wipe System",
|
||||
"Wipe Data / Factory Reset",
|
||||
"Wipe Cache",
|
||||
"Wipe Dalvik Cache",
|
||||
"Wipe System and Data",
|
||||
"Wipe Cache and Dalvik Cache",
|
||||
NULL
|
||||
};
|
||||
|
||||
int chosen_item = get_menu_selection(headers, list, 0, 0);
|
||||
// if (chosen_item == GO_BACK)
|
||||
//break;
|
||||
switch (chosen_item)
|
||||
{
|
||||
case 0:
|
||||
if (confirm_selection("Confirm wipe System ?", "Yes, I will install a new ROM!")) {
|
||||
{
|
||||
ui_print("\n-- Wiping system...\n");
|
||||
erase_volume("/system");
|
||||
ui_print("\n==Now flash a new ROM!==\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
wipe_data();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (confirm_selection("Confirm wipe?", "Yes - Wipe Cache"))
|
||||
{
|
||||
ui_print("\n-- Wiping cache...\n");
|
||||
erase_volume("/cache");
|
||||
ui_print("Cache wipe complete.\n");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (0 != ensure_path_mounted("/data"))
|
||||
break;
|
||||
if (confirm_selection( "Confirm wipe?", "Yes - Wipe Dalvik Cache"))
|
||||
{
|
||||
ensure_path_mounted("/sd-ext");
|
||||
ensure_path_mounted("/cache");
|
||||
ui_print("\n-- Wiping dalvik cache...\n");
|
||||
__system("rm -r /data/dalvik-cache");
|
||||
__system("rm -r /cache/dalvik-cache");
|
||||
__system("rm -r /sd-ext/dalvik-cache");
|
||||
ui_print("Dalvik cache wipe complete.\n");
|
||||
}
|
||||
ensure_path_unmounted("/data");
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
if (confirm_selection("Confirm wipe data & system?", "Yes, I will install a new ROM!")) {
|
||||
ui_print("\n-- Wiping data...\n");
|
||||
wipe_data();
|
||||
ui_print("-- Wiping system...\n");
|
||||
erase_volume("/system");
|
||||
ui_print("\n==Now flash a new ROM!==\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
if (0 != ensure_path_mounted("/data"))
|
||||
break;
|
||||
if (confirm_selection( "Confirm Wipe?", "Yes - Wipe Cache and Dalvik Cache"))
|
||||
{
|
||||
ui_print("\n-- Wiping cache...\n");
|
||||
erase_volume("/cache");
|
||||
ensure_path_mounted("/sd-ext");
|
||||
ensure_path_mounted("/cache");
|
||||
ui_print("-- Wiping dalvik cache...\n");
|
||||
__system("rm -r /data/dalvik-cache");
|
||||
__system("rm -r /cache/dalvik-cache");
|
||||
__system("rm -r /sd-ext/dalvik-cache");
|
||||
ui_print("Cache and Dalvik Cache Wiped.\n");
|
||||
}
|
||||
ensure_path_unmounted("/data");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void write_fstab_root(char *path, FILE *file)
|
||||
{
|
||||
Volume *vol = volume_for_path(path);
|
||||
|
@ -28,6 +28,9 @@ show_nandroid_menu();
|
||||
void
|
||||
show_partition_menu();
|
||||
|
||||
void
|
||||
show_wipeall_menu();
|
||||
|
||||
void
|
||||
show_choose_zip_menu();
|
||||
|
||||
|
14
recovery.c
14
recovery.c
@ -303,7 +303,7 @@ finish_recovery(const char *send_intent) {
|
||||
sync(); // For good measure.
|
||||
}
|
||||
|
||||
static int
|
||||
/*static*/int //to be able to call it from wipe options
|
||||
erase_volume(const char *volume) {
|
||||
ui_set_background(BACKGROUND_ICON_INSTALLING);
|
||||
ui_show_indeterminate_progress();
|
||||
@ -629,10 +629,10 @@ update_directory(const char* path, const char* unmount_when_done) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
/*static*/void
|
||||
wipe_data(int confirm) {
|
||||
if (confirm) {
|
||||
static char** title_headers = NULL;
|
||||
/*static*/char** title_headers = NULL;
|
||||
|
||||
if (title_headers == NULL) {
|
||||
char* headers[] = { "Confirm wipe of all user data?",
|
||||
@ -765,6 +765,10 @@ prompt_and_wait() {
|
||||
show_install_update_menu();
|
||||
break;
|
||||
|
||||
case ITEM_WIPES_ALL:
|
||||
show_wipeall_menu();
|
||||
break;
|
||||
|
||||
case ITEM_NANDROID:
|
||||
show_nandroid_menu();
|
||||
break;
|
||||
@ -776,10 +780,6 @@ prompt_and_wait() {
|
||||
case ITEM_ADVANCED:
|
||||
show_advanced_menu();
|
||||
break;
|
||||
|
||||
case ITEM_POWEROFF:
|
||||
poweroff = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,17 +72,19 @@ int device_wipe_data();
|
||||
#define SELECT_ITEM -4
|
||||
#define GO_BACK -5
|
||||
|
||||
#define ITEM_REBOOT 0
|
||||
#define ITEM_APPLY_EXT 1
|
||||
#define ITEM_APPLY_SDCARD 1 // historical synonym for ITEM_APPLY_EXT
|
||||
#define ITEM_WIPE_DATA 2
|
||||
#define ITEM_WIPE_CACHE 3
|
||||
#define ITEM_APPLY_EXT 0
|
||||
#define ITEM_APPLY_SDCARD 0 // historical synonym for ITEM_APPLY_EXT
|
||||
//#define ITEM_APPLY_SIDELOAD 1
|
||||
#define ITEM_WIPES_ALL 1
|
||||
#define ITEM_NANDROID 2
|
||||
#define ITEM_PARTITION 3
|
||||
#define ITEM_ADVANCED 4
|
||||
#define ITEM_REBOOT 5
|
||||
#define ITEM_WIPE_DATA 6
|
||||
#define ITEM_WIPE_CACHE 7
|
||||
// unused in cwr
|
||||
#define ITEM_APPLY_CACHE 3
|
||||
#define ITEM_NANDROID 4
|
||||
#define ITEM_PARTITION 5
|
||||
#define ITEM_ADVANCED 6
|
||||
#define ITEM_POWEROFF 7
|
||||
#define ITEM_APPLY_CACHE 7
|
||||
#define ITEM_POWEROFF 8
|
||||
|
||||
// Header text to display above the main menu.
|
||||
extern char* MENU_HEADERS[];
|
||||
|
Loading…
Reference in New Issue
Block a user