Skip to content

Commit 87e1090

Browse files
author
weishu.tws
committed
replace Application.onCreate with Instrumentation.callApplicationOnCreate for CHA.
1 parent 4e4c93d commit 87e1090

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

exposed-core/src/main/java/me/weishu/exposed/ExposedBridge.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.annotation.SuppressLint;
44
import android.app.Application;
5+
import android.app.Instrumentation;
56
import android.content.ComponentName;
67
import android.content.Context;
78
import android.content.ContextWrapper;
@@ -344,9 +345,16 @@ private static Member replaceForCHA(Member member) {
344345
if (member.getDeclaringClass() == Application.class && member.getName().equals("attach")) {
345346

346347
Method m = XposedHelpers.findMethodExact(ContextWrapper.class, "attachBaseContext", Context.class);
347-
XposedBridge.log("replace ContextWrapper.attachBaseContext with Application.attach for CHA");
348+
XposedBridge.log("replace Application.attach with ContextWrapper.attachBaseContext for CHA");
348349
return m;
349350
}
351+
352+
if (member.getDeclaringClass() == Application.class && member.getName().equals("onCreate")) {
353+
Method m = XposedHelpers.findMethodExact(Instrumentation.class, "callApplicationOnCreate", Application.class);
354+
XposedBridge.log("replace Application.onCreate with Instrumentation.callApplicationOnCreate for CHA");
355+
return m;
356+
}
357+
350358
return member;
351359
}
352360

0 commit comments

Comments
 (0)