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
This commit is contained in:
DarthJabba9
2020-10-23 14:44:08 +01:00
committed by bigbiff
parent 2d9953ab3e
commit 58d1e7a13a
3 changed files with 18 additions and 1 deletions
+6
View File
@@ -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>
+10
View File
@@ -24,6 +24,16 @@ void startupArgs::parse(int *argc, char ***argv) {
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;
+2 -1
View File
@@ -40,6 +40,7 @@ public:
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 @@ private:
bool fastboot_mode = false;
std::string Send_Intent;
};
#endif
#endif