From 0e2c657cc8cff51044af11d82352d1bfef9957c3 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 4 Jun 2015 11:30:02 -0500 Subject: Fix system read only behavior during boot Change-Id: I90dbdd06465e2ddaaade86b930beff91991432eb --- twrp.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/twrp.cpp b/twrp.cpp index b7fc9815d..e34c9b381 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -333,16 +333,22 @@ int main(int argc, char **argv) { #endif // Check if system has never been changed - if (DataManager::GetIntValue("tw_mount_system_ro") != 0 && DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) { - TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system"); - if (sys && sys->Check_Lifetime_Writes() == 0) { - LOGINFO("System writes is 0, show system_readonly page\n"); - DataManager::SetValue("tw_back", "main"); - if (gui_startPage("system_readonly", 1, 1) != 0) { - LOGERR("Failed to start system_readonly GUI page.\n"); + TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system"); + if (sys) { + if (DataManager::GetIntValue("tw_mount_system_ro") != 0) { + if (sys->Check_Lifetime_Writes() == 0) { + if (DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) { + DataManager::SetValue("tw_back", "main"); + if (gui_startPage("system_readonly", 1, 1) != 0) { + LOGERR("Failed to start system_readonly GUI page.\n"); + } + } + } else { + DataManager::SetValue("tw_mount_system_ro", 0); + sys->Change_Mount_Read_Only(false); } } else { - DataManager::SetValue("tw_mount_system_ro", 0); + sys->Change_Mount_Read_Only(false); } } -- cgit v1.2.3