summaryrefslogtreecommitdiffstats
path: root/partitionmanager.cpp
diff options
context:
space:
mode:
authorTom Hite <tdhite@gmail.com>2014-09-15 03:31:03 +0200
committerDees Troy <dees_troy@teamw.in>2014-10-08 19:35:32 +0200
commit5a9267283c05ba70822ae27a8496c95cdd4a1058 (patch)
tree57c58881136d29aa6a5d4b5db4dbc91935df0434 /partitionmanager.cpp
parentmtp: cleanup, fixes and performance improvements (diff)
downloadandroid_bootable_recovery-5a9267283c05ba70822ae27a8496c95cdd4a1058.tar
android_bootable_recovery-5a9267283c05ba70822ae27a8496c95cdd4a1058.tar.gz
android_bootable_recovery-5a9267283c05ba70822ae27a8496c95cdd4a1058.tar.bz2
android_bootable_recovery-5a9267283c05ba70822ae27a8496c95cdd4a1058.tar.lz
android_bootable_recovery-5a9267283c05ba70822ae27a8496c95cdd4a1058.tar.xz
android_bootable_recovery-5a9267283c05ba70822ae27a8496c95cdd4a1058.tar.zst
android_bootable_recovery-5a9267283c05ba70822ae27a8496c95cdd4a1058.zip
Diffstat (limited to '')
-rw-r--r--partitionmanager.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index b2d7b4e02..721537496 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -651,9 +651,11 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde
pos = section_time / (float) total_time;
//DataManager::ShowProgress(pos, section_time);
+ TWFunc::SetPerformanceMode(true);
time(&start);
if (Part->Backup(Backup_Folder, &total_size, &current_size)) {
+ bool md5Success = false;
current_size += Part->Backup_Size;
pos = (float)((float)(current_size) / (float)(total_size));
DataManager::SetProgress(pos);
@@ -662,12 +664,16 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde
for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
if ((*subpart)->Can_Be_Backed_Up && (*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point) {
- if (!(*subpart)->Backup(Backup_Folder, &total_size, &current_size))
+ if (!(*subpart)->Backup(Backup_Folder, &total_size, &current_size)) {
+ TWFunc::SetPerformanceMode(false);
return false;
+ }
sync();
sync();
- if (!Make_MD5(generate_md5, Backup_Folder, (*subpart)->Backup_FileName))
+ if (!Make_MD5(generate_md5, Backup_Folder, (*subpart)->Backup_FileName)) {
+ TWFunc::SetPerformanceMode(false);
return false;
+ }
if (Part->Backup_Method == 1) {
*file_bytes_remaining -= (*subpart)->Backup_Size;
} else {
@@ -689,8 +695,12 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde
*img_bytes_remaining -= Part->Backup_Size;
*img_time += backup_time;
}
- return Make_MD5(generate_md5, Backup_Folder, Part->Backup_FileName);
+
+ md5Success = Make_MD5(generate_md5, Backup_Folder, Part->Backup_FileName);
+ TWFunc::SetPerformanceMode(false);
+ return md5Success;
} else {
+ TWFunc::SetPerformanceMode(false);
return false;
}
}
@@ -862,21 +872,27 @@ int TWPartitionManager::Run_Backup(void) {
bool TWPartitionManager::Restore_Partition(TWPartition* Part, string Restore_Name, int partition_count, const unsigned long long *total_restore_size, unsigned long long *already_restored_size) {
time_t Start, Stop;
+ TWFunc::SetPerformanceMode(true);
time(&Start);
//DataManager::ShowProgress(1.0 / (float)partition_count, 150);
- if (!Part->Restore(Restore_Name, total_restore_size, already_restored_size))
+ if (!Part->Restore(Restore_Name, total_restore_size, already_restored_size)) {
+ TWFunc::SetPerformanceMode(false);
return false;
+ }
if (Part->Has_SubPartition) {
std::vector<TWPartition*>::iterator subpart;
for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) {
if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point) {
- if (!(*subpart)->Restore(Restore_Name, total_restore_size, already_restored_size))
+ if (!(*subpart)->Restore(Restore_Name, total_restore_size, already_restored_size)) {
+ TWFunc::SetPerformanceMode(false);
return false;
+ }
}
}
}
time(&Stop);
+ TWFunc::SetPerformanceMode(false);
gui_print("[%s done (%d seconds)]\n\n", Part->Backup_Display_Name.c_str(), (int)difftime(Stop, Start));
return true;
}