From 58d1e7a13a1a625c3b5a58e715c78d2e3fffbcbb Mon Sep 17 00:00:00 2001 From: DarthJabba9 Date: Fri, 23 Oct 2020 14:44:08 +0100 Subject: [PATCH] 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 --- gui/theme/common/languages/en.xml | 6 ++++++ startupArgs.cpp | 10 ++++++++++ startupArgs.hpp | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml index caece05c..32afd3f2 100755 --- a/gui/theme/common/languages/en.xml +++ b/gui/theme/common/languages/en.xml @@ -745,5 +745,11 @@ Enable ADB Enable Fastboot Entered Fastboot mode... + + Android Rescue Party trigger! Possible solutions? Either: + 1. Wipe caches, and/or + 2. Format data, and/or + 3. Clean-flash your ROM. + The reported problem is: diff --git a/startupArgs.cpp b/startupArgs.cpp index 5d19dc26..4fe6ec0c 100755 --- a/startupArgs.cpp +++ b/startupArgs.cpp @@ -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; diff --git a/startupArgs.hpp b/startupArgs.hpp index 53a47c42..6bb2cb86 100755 --- a/startupArgs.hpp +++ b/startupArgs.hpp @@ -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 \ No newline at end of file +#endif