vab: correct default properties when vab is enabled

- do not show vab options in advanced
- do not perform merges when vab is disabled

Change-Id: I20997eca515600cb07fe896305b861ee9418c326
diff --git a/data.cpp b/data.cpp
index 3f0fe79..f19a2ed 100755
--- a/data.cpp
+++ b/data.cpp
@@ -1,5 +1,5 @@
 /*
-	Copyright 2012 to 2016 bigbiff/Dees_Troy TeamWin
+	Copyright 2012 to 2021 TeamWin
 	This file is part of TWRP/TeamWin Recovery Project.
 
 	TWRP is free software: you can redistribute it and/or modify
@@ -766,7 +766,7 @@
 	mPersist.SetValue(TW_TIME_ZONE_GUISEL, "CST6;CDT,M3.2.0,M11.1.0");
 	mPersist.SetValue(TW_TIME_ZONE_GUIOFFSET, "0");
 	mPersist.SetValue(TW_TIME_ZONE_GUIDST, "1");
-        mPersist.SetValue(TW_AUTO_REFLASHTWRP_VAR, "0");
+	mPersist.SetValue(TW_AUTO_REFLASHTWRP_VAR, "0");
 
 	mData.SetValue(TW_ACTION_BUSY, "0");
 	mData.SetValue("tw_wipe_cache", "0");
@@ -813,6 +813,11 @@
 	mData.SetValue("tw_sleep", "5");
 	mData.SetValue("tw_enable_fastboot", "0");
 
+
+	if (android::base::GetBoolProperty("ro.virtual_ab.enabled", false))
+		mConst.SetValue("tw_virtual_ab.enabled", "1");
+	else
+		mConst.SetValue("tw_virtual_ab.enabled", "0");
 	// Brightness handling
 	string findbright;
 #ifdef TW_BRIGHTNESS_PATH
diff --git a/data.hpp b/data.hpp
index 843bef2..d89966e 100755
--- a/data.hpp
+++ b/data.hpp
@@ -1,5 +1,5 @@
 /*
-	Copyright 2012 bigbiff/Dees_Troy TeamWin
+	Copyright 2012 to 2021 TeamWin
 	This file is part of TWRP/TeamWin Recovery Project.
 
 	TWRP is free software: you can redistribute it and/or modify
diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml
index 831a434..da3e321 100755
--- a/gui/theme/common/landscape.xml
+++ b/gui/theme/common/landscape.xml
@@ -3803,6 +3803,7 @@
 					</actions>
 				</listitem>
 				<listitem name="{@unmap_super_devices=Unmap Super Devices}">
+					<condition var1="tw_virtual_ab.enabled" op="=" var2="1"/>
 					<actions>
 						<action function="set">tw_back=advanced</action>
 						<action function="set">tw_action=unmapsuperdevices</action>
@@ -3814,6 +3815,7 @@
 					</actions>
 				</listitem>
 				<listitem name="{@merges_snapshots=Merge Snapshots}">
+					<condition var1="tw_virtual_ab.enabled" op="=" var2="1"/>
 					<actions>
 						<action function="set">tw_back=advanced</action>
 						<action function="set">tw_action=mergesnapshots</action>
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
index 0fed73d..a6711ff 100755
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -3925,6 +3925,7 @@
 					</actions>
 				</listitem>
 				<listitem name="{@unmap_super_devices=Unmap Super Devices}">
+					<condition var1="tw_virtual_ab.enabled" op="=" var2="1"/>
 					<actions>
 						<action function="set">tw_back=advanced</action>
 						<action function="set">tw_action=unmapsuperdevices</action>
@@ -3936,6 +3937,7 @@
 					</actions>
 				</listitem>
 				<listitem name="{@merges_snapshots=Merge Snapshots}">
+					<condition var1="tw_virtual_ab.enabled" op="=" var2="1"/>
 					<actions>
 						<action function="set">tw_back=advanced</action>
 						<action function="set">tw_action=mergesnapshots</action>
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
index 526e9c0..1ad5cbd 100755
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -4404,6 +4404,7 @@
 					</actions>
 				</listitem>
 				<listitem name="{@unmap_super_devices=Unmap Super Devices}">
+					<condition var1="tw_virtual_ab.enabled" op="=" var2="1"/>
 					<actions>
 						<action function="set">tw_back=advanced</action>
 						<action function="set">tw_action=unmapsuperdevices</action>
@@ -4415,6 +4416,7 @@
 					</actions>
 				</listitem>
 				<listitem name="{@merges_snapshots=Merge Snapshots}">
+					<condition var1="tw_virtual_ab.enabled" op="=" var2="1"/>
 					<actions>
 						<action function="set">tw_back=advanced</action>
 						<action function="set">tw_action=mergesnapshots</action>
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 0b3881e..72bd197 100755
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -1594,7 +1594,7 @@
 		metadata->UnMount(false);
 
 	if (dat != NULL) {
-		if (android::base::GetBoolProperty("ro.virtual_ab.enabled", true)) {
+		if (android::base::GetBoolProperty("ro.virtual_ab.enabled", false)) {
 #ifndef TW_EXCLUDE_APEX
 			twrpApex apex;
 			apex.Unmount();
diff --git a/twrpinstall/twinstall.cpp b/twrpinstall/twinstall.cpp
index 7f9e8c0..849b3ad 100755
--- a/twrpinstall/twinstall.cpp
+++ b/twrpinstall/twinstall.cpp
@@ -346,7 +346,7 @@
 				PartitionManager.UnMount_By_Path("/vendor", false);
 			if (!system_mount_state)
 				PartitionManager.UnMount_By_Path(PartitionManager.Get_Android_Root_Path(), false);
-			if (android::base::GetBoolProperty("ro.virtual_ab.enabled", true)) {
+			if (android::base::GetBoolProperty("ro.virtual_ab.enabled", false)) {
 				PartitionManager.Prepare_All_Super_Volumes();
 				gui_warn("mount_vab_partitions=Devices on super may not mount until rebooting recovery.");
 			}