diff --git a/app/src/main/java/com/jens/automation2/Actions.java b/app/src/main/java/com/jens/automation2/Actions.java index d9cd7fd0..f5462af9 100644 --- a/app/src/main/java/com/jens/automation2/Actions.java +++ b/app/src/main/java/com/jens/automation2/Actions.java @@ -83,10 +83,6 @@ public class Actions public static AutomationService automationServerRef; public static Context context; private static Intent playMusicIntent; - private static boolean suAvailable = false; - private static String suVersion = null; - private static String suVersionInternal = null; - private static List suResult = null; public final static String smsSeparator = "&sms&"; public final static String dummyPackageString = "dummyPkg239asd"; @@ -1865,6 +1861,12 @@ public class Actions protected static boolean executeCommandViaSu(String[] commands) { + boolean suAvailable = false; + String suVersion = null; + String suVersionInternal = null; +// List suResult = null; + int suResult; + boolean success = false; try @@ -1874,17 +1876,30 @@ public class Actions { suVersion = Shell.SU.version(false); suVersionInternal = Shell.SU.version(true); - suResult = Shell.SU.run(commands); - if (suResult != null) + Miscellaneous.logEvent("i", "executeCommandViaSu()", "suVersion: " + suVersion + ", suVersionInternal: " + suVersionInternal, 5); + +// suResult = Shell.SU.run(commands); + suResult = Shell.Pool.SU.run(commands); + +// if (suResult != null) +// success = true; + + Miscellaneous.logEvent("i", "executeCommandViaSu()", "RC=" + String.valueOf(suResult), 3); + + if(suResult == 0) success = true; } + else + Miscellaneous.logEvent("w", "executeCommandViaSu()", "su not available.", 4); } catch (Exception e) { success = false; } + Miscellaneous.logEvent("i", "executeCommandViaSu()", "Returning " + String.valueOf(success), 4); + return success; }