From f193f88e6d54c186bd425c7f77dab3e6782b046b Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Wed, 11 Sep 2013 14:56:20 +0000 Subject: [PATCH] Make fixing su perms automatic In 4.3+ with SELinux, su perms will be lost on every reboot so users will get the prompt to fix su perms in TWRP every time. Make fixing the su perms automatic instead of nagging the user. Change-Id: Ia8a2652018db5e1f6ffc5fec2a4ac0db3a8f32bb --- gui/action.cpp | 5 +-- gui/devices/1024x600/res/ui.xml | 54 -------------------------------- gui/devices/1024x768/res/ui.xml | 54 -------------------------------- gui/devices/1080x1920/res/ui.xml | 54 -------------------------------- gui/devices/1280x800/res/ui.xml | 54 -------------------------------- gui/devices/1920x1200/res/ui.xml | 54 -------------------------------- gui/devices/2560x1600/res/ui.xml | 54 -------------------------------- gui/devices/320x480/res/ui.xml | 54 -------------------------------- gui/devices/480x800/res/ui.xml | 54 -------------------------------- gui/devices/480x854/res/ui.xml | 54 -------------------------------- gui/devices/540x960/res/ui.xml | 54 -------------------------------- gui/devices/720x1280/res/ui.xml | 54 -------------------------------- gui/devices/800x1280/res/ui.xml | 54 -------------------------------- gui/devices/800x480/res/ui.xml | 54 -------------------------------- twrp.cpp | 8 ++--- 15 files changed, 6 insertions(+), 709 deletions(-) diff --git a/gui/action.cpp b/gui/action.cpp index 78e86252..36f40061 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -603,6 +603,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) } if (function == "togglestorage") { + LOGERR("togglestorage action was deprecated from TWRP\n"); if (arg == "internal") { DataManager::SetValue(TW_USE_EXTERNAL_STORAGE, 0); } else if (arg == "external") { @@ -1290,8 +1291,8 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) if (simulate) { simulate_progress_bar(); } else { - if (!TWFunc::Fix_su_Perms()) - op_status = 1; + LOGERR("Fixing su permissions was deprecated from TWRP.\n"); + LOGERR("4.3+ ROMs with SELinux will always lose su perms.\n"); } operation_end(op_status, simulate); diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index bbcaae1f..569a5bd1 100755 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -3861,59 +3861,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index 97b98c04..6f8797a7 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -3861,59 +3861,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml index 5ba884b1..beaf3732 100644 --- a/gui/devices/1080x1920/res/ui.xml +++ b/gui/devices/1080x1920/res/ui.xml @@ -3855,59 +3855,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 66861f2c..115a391e 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -3861,59 +3861,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index d1a7829a..fb615c13 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -3861,59 +3861,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 23b7c3e0..9ce330a4 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -3861,59 +3861,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index 893c90cf..dbee885a 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -3842,59 +3842,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index 69002810..bb90e70b 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -3842,59 +3842,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index 09c50776..08c3ddcf 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -3841,59 +3841,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index f636e2e0..e03704ee 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -3842,59 +3842,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index 316b20e7..c9a4c0a6 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -3855,59 +3855,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index b8508414..9b7a0631 100755 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -3843,59 +3843,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index cbd3b7da..9c391b33 100755 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -3869,59 +3869,5 @@ Swipe to Install - - - - - - - - Fix Superuser Permissions? - - - - - - Root permissions appear to be lost. - - - - - - Fix root permissions now? - - - - - - (Fixes permissions on su binary & app) - - - - - - - Do Not Fix - - tw_page_done=1 - - - - - - - tw_action=fixsu - tw_action_text1=Fixing Root Permissions - tw_action_text2= - singleaction_page - - - - - - - Swipe to Fix Root - - diff --git a/twrp.cpp b/twrp.cpp index 5e1956f2..57e1657b 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -249,14 +249,12 @@ int main(int argc, char **argv) { // Device doesn't have su installed DataManager::SetValue("tw_busy", 1); if (gui_startPage("installsu") != 0) { - LOGERR("Failed to start decrypt GUI page.\n"); + LOGERR("Failed to start SuperSU install page.\n"); } } else if (TWFunc::Check_su_Perms() > 0) { // su perms are set incorrectly - DataManager::SetValue("tw_busy", 1); - if (gui_startPage("fixsu") != 0) { - LOGERR("Failed to start decrypt GUI page.\n"); - } + LOGINFO("Root permissions appear to be lost... fixing. (This will always happen on 4.3+ ROMs with SELinux.\n"); + TWFunc::Fix_su_Perms(); } sync(); PartitionManager.UnMount_By_Path("/system", false);