Clean up PartitionSettings

The PartitionSettings struct contains some data elements that are duplicates
of data elements in the TWPartition class that is contained within the
PartitionsSettings.Part element. We will eliminate this duplication to help
reduce the chances for programming bugs.

Specifically, this fixes problems where the current file system does not
match the backed up file system.

Change-Id: I02f236e72093362050556a2e53a09d1dbb9a269d
This commit is contained in:
Ethan Yonker
2016-09-13 14:53:37 -05:00
parent ea2fcf0179
commit dcf2b674c4
5 changed files with 49 additions and 56 deletions
+1 -4
View File
@@ -840,11 +840,10 @@ int OpenRecoveryScript::Restore_ADB_Backup(void) {
pos = Restore_Name.find_last_of("/");
Backup_FileName = Restore_Name.substr(pos + 1, Restore_Name.size());
part_settings.Part = PartitionManager.Find_Partition_By_Path(path);
part_settings.Restore_Name = path;
part_settings.Backup_Folder = path;
part_settings.partition_count = partition_count;
part_settings.adbbackup = true;
part_settings.adb_compression = twimghdr.compressed;
part_settings.Backup_FileName = Backup_FileName;
part_settings.PM_Method = PM_RESTORE;
ProgressTracking progress(part_settings.total_restore_size);
part_settings.progress = &progress;
@@ -871,7 +870,6 @@ int OpenRecoveryScript::Restore_ADB_Backup(void) {
pos = Restore_Name.find_last_of("/");
Backup_FileName = Restore_Name.substr(pos + 1, Restore_Name.size());
pos = Restore_Name.find_last_of("/");
part_settings.Restore_Name = Restore_Name.substr(0, pos);
part_settings.Part = PartitionManager.Find_Partition_By_Path(path);
if (path.compare("/system") == 0) {
@@ -893,7 +891,6 @@ int OpenRecoveryScript::Restore_ADB_Backup(void) {
part_settings.partition_count = partition_count;
part_settings.adbbackup = true;
part_settings.adb_compression = twimghdr.compressed;
part_settings.Backup_FileName = Backup_FileName;
part_settings.total_restore_size += part_settings.Part->Get_Restore_Size(&part_settings);
part_settings.PM_Method = PM_RESTORE;
ProgressTracking progress(part_settings.total_restore_size);