EzXHelper
EzXHelper copied to clipboard
Can EzXHelper or Xposed be used to call the superclass version of a hooked method?
I have a scenario in which I want to hook a method in a class that is extended from another class. Under certain conditions, I want to override the hooked method in the extended class and have it instead execute the original method. Basically I want to do the Xposed/EzXHelper equivalent of calling super.myHookedMethod()
. Is there a way to do this?
I tried using XposedHelpers.callMethod(XposedHelpers.getSurroundingThis(param.thisObject), "myHookedMethod")
and XposedHelpers.callMethod(param.thisObject, "super.myHookedMethod")
but neither has worked. Is there any way to achieve this?
XposedBridge#invokeOriginalMethod (Member method, Object thisObject, Object[] args)
Doesn't this just call the method of the class you're in?
https://api.xposed.info/reference/de/robv/android/xposed/XposedBridge.html#invokeOriginalMethod(java.lang.reflect.Member,%20java.lang.Object,%20java.lang.Object[])
Are you looking for java.lang.invoke.MethodHandle? it can call obj.super.method()
For invoking a super method (aka. invoke-super
), you can use JNIEnv::CallNonvirtual<Type>Method
. Note that MethodHandle is added in API 26.
@teble I'm honestly not sure if java.lang.invoke.MethodHandle
is what I'm looking for, but it kind of sounds like it might be based on what I'm reading. Can I use callMethod()
with obj.super
then?
@cinit I'm not sure I understand this.