Skip to content

RFC for API 102#62

Open
Dr-TSNG wants to merge 13 commits into
masterfrom
102
Open

RFC for API 102#62
Dr-TSNG wants to merge 13 commits into
masterfrom
102

Conversation

@Dr-TSNG
Copy link
Copy Markdown
Contributor

@Dr-TSNG Dr-TSNG commented May 28, 2026

libxposed API 102

This PR introduces API 102 across the libxposed module API, service API, annotations, and lint checks.

Module API

  • Added hot reload lifecycle callbacks for modules with exactly one Java entry class:
    • onHotReloading(HotReloadingParam) runs in old code and decides whether reload proceeds.
    • onHotReloaded(HotReloadedParam) runs in new code and receives extras, saved state, and old hook handles.
    • Package lifecycle callbacks are not replayed automatically after hot reload.
  • Added hook identity and replacement APIs:
    • HookBuilder#setId(String) assigns a module/executable-scoped hook id.
    • HookHandle#getId() exposes the assigned id.
    • HookHandle#replaceHook(Hooker) atomically replaces an existing hook while preserving executable, priority, exception mode, and id.
  • Added XposedInterfaceWrapper#detach(), allowing the current module entry to stop receiving subsequent lifecycle callbacks without disabling hooks or other XposedInterface APIs.
  • Added PROP_RT_HOT_RELOAD to report whether hot reload is currently permitted.
  • Behavior change for modules targeting API 102 or higher: libxposed modules must not call legacy de.robv.android.xposed APIs.

Service API

  • Added running target discovery and hot reload requests:
    • XposedService#getRunningTargets()
    • XposedService#hotReloadModule(HookedTarget, Bundle, HotReloadCallback)
  • Added public SDK models for service hot reload:
    • HookedTarget wraps the AIDL HookedProcess and hides the opaque target id from module apps.
    • HotReloadResult and HotReloadResult.Status expose asynchronous hot reload results.

Annotations And Lint

  • Added @InternalApi for APIs reserved for framework implementations.
  • Added lint issue XposedInternalApi, which reports module usage of APIs annotated with @InternalApi.
  • Updated the existing @SinceApi lint coverage for new API 102 service and module APIs.

Framework Integration

  • XposedInterfaceWrapper#attachFramework(...) now accepts a per-entry detach implementation and is marked internal.
  • The framework remains responsible for calling attachFramework(...); modules must not call it directly.

Copilot AI review requested due to automatic review settings May 28, 2026 21:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR rolls the libxposed module API forward to version 102. It expands the public Java API with hot-reload lifecycle callbacks, hook identity/replacement, an entry-detach mechanism, and a new runtime property bit, while also moving the annotation and lint artifacts to externally-published io.github.libxposed modules (with snapshot publishing infrastructure). Gradle and AGP tooling are bumped along the way.

Changes:

  • Add API 102: hot-reload callbacks (onHotReloading/onHotReloaded), HookBuilder#setId/HookHandle#getId/replaceHook, XposedInterfaceWrapper#detach(), and PROP_RT_HOT_RELOAD; update Javadoc/package-info accordingly.
  • Switch attachFramework to a 2-arg @InternalApi form that accepts a detach implementation, and drop volatile from the wrapper's mBase field.
  • Build / CI: bump Gradle to 9.5.1, AGP to 9.2.1, compileSdk/buildTools to 37; consume external libxposed-annotation/libxposed-lint; add Sonatype-snapshot repo and publishing workflow; remove the confirm == 'yes' gate on the Maven Central deploy workflow.

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
api/src/main/java/io/github/libxposed/api/XposedInterface.java Adds API_102, PROP_RT_HOT_RELOAD, HookHandle#getId/replaceHook, and HookBuilder#setId.
api/src/main/java/io/github/libxposed/api/XposedInterfaceWrapper.java New detach() API; attachFramework gains detachImpl and is marked @InternalApi; mBase no longer volatile.
api/src/main/java/io/github/libxposed/api/XposedModuleInterface.java Adds HotReloadingParam, HotReloadedParam, onHotReloading, onHotReloaded.
api/src/main/java/io/github/libxposed/api/XposedModule.java Updates class-level Javadoc to reflect per-generation instantiation.
api/src/main/java/io/github/libxposed/api/package-info.java Documents API 102 additions, hot-reload lifecycle, detach, and autoHotReload property.
api/build.gradle.kts compileSdk/buildTools 37; new libxposed-annotation/-lint deps; snapshot publishing; version 102.0.0.
api/proguard-rules.pro Adds -dontwarn for io.github.libxposed.annotation.**.
gradle/libs.versions.toml Switches to androidx-annotation and adds libxposed-annotation/-lint versions; bumps AGP.
build.gradle.kts Adds dependencySnapshot flag disabling changing-module cache.
settings.gradle.kts Registers mavenLocal and Sonatype snapshots repo filtered to io.github.libxposed.
gradle/wrapper/gradle-wrapper.properties Gradle 9.4.0 → 9.5.1.
gradlew.bat Regenerated for new Gradle wrapper.
.github/workflows/snapshot.yml New workflow publishing snapshots to Sonatype.
.github/workflows/deploy.yml Removes the typed-confirmation gate on Maven Central deploys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/deploy.yml
Comment thread api/src/main/java/io/github/libxposed/api/XposedInterfaceWrapper.java Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@Hamammal Hamammal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/deploy.yml

Copy link
Copy Markdown

@Hamammal Hamammal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

@Hamammal Hamammal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants