Revert "Save zygoteInit callbacks to invoke after process forked"
This reverts commit 8c4682e
This commit is contained in:
parent
6254660b9b
commit
f417209b81
|
|
@ -84,7 +84,6 @@ public class Main implements KeepAll {
|
|||
// load modules for each app process on its forked
|
||||
Router.loadModulesSafely();
|
||||
}
|
||||
Router.callZygoteInits();
|
||||
} else {
|
||||
// in zygote process, res is child zygote pid
|
||||
// don't print log here, see https://github.com/RikkaApps/Riru/blob/77adfd6a4a6a81bfd20569c910bc4854f2f84f5e/riru-core/jni/main/jni_native_method.cpp#L55-L66
|
||||
|
|
@ -110,7 +109,6 @@ public class Main implements KeepAll {
|
|||
Router.prepare(true);
|
||||
Router.onProcessForked(true);
|
||||
Router.loadModulesSafely();
|
||||
Router.callZygoteInits();
|
||||
} else {
|
||||
// in zygote process, res is child zygote pid
|
||||
// don't print log here, see https://github.com/RikkaApps/Riru/blob/77adfd6a4a6a81bfd20569c910bc4854f2f84f5e/riru-core/jni/main/jni_native_method.cpp#L55-L66
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ import com.elderdrivers.riru.xposed.entry.bootstrap.SysInnerHookInfo;
|
|||
import com.elderdrivers.riru.xposed.entry.hooker.SystemMainHooker;
|
||||
import com.elderdrivers.riru.xposed.util.Utils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import de.robv.android.xposed.IXposedHookZygoteInit;
|
||||
import de.robv.android.xposed.XposedBridge;
|
||||
import de.robv.android.xposed.XposedInit;
|
||||
|
||||
|
|
@ -19,7 +16,6 @@ public class Router {
|
|||
// this flag is needed when loadModules
|
||||
XposedInit.startsSystemServer = isSystem;
|
||||
}
|
||||
|
||||
public static void onProcessForked(boolean isSystem) {
|
||||
// Initialize the Xposed framework
|
||||
try {
|
||||
|
|
@ -39,16 +35,6 @@ public class Router {
|
|||
}
|
||||
}
|
||||
|
||||
public static void callZygoteInits() {
|
||||
for (Map.Entry<IXposedHookZygoteInit, IXposedHookZygoteInit.StartupParam> entry : XposedBridge.sZygoteInitCallbacks.entrySet()) {
|
||||
try {
|
||||
entry.getKey().initZygote(entry.getValue());
|
||||
} catch (Throwable t) {
|
||||
Utils.logE("Failed to load class " + entry.getKey().getClass(), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void startBootstrapHook(boolean isSystem) {
|
||||
Utils.logD("startBootstrapHook starts: isSystem = " + isSystem);
|
||||
ClassLoader classLoader = XposedBridge.BOOTCLASSLOADER;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ public final class XposedBridge {
|
|||
// built-in handlers
|
||||
private static final Map<Member, CopyOnWriteSortedSet<XC_MethodHook>> sHookedMethodCallbacks = new HashMap<>();
|
||||
public static final CopyOnWriteSortedSet<XC_LoadPackage> sLoadedPackageCallbacks = new CopyOnWriteSortedSet<>();
|
||||
public static final HashMap<IXposedHookZygoteInit, IXposedHookZygoteInit.StartupParam> sZygoteInitCallbacks = new HashMap<>();
|
||||
/*package*/ static final CopyOnWriteSortedSet<XC_InitPackageResources> sInitPackageResourcesCallbacks = new CopyOnWriteSortedSet<>();
|
||||
|
||||
private XposedBridge() {}
|
||||
|
|
@ -373,13 +372,6 @@ public final class XposedBridge {
|
|||
}
|
||||
}
|
||||
|
||||
public static void hookZygoteInit(IXposedHookZygoteInit moduleInstance,
|
||||
IXposedHookZygoteInit.StartupParam param) {
|
||||
synchronized (sZygoteInitCallbacks) {
|
||||
sZygoteInitCallbacks.put(moduleInstance, param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a callback to be executed when the resources for an app are initialized.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -208,8 +208,7 @@ public final class XposedInit {
|
|||
IXposedHookZygoteInit.StartupParam param = new IXposedHookZygoteInit.StartupParam();
|
||||
param.modulePath = apk;
|
||||
param.startsSystemServer = startsSystemServer;
|
||||
// ((IXposedHookZygoteInit) moduleInstance).initZygote(param);
|
||||
XposedBridge.hookZygoteInit((IXposedHookZygoteInit) moduleInstance, param);
|
||||
((IXposedHookZygoteInit) moduleInstance).initZygote(param);
|
||||
}
|
||||
|
||||
if (moduleInstance instanceof IXposedHookLoadPackage)
|
||||
|
|
|
|||
Loading…
Reference in New Issue