Skip to content

Commit

Permalink
vab: correct default properties when vab is enabled
Browse files Browse the repository at this point in the history
- do not show vab options in advanced
- do not perform merges when vab is disabled

Change-Id: I20997eca515600cb07fe896305b861ee9418c326
  • Loading branch information
epicX67 committed Nov 4, 2021
1 parent 1222596 commit 468339e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
9 changes: 7 additions & 2 deletions data.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -770,7 +770,7 @@ initSHRPVars(&mConst, &mData, &mPersist);
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");
Expand Down Expand Up @@ -817,6 +817,11 @@ initSHRPVars(&mConst, &mData, &mPersist);
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
Expand Down
2 changes: 1 addition & 1 deletion data.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 24 additions & 0 deletions gui/theme/shrp_portrait_hdpi/pages/tweaks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@
<action function="page">confirm_action</action>
</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=c_addons_native</action>
<action function="set">tw_action=unmapsuperdevices</action>
<action function="set">tw_text1={@unmap_super_devices_confirm=Unmap all Super Devices?}</action>
<action function="set">tw_action_text1={@unmapping_super_devices=Unmapping Super Devices...}</action>
<action function="set">tw_complete_text1={@unmap_super_devices_complete=Unmapped all Super Devices}</action>
<action function="set">tw_slider_text={@swipe_to_confirm=Swipe to Confirm}</action>
<action function="page">confirm_action</action>
</actions>
</listitem>
<listitem name="{@merges_snapshots=Merge Snapshots}">
<condition var1="tw_virtual_ab.enabled" op="=" var2="1"/>
<actions>
<action function="set">tw_back=c_addons_native</action>
<action function="set">tw_action=mergesnapshots</action>
<action function="set">tw_text1={@merge_snapshots_confirm=Merge Snapshots?}</action>
<action function="set">tw_action_text1={@merging_snapshots=Merging Snapshots...}</action>
<action function="set">tw_complete_text1={@merging_snapshots_complete=Merged Snapshots}</action>
<action function="set">tw_slider_text={@swipe_to_confirm=Swipe to Confirm}</action>
<action function="page">confirm_action</action>
</actions>
</listitem>
</listbox>


Expand Down
2 changes: 1 addition & 1 deletion partitionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ int TWPartitionManager::Format_Data(void) {
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();
Expand Down
2 changes: 1 addition & 1 deletion twrpinstall/twinstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest) {
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.");
}
Expand Down

0 comments on commit 468339e

Please sign in to comment.