xposed模块代码——得到上下文

2019-04-14 08:18发布

try { Class ContextClass = findClass("android.content.ContextWrapper", loadPackageParam.classLoader); findAndHookMethod(ContextClass, "getApplicationContext", new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { super.afterHookedMethod(param); if (applicationContext != null) return; applicationContext = (Context) param.getResult(); XposedBridge.log("CSDN_LQR-->得到上下文"); } }); } catch (Throwable t) { XposedBridge.log("CSDN_LQR-->获取上下文出错"); XposedBridge.log(t); }