Revert "sdcard: only bind mount sdcard after successful preparation of data"

This reverts commit 60bb9f6369.
This commit is contained in:
Konsta
2022-02-19 12:01:05 +02:00
parent 60bb9f6369
commit a500eaef7f
2 changed files with 5 additions and 14 deletions
+2 -7
View File
@@ -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))) {
+3 -7
View File
@@ -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<users_struct>::iterator iter;