From bdb5d2ada54e672ec1d9283d1e65205353640c9a Mon Sep 17 00:00:00 2001 From: me-cafebabe Date: Wed, 20 Jul 2022 06:42:18 +0800 Subject: [PATCH] Make "Unmap Super Devices" option available to A-only devices Change-Id: Ib3aed724b2e98f66387bdca240b0b4f719054594 (cherry picked from commit 2136fc5b91963fc21e782614ce6cfd55ca065eb9) --- data.cpp | 5 ++--- gui/theme/common/landscape.xml | 2 +- gui/theme/common/portrait.xml | 2 +- gui/theme/common/watch.xml | 2 +- partitionmanager.cpp | 4 +++- variables.h | 1 + 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/data.cpp b/data.cpp index 4e32dc4b..96e4b5e8 100755 --- a/data.cpp +++ b/data.cpp @@ -818,11 +818,10 @@ void DataManager::SetDefaultValues() 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"); + mConst.SetValue(TW_VIRTUAL_AB_ENABLED, "1"); else - mConst.SetValue("tw_virtual_ab.enabled", "0"); + mConst.SetValue(TW_VIRTUAL_AB_ENABLED, "0"); // Brightness handling string findbright; #ifdef TW_BRIGHTNESS_PATH diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml index 9fb85707..c0d14d89 100755 --- a/gui/theme/common/landscape.xml +++ b/gui/theme/common/landscape.xml @@ -3856,7 +3856,7 @@ - + tw_back=advanced tw_action=unmapsuperdevices diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml index db8ea38d..1e3d0f83 100755 --- a/gui/theme/common/portrait.xml +++ b/gui/theme/common/portrait.xml @@ -3979,7 +3979,7 @@ - + tw_back=advanced tw_action=unmapsuperdevices diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml index f82c2d8c..7d9888da 100755 --- a/gui/theme/common/watch.xml +++ b/gui/theme/common/watch.xml @@ -4466,7 +4466,7 @@ - + tw_back=advanced tw_action=unmapsuperdevices diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 743e9285..5aee83f9 100755 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -3573,7 +3573,9 @@ bool TWPartitionManager::Unmap_Super_Devices() { if ((*iter)->Is_Super) { TWPartition *part = *iter; std::string bare_partition_name = Get_Bare_Partition_Name((*iter)->Get_Mount_Point()); - std::string blk_device_partition = bare_partition_name + PartitionManager.Get_Active_Slot_Suffix(); + std::string blk_device_partition = bare_partition_name; + if (DataManager::GetStrValue(TW_VIRTUAL_AB_ENABLED) == "1") + blk_device_partition.append(PartitionManager.Get_Active_Slot_Suffix()); (*iter)->UnMount(false); LOGINFO("removing dynamic partition: %s\n", blk_device_partition.c_str()); destroyed = DestroyLogicalPartition(blk_device_partition); diff --git a/variables.h b/variables.h index 8ae34696..cc6977cd 100755 --- a/variables.h +++ b/variables.h @@ -147,6 +147,7 @@ #define TW_NO_SHA2 "tw_no_sha2" #define TW_UNMOUNT_SYSTEM "tw_unmount_system" #define TW_IS_SUPER "tw_is_super" +#define TW_VIRTUAL_AB_ENABLED "tw_virtual_ab.enabled" #define TW_AUTO_REFLASHTWRP_VAR "tw_auto_reflashtwrp" // Theme versioning