AOSP10 TWRP Merge: fix conflicts and update libraries needed

This allows flame to boot TWRP. Still will need to work on
super partition for vendor and system access.

The plan will be to cherry-pick any updates to android-9.0
through gerrit.twrp.me to this branch as a WIP.
diff --git a/twrp.cpp b/twrp.cpp
index dac0093..8c6dcf8 100755
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -47,7 +47,7 @@
 #include "variables.h"
 #include "twrpAdbBuFifo.hpp"
 #ifdef TW_USE_NEW_MINADBD
-#include "minadbd/minadbd.h"
+// #include "minadbd/minadbd.h"
 #else
 extern "C" {
 #include "minadbd21/adb.h"
@@ -84,7 +84,7 @@
 		property_set("ctl.stop", "adbd");
 #ifdef TW_USE_NEW_MINADBD
 		//adb_server_main(0, DEFAULT_ADB_PORT, -1); TODO fix this for android8
-		minadbd_main();
+		// minadbd_main();
 #else
 		adb_main(argv[2]);
 #endif
@@ -127,6 +127,7 @@
 	gui_loadResources();
 
 	bool Shutdown = false;
+	bool SkipDecryption = false;
 	string Send_Intent = "";
 	{
 		TWPartition* misc = PartitionManager.Find_Partition_By_Path("/misc");
@@ -161,6 +162,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
@@ -228,13 +232,17 @@
 
 	// 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
-			TWFunc::check_selinux_support();
-			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
+				TWFunc::check_selinux_support();
+				gui_loadCustomResources();
+			}
 		}
 	} else if (datamedia) {
 		TWFunc::check_selinux_support();
@@ -258,8 +266,7 @@
 	// Run any outstanding OpenRecoveryScript
 	std::string cacheDir = TWFunc::get_cache_dir();
 	std::string orsFile = cacheDir + "/recovery/openrecoveryscript";
-
-	if (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || (DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 && TWFunc::Path_Exists(orsFile))) {
+	if ((DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 || SkipDecryption) && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(orsFile))) {
 		OpenRecoveryScript::Run_OpenRecoveryScript();
 	}