diff options
Diffstat (limited to 'extra-functions.c')
-rw-r--r-- | extra-functions.c | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/extra-functions.c b/extra-functions.c index e01ab83b4..952c091ee 100644 --- a/extra-functions.c +++ b/extra-functions.c @@ -339,102 +339,6 @@ int usb_storage_disable(void) return 0; } -void wipe_dalvik_cache() -{ - //ui_set_background(BACKGROUND_ICON_WIPE); - ensure_path_mounted("/data"); - ensure_path_mounted("/cache"); - ui_print("\n-- Wiping Dalvik Cache Directories...\n"); - __system("rm -rf /data/dalvik-cache"); - ui_print("Cleaned: /data/dalvik-cache...\n"); - __system("rm -rf /cache/dalvik-cache"); - ui_print("Cleaned: /cache/dalvik-cache...\n"); - __system("rm -rf /cache/dc"); - ui_print("Cleaned: /cache/dc\n"); - - struct stat st; - LOGE("TODO: Re-implement wipe dalvik into Partition Manager!\n"); - if (1) //if (0 != stat(sde.blk, &st)) - { - ui_print("/sd-ext not present, skipping\n"); - } else { - __system("mount /sd-ext"); - LOGI("Mounting /sd-ext\n"); - if (stat("/sd-ext/dalvik-cache",&st) == 0) - { - __system("rm -rf /sd-ext/dalvik-cache"); - ui_print("Cleaned: /sd-ext/dalvik-cache...\n"); - } - } - ensure_path_unmounted("/data"); - ui_print("-- Dalvik Cache Directories Wipe Complete!\n\n"); - //ui_set_background(BACKGROUND_ICON_MAIN); - //if (!ui_text_visible()) return; -} - -// BATTERY STATS -void wipe_battery_stats() -{ - ensure_path_mounted("/data"); - struct stat st; - if (0 != stat("/data/system/batterystats.bin", &st)) - { - ui_print("No Battery Stats Found. No Need To Wipe.\n"); - } else { - //ui_set_background(BACKGROUND_ICON_WIPE); - remove("/data/system/batterystats.bin"); - ui_print("Cleared: Battery Stats...\n"); - ensure_path_unmounted("/data"); - } -} - -// ROTATION SETTINGS -void wipe_rotate_data() -{ - //ui_set_background(BACKGROUND_ICON_WIPE); - ensure_path_mounted("/data"); - __system("rm -r /data/misc/akmd*"); - __system("rm -r /data/misc/rild*"); - ui_print("Cleared: Rotatation Data...\n"); - ensure_path_unmounted("/data"); -} - -void fix_perms() -{ - ensure_path_mounted("/data"); - ensure_path_mounted("/system"); - //ui_show_progress(1,30); - ui_print("\n-- Fixing Permissions\n"); - ui_print("This may take a few minutes.\n"); - __system("./sbin/fix_permissions.sh"); - ui_print("-- Done.\n\n"); - //ui_reset_progress(); -} - -int get_battery_level(void) -{ - static int lastVal = -1; - static time_t nextSecCheck = 0; - - struct timeval curTime; - gettimeofday(&curTime, NULL); - if (curTime.tv_sec > nextSecCheck) - { - char cap_s[4]; - FILE * cap = fopen("/sys/class/power_supply/battery/capacity","rt"); - if (cap) - { - fgets(cap_s, 4, cap); - fclose(cap); - lastVal = atoi(cap_s); - if (lastVal > 100) lastVal = 101; - if (lastVal < 0) lastVal = 0; - } - nextSecCheck = curTime.tv_sec + 60; - } - return lastVal; -} - void update_tz_environment_variables() { setenv("TZ", DataManager_GetStrValue(TW_TIME_ZONE_VAR), 1); tzset(); @@ -478,56 +382,6 @@ void run_script(const char *str1, const char *str2, const char *str3, const char //if (!ui_text_visible()) return; } -void install_htc_dumlock(void) -{ - struct statfs fs1, fs2; - int need_libs = 0; - - ui_print("Installing HTC Dumlock to system...\n"); - ensure_path_mounted("/system"); - __system("cp /res/htcd/htcdumlocksys /system/bin/htcdumlock && chmod 755 /system/bin/htcdumlock"); - if (statfs("/system/bin/flash_image", &fs1) != 0) { - ui_print("Installing flash_image...\n"); - __system("cp /res/htcd/flash_imagesys /system/bin/flash_image && chmod 755 /system/bin/flash_image"); - need_libs = 1; - } else - ui_print("flash_image is already installed, skipping...\n"); - if (statfs("/system/bin/dump_image", &fs2) != 0) { - ui_print("Installing dump_image...\n"); - __system("cp /res/htcd/dump_imagesys /system/bin/dump_image && chmod 755 /system/bin/dump_image"); - need_libs = 1; - } else - ui_print("dump_image is already installed, skipping...\n"); - if (need_libs) { - ui_print("Installing libs needed for flash_image and dump_image...\n"); - __system("cp /res/htcd/libbmlutils.so /system/lib && chmod 755 /system/lib/libbmlutils.so"); - __system("cp /res/htcd/libflashutils.so /system/lib && chmod 755 /system/lib/libflashutils.so"); - __system("cp /res/htcd/libmmcutils.so /system/lib && chmod 755 /system/lib/libmmcutils.so"); - __system("cp /res/htcd/libmtdutils.so /system/lib && chmod 755 /system/lib/libmtdutils.so"); - } - ui_print("Installing HTC Dumlock app...\n"); - ensure_path_mounted("/data"); - mkdir("/data/app", 0777); - __system("rm /data/app/com.teamwin.htcdumlock*"); - __system("cp /res/htcd/HTCDumlock.apk /data/app/com.teamwin.htcdumlock.apk"); - sync(); - ui_print("HTC Dumlock is installed.\n"); -} - -void htc_dumlock_restore_original_boot(void) -{ - ui_print("Restoring original boot...\n"); - __system("htcdumlock restore"); - ui_print("Original boot restored.\n"); -} - -void htc_dumlock_reflash_recovery_to_boot(void) -{ - ui_print("Reflashing recovery to boot...\n"); - __system("htcdumlock recovery noreboot"); - ui_print("Recovery is flashed to boot.\n"); -} - void check_and_run_script(const char* script_file, const char* display_name) { // Check for and run startup script if script exists |