From a009fdbdc36bfbb58a4dee650f14be42d8b5bed9 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 2 Feb 2022 04:49:23 -0800 Subject: [PATCH] Fix root service on stub --- .../java/com/topjohnwu/magisk/DelegateComponentFactory.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java b/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java index c2a3ad840..2f6911c8e 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java @@ -9,6 +9,7 @@ import android.content.BroadcastReceiver; import android.content.ContentProvider; import android.content.Intent; import android.content.pm.ApplicationInfo; +import android.os.Process; @SuppressLint("NewApi") public class DelegateComponentFactory extends AppComponentFactory { @@ -21,6 +22,10 @@ public class DelegateComponentFactory extends AppComponentFactory { @Override public ClassLoader instantiateClassLoader(ClassLoader cl, ApplicationInfo info) { + if (Process.myUid() == 0) { + // Do not do anything in root process + return cl; + } DynLoad.loadApk(info); return new DelegateClassLoader(); }