I'm quite new to xposed development and i'm stuck:
I hook a method, check some stuff, then i want to decide wheter i replace it with just return true;
or let it run. But i haven't found a possibility to set a condition to replaceHookedMethod(..)
I know i can set the return value in afterHookedMethod or beforeHookedMethod, but that doesnt prevent the method from running.
Here is my short example:
private static boolean flag;
...
findAndHookMethod(Activity.class, "onKeyDown", int.class, KeyEvent.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
//check some stuff here and set flag = true or flag = false
}
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
//this methode should only be called if the flag is true
return true;
}
};
Any ideas / suggestions? Thanks in advance!