sdcard: only bind mount sdcard after successful preparation of data
Change-Id: I589f48a019f90a60ad48f93c5f5555aae4b8a5c9
This commit is contained in:
+7
-2
@@ -658,8 +658,6 @@ 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");
|
||||
@@ -667,6 +665,8 @@ 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,6 +683,8 @@ 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.");
|
||||
}
|
||||
@@ -705,6 +707,9 @@ 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))) {
|
||||
|
||||
@@ -477,8 +477,7 @@ void TWPartitionManager::Decrypt_Data() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Decrypt_Data && (!Decrypt_Data->Is_Encrypted || Decrypt_Data->Is_Decrypted) &&
|
||||
Decrypt_Data->Mount(false)) {
|
||||
if (Decrypt_Data && (!Decrypt_Data->Is_Encrypted || Decrypt_Data->Is_Decrypted)) {
|
||||
Decrypt_Adopted();
|
||||
}
|
||||
#endif
|
||||
@@ -1936,8 +1935,13 @@ int TWPartitionManager::Decrypt_Device(string Password, int user_id) {
|
||||
|
||||
if (DataManager::GetIntValue(TW_IS_FBE)) {
|
||||
#ifdef TW_INCLUDE_FBE
|
||||
if (!Mount_By_Path("/data", true)) // /data has to be mounted for FBE
|
||||
TWPartition* dat = Find_Partition_By_Path("/data");
|
||||
if (dat == nullptr)
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user