void show_recovery_debugging_menu() { static char* headers[] = { "Recovery Debugging", "", NULL }; static char* list[] = { "Report Error", "Key Test", "Show log", "Toggle UI Debugging", NULL }; for (;;) { int chosen_item = get_menu_selection(headers, list, 0, 0); if(chosen_item == GO_BACK) break; switch(chosen_item) { case 0: handle_failure(1); break; case 1: { ui_print("Outputting key codes.\n"); ui_print("Go back to end debugging.\n"); struct keyStruct{ int code; int x; int y; }*key; int action; do { key = ui_wait_key(); if(key->code == ABS_MT_POSITION_X) { action = device_handle_mouse(key, 1); ui_print("Touch: X: %d\tY: %d\n", key->x, key->y); } else { action = device_handle_key(key->code, 1); ui_print("Key: %x\n", key->code); } } while (action != GO_BACK); break; } case 2: ui_printlogtail(12); break; case 3: toggle_ui_debugging(); break; } } }
void show_advanced_menu() { static char* headers[] = { "Tweaks Menu", "", NULL }; static char* list[] = { "enable yes/no confirmation", "disable yes/no confirmation", "fix permissions", "show log", NULL }; for (;;) { int chosen_item = get_menu_selection(headers, list, 0, 0); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: { ensure_path_mounted("/sdcard"); __system("/sbin/busybox rm /sdcard/clockworkmod/.no_confirm"); ui_print("Yes/No confirmation enabled during install/restore\n"); break; } case 1: { ensure_path_mounted("/sdcard"); __system("/sbin/busybox mkdir -p /sdcard/clockworkmod"); __system("/sbin/busybox touch /sdcard/clockworkmod/.no_confirm"); ui_print("Yes/No confirmation disabled during install/restore\n"); break; } case 2: { ensure_path_mounted("/system"); ensure_path_mounted("/data"); ui_print("Fixing permissions...\n"); __system("fix_permissions"); ui_print("Done!\n"); break; } case 3: ui_printlogtail(12); break; } } }
void show_advanced_menu() { static char* headers[] = { "Advanced Menu", "", NULL }; static char* list[] = { "reboot recovery", "reboot to bootloader", "power off", "wipe dalvik cache", "report error", "key test", "show log", "partition sdcard", "partition external sdcard", "partition internal sdcard", NULL }; char bootloader_mode[PROPERTY_VALUE_MAX]; property_get("ro.bootloader.mode", bootloader_mode, ""); if (!strcmp(bootloader_mode, "download")) { list[1] = "reboot to download mode"; } if (!can_partition("/sdcard")) { list[7] = NULL; } if (!can_partition("/external_sd")) { list[8] = NULL; } if (!can_partition("/emmc")) { list[9] = NULL; } for (;;) { int chosen_item = get_filtered_menu_selection(headers, list, 0, 0, sizeof(list) / sizeof(char*)); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: { ui_print("Rebooting recovery...\n"); reboot_main_system(ANDROID_RB_RESTART2, 0, "recovery"); break; } case 1: { if (!strcmp(bootloader_mode, "download")) { ui_print("Rebooting to download mode...\n"); reboot_main_system(ANDROID_RB_RESTART2, 0, "download"); } else { ui_print("Rebooting to bootloader...\n"); reboot_main_system(ANDROID_RB_RESTART2, 0, "bootloader"); } break; } case 2: { ui_print("Shutting down...\n"); reboot_main_system(ANDROID_RB_POWEROFF, 0, 0); break; } case 3: 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 4: handle_failure(1); break; case 5: { ui_print("Outputting key codes.\n"); ui_print("Go back to end debugging.\n"); int key; int action; do { key = ui_wait_key(); action = device_handle_key(key, 1); ui_print("Key: %d\n", key); } while (action != GO_BACK); break; } case 6: ui_printlogtail(12); break; case 7: partition_sdcard("/sdcard"); break; case 8: partition_sdcard("/external_sd"); break; case 9: partition_sdcard("/emmc"); break; } } }
void show_advanced_menu() { static char* headers[] = { "Advanced and Debugging Menu", "", NULL }; static char* list[] = { "Reboot Recovery", "Wipe Dalvik Cache", "Wipe Battery Stats", "Report Error", "Key Test", "Show log", #ifndef BOARD_HAS_SMALL_RECOVERY "Partition SD Card", "Fix Permissions", #ifdef BOARD_HAS_SDCARD_INTERNAL // "Partition Internal SD Card", #endif #endif NULL }; for (;;) { int chosen_item = get_menu_selection(headers, list, 0, 0); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: { reboot_wrapper("recovery"); break; } case 1: { 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"); } ensure_path_unmounted("/data"); ui_print("Dalvik Cache wiped.\n"); break; } case 2: { if (confirm_selection( "Confirm wipe?", "Yes - Wipe Battery Stats")) wipe_battery_stats(); break; } case 3: handle_failure(1); break; case 4: { ui_print("Outputting key codes.\n"); ui_print("Go back to end debugging.\n"); int key; int action; do { key = ui_wait_key(); action = device_handle_key(key, 1); ui_print("Key: %d\n", key); } while (action != GO_BACK); break; } case 5: { ui_printlogtail(12); break; } case 6: { static char* ext_sizes[] = { "128M", "256M", "512M", "1024M", "2048M", "4096M", NULL }; static char* swap_sizes[] = { "0M", "32M", "64M", "128M", "256M", NULL }; static char* ext_headers[] = { "Ext Size", "", NULL }; static char* swap_headers[] = { "Swap Size", "", NULL }; int ext_size = get_menu_selection(ext_headers, ext_sizes, 0, 0); if (ext_size == GO_BACK) continue; int swap_size = get_menu_selection(swap_headers, swap_sizes, 0, 0); if (swap_size == GO_BACK) continue; char sddevice[256]; #ifdef BOARD_HAS_SDCARD_INTERNAL Volume *vol = volume_for_path("/sdcard-ext"); #else Volume *vol = volume_for_path("/sdcard"); #endif strcpy(sddevice, vol->device); // we only want the mmcblk, not the partition sddevice[strlen("/dev/block/mmcblkX")] = NULL; char cmd[PATH_MAX]; setenv("SDPATH", sddevice, 1); sprintf(cmd, "sdparted -es %s -ss %s -efs ext3 -s", ext_sizes[ext_size], swap_sizes[swap_size]); ui_print("Partitioning SD Card... please wait...\n"); if (0 == __system(cmd)) ui_print("Done!\n"); else ui_print("An error occured while partitioning your SD Card. Please see /tmp/recovery.log for more details.\n"); break; } case 7: { ensure_path_mounted("/system"); ensure_path_mounted("/data"); ui_print("Fixing permissions...\n"); __system("fix_permissions"); ui_print("Done!\n"); break; } case 8: { static char* ext_sizes[] = { "128M", "256M", "512M", "1024M", "2048M", "4096M", NULL }; static char* swap_sizes[] = { "0M", "32M", "64M", "128M", "256M", NULL }; static char* ext_headers[] = { "Data Size", "", NULL }; static char* swap_headers[] = { "Swap Size", "", NULL }; int ext_size = get_menu_selection(ext_headers, ext_sizes, 0, 0); if (ext_size == GO_BACK) continue; int swap_size = 0; if (swap_size == GO_BACK) continue; char sddevice[256]; Volume *vol = volume_for_path("/emmc"); strcpy(sddevice, vol->device); // we only want the mmcblk, not the partition sddevice[strlen("/dev/block/mmcblkX")] = NULL; char cmd[PATH_MAX]; setenv("SDPATH", sddevice, 1); sprintf(cmd, "sdparted -es %s -ss %s -efs ext3 -s", ext_sizes[ext_size], swap_sizes[swap_size]); ui_print("Partitioning Internal SD Card... please wait...\n"); if (0 == __system(cmd)) ui_print("Done!\n"); else ui_print("An error occured while partitioning your Internal SD Card. Please see /tmp/recovery.log for more details.\n"); break; } } } }
void show_advanced_menu() { static char* headers[] = { "Advanced Menu", "", NULL }; static char* list[] = { "reboot recovery", "wipe dalvik cache", "wipe battery stats", "report error", "key test", "show log", "fix permissions", "partition sdcard", "partition external sdcard", "partition internal sdcard", NULL }; if (!can_partition("/sdcard")) { list[7] = NULL; } if (!can_partition("/external_sd")) { list[8] = NULL; } if (!can_partition("/emmc")) { list[9] = NULL; } for (;;) { int chosen_item = get_filtered_menu_selection(headers, list, 0, 0, sizeof(list) / sizeof(char*)); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: android_reboot(ANDROID_RB_RESTART2, 0, "recovery"); break; case 1: 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 2: if (confirm_selection( "Confirm wipe?", "Yes - Wipe Battery Stats")) wipe_battery_stats(); break; case 3: handle_failure(1); break; case 4: { ui_print("Outputting key codes.\n"); ui_print("Go back to end debugging.\n"); int key; int action; do { key = ui_wait_key(); action = device_handle_key(key, 1); ui_print("Key: %d\n", key); } while (action != GO_BACK); break; } case 5: ui_printlogtail(12); break; case 6: ensure_path_mounted("/system"); ensure_path_mounted("/data"); ui_print("Fixing permissions...\n"); __system("fix_permissions"); ui_print("Done!\n"); break; case 7: partition_sdcard("/sdcard"); break; case 8: partition_sdcard("/external_sd"); break; case 9: partition_sdcard("/emmc"); break; } } }
void show_advanced_menu() { static char* headers[] = { "高级设置", "", NULL }; static char* list[] = { "清空Dalvik Cache", "发送错误报告", "按键测试", "显示日志", "对SD卡进行分区", "对外置SD卡进行分区", "对内置SD卡进行分区", NULL }; if (!can_partition("/sdcard")) { list[4] = NULL; } if (!can_partition("/external_sd")) { list[5] = NULL; } if (!can_partition("/emmc")) { list[6] = NULL; } for (;;) { int chosen_item = get_filtered_menu_selection(headers, list, 0, 0, sizeof(list) / sizeof(char*)); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: if (0 != ensure_path_mounted("/data")) break; ensure_path_mounted("/sd-ext"); ensure_path_mounted("/cache"); if (confirm_selection( "确定清空?", "是 - 清空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 已经清空!\n"); } ensure_path_unmounted("/data"); break; case 1: handle_failure(1); break; case 2: { ui_print("正在进行键位测试\n"); ui_print("按返回结束测试.\n"); int key; int action; do { key = ui_wait_key(); action = device_handle_key(key, 1); ui_print("键值: %d\n", key); } while (action != GO_BACK); break; } case 3: ui_printlogtail(12); break; case 4: partition_sdcard("/sdcard"); break; case 5: partition_sdcard("/external_sd"); break; case 6: partition_sdcard("/emmc"); break; } } }