From c51f1f994ada7b46224f672481c0dacf3894c70b Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Thu, 20 Sep 2012 15:32:13 -0400 Subject: Various fixes Modify AOSP mount and wipe functions to use Partition Manager. Update wipe code to reset the log file index when wiping cache. Add ADB sideload to 540x960 theme. --- gui/devices/540x960/res/ui.xml | 38 ++++++++++++++++++++++++++++++++++++++ partition.cpp | 7 +++++++ partitionmanager.cpp | 4 +--- roots.cpp | 13 +++++++++++++ twinstall.cpp | 2 +- 5 files changed, 60 insertions(+), 4 deletions(-) diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index 0d7fa3ecf..398764127 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -44,6 +44,7 @@ + @@ -785,6 +786,9 @@ tw_has_action2=0 tw_action2= tw_action2_param= + tw_has_cancel=0 + tw_cancel_action= + tw_cancel_param= %tw_clear_destination% @@ -867,6 +871,15 @@ + + + + + Cancel + + %tw_cancel_param% + + @@ -2530,6 +2543,31 @@ terminalfolder + + + + Reload Theme + + + + + + + + ADB Sideload + + + tw_back=advanced + tw_action=adbsideload + tw_action_text1=ADB Sideload + tw_action_text2=Usage: adb sideload filename.zip + tw_complete_text1=ADB Sideload Complete + tw_has_cancel=1 + tw_cancel_action=adbsideloadcancel + action_page + + + diff --git a/partition.cpp b/partition.cpp index ad3198ba7..341dee704 100644 --- a/partition.cpp +++ b/partition.cpp @@ -42,6 +42,7 @@ extern "C" { #include "mtdutils/mtdutils.h" #include "mtdutils/mounts.h" #include "makelist.h" + #include "extra-functions.h" } TWPartition::TWPartition(void) { @@ -217,16 +218,19 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) { Wipe_During_Factory_Reset = true; Display_Name = "SD-Ext"; Wipe_Available_in_GUI = true; + Removable = true; } #ifdef TW_EXTERNAL_STORAGE_PATH if (Mount_Point == EXPAND(TW_EXTERNAL_STORAGE_PATH)) { Is_Storage = true; Storage_Path = EXPAND(TW_EXTERNAL_STORAGE_PATH); + Removable = true; } #else if (Mount_Point == "/sdcard") { Is_Storage = true; Storage_Path = "/sdcard"; + Removable = true; } #endif #ifdef TW_INTERNAL_STORAGE_PATH @@ -662,6 +666,9 @@ bool TWPartition::Wipe() { return false; } + if (Mount_Point == "/cache") + tmplog_offset = 0; + if (Has_Data_Media) return Wipe_Data_Without_Wiping_Media(); diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 2bcbc2713..2e0219e01 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -413,11 +413,10 @@ bool TWPartitionManager::Make_MD5(bool generate_md5, string Backup_Folder, strin if (!generate_md5) return true; - ui_print(" * Generating md5..."); + ui_print(" * Generating md5...\n"); if (TWFunc::Path_Exists(Full_File)) { sprintf(command, "cd '%s' && md5sum %s > %s.md5",Backup_Folder.c_str(), Backup_Filename.c_str(), Backup_Filename.c_str()); - LOGI("MD5 command is: '%s'\n", command); if (system(command) == 0) { ui_print("MD5 Created.\n"); return true; @@ -432,7 +431,6 @@ bool TWPartitionManager::Make_MD5(bool generate_md5, string Backup_Folder, strin sprintf(filename, "%s%03i", Full_File.c_str(), index); while (TWFunc::Path_Exists(filename) == true) { sprintf(command, "cd '%s' && md5sum %s%03i > %s%03i.md5",Backup_Folder.c_str(), Backup_Filename.c_str(), index, Backup_Filename.c_str(), index); - LOGI("MD5 command is: '%s'\n", command); if (system(command) != 0) { ui_print("MD5 Error.\n"); return false; diff --git a/roots.cpp b/roots.cpp index 69c98fc1d..9cbaa499a 100644 --- a/roots.cpp +++ b/roots.cpp @@ -29,6 +29,7 @@ extern "C" { #include "roots.h" #include "common.h" #include "make_ext4fs.h" +#include "partitions.hpp" static int num_volumes = 0; static Volume* device_volumes = NULL; @@ -142,6 +143,10 @@ Volume* volume_for_path(const char* path) { } int ensure_path_mounted(const char* path) { + if (PartitionManager.Mount_By_Path(path, true)) + return 0; + else + return -1; Volume* v = volume_for_path(path); if (v == NULL) { LOGE("unknown volume for path [%s]\n", path); @@ -202,6 +207,10 @@ int ensure_path_mounted(const char* path) { } int ensure_path_unmounted(const char* path) { + if (PartitionManager.UnMount_By_Path(path, true)) + return 0; + else + return -1; Volume* v = volume_for_path(path); if (v == NULL) { LOGE("unknown volume for path [%s]\n", path); @@ -230,6 +239,10 @@ int ensure_path_unmounted(const char* path) { } int format_volume(const char* volume) { + if (PartitionManager.Wipe_By_Path(volume)) + return 0; + else + return -1; Volume* v = volume_for_path(volume); if (v == NULL) { LOGE("unknown volume \"%s\"\n", volume); diff --git a/twinstall.cpp b/twinstall.cpp index af5325698..4bc69424e 100644 --- a/twinstall.cpp +++ b/twinstall.cpp @@ -287,7 +287,7 @@ extern "C" int TWinstall_zip(const char* path, int* wipe_cache) { LOGE("No MD5 file found for '%s'.\nDisable force MD5 check to avoid this error.\n", path); return INSTALL_CORRUPT; } else - ui_print("No MD5 file found, this is not an error.\n"); + ui_print("Skipping MD5 check: no MD5 file found.\n"); } else if (md5_return == 1) ui_print("Zip MD5 matched.\n"); // MD5 found and matched. -- cgit v1.2.3