HookFactory

Xposed 82 hook DSL 构造器。

通过 beforeafterreplace 等方法声明行为,最终由 helper API 触发创建。

与 102 的差异(API 设计取舍,不算 bug):

  • 每个 HookFactory 实例只保留一对 before / after 回调。重复调用 before / after / replace / returnConstant覆盖前一次注册,不会叠加。

  • 没有 priority / id / intercept 等 102 才支持的 hook 元信息——经典 Xposed API 82 在框架层就没有这些能力。

如果你的代码同时支持两个工件,请按 102 的多 stage 思路写时显式包装, 不要假设 82 也会按顺序执行多次 before/after。

Functions

Link copied to clipboard
fun after(callback: Consumer<HookParam>)

注册 Java Consumer 形式的 after 阶段回调。

fun after(callback: HookCallback)

注册 after 阶段回调。

Link copied to clipboard
fun before(callback: Consumer<HookParam>)

注册 Java Consumer 形式的 before 阶段回调。

fun before(callback: HookCallback)

注册 before 阶段回调。

Link copied to clipboard
fun interrupt()

中断原始调用并返回 null

Link copied to clipboard
fun replace(callback: Function<HookParam, Any?>)

用 Java Function 形式替换原始实现。

fun replace(callback: (HookParam) -> Any?)

用自定义返回值替换原始实现。

Link copied to clipboard
fun returnConstant(value: Any?)

中断原始调用并返回固定值。