sdcard: bind mount in post decrypt

also uncomment wiping code that should not be commented

Change-Id: I445f688628dcedb67544c22c7b0775ee62e0b267
This commit is contained in:
bigbiff
2021-04-24 11:48:54 -04:00
parent a957f078be
commit be4f46cbc3
3 changed files with 21 additions and 9 deletions
+18 -9
View File
@@ -1615,9 +1615,18 @@ bool TWPartition::Mount(bool Display_Error) {
if (Removable)
Update_Size(Display_Error);
if (!Symlink_Mount_Point.empty() && TWFunc::Path_Exists(Symlink_Path)) {
string Command = "/system/bin/mount -o bind '" + Symlink_Path + "' '" + Symlink_Mount_Point + "'";
TWFunc::Exec_Cmd(Command);
if (!Symlink_Mount_Point.empty()) {
if (!Bind_Mount(false))
return false;
}
return true;
}
bool TWPartition::Bind_Mount(bool Display_Error) {
if (TWFunc::Path_Exists(Symlink_Path)) {
if (mount(Symlink_Path.c_str(), Symlink_Mount_Point.c_str(), "", MS_BIND, NULL) < 0) {
return false;
}
}
return true;
}
@@ -1750,8 +1759,8 @@ bool TWPartition::Wipe(string New_File_System) {
}
}
// if (Is_Storage && Mount(false))
// PartitionManager.Add_MTP_Storage(MTP_Storage_ID);
if (Is_Storage && Mount(false))
PartitionManager.Add_MTP_Storage(MTP_Storage_ID);
}
return wiped;
@@ -2057,10 +2066,10 @@ bool TWPartition::Wipe_Encryption() {
Is_Encrypted = false;
if (Wipe(Fstab_File_System)) {
Has_Data_Media = Save_Data_Media;
// if (Has_Data_Media && !Symlink_Mount_Point.empty()) {
// if (Mount(false))
// PartitionManager.Add_MTP_Storage(MTP_Storage_ID);
// }
if (Has_Data_Media && !Symlink_Mount_Point.empty()) {
if (Mount(false))
PartitionManager.Add_MTP_Storage(MTP_Storage_ID);
}
DataManager::SetValue(TW_IS_ENCRYPTED, 0);
#ifndef TW_OEM_BUILD
gui_msg("format_data_msg=You may need to reboot recovery to be able to use /data again.");