Add pre-lollipop support

This commit is contained in:
topjohnwu 2023-01-08 21:59:06 +08:00 committed by John Wu
parent 9043cd5c46
commit 01de4f25fe
3 changed files with 8 additions and 2 deletions

View File

@ -96,7 +96,7 @@ subprojects {
afterEvaluate {
android {
compileSdkVersion(33)
buildToolsVersion = "32.0.0"
buildToolsVersion = "33.0.1"
defaultConfig {
if (minSdkVersion == null)

View File

@ -187,6 +187,9 @@ public final class Utils {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return Process.is64Bit();
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return false;
}
try {
Class<?> classVMRuntime = Class.forName("dalvik.system.VMRuntime");
Method getRuntime = classVMRuntime.getDeclaredMethod("getRuntime");

View File

@ -216,7 +216,10 @@ public class RootServiceManager implements Handler.Callback {
}
// We cannot readlink /proc/self/exe on old kernels
String app_process = "/system/bin/app_process" + (Utils.isProcess64Bit() ? "64" : "32");
String app_process = "/system/bin/app_process";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
app_process += Utils.isProcess64Bit() ? "64" : "32";
}
String cmd = String.format(Locale.ROOT,
"(%s CLASSPATH=%s %s %s /system/bin %s " +
"com.topjohnwu.superuser.internal.RootServerMain '%s' %d %s >/dev/null 2>&1)&",