Package 

Class XposedBridge


  • 
    public final class XposedBridge
    
                        

    This class contains most of Xposed's central logic, such as initialization and callbacks used by the native side. It also includes methods to add new hooks.

    • Method Detail

      • getXposedVersion

         static int getXposedVersion()

        Returns the currently installed version of the Xposed framework.

      • log

         static synchronized void log(String text)

        Writes a message to the Xposed error log.

        DON'T FLOOD THE LOG!!! This is only meant for error logging.If you want to write information/debug messages, use logcat.

        Parameters:
        text - The log message.
      • log

         static synchronized void log(Throwable t)

        Logs a stack trace to the Xposed error log.

        DON'T FLOOD THE LOG!!! This is only meant for error logging.If you want to write information/debug messages, use logcat.

        Parameters:
        t - The Throwable object for the stack trace.
      • hookMethod

         static XC_MethodHook.Unhook hookMethod(Member hookMethod, XC_MethodHook callback)

        Hook any method (or constructor) with the specified callback. See below for some wrappersthat make it easier to find a method/constructor in one step.

        Parameters:
        hookMethod - The method to be hooked.
        callback - The callback to be executed when the hooked method is called.
      • unhookMethod

        @Deprecated() static void unhookMethod(Member hookMethod, XC_MethodHook callback)

        Removes the callback for a hooked method/constructor.

        Parameters:
        hookMethod - The method for which the callback should be removed.
        callback - The reference to the callback as specified in hookMethod.
      • hookAllMethods

         static Set<XC_MethodHook.Unhook> hookAllMethods(Class<out Object> hookClass, String methodName, XC_MethodHook callback)

        Hooks all methods with a certain name that were declared in the specified class. Inheritedmethods and constructors are not considered. For constructors, use hookAllConstructors instead.

        Parameters:
        hookClass - The class to check for declared methods.
        methodName - The name of the method(s) to hook.
        callback - The callback to be executed when the hooked methods are called.
      • invokeOriginalMethod

         static Object invokeOriginalMethod(Member method, Object thisObject, Array<Object> args)

        Basically the same as invoke, but calls the original methodas it was before the interception by Xposed. Also, access permissions are not checked.If the given method is not hooked, the behavior is undefined, Pine does not guarantee thiswill always work and may crash on other Xposed framework implementations.

        There are very few cases where this method is needed. A common mistake isto replace a method and then invoke the original one based on dynamic conditions. Thiscreates overhead and skips further hooks by other modules. Instead, just hook (don't replace)the method and call {@code param.setResult(null)} in beforeHookedMethod if the original method should be skipped.

        Parameters:
        method - The method to be called.
        thisObject - For non-static calls, the "this" pointer, otherwise {@code null}.
        args - Arguments for the method call as Object[] array.