Fixes Decryption prompt asking when not needed
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
Change-Id: Ic366a50f02f283864cf44d7b36f40ff6432d4970
diff --git a/partition.cpp b/partition.cpp
index 64b461c..6e0716e 100755
--- a/partition.cpp
+++ b/partition.cpp
@@ -734,6 +734,7 @@
bool TWPartition::Decrypt_FBE_DE() {
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
LOGINFO("File Based Encryption is present\n");
#ifdef TW_INCLUDE_FBE
ExcludeAll(Mount_Point + "/convert_fbe");
@@ -3394,4 +3395,4 @@
bool TWPartition::Is_SlotSelect() {
return SlotSelect;
-}
\ No newline at end of file
+}
diff --git a/twrp.cpp b/twrp.cpp
index 9973536..584245b 100755
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -74,7 +74,7 @@
if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) {
if (SkipDecryption) {
LOGINFO("Skipping decryption\n");
- } else {
+ } else if (DataManager::GetIntValue(TW_CRYPTO_PWTYPE) != 0) {
LOGINFO("Is encrypted, do decrypt page first\n");
if (DataManager::GetIntValue(TW_IS_FBE))
DataManager::SetValue("tw_crypto_user_id", "0");