Skip to content

Commit 532fa3b

Browse files
committed
Add module scope doc
1 parent 07bd715 commit 532fa3b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

api/src/main/java/io/github/libxposed/api/package-info.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,27 @@
3838
* {@link io.github.libxposed.api.XposedInterface.ExceptionMode}</li>
3939
* </ul>
4040
*
41+
* <h2>Scope</h2>
42+
*
43+
* <p>Module scope is defined by a list of package names in {@code META-INF/xposed/scope.list}.
44+
* The framework injects the module into all regular processes declared by those packages.
45+
* After injection, every loaded package in that process will trigger callbacks.
46+
* As a result, modules may receive callbacks beyond the originally scoped packages, so they
47+
* should always filter by process name and package name.</p>
48+
*
49+
* <p>A special case applies to components declared with {@code android:process="system"} in a
50+
* {@code android:sharedUserId="android.uid.system"} package: they run in system server.
51+
* For packages whose components all run in system server, adding the package name itself to the
52+
* scope has no effect. Instead, system server is represented by the special virtual package name
53+
* {@code system}, which should be used explicitly. </p>
54+
*
55+
* <p>Note that {@code android} package is still a valid scope target because some of its
56+
* components declare {@code android:process=":ui"} and therefore do not run in system server.
57+
* Modules scoped to {@code android} can still receive events for {@code android} package loading
58+
* even though {@code android} package has no code. By contrast, {@code com.android.providers.settings}
59+
* is not a valid scope target, modules should use the {@code system} scope and then wait
60+
* for the {@code com.android.providers.settings} package loading event.</p>
61+
*
4162
* <h2>Hook Model</h2>
4263
*
4364
* <p>The API uses an <b>interceptor-chain</b> model (similar to OkHttp interceptors). Modules
@@ -80,7 +101,8 @@
80101
* <li>{@link io.github.libxposed.api.XposedModuleInterface#onPackageReady(XposedModuleInterface.PackageReadyParam)
81102
* onPackageReady()} – called after the app classloader is created.</li>
82103
* <li>{@link io.github.libxposed.api.XposedModuleInterface#onSystemServerStarting(XposedModuleInterface.SystemServerStartingParam)
83-
* onSystemServerStarting()} – called when system server is starting.</li>
104+
* onSystemServerStarting()} – called once when system server is starting. This callback
105+
* replaces the first package load phase.</li>
84106
* </ul>
85107
*
86108
* <h2>Error Handling</h2>

0 commit comments

Comments
 (0)