Skip to content

Commit 046844b

Browse files
author
weishu.tws
committed
do not load module for wechat appbrand.
1 parent 5258cda commit 046844b

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ public class ExposedBridge {
7070
public static final String BASE_DIR = Build.VERSION.SDK_INT >= 24
7171
? "/data/user_de/0/de.robv.android.xposed.installer/" : BASE_DIR_LEGACY;
7272

73+
private static final String WECHAT = decodeFromBase64("Y29tLnRlbmNlbnQubW0=");
74+
7375
private static final int FAKE_XPOSED_VERSION = 91;
7476
private static final String VERSION_KEY = "version";
7577
private static boolean SYSTEM_CLASSLOADER_INJECT = false;
@@ -210,6 +212,10 @@ public static ModuleLoadResult loadModule(final String moduleApkPath, String mod
210212
if (moduleClassName.isEmpty() || moduleClassName.startsWith("#"))
211213
continue;
212214

215+
if (filterModuleForApp(currentApplicationInfo, moduleClassName)) {
216+
XposedBridge.log("ignore module: " + moduleClassName + " for application: " + currentApplicationInfo.packageName);
217+
continue;
218+
}
213219
try {
214220
log(" Loading class " + moduleClassName);
215221
Class<?> moduleClass = mcl.loadClass(moduleClassName);
@@ -324,6 +330,32 @@ private static boolean filterApplication(ApplicationInfo applicationInfo) {
324330
return false;
325331
}
326332

333+
private static boolean filterModuleForApp(ApplicationInfo applicationInfo, String moduleEntry) {
334+
if (applicationInfo == null || applicationInfo.packageName == null) {
335+
return false;
336+
}
337+
338+
final String WECHAT_JUMP_HELPER = "com.emily.mmjumphelper.xposed.XposedMain";
339+
340+
if (WECHAT.equals(applicationInfo.packageName)) {
341+
if (applicationInfo.processName.contains("appbrand")) {
342+
// wechat app brand
343+
if (WECHAT_JUMP_HELPER.equals(moduleEntry)) {
344+
// now only load module for appbrand.
345+
return false;
346+
} else {
347+
return true;
348+
}
349+
} else {
350+
if (WECHAT_JUMP_HELPER.equals(moduleEntry)) {
351+
return true;
352+
}
353+
}
354+
}
355+
356+
return false;
357+
}
358+
327359
private static void initForXposedInstaller(Context context, ApplicationInfo applicationInfo, ClassLoader appClassLoader) {
328360
if (!isXposedInstaller(applicationInfo)) {
329361
return;
@@ -478,7 +510,6 @@ private static void initForWechat(Context context, ApplicationInfo applicationIn
478510
if (applicationInfo == null) {
479511
return;
480512
}
481-
final String WECHAT = decodeFromBase64("Y29tLnRlbmNlbnQubW0=");
482513

483514
if (!WECHAT.equals(applicationInfo.packageName)) {
484515
return;

0 commit comments

Comments
 (0)