Package io.github.libxposed.api
Interface XposedInterface.HookBuilder
- Enclosing interface:
XposedInterface
public static interface XposedInterface.HookBuilder
Builder for configuring a hook.
-
Method Summary
Modifier and TypeMethodDescriptionintercept(XposedInterface.Hooker hooker) Sets the hooker for the method / constructor and builds the hook.Sets the exception handling mode for the hook.Sets a unique id for the hook, default tonull.setPriority(int priority) Sets the priority of the hook.
-
Method Details
-
setPriority
Sets the priority of the hook. Hooks with higher priority will be called before hooks with lower priority. The default priority isXposedInterface.PRIORITY_DEFAULT.- Parameters:
priority- The priority of the hook- Returns:
- The builder itself for chaining
-
setExceptionMode
Sets the exception handling mode for the hook. The default mode isXposedInterface.ExceptionMode.DEFAULT.- Parameters:
mode- The exception handling mode- Returns:
- The builder itself for chaining
-
intercept
Sets the hooker for the method / constructor and builds the hook.- Parameters:
hooker- The hooker object- Returns:
- The handle for the hook
- Throws:
IllegalArgumentException- if origin is framework internal orConstructor.newInstance(java.lang.Object...), or hooker is invalidHookFailedError- if hook fails due to framework internal error
-
setId
Sets a unique id for the hook, default tonull. An id is used for exclusively identifying a hook in the same module on the executable. A new hook with the same id in the same module on the executable will replace the old one atomically, and the old hook handle will be invalid. Hook ids are isolated between modules.The hook chain is snapshot based. Replacing or adding a hook while a call is running does not affect that in-flight call.
- Parameters:
id- The id for the hook. It can be null if you don't care about replacing the hook later.- Returns:
- The builder itself for chaining
-