public class NativeLibInstaller
extends java.lang.Object
date: 2019/8/7 21:11 author: zengfansheng
| 构造器和说明 |
|---|
NativeLibInstaller() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
expandFieldArray(java.lang.Object instance,
java.lang.String fieldName,
java.lang.Object[] extraElements)
Replace the value of a field containing a non null array, by a new array containing the
elements of the original array plus the elements of extraElements.
|
static java.lang.reflect.Constructor<?> |
findConstructor(java.lang.Object instance,
java.lang.Class<?>... parameterTypes)
Locates a given constructor anywhere in the class inheritance hierarchy.
|
static java.lang.reflect.Field |
findField(java.lang.Class<?> originClazz,
java.lang.String name) |
static java.lang.reflect.Method |
findMethod(java.lang.Class<?> clazz,
java.lang.String name,
java.lang.Class<?>... parameterTypes)
Locates a given method anywhere in the class inheritance hierarchy.
|
static java.lang.reflect.Method |
findMethod(java.lang.Object instance,
java.lang.String name,
java.lang.Class<?>... parameterTypes)
Locates a given method anywhere in the class inheritance hierarchy.
|
static java.lang.Object |
getActivityThread(android.content.Context context,
java.lang.Class<?> activityThread) |
static int |
getValueOfStaticIntField(java.lang.Class<?> clazz,
java.lang.String fieldName,
int defVal)
Handy method for fetching hidden integer constant value in system classes.
|
static void |
installLibrary(java.lang.ClassLoader classLoader,
java.io.File folder)
将包含so文件的目录添加到系统可加载列表中
|
static void |
reduceFieldArray(java.lang.Object instance,
java.lang.String fieldName,
int reduceSize)
Replace the value of a field containing a non null array, by a new array containing the
elements of the original array plus the elements of extraElements.
|
public static void installLibrary(java.lang.ClassLoader classLoader,
java.io.File folder)
throws java.lang.Throwable
classLoader - 调用此方法的类加载器folder - so文件所在的目录java.lang.Throwablepublic static java.lang.reflect.Field findField(java.lang.Class<?> originClazz,
java.lang.String name)
throws java.lang.NoSuchFieldException
java.lang.NoSuchFieldExceptionpublic static java.lang.reflect.Method findMethod(java.lang.Object instance,
java.lang.String name,
java.lang.Class<?>... parameterTypes)
throws java.lang.NoSuchMethodException
instance - an object to search the method into.name - method nameparameterTypes - method parameter typesjava.lang.NoSuchMethodException - if the method cannot be locatedpublic static java.lang.reflect.Method findMethod(java.lang.Class<?> clazz,
java.lang.String name,
java.lang.Class<?>... parameterTypes)
throws java.lang.NoSuchMethodException
clazz - a class to search the method into.name - method nameparameterTypes - method parameter typesjava.lang.NoSuchMethodException - if the method cannot be locatedpublic static java.lang.reflect.Constructor<?> findConstructor(java.lang.Object instance,
java.lang.Class<?>... parameterTypes)
throws java.lang.NoSuchMethodException
instance - an object to search the constructor into.parameterTypes - constructor parameter typesjava.lang.NoSuchMethodException - if the constructor cannot be locatedpublic static void expandFieldArray(java.lang.Object instance,
java.lang.String fieldName,
java.lang.Object[] extraElements)
throws java.lang.NoSuchFieldException,
java.lang.IllegalArgumentException,
java.lang.IllegalAccessException
instance - the instance whose field is to be modified.fieldName - the field to modify.extraElements - elements to append at the end of the array.java.lang.NoSuchFieldExceptionjava.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionpublic static void reduceFieldArray(java.lang.Object instance,
java.lang.String fieldName,
int reduceSize)
throws java.lang.NoSuchFieldException,
java.lang.IllegalArgumentException,
java.lang.IllegalAccessException
instance - the instance whose field is to be modified.fieldName - the field to modify.java.lang.NoSuchFieldExceptionjava.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionpublic static java.lang.Object getActivityThread(android.content.Context context,
java.lang.Class<?> activityThread)
public static int getValueOfStaticIntField(java.lang.Class<?> clazz,
java.lang.String fieldName,
int defVal)