summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bootloader_message/Android.mk4
-rw-r--r--bootloader_message/bootloader_message.cpp11
2 files changed, 15 insertions, 0 deletions
diff --git a/bootloader_message/Android.mk b/bootloader_message/Android.mk
index 8653fd525..1d5c85fe3 100644
--- a/bootloader_message/Android.mk
+++ b/bootloader_message/Android.mk
@@ -37,5 +37,9 @@ else
LOCAL_SHARED_LIBRARIES += libc++
endif
LOCAL_CFLAGS := -DEXCLUDE_FS_MGR
+# ignore bootloader's factory reset command even when written to /misc
+ifeq ($(TW_IGNORE_MISC_WIPE_DATA), true)
+ LOCAL_CFLAGS += -DIGNORE_MISC_WIPE_DATA
+endif
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp
index eb99bdb42..362d9cbe2 100644
--- a/bootloader_message/bootloader_message.cpp
+++ b/bootloader_message/bootloader_message.cpp
@@ -284,6 +284,17 @@ get_args(int *argc, char ***argv) {
(*argv)[0] = strdup(arg);
for (*argc = 1; *argc < MAX_ARGS; ++*argc) {
if ((arg = strtok(NULL, "\n")) == NULL) break;
+
+// if the device does not have an own recovery key combo we just want to open TWRP after
+// walking through the factory reset screen - without actually doing a factory reset
+#ifdef IGNORE_MISC_WIPE_DATA
+ if (!strcmp(arg, "--wipe_data")) {
+ (*argv)[*argc] = "";
+ *argc = *argc -1;
+ printf("Bootloader arg \"%s\" ignored because TWRP was compiled with TW_IGNORE_MISC_WIPE_DATA\n", arg);
+ continue;
+ }
+#endif
(*argv)[*argc] = strdup(arg);
}
printf("Got arguments from boot message\n");