Global invoke origin

This commit is contained in:
LoveSy 2023-01-24 18:11:28 +08:00
parent 867e39e323
commit a026708a35
No known key found for this signature in database
3 changed files with 39 additions and 13 deletions

View File

@ -8,6 +8,7 @@ import androidx.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -213,6 +214,18 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf
return getBaseContext().deoptimize(constructor); return getBaseContext().deoptimize(constructor);
} }
@Nullable
@Override
public Object invokeOrigin(@NonNull Method method, @Nullable Object thisObject, Object[] args) throws InvocationTargetException, IllegalAccessException {
return getBaseContext().invokeOrigin(method, thisObject, args);
}
@Nullable
@Override
public <T> T newInstanceOrigin(@NonNull Constructor<T> constructor, Object[] args) throws InvocationTargetException, IllegalAccessException {
return getBaseContext().newInstanceOrigin(constructor, args);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -223,18 +223,6 @@ public interface XposedInterface {
*/ */
void setThrowable(@Nullable Throwable throwable); void setThrowable(@Nullable Throwable throwable);
/**
* Invoke origin object.
*
* @param thisObject the this object
* @param args the args
* @return the object
* @throws InvocationTargetException the invocation target exception
* @throws IllegalAccessException the illegal access exception
*/
@Nullable
Object invokeOrigin(@Nullable Object thisObject, Object[] args) throws InvocationTargetException, IllegalAccessException;
/** /**
* Invoke origin object. * Invoke origin object.
* *
@ -538,6 +526,31 @@ public interface XposedInterface {
*/ */
<T> boolean deoptimize(@NonNull Constructor<T> constructor); <T> boolean deoptimize(@NonNull Constructor<T> constructor);
/**
* Invoke origin object.
*
* @param method the method
* @param thisObject the this object
* @param args the args
* @return the object
* @throws InvocationTargetException the invocation target exception
* @throws IllegalAccessException the illegal access exception
*/
@Nullable
Object invokeOrigin(@NonNull Method method, @Nullable Object thisObject, Object[] args) throws InvocationTargetException, IllegalAccessException;
/**
* new origin object.
*
* @param constructor the constructor
* @param args the args
* @return the object
* @throws InvocationTargetException the invocation target exception
* @throws IllegalAccessException the illegal access exception
*/
@Nullable
<T> T newInstanceOrigin(@NonNull Constructor<T> constructor, Object[] args) throws InvocationTargetException, IllegalAccessException;
/** /**
* Log. * Log.
* *

View File

@ -17,6 +17,6 @@ dependencyResolutionManagement {
} }
} }
rootProject.name = "libxposed" rootProject.name = "api"
include(":api") include(":api")