diff --git a/gui/action.cpp b/gui/action.cpp index 145a55b8..89432340 100755 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -400,6 +400,11 @@ int GUIAction::flash_zip(std::string filename, int* wipe_cache) if (simulate) { simulate_progress_bar(); } else { + char apex_enabled[PROPERTY_VALUE_MAX]; + property_get("twrp.apex.flattened", apex_enabled, ""); + if (strcmp(apex_enabled, "true") == 0) { + umount("/apex"); + } ret_val = TWinstall_zip(filename.c_str(), wipe_cache, (bool) !DataManager::GetIntValue(TW_SKIP_DIGEST_CHECK_ZIP_VAR)); PartitionManager.Unlock_Block_Partitions(); // Now, check if we need to ensure TWRP remains installed... diff --git a/twrpApex.cpp b/twrpApex.cpp index 45e3e30b..5531445d 100755 --- a/twrpApex.cpp +++ b/twrpApex.cpp @@ -45,6 +45,7 @@ bool twrpApex::loadApexImages() { LOGERR("Unable to bind mount flattened apex directory\n"); return false; } + android::base::SetProperty("twrp.apex.flattened", "true"); return true; } if (!mountApexOnLoopbackDevices(apexFiles)) { diff --git a/twrpApex.hpp b/twrpApex.hpp index edd1d5f1..1c85d06e 100755 --- a/twrpApex.hpp +++ b/twrpApex.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "twcommon.h"