Android(5) Xposed API中文手册(部分)

推荐肉丝r0ysue课程(包含安卓逆向与js逆向):https://img-blog.csdnimg.cn/7fa698312c304ab7bb0a03e2c866990f.png
Xposed英文原版离线api文档

android.app

AndroidAppHelper

包含一些关于当前app信息的一些方法

Public Methods

返回值类型Public方法原型及作用
static ApplicationcurrentApplication ():返回当前进程的主要Application
static ApplicationInfocurrentApplicationInfo ():返回当前进程中主应用程序的的信息
static StringcurrentPackageName ():返回当前进程中主应用程序的Android包名称。
static StringcurrentProcessName ():返回当前进程的名称。
static SharedPreferencesgetDefaultSharedPreferencesForPackage ( String packageName) :(此方法已弃用。)现在使用XSharedPreferences
static SharedPreferencesgetSharedPreferencesForPackage ( String packageName, String prefFileName, int mode) :(此方法已弃用。)现在使用 XSharedPreferences
static voidreloadSharedPreferencesIfNeeded ( SharedPreferences pref):(此方法已弃用。)现在使用 XSharedPreferences.reload()

de.robv.android.xposed

XC_MethodHook

用于hook 方法的回调类

通常,子类被创建时会重写beforeHookedMethod(XC_MethodHook.MethodHookParam) 或者afterHookedMethod(XC_MethodHook.MethodHookParam)

内部类

类名描述
classXC_MethodHook.MethodHookParam包装有关方法调用的信息(参数、返回值),并且允许对其进行修改。
classXC_MethodHook.Unhook用来解除方法/构造函数的钩子的对象,。
公共构造方法描述
XC_MethodHook ()创建具有默认优先级的新回调。
XC_MethodHook (int priority)创建具有特定优先级的新回调。
返回值类型Protected方法原型及作用
voidafterHookedMethodMethod(XC_MethodHook.MethodHookParam param):在调用被hook的方法调用。
voidbeforeHookedMethod(XC_MethodHook.MethodHookParam param) :在调用被hook的方法调用。

XC_MethodHook.MethodHookParam

包装有关方法调用的信息(参数、返回值),并且允许对其进行修改。

成员域

成员域类型成员域名字描述
public Object[]args被hook方法的参数列表
public Membermethod这个被hook的方法/构造方法
public ObjectthisObject一个实例方法的this引用;静态方法则返回null
返回值类型Public方法原型及作用
ObjectgetResult () :返回被hook方法调用的结果。
ObjectgetResultOrThrowable () :返回被hook方法调用的结果,或抛出由该方法引起的异常。
ThrowablegetThrowable () :返回由被hook方法抛出的Throwable 或者null
booleanhasThrowable () :如果被hook方法抛出了异常,则返回true
voidsetResult ( Object result) :修改被hook方法的结果
voidsetThrowable ( Throwable throwable) :修改被hook方法抛出的异常

XC_MethodHook.Unhook

返回值类型Public方法原型及作用
XC_MethodHookgetCallback () :返回已注册的回调方法。
MembergetHookedMethod () :返回这个被hook的方法/构造方法
voidunhook () :移除方法回调(hook)

XC_MethodReplacement

Public Constructors描述
XC_MethodReplacement ()创建具有默认优先级的新回调。
XC_MethodReplacement (int priority)创建具有特定优先级的新回调。
返回值类型Public方法原型及作用
static XC_MethodReplacementreturnConstant (Object result) :创建一个回调方法,使得返回给被钩方法的调用者的值为定值result
static XC_MethodReplacementreturnConstant (int priority, Object result) :像returnConstant(Object), 但是允许设置一个优先级
返回值类型Protected 方法原型及作用
abstract ObjectreplaceHookedMethod ( XC_MethodHook.MethodHookParam param) :快捷的完全替换这个hook方法

XposedBridge

Fields
public static final ClassLoaderBOOTCLASSLOADER系统类装入器,可用于定位Android框架类。
public static intXPOSED_BRIDGE_VERSION这个字段在API level 65被废弃。 现在使用getXposedVersion()
返回值类型Public方法原型及作用
static intgetXposedVersion () :返回Xposed框架的当前安装版本。
static Set <XC_MethodHook.Unhook>hookAllConstructors ( Class <?> hookClass, XC_MethodHook callback) :钩住指定类hookClass的所有构造函数。
static Set <XC_MethodHook.Unhook>hookAllMethods ( Class <?> hookClass, String methodName, XC_MethodHook callback) :用指定类hookClass中声明的methodName钩住所有该方法。
static XC_MethodHook.UnhookhookMethod ( Member hookMethod, XC_MethodHook callback):用指定的回调钩住任何方法(或构造函数)。
static ObjectinvokeOriginalMethod ( Member method, Object thisObject, Object[] args) 基本上与反射中Method.invoke(Object,Object…)相同,但是是调用未被Xposed修改的原始的Method。
static voidlog ( String text) :在Xposed的error日志中写一条信息
static voidlog ( Throwable t) :在将堆栈跟踪记录到Xposed error日志。
static voidunhookMethod ( Member hookMethod, XC_MethodHook callback) :这个方法在API level 81已经被弃用 ,现在使用 XC_MethodHook.Unhook.unhook() 。钩住方法时,将返回Unhook类的实例

XposedHelpers

返回值类型Public方法原型及作用
static byte[]assetAsByteArray ( Resources res, String path) :从资源对象加载资源,并将内容作为“byte”数组返回。
static ObjectcallMethod ( Object obj, String methodName, Class<?> parameterTypes, Object… args) :调用给定对象的实例或静态方法。
static ObjectcallMethod ( Object obj, String methodName, Object… args) :调用给定对象的实例或静态方法。
static ObjectcallStaticMethod ( Class <?> clazz, String methodName, Class<?> parameterTypes, Object... args) : 调用给定类的静态方法。
static ObjectcallStaticMethod ( Class <?> clazz, String methodName, Object… args) : 调用给定类的静态方法。
static intdecrementMethodDepth ( String method) :递减给定方法的深度计数器。
static XC_MethodHook.UnhookfindAndHookConstructor ( Class <?> clazz, Object… parameterTypesAndCallback) :查找构造函数并将其挂钩。
static XC_MethodHook.UnhookfindAndHookConstructor ( String className, ClassLoader classLoader, Object… parameterTypesAndCallback) : 查找构造函数并将其挂钩。
static XC_MethodHook.UnhookfindAndHookMethod ( Class <?> clazz, String methodName, Object… parameterTypesAndCallback) : 查找一个方法并将其挂钩
static XC_MethodHook.UnhookfindAndHookMethod ( String className, ClassLoader classLoader, String methodName, Object… parameterTypesAndCallback) : 查找一个方法并将其挂钩
static Class <?>findClass ( String className, ClassLoader classLoader) :使用指定的类装入器查找类。
static Class <?>findClassIfExists ( String className, ClassLoader classLoader) :查找一个类,如果存在就返回。
static Constructor <?>findConstructorBestMatch ( Class <?> clazz, Class args) :在类中查找构造函数并将其设置为可访问的。
static Constructor <?>findConstructorBestMatch ( Class <?> clazz, Object… args) :在类中查找构造函数并将其设置为可访问的。
static Constructor <?>findConstructorBestMatch ( Class <?> clazz, Class... <?> parameterTypes) :在类中查找构造函数并将其设置为可访问的。
static Constructor <?>findConstructorExact ( String className, ClassLoader classLoader, Object… parameterTypes) :查找类的构造函数并将其设置为可访问的。
static Constructor <?>findConstructorExact ( Class <?> clazz, Class... <?> parameterTypes) :查找类的构造函数并将其设置为可访问的。
static Constructor <?>findConstructorExact ( Class <?> clazz, Object… parameterTypes) 查找类的构造函数并将其设置为可访问的。
static Constructor <?>findConstructorExactIfExists ( Class <?> clazz, Object… parameterTypes) 查找构造函数,如果存在就将其返回。
static Constructor <?>findConstructorExactIfExists ( String className, ClassLoader classLoader, Object… parameterTypes) 查找构造函数,如果存在就将其返回。
static FieldfindField ( Class <?> clazz, String fieldName) 在类中查找一个字段并将其设置为可访问的。
static FieldfindFieldIfExists ( Class <?> clazz, String fieldName) 查找字段,如果存在就将其返回。
static FieldfindFirstFieldByExactType ( Class <?> clazz, Class <?> type) 返回类中给定类型的第一个字段。
static MethodfindMethodBestMatch ( Class <?> clazz, String methodName, Class args) 在类中查找方法并将其设置为可访问的。
static MethodfindMethodBestMatch ( Class <?> clazz, String methodName, Object… args) 在类中查找方法并将其设置为可访问的。
static MethodfindMethodBestMatch ( Class <?> clazz, String methodName, Class... <?> parameterTypes) 在类中查找方法并将其设置为可访问的。
static MethodfindMethodExact ( Class <?> clazz, String methodName, Class... <?> parameterTypes) 在类中查找方法并将其设置为可访问的。
static MethodfindMethodExact ( Class <?> clazz, String methodName, Object… parameterTypes) 在类中查找方法并将其设置为可访问的。
static MethodfindMethodExact ( String className, ClassLoader classLoader, String methodName, Object… parameterTypes) 在类中查找方法并将其设置为可访问的。
static MethodfindMethodExactIfExists ( Class <?> clazz, String methodName, Object… parameterTypes) 查找并返回存在的方法。
static MethodfindMethodExactIfExists ( String className, ClassLoader classLoader, String methodName, Object… parameterTypes) 查找并返回存在的方法。
static MethodfindMethodsByExactParameters ( Class <?> clazz, Class <?> returnType, Class... <?> parameterTypes) 返回具有指定参数类型的类中声明/重写的所有方法的数组。
static ObjectgetAdditionalInstanceField ( Object obj, String key) 返回一个被setAdditionalInstanceField(Object, String, Object)存储的值.
static ObjectgetAdditionalStaticField ( Class <?> clazz, String key) Like setAdditionalInstanceField(Object, String, Object), but the value is returned for clazz.
static ObjectgetAdditionalStaticField ( Object obj, String key) Like getAdditionalInstanceField(Object, String), but the value is returned for the class of obj.
static booleangetBooleanField ( Object obj, String fieldName) 返回给定对象实例中的fieldName字段的类型为Boolean的值。
static bytegetByteField ( Object obj, String fieldName) Returns the value of a byte field in the given object instance.
static chargetCharField ( Object obj, String fieldName) Returns the value of a char field in the given object instance.
static Class<?>getClassesAsArray ( Class… <?> clazzes) Returns an array of the given classes.
static doublegetDoubleField ( Object obj, String fieldName) Returns the value of a double field in the given object instance.
static floatgetFloatField ( Object obj, String fieldName) Returns the value of a float field in the given object instance.
static intgetIntField ( Object obj, String fieldName) Returns the value of an int field in the given object instance.
static longgetLongField ( Object obj, String fieldName) Returns the value of a long field in the given object instance.
static StringgetMD5Sum ( String file) Returns the lowercase hex string representation of a file’s MD5 hash sum.
static intgetMethodDepth ( String method) Returns the current depth counter for the given method.
static ObjectgetObjectField ( Object obj, String fieldName) 返回给定对象实例中的对象字段的值。
static Class<?>getParameterTypes ( Object… args) Returns an array with the classes of the given objects.
static shortgetShortField ( Object obj, String fieldName) Returns the value of a short field in the given object instance.
static booleangetStaticBooleanField ( Class <?> clazz, String fieldName) Returns the value of a static boolean field in the given class.
static bytegetStaticByteField ( Class <?> clazz, String fieldName) Sets the value of a static byte field in the given class.
static chargetStaticCharField ( Class <?> clazz, String fieldName) Sets the value of a static char field in the given class.
static doublegetStaticDoubleField ( Class <?> clazz, String fieldName) Sets the value of a static double field in the given class.
static floatgetStaticFloatField ( Class <?> clazz, String fieldName) Sets the value of a static float field in the given class.
static intgetStaticIntField ( Class <?> clazz, String fieldName) Sets the value of a static int field in the given class.
static longgetStaticLongField ( Class <?> clazz, String fieldName) Sets the value of a static long field in the given class.
static ObjectgetStaticObjectField ( Class <?> clazz, String fieldName) Returns the value of a static object field in the given class.
static shortgetStaticShortField ( Class <?> clazz, String fieldName) Sets the value of a static short field in the given class.
static ObjectgetSurroundingThis ( Object obj) For inner classes, returns the surrounding instance, i.e.
static intincrementMethodDepth ( String method) Increments the depth counter for the given method.
static ObjectnewInstance ( Class <?> clazz, Object… args) Creates a new instance of the given class.
static ObjectnewInstance ( Class <?> clazz, Class<?> parameterTypes, Object... args) Creates a new instance of the given class.
static ObjectremoveAdditionalInstanceField ( Object obj, String key) Removes and returns a value which was stored with setAdditionalInstanceField(Object, String, Object).
static ObjectremoveAdditionalStaticField ( Class <?> clazz, String key) Like setAdditionalInstanceField(Object, String, Object), but the value is removed and returned for clazz.
static ObjectremoveAdditionalStaticField ( Object obj, String key) Like removeAdditionalInstanceField(Object, String), but the value is removed and returned for the class of obj.
static ObjectsetAdditionalInstanceField ( Object obj, String key, Object value) Attaches any value to an object instance.
static ObjectsetAdditionalStaticField ( Object obj, String key, Object value) Like setAdditionalInstanceField(Object, String, Object), but the value is stored for the class of obj.
static ObjectsetAdditionalStaticField ( Class <?> clazz, String key, Object value) Like setAdditionalInstanceField(Object, String, Object), but the value is stored for clazz.
static voidsetBooleanField ( Object obj, String fieldName, boolean value) Sets the value of a boolean field in the given object instance.
static voidsetByteField ( Object obj, String fieldName, byte value) 在被给予的类中,设置一个byte
static voidsetCharField ( Object obj, String fieldName, char value) Sets the value of a char field in the given object instance.
static voidsetDoubleField ( Object obj, String fieldName, double value) Sets the value of a double field in the given object instance.
static voidsetFloatField ( Object obj, String fieldName, float value) Sets the value of a float field in the given object instance.
static voidsetIntField ( Object obj, String fieldName, int value) Sets the value of an int field in the given object instance.
static voidsetLongField ( Object obj, String fieldName, long value) Sets the value of a long field in the given object instance.
static voidsetObjectField ( Object obj, String fieldName, Object value) Sets the value of an object field in the given object instance.
static voidsetShortField ( Object obj, String fieldName, short value) Sets the value of a short field in the given object instance.
static voidsetStaticBooleanField ( Class <?> clazz, String fieldName, boolean value) Sets the value of a static boolean field in the given class.
static voidsetStaticByteField ( Class <?> clazz, String fieldName, byte value) 在被给予的类中,设置一个静态byte
static voidsetStaticCharField ( Class <?> clazz, String fieldName, char value) Sets the value of a static char field in the given class.
static voidsetStaticDoubleField ( Class <?> clazz, String fieldName, double value) Sets the value of a static double field in the given class.
static voidsetStaticFloatField ( Class <?> clazz, String fieldName, float value) Sets the value of a static float field in the given class.
static voidsetStaticIntField ( Class <?> clazz, String fieldName, int value) Sets the value of a static int field in the given class.
static voidsetStaticLongField ( Class <?> clazz, String fieldName, long value) Sets the value of a static long field in the given class.
static voidsetStaticObjectField ( Class <?> clazz, String fieldName, Object value) Sets the value of a static object field in the given class.
static voidsetStaticShortField ( Class <?> clazz, String fieldName, short value) Sets the value of a static short field in the given class.
  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Forgo7ten

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值