mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-06 07:20:47 -05:00
Remove all backwards compatibility nonsense
This also allows full obfuscation
This commit is contained in:
@@ -9,7 +9,6 @@ import androidx.annotation.Keep;
|
||||
|
||||
public class BootSigner {
|
||||
|
||||
@Keep
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (args.length > 0 && "-verify".equals(args[0])) {
|
||||
String certPath = "";
|
||||
|
||||
@@ -21,10 +21,6 @@ public class RootUtils extends Shell.Initializer {
|
||||
BusyBox.BB_PATH = new File(Const.BUSYBOX_PATH);
|
||||
}
|
||||
|
||||
public static void uninstallPkg(String pkg) {
|
||||
Shell.su("db_clean " + Const.USER_ID, "pm uninstall " + pkg).exec();
|
||||
}
|
||||
|
||||
public static void rmAndLaunch(String rm, String launch) {
|
||||
Shell.su(Utils.fmt("(rm_launch %d %s %s)&", Const.USER_ID, rm, launch)).exec();
|
||||
}
|
||||
@@ -33,9 +29,6 @@ public class RootUtils extends Shell.Initializer {
|
||||
public boolean onInit(Context context, @NonNull Shell shell) {
|
||||
Shell.Job job = shell.newJob();
|
||||
if (shell.isRoot()) {
|
||||
if (!new SuFile("/sbin/.magisk").exists())
|
||||
job.add("ln -s /sbin/.core /sbin/.magisk");
|
||||
|
||||
job.add(context.getResources().openRawResource(R.raw.util_functions))
|
||||
.add(context.getResources().openRawResource(R.raw.utils));
|
||||
Const.MAGISK_DISABLE_FILE = new SuFile("/cache/.disable_magisk");
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.topjohnwu.magisk.utils;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.LocalSocket;
|
||||
import android.net.LocalSocketAddress;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
@@ -24,12 +25,13 @@ import java.util.Date;
|
||||
|
||||
public abstract class SuConnector {
|
||||
|
||||
protected LocalSocket socket = new LocalSocket();
|
||||
private LocalSocket socket;
|
||||
protected DataOutputStream out;
|
||||
protected DataInputStream in;
|
||||
|
||||
public SuConnector(String name) throws IOException {
|
||||
connect(name);
|
||||
socket = new LocalSocket();
|
||||
socket.connect(new LocalSocketAddress(name, LocalSocketAddress.Namespace.ABSTRACT));
|
||||
out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()));
|
||||
in = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
|
||||
}
|
||||
@@ -66,11 +68,9 @@ public abstract class SuConnector {
|
||||
} catch (IOException ignored) { }
|
||||
}
|
||||
|
||||
public abstract void connect(String name) throws IOException;
|
||||
|
||||
protected abstract void onResponse() throws IOException;
|
||||
|
||||
public static void handleLogs(Intent intent, int version) {
|
||||
public static void handleLogs(Intent intent) {
|
||||
|
||||
int fromUid = intent.getIntExtra("from.uid", -1);
|
||||
if (fromUid < 0) return;
|
||||
@@ -97,24 +97,9 @@ public abstract class SuConnector {
|
||||
notify = policy.notification;
|
||||
}
|
||||
|
||||
if (version == 1) {
|
||||
String action = intent.getStringExtra("action");
|
||||
if (action == null) return;
|
||||
switch (action) {
|
||||
case "allow":
|
||||
policy.policy = Policy.ALLOW;
|
||||
break;
|
||||
case "deny":
|
||||
policy.policy = Policy.DENY;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
policy.policy = data.getInt("policy", -1);
|
||||
if (policy.policy < 0)
|
||||
return;
|
||||
}
|
||||
policy.policy = data.getInt("policy", -1);
|
||||
if (policy.policy < 0)
|
||||
return;
|
||||
|
||||
if (notify)
|
||||
handleNotify(policy);
|
||||
|
||||
Reference in New Issue
Block a user