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 e0c32b1..5af68c9 100755
--- a/partition.cpp
+++ b/partition.cpp
@@ -737,8 +737,8 @@
if (TWFunc::Path_Exists("/data/unencrypted/key/version")) {
DataManager::SetValue(TW_IS_FBE, 1);
DataManager::SetValue(TW_CRYPTO_PWTYPE, "0"); // Set initial value so that recovery will not be confused when using unencrypted data or failed to decrypt data
- 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;
@@ -765,7 +765,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);