Class PatcherAPI
-
- All Implemented Interfaces:
public final class PatcherAPIRuntime patching helper that wraps Xposed hooks and tracks created unpatch actions.
Use instances to apply hooks via the
patchmethods. Each patch returns an Unpatch callback that will remove the applied hook when invoked. Call unpatchAll to run all registered unpatch actions and clear the internal registry.
-
-
Method Summary
Modifier and Type Method Description final Runnablepatch(String forClass, String fn, Array<Class<?>> paramTypes, XC_MethodHook hook)Patch a method by class name. final Runnablepatch(String forClass, String fn, XC_MethodHook hook)Patch a method by class name. final Runnablepatch(Class<?> clazz, String fn, Array<Class<?>> paramTypes, XC_MethodHook hook)Patch a method by Class. final Runnablepatch(Class<?> clazz, String fn, XC_MethodHook hook)Patch a method by Class. final Runnablepatch(Member m, XC_MethodHook hook)Patch a specific method or constructor. final Runnablepatch(Member m, Action1<XC_MethodHook.MethodHookParam> callback)Patch a specific method or constructor using a MethodHookCallback. final UnitunpatchAll()Invoke all registered unpatch actions and clear the registry. -
-
Method Detail
-
patch
@JvmOverloads() final Runnable patch(String forClass, String fn, Array<Class<?>> paramTypes, XC_MethodHook hook)
Patch a method by class name.
- Parameters:
forClass- full name of the class containing the methodfn- method name to patchparamTypes- parameter types to select an overloadhook- the XC_MethodHook callback to apply- Returns:
an Unpatch that will remove the applied hook
-
patch
@JvmOverloads() final Runnable patch(String forClass, String fn, XC_MethodHook hook)
Patch a method by class name.
- Parameters:
forClass- full name of the class containing the methodfn- method name to patchhook- the XC_MethodHook callback to apply- Returns:
an Unpatch that will remove the applied hook
-
patch
@JvmOverloads() final Runnable patch(Class<?> clazz, String fn, Array<Class<?>> paramTypes, XC_MethodHook hook)
Patch a method by Class.
- Parameters:
clazz- the class containing the methodfn- method name to patchparamTypes- parameter types to select an overloadhook- the XC_MethodHook callback to apply- Returns:
an Unpatch that will remove the applied hook
-
patch
@JvmOverloads() final Runnable patch(Class<?> clazz, String fn, XC_MethodHook hook)
Patch a method by Class.
- Parameters:
clazz- the class containing the methodfn- method name to patchhook- the XC_MethodHook callback to apply- Returns:
an Unpatch that will remove the applied hook
-
patch
final Runnable patch(Member m, XC_MethodHook hook)
Patch a specific method or constructor.
- Parameters:
m- the reflective Member (method or constructor) to hookhook- the XC_MethodHook callback to apply- Returns:
an Unpatch that will remove the applied hook
-
patch
final Runnable patch(Member m, Action1<XC_MethodHook.MethodHookParam> callback)
Patch a specific method or constructor using a MethodHookCallback.
- Parameters:
m- the reflective Member (method or constructor) to hookcallback- the callback wrapper to apply- Returns:
an Unpatch that will remove the applied hook
-
unpatchAll
final Unit unpatchAll()
Invoke all registered unpatch actions and clear the registry.
This will remove all applied hooks that were created through this PatcherAPI instance.
-
-
-
-