Add compatibility for the new version of LSPosed
This commit is contained in:
@@ -21,9 +21,19 @@ import io.github.libxposed.api.utils.DexParser;
|
||||
*/
|
||||
public class XposedInterfaceWrapper implements XposedInterface {
|
||||
|
||||
private final XposedInterface mBase;
|
||||
private volatile XposedInterface mBase;
|
||||
|
||||
XposedInterfaceWrapper(@NonNull XposedInterface base) {
|
||||
public XposedInterfaceWrapper() {
|
||||
}
|
||||
|
||||
public XposedInterfaceWrapper(@NonNull XposedInterface base) {
|
||||
mBase = base;
|
||||
}
|
||||
|
||||
public final void attachFramework(@NonNull XposedInterface base) {
|
||||
if (mBase != null) {
|
||||
throw new IllegalStateException("Framework already attached");
|
||||
}
|
||||
mBase = base;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,16 @@ import androidx.annotation.NonNull;
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class XposedModule extends XposedInterfaceWrapper implements XposedModuleInterface {
|
||||
/**
|
||||
* Instantiates a new Xposed module.<br/>
|
||||
* When the module is loaded into the target process, the constructor will be called.
|
||||
*
|
||||
* @param base The implementation interface provided by the framework, should not be used by the module
|
||||
* @param param Information about the process in which the module is loaded
|
||||
* No-arg constructor for API 101 contract: the framework instantiates the module via
|
||||
* {@code Class.getDeclaredConstructor()}, then calls {@link #attachFramework}.
|
||||
*/
|
||||
public XposedModule() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Two-arg constructor for API 100 contract: the framework instantiates the module via
|
||||
* {@code (XposedInterface, ModuleLoadedParam)} and attaches the framework base inline.
|
||||
*/
|
||||
public XposedModule(@NonNull XposedInterface base, @NonNull ModuleLoadedParam param) {
|
||||
super(base);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.github.libxposed.api;
|
||||
|
||||
import android.app.AppComponentFactory;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Build;
|
||||
|
||||
@@ -32,7 +33,7 @@ public interface XposedModuleInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps information about system server.
|
||||
* Wraps information about system server. API 100 flavor.
|
||||
*/
|
||||
interface SystemServerLoadedParam {
|
||||
/**
|
||||
@@ -44,6 +45,26 @@ public interface XposedModuleInterface {
|
||||
ClassLoader getClassLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps information about system server. API 101 flavor.
|
||||
*/
|
||||
interface SystemServerStartingParam {
|
||||
@NonNull
|
||||
ClassLoader getClassLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps information about a package whose classloader is ready. API 101.
|
||||
*/
|
||||
interface PackageReadyParam extends PackageLoadedParam {
|
||||
@NonNull
|
||||
ClassLoader getClassLoader();
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.P)
|
||||
@NonNull
|
||||
AppComponentFactory getAppComponentFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps information about the package being loaded.
|
||||
*/
|
||||
@@ -99,10 +120,28 @@ public interface XposedModuleInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets notified when the system server is loaded.
|
||||
* Gets notified when the system server is loaded. API 100.
|
||||
*
|
||||
* @param param Information about system server
|
||||
*/
|
||||
default void onSystemServerLoaded(@NonNull SystemServerLoadedParam param) {
|
||||
}
|
||||
|
||||
/**
|
||||
* API 101: invoked once per process after the module instance is attached.
|
||||
*/
|
||||
default void onModuleLoaded(@NonNull ModuleLoadedParam param) {
|
||||
}
|
||||
|
||||
/**
|
||||
* API 101: invoked when a package's classloader is ready.
|
||||
*/
|
||||
default void onPackageReady(@NonNull PackageReadyParam param) {
|
||||
}
|
||||
|
||||
/**
|
||||
* API 101: replaces {@link #onSystemServerLoaded(SystemServerLoadedParam)}.
|
||||
*/
|
||||
default void onSystemServerStarting(@NonNull SystemServerStartingParam param) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user