This module implements the libxposed API for the Vector framework. It serves as the primary bridge between the native ART hooking engine (lsplant) and module developers, providing a type-safe, OkHttp-style interceptor chain architecture.
The xposed module is designed with strict boundaries to ensure stability during the Android boot process and application lifecycles. It is written entirely in Kotlin and operates independently of the legacy Xposed API (de.robv.android.xposed).
It defines a Dependency Injection (DI) contract (LegacyFrameworkDelegate) which the legacy module must implement and inject during startup.
VectorHookBuilder: Implements theHookBuilderAPI. It validates the targetExecutable, bundles the module'sHooker,priority, andExceptionModeinto aVectorHookRecord, and registers it natively via JNI.VectorNativeHooker: The JNI trampoline target. When a hooked method is executed, the C++ layer invokescallback(Array<Any?>)on this class. It fetches the active hooks (both modern and legacy) from the native registry as globaljobjectreferences, constructs the rootVectorChain, and initiates execution.VectorChain: Implements the recursiveproceed()state machine.- Exception Handling: It implements the logic for
ExceptionMode. InPROTECTIVEmode, if an interceptor throws an exception before callingproceed(), the chain skips the interceptor. If it throws after callingproceed(), the chain catches the exception and restores the cached downstream result/throwable to protect the host process.
- Exception Handling: It implements the logic for
The Invoker system allows modules to execute methods while bypassing standard JVM access checks, with granular control over hook execution.
Type.Origin: Dispatches directly to JNI (HookBridge.invokeOriginalMethod), bypassing all active hooks.Type.Chain: Constructs a localizedVectorChaincontaining only hooks with a priority less than or equal to the requestedmaxPriority, allowing modules to execute partial hook chains.VectorCtorInvoker: Handles constructor invocation. It separates memory allocation (HookBridge.allocateObject) from initialization (invokeOriginalMethod/invokeSpecialMethod) to support safenewInstanceSpeciallogic.
To maintain the separation of concerns, the xposed module communicates with the legacy Xposed ecosystem via VectorBootstrap and LegacyFrameworkDelegate.
When xposed intercepts an Android lifecycle event (e.g., LoadedApk.createClassLoader), it dispatches the event internally via VectorLifecycleManager and then delegates the raw parameters to LegacyFrameworkDelegate so the legacy module can construct and dispatch the legacy XC_LoadPackage callbacks.
Modules are executed strictly from memory using an isolated ClassLoader, ensuring zero disk footprint and maximum stealth against anti-cheat mechanisms.
- The module APK is loaded into
SharedMemory(ashmem) to bypass Java heap limitations. Once the Android Runtime (ART) ingests the DEX buffers, the ashmem is instantly unmapped, preventing memory leaks and leaving no residual file descriptors. - The
VectorModuleClassLoaderis attached exclusively to the Xposed Framework's classloader branch, preventing the target app from discovering the module via reflection orClassLoader.getParent()chain-walking. VectorURLStreamHandlerintercepts standardjar:requests, reading assets and resources natively from the module path without triggering Android's globalJarFilecache, preventing OS-level file locks.