gui: allow disabling Flash Current TWRP option

On devices where boot scripts are run and ramdisk contents
are dynamically changed, hash check will always fail
when trying to use Flash Current TWRP option.

Disabling the hash check is not advisable as that would
hardcode the changes made during boot and would nullify
the dynamic nature of such changes.

Instead, provide a BoardConfig flag to hide this option,
along with the related feature to automatically flash TWRP
after a zip.

Usage:
TW_NO_FLASH_CURRENT_TWRP := true

Change-Id: Id307bf60b79ff1bff4ba7dd7f427132f40637289
diff --git a/Android.mk b/Android.mk
index 61cec06..011b06c 100755
--- a/Android.mk
+++ b/Android.mk
@@ -179,6 +179,10 @@
     LOCAL_CFLAGS += -DTW_NO_BIND_SYSTEM
 endif
 
+ifeq ($(TW_NO_FLASH_CURRENT_TWRP),true)
+    LOCAL_CFLAGS += -DTW_NO_FLASH_CURRENT_TWRP
+endif
+
 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/bin
 
 ifeq ($(TARGET_RECOVERY_TWRP_LIB),)
diff --git a/data.cpp b/data.cpp
index 96e4b5e..6959c82 100755
--- a/data.cpp
+++ b/data.cpp
@@ -771,6 +771,11 @@
 	mPersist.SetValue(TW_TIME_ZONE_GUIOFFSET, "0");
 	mPersist.SetValue(TW_TIME_ZONE_GUIDST, "1");
 	mPersist.SetValue(TW_AUTO_REFLASHTWRP_VAR, "0");
+#ifdef TW_NO_FLASH_CURRENT_TWRP
+	mConst.SetValue("tw_no_flash_current_twrp", "1");
+#else
+	mConst.SetValue("tw_no_flash_current_twrp", "0");
+#endif
 
 	mData.SetValue(TW_ACTION_BUSY, "0");
 	mData.SetValue("tw_wipe_cache", "0");
diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml
index c0d14d8..d65a84c 100755
--- a/gui/theme/common/landscape.xml
+++ b/gui/theme/common/landscape.xml
@@ -464,6 +464,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<data variable="tw_auto_reflashtwrp"/>
 				</listitem>
@@ -3298,6 +3299,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<data variable="tw_auto_reflashtwrp"/>
 				</listitem>
@@ -3797,6 +3799,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<actions>
 						<action function="set">tw_repack_kernel=0</action>
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
index 1e3d0f8..c3369ae 100755
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -416,6 +416,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<data variable="tw_auto_reflashtwrp"/>
 				</listitem>
@@ -3473,6 +3474,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<data variable="tw_auto_reflashtwrp"/>
 				</listitem>
@@ -3920,6 +3922,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<actions>
 						<action function="set">tw_repack_kernel=0</action>
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
index 7d9888d..9a3b025 100755
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -579,6 +579,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<data variable="tw_auto_reflashtwrp"/>
 				</listitem>
@@ -3846,6 +3847,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<data variable="tw_auto_reflashtwrp"/>
 				</listitem>
@@ -4407,6 +4409,7 @@
 					<conditions>
 						<condition var1="tw_has_boot_slots" var2="1"/>
 						<condition var1="tw_has_repack_tools" var2="1"/>
+						<condition var1="tw_no_flash_current_twrp" var2="0"/>
 					</conditions>
 					<actions>
 						<action function="set">tw_repack_kernel=0</action>