diff options
-rw-r--r-- | gui/action.cpp | 15 | ||||
-rw-r--r-- | partition.cpp | 10 | ||||
-rw-r--r-- | twrp.cpp | 5 |
3 files changed, 30 insertions, 0 deletions
diff --git a/gui/action.cpp b/gui/action.cpp index aafcd2ed4..86907a54f 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -1798,6 +1798,7 @@ int GUIAction::mountsystemtoggle(std::string arg) { int op_status = 0; bool remount_system = PartitionManager.Is_Mounted_By_Path("/system"); + bool remount_vendor = PartitionManager.Is_Mounted_By_Path("/vendor"); operation_start("Toggle System Mount"); if (!PartitionManager.UnMount_By_Path("/system", true)) { @@ -1819,6 +1820,20 @@ int GUIAction::mountsystemtoggle(std::string arg) } else { op_status = 1; // fail } + Part = PartitionManager.Find_Partition_By_Path("/vendor"); + if (Part) { + if (arg == "0") { + Part->Change_Mount_Read_Only(false); + } else { + Part->Change_Mount_Read_Only(true); + } + if (remount_vendor) { + Part->Mount(true); + } + op_status = 0; // success + } else { + op_status = 1; // fail + } } operation_end(op_status); diff --git a/partition.cpp b/partition.cpp index 3f7b26ccd..e110ba71a 100644 --- a/partition.cpp +++ b/partition.cpp @@ -354,6 +354,11 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) { Backup_Display_Name = Display_Name; DataManager::SetValue("tw_boot_is_mountable", 1); Can_Be_Backed_Up = true; + } else if (Mount_Point == "/vendor") { + Display_Name = "Vendor"; + Backup_Display_Name = Display_Name; + Storage_Name = Display_Name; + Mount_Read_Only = true; } #ifdef TW_EXTERNAL_STORAGE_PATH if (Mount_Point == EXPAND(TW_EXTERNAL_STORAGE_PATH)) { @@ -399,6 +404,11 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) { Backup_Display_Name = Display_Name; Can_Flash_Img = false; Can_Be_Backed_Up = true; + } else if (Mount_Point == "/vendor_image") { + Display_Name = "Vendor Image"; + Backup_Display_Name = Display_Name; + Can_Flash_Img = false; + Can_Be_Backed_Up = true; } } @@ -345,6 +345,7 @@ int main(int argc, char **argv) { #ifndef TW_OEM_BUILD // Check if system has never been changed TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system"); + TWPartition* ven = PartitionManager.Find_Partition_By_Path("/vendor"); if (sys) { if ((DataManager::GetIntValue("tw_mount_system_ro") == 0 && sys->Check_Lifetime_Writes() == 0) || DataManager::GetIntValue("tw_mount_system_ro") == 2) { if (DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) { @@ -354,11 +355,15 @@ int main(int argc, char **argv) { } } else if (DataManager::GetIntValue("tw_mount_system_ro") == 0) { sys->Change_Mount_Read_Only(false); + if (ven) + ven->Change_Mount_Read_Only(false); } } else if (DataManager::GetIntValue("tw_mount_system_ro") == 1) { // Do nothing, user selected to leave system read only } else { sys->Change_Mount_Read_Only(false); + if (ven) + ven->Change_Mount_Read_Only(false); } } #endif |