Fix backup and restore after autodetection for SAR

This reverts commit 8a411c8d25.

 * 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
This commit is contained in:
dianlujitao
2020-05-10 21:35:01 +00:00
committed by bigbiff
parent 65633a46d0
commit b76a73a1a9
3 changed files with 19 additions and 13 deletions
+4 -6
View File
@@ -417,12 +417,10 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
else
return true;
} else if (Mount_Point == "auto") {
Mount_Point = "/auto";
char autoi[5];
sprintf(autoi, "%i", auto_index);
Mount_Point += autoi;
Mount_Point = "/auto" + to_string(auto_index);
Backup_Path = Mount_Point;
Storage_Path = Mount_Point;
Backup_Name = Mount_Point.substr(1);
auto_index++;
Setup_File_System(Display_Error);
Display_Name = "Storage";
@@ -442,8 +440,10 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
} else if (Is_File_System(Fstab_File_System)) {
Find_Actual_Block_Device();
Setup_File_System(Display_Error);
Backup_Name = Display_Name = Mount_Point.substr(1, Mount_Point.size() - 1);
if (Mount_Point == "/" || Mount_Point == "/system" || Mount_Point == "/system_root") {
Display_Name = "System";
Backup_Name = "system";
Backup_Display_Name = Display_Name;
Storage_Name = Display_Name;
Wipe_Available_in_GUI = true;
@@ -1092,8 +1092,6 @@ void TWPartition::Setup_File_System(bool Display_Error) {
// Make the mount point folder if it doesn't exist
Make_Dir(Mount_Point, Display_Error);
Display_Name = Mount_Point.substr(1, Mount_Point.size() - 1);
Backup_Name = Display_Name;
Backup_Method = BM_FILES;
}