Skip to content

Commit 5fb7933

Browse files
author
weishu.tws
committed
replace Application.onCreate with ContextWrapper.attachBaseContext for CHA.
1 parent 87e1090 commit 5fb7933

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.annotation.SuppressLint;
44
import android.app.Application;
5-
import android.app.Instrumentation;
65
import android.content.ComponentName;
76
import android.content.Context;
87
import android.content.ContextWrapper;
@@ -343,15 +342,14 @@ public static XC_MethodHook.Unhook hookMethod(Member method, XC_MethodHook callb
343342
private static Member replaceForCHA(Member member) {
344343

345344
if (member.getDeclaringClass() == Application.class && member.getName().equals("attach")) {
346-
347345
Method m = XposedHelpers.findMethodExact(ContextWrapper.class, "attachBaseContext", Context.class);
348346
XposedBridge.log("replace Application.attach with ContextWrapper.attachBaseContext for CHA");
349347
return m;
350348
}
351349

352350
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");
351+
Method m = XposedHelpers.findMethodExact(ContextWrapper.class, "attachBaseContext", Context.class);
352+
XposedBridge.log("replace Application.onCreate with ContextWrapper.attachBaseContext for CHA");
355353
return m;
356354
}
357355

0 commit comments

Comments
 (0)