-
public final class XposedBridgeThis 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classXposedBridge.CopyOnWriteSortedSet
-
Field Summary
Fields Modifier and Type Field Description public final static ClassLoaderBOOTCLASSLOADERpublic final static StringTAGpublic static intXPOSED_BRIDGE_VERSION
-
Method Summary
Modifier and Type Method Description static intgetXposedVersion()Returns the currently installed version of the Xposed framework. static voidsetXposedVersion(int version)static booleanisFeatureSupported(String featureName)static Array<String>getSupportedFeatures()static voidsetSupportedFeatures(Array<String> features)static synchronized voidlog(String text)Writes a message to the Xposed error log. static synchronized voidlog(Throwable t)Logs a stack trace to the Xposed error log. static XC_MethodHook.UnhookhookMethod(Member hookMethod, XC_MethodHook callback)Hook any method (or constructor) with the specified callback. static voidunhookMethod(Member hookMethod, XC_MethodHook callback)Removes the callback for a hooked method/constructor. 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. static Set<XC_MethodHook.Unhook>hookAllConstructors(Class<out Object> hookClass, XC_MethodHook callback)Hook all constructors of the specified class. static ObjectinvokeOriginalMethod(Member method, Object thisObject, Array<Object> args)Basically the same as invoke, but calls the original methodas it was before the interception by Xposed. -
-
Method Detail
-
getXposedVersion
static int getXposedVersion()
Returns the currently installed version of the Xposed framework.
-
setXposedVersion
static void setXposedVersion(int version)
-
isFeatureSupported
static boolean isFeatureSupported(String featureName)
-
getSupportedFeatures
static Array<String> getSupportedFeatures()
-
setSupportedFeatures
static void setSupportedFeatures(Array<String> features)
-
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.
-
hookAllConstructors
static Set<XC_MethodHook.Unhook> hookAllConstructors(Class<out Object> hookClass, XC_MethodHook callback)
Hook all constructors of the specified class.
- Parameters:
hookClass- The class to check for constructors.callback- The callback to be executed when the hooked constructors 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.
-
-
-
-