Skip to content

[Discussion] Hot reload API design #54

@Dr-TSNG

Description

@Dr-TSNG

Hot reload (reloading modules without restarting target app / system) will be a new feature in API 102. Please give your suggestions about the interfaces.

Preview (may change later):

// XposedModuleInterface.java
interface PrepareHotReloadParam {
    @Nullable Bundle getData();
    void saveInstances(@Nullable Bundle in);
}
// Called in old modules
default bool onPrepareHotReload(@NonNull PrepareHotReloadParam param) {
    return isSuccess;
}
// Called in updated modules
default void onHotReloaded(@Nullable Bundle savedInstances) {
}

// IXposedService.aidl
HookedProcess getRunningTargets();

// HookedProcess.aidl
bool requestHotReload(in Bundle data);

Updated module will be loaded with a new ClassLoader, and the old module should manually stop all threads created when onHotReloadRequested is called.

Issues under discussion:

  • Should the framework always invalidate old hooks before a new version is loaded into the target process or just pass hook handles to the new modules?
  • How to handle native libraries, should the framework provide XposedInterface.(un)loadLibrary or simply doesn't support this senario?
  • Should the process be atomic - the framework pauses all threads / all hooked methods before hot reload completed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions