Add exclusion criteria for "Fix Recovery Bootloop"

Should only be included on devices that use initramfs,
i.e. legacy SAR, recovery-in-boot

Change-Id: I2408fcd993e1e381f49b3d5ae860694b2fade4d2
diff --git a/Android.mk b/Android.mk
index 826636f..d5e023f 100755
--- a/Android.mk
+++ b/Android.mk
@@ -240,6 +240,13 @@
 endif
 endif
 
+ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
+    LOCAL_CFLAGS += -DBOARD_USES_RECOVERY_AS_BOOT
+endif
+ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE), true)
+    LOCAL_CFLAGS += -DBOARD_BUILD_SYSTEM_ROOT_IMAGE
+endif
+
 #TWRP Build Flags
 ifeq ($(TW_EXCLUDE_MTP),)
     LOCAL_CFLAGS += -DTW_HAS_MTP
diff --git a/data.cpp b/data.cpp
index b0d44f1..a40a7e5 100755
--- a/data.cpp
+++ b/data.cpp
@@ -781,6 +781,12 @@
 #endif
 	mPersist.SetValue(TW_UNMOUNT_SYSTEM, "1");
 
+#if defined BOARD_USES_RECOVERY_AS_BOOT && defined BOARD_BUILD_SYSTEM_ROOT_IMAGE
+	mConst.SetValue("tw_uses_initramfs", "1");
+#else
+	mConst.SetValue("tw_uses_initramfs", "0");
+#endif
+
 #ifdef TW_NO_SCREEN_TIMEOUT
 	mConst.SetValue("tw_screen_timeout_secs", "0");
 	mConst.SetValue("tw_no_screen_timeout", "1");
diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml
index 09efcb3..ef0cb4f 100755
--- a/gui/theme/common/landscape.xml
+++ b/gui/theme/common/landscape.xml
@@ -3612,6 +3612,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_uses_initramfs" var2="1"/>
 					</conditions>
 					<actions>
 						<action function="set">tw_back=advanced</action>
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
index d27aa53..9490a04 100755
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -3734,6 +3734,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_uses_initramfs" var2="1"/>
 					</conditions>
 					<actions>
 						<action function="set">tw_back=advanced</action>
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
index d87d091..8252780 100755
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -4358,6 +4358,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_uses_initramfs" var2="1"/>
 					</conditions>
 					<actions>
 						<action function="set">tw_back=advanced</action>