这篇教程C++ ui_text_visible函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ui_text_visible函数的典型用法代码示例。如果您正苦于以下问题:C++ ui_text_visible函数的具体用法?C++ ui_text_visible怎么用?C++ ui_text_visible使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ui_text_visible函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: prompt_and_waitstatic voidprompt_and_wait() { char** headers = prepend_title((const char**)MENU_HEADERS); for (;;) { finish_recovery(NULL); ui_reset_progress(); allow_display_toggle = 1; int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0, 0); allow_display_toggle = 0; // device-specific code may take some action here. It may // return one of the core actions handled in the switch // statement below. chosen_item = device_perform_action(chosen_item); int status; switch (chosen_item) { case ITEM_REBOOT: poweroff=0; return; case ITEM_WIPE_DATA: wipe_data(ui_text_visible()); if (!ui_text_visible()) return; break; case ITEM_WIPE_CACHE: if (confirm_selection("Confirm wipe?", "Yes - Wipe Cache")) { ui_print("/n-- Wiping cache.../n"); erase_volume("/cache"); ui_print("Cache wipe complete./n"); if (!ui_text_visible()) return; } break; case ITEM_APPLY_SDCARD: show_install_update_menu(); break; case ITEM_NANDROID: show_nandroid_menu(); break; case ITEM_PARTITION: show_partition_menu(); break; case ITEM_ADVANCED: show_advanced_menu(); break; case ITEM_POWEROFF: poweroff = 1; return; } }}
开发者ID:Racing1,项目名称:android_bootable_touch_recovery,代码行数:60,
示例2: prompt_and_waitstatic voidprompt_and_wait() { char** headers = prepend_title(MENU_HEADERS); for (;;) { finish_recovery(NULL); ui_reset_progress(); ui_set_background(BACKGROUND_ICON_ERROR); int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0); // device-specific code may take some action here. It may // return one of the core actions handled in the switch // statement below. chosen_item = device_perform_action(chosen_item); switch (chosen_item) { case ITEM_REBOOT: return; case ITEM_APPLY_SDCARD: show_install_update_menu(); /* ui_print("/n-- Install from sdcard.../n"); set_sdcard_update_bootloader_message(); int status = install_package(SDCARD_PACKAGE_FILE); if (status != INSTALL_SUCCESS) { ui_set_background(BACKGROUND_ICON_ERROR); ui_print("Installation aborted./n"); } else if (!ui_text_visible()) { return; // reboot if logs aren't visible } else { ui_print("/nInstall from sdcard complete./n"); } */ break; case ITEM_WIPE_DATA: wipe_data(ui_text_visible()); if (!ui_text_visible()) return; break; case ITEM_WIPE_CACHE: ui_print("/n-- Wiping cache.../n"); erase_root("CACHE:"); ui_print("Cache wipe complete./n"); if (!ui_text_visible()) return; break; case ITEM_ADVANCED: show_advanced_menu(); break; } }}
开发者ID:35mmslr,项目名称:Dell-Streak-Recovery,代码行数:56,
示例3: prompt_and_waitvoidprompt_and_wait() { char** headers = prepend_title((const char**)MENU_HEADERS); for (;;) { finish_recovery(NULL); ui_reset_progress(); int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0, 0); // device-specific code may take some action here. It may // return one of the core actions handled in the switch // statement below. chosen_item = device_perform_action(chosen_item); switch (chosen_item) { case ITEM_REBOOT: return; case ITEM_WIPE_DATA: wipe_data(ui_text_visible()); if (!ui_text_visible()) return; break; case ITEM_WIPE_CACHE: printf("/n-- Wiping cache.../n"); erase_volume("/cache"); printf("Cache wipe complete./n"); if (!ui_text_visible()) return; break; case ITEM_APPLY_SDCARD: ; int status = sdcard_directory(SDCARD_ROOT); if (status >= 0) { if (status != INSTALL_SUCCESS) { ui_set_background(BACKGROUND_ICON_ERROR); printf("Installation aborted./n"); } else if (!ui_text_visible()) { return; // reboot if logs aren't visible } else { printf("/nInstall from sdcard complete./n"); } } break; } }}
开发者ID:xwliu,项目名称:open-ivi.MX53,代码行数:48,
示例4: install_update_zipint install_update_zip(char* filename) { char *path = NULL; puts(filename); path = replace_str(filename, "/sdcard/", "SDCARD:"); ui_print("/n-- Install update.zip from sdcard.../n"); set_sdcard_update_bootloader_message(); ui_print("Attempting update from.../n"); ui_print(filename); ui_print("/n"); int status = install_package(path); if (status != INSTALL_SUCCESS) { ui_set_background(BACKGROUND_ICON_ERROR); ui_print("Installation aborted./n"); return 0; } else if (!ui_text_visible()) { return 0; // reboot if logs aren't visible } else { if (firmware_update_pending()) { ui_print("/nReboot via menu to complete/ninstallation./n"); return 0; } else { ui_print("/nInstall from sdcard complete./n"); ui_print("/nThanks for using RZrecovery./n"); } } return 0;}
开发者ID:Jewremy,项目名称:RZrecovery,代码行数:29,
示例5: show_options_menuvoid show_options_menu(){ static char* headers[] = { "Extras", "or press DEL or POWER to return", "", NULL }; char* items[] = { "Custom Colors", "Disable OTA Update Downloads in ROM", "Show Battery Status", "Toggle Flashlight", "Activate Root Access in ROM", "Recovery Overclocking", "Toggle keyboard light", NULL }; #define COLORS 0#define OTA 1#define BATT 2#define FLASHLIGHT 3#define ROOT_MENU 4#define OVERCLOCK 5#define KEYLIGHT 6int chosen_item = -1; while(chosen_item!=ITEM_BACK) { chosen_item = get_menu_selection(headers,items,1,chosen_item<0?0:chosen_item); switch (chosen_item) { case COLORS: show_colors_menu(); return; case OTA: disable_OTA(); break; case BATT: show_battstat(); break; case FLASHLIGHT: flashlight(); break; case ROOT_MENU: root_menu(ui_text_visible()); break; case OVERCLOCK: show_overclock_menu(); break; case KEYLIGHT: keylight(); break; } }}
开发者ID:Jewremy,项目名称:RZrecovery,代码行数:55,
示例6: prompt_and_waitstatic voidprompt_and_wait(){ ui_print("/n" "Home+Back - reboot system now/n" "Alt+L - toggle log text display/n" "Alt+S - apply sdcard:update.zip/n" "Alt+W - wipe data/factory reset/n"); for (;;) { finish_recovery(NULL); ui_reset_progress(); int key = ui_wait_key(); int alt = ui_key_pressed(KEY_LEFTALT) || ui_key_pressed(KEY_RIGHTALT); if (key == KEY_DREAM_BACK && ui_key_pressed(KEY_DREAM_HOME)) { // Wait for the keys to be released, to avoid triggering // special boot modes (like coming back into recovery!). while (ui_key_pressed(KEY_DREAM_BACK) || ui_key_pressed(KEY_DREAM_HOME)) { usleep(1000); } break; } else if (alt && key == KEY_W) { ui_print("/n"); erase_root("DATA:"); erase_root("CACHE:"); ui_print("Data wipe complete./n"); if (!ui_text_visible()) break; } else if (alt && key == KEY_S) { ui_print("/nInstalling from sdcard.../n"); int status = install_package(SDCARD_PACKAGE_FILE); if (status != INSTALL_SUCCESS) { ui_set_background(BACKGROUND_ICON_ERROR); ui_print("Installation aborted./n"); } else if (!ui_text_visible()) { break; // reboot if logs aren't visible } ui_print("/nPress Home+Back to reboot/n"); } }}
开发者ID:Jib-BAOSP,项目名称:platform_recovery,代码行数:42,
示例7: get_menu_selectionstatic intget_menu_selection(char** headers, char** items, int menu_only, int initial_selection) { // throw away keys pressed previously, so user doesn't // accidentally trigger menu items. ui_clear_key_queue(); ui_start_menu(headers, items, initial_selection); int selected = initial_selection; int chosen_item = -1; while (chosen_item < 0) { int key = ui_wait_key(); int visible = ui_text_visible(); if (key == -1) { // ui_wait_key() timed out if (ui_text_ever_visible()) { continue; } else { LOGI("timed out waiting for key input; rebooting./n"); ui_end_menu(); return ITEM_REBOOT; } } int action = device_handle_key(key, visible); if (action < 0) { switch (action) { case HIGHLIGHT_UP: --selected; selected = ui_menu_select(selected); break; case HIGHLIGHT_DOWN: ++selected; selected = ui_menu_select(selected); break; case SELECT_ITEM: chosen_item = selected; break; case NO_ACTION: break; } } else if (!menu_only) { chosen_item = action; } } ui_end_menu(); return chosen_item;}
开发者ID:ebmajor,项目名称:msm7627a_2038_recovery,代码行数:51,
示例8: get_menu_selectionint get_menu_selection(char** headers, char** items, int menu_only, int selected) { // throw away keys pressed previously, so user doesn't // accidentally trigger menu items. ui_clear_key_queue(); ui_start_menu(headers, items,selected); int chosen_item = -1; while (chosen_item < 0) { int key = ui_wait_key(); /* char* key_str = calloc(18,sizeof(char)); sprintf(key_str, "Key %d pressed./n", key); ui_print(key_str);*/ if (key == KEY_BACKSPACE || key == KEY_END) { return(ITEM_BACK); } int visible = ui_text_visible(); int action = device_handle_key(key, visible); if (action < 0) { switch (action) { case ITEM_BACK: return(ITEM_BACK); break; case HIGHLIGHT_UP: --selected; selected = ui_menu_select(selected); break; case HIGHLIGHT_DOWN: ++selected; selected = ui_menu_select(selected); break; case SELECT_ITEM: chosen_item = selected; break; case NO_ACTION: break; } } else if (!menu_only) { chosen_item = action; } } ui_end_menu(); return chosen_item;}
开发者ID:cvpcs,项目名称:android_bootable_recovery,代码行数:50,
示例9: erase_cachevoid erase_cache(int orscallback) { if(orscallback) { if(orswipeprompt && !confirm_selection("Confirm wipe?","Yes - Wipe Cache")) { ui_print("Skipping cache wipe.../n"); return; } } else if (!confirm_selection("Confirm wipe?","Yes - Wipe Cache")) { return; } ui_print("/n-- Wiping cache.../n"); erase_volume("/cache"); ui_print("%s/n", cachewipecomplete); if (!ui_text_visible()) return; return;}
开发者ID:fjy2003,项目名称:COT_bootable_recovery_touch,代码行数:15,
示例10: wipe_allvoid wipe_all(int orscallback) { if(orscallback) { if(orswipeprompt && !confirm_selection("Confirm wipe all?","Yes - Wipe All")) { ui_print("Skipping full wipe.../n"); return; } } else if (!confirm_selection("Confirm wipe all?", "Yes - Wipe All")) { return; } ui_print("/n-- Wiping system, data, cache.../n"); erase_volume("/system"); erase_volume("/data"); erase_volume("/cache"); ui_print("/nFull wipe complete!/n"); if (!ui_text_visible()) return; return;}
开发者ID:fjy2003,项目名称:COT_bootable_recovery_touch,代码行数:17,
示例11: get_menu_selectionint get_menu_selection(char** headers, char** items, int menu_only) { // throw away keys pressed previously, so user doesn't // accidentally trigger menu items. ui_clear_key_queue(); ui_start_menu(headers, items); int selected = 0; int chosen_item = -1; while (chosen_item < 0) { int key = ui_wait_key(); int visible = ui_text_visible(); int action = device_handle_key(key, visible); if (action < 0) { switch (action) { case HIGHLIGHT_UP: --selected; selected = ui_menu_select(selected); break; case HIGHLIGHT_DOWN: ++selected; selected = ui_menu_select(selected); break; case SELECT_ITEM: chosen_item = selected; break; case NO_ACTION: break; } if(action == SELECT_BACK) { chosen_item = action; break; } } else if (!menu_only) { chosen_item = action; } } ui_end_menu(); return chosen_item;}
开发者ID:CMODROM,项目名称:android_recovery_with_chinese,代码行数:44,
示例12: preinstall_menuvoid preinstall_menu(char* filename) { char* basename = strrchr(filename, '/') +1; char install_string[PATH_MAX]; strcpy(install_string, "Install "); strcat(install_string, basename); char* headers[] = { "Preinstall Menu", "Please make your selections.", " ", NULL }; char* items[] = { "Abort Install", "Backup Before Install", "Wipe /data", install_string, NULL };#define ITEM_NO 0#define ITEM_BACKUP 1#define ITEM_WIPE 2#define ITEM_INSTALL 3 int chosen_item = -1; while (chosen_item != ITEM_BACK) { chosen_item = get_menu_selection(headers,items,1,chosen_item<0?0:chosen_item); switch(chosen_item) { case ITEM_NO: chosen_item = ITEM_BACK; return; case ITEM_BACKUP: ui_print("Backing up before installing.../n"); nandroid_backup("preinstall",BSDA|PROGRESS); break; case ITEM_WIPE: wipe_partition(ui_text_visible(), "Are you sure?", "Yes - wipe DATA", "data"); break; case ITEM_INSTALL: install_update_package(filename); return; } }}
开发者ID:Jewremy,项目名称:RZrecovery,代码行数:42,
示例13: main//.........这里部分代码省略......... property_list(print_property, NULL); printf("/n"); int status = INSTALL_SUCCESS; if (toggle_secure_fs) { if (strcmp(encrypted_fs_mode,"on") == 0) { encrypted_fs_data.mode = MODE_ENCRYPTED_FS_ENABLED; ui_print("Enabling Encrypted FS./n"); } else if (strcmp(encrypted_fs_mode,"off") == 0) { encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; ui_print("Disabling Encrypted FS./n"); } else { ui_print("Error: invalid Encrypted FS setting./n"); status = INSTALL_ERROR; } // Recovery strategy: if the data partition is damaged, disable encrypted file systems. // This preventsthe device recycling endlessly in recovery mode. if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && (read_encrypted_fs_info(&encrypted_fs_data))) { ui_print("Encrypted FS change aborted, resetting to disabled state./n"); encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; } if (status != INSTALL_ERROR) { if (erase_volume("/data")) { ui_print("Data wipe failed./n"); status = INSTALL_ERROR; } else if (erase_volume("/cache")) { ui_print("Cache wipe failed./n"); status = INSTALL_ERROR; } else if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && (restore_encrypted_fs_info(&encrypted_fs_data))) { ui_print("Encrypted FS change aborted./n"); status = INSTALL_ERROR; } else { ui_print("Successfully updated Encrypted FS./n"); status = INSTALL_SUCCESS; } } } else if (update_package != NULL) { status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("Installation aborted./n"); } else if (wipe_data) { if (device_wipe_data()) status = INSTALL_ERROR; if (erase_volume("/data")) status = INSTALL_ERROR; if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed./n"); } else if (wipe_cache) { if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed./n"); } else { 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 signature_check_enabled = 0; script_assert_enabled = 0; is_user_initiated_recovery = 1; ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_CLOCKWORK); if (extendedcommand_file_exists()) { LOGI("Running extendedcommand.../n"); int ret; if (0 == (ret = run_and_remove_extendedcommand())) { status = INSTALL_SUCCESS; ui_set_show_text(0); } else { handle_failure(ret); } } else { LOGI("Skipping execution of extendedcommand, file not found.../n"); } } if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) { ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_ERROR); } if (status != INSTALL_SUCCESS || ui_text_visible()) { prompt_and_wait(); } // If there is a radio image pending, reboot now to install it. maybe_install_firmware_update(send_intent); // Otherwise, get ready to boot the main system... finish_recovery(send_intent); if(!poweroff) ui_print("Rebooting.../n"); else ui_print("Shutting down.../n"); sync(); reboot((!poweroff) ? RB_AUTOBOOT : RB_POWER_OFF); return EXIT_SUCCESS;}
开发者ID:MiniCM4BCM21553,项目名称:BlackReactorRecovery,代码行数:101,
示例14: prompt_and_waitstatic voidprompt_and_wait() { char** headers = prepend_title((const char**)MENU_HEADERS); for (;;) { finish_recovery(NULL); ui_reset_progress(); allow_display_toggle = 1; int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0, 0); allow_display_toggle = 0; // device-specific code may take some action here. It may // return one of the core actions handled in the switch // statement below. chosen_item = device_perform_action(chosen_item); switch (chosen_item) { case ITEM_REBOOT: poweroff=0; return; case ITEM_WIPE_DATA: wipe_data(ui_text_visible()); if (!ui_text_visible()) return; break; case ITEM_WIPE_CACHE: if (confirm_selection("Confirm wipe?", "Yes - Wipe Cache")) { ui_print("/n-- Wiping cache.../n"); erase_volume("/cache"); ui_print("Cache wipe complete./n"); if (!ui_text_visible()) return; } break; case ITEM_APPLY_SDCARD: if (confirm_selection("Confirm install?", "Yes - Install /sdcard/update.zip")) { ui_print("/n-- Install from sdcard.../n"); int status = install_package(SDCARD_PACKAGE_FILE); if (status != INSTALL_SUCCESS) { ui_set_background(BACKGROUND_ICON_ERROR); ui_print("Installation aborted./n"); } else if (!ui_text_visible()) { return; // reboot if logs aren't visible } else { ui_print("/nInstall from sdcard complete./n"); } } break; case ITEM_INSTALL_ZIP: show_install_update_menu(); break; case ITEM_NANDROID: show_nandroid_menu(); break; case ITEM_PARTITION: show_partition_menu(); break; case ITEM_ADVANCED: show_advanced_menu(); break; case ITEM_POWEROFF: poweroff=1; return; } }}
开发者ID:MiniCM4BCM21553,项目名称:BlackReactorRecovery,代码行数:70,
示例15: prompt_and_waitstatic voidprompt_and_wait() { char** headers = prepend_title((const char**)MENU_HEADERS); for (;;) { finish_recovery(NULL); ui_reset_progress(); ui_root_menu = 1; // ui_menu_level is a legacy variable that i am keeping around to prevent build breakage. ui_menu_level = 0; // allow_display_toggle = 1; int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0, 0); ui_menu_level = 1; ui_root_menu = 0; // allow_display_toggle = 0; // device-specific code may take some action here. It may // return one of the core actions handled in the switch // statement below. chosen_item = device_perform_action(chosen_item); int status; switch (chosen_item) { case ITEM_REBOOT: poweroff=0; return; case ITEM_WIPE_DATA: wipe_data(ui_text_visible()); if (!ui_text_visible()) return; break; case ITEM_WIPE_CACHE: if (confirm_selection("确认清空?", "是 - 清空CACHE分区")) { ui_print("/n-- 正在清空CACHE分区.../n"); erase_volume("/cache"); ui_print("CACHE分区已清空./n"); if (!ui_text_visible()) return; } break; case ITEM_APPLY_ZIP: show_install_update_menu(); break; case ITEM_NANDROID: show_nandroid_menu(); break; case ITEM_PARTITION: show_partition_menu(); break; case ITEM_ADVANCED: show_advanced_menu(); break; case ITEM_POWEROFF: poweroff = 1; return; } }}
开发者ID:jm199011,项目名称:cwm_rec_6.0.3.3_cn,代码行数:65,
示例16: get_menu_selectionintget_menu_selection(char** headers, char** items, int menu_only, int initial_selection) { // throw away keys pressed previously, so user doesn't // accidentally trigger menu items. ui_clear_key_queue(); int item_count = ui_start_menu(headers, items, initial_selection); int selected = initial_selection; int chosen_item = -1; // Some users with dead enter keys need a way to turn on power to select. // Jiggering across the wrapping menu is one "secret" way to enable it. // We can't rely on /cache or /sdcard since they may not be available. int wrap_count = 0; while (chosen_item < 0 && chosen_item != GO_BACK) { struct keyStruct *key; key = ui_wait_key(); int visible = ui_text_visible(); int action; if(key->code == ABS_MT_POSITION_X) action = device_handle_mouse(key, visible); else action = device_handle_key(key->code, visible); int old_selected = selected; if (action < 0) { switch (action) { case HIGHLIGHT_UP: --selected; selected = ui_menu_select(selected); break; case HIGHLIGHT_DOWN: ++selected; selected = ui_menu_select(selected); break; case SELECT_ITEM: chosen_item = selected; if (ui_get_showing_back_button()) { if (chosen_item == item_count) { chosen_item = GO_BACK; } } break; case NO_ACTION: break; case GO_BACK: chosen_item = GO_BACK; break; } } else if (!menu_only) { chosen_item = action; } if (abs(selected - old_selected) > 1) { wrap_count++; if (wrap_count == 3) { wrap_count = 0; if (ui_get_showing_back_button()) { ui_print("Back menu button disabled./n"); ui_set_showing_back_button(0); } else { ui_print("Back menu button enabled./n"); ui_set_showing_back_button(1); } } } } ui_end_menu(); ui_clear_key_queue(); return chosen_item;}
开发者ID:apeelme,项目名称:android_bootable_recovery,代码行数:78,
示例17: main//.........这里部分代码省略......... strlcat(modified_path, update_package+6, len); printf("(replacing path /"%s/" with /"%s/")/n", update_package, modified_path); update_package = modified_path; } } printf("/n"); property_list(print_property, NULL); printf("/n"); int status = INSTALL_SUCCESS; if (update_package != NULL) { status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("安装终止./n"); } else if (wipe_data) { if (device_wipe_data()) status = INSTALL_ERROR; ignore_data_media_workaround(1); if (erase_volume("/data")) status = INSTALL_ERROR; ignore_data_media_workaround(0); if (has_datadata() && erase_volume("/datadata")) status = INSTALL_ERROR; if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("清除数据失败./n"); } else if (wipe_cache) { if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("清除缓存失败./n"); } else if (sideload) { signature_check_enabled = 0;// if (!headless) ui_set_show_text(1); if (0 == apply_from_adb()) { status = INSTALL_SUCCESS; ui_set_show_text(0); } } else { 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 signature_check_enabled = 0; script_assert_enabled = 0; is_user_initiated_recovery = 1;// if (!headless) { ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_CLOCKWORK);// } if (extendedcommand_file_exists()) { LOGI("Running extendedcommand.../n"); int ret; if (0 == (ret = run_and_remove_extendedcommand())) { status = INSTALL_SUCCESS; ui_set_show_text(0); } else { handle_failure(ret); } } else { LOGI("Skipping execution of extendedcommand, file not found.../n"); } } setup_adbd();/* if (headless) { headless_wait(); } */ if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) { ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_ERROR); }// else if (status != INSTALL_SUCCESS || ui_text_visible()) { if (status != INSTALL_SUCCESS || ui_text_visible()) { prompt_and_wait(); } verify_root_and_recovery(); // If there is a radio image pending, reboot now to install it. maybe_install_firmware_update(send_intent); // Otherwise, get ready to boot the main system... finish_recovery(send_intent); sync(); if(!poweroff) { ui_print("正在重启.../n"); android_reboot(ANDROID_RB_RESTART, 0, 0); } else { ui_print("正在关机.../n"); android_reboot(ANDROID_RB_POWEROFF, 0, 0); } return EXIT_SUCCESS;}#ifdef RECOVERY_CHARGEMODE return 0;}
开发者ID:KingRan,项目名称:CWM_Recovery_v6037_cn,代码行数:101,
示例18: mainintmain(int argc, char **argv) { time_t start = time(NULL); // If these fail, there's not really anywhere to complain... freopen(TEMPORARY_LOG_FILE, "a", stdout); setbuf(stdout, NULL); freopen(TEMPORARY_LOG_FILE, "a", stderr); setbuf(stderr, NULL); printf("Starting recovery on %s", ctime(&start)); device_ui_init(&ui_parameters); ui_init(); ui_set_background(BACKGROUND_ICON_INSTALLING); load_volume_table(); get_args(&argc, &argv); int previous_runs = 0; const char *send_intent = NULL; const char *update_package = NULL; int wipe_data = 0, wipe_cache = 0; //check delta update first handle_deltaupdate_status(); int arg; while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) { switch (arg) { case 'p': previous_runs = atoi(optarg); break; case 's': send_intent = optarg; break; case 'u': update_package = optarg; break; case 'w': wipe_data = wipe_cache = 1; break; case 'c': wipe_cache = 1; break; case 't': ui_show_text(1); break; case '?': LOGE("Invalid command argument/n"); continue; } } device_recovery_start(); printf("Command:"); for (arg = 0; arg < argc; arg++) { printf(" /"%s/"", argv[arg]); } printf("/n"); if (update_package) { // For backwards compatibility on the cache partition only, if // we're given an old 'root' path "CACHE:foo", change it to // "/cache/foo". if (strncmp(update_package, "CACHE:", 6) == 0) { int len = strlen(update_package) + 10; char* modified_path = malloc(len); strlcpy(modified_path, "/cache/", len); strlcat(modified_path, update_package+6, len); printf("(replacing path /"%s/" with /"%s/")/n", update_package, modified_path); update_package = modified_path; } } printf("/n"); property_list(print_property, NULL); printf("/n"); int status = INSTALL_SUCCESS; if (update_package != NULL) { status = install_package(update_package, &wipe_cache, TEMPORARY_INSTALL_FILE); if (status == INSTALL_SUCCESS && wipe_cache) { if (erase_volume("/cache")) { LOGE("Cache wipe (requested by package) failed."); } } if (status != INSTALL_SUCCESS) ui_print("Installation aborted./n"); } else if (wipe_data) { if (device_wipe_data()) status = INSTALL_ERROR; if (erase_volume("/data")) status = INSTALL_ERROR; if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed./n"); } else if (wipe_cache) { if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed./n"); } else { status = INSTALL_ERROR; // No command specified } if (status != INSTALL_SUCCESS) ui_set_background(BACKGROUND_ICON_ERROR); if (status != INSTALL_SUCCESS || ui_text_visible()) { prompt_and_wait(); } // Otherwise, get ready to boot the main system... finish_recovery(send_intent); ui_print("Rebooting.../n"); android_reboot(ANDROID_RB_RESTART, 0, 0); return EXIT_SUCCESS;}
开发者ID:ebmajor,项目名称:msm7627a_2038_recovery,代码行数:98,
示例19: prompt_and_waitstatic intprompt_and_wait() { char** headers = prepend_title((const char**)MENU_HEADERS); for (;;) { finish_recovery(NULL); ui_reset_progress(); int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0, 0); // device-specific code may take some action here. It may // return one of the core actions handled in the switch // statement below. chosen_item = device_perform_action(chosen_item); int status; int wipe_cache; switch (chosen_item) { case ITEM_REBOOT: return REBOOT_NORMAL;#ifdef RECOVERY_HAS_FACTORY_TEST case ITEM_FACTORY_TEST: return REBOOT_FACTORY_TEST;#endif case ITEM_WIPE_DATA: wipe_data(ui_text_visible()); if (!ui_text_visible()) return REBOOT_NORMAL; break; case ITEM_WIPE_CACHE: ui_print("/n-- Wiping cache.../n"); erase_volume("/cache"); ui_print("Cache wipe complete./n"); if (!ui_text_visible()) return REBOOT_NORMAL; break;#ifdef RECOVERY_HAS_MEDIA case ITEM_WIPE_MEDIA: wipe_media(ui_text_visible()); if (!ui_text_visible()) return REBOOT_NORMAL; break;#endif /* RECOVERY_HAS_MEDIA */ case ITEM_APPLY_SDCARD:#ifdef RECOVERY_HAS_SDCARD_ONLY status = update_directory(SDCARD_ROOT, SDCARD_ROOT, &wipe_cache);#else status = update_directory("/", "/", &wipe_cache);#endif /* RECOVERY_HAS_SDCARD_ONLY */ if (status == INSTALL_SUCCESS && wipe_cache) { ui_print("/n-- Wiping cache (at package request).../n"); if (erase_volume("/cache")) { ui_print("Cache wipe failed./n"); } else { ui_print("Cache wipe complete./n"); } } if (status >= 0) { if (status != INSTALL_SUCCESS) { ui_set_background(BACKGROUND_ICON_ERROR); ui_print("Installation aborted./n"); } else if (!ui_text_visible()) { return REBOOT_NORMAL; // reboot if logs aren't visible } else {#ifdef RECOVERY_HAS_SDCARD_ONLY ui_print("/nInstall from sdcard complete./n");#else ui_print("/nInstall complete./n");#endif /* RECOVERY_HAS_SDCARD_ONLY */ } } break; case ITEM_APPLY_CACHE: // Don't unmount cache at the end of this. status = update_directory(CACHE_ROOT, NULL, &wipe_cache); if (status == INSTALL_SUCCESS && wipe_cache) { ui_print("/n-- Wiping cache (at package request).../n"); if (erase_volume("/cache")) { ui_print("Cache wipe failed./n"); } else { ui_print("Cache wipe complete./n"); } } if (status >= 0) { if (status != INSTALL_SUCCESS) { ui_set_background(BACKGROUND_ICON_ERROR); ui_print("Installation aborted./n"); } else if (!ui_text_visible()) { return REBOOT_NORMAL; // reboot if logs aren't visible } else { ui_print("/nInstall from cache complete./n"); } } break;#ifdef RECOVERY_HAS_EFUSE case ITEM_WRITE_EFUSE: recovery_efuse(-1, NULL); if (!ui_text_visible()) return REBOOT_NORMAL;//.........这里部分代码省略.........
开发者ID:fards,项目名称:ainol_elfii_bootable,代码行数:101,
示例20: main//.........这里部分代码省略......... } } if (wipe_cache) { if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) { ui_print("Cache wipe failed./n"); goto process_failed; } } #ifdef RECOVERY_HAS_MEDIA if (wipe_media) { if (wipe_media && erase_volume(MEDIA_ROOT)) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) { ui_print("Media wipe failed./n"); goto process_failed; } } #endif /* RECOVERY_HAS_MEDIA */ // else {// status = INSTALL_ERROR; // No command specified// } //add ainuo if (copy_custom_files_dir != NULL) { status = copy_custom_files(MEDIA_ROOT, copy_custom_files_dir); if (status != INSTALL_SUCCESS) ui_print("Copy custom files failed./n"); }#ifdef RECOVERY_HAS_EFUSE if (set_efuse_version) { status = recovery_efuse(EFUSE_VERSION, efuse_version); if (status != INSTALL_SUCCESS) { ui_print("efuse write version failed./n"); goto process_failed; } }#ifdef EFUSE_LICENCE_ENABLE if (set_efuse_audio_license) { status = recovery_efuse(EFUSE_LICENCE, NULL); if (status != INSTALL_SUCCESS) { ui_print("efuse write licence failed./n"); goto process_failed; } }#endif /* EFUSE_LICENCE_ENABLE */ if (set_efuse_ethernet_mac) { status = recovery_efuse(EFUSE_MAC, NULL); if (status != INSTALL_SUCCESS) { ui_print("efuse write MAC addr failed./n"); goto process_failed; } } if (set_efuse_bluetooth_mac) { status = recovery_efuse(EFUSE_MAC_BT, NULL); if (status != INSTALL_SUCCESS) { ui_print("efuse write BT MAC failed./n"); goto process_failed; } } if (set_efuse_machine_id) { /* add for m6 */ status = recovery_efuse(EFUSE_MACHINEID, efuse_machine); } #endif /* RECOVERY_HAS_EFUSE */ int howReboot;process_failed: if (status != INSTALL_SUCCESS) ui_set_background(BACKGROUND_ICON_ERROR); if (status != INSTALL_SUCCESS || ui_text_visible()) { ui_show_text(1); howReboot = prompt_and_wait(); if (REBOOT_FACTORY_TEST == howReboot) reboot_to_factorymode = 1; } // Otherwise, get ready to boot the main system... finish_recovery(send_intent); ui_print("Rebooting.../n"); sync(); if (reboot_to_factorymode) { property_set("androidboot.mode", "factorytest"); android_reboot(ANDROID_RB_RESTART, 0, "factory_testl_reboot"); } else { android_reboot(ANDROID_RB_RESTART, 0, 0); } return EXIT_SUCCESS;}
开发者ID:fards,项目名称:ainol_elfii_bootable,代码行数:101,
示例21: main//.........这里部分代码省略......... freopen(TEMPORARY_LOG_FILE, "a", stderr); setbuf(stderr, NULL); fprintf(stderr, "Starting recovery on %s", ctime(&start)); ui_init(); ui_print(EXPAND(RECOVERY_VERSION)"/n");#ifdef BOARD_GOAPK_DEFY ui_print(EXPAND(RECOVERY_VERSION_GOAPK)"/n"); ui_print(EXPAND(RECOVERY_VERSION_QUN)"/n");#endif get_args(&argc, &argv); int previous_runs = 0; const char *send_intent = NULL; const char *update_package = NULL; int wipe_data = 0, wipe_cache = 0; int arg; while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) { switch (arg) { case 'p': previous_runs = atoi(optarg); break; case 's': send_intent = optarg; break; case 'u': update_package = optarg; break; case 'w': wipe_data = wipe_cache = 1; break; case 'c': wipe_cache = 1; break; case '?': LOGE("Invalid command argument/n"); continue; } } device_recovery_start(); fprintf(stderr, "Command:"); for (arg = 0; arg < argc; arg++) { fprintf(stderr, " /"%s/"", argv[arg]); } fprintf(stderr, "/n/n"); property_list(print_property, NULL); fprintf(stderr, "/n"); int status = INSTALL_SUCCESS; RecoveryCommandContext ctx = { NULL }; if (register_update_commands(&ctx)) { LOGE("Can't install update commands/n"); } if (update_package != NULL) { if (wipe_data && erase_root("DATA:")) status = INSTALL_ERROR; status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("Installation aborted./n"); } else if (wipe_data) { if (device_wipe_data()) status = INSTALL_ERROR; if (erase_root("DATA:")) status = INSTALL_ERROR; if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed./n"); } else if (wipe_cache) { if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed./n"); } else { 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 signature_check_enabled = 0; script_assert_enabled = 0; is_user_initiated_recovery = 1; ui_set_show_text(1); if (extendedcommand_file_exists()) { LOGI("Running extendedcommand.../n"); int ret; if (0 == (ret = run_and_remove_extendedcommand())) { status = INSTALL_SUCCESS; ui_set_show_text(0); } else { handle_failure(ret); } } else { LOGI("Skipping execution of extendedcommand, file not found.../n"); } } if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) ui_set_background(BACKGROUND_ICON_ERROR); if (status != INSTALL_SUCCESS || ui_text_visible()) prompt_and_wait();#ifndef BOARD_HAS_NO_MISC_PARTITION // If there is a radio image pending, reboot now to install it. maybe_install_firmware_update(send_intent);#endif // Otherwise, get ready to boot the main system... finish_recovery(send_intent); ui_print("Rebooting.../n"); sync(); reboot(RB_AUTOBOOT); return EXIT_SUCCESS;}
开发者ID:bandroidx,项目名称:bravo_recovery,代码行数:101,
示例22: show_wipe_menuvoid show_wipe_menu(){static char* headers[] = { "Wipe Menu", "", NULL }; static char* list[] = { "~~~> Go Back <~~~", "Data / Factory Reset", "Cache", "Wipe Dalvik Cache", "Wipe Battery Stats", NULL};for (;;) { int chosen_item = get_menu_selection(headers, list, 0); if (chosen_item == GO_BACK) break; switch (chosen_item) { case 0: { return; break; } case 1: { wipe_data1(ui_text_visible()); if (!ui_text_visible()) return; break; } case 2: { if (confirm_selection("Confirm wipe?", "Yes - Wipe Cache")) { ui_print("/n-- Wiping cache.../n"); erase_root1("CACHE:"); ui_print("Cache wipe complete./n"); if (!ui_text_visible()) return; } break; } case 3: { if (0 != ensure_root_path_mounted("DATA:")) break; ensure_root_path_mounted("SDEXT:"); ensure_root_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_root_path_unmounted("DATA:"); ui_print("Dalvik Cache wiped./n"); break; } case 4: { if (confirm_selection( "Confirm wipe?", "Yes - Wipe Battery Stats")) wipe_battery_stats(); break; } } }}
开发者ID:Fengyuan,项目名称:G3MOD,代码行数:69,
示例23: get_menu_selectionintget_menu_selection(char** headers, char** items, int menu_only, int initial_selection) { // throw away keys pressed previously, so user doesn't // accidentally trigger menu items. ui_clear_key_queue(); int item_count = ui_start_menu(headers, items, initial_selection); int selected = initial_selection; int chosen_item = -1; // Some users with dead enter keys need a way to turn on power to select. // Jiggering across the wrapping menu is one "secret" way to enable it. // We can't rely on /cache or /sdcard since they may not be available. int wrap_count = 0; while (chosen_item < 0 && chosen_item != GO_BACK) { int key = ui_wait_key(); int visible = ui_text_visible(); if (key == -1) { // ui_wait_key() timed out if (ui_text_ever_visible()) { continue; } else { LOGI("timed out waiting for key input; rebooting./n"); ui_end_menu(); return ITEM_REBOOT; } } int action = ui_handle_key(key, visible); int old_selected = selected; selected = ui_get_selected_item(); if (action < 0) { switch (action) { case HIGHLIGHT_UP: --selected; selected = ui_menu_select(selected); break; case HIGHLIGHT_DOWN: ++selected; selected = ui_menu_select(selected); break; case SELECT_ITEM: chosen_item = selected; if (ui_is_showing_back_button()) { if (chosen_item == item_count) { chosen_item = GO_BACK; } } break; case NO_ACTION: break; case GO_BACK: chosen_item = GO_BACK; break; } } else if (!menu_only) { chosen_item = action; } } ui_end_menu(); ui_clear_key_queue(); return chosen_item;}
开发者ID:xiangxin19960319,项目名称:android_bootable_recovery_cn_ics,代码行数:68,
示例24: get_menu_selectionint get_menu_selection(char** headers, char** items, int menu_only, int initial_selection) { // throw away keys pressed previously, so user doesn't // accidentally trigger menu items. ui_clear_key_queue(); ui_start_menu(headers, items, initial_selection); int selected = initial_selection; int chosen_item = -1; while (chosen_item < 0) { int key = ui_wait_key(); int visible = ui_text_visible(); int action = device_handle_key(key, visible); if (action < 0) { switch (action) { case HIGHLIGHT_UP: --selected; selected = ui_menu_select(selected); break; case HIGHLIGHT_DOWN: ++selected; selected = ui_menu_select(selected); break; case KEY_POWER: case SELECT_ITEM: chosen_item = selected; break; case UP_A_LEVEL: if (menu_loc_idx != 0) { chosen_item = menu_loc[menu_loc_idx]; } break; case HOME_MENU: if (menu_loc_idx != 0) { go_home = 1; chosen_item = menu_loc[menu_loc_idx]; } break; case MENU_MENU: if (menu_loc_idx == 0) { return 3; } else { go_home = 1; go_menu = 1; chosen_item = menu_loc[menu_loc_idx]; } break; case NO_ACTION: break; } } else if (!menu_only) { chosen_item = action; } } ui_end_menu(); return chosen_item;}
开发者ID:kbzona,项目名称:TWRP-LG-P500-Port,代码行数:65,
示例25: mainintmain(int argc, char **argv){ time_t start = time(NULL); // If these fail, there's not really anywhere to complain... freopen(TEMPORARY_LOG_FILE, "a", stdout); setbuf(stdout, NULL); freopen(TEMPORARY_LOG_FILE, "a", stderr); setbuf(stderr, NULL); fprintf(stderr, "Starting recovery on %s", ctime(&start)); ui_init(); ui_print("Android system recovery utility/n"); get_args(&argc, &argv); int previous_runs = 0; const char *send_intent = NULL; const char *update_package = NULL; int wipe_data = 0, wipe_cache = 0; int arg; while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) { switch (arg) { case 'p': previous_runs = atoi(optarg); break; case 's': send_intent = optarg; break; case 'u': update_package = optarg; break; case 'w': wipe_data = wipe_cache = 1; break; case 'c': wipe_cache = 1; break; case '?': LOGE("Invalid command argument/n"); continue; } } fprintf(stderr, "Command:"); for (arg = 0; arg < argc; arg++) { fprintf(stderr, " /"%s/"", argv[arg]); } fprintf(stderr, "/n/n"); property_list(print_property, NULL); fprintf(stderr, "/n");#if TEST_AMEND test_amend();#endif RecoveryCommandContext ctx = { NULL }; if (register_update_commands(&ctx)) { LOGE("Can't install update commands/n"); } int status = INSTALL_SUCCESS; if (update_package != NULL) { status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("Installation aborted./n"); } else if (wipe_data || wipe_cache) { if (wipe_data && erase_root("DATA:")) status = INSTALL_ERROR; if (wipe_cache && erase_root("CACHE:")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed./n"); } else { status = INSTALL_ERROR; // No command specified } if (status != INSTALL_SUCCESS) ui_set_background(BACKGROUND_ICON_ERROR); if (status != INSTALL_SUCCESS || ui_text_visible()) prompt_and_wait(); // If there is a radio image pending, reboot now to install it. maybe_install_firmware_update(send_intent); // Otherwise, get ready to boot the main system... finish_recovery(send_intent); ui_print("Rebooting.../n"); sync(); reboot(RB_AUTOBOOT); return EXIT_SUCCESS;}
开发者ID:Jib-BAOSP,项目名称:platform_recovery,代码行数:77,
示例26: main//.........这里部分代码省略......... case '?': LOGE("Invalid command argument/n"); continue; } } device_recovery_start(); printf("Command:"); for (arg = 0; arg < argc; arg++) { printf(" /"%s/"", argv[arg]); } printf("/n"); if (update_package) { // For backwards compatibility on the cache partition only, if // we're given an old 'root' path "CACHE:foo", change it to // "/cache/foo". if (strncmp(update_package, "CACHE:", 6) == 0) { int len = strlen(update_package) + 10; char* modified_path = malloc(len); strlcpy(modified_path, "/cache/", len); strlcat(modified_path, update_package+6, len); printf("(replacing path /"%s/" with /"%s/")/n", update_package, modified_path); update_package = modified_path; } } printf("/n"); property_list(print_property, NULL); printf("/n"); int status = INSTALL_SUCCESS; if (toggle_secure_fs) { if (strcmp(encrypted_fs_mode,"on") == 0) { encrypted_fs_data.mode = MODE_ENCRYPTED_FS_ENABLED; ui_print("Enabling Encrypted FS./n"); } else if (strcmp(encrypted_fs_mode,"off") == 0) { encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; ui_print("Disabling Encrypted FS./n"); } else { ui_print("Error: invalid Encrypted FS setting./n"); status = INSTALL_ERROR; } // Recovery strategy: if the data partition is damaged, disable encrypted file systems. // This preventsthe device recycling endlessly in recovery mode. if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && (read_encrypted_fs_info(&encrypted_fs_data))) { ui_print("Encrypted FS change aborted, resetting to disabled state./n"); encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; } if (status != INSTALL_ERROR) { if (erase_volume("/data")) { ui_print("Data wipe failed./n"); status = INSTALL_ERROR; } else if (erase_volume("/cache")) { ui_print("Cache wipe failed./n"); status = INSTALL_ERROR; } else if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && (restore_encrypted_fs_info(&encrypted_fs_data))) { ui_print("Encrypted FS change aborted./n"); status = INSTALL_ERROR; } else { ui_print("Successfully updated Encrypted FS./n"); status = INSTALL_SUCCESS; } } } else if (update_package != NULL) { status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("Installation aborted./n"); } else if (wipe_data) { if (device_wipe_data()) status = INSTALL_ERROR; if (erase_volume("/data")) status = INSTALL_ERROR; if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed./n"); } else if (wipe_cache) { if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed./n"); } else { status = INSTALL_ERROR; // No command specified } if (status != INSTALL_SUCCESS) ui_set_background(BACKGROUND_ICON_ERROR); if (status != INSTALL_SUCCESS || ui_text_visible()) { //assume we want to be here and its not an error - give us the pretty icon! ui_set_background(BACKGROUND_ICON_MAIN); prompt_and_wait(); } // Otherwise, get ready to boot the main system... finish_recovery(send_intent); ui_print("Rebooting.../n"); sync(); reboot(RB_AUTOBOOT); return EXIT_SUCCESS;}
开发者ID:kbzona,项目名称:TWRP-LG-P500-Port,代码行数:101,
示例27: prompt_and_waitstatic voidprompt_and_wait() { char** headers = prepend_title((const char**)MENU_HEADERS); for (;;) { finish_recovery(NULL); ui_reset_progress(); ui_root_menu = 1; // ui_menu_level is a legacy variable that i am keeping around to prevent build breakage. ui_menu_level = 0; // allow_display_toggle = 1; int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0, 0); ui_menu_level = 1; ui_root_menu = 0; // allow_display_toggle = 0; // device-specific code may take some action here. It may // return one of the core actions handled in the switch // statement below. chosen_item = device_perform_action(chosen_item); int status; switch (chosen_item) { case ITEM_REBOOT: poweroff=0; return; case ITEM_WIPE_DATA: wipe_data(ui_text_visible()); if (!ui_text_visible()) return; break; case ITEM_WIPE_CACHE: if (confirm_selection("你真的要清除数据?", "我就是要删除缓存数据")) { ui_print("/n-- 正在清除 /n"); erase_volume("/cache"); ui_print("已经成功清除/n"); if (!ui_text_visible()) return; } break; case ITEM_APPLY_SDCARD: show_install_update_menu(); break; case ITEM_APPLY_SIDELOAD: apply_from_adb(); break; case ITEM_NANDROID: show_nandroid_menu(); break; case ITEM_PARTITION: show_partition_menu(); break; case ITEM_ADVANCED: show_advanced_menu(); break; case ITEM_GUOHOWFLASH: // 调用exs.c中该函数 show_guohowflash_menu(); break; case ITEM_GUOHOWWHOLEWIPE: // 调用exs.c中该函数 show_guohowwholewipe_menu(); break; case ITEM_GUOHOWHELP: // 调用exs.c中该函数 show_guohowhelp_menu(); break; case ITEM_GUOHOWABOUT: // 调用exs.c中该函数 show_guohowabout_menu(); break; case ITEM_POWEROFF: poweroff = 1; return; } }}
开发者ID:HyperToxic,项目名称:CWM_REC_6.0.3.2_CHN,代码行数:89,
示例28: main//.........这里部分代码省略......... printf(" /"%s/"", argv[arg]); } printf("/n"); if (update_package) { // For backwards compatibility on the cache partition only, if // we're given an old 'root' path "CACHE:foo", change it to // "/cache/foo". if (strncmp(update_package, "CACHE:", 6) == 0) { int len = strlen(update_package) + 10; char* modified_path = malloc(len); strlcpy(modified_path, "/cache/", len); strlcat(modified_path, update_package+6, len); printf("(replacing path /"%s/" with /"%s/")/n", update_package, modified_path); update_package = modified_path; } } printf("/n"); property_list(print_property, NULL); printf("/n"); int status = INSTALL_SUCCESS; if (update_package != NULL) { status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("Installation aborted./n"); } else if (wipe_data) { if (device_wipe_data()) status = INSTALL_ERROR; if (erase_volume("/data")) status = INSTALL_ERROR; if (has_datadata() && erase_volume("/datadata")) status = INSTALL_ERROR; if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Data wipe failed./n"); } else if (wipe_cache) { if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR; if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed./n"); } else { 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 signature_check_enabled = 0; script_assert_enabled = 0; is_user_initiated_recovery = 1; ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_CLOCKWORK); if (extendedcommand_file_exists()) { LOGI("Running extendedcommand.../n"); int ret; if (0 == (ret = run_and_remove_extendedcommand())) { status = INSTALL_SUCCESS; ui_set_show_text(0); } else { handle_failure(ret); } } else { LOGI("Skipping execution of extendedcommand, file not found.../n"); } } if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) { ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_ERROR); } if (status != INSTALL_SUCCESS || ui_text_visible()) { prompt_and_wait(); } verify_root_and_recovery(); // If there is a radio image pending, reboot now to install it. maybe_install_firmware_update(send_intent); // Otherwise, get ready to boot the main system... finish_recovery(send_intent); sync(); if(!poweroff) { ui_print("重启手机.../n"); #ifdef BOARD_HAS_DUAL_SYSTEM if(multiboot==1){ #endif android_reboot(ANDROID_RB_RESTART, 0, 0); #ifdef BOARD_HAS_DUAL_SYSTEM }else{ set_reboot_message(multiboot==2); sync(); android_reboot(ANDROID_RB_RESTART, 0, 0); } #endif } else { ui_print("关闭手机.../n"); android_reboot(ANDROID_RB_POWEROFF, 0, 0); } return EXIT_SUCCESS;}
开发者ID:xiangxin19960319,项目名称:android_bootable_recovery_cn_ics,代码行数:101,
示例29: get_menu_selectionintget_menu_selection(char** headers, char** items, int menu_only, int initial_selection) { // throw away keys pressed previously, so user doesn't // accidentally trigger menu items. ui_clear_key_queue(); int item_count = ui_start_menu(headers, items, initial_selection); int selected = initial_selection; int chosen_item = -1; // NO_ACTION int wrap_count = 0; while (chosen_item < 0 && chosen_item != GO_BACK) { int key = ui_wait_key(); int visible = ui_text_visible(); if (key == -1) { // ui_wait_key() timed out if (ui_text_ever_visible()) { continue; } else { LOGI("timed out waiting for key input; rebooting./n"); ui_end_menu(); return ITEM_REBOOT; } } else if (key == -2) { // we are returning from ui_cancel_wait_key(): trigger a GO_BACK return GO_BACK; } int action = ui_handle_key(key, visible); int old_selected = selected; selected = ui_get_selected_item(); if (action < 0) { switch (action) { case HIGHLIGHT_UP: --selected; selected = ui_menu_select(selected); break; case HIGHLIGHT_DOWN: ++selected; selected = ui_menu_select(selected); break; case SELECT_ITEM: chosen_item = selected; if (ui_is_showing_back_button()) { if (chosen_item == item_count) { chosen_item = GO_BACK; } } break; case NO_ACTION: break; case GO_BACK: chosen_item = GO_BACK; break; } } else if (!menu_only) { chosen_item = action; } if (abs(selected - old_selected) > 1) { wrap_count++; if (wrap_count == 5) { wrap_count = 0; if (ui_get_rainbow_mode()) { ui_set_rainbow_mode(0); ui_print("Rainbow mode disabled/n"); } else { ui_set_rainbow_mode(1); ui_print("Rainbow mode enabled!/n"); } } } } ui_end_menu(); ui_clear_key_queue(); return chosen_item;}
开发者ID:adbaby,项目名称:mtk6589_bootable_recovery,代码行数:82,
注:本文中的ui_text_visible函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ui_update_menus函数代码示例 C++ ui_show_indeterminate_progress函数代码示例 |