第一步:找到当前activity
此处使用的adb命令
adb shell dumpsys activity top > activity_top.txt
也能看到View Hierarchy,整个view树结构
第二步:找到余额控件ID
查找id为ff3的16进制值:
通过activity_top查看
com.robinhood.ticker.TickerView{46e2cf1 V.ED..... ........ 0,0-105,37 #7f092263 app:id/ff3}
在里面找到元素对应的值,为十六进制值。如上面结果中有这样一行,可以看到id为'ff3'的值为十六进制值7f092263
第三步:找到余额控件ID所在类
由于Mac的jadx比较卡,内存为4G,修改为8G居然不生效???
我导出了源码到AS,在AS全局搜索找到WcPayMoneyLoadingView
一路跟踪发现setMoney方法,XPosed走起试试
public class XposedInit implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
XposedBridge.log("========test");
if(lpparam.packageName.equals("com.tencent.mm")){
String className = "com.tencent.mm.plugin.wallet_core.ui.view.WcPayMoneyLoadingView";
XposedHelpers.findAndHookMethod(className, lpparam.classLoader, "setMoney", String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
// param.args[0] = "11111";
XposedBridge.log("beforeHookedMethod");
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
XposedBridge.log("========afterHookedMethod");
// Activity activity = (Activity) ((View) param.thisObject).getContext();
// View view = activity.findViewById(0x7f092263);
// XposedHelpers.callMethod(view, "setText", "11111111");
XposedHelpers.callMethod(param.thisObject,"setNewMoney","100001");
}
});
}
}
}
可以在beforeHookedMethod直接修改setmoney的参数
也可以找到那个控件直接settext
还可以直接反射调用setNewMoney
成了
参考文章:https://juejin.cn/post/6850037258754457614#heading-8https://www.jianshu.com/p/35246dfe4cb0