diff --git a/Android.mk b/Android.mk index 2ef6561c..5aa6a2b8 100755 --- a/Android.mk +++ b/Android.mk @@ -161,6 +161,9 @@ ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) ifeq ($(TW_EXCLUDE_LPDUMP),) TWRP_REQUIRED_MODULES += lpdump lpdumpd.rc endif + ifeq ($(TW_EXCLUDE_LPTOOLS),) + TWRP_REQUIRED_MODULES += lptools + endif endif ifeq ($(TW_USES_VENDOR_LIBS),true) diff --git a/partition.cpp b/partition.cpp index ecd5be59..cc8fb07d 100755 --- a/partition.cpp +++ b/partition.cpp @@ -1112,6 +1112,7 @@ bool TWPartition::Is_File_System(string File_System) { File_System == "yaffs2" || File_System == "exfat" || File_System == "f2fs" || + File_System == "erofs" || File_System == "squashfs" || File_System == "auto") return true; diff --git a/partitionmanager.cpp b/partitionmanager.cpp index a4d84ecb..e0bd0054 100755 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -3115,6 +3115,7 @@ void TWPartitionManager::Override_Active_Slot(const string& Slot) { LOGINFO("Overriding slot to '%s'\n", Slot.c_str()); Active_Slot_Display = Slot; DataManager::SetValue("tw_active_slot", Slot); + PartitionManager.Update_System_Details(); } void TWPartitionManager::Set_Active_Slot(const string& Slot) { @@ -3578,7 +3579,6 @@ bool TWPartitionManager::Unmap_Super_Devices() { LOGINFO("removing cow partition: %s\n", cow_partition.c_str()); destroyed = DestroyLogicalPartition(cow_partition); } - rmdir((*iter)->Mount_Point.c_str()); iter = Partitions.erase(iter); delete part; if (!destroyed) { diff --git a/prebuilt/Android.bp b/prebuilt/Android.bp new file mode 100644 index 00000000..fdbb3d2e --- /dev/null +++ b/prebuilt/Android.bp @@ -0,0 +1,5 @@ +soong_namespace { + imports: [ + "external/lptools", + ], +} diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index 6e269947..1a0beee2 100755 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -237,6 +237,8 @@ ifeq ($(AB_OTA_UPDATER), true) RECOVERY_BINARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/update_engine_sideload RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.boot@1.0.so RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.boot@1.1.so +endif +ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) ifeq ($(TW_EXCLUDE_LPDUMP),) RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/bootctl RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/lpdump @@ -245,6 +247,9 @@ ifeq ($(AB_OTA_UPDATER), true) RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblpdump_interface-V1-cpp.so RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-full.so endif + ifeq ($(TW_EXCLUDE_LPTOOLS),) + RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/lptools + endif endif ifneq ($(wildcard system/core/libsparse/Android.*),) diff --git a/twrpRepacker.cpp b/twrpRepacker.cpp index 8ca1409a..5a59fc6b 100755 --- a/twrpRepacker.cpp +++ b/twrpRepacker.cpp @@ -216,7 +216,6 @@ bool twrpRepacker::Repack_Image_And_Flash(const std::string& Target_Image, const else PartitionManager.Override_Active_Slot("A"); DataManager::SetProgress(.25); - PartitionManager.Update_System_Details(); if (!Backup_Image_For_Repack(part, REPACK_ORIG_DIR, Repack_Options.Backup_First, gui_lookup("repack", "Repack"))) return false; if (TWFunc::copy_file(REPACK_NEW_DIR "ramdisk.cpio", REPACK_ORIG_DIR "ramdisk.cpio", 0644)) { @@ -261,6 +260,11 @@ bool twrpRepacker::Repack_Image_And_Flash(const std::string& Target_Image, const }} TWFunc::removeDir(REPACK_NEW_DIR, false); gui_msg(Msg(msg::kWarning, "repack_overwrite_warning=If device was previously rooted, then root has been overwritten and will need to be reinstalled.")); + string Current_Slot = PartitionManager.Get_Active_Slot_Display(); + if (Current_Slot == "A") + PartitionManager.Override_Active_Slot("B"); + else + PartitionManager.Override_Active_Slot("A"); return true; }