Skip decryption when installing mapped zips

Decrypting userdata is not needed when installing zips if we have
a map of blocks to read, so skip the decryption. This allows to
install zips with no user interaction and, more importantly, it
allows to install zips on devices where TWRP can't properly decrypt
userdata.

Remove also the unneeded Mount_All_Storage() call, Install_Command()
already mounts the needed partition.

Change-Id: I91c69f84ecc2fe41c9567c40649e501af1cfb64a
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index 92cac07..d7e4a23 100644
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -141,7 +141,6 @@
 			if (strcmp(command, "install") == 0) {
 				// Install Zip
 				DataManager::SetValue("tw_action_text2", "Installing Zip");
-				PartitionManager.Mount_All_Storage();
 				ret_val = Install_Command(value);
 				install_cmd = -1;
 			} else if (strcmp(command, "wipe") == 0) {
diff --git a/twrp.cpp b/twrp.cpp
index f72d691..c46d655 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -169,6 +169,7 @@
 	PartitionManager.Mount_By_Path("/cache", false);
 
 	bool Shutdown = false;
+	bool SkipDecryption = false;
 	string Send_Intent = "";
 	{
 		TWPartition* misc = PartitionManager.Find_Partition_By_Path("/misc");
@@ -203,6 +204,9 @@
 					string ORSCommand = "install ";
 					ORSCommand.append(ptr);
 
+					// If we have a map of blocks we don't need to mount data.
+					SkipDecryption = *ptr == '@';
+
 					if (!OpenRecoveryScript::Insert_ORS_Command(ORSCommand))
 						break;
 				} else
@@ -271,12 +275,16 @@
 	TWFunc::Update_Log_File();
 	// Offer to decrypt if the device is encrypted
 	if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) {
-		LOGINFO("Is encrypted, do decrypt page first\n");
-		if (gui_startPage("decrypt", 1, 1) != 0) {
-			LOGERR("Failed to start decrypt GUI page.\n");
+		if (SkipDecryption) {
+			LOGINFO("Skipping decryption\n");
 		} else {
-			// Check for and load custom theme if present
-			gui_loadCustomResources();
+			LOGINFO("Is encrypted, do decrypt page first\n");
+			if (gui_startPage("decrypt", 1, 1) != 0) {
+				LOGERR("Failed to start decrypt GUI page.\n");
+			} else {
+				// Check for and load custom theme if present
+				gui_loadCustomResources();
+			}
 		}
 	} else if (datamedia) {
 		if (tw_get_default_metadata(DataManager::GetSettingsStoragePath().c_str()) != 0) {