Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5ecaad2 authored by bigbiff bigbiff's avatar bigbiff bigbiff
Browse files

ADB Backup: fix adb restore issues

Set Backup_FileName on adb backup to fix restore.
Set read_from_adb after EOF to return properly
from newer adb client prompt.
Create setter and getter for Backup_FileName
for openrecoveryscript.cpp which is not a
friend class.
Fix condition for twrpTar::Get_Size() and adb backup.
Change-Id: I7eb8168fa3416366b996e220cecbc0e1bcec5e8e
parent 76958ae9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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");
+1 −0
Original line number Diff line number Diff line
@@ -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);
+8 −0
Original line number Diff line number Diff line
@@ -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;
}
+4 −0
Original line number Diff line number Diff line
@@ -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);
Loading