From a500eaef7f9c62fa415ecbae49d948eb4fc5c580 Mon Sep 17 00:00:00 2001 From: Konsta Date: Sat, 19 Feb 2022 12:01:05 +0200 Subject: [PATCH] Revert "sdcard: only bind mount sdcard after successful preparation of data" This reverts commit 60bb9f63697697ebe0c525de1d85cae7ec395280. --- partition.cpp | 9 ++------- partitionmanager.cpp | 10 +++------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/partition.cpp b/partition.cpp index dd70897c..a26e3f0b 100755 --- a/partition.cpp +++ b/partition.cpp @@ -658,6 +658,8 @@ void TWPartition::Setup_Data_Partition(bool Display_Error) { UnMount(false); #ifdef TW_INCLUDE_CRYPTO + if (datamedia) + Setup_Data_Media(); Can_Be_Encrypted = true; char crypto_blkdev[255]; property_get("ro.crypto.fs_crypto_blkdev", crypto_blkdev, "error"); @@ -665,8 +667,6 @@ void TWPartition::Setup_Data_Partition(bool Display_Error) { Set_FBE_Status(); Decrypted_Block_Device = crypto_blkdev; LOGINFO("Data already decrypted, new block device: '%s'\n", crypto_blkdev); - if (datamedia) - Setup_Data_Media(); DataManager::SetValue(TW_IS_ENCRYPTED, 0); } else if (!Mount(false)) { if (Is_Present) { @@ -683,8 +683,6 @@ void TWPartition::Setup_Data_Partition(bool Display_Error) { DataManager::SetValue("tw_crypto_pwtype_0", cryptfs_get_password_type()); DataManager::SetValue(TW_CRYPTO_PASSWORD, ""); DataManager::SetValue("tw_crypto_display", ""); - if (datamedia) - Setup_Data_Media(); } else { gui_err("mount_data_footer=Could not mount /data and unable to find crypto footer."); } @@ -707,9 +705,6 @@ void TWPartition::Setup_Data_Partition(bool Display_Error) { LOGERR("Unable to decrypt FBE device\n"); } else { DataManager::SetValue(TW_IS_ENCRYPTED, 0); - if (datamedia) - Setup_Data_Media(); - } } if (datamedia && (!Is_Encrypted || (Is_Encrypted && Is_Decrypted))) { diff --git a/partitionmanager.cpp b/partitionmanager.cpp index b3144c8b..8d1b6c43 100755 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -477,7 +477,8 @@ void TWPartitionManager::Decrypt_Data() { } } } - if (Decrypt_Data && (!Decrypt_Data->Is_Encrypted || Decrypt_Data->Is_Decrypted)) { + if (Decrypt_Data && (!Decrypt_Data->Is_Encrypted || Decrypt_Data->Is_Decrypted) && + Decrypt_Data->Mount(false)) { Decrypt_Adopted(); } #endif @@ -1935,13 +1936,8 @@ int TWPartitionManager::Decrypt_Device(string Password, int user_id) { if (DataManager::GetIntValue(TW_IS_FBE)) { #ifdef TW_INCLUDE_FBE - TWPartition* dat = Find_Partition_By_Path("/data"); - if (dat == nullptr) + if (!Mount_By_Path("/data", true)) // /data has to be mounted for FBE return -1; - if (!dat->Is_Mounted()) { - if (!dat->Mount(true)) // /data has to be mounted for FBE - return -1; - } bool user_need_decrypt = false; std::vector::iterator iter;