您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ui_show_indeterminate_progress函数代码示例

51自学网 2021-06-03 09:07:04
  C++
这篇教程C++ ui_show_indeterminate_progress函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ui_show_indeterminate_progress函数的典型用法代码示例。如果您正苦于以下问题:C++ ui_show_indeterminate_progress函数的具体用法?C++ ui_show_indeterminate_progress怎么用?C++ ui_show_indeterminate_progress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ui_show_indeterminate_progress函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: install_package

intinstall_package(const char *root_path){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_print("Finding update package.../n");    ui_show_indeterminate_progress();    LOGI("Update location: %s/n", root_path);    if (ensure_root_path_mounted(root_path) != 0) {        LOGE("Can't mount %s/n", root_path);        return INSTALL_CORRUPT;    }    char path[PATH_MAX] = "";    if (translate_root_path(root_path, path, sizeof(path)) == NULL) {        LOGE("Bad path %s/n", root_path);        return INSTALL_CORRUPT;    }    ui_print("Opening update package.../n");    LOGI("Update file path: %s/n", path);    int numKeys;    RSAPublicKey* loadedKeys = load_keys(PUBLIC_KEYS_FILE, &numKeys);    if (loadedKeys == NULL) {        LOGE("Failed to load keys/n");        return INSTALL_CORRUPT;    }    LOGI("%d key(s) loaded from %s/n", numKeys, PUBLIC_KEYS_FILE);    // Give verification half the progress bar...    ui_print("Verifying update package.../n");    ui_show_progress(            VERIFICATION_PROGRESS_FRACTION,            VERIFICATION_PROGRESS_TIME);    int err;    err = verify_file(path, loadedKeys, numKeys);    free(loadedKeys);    LOGI("verify_file returned %d/n", err);    if (err != VERIFY_SUCCESS) {        LOGE("signature verification failed/n");        return INSTALL_CORRUPT;    }    /* Try to open the package.     */    ZipArchive zip;    err = mzOpenZipArchive(path, &zip);    if (err != 0) {        LOGE("Can't open %s/n(%s)/n", path, err != -1 ? strerror(err) : "bad");        return INSTALL_CORRUPT;    }    /* Verify and install the contents of the package.     */    int status = handle_update_package(path, &zip);    mzCloseZipArchive(&zip);    return status;}
开发者ID:YtnbFirewings,项目名称:android_bootable_recovery,代码行数:60,


示例2: erase_root

static interase_root(const char *root) {    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    ui_print("Formatting %s.../n", root);    return format_root_device(root);}
开发者ID:bandroidx,项目名称:bravo_recovery,代码行数:7,


示例3: nandroid_restore

int nandroid_restore(const char* backup_path, int restore_boot, int restore_system, int restore_data, int restore_cache, int restore_sdext){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    yaffs_files_total = 0;    if (ensure_root_path_mounted("SDCARD:") != 0)        return print_and_error("Can't mount /sdcard/n");        char tmp[PATH_MAX];    //ui_print("Checking MD5 sums.../n");    //sprintf(tmp, "cd %s && md5sum -c nandroid.md5", backup_path);    //if (0 != __system(tmp))    //    return print_and_error("MD5 mismatch!/n");        int ret;#ifndef BOARD_RECOVERY_IGNORE_BOOTABLES    if (restore_boot)    {        ui_print("Erasing boot before restore.../n");        if (0 != (ret = format_root_device("BOOT:")))            return print_and_error("Error while formatting BOOT:!/n");        sprintf(tmp, "%s/boot.img", backup_path);        ui_print("Restoring boot image.../n");        if (0 != (ret = restore_raw_partition("boot", tmp))) {            ui_print("Error while flashing boot image!");            return ret;        }    }#endif        if (restore_system && 0 != (ret = nandroid_restore_partition(backup_path, "SYSTEM:")))        return ret;    if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "DATA:")))        return ret;        #ifdef BOARD_HAS_DATADATA    if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "DATADATA:")))        return ret;#endif    if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "SDCARD:/.android_secure", 0)))        return ret;    if (restore_cache && 0 != (ret = nandroid_restore_partition_extended(backup_path, "CACHE:", 0)))        return ret;    if (restore_sdext && 0 != (ret = nandroid_restore_partition(backup_path, "SDEXT:")))        return ret;    sync();    ui_set_background(BACKGROUND_ICON_NONE);    ui_reset_progress();    ui_print("/nRestore complete!/n");    return 0;}
开发者ID:Fengyuan,项目名称:G3MOD,代码行数:58,


示例4: really_install_package

static intreally_install_package(const char *path){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_print("正在查找升级包.../n");    ui_show_indeterminate_progress();    LOGI("Update location: %s/n", path);    if (ensure_path_mounted(path) != 0) {        LOGE("Can't mount %s/n", path);        return INSTALL_CORRUPT;    }    ui_print("正在打开升级包.../n");    int err;    if (signature_check_enabled) {        int numKeys;        RSAPublicKey* loadedKeys = load_keys(PUBLIC_KEYS_FILE, &numKeys);        if (loadedKeys == NULL) {            LOGE("Failed to load keys/n");            return INSTALL_CORRUPT;        }        LOGI("%d key(s) loaded from %s/n", numKeys, PUBLIC_KEYS_FILE);        // Give verification half the progress bar...        ui_print("正在校验升级包.../n");        ui_show_progress(                VERIFICATION_PROGRESS_FRACTION,                VERIFICATION_PROGRESS_TIME);        err = verify_file(path, loadedKeys, numKeys);        free(loadedKeys);        LOGI("verify_file returned %d/n", err);        if (err != VERIFY_SUCCESS) {            LOGE("signature verification failed/n");            ui_show_text(1);            if (!confirm_selection("Install Untrusted Package?", "确认 - 安装不严格的zip卡刷包"))                return INSTALL_CORRUPT;        }    }    /* Try to open the package.     */    ZipArchive zip;    err = mzOpenZipArchive(path, &zip);    if (err != 0) {        LOGE("Can't open %s/n(%s)/n", path, err != -1 ? strerror(err) : "bad");        return INSTALL_CORRUPT;    }    /* Verify and install the contents of the package.     */    ui_print("正在安装更新.../n");    return try_update_binary(path, &zip);}
开发者ID:EYEALAN,项目名称:CWM_recovery_6.0.3.5_CN_EYE,代码行数:57,


示例5: install_package

intinstall_package(const char *path){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_print("Finding update package.../n");    ui_show_indeterminate_progress();    LOGI("Update location: %s/n", path);/*    if (strcmp(root_path, ":") == 0) {	    if (ensure_root_path_mounted(root_path) != 0) {	        LOGE("Can't mount %s/n", root_path);	        return INSTALL_CORRUPT;	    }	    if (translate_root_path(root_path, path, sizeof(path)) == NULL) {	        LOGE("Bad path %s/n", root_path);	        return INSTALL_CORRUPT;	    }    } else {	    path = strndup(path, root_path);    }*/    ui_print("Opening update package.../n");    LOGI("Update file path: %s/n", path);/*    int numKeys;    RSAPublicKey* loadedKeys = load_keys(PUBLIC_KEYS_FILE, &numKeys);    if (loadedKeys == NULL) {        LOGE("Failed to load keys/n");        return INSTALL_CORRUPT;    }    LOGI("%d key(s) loaded from %s/n", numKeys, PUBLIC_KEYS_FILE);*/    /* Try to open the package.     */    ZipArchive zip;    int err = mzOpenZipArchive(path, &zip);    if (err != 0) {        LOGE("Can't open %s/n(%s)/n", path, err != -1 ? strerror(err) : "bad");        return INSTALL_CORRUPT;    }    /* Verify and install the contents of the package.     */    // int status = handle_update_package(path, &zip, loadedKeys, numKeys);    int status = handle_update_package(path, &zip);    mzCloseZipArchive(&zip);    // free(loadedKeys);    return status;}
开发者ID:bpedman,项目名称:android_bootable_recovery,代码行数:54,


示例6: erase_volume

int erase_volume(const char *volume) {    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    ui_print("%s %s.../n", edifyformatting, volume);    if (strcmp(volume, "/cache") == 0) {        // Any part of the log we'd copied to cache is now gone.        // Reset the pointer so we copy from the beginning of the temp        // log.        tmplog_offset = 0;    }    // Finally run format_volume from within roots    return format_volume(volume);}
开发者ID:drewwalton19216801,项目名称:android_bootable_recovery,代码行数:14,


示例7: erase_volume

static interase_volume(const char *volume) {    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    ui_print("正在格式化 %s /n", volume);    if (strcmp(volume, "/cache") == 0) {        // Any part of the log we'd copied to cache is now gone.        // Reset the pointer so we copy from the beginning of the temp        // log.        tmplog_offset = 0;    }    return format_volume(volume);}
开发者ID:HyperToxic,项目名称:CWM_REC_6.0.3.2_CHN,代码行数:15,


示例8: device_toggle_truedualboot

void device_toggle_truedualboot(void) {	char confirm[PATH_MAX];	int enable = dualboot_is_tdb_enabled();#ifndef PHILZ_TOUCH_RECOVERY	ui_setMenuTextColor(MENU_TEXT_COLOR_RED);#endif	sprintf(confirm, "Yes - %s TrueDualBoot", enable?"DISABLE":"ENABLE");	if (confirm_selection("This will WIPE DATA. Confirm?", confirm)) {		// unmount /data		if(ensure_path_unmounted("/data")!=0) {			LOGE("Error unmounting /data!/n");			return;		}		// format /data		ui_set_background(BACKGROUND_ICON_INSTALLING);		ui_show_indeterminate_progress();		ui_print("Formatting /data.../n");		set_force_raw_format_enabled(1);		if(format_volume("/data")!=0) {			ui_print("Error formatting /data!/n");			ui_reset_progress();			return;		}		ui_reset_progress();		set_force_raw_format_enabled(0);		ui_print("Done./n");		// toggle		dualboot_set_tdb_enabled(!enable);	}#ifndef PHILZ_TOUCH_RECOVERY	ui_setMenuTextColor(MENU_TEXT_COLOR);#endif	return;}
开发者ID:Rohirimor,项目名称:android_device_xiaomi_mione_plus-carbon,代码行数:41,


示例9: nandroid_restore_sd

int nandroid_restore_sd(const char* backup_path, int restore_sdext){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    yaffs_files_total = 0;    if (ensure_path_mounted(backup_path) != 0)        return print_and_error("Can't mount backup path/n");        char tmp[PATH_MAX];        int ret;    if (restore_sdext && 0 != (ret = nandroid_restore_partition(backup_path, "/sd-ext")))        return ret;    sync();    ui_set_background(BACKGROUND_ICON_NONE);    ui_reset_progress();    ui_print("/nRestore complete!/n");    return 0;}
开发者ID:Arakmar,项目名称:cwm5-g3mod,代码行数:22,


示例10: nandroid_restore_androidSecure

int nandroid_restore_androidSecure(const char* backup_path, int restore_androidSecure){	ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    yaffs_files_total = 0;    if (ensure_root_path_mounted("SDCARD:") != 0)        return print_and_error("Can't mount /sdcard/n");        char tmp[PATH_MAX];    int ret;    if (restore_androidSecure && 0 != (ret = nandroid_restore_partition_extended(backup_path, "SDCARD:/.android_secure", 0)))        return ret;    sync();    ui_set_background(BACKGROUND_ICON_NONE);    ui_reset_progress();    ui_print("/nRestore complete!/n");    return 0;}
开发者ID:Fengyuan,项目名称:G3MOD,代码行数:22,


示例11: tarbackup_restore

int tarbackup_restore(const char* backup_path, int restore_system, int restore_data, int restore_cache, int restore_sdext){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    if (ensure_root_path_mounted("SDCARD:") != 0)        return print_and_error("Can't mount /sdcard/n");    char tmp[PATH_MAX];/*    ui_print("Checking MD5 sums.../n");    sprintf(tmp, "cd %s && md5sum -c nandroid.md5", backup_path);    if (0 != __system(tmp))        return print_and_error("MD5 mismatch!/n");*/    int ret=0;    if (restore_system && 0 != (ret = tarbackup_restore_partition_extended(backup_path, "SYSTEM:", 1)))        return ret;    if (restore_data && 0 != (ret = tarbackup_restore_partition_extended(backup_path, "DATA:", 1)))        return ret;    if (restore_data && 0 != (ret = tarbackup_restore_partition_extended(backup_path, "DATADATA:", 1)))        return ret;/*    if (restore_data && 0 != (ret = tarbackup_restore_partition_extended(backup_path, "SDCARD:/.android_secure", 0)))        return ret;*/    if (restore_cache && 0 != (ret = tarbackup_restore_partition_extended(backup_path, "CACHE:", 0)))        return ret;    sync();    ui_set_background(BACKGROUND_ICON_EBCLOCKWORK);    ui_reset_progress();    ui_print("/nRestore complete!/n");    detect_root_fs();    return 0;}
开发者ID:eugene373,项目名称:BeHold-2-Recovery-1,代码行数:39,


示例12: nandroid_restore

int nandroid_restore(const char* backup_path, int restore_boot, int restore_system, int restore_data, int restore_cache, int restore_sdext, int restore_wimax){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    if (ensure_path_mounted(backup_path) != 0)        return print_and_error("Can't mount backup path/n");        char tmp[PATH_MAX];#ifdef PHILZ_TOUCH_RECOVERY    if (enable_md5sum)#endif    {        ui_print("Checking MD5 sums.../n");        sprintf(tmp, "cd %s && md5sum -c nandroid.md5", backup_path);        if (0 != __system(tmp))            return print_and_error("MD5 mismatch!/n");    }    int ret;    if (restore_boot && NULL != volume_for_path("/boot") && 0 != (ret = nandroid_restore_partition(backup_path, "/boot")))        return ret;    if (backup_recovery && 0 != (ret = nandroid_restore_partition(backup_path, "/recovery")))        return ret;    struct stat s;    Volume *vol = volume_for_path("/wimax");    if (restore_wimax && vol != NULL && 0 == stat(vol->device, &s))    {        char serialno[PROPERTY_VALUE_MAX];                serialno[0] = 0;        property_get("ro.serialno", serialno, "");        sprintf(tmp, "%s/wimax.%s.img", backup_path, serialno);        struct stat st;        if (0 != stat(tmp, &st))        {            ui_print("WARNING: WiMAX partition exists, but nandroid/n");            ui_print("         backup does not contain WiMAX image./n");            ui_print("         You should create a new backup to/n");            ui_print("         protect your WiMAX keys./n");        }        else        {            ui_print("Erasing WiMAX before restore.../n");            if (0 != (ret = format_volume("/wimax")))                return print_and_error("Error while formatting wimax!/n");            ui_print("Restoring WiMAX image.../n");            if (0 != (ret = restore_raw_partition(vol->fs_type, vol->device, tmp)))                return ret;        }    }    // restore of raw efs image files (efs_time-stamp.img) is done elsewhere    // as it needs to pass in a filename (instead of a folder) as backup_path    // this could be done here since efs is processed alone, but must be done before md5 checksum!    if (backup_efs == RESTORE_EFS_TAR && 0 != (ret = nandroid_restore_partition(backup_path, "/efs")))        return ret;            if (backup_modem == RAW_IMG_FILE && 0 != (ret = nandroid_restore_partition(backup_path, "/modem")))        return ret;    else if (backup_modem == RAW_BIN_FILE) {        sprintf(tmp, "%s/modem.bin", backup_path);        custom_restore_raw_handler(tmp, "/modem");    }    if (restore_system && 0 != (ret = nandroid_restore_partition(backup_path, "/system")))        return ret;    if (is_custom_backup && backup_preload) {        if (0 != (ret = nandroid_restore_partition(backup_path, "/preload"))) {            ui_print("Failed to restore /preload!/n");            return ret;        }    }    else if (!is_custom_backup#ifdef PHILZ_TOUCH_RECOVERY                && nandroid_add_preload#endif            )    {        if (restore_system && 0 != (ret = nandroid_restore_partition(backup_path, "/preload"))) {            ui_print("Failed to restore preload! Try to disable it./n");            ui_print("Skipping /preload.../n");            //return ret;        }    }    if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/data")))        return ret;            if (has_datadata()) {        if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/datadata")))            return ret;    }//.........这里部分代码省略.........
开发者ID:Atlant777,项目名称:philz_touch_cwm6,代码行数:101,


示例13: nandroid_restore

int nandroid_restore(const char* backup_path, int restore_boot, int restore_system, int restore_data, int restore_cache, int restore_sdext, int restore_wimax){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    nandroid_files_total = 0;    if (ensure_path_mounted(backup_path) != 0)        return print_and_error("挂载分区失败/n");    char tmp[PATH_MAX];    ui_print("检查MD5 校验值.../n");    sprintf(tmp, "cd %s && md5sum -c nandroid.md5", backup_path);    if (0 != __system(tmp))        return print_and_error("MD5不合法/n");    int ret;    if (restore_boot)    {        if (NULL != volume_for_path("/boot") && 0 != (ret = nandroid_restore_partition(backup_path, "/boot")))            return ret;        if (NULL != volume_for_path("/uboot") && 0 != (ret = nandroid_restore_partition(backup_path, "/uboot")))            return ret;        if (NULL != volume_for_path("/recovery") && 0 != (ret = nandroid_restore_partition(backup_path, "/recovery")))            return ret;    }        struct stat s;    Volume *vol = volume_for_path("/wimax");    if (restore_wimax && vol != NULL && 0 == stat(vol->device, &s))    {        char serialno[PROPERTY_VALUE_MAX];        serialno[0] = 0;        property_get("ro.serialno", serialno, "");        sprintf(tmp, "%s/wimax.%s.img", backup_path, serialno);        struct stat st;        if (0 != stat(tmp, &st))        {            ui_print("警告: WiMAX分区存在,但是/n");            ui_print("        不存在可恢复的WiMAX 镜像./n");            ui_print("        亦需要重新做一个备份 /n");            ui_print("        来保护你的WiMAX keys./n");        }        else        {            ui_print("恢复之前先清除WiMAX.../n");            if (0 != (ret = format_volume("/wimax")))                return print_and_error("抹掉wimax失败!/n");            ui_print("恢复WiMAX 镜像.../n");            if (0 != (ret = restore_raw_partition(vol->fs_type, vol->device, tmp)))                return ret;        }    }    if (restore_system && 0 != (ret = nandroid_restore_partition(backup_path, "/system")))        return ret;    if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/data")))        return ret;    if (has_datadata()) {        if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/datadata")))            return ret;    }    if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/sdcard/.android_secure", 0)))        return ret;    if (restore_cache && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/cache", 0)))        return ret;    if (restore_sdext && 0 != (ret = nandroid_restore_partition(backup_path, "/sd-ext")))        return ret;    sync();    ui_set_background(BACKGROUND_ICON_NONE);    ui_reset_progress();    ui_print("/n恢复完成!/n");    return 0;}
开发者ID:Aromer-room,项目名称:mtk6589_recovery_cn,代码行数:85,


示例14: dd_raw_restore_handler

// custom raw restore handler// used to restore efs in raw mode or modem.bin files// for now, only called directly from outside functions (not from nandroid_restore())// user selects an image file to restore, so backup_file_image path is already mountedint dd_raw_restore_handler(const char* backup_file_image, const char* root) {    ui_print("/n>> Restoring %s.../n", root);    Volume *vol = volume_for_path(root);    if (vol == NULL || vol->fs_type == NULL) {        ui_print("volume not found! Skipping raw restore of %s.../n", root);        return 0;    }    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    // make sure we  have a valid image file name    int i = 0;    char errmsg[PATH_MAX];    char tmp[PATH_MAX];    char filename[PATH_MAX];    const char *raw_image_format[] = { ".img", ".bin", NULL };    sprintf(filename, "%s", BaseName(backup_file_image));    while (raw_image_format[i] != NULL) {        if (strlen(filename) > strlen(raw_image_format[i]) &&                    strcmp(filename + strlen(filename) - strlen(raw_image_format[i]), raw_image_format[i]) == 0 &&                    strncmp(filename, vol->mount_point + 1, strlen(vol->mount_point)-1) == 0) {            break;        }        i++;    }    if (raw_image_format[i] == NULL) {        sprintf(errmsg, "invalid image file! Failed to restore %s to %s/n", filename, root);        return print_and_error(errmsg, NANDROID_ERROR_GENERAL);    }    //make sure file exists    if (!file_found(backup_file_image)) {        sprintf(errmsg, "%s not found. Skipping restore of %s/n", backup_file_image, root);        return print_and_error(errmsg, NANDROID_ERROR_GENERAL);    }    //restore raw image    int ret = 0;    char* device_mmcblk;    ui_print("Restoring %s to %s/n", filename, vol->mount_point);    if (strstr(vol->blk_device, "/dev/block/mmcblk") != NULL || strstr(vol->blk_device, "/dev/block/mtdblock") != NULL) {        sprintf(tmp, "raw-backup.sh -r '%s' %s %s", backup_file_image, vol->blk_device, vol->mount_point);    } else if (vol->blk_device2 != NULL &&            (strstr(vol->blk_device2, "/dev/block/mmcblk") != NULL || strstr(vol->blk_device2, "/dev/block/mtdblock") != NULL)) {        sprintf(tmp, "raw-backup.sh -r '%s' %s %s", backup_file_image, vol->blk_device2, vol->mount_point);    } else if ((device_mmcblk = readlink_device_blk(root)) != NULL) {        sprintf(tmp, "raw-backup.sh -r '%s' %s %s", backup_file_image, device_mmcblk, vol->mount_point);        free(device_mmcblk);    } else {        sprintf(errmsg, "raw restore: no device found (%s)/n", root);        return print_and_error(errmsg, NANDROID_ERROR_GENERAL);    }    ret = __system(tmp);    if (0 != ret) {        sprintf(errmsg, "failed raw restore of %s to %s/n", filename, root);        print_and_error(errmsg, ret);    } else {        finish_nandroid_job();    }    sprintf(tmp, "%s/log.txt", DirName(backup_file_image));    ui_print_custom_logtail(tmp, 3);    return ret;}
开发者ID:Shoxxy,项目名称:PhilMeHd7aio,代码行数:73,


示例15: nandroid_restore

int nandroid_restore(const char* backup_path, int restore_boot, int restore_system, int restore_data, int restore_cache, int restore_sdext, int restore_wimax){    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    yaffs_files_total = 0;    if (ensure_path_mounted("/sdcard") != 0)        return print_and_error("Can't mount /sdcard/n");        char tmp[PATH_MAX];    ui_print("Checking MD5 sums.../n");    sprintf(tmp, "cd %s && md5sum -c nandroid.md5", backup_path);    if (0 != __system(tmp))        return print_and_error("MD5 mismatch!/n");        int ret;    if (restore_boot && NULL != volume_for_path("/boot") && 0 != (ret = nandroid_restore_partition(backup_path, "/boot")))        return ret;        struct stat s;    Volume *vol = volume_for_path("/wimax");    if (restore_wimax && vol != NULL && 0 == stat(vol->device, &s))    {        char serialno[PROPERTY_VALUE_MAX];                serialno[0] = 0;        property_get("ro.serialno", serialno, "");        sprintf(tmp, "%s/wimax.%s.img", backup_path, serialno);        struct stat st;        if (0 != stat(tmp, &st))        {            ui_print("WARNING: WiMAX partition exists, but nandroid/n");            ui_print("         backup does not contain WiMAX image./n");            ui_print("         You should create a new backup to/n");            ui_print("         protect your WiMAX keys./n");        }        else        {            ui_print("Erasing WiMAX before restore.../n");            if (0 != (ret = format_volume("/wimax")))                return print_and_error("Error while formatting wimax!/n");            ui_print("Restoring WiMAX image.../n");            if (0 != (ret = restore_raw_partition(vol->fs_type, vol->device, tmp)))                return ret;        }    }    if (restore_system && 0 != (ret = nandroid_restore_partition(backup_path, "/system")))        return ret;    if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/data")))        return ret;            if (has_datadata()) {        if (restore_data && 0 != (ret = nandroid_restore_partition(backup_path, "/datadata")))            return ret;    }    if (restore_data && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/sdcard/.android_secure", 0)))        return ret;    if (restore_cache && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/cache", 0)))        return ret;#ifdef RECOVERY_HAVE_SD_EXT    if (restore_sdext && 0 != (ret = nandroid_restore_partition(backup_path, "/sd-ext")))        return ret;#endif    sync();    ui_set_background(BACKGROUND_ICON_NONE);    ui_reset_progress();    ui_print("/nRestore complete!/n");    return 0;}
开发者ID:rex12345,项目名称:sc02c_cwm_recovery,代码行数:76,


示例16: try_update_binary

// If the package contains an update binary, extract it and run it.static inttry_update_binary(const char *path, ZipArchive *zip) {	int	custom_binary = 0;	const ZipEntry* or_script_entry =		      mzFindZipEntry(zip, ASSUMED_OR_UPDATE_SCRIPT_NAME);		      	if (or_script_entry != NULL)	{		ui_print("Using shell script.../n");		return handle_or_update(path, zip);	}	const ZipEntry* binary_entry =		      mzFindZipEntry(zip, ASSUMED_UPDATE_BINARY_NAME);	if (binary_entry == NULL)		ui_print("Using default updater.../n");	else		custom_binary = 1;    char* binary = "/tmp/update_binary";  unlink(binary);    if (custom_binary)  {		int fd = creat(binary, 0755);		if (fd < 0) 		{		  LOGE("Can't make %s/n", binary);		  return 1;		}  		bool ok = mzExtractZipEntryToFile(zip, binary_entry, fd);		close(fd);		if (!ok) 		{	    LOGE("Can't copy %s/n", ASSUMED_UPDATE_BINARY_NAME);	    return 1;		}	}	else		binary = DEFAULT_UPDATE_BINARY_NAME;	ui_show_indeterminate_progress();  int pipefd[2];  pipe(pipefd);  // When executing the update binary contained in the package, the  // arguments passed are:  //  //   - the version number for this interface  //  //   - an fd to which the program can write in order to update the  //     progress bar.  The program can write single-line commands:  //  //        progress <frac> <secs>  //            fill up the next <frac> part of of the progress bar  //            over <secs> seconds.  If <secs> is zero, use  //            set_progress commands to manually control the  //            progress of this segment of the bar  //  //        set_progress <frac>  //            <frac> should be between 0.0 and 1.0; sets the  //            progress bar within the segment defined by the most  //            recent progress command.  //  //        firmware <"hboot"|"radio"> <filename>  //            arrange to install the contents of <filename> in the  //            given partition on reboot.  (API v2: <filename> may  //            start with "PACKAGE:" to indicate taking a file from  //            the OTA package.)  //  //        ui_print <string>  //            display <string> on the screen.  //  //				stasis  //						quit the gui  //   - the name of the package zip file.  //  char** args = malloc(sizeof(char*) * 5);  args[0] = binary;  args[1] = EXPAND(RECOVERY_API_VERSION);   // defined in Android.mk  args[2] = malloc(10);  sprintf(args[2], "%d", pipefd[1]);  args[3] = (char*)path;  args[4] = NULL;  pid_t pid = fork();  if (pid == 0)   {    close(pipefd[0]);    execv(binary, args);    fprintf(stderr, "E:Can't run %s (%s)/n", binary, strerror(errno));    _exit(-1);  }//.........这里部分代码省略.........
开发者ID:Mioze7Ae,项目名称:openrecovery,代码行数:101,


示例17: convert_mtd_device

int convert_mtd_device(const char *root, const char* fs_list){    static char* headers[] = {  "Converting Menu",                                "",    							NULL,                                NULL    };    static char* confirm_convert  = "Confirm convert?";    static char* confirm = "Yes - Convert";    const char* root_fs = get_type_internal_fs(root);    headers[2] = root;    typedef char* string;    string tfs[NUM_FILESYSTEMS] = { "rfs", "ext4" };    static string options[NUM_FILESYSTEMS*2 + 1 + 1];    int sel_fs[NUM_FILESYSTEMS*2 + 1 + 1];	int i,j=0;	// with backup	for (i=0; i<NUM_FILESYSTEMS; i++) {    	if (fs_list[i] == '*') {    		if (strcmp(tfs[i], root_fs)) {    			sel_fs[j] = i;    			options[j] = (string)malloc(32);    			sprintf(options[j++], "to %s with backup", tfs[i]);    		}    	}    	else break;    }    options[j++] = "";	// without backup	for (i=0; i<NUM_FILESYSTEMS; i++) {    	if (fs_list[i] == '*') {    		if (strcmp(tfs[i], root_fs)) {    			sel_fs[j] = i;    			options[j] = (string)malloc(32);    			sprintf(options[j++], "to %s through format", tfs[i]);    		}    	}    	else break;    }    options[j] = NULL;    int chosen_item = get_menu_selection(headers, options, 0);    if (chosen_item == GO_BACK)        return 1;    if (chosen_item < i) {        // with backup        if (!confirm_selection(confirm_convert, confirm))            return 1;    	ui_set_background(BACKGROUND_ICON_INSTALLING);        ui_show_indeterminate_progress();    	// mount $root    	if (0 != ensure_root_path_mounted(root)) {    		ui_print("Can't mount %s for backup/n", root);    		return -1;    	}    	// check size of $root    	struct statfs stat_root;    	if (0 != statfs(get_mount_point_for_root(root), &stat_root)) {    		ui_print("Can't get size of %s/n", root);    		return -1;    	}    	// mount SDCARD    	if (0 != ensure_root_path_mounted("SDCARD:")) {    		ui_print("Can't mount sdcard for backup/n", root);    		return -1;    	}    	// check size SD    	struct statfs stat_sd;    	if (0 != statfs(get_mount_point_for_root("SDCARD:"), &stat_sd)) {    		ui_print("Can't get size of sdcard/n");    		return -1;    	}        uint64_t root_fsize = (uint64_t)(stat_root.f_blocks-stat_root.f_bfree)*(uint64_t)stat_root.f_bsize;        uint64_t sd_free_size = (uint64_t)stat_sd.f_bfree*(uint64_t)stat_sd.f_bsize;        ui_print("SD free: %lluMB / need: %lluMB/n", sd_free_size/(1024*1024), root_fsize/(1024*1024));        if (root_fsize > sd_free_size) {        	ui_print("Can't backup need: %lluMB on SD/n", root_fsize/(1024*1024));        	return -1;        }    	// create folder for backup [/sdcard/ebrecovery/tmp] [mkdir -p /sdcard/ebrecovery/tmp]    	if (0 != __system("mkdir -p /sdcard/ebrecovery/tmp")) {    		ui_print("Can't create tmp folder for backup/n");    		return -1;    	}        ui_show_progress(0.3, root_fsize*30/(140*1024*1024));//.........这里部分代码省略.........
开发者ID:eugene373,项目名称:BeHold-2-Recovery-1,代码行数:101,


示例18: twrp_restore

int twrp_restore(const char* backup_path) {    Backup_Size = 0; // by default, do not calculate size    // progress bar will be of indeterminate progress    // setting nandroid_files_total = 0 will force this in nandroid_callback()    ui_set_background(BACKGROUND_ICON_INSTALLING);    nandroid_files_total = 0;    nandroid_start_msec = timenow_msec();#ifdef PHILZ_TOUCH_RECOVERY    // support dim screen timeout during nandroid operation    last_key_ev = timenow_msec();#endif    if (ensure_path_mounted(backup_path) != 0)        return print_and_error("Can't mount backup path/n", NANDROID_ERROR_GENERAL);    char tmp[PATH_MAX];    if (enable_md5sum.value) {        if (0 != check_twrp_md5sum(backup_path))            return print_and_error("MD5 mismatch!/n", NANDROID_ERROR_GENERAL);    }    ui_show_indeterminate_progress(); // call after verify_nandroid_md5sum() as it will reset the progress    int ret;    if (backup_boot && volume_for_path(BOOT_PARTITION_MOUNT_POINT) != NULL &&            0 != (ret = nandroid_restore_partition(backup_path, BOOT_PARTITION_MOUNT_POINT)))        return print_and_error(NULL, ret);    if (backup_recovery && volume_for_path("/recovery") != NULL &&            0 != (ret = nandroid_restore_partition(backup_path, "/recovery")))        return print_and_error(NULL, ret);#ifdef BOARD_USE_MTK_LAYOUT    if ((backup_boot || backup_recovery) && volume_for_path("/uboot") != NULL &&            0 != (ret = nandroid_restore_partition(backup_path, "/uboot")))        return print_and_error(NULL, ret);#endif    Volume *vol = volume_for_path("/efs");    if (backup_efs == RESTORE_EFS_TAR && vol != NULL) {        if (0 != (ret = nandroid_restore_partition(backup_path, "/efs")))            return print_and_error(NULL, ret);    }    vol = volume_for_path("/misc");    if (backup_misc && vol != NULL) {        if (0 != (ret = nandroid_restore_partition(backup_path, "/misc")))            return print_and_error(NULL, ret);    }    vol = volume_for_path("/modem");    if (backup_modem == RAW_IMG_FILE && vol != NULL) {        if (0 != (ret = nandroid_restore_partition(backup_path, "/modem")))            return print_and_error(NULL, ret);    }    vol = volume_for_path("/radio");    if (backup_radio == RAW_IMG_FILE && vol != NULL) {        if (0 != (ret = nandroid_restore_partition(backup_path, "/radio")))            return print_and_error(NULL, ret);    }    if (backup_system && 0 != (ret = nandroid_restore_partition(backup_path, "/system")))        return print_and_error(NULL, ret);    vol = volume_for_path("/preload");    if (backup_preload && vol != NULL) {        if (0 != (ret = nandroid_restore_partition(backup_path, "/preload")))            return print_and_error(NULL, ret);    }    if (backup_data && 0 != (ret = nandroid_restore_partition(backup_path, "/data")))        return print_and_error(NULL, ret);            if (has_datadata()) {        if (backup_data && 0 != (ret = nandroid_restore_partition(backup_path, "/datadata")))            return print_and_error(NULL, ret);    }    // handle .android_secure on external and internal storage    set_android_secure_path(tmp);    if (backup_data && android_secure_ext) {        if (0 != (ret = nandroid_restore_partition_extended(backup_path, tmp, 0)))            return print_and_error(NULL, ret);    }    if (backup_cache && 0 != (ret = nandroid_restore_partition_extended(backup_path, "/cache", 0)))        return print_and_error(NULL, ret);    if (backup_sdext && 0 != (ret = nandroid_restore_partition(backup_path, "/sd-ext")))        return print_and_error(NULL, ret);    // handle extra partitions    int i;    int extra_partitions_num = get_extra_partitions_state();    for (i = 0; i < extra_partitions_num; ++i) {        if (extra_partition[i].backup_state && 0 != (ret = nandroid_restore_partition(backup_path, extra_partition[i].mount_point)))            return print_and_error(NULL, ret);    }//.........这里部分代码省略.........
开发者ID:Shoxxy,项目名称:PhilMeHd7aio,代码行数:101,


示例19: main

//.........这里部分代码省略.........    }    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) {            copy_logs();            ui_print("Installation aborted./n");        }    } else if (update_ubuntu_package != NULL) {        LOGI("Performing Ubuntu update");        ui_set_background(BACKGROUND_ICON_INSTALLING);        ui_show_indeterminate_progress();        ui_print("Installing Ubuntu update./n");        char tmp[PATH_MAX];        sprintf(tmp, "%s %s", UBUNTU_UPDATE_SCRIPT, UBUNTU_COMMAND_FILE );        __system(tmp);        LOGI("Ubuntu update complete");        ui_print("Ubuntu update complete./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) {            copy_logs();            ui_print("Data wipe failed./n");        }    } else if (wipe_cache) {        if (wipe_cache && erase_volume("/cache")) status = INSTALL_ERROR;        if (status != INSTALL_SUCCESS) {            copy_logs();            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;        if (!headless) {
开发者ID:cherojeong,项目名称:utopic,代码行数:67,


示例20: runve

//.........这里部分代码省略.........    int num_headers;    int num_chks;    float cur_progress;    char** items = NULL;    char** headers = NULL;    char** chks = NULL;        int i = 0; // iterator for menu items    int j = 0; // iterator for menu headers    int k = 0; // iterator for check menu items    int l = 0;  // iterator for outputting flags from check menu    int flags = INT_MAX;    int choice;        while (fgets(cur_line,100,from)!=NULL) {	printf(cur_line);	tok=strtok(cur_line," /n");	if(tok==NULL) {continue;}	if(strcmp(tok,"*")==0) {	    tok=strtok(NULL," /n");	    if(tok==NULL) {continue;}	    if(strcmp(tok,"ptotal")==0) {		ui_set_progress(0.0);		ui_show_progress(1.0,0);		total_lines=atoi(strtok(NULL," "));	    } else if (strcmp(tok,"print")==0) {		ui_print(strtok(NULL,""));	    } else if (strcmp(tok,"items")==0) {		num_items=atoi(strtok(NULL," /n"));		if(items!=NULL) free(items);		items=calloc((num_items+1),sizeof(char*));		items[num_items]=NULL;		i=0;	    } else if (strcmp(tok,"item")==0) {		if (i < num_items) {		    tok=strtok(NULL,"/n");		    items[i]=calloc((strlen(tok)+1),sizeof(char));		    strcpy(items[i],tok);		    i++;		}	    } else if (strcmp(tok,"headers")==0) {		num_headers=atoi(strtok(NULL," /n"));		if(headers!=NULL) free(headers);		headers=calloc((num_headers+1),sizeof(char*));		headers[num_headers]=NULL;		j=0;	    } else if (strcmp(tok,"header")==0) {		if (j < num_headers) {		    tok=strtok(NULL,"/n");		    if (tok) {			headers[j]=calloc((strlen(tok)+1),sizeof(char));			strcpy(headers[j],tok);		    } else {			headers[j]="";		    }		    j++;		}	    } else if (strcmp(tok,"show_menu")==0) {		choice=get_menu_selection(headers,items,0,0);		fprintf(to, "%d/n", choice);		fflush(to);	    } else if (strcmp(tok,"pcur")==0) {		cur_lines=atoi(strtok(NULL,"/n"));		if (cur_lines%10==0 || total_lines-cur_lines<10) {		    cur_progress=(float)cur_lines/((float)total_lines);		    ui_set_progress(cur_progress);		}		if (cur_lines==total_lines) ui_reset_progress();	    } else if (strcmp(tok,"check_items")==0) {		num_chks=atoi(strtok(NULL," /n"));		if(chks!=NULL) free(chks);		chks=calloc((num_chks+1),sizeof(char*));		chks[num_chks]=NULL;		k = 0;	    } else if (strcmp(tok,"check_item")==0) {		if (k < num_chks) {		    tok=strtok(NULL,"/n");		    chks[k]=calloc(strlen(tok)+1,sizeof(char));		    strcpy(chks[k],tok);		    k++;		}	    } else if (strcmp(tok,"show_check_menu")==0) {		show_check_menu(headers,chks,&flags);		for(l=0;l<num_chks;l++) {		    fprintf(to, "%d/n", !!(flags&(1<<l)));		}		fflush(to);	    } else if (strcmp(tok,"show_indeterminate_progress")==0) {		ui_show_indeterminate_progress();	    } else {ui_print("unrecognized command "); ui_print(tok); ui_print("/n");}	}    }    while (waitpid(pid, &status, WNOHANG) == 0) {	sleep(1);    }    ui_print("/n");    free(cur_line);    return status;}
开发者ID:cvpcs,项目名称:android_bootable_recovery,代码行数:101,


示例21: erase_volume

// remove static to be able to call it from ors menuinterase_volume(const char *volume) {    bool is_cache = (strcmp(volume, CACHE_ROOT) == 0);    int icon = ui_get_background_icon();    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_show_indeterminate_progress();    saved_log_file* head = NULL;    if (is_cache) {        // If we're reformatting /cache, we load any        // "/cache/recovery/last*" files into memory, so we can restore        // them after the reformat.        ensure_path_mounted(volume);        DIR* d;        struct dirent* de;        d = opendir(CACHE_LOG_DIR);        if (d) {            char path[PATH_MAX];            strcpy(path, CACHE_LOG_DIR);            strcat(path, "/");            int path_len = strlen(path);            while ((de = readdir(d)) != NULL) {                if (strncmp(de->d_name, "last", 4) == 0) {                    saved_log_file* p = (saved_log_file*) malloc(sizeof(saved_log_file));                    strcpy(path+path_len, de->d_name);                    p->name = strdup(path);                    if (stat(path, &(p->st)) == 0) {                        // truncate files to 512kb                        if (p->st.st_size > (1 << 19)) {                            p->st.st_size = 1 << 19;                        }                        p->data = (unsigned char*) malloc(p->st.st_size);                        FILE* f = fopen(path, "rb");                        fread(p->data, 1, p->st.st_size, f);                        fclose(f);                        p->next = head;                        head = p;                    } else {                        free(p);                    }                }            }            closedir(d);        } else {            if (errno != ENOENT) {                printf("opendir failed: %s/n", strerror(errno));            }        }    }    ui_print("Formatting %s.../n", volume);    ensure_path_unmounted(volume);    int result = format_volume(volume);    if (is_cache) {        while (head) {            FILE* f = fopen_path(head->name, "wb");            if (f) {                fwrite(head->data, 1, head->st.st_size, f);                fclose(f);                chmod(head->name, head->st.st_mode);                chown(head->name, head->st.st_uid, head->st.st_gid);            }            free(head->name);            free(head->data);            saved_log_file* temp = head->next;            free(head);            head = temp;        }        // Any part of the log we'd copied to cache is now gone.        // Reset the pointer so we copy from the beginning of the temp        // log.        tmplog_offset = 0;        copy_logs();    }    ui_set_background(icon);    ui_reset_progress();    return result;}
开发者ID:Xanwar,项目名称:android_bootable_recovery-philz,代码行数:87,


示例22: install_package

intinstall_package(const char *root_path){	recovery_status = 0;	int status = INSTALL_SUCCESS;    ui_set_background(BACKGROUND_ICON_INSTALLING);    ui_print("Finding update package.../n");    ui_show_indeterminate_progress();    if (ensure_root_path_mounted(root_path) != 0) {        ui_print("Can't mount %s/n", root_path);        status = INSTALL_CORRUPT;		goto exit;    }    char path[PATH_MAX] = "";    if (translate_root_path(root_path, path, sizeof(path)) == NULL) {        ui_print("Bad path %s/n", root_path);        status = INSTALL_CORRUPT;		goto exit;    }	printf("package name = '%s'/t path_len= %d/n",path,strlen(path));    ui_print("Opening update package.../n");#if 0    int numKeys;    RSAPublicKey* loadedKeys = load_keys(PUBLIC_KEYS_FILE, &numKeys);    if (loadedKeys == NULL) {        LOGE("Failed to load keys/n");        return INSTALL_CORRUPT;    }    LOGI("%d key(s) loaded from %s/n", numKeys, PUBLIC_KEYS_FILE);    // Give verification half the progress bar...    ui_print("Verifying update package.../n");    ui_show_progress(            VERIFICATION_PROGRESS_FRACTION,            VERIFICATION_PROGRESS_TIME);    int err;    err = verify_file(path, loadedKeys, numKeys);    free(loadedKeys);    LOGI("verify_file returned %d/n", err);    if (err != VERIFY_SUCCESS) {        LOGE("signature verification failed/n");        return INSTALL_CORRUPT;    }#endif    /* Try to open the package.     */    int err;    ZipArchive zip;    err = mzOpenZipArchive(path, &zip);    if (err != 0) {        ui_print("Can't open %s/n(%s)/n", path, err != -1 ? strerror(err) : "bad");        status = INSTALL_CORRUPT;		goto exit;    }	/*	 * Verify hw version 	 */	/*	if (check_hw_version(&zip)) {		ui_print("HW version doesn't match!!!");		status = INSTALL_CORRUPT;    	mzCloseZipArchive(&zip);		goto exit;	}*/    /* Verify and install the contents of the package.     */	ui_print("start update package file/n");    status = handle_update_package(path, &zip);	ui_print("install_success!!!/n");    mzCloseZipArchive(&zip);exit:	ensure_root_path_unmounted(root_path);	if (status != INSTALL_SUCCESS)		recovery_status = 1;	else		recovery_status = 0;    return status;}
开发者ID:zenki2001cn,项目名称:SnippetCode,代码行数:86,



注:本文中的ui_show_indeterminate_progress函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ui_text_visible函数代码示例
C++ ui_set_background函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。