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.
This commit is contained in:
Dees_Troy 2012-09-20 15:32:13 -04:00
parent 2a92358be3
commit c51f1f994a
5 changed files with 60 additions and 4 deletions

View File

@ -44,6 +44,7 @@
<variable name="col1_x" value="10" />
<variable name="col2_x" value="277" />
<variable name="col_center_x" value="143" />
<variable name="col_center_medium_x" value="206" />
<variable name="center_x" value="270" />
<variable name="row1_y" value="140" />
<variable name="row2_y" value="332" />
@ -785,6 +786,9 @@
<action function="set">tw_has_action2=0</action>
<action function="set">tw_action2=</action>
<action function="set">tw_action2_param=</action>
<action function="set">tw_has_cancel=0</action>
<action function="set">tw_cancel_action=</action>
<action function="set">tw_cancel_param=</action>
<action function="page">%tw_clear_destination%</action>
</object>
</page>
@ -867,6 +871,15 @@
<object type="template" name="action_page_console" />
<object type="button">
<condition var1="tw_has_cancel" var2="1" />
<placement x="%col_center_medium_x%" y="%row4_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="medium_button" />
<action function="%tw_cancel_action%">%tw_cancel_param%</action>
</object>
<object type="template" name="progress_bar" />
<object type="action">
@ -2530,6 +2543,31 @@
<action function="page">terminalfolder</action>
</object>
<object type="button">
<placement x="%col2_x%" y="%row3_y%" />
<font resource="font" color="%button_text_color%" />
<text>Reload Theme</text>
<image resource="main_button" />
<action function="reload"></action>
</object>
<object type="button">
<placement x="%col1_x%" y="%row4_y%" />
<font resource="font" color="%button_text_color%" />
<text>ADB Sideload</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=advanced</action>
<action function="set">tw_action=adbsideload</action>
<action function="set">tw_action_text1=ADB Sideload</action>
<action function="set">tw_action_text2=Usage: adb sideload filename.zip</action>
<action function="set">tw_complete_text1=ADB Sideload Complete</action>
<action function="set">tw_has_cancel=1</action>
<action function="set">tw_cancel_action=adbsideloadcancel</action>
<action function="page">action_page</action>
</actions>
</object>
<object type="button">
<condition var1="tw_show_dumlock" var2="1" />
<placement x="%col2_x%" y="%row4_y%" />

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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.