Use AppComponentFactory to replace ClassLoader

This commit is contained in:
topjohnwu
2022-02-01 22:43:44 -08:00
parent 7f65f7d3ca
commit 355341f0ab
7 changed files with 139 additions and 83 deletions
@@ -2,11 +2,8 @@ package com.topjohnwu.magisk;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;
import java.lang.reflect.Method;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
@@ -17,14 +14,7 @@ public class DelegateApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
receiver = DynLoad.setup(this);
if (receiver != null) try {
// Call attachBaseContext without ContextImpl to show it is being wrapped
Method m = ContextWrapper.class.getDeclaredMethod("attachBaseContext", Context.class);
m.setAccessible(true);
m.invoke(receiver, this);
} catch (Exception ignored) { /* Impossible */ }
receiver = DynLoad.createAndSetupApp(this);
}
@Override