Class PatcherAPI

  • All Implemented Interfaces:

    
    public final class PatcherAPI
    
                        

    Runtime patching helper that wraps Xposed hooks and tracks created unpatch actions.

    Use instances to apply hooks via the patch methods. 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Runnable patch(String forClass, String fn, Array<Class<?>> paramTypes, XC_MethodHook hook) Patch a method by class name.
      final Runnable patch(String forClass, String fn, XC_MethodHook hook) Patch a method by class name.
      final Runnable patch(Class<?> clazz, String fn, Array<Class<?>> paramTypes, XC_MethodHook hook) Patch a method by Class.
      final Runnable patch(Class<?> clazz, String fn, XC_MethodHook hook) Patch a method by Class.
      final Runnable patch(Member m, XC_MethodHook hook) Patch a specific method or constructor.
      final Runnable patch(Member m, Action1<XC_MethodHook.MethodHookParam> callback) Patch a specific method or constructor using a MethodHookCallback.
      final Unit unpatchAll() Invoke all registered unpatch actions and clear the registry.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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 method
        fn - method name to patch
        paramTypes - parameter types to select an overload
        hook - 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 method
        fn - method name to patch
        hook - 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 method
        fn - method name to patch
        paramTypes - parameter types to select an overload
        hook - 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 method
        fn - method name to patch
        hook - 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 hook
        hook - 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 hook
        callback - 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.