mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-11-15 11:23:35 +00:00
Magisk officially moving away from Safety Net bypasses
This commit is contained in:
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
public class Shell {
|
||||
|
||||
// -1 = problematic/unknown issue; 0 = not rooted; 1 = properly rooted; 2 = improperly rooted;
|
||||
// -1 = problematic/unknown issue; 0 = not rooted; 1 = properly rooted
|
||||
public static int rootStatus;
|
||||
|
||||
private static Process rootShell;
|
||||
@@ -27,18 +27,12 @@ public class Shell {
|
||||
private static void init() {
|
||||
|
||||
try {
|
||||
rootShell = Runtime.getRuntime().exec(sh("getprop magisk.supath").get(0) + "/su");
|
||||
rootShell = Runtime.getRuntime().exec("su");
|
||||
rootStatus = 1;
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
// Improper root
|
||||
rootShell = Runtime.getRuntime().exec("su");
|
||||
rootStatus = 2;
|
||||
} catch (IOException err) {
|
||||
// No root
|
||||
rootStatus = 0;
|
||||
return;
|
||||
}
|
||||
} catch (IOException err) {
|
||||
// No root
|
||||
rootStatus = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
rootSTDIN = new DataOutputStream(rootShell.getOutputStream());
|
||||
|
||||
@@ -73,17 +73,6 @@ public class Utils {
|
||||
return Shell.rootAccess() && Boolean.parseBoolean(Shell.su(command).get(0));
|
||||
}
|
||||
|
||||
public static void toggleRoot(Boolean b, Context context) {
|
||||
if (MagiskFragment.magiskVersion != -1) {
|
||||
if (b) {
|
||||
Shell.su("ln -s $(getprop magisk.supath) /magisk/.core/bin", "setprop magisk.root 1");
|
||||
} else {
|
||||
Shell.su("rm -rf /magisk/.core/bin", "setprop magisk.root 0");
|
||||
}
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("root", b).apply();
|
||||
}
|
||||
}
|
||||
|
||||
static List<String> getModList(String path) {
|
||||
List<String> ret;
|
||||
String command = "find " + path + " -type d -maxdepth 1 ! -name \"*.core\" ! -name \"*lost+found\" ! -name \"*magisk\"";
|
||||
|
||||
Reference in New Issue
Block a user