From cfa875c4d42aff5c445313274a84c56d7394b162 Mon Sep 17 00:00:00 2001 From: bigbiff Date: Sun, 20 Jun 2021 16:20:27 -0400 Subject: [PATCH] vab support: merges and unmapping super devices - check for merges before formatting data - add advanced option for unmapping super devices Change-Id: I38d4d3bbdfa071969016c3e000c86a4d03c71e45 --- Android.mk | 5 +- data.cpp | 4 ++ gui/action.cpp | 18 ++++++++ gui/objects.hpp | 2 + gui/theme/common/landscape.xml | 11 +++++ gui/theme/common/languages/en.xml | 8 ++++ gui/theme/common/portrait.xml | 11 +++++ gui/theme/common/watch.xml | 11 +++++ partition.cpp | 24 +++++++++- partitionmanager.cpp | 77 +++++++++++++++++++++++++++---- partitions.hpp | 9 +++- twrpApex.cpp | 4 ++ twrpApex.hpp | 1 + twrpinstall/twinstall.cpp | 12 +++-- 14 files changed, 178 insertions(+), 19 deletions(-) diff --git a/Android.mk b/Android.mk index effab7fa..aea8b0ca 100755 --- a/Android.mk +++ b/Android.mk @@ -79,8 +79,8 @@ else LOCAL_CFLAGS += -DTW_EXCLUDE_APEX endif -LOCAL_STATIC_LIBRARIES += libavb libtwrpinstall libminadbd_services libinit -LOCAL_SHARED_LIBRARIES += libfs_mgr +LOCAL_STATIC_LIBRARIES += libavb libtwrpinstall libminadbd_services libinit libsnapshot_nobinder +LOCAL_SHARED_LIBRARIES += libfs_mgr libhardware android.hardware.boot@1.0 android.hardware.boot@1.1 libprotobuf-cpp-lite liblp libutils libhidlbase LOCAL_C_INCLUDES += \ system/core/fs_mgr/libfs_avb/include/ \ system/core/fs_mgr/include_fstab/ \ @@ -148,7 +148,6 @@ endif ifeq ($(AB_OTA_UPDATER),true) LOCAL_CFLAGS += -DAB_OTA_UPDATER=1 - LOCAL_SHARED_LIBRARIES += libhardware android.hardware.boot@1.0 android.hardware.boot@1.1 TWRP_REQUIRED_MODULES += libhardware android.hardware.boot@1.0-service android.hardware.boot@1.0-service.rc \ android.hardware.boot@1.1-service android.hardware.boot@1.1-service.rc android.hardware.boot@1.1.xml endif diff --git a/data.cpp b/data.cpp index ffb9b420..3d81bf6f 100755 --- a/data.cpp +++ b/data.cpp @@ -786,7 +786,11 @@ void DataManager::SetDefaultValues() #else mPersist.SetValue(TW_NO_SHA2, "1"); #endif +#ifdef AB_OTA_UPDATER + mPersist.SetValue(TW_UNMOUNT_SYSTEM, "0"); +#else mPersist.SetValue(TW_UNMOUNT_SYSTEM, "1"); +#endif #ifdef TW_NO_SCREEN_TIMEOUT mConst.SetValue("tw_screen_timeout_secs", "0"); diff --git a/gui/action.cpp b/gui/action.cpp index 89432340..a623ccd5 100755 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -207,6 +207,7 @@ GUIAction::GUIAction(xml_node<>* node) ADD_ACTION(enableadb); ADD_ACTION(enablefastboot); ADD_ACTION(changeterminal); + ADD_ACTION(unmapsuperdevices); // remember actions that run in the caller thread for (mapFunc::const_iterator it = mf.begin(); it != mf.end(); ++it) @@ -2266,6 +2267,23 @@ int GUIAction::changeterminal(std::string arg) { gui_changePage("terminalcommand"); return 0; } + +int GUIAction::unmapsuperdevices(std::string arg __unused) { + int op_status = 1; + + operation_start("Remove Super Devices"); + if (simulate) { + simulate_progress_bar(); + } else { + if (PartitionManager.Unmap_Super_Devices()) { + op_status = 0; + } + } + + operation_end(op_status); + return 0; +} + #ifndef TW_EXCLUDE_NANO int GUIAction::editfile(std::string arg) { if (term != NULL) { diff --git a/gui/objects.hpp b/gui/objects.hpp index 3948fb28..ec550bb3 100755 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -328,6 +328,8 @@ protected: int screenshot(std::string arg); int setbrightness(std::string arg); int checkforapp(std::string arg); + int unmapsuperdevices(std::string arg); + int removedynamicgroups(std:: string arg); // (originally) threaded actions int fileexists(std::string arg); diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml index 3ac0d285..bf8912a3 100755 --- a/gui/theme/common/landscape.xml +++ b/gui/theme/common/landscape.xml @@ -3764,6 +3764,17 @@ confirm_action + + + tw_back=advanced + tw_action=unmapsuperdevices + tw_text1={@unmap_super_devices_confirm=Unmap all Super Devices?} + tw_action_text1={@unmapping_super_devices=Unmapping Super Devices...} + tw_complete_text1={@unmap_super_devices_complete=Unmapped all Super Devices} + tw_slider_text={@swipe_to_confirm=Swipe to Confirm} + confirm_action + + diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml index 811f40c4..1dca4f61 100755 --- a/gui/theme/common/languages/en.xml +++ b/gui/theme/common/languages/en.xml @@ -760,5 +760,13 @@ Changing TWRP folder TWRP folder changed to A folder with that name already exists! + Unmap Super Devices + Unmap all Super Devices? + Unmapping Super Devices... + Unmapped all Super Devices + Unmap all Super Devices? + Unmapping Super Devices... + Unmapped all Super Devices + Devices on super may not mount until rebooting recovery. diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml index 78677cbf..9e0fec88 100755 --- a/gui/theme/common/portrait.xml +++ b/gui/theme/common/portrait.xml @@ -3886,6 +3886,17 @@ confirm_action + + + tw_back=advanced + tw_action=unmapsuperdevices + tw_text1={@unmap_super_devices_confirm=Unmap all Super Devices?} + tw_action_text1={@unmapping_super_devices=Unmapping Super Devices...} + tw_complete_text1={@unmap_super_devices_complete=Unmapped all Super Devices} + tw_slider_text={@swipe_to_confirm=Swipe to Confirm} + confirm_action + + diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml index 165f329c..1b705470 100755 --- a/gui/theme/common/watch.xml +++ b/gui/theme/common/watch.xml @@ -4365,6 +4365,17 @@ confirm_action + + + tw_back=advanced + tw_action=unmapsuperdevices + tw_text1={@unmap_super_devices_confirm=Unmap all Super Devices?} + tw_action_text1={@unmapping_super_devices=Unmapping Super Devices...} + tw_complete_text1={@unmap_super_devices_complete=Unmapped all Super Devices} + tw_slider_text={@swipe_to_confirm=Swipe to Confirm} + confirm_action + +