Encryption: don't try wrapped key if not needed

This commit is used to directly use the wrapped key
decryption when the "wrappedkey" flag is set in the
fstab.

Change-Id: I74310c3bbec378ee684a8f6d0395a9776dd22abf
(cherry picked from commit 1db943295de9728e364bf0e75bfe9f1a98d413a1)
diff --git a/partition.cpp b/partition.cpp
index 5626e5c..7f4189a 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -685,11 +685,18 @@
 	} else {
 
 		if (!Decrypt_FBE_DE()) {
-			LOGINFO("Trying wrapped key.\n");
-			property_set("fbe.data.wrappedkey", "true");
+			char wrappedvalue[PROPERTY_VALUE_MAX];
+			property_get("fbe.data.wrappedkey", wrappedvalue, "");
+			std::string wrappedkeyvalue(wrappedvalue);
+			if (wrappedkeyvalue == "true") {
+				LOGERR("Unable to decrypt FBE device\n");
+			} else {
+				LOGINFO("Trying wrapped key.\n");
+				property_set("fbe.data.wrappedkey", "true");
 				if (!Decrypt_FBE_DE()) {
 					LOGERR("Unable to decrypt FBE device\n");
 				}
+			}
 		}
 	}
 	if (datamedia && (!Is_Encrypted || (Is_Encrypted && Is_Decrypted))) {