partitionmanager: Unmount all directories mounted to same block

* Like Xiaomi's some older devices uses cust as vendor and also mounts cust & vendor simultanously

 * This patch will unmount all directories mounted to same block

Change-Id: Ic242e267a470b4d82098d847f74b807a461605c4
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
This commit is contained in:
Mohd Faraz
2020-04-21 18:56:44 +05:30
committed by bigbiff
parent fec60c3e33
commit 77a31917f2
+9
View File
@@ -1285,6 +1285,7 @@ void TWPartitionManager::Set_Restore_Files(string Restore_Name) {
int TWPartitionManager::Wipe_By_Path(string Path) {
std::vector<TWPartition*>::iterator iter;
std::vector < TWPartition * >::iterator iter1;
int ret = false;
bool found = false;
string Local_Path = TWFunc::Get_Root_Path(Path);
@@ -1292,6 +1293,14 @@ int TWPartitionManager::Wipe_By_Path(string Path) {
// Iterate through all partitions
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)) {
// iterate through all partitions since some legacy devices uses other partitions as vendor causes issues while wiping
(*iter)->Find_Actual_Block_Device();
for (iter1 = Partitions.begin (); iter1 != Partitions.end (); iter1++)
{
(*iter1)->Find_Actual_Block_Device();
if ((*iter)->Actual_Block_Device == (*iter1)->Actual_Block_Device && (*iter)->Mount_Point != (*iter1)->Mount_Point)
(*iter1)->UnMount(false);
}
if (Path == "/and-sec")
ret = (*iter)->Wipe_AndSec();
else