Try to handle Android Rescue Party triggers.

The Rescue Party trigger manifests itself when a user is trying to boot
a ROM but keeps getting dumped back to recovery.

Normally, TWRP doesn't capture this, and the user is often wondering
what is happening. This patch captures the trigger and presents a clear
message to the user about what is going on (with options of how to
resolve the situation).

Change-Id: Ia4414ce6270a7ee9e54d14381990ca4766e757bd
diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml
index caece05..32afd3f 100755
--- a/gui/theme/common/languages/en.xml
+++ b/gui/theme/common/languages/en.xml
@@ -745,5 +745,11 @@
 		<string name="enable_adb">Enable ADB</string>
 		<string name="enable_fastboot">Enable Fastboot</string>
 		<string name="fastboot_console_msg">Entered Fastboot mode...</string>
+		<!-- Android Rescue Party trigger -->
+		<string name="rescue_party0">Android Rescue Party trigger! Possible solutions? Either:</string>
+		<string name="rescue_party1"> 1. Wipe caches, and/or</string>
+		<string name="rescue_party2"> 2. Format data, and/or</string>
+		<string name="rescue_party3"> 3. Clean-flash your ROM.</string>
+		<string name="rescue_party4">The reported problem is: </string>
 	</resources>
 </language>
diff --git a/startupArgs.cpp b/startupArgs.cpp
index 5d19dc2..4fe6ec0 100755
--- a/startupArgs.cpp
+++ b/startupArgs.cpp
@@ -24,6 +24,16 @@
 
 	LOGINFO("Startup Commands: ");
 	for (index = 1; index < args.size(); index++) {
+		if (args[index].find(RESCUE_PARTY) != std::string::npos) {
+		      gui_print("\n\n");
+		      gui_msg(Msg(msg::kError, "rescue_party0=Android Rescue Party trigger! Possible solutions? Either:"));
+		      gui_msg(Msg(msg::kError, "rescue_party1= 1. Wipe caches, and/or"));
+		      gui_msg(Msg(msg::kError, "rescue_party2= 2. Format data, and/or"));
+		      gui_msg(Msg(msg::kError, "rescue_party3= 3. Clean-flash your ROM."));
+		      gui_print(" \n");
+		      gui_msg(Msg(msg::kError, "rescue_party4=The reported problem is:"));
+		      gui_print_color("error", " '%s'\n\n", args[index+1].c_str());
+		} else
 		printf("'%s'", args[index].c_str());
 		if (args[index] == FASTBOOT) {
 			fastboot_mode = true;
diff --git a/startupArgs.hpp b/startupArgs.hpp
index 53a47c4..6bb2cb8 100755
--- a/startupArgs.hpp
+++ b/startupArgs.hpp
@@ -40,6 +40,7 @@
 	static inline std::string const REASON = "--reason";
 	static inline std::string const FASTBOOT = "--fastboot";
 	static inline std::string const NANDROID = "--nandroid";
+	static inline std::string const RESCUE_PARTY = "--prompt_and_wipe_data";
 	void parse(int *argc, char ***argv);
 	bool Should_Skip_Decryption();
 	std::string Get_Intent();
@@ -50,4 +51,4 @@
 	bool fastboot_mode = false;
 	std::string Send_Intent;
 };
-#endif
\ No newline at end of file
+#endif