diff --git a/extern/libsuperuser/libsuperuser/build.gradle b/extern/libsuperuser/libsuperuser/build.gradle index 14d725df9..109b4cf62 100644 --- a/extern/libsuperuser/libsuperuser/build.gradle +++ b/extern/libsuperuser/libsuperuser/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 21 - buildToolsVersion '22.0.1' + buildToolsVersion "21.1.0" defaultConfig { minSdkVersion 4 @@ -20,6 +20,9 @@ android { assets.srcDirs = ['assets'] } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_6 + } } version = "1.0.0." + (new Date()).format('yyyyMMddHHmm') diff --git a/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Application.java b/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Application.java index a439517fb..095c7209b 100644 --- a/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Application.java +++ b/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Application.java @@ -74,6 +74,7 @@ public class Application extends android.app.Application { // this makes sure AsyncTask's internal handler is created from the right (main) thread Class.forName("android.os.AsyncTask"); } catch (ClassNotFoundException e) { + // will never happen } } } diff --git a/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Debug.java b/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Debug.java index c6f695ca0..6116c9abb 100644 --- a/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Debug.java +++ b/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Debug.java @@ -35,7 +35,7 @@ public class Debug { * builds and disabled for exported APKs - see * BuildConfig.DEBUG
* - * @param enabled Enable debug mode ? + * @param enable Enable debug mode ? */ public static void setDebug(boolean enable) { debug = enable; @@ -53,7 +53,7 @@ public class Debug { // ----- LOGGING ----- public interface OnLogListener { - public void onLog(int type, String typeIndicator, String message); + void onLog(int type, String typeIndicator, String message); } public static final String TAG = "libsuperuser"; @@ -130,7 +130,7 @@ public class Debug { * occur. * * @param type LOG_* constants - * @param enabled Enable or disable + * @param enable Enable or disable */ public static void setLogTypeEnabled(int type, boolean enable) { if (enable) { @@ -199,7 +199,7 @@ public class Debug { *Enables or disables the library crashing when su is called * from the main thread.
* - * @param enabled Enable or disable + * @param enable Enable or disable */ public static void setSanityChecksEnabled(boolean enable) { sanityChecks = enable; diff --git a/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Shell.java b/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Shell.java index ebd03cff9..742363a87 100644 --- a/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Shell.java +++ b/extern/libsuperuser/libsuperuser/src/eu/chainfire/libsuperuser/Shell.java @@ -177,6 +177,7 @@ public class Shell { try { STDIN.close(); } catch (IOException e) { + // might be closed already } STDOUT.join(); STDERR.join(); @@ -368,7 +369,7 @@ public class Shell { if (ret != null) { for (String line : ret) { if (!internal) { - if (line.contains(".")) { + if (!line.trim().equals("")) { version = line; break; } @@ -379,6 +380,7 @@ public class Shell { break; } } catch (NumberFormatException e) { + // should be parsable, try next line otherwise } } } @@ -474,18 +476,17 @@ public class Shell { // leak if (android.os.Build.VERSION.SDK_INT >= 17) { // Detect enforcing through sysfs, not always present - if (enforcing == null) { - File f = new File("/sys/fs/selinux/enforce"); - if (f.exists()) { + File f = new File("/sys/fs/selinux/enforce"); + if (f.exists()) { + try { + InputStream is = new FileInputStream("/sys/fs/selinux/enforce"); try { - InputStream is = new FileInputStream("/sys/fs/selinux/enforce"); - try { - enforcing = (is.read() == '1'); - } finally { - is.close(); - } - } catch (Exception e) { + enforcing = (is.read() == '1'); + } finally { + is.close(); } + } catch (Exception e) { + // we might not be allowed to read, thanks SELinux } } @@ -524,13 +525,13 @@ public class Shell { private interface OnResult { // for any onCommandResult callback - public static final int WATCHDOG_EXIT = -1; - public static final int SHELL_DIED = -2; + int WATCHDOG_EXIT = -1; + int SHELL_DIED = -2; // for Interactive.open() callbacks only - public static final int SHELL_EXEC_FAILED = -3; - public static final int SHELL_WRONG_UID = -4; - public static final int SHELL_RUNNING = 0; + int SHELL_EXEC_FAILED = -3; + int SHELL_WRONG_UID = -4; + int SHELL_RUNNING = 0; } /** @@ -557,7 +558,7 @@ public class Shell { * @param exitCode Exit code of the last command in the block * @param output All output generated by the command block */ - public void onCommandResult(int commandCode, int exitCode, List