mirror of
https://github.com/topjohnwu/libsu.git
synced 2025-02-17 02:29:09 +00:00
Add startup agents warning
Co-authored-by: topjohnwu <topjohnwu@gmail.com>
This commit is contained in:
parent
0f3698afa4
commit
fc42e8274e
5
core/proguard-rules.pro
vendored
5
core/proguard-rules.pro
vendored
@ -24,11 +24,10 @@
|
||||
-assumenosideeffects class com.topjohnwu.superuser.internal.Utils {
|
||||
public static void log(...);
|
||||
public static void ex(...);
|
||||
}
|
||||
-assumevalues class com.topjohnwu.superuser.internal.Utils {
|
||||
public static boolean vLog() return false;
|
||||
public static boolean hasStartupAgents(android.content.Context) return false;
|
||||
}
|
||||
-assumevalues class android.os.Debug {
|
||||
-assumenosideeffects class android.os.Debug {
|
||||
public static boolean isDebuggerConnected() return false;
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,13 @@ public final class Utils {
|
||||
return context;
|
||||
}
|
||||
|
||||
public static boolean hasStartupAgents(Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R)
|
||||
return false;
|
||||
File agents = new File(context.getCodeCacheDir(), "startup_agents");
|
||||
return agents.isDirectory();
|
||||
}
|
||||
|
||||
public static boolean isSynchronized(Collection<?> collection) {
|
||||
if (synchronizedCollectionClass == null) {
|
||||
synchronizedCollectionClass =
|
||||
|
@ -39,6 +39,7 @@ import android.os.Messenger;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -80,6 +81,13 @@ public class RootServiceManager implements Handler.Callback {
|
||||
private static final String API_28_DEBUG =
|
||||
"-XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y " +
|
||||
"-Xcompiler-option --debuggable";
|
||||
private static final String JVMTI_ERROR = " \n" +
|
||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" +
|
||||
"! Warning: JVMTI agent is enabled. Please enable the !\n" +
|
||||
"! 'Always install with package manager' option in !\n" +
|
||||
"! Android Studio. For more details and information, !\n" +
|
||||
"! check out RootService's Javadoc. !\n" +
|
||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
|
||||
|
||||
private static final int REMOTE_EN_ROUTE = 1 << 0;
|
||||
private static final int DAEMON_EN_ROUTE = 1 << 1;
|
||||
@ -141,6 +149,11 @@ public class RootServiceManager implements Handler.Callback {
|
||||
|
||||
private Shell.Task startRootProcess(ComponentName name, String action) {
|
||||
Context context = Utils.getContext();
|
||||
|
||||
if (Utils.hasStartupAgents(context)) {
|
||||
Log.e(TAG, JVMTI_ERROR);
|
||||
}
|
||||
|
||||
if (filterAction == null) {
|
||||
filterAction = UUID.randomUUID().toString();
|
||||
// Register receiver to receive binder from root process
|
||||
|
@ -41,9 +41,9 @@ import java.util.concurrent.Executor;
|
||||
/**
|
||||
* A remote root service using native Android Binder IPC.
|
||||
* <p>
|
||||
* Pro tip: while developing an app with RootServices, modify the run/debug configuration and check
|
||||
* the "Always install with package manager" option if testing on Android 11+, or else the code
|
||||
* changes will not be reflected after Android Studio's deployment.
|
||||
* Important: while developing an app with RootServices, modify the run/debug configuration and
|
||||
* check the "Always install with package manager" option if testing on Android 11+, or else the
|
||||
* code changes will not be reflected after Android Studio's deployment.
|
||||
* <p>
|
||||
* This class is almost a complete recreation of a bound service running in a root process.
|
||||
* Instead of using the original {@code Context.bindService(...)} methods to start and bind
|
||||
|
Loading…
x
Reference in New Issue
Block a user