[core] FastNative (#467)
This commit is contained in:
parent
445b87711f
commit
65f387f429
|
|
@ -20,6 +20,8 @@
|
|||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
-keepattributes *Annotation*
|
||||
|
||||
-keep class de.robv.android.xposed.** {*;}
|
||||
-keep class android.** { *; }
|
||||
-keepclassmembers class * implements android.os.Parcelable {
|
||||
|
|
|
|||
|
|
@ -22,12 +22,15 @@ package org.lsposed.lspd.nativebridge;
|
|||
|
||||
import java.lang.reflect.Executable;
|
||||
|
||||
import dalvik.annotation.optimization.FastNative;
|
||||
import de.robv.android.xposed.PendingHooks;
|
||||
|
||||
public class ClassLinker {
|
||||
|
||||
@FastNative
|
||||
public static native void setEntryPointsToInterpreter(Executable method);
|
||||
|
||||
@FastNative
|
||||
public static void onPostFixupStaticTrampolines(Class<?> clazz) {
|
||||
// native flags will be re-set in hooking logic
|
||||
PendingHooks.hookPendingMethod(clazz);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import java.util.TimeZone;
|
|||
|
||||
import org.lsposed.lspd.util.Utils;
|
||||
|
||||
import dalvik.annotation.optimization.FastNative;
|
||||
|
||||
public class ModuleLogger {
|
||||
static SimpleDateFormat logDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss", Locale.getDefault());
|
||||
static int fd = -1;
|
||||
|
|
@ -42,6 +44,7 @@ public class ModuleLogger {
|
|||
}
|
||||
}
|
||||
|
||||
@FastNative
|
||||
private static native void nativeLog(int fd, String logStr);
|
||||
|
||||
public static void log(String str, boolean isThrowable) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
package org.lsposed.lspd.nativebridge;
|
||||
|
||||
import dalvik.annotation.optimization.FastNative;
|
||||
|
||||
public class NativeAPI {
|
||||
@FastNative
|
||||
public static native void recordNativeEntrypoint(String library_name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ package org.lsposed.lspd.nativebridge;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import dalvik.annotation.optimization.FastNative;
|
||||
|
||||
public class PendingHooks {
|
||||
public static native void recordPendingMethodNative(Method hookMethod, Class clazz);
|
||||
@FastNative
|
||||
public static native void recordPendingMethodNative(Method hookMethod, Class<?> clazz);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,19 @@ package org.lsposed.lspd.nativebridge;
|
|||
import android.content.res.Resources;
|
||||
import android.content.res.XResources;
|
||||
|
||||
import dalvik.annotation.optimization.FastNative;
|
||||
|
||||
public class ResourcesHook {
|
||||
|
||||
@FastNative
|
||||
public static native boolean initXResourcesNative();
|
||||
|
||||
@FastNative
|
||||
public static native boolean removeFinalFlagNative(Class<?> clazz);
|
||||
|
||||
@FastNative
|
||||
public static native ClassLoader buildDummyClassLoader(ClassLoader parent, Class<?> resourceSuperClass, Class<?> typedArraySuperClass);
|
||||
|
||||
@FastNative
|
||||
public static native void rewriteXmlReferencesNative(long parserPtr, XResources origRes, Resources repRes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,18 +23,26 @@ package org.lsposed.lspd.nativebridge;
|
|||
import java.lang.reflect.Executable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import dalvik.annotation.optimization.FastNative;
|
||||
|
||||
public class Yahfa {
|
||||
|
||||
@FastNative
|
||||
public static native boolean backupAndHookNative(Executable target, Method hook, Method backup);
|
||||
|
||||
// JNI.ToReflectedMethod() could return either Method or Constructor
|
||||
@FastNative
|
||||
public static native Executable findMethodNative(Class<?> targetClass, String methodName, String methodSig);
|
||||
|
||||
@FastNative
|
||||
public static native void init(int sdkVersion);
|
||||
|
||||
@FastNative
|
||||
public static native void recordHooked(Executable member);
|
||||
|
||||
@FastNative
|
||||
public static native boolean isHooked(Executable member);
|
||||
|
||||
@FastNative
|
||||
public static native Class<?> buildHooker(ClassLoader appClassLoader, Class<?> returnType, Class<?>[] params, String methodName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package dalvik.annotation.optimization;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface FastNative {
|
||||
}
|
||||
Loading…
Reference in New Issue