diff options
Diffstat (limited to '')
-rw-r--r-- | partition.cpp | 11 | ||||
-rw-r--r-- | partitionmanager.cpp | 13 | ||||
-rw-r--r-- | partitions.hpp | 3 |
3 files changed, 26 insertions, 1 deletions
diff --git a/partition.cpp b/partition.cpp index df03336c4..354563466 100644 --- a/partition.cpp +++ b/partition.cpp @@ -2526,6 +2526,17 @@ int TWPartition::Decrypt_Adopted() { cryptfs_revert_ext_volume(part_guid); ret = 1; } else { + UnMount(false); + Has_Android_Secure = false; + Symlink_Path = ""; + Symlink_Mount_Point = ""; + Backup_Name = Mount_Point.substr(1); + Backup_Path = Mount_Point; + TWPartition* sdext = PartitionManager.Find_Partition_By_Path("/sd-ext"); + if (sdext && sdext->Actual_Block_Device == Adopted_Block_Device) { + LOGINFO("Removing /sd-ext from partition list due to adopted storage\n"); + PartitionManager.Remove_Partition_By_Path("/sd-ext"); + } Setup_Data_Media(); Recreate_Media_Folder(); Wipe_Available_in_GUI = true; diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 1c59de7f0..cc090cf4b 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -2413,3 +2413,16 @@ void TWPartitionManager::Decrypt_Adopted() { return; #endif } + +void TWPartitionManager::Remove_Partition_By_Path(string Path) { + std::vector<TWPartition*>::iterator iter; + string Local_Path = TWFunc::Get_Root_Path(Path); + + for (iter = Partitions.begin(); iter != Partitions.end(); iter++) { + if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path)) { + LOGINFO("Found and erasing '%s' from partition list\n", Local_Path.c_str()); + Partitions.erase(iter); + return; + } + } +} diff --git a/partitions.hpp b/partitions.hpp index a020ee229..90f772cb4 100644 --- a/partitions.hpp +++ b/partitions.hpp @@ -243,7 +243,8 @@ public: void Translate_Partition(const char* path, const char* resource_name, const char* default_value); void Translate_Partition(const char* path, const char* resource_name, const char* default_value, const char* storage_resource_name, const char* storage_default_value); void Translate_Partition_Display_Names(); // Updates display names based on translations - void Decrypt_Adopted(); + void Decrypt_Adopted(); // Attempt to identy and decrypt any adopted storage partitions + void Remove_Partition_By_Path(string Path); // Removes / erases a partition entry from the partition list TWAtomicInt stop_backup; |