接口 XposedInterface
- 所有已知实现类:
XposedInterfaceWrapper,XposedModule
-
嵌套类概要
嵌套类修饰符和类型接口说明static interfaceInterceptor chain for a method or constructor.static interfaceInvoker for a constructor.static enumException handling mode for hookers.static interfaceBuilder for configuring a hook.static interfaceHooker for a method or constructor.static interfaceHandle for a hook.static interfaceXposedInterface.Invoker<T extends XposedInterface.Invoker<T,U>, U extends Executable> Invoker for a method or constructor. -
字段概要
字段修饰符和类型字段说明static final intBehavior changes: all modules Modules cannot be injected into zygote; they are only loaded within the process of the scope. Behavior changes: Modules targeting 101 or higher This is the first API version.static final intThe API version of this library.static final intThe default hook priority.static final intExecute at the beginning of the interception chain.static final intExecute at the end of the interception chain.static final longThe framework provides remote preferences and remote files support.static final longThe framework has the capability to hook system_server and other system processes.static final longThe framework disallows accessing Xposed API via reflection or dynamically loaded code. -
方法概要
修饰符和类型方法说明booleandeoptimize(Executable executable) Deoptimizes a method / constructor in case hooked callee is not called because of inline.default intGets the runtime Xposed API version.Gets the Xposed framework name of current implementation.longGets the Xposed framework properties.Gets the Xposed framework version of current implementation.longGets the Xposed framework version code of current implementation.<T> XposedInterface.CtorInvoker<T> getInvoker(Constructor<T> constructor) Get a constructor invoker for the given constructor.getInvoker(Method method) Get a method invoker for the given method.Gets the application info of the module.getRemotePreferences(String group) Gets remote preferences stored in Xposed framework.hook(Executable origin) Hook a method / constructor.hookClassInitializer(Class<?> origin) Hook the static initializer (<clinit>) of a class.String[]List all files in the module's shared data directory.voidWrites a message to the Xposed log.voidWrites a message to the Xposed log.openRemoteFile(String name) Open a file in the module's shared data directory.
-
字段详细资料
-
API_101
static final int API_101Behavior changes: all modules- Modules cannot be injected into zygote; they are only loaded within the process of the scope.
- This is the first API version.
- 另请参阅:
-
LIB_API
static final int LIB_APIThe API version of this library. This is a static value for the framework. Modules should usegetApiVersion()to check the API version at runtime.- 另请参阅:
-
PROP_CAP_SYSTEM
static final long PROP_CAP_SYSTEMThe framework has the capability to hook system_server and other system processes.- 另请参阅:
-
PROP_CAP_REMOTE
static final long PROP_CAP_REMOTEThe framework provides remote preferences and remote files support.- 另请参阅:
-
PROP_RT_API_PROTECTION
static final long PROP_RT_API_PROTECTIONThe framework disallows accessing Xposed API via reflection or dynamically loaded code.- 另请参阅:
-
PRIORITY_DEFAULT
static final int PRIORITY_DEFAULTThe default hook priority.- 另请参阅:
-
PRIORITY_LOWEST
static final int PRIORITY_LOWESTExecute at the end of the interception chain.- 另请参阅:
-
PRIORITY_HIGHEST
static final int PRIORITY_HIGHESTExecute at the beginning of the interception chain.- 另请参阅:
-
-
方法详细资料
-
getApiVersion
default int getApiVersion()Gets the runtime Xposed API version. Framework implementations must not override this method. -
getFrameworkName
Gets the Xposed framework name of current implementation. -
getFrameworkVersion
Gets the Xposed framework version of current implementation. -
getFrameworkVersionCode
long getFrameworkVersionCode()Gets the Xposed framework version code of current implementation. -
getFrameworkProperties
long getFrameworkProperties()Gets the Xposed framework properties. Properties with prefixPROP_RT_may change among launches. -
hook
Hook a method / constructor.- 参数:
origin- The executable to be hooked- 返回:
- The builder for the hook
-
hookClassInitializer
Hook the static initializer (<clinit>) of a class.The static initializer is treated as a regular
static void()method with no parameters. Accordingly, in theXposedInterface.Chainpassed to the hooker:XposedInterface.Chain.getExecutable()returns a syntheticMethodrepresenting the static initializer.XposedInterface.Chain.getThisObject()always returnsnull.XposedInterface.Chain.getArgs()returns an empty list.XposedInterface.Chain.proceed()returnsnull.
Note: If the class is already initialized, the hook will never be called.
- 参数:
origin- The class whose static initializer is to be hooked- 返回:
- The builder for the hook
-
deoptimize
Deoptimizes a method / constructor in case hooked callee is not called because of inline.By deoptimizing the method, the runtime will fall back to calling all callees without inlining. For example, when a short hooked method B is invoked by method A, the callback to B is not invoked after hooking, which may mean A has inlined B inside its method body. To force A to call the hooked B, you can deoptimize A and then your hook can take effect.
Generally, you need to find all the callers of your hooked callee, and that can hardly be achieved (but you can still search all callers by using DexKit). Use this method if you are sure the deoptimized callers are all you need. Otherwise, it would be better to change the hook point or to deoptimize the whole app manually (by simply reinstalling the app without uninstall).
- 参数:
executable- The method / constructor to deoptimize- 返回:
- Indicate whether the deoptimizing succeed or not
-
getInvoker
Get a method invoker for the given method. Invocations through invokers will bypass access checks. The default type of the invoker isXposedInterface.Invoker.Type.Chain.FULL.- 参数:
method- The method to get the invoker for- 返回:
- The method invoker
-
getInvoker
Get a constructor invoker for the given constructor. Invocations through invokers will bypass access checks. The default type of the invoker isXposedInterface.Invoker.Type.Chain.FULL.- 类型参数:
T- The type of the constructor- 参数:
constructor- The constructor to get the invoker for- 返回:
- The constructor invoker
-
log
Writes a message to the Xposed log.- 参数:
priority- The log priority, seeLogtag- The log tagmsg- The log message
-
log
Writes a message to the Xposed log.- 参数:
priority- The log priority, seeLogtag- The log tagmsg- The log messagetr- An exception to log
-
getModuleApplicationInfo
Gets the application info of the module. -
getRemotePreferences
Gets remote preferences stored in Xposed framework. Note that those are read-only in hooked apps.- 参数:
group- Group name- 返回:
- The preferences
- 抛出:
UnsupportedOperationException- If the framework is embedded
-
listRemoteFiles
List all files in the module's shared data directory.- 返回:
- The file list
- 抛出:
UnsupportedOperationException- If the framework is embedded
-
openRemoteFile
Open a file in the module's shared data directory. The file is opened in read-only mode.- 参数:
name- File name, must not contain path separators and . or ..- 返回:
- The file descriptor
- 抛出:
FileNotFoundException- If the file does not exist or the path is forbiddenUnsupportedOperationException- If the framework is embedded
-