Support RootService on stub APKs

This commit is contained in:
topjohnwu
2021-12-13 03:57:27 -08:00
parent edcf9f1b0c
commit 54e3f1998a
9 changed files with 130 additions and 68 deletions
@@ -18,7 +18,7 @@ public class DelegateApplication extends Application {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
receiver = InjectAPK.setup(this);
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);
@@ -27,6 +27,13 @@ public class DelegateApplication extends Application {
} catch (Exception ignored) { /* Impossible */ }
}
@Override
public void onCreate() {
super.onCreate();
if (receiver != null)
receiver.onCreate();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);