Skip to content

Commit

Permalink
add invokeOriginalMethod in XposedBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
swift_gan committed Apr 16, 2019
1 parent c0b453c commit 6d5b4e2
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.util.Log;

import com.swift.sandhook.SandHook;
import com.swift.sandhook.xposedcompat.methodgen.DynamicBridge;
import com.swift.sandhook.xposedcompat.utils.DexLog;

Expand Down Expand Up @@ -275,6 +276,27 @@ private synchronized static void hookMethodNative(final Member method, Class<?>

}


@SuppressWarnings("unused")
public static Object invokeOriginalMethod(final Member method, final Object thisObject,
final Object[] args)
throws NullPointerException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {

try {
return SandHook.callOriginMethod(method, thisObject, args);
} catch (NullPointerException e) {
throw e;
} catch (IllegalAccessException e) {
throw e;
} catch (IllegalArgumentException e) {
throw e;
} catch (InvocationTargetException e) {
throw e;
} catch (Throwable throwable) {
throw new InvocationTargetException(throwable);
}
}

/**
* Basically the same as {@link Method#invoke}, but calls the original method
* as it was before the interception by Xposed. Also, access permissions are not checked.
Expand Down

0 comments on commit 6d5b4e2

Please sign in to comment.