Skip to content

Commit 220a9eb

Browse files
author
tiann
committed
2 parents f4b2e42 + 89410df commit 220a9eb

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

exposed-core/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ android {
2323

2424
dependencies {
2525
compile fileTree(dir: 'libs', include: ['*.jar'])
26-
compile 'me.weishu.exposed:exposed-xposedapi:0.3.3' // The Xposed API
27-
compile ('me.weishu:epic:0.5.3') { // The AOP Framework
26+
compile 'me.weishu.exposed:exposed-xposedapi:0.4.0' // The Xposed API
27+
compile ('me.weishu:epic:0.5.9') { // The AOP Framework
2828
exclude group: 'me.weishu.exposed', module: 'exposed-xposedapi'
2929
}
3030
compile 'com.getkeepsafe.relinker:relinker:1.2.3' // for load library
3131
}
3232

3333
group = 'me.weishu.exposed'
34-
version = '0.5.9'
34+
version = '0.6.5'
3535

3636
apply plugin: 'com.novoda.bintray-release'
3737

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

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.lang.reflect.Array;
3535
import java.lang.reflect.Constructor;
3636
import java.lang.reflect.Field;
37+
import java.lang.reflect.InvocationTargetException;
3738
import java.lang.reflect.Member;
3839
import java.lang.reflect.Method;
3940
import java.util.Arrays;
@@ -71,6 +72,7 @@ public class ExposedBridge {
7172
? "/data/user_de/0/de.robv.android.xposed.installer/" : BASE_DIR_LEGACY;
7273

7374
private static final String WECHAT = decodeFromBase64("Y29tLnRlbmNlbnQubW0=");
75+
private static final String QQ = decodeFromBase64("Y29tLnRlbmNlbnQubW9iaWxlcXE=");
7476

7577
private static final int FAKE_XPOSED_VERSION = 91;
7678
private static final String VERSION_KEY = "version";
@@ -304,14 +306,22 @@ private static boolean ignoreHooks(Member member) {
304306
return false;
305307
}
306308

309+
String name = member.getDeclaringClass().getName();
310+
if (QQ.equals(currentPackage)) {
311+
// TODO, we just ignore this hook to avoid crash, fix it when you figure out it. (getManager)
312+
if (name.contains("QQAppInterface")) {
313+
// Log.i("mylog", "ignore hook for: " + member);
314+
return true;
315+
}
316+
}
317+
307318
if (!yieldMode) {
308319
return false;
309320
}
310321

311-
String name = member.getDeclaringClass().getName();
312322
if (WECHAT.equals(currentPackage)) {
313323
if (name.contains("wcdb")) {
314-
Log.i("mylog", "ignore hook for: " + name);
324+
// Log.i("mylog", "ignore hook for: " + member);
315325
return true;
316326
}
317327
}
@@ -330,14 +340,26 @@ public static XC_MethodHook.Unhook hookMethod(Member method, XC_MethodHook callb
330340
return ExposedHelper.newUnHook(callback, unhook.getHookedMethod());
331341
}
332342

343+
public static Object invokeOriginalMethod(Member method, Object thisObject, Object[] args)
344+
throws NullPointerException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
345+
346+
return DexposedBridge.invokeOriginalMethod(method, thisObject, args);
347+
}
348+
333349
private static Member replaceForCHA(Member member) {
334350

335351
if (member.getDeclaringClass() == Application.class && member.getName().equals("attach")) {
352+
Method m = XposedHelpers.findMethodExact(ContextWrapper.class, "attachBaseContext", Context.class);
353+
XposedBridge.log("replace Application.attach with ContextWrapper.attachBaseContext for CHA");
354+
return m;
355+
}
336356

357+
if (member.getDeclaringClass() == Application.class && member.getName().equals("onCreate")) {
337358
Method m = XposedHelpers.findMethodExact(ContextWrapper.class, "attachBaseContext", Context.class);
338-
XposedBridge.log("replace ContextWrapper.attachBaseContext with Application.attach for CHA");
359+
XposedBridge.log("replace Application.onCreate with ContextWrapper.attachBaseContext for CHA");
339360
return m;
340361
}
362+
341363
return member;
342364
}
343365

@@ -348,7 +370,7 @@ private static void initForXposedModule(Context context, ApplicationInfo applica
348370
inputStream = context.getAssets().open("xposed_init");
349371
System.setProperty("epic.force", "true");
350372
} catch (IOException e) {
351-
log("initForXposedModule, ignore :" + applicationInfo.packageName);
373+
log(applicationInfo.packageName + " is not a Xposed module");
352374
} finally {
353375
closeSliently(inputStream);
354376
}

0 commit comments

Comments
 (0)