之前写的个插件,因为自己无太多正式软件编程能力,一般也就用点脚本语言,跟着论坛学着写的,在软件更新之前能用,先根据软件包名过滤不需要Hook的APP,因为是动态加载的class,再XposedBridge.hookAllMethods(ClassLoader.class, "loadClass", new XC_MethodHook() hook到了需要修改的界面,再在这个界面里面用列出了所有方法,找到自己需要的数据。最近软件更新之后,插件不能用了,在APP主界面正常,因为还没有开始hook动态加载的class,再点到子界面软件就崩溃了,排查了代码,注释了所有的功能,只留了下面这段什么也没做的代码,一样的崩溃,有知道为啥的么。
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
if (!loadPackageParam.packageName.contains("com.test.app")) return;
XposedBridge.hookAllMethods(ClassLoader.class, "loadClass", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
if (param.hasThrowable()) return;
Class<?> aClass = (Class<?>) param.getResult();
if (aClass.getName().contains("com.test.app.call.activity")) {
XposedBridge.log("hook test 1");
XposedBridge.hookAllMethods(aClass, "onCreate", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
XposedBridge.log("hook test 2");
}
});
}
}
});
}