crypto: only set crypto state and type if not already set
Move setting crypto state and type to functions and call those
functions rather than arbitrarily setting those props in every
case. This cleans up all the log spam from trying to set
read-only props, since they will now only get set if
they aren't already.
Change-Id: I392bee060d71c6ee50d0d92bf1b118d9049be41a
diff --git a/partition.cpp b/partition.cpp
index d14c72d..2af1bf3 100755
--- a/partition.cpp
+++ b/partition.cpp
@@ -733,8 +733,8 @@
bool TWPartition::Decrypt_FBE_DE() {
if (TWFunc::Path_Exists("/data/unencrypted/key/version")) {
DataManager::SetValue(TW_IS_FBE, 1);
- property_set("ro.crypto.state", "encrypted");
- property_set("ro.crypto.type", "file");
+ PartitionManager.Set_Crypto_State();
+ PartitionManager.Set_Crypto_Type("file");
LOGINFO("File Based Encryption is present\n");
#ifdef TW_INCLUDE_FBE
Is_FBE = true;
@@ -755,7 +755,7 @@
while (!Decrypt_DE() && --retry_count)
usleep(2000);
if (retry_count > 0) {
- property_set("ro.crypto.state", "encrypted");
+ PartitionManager.Set_Crypto_State();
Is_Encrypted = true;
Is_Decrypted = false;
DataManager::SetValue(TW_IS_ENCRYPTED, 1);