Fix backup and restore after autodetection for SAR
This reverts commit 8a411c8d257bf37a31907fc44be7cedf447aad7f.
* Always use "/system" to interact with the frontend and replace it
with the detected path before taking actions.
* Don't replace the pretty display name and backup name set during
processing fstab after wipe. This improves UX and ensures that the
system backup is always named system.ext4.win despite the actual
mount point is /system_root so TWRP is able to recover either SAR or
non-SAR backups.
Change-Id: Ie2594d2678d0c75ce25c0d1087d47b035b3f10e9
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index f63b3f3..873b292 100755
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -599,6 +599,8 @@
std::vector<TWPartition*>::iterator iter;
string Local_Path = TWFunc::Get_Root_Path(Path);
+ if (Local_Path == "/system")
+ Local_Path = Get_Android_Root_Path();
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path))
return (*iter);
@@ -1273,8 +1275,12 @@
Part->Backup_FileName.resize(Part->Backup_FileName.size() - strlen(extn) + 3);
}
- if (!Part->Is_SubPartition)
- Restore_List += Part->Backup_Path + ";";
+ if (!Part->Is_SubPartition) {
+ if (Part->Backup_Path == Get_Android_Root_Path())
+ Restore_List += "/system;";
+ else
+ Restore_List += Part->Backup_Path + ";";
+ }
}
closedir(d);
}
@@ -1297,6 +1303,8 @@
bool found = false;
string Local_Path = TWFunc::Get_Root_Path(Path);
+ if (Local_Path == "/system")
+ Local_Path = Get_Android_Root_Path();
// Iterate through all partitions
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path)) {