@@ -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+ final static 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 ;
@@ -79,6 +81,9 @@ public class ExposedBridge {
7981 private static ClassLoader xposedClassLoader ;
8082
8183 private static Context appContext ;
84+ private static String currentPackage ;
85+ private static boolean yieldMode = false ;
86+
8287 private static ModuleLoadListener sModuleLoadListener = new ModuleLoadListener () {
8388 @ Override
8489 public void onLoadingModule (String moduleClassName , ApplicationInfo applicationInfo , ClassLoader appClassLoader ) {
@@ -106,6 +111,8 @@ public static void initOnce(Context context, ApplicationInfo applicationInfo, Cl
106111 // SYSTEM_CLASSLOADER_INJECT = patchSystemClassLoader();
107112 XposedBridge .XPOSED_BRIDGE_VERSION = FAKE_XPOSED_VERSION ;
108113 appContext = context ;
114+ initForPackage (context , applicationInfo );
115+
109116 ReLinker .loadLibrary (context , "epic" );
110117 ExposedHelper .initSeLinux (applicationInfo .processName );
111118 XSharedPreferences .setPackageBaseDirectory (new File (applicationInfo .dataDir ).getParentFile ());
@@ -116,6 +123,30 @@ public static void initOnce(Context context, ApplicationInfo applicationInfo, Cl
116123 initForQQ (context , applicationInfo , appClassLoader );
117124 }
118125
126+ private static void initForPackage (Context context , ApplicationInfo applicationInfo ) {
127+ do {
128+ if (applicationInfo == null ) {
129+ break ;
130+ }
131+ String pkg = applicationInfo .packageName ;
132+ if (pkg == null ) {
133+ break ;
134+ }
135+ currentPackage = pkg ;
136+
137+ } while (false );
138+
139+ if (currentPackage == null ) {
140+ currentPackage = context .getPackageName ();
141+ }
142+
143+ String yieldModeConfig = System .getProperty ("yieldMode" );
144+ if ("true" .equals (yieldModeConfig )) {
145+ yieldMode = true ;
146+ XposedBridge .log ("yield mode take effect" );
147+ }
148+ }
149+
119150 private static boolean patchSystemClassLoader () {
120151 // 1. first create XposedClassLoader -> BootstrapClassLoader
121152 ClassLoader xposedClassLoader = new XposedClassLoader (ExposedBridge .class .getClassLoader ());
@@ -264,6 +295,22 @@ public static ModuleLoadResult loadModule(final String moduleApkPath, String mod
264295 }
265296
266297 private static boolean ignoreHooks (Member member ) {
298+ if (member == null ) {
299+ return false ;
300+ }
301+
302+ if (!yieldMode ) {
303+ return false ;
304+ }
305+
306+ String name = member .getDeclaringClass ().getName ();
307+ if (WECHAT .equals (currentPackage )) {
308+ if (name .contains ("wcdb" )) {
309+ Log .i ("mylog" , "ignore hook for: " + name );
310+ return true ;
311+ }
312+ }
313+
267314 return false ;
268315 }
269316
@@ -478,7 +525,6 @@ private static void initForWechat(Context context, ApplicationInfo applicationIn
478525 if (applicationInfo == null ) {
479526 return ;
480527 }
481- final String WECHAT = decodeFromBase64 ("Y29tLnRlbmNlbnQubW0=" );
482528
483529 if (!WECHAT .equals (applicationInfo .packageName )) {
484530 return ;
0 commit comments