Clean up loaded module callbacks for blacklisted app
Otherwise a few applications would get stuck at launch screen, for unknown reason.
This commit is contained in:
parent
c28c2cb065
commit
47c500b96d
|
|
@ -9,6 +9,8 @@ import com.elderdrivers.riru.xposed.util.PrebuiltMethodsDeopter;
|
|||
import com.elderdrivers.riru.xposed.util.ProcessUtils;
|
||||
import com.elderdrivers.riru.xposed.util.Utils;
|
||||
|
||||
import de.robv.android.xposed.XposedBridge;
|
||||
|
||||
import static com.elderdrivers.riru.xposed.Main.isAppNeedHook;
|
||||
import static com.elderdrivers.riru.xposed.util.FileUtils.getDataPathPrefix;
|
||||
|
||||
|
|
@ -80,6 +82,7 @@ public class BlackWhiteListProxy {
|
|||
// because installed hooks would be propagated to all child processes of zygote
|
||||
Router.startWorkAroundHook();
|
||||
// loadModules once for all child processes of zygote
|
||||
// TODO maybe just save initZygote callbacks and call them when whitelisted process forked?
|
||||
Router.loadModulesSafely(true);
|
||||
}
|
||||
|
||||
|
|
@ -112,6 +115,15 @@ public class BlackWhiteListProxy {
|
|||
// FIXME some process cannot read app_data_file because of MLS, e.g. bluetooth
|
||||
needHook = isAppNeedHook(appDataDir);
|
||||
}
|
||||
if (!needHook) {
|
||||
// clean up the scene
|
||||
onBlackListed();
|
||||
}
|
||||
return needHook;
|
||||
}
|
||||
|
||||
private static void onBlackListed() {
|
||||
XposedBridge.clearLoadedPackages();
|
||||
XposedBridge.clearInitPackageResources();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,6 +393,12 @@ public final class XposedBridge {
|
|||
// }
|
||||
}
|
||||
|
||||
public static void clearInitPackageResources() {
|
||||
synchronized (sInitPackageResourcesCallbacks) {
|
||||
sInitPackageResourcesCallbacks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept every call to the specified method and call a handler function instead.
|
||||
* @param method The method to intercept
|
||||
|
|
|
|||
Loading…
Reference in New Issue