set crypto state/type when detected
Change-Id: I4506d3ef11052dbebf974b5c387a3c7d5055f2ea
diff --git a/partition.cpp b/partition.cpp
index f753fdb..f169bd0 100755
--- a/partition.cpp
+++ b/partition.cpp
@@ -723,6 +723,7 @@
bool TWPartition::Decrypt_FBE_DE() {
if (TWFunc::Path_Exists("/data/unencrypted/key/version")) {
DataManager::SetValue(TW_IS_FBE, 1);
+ property_set("ro.crypto.type", "file");
LOGINFO("File Based Encryption is present\n");
#ifdef TW_INCLUDE_FBE
Is_FBE = true;
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index d4b2028..30bdf3e 100755
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -302,11 +302,12 @@
#ifdef TW_INCLUDE_CRYPTO
TWPartition* Decrypt_Data = Find_Partition_By_Path("/data");
if (Decrypt_Data && Decrypt_Data->Is_Encrypted && !Decrypt_Data->Is_Decrypted) {
+ property_set("ro.crypto.state", "encrypted");
if (!Decrypt_Data->Key_Directory.empty() && Mount_By_Path(Decrypt_Data->Key_Directory, false)) {
+ property_set("ro.crypto.type", "file");
#ifdef TW_INCLUDE_FBE_METADATA_DECRYPT
if (e4crypt_mount_metadata_encrypted(Decrypt_Data->Mount_Point, false, Decrypt_Data->Key_Directory, Decrypt_Data->Actual_Block_Device, &Decrypt_Data->Decrypted_Block_Device)) {
LOGINFO("Successfully decrypted metadata encrypted data partition with new block device: '%s'\n", Decrypt_Data->Decrypted_Block_Device.c_str());
- property_set("ro.crypto.state", "encrypted");
Decrypt_Data->Is_Decrypted = true; // Needed to make the mount function work correctly
int retry_count = 10;
while (!Decrypt_Data->Mount(false) && --retry_count)