summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adbbu/twadbstream.h2
-rw-r--r--adbbu/twrpback.cpp2
-rw-r--r--openrecoveryscript.cpp1
-rw-r--r--partition.cpp8
-rw-r--r--partitionmanager.cpp4
-rw-r--r--partitions.hpp2
-rw-r--r--twrpTar.cpp2
7 files changed, 18 insertions, 3 deletions
diff --git a/adbbu/twadbstream.h b/adbbu/twadbstream.h
index 4e76be165..23d4a1fea 100644
--- a/adbbu/twadbstream.h
+++ b/adbbu/twadbstream.h
@@ -21,7 +21,7 @@
#define TW_ADB_BU_CONTROL "/tmp/twadbbucontrol" //FIFO for sending control from TWRP to ADB Backup
#define TW_ADB_TWRP_CONTROL "/tmp/twadbtwrpcontrol" //FIFO for sending control from ADB Backup to TWRP
#define TWRP "TWRP" //Magic Value
-#define ADB_BU_MAX_ERROR 10 //Max amount of errors for while loops
+#define ADB_BU_MAX_ERROR 20 //Max amount of errors for while loops
//ADB Backup Control Commands
#define TWSTREAMHDR "twstreamheader" //TWRP Parititon Count Control
diff --git a/adbbu/twrpback.cpp b/adbbu/twrpback.cpp
index 2a227ecb1..c59fd1cda 100644
--- a/adbbu/twrpback.cpp
+++ b/adbbu/twrpback.cpp
@@ -514,7 +514,6 @@ int twrpback::restore(void) {
return -1;
}
}
-
//If we should read from the adb stream, write commands and data to TWRP
if (read_from_adb) {
std::string cmdstr;
@@ -547,6 +546,7 @@ int twrpback::restore(void) {
close_restore_fds();
return -1;
}
+ read_from_adb = false;
}
else {
adblogwrite("ADB TWENDADB crc header doesn't match\n");
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index b45cf0a4b..faa0f9ca1 100644
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -903,6 +903,7 @@ int OpenRecoveryScript::Restore_ADB_Backup(void) {
part_settings.partition_count = partition_count;
part_settings.adbbackup = true;
part_settings.adb_compression = twimghdr.compressed;
+ part_settings.Part->Set_Backup_FileName(part_settings.Part->Get_Backup_Name() + "." + part_settings.Part->Current_File_System + ".win");
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);
diff --git a/partition.cpp b/partition.cpp
index 8832909fe..f523ddf85 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -2947,3 +2947,11 @@ void TWPartition::Revert_Adopted() {
LOGINFO("Revert_Adopted: no crypto support\n");
#endif
}
+
+void TWPartition::Set_Backup_FileName(string fname) {
+ Backup_FileName = fname;
+}
+
+string TWPartition::Get_Backup_Name() {
+ return Backup_Name;
+}
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 8aceec268..0b9918d53 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -915,6 +915,10 @@ int TWPartitionManager::Run_Backup(bool adbbackup) {
bool TWPartitionManager::Restore_Partition(PartitionSettings *part_settings) {
time_t Start, Stop;
+ if (part_settings->adbbackup) {
+ part_settings->Part->Set_Backup_FileName(part_settings->Part->Backup_Name + "." + part_settings->Part->Current_File_System + ".win");
+ }
+
TWFunc::SetPerformanceMode(true);
time(&Start);
diff --git a/partitions.hpp b/partitions.hpp
index 0f0e6fd30..0865c9636 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -106,6 +106,8 @@ public:
int Decrypt_Adopted();
void Revert_Adopted();
void Partition_Post_Processing(bool Display_Error); // Apply partition specific settings after fstab processed
+ void Set_Backup_FileName(string fname); // Set Backup_FileName for partition
+ string Get_Backup_Name(); // Get Backup_Name for partition
public:
string Current_File_System; // Current file system
diff --git a/twrpTar.cpp b/twrpTar.cpp
index 39117331f..d86e13382 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -1463,7 +1463,7 @@ int twrpTar::entryExists(string entry) {
}
unsigned long long twrpTar::get_size() {
- if (TWFunc::Path_Exists(tarfn) && !part_settings->adbbackup) {
+ if (part_settings->adbbackup || TWFunc::Path_Exists(tarfn)) {
LOGINFO("Single archive\n");
return uncompressedSize(tarfn);
} else {