function main() {
Java.perform(function () {
console.log("--------------start hooking--------------");
function showStack() {
var log = Java.use("android.util.Log");
var Throwable = Java.use("java.lang.Throwable");
console.log(log.getStackTraceString(Throwable.$new()))
}
var btn_login_id = Java.use("com.dodonew.online.R$id").btn_login.value;
console.log("btn_login_id", btn_login_id);
var view = Java.use("android.view.View");
view.setOnClickListener.implementation = function (a) {
if(this.getId() == btn_login_id){
showStack();
console.log("view.id: " + this.getId());
console.log("view.setOnClickListener is called");
}
return this.setOnClickListener(a);
}
})
}
setTimeout(main, 1000);
hook这个函数,比对控件id,打印堆栈