Commit 6b0ac144 authored by Administrator's avatar Administrator

支持Zelda引擎

parent a51f9d8f
......@@ -7,7 +7,7 @@ import java.lang.reflect.Member;
public interface HookProvider {
void hookMethod(Member method, RC_MethodHook callback);
RC_MethodHook.Unhook hookMethod(Member method, RC_MethodHook callback);
void unhookMethod(Member method, RC_MethodHook callback);
......
package com.virjar.ratel.api;
/**
* ratel框架支持的四种引擎
*/
public enum RatelEngine {
//入口重编
REBUILD_DEX,
//修改AndroidManifest.xml,并植入新的dex
APPEND_DEX,
//通过shell包裹,这种引擎线上使用此时非常少
SHELL,
//zelda引擎,这里指商业版,开源版引擎: https://github.com/virjar/zelda
ZELDA
}
......@@ -92,6 +92,7 @@ public class RatelToolKit {
*/
public static boolean killAppIfDetectANR = false;
/**
* 虚拟化环境下,sdcard将会被隔离,导致无法往sdcard写入数据。但是如果ratel模块期望通过sdcard和其他app交换数据,那么需要通过一个sdcard白名单进行放行<br>
* 该路径规则为: /sdcard/ratel_white_dir/packageName/ <br>
......
......@@ -3,9 +3,7 @@ package com.virjar.ratel.api.rposed;
import android.util.Log;
import com.virjar.ratel.api.RatelToolKit;
import com.virjar.ratel.api.rposed.callbacks.RC_LoadPackage;
import java.io.IOException;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
......@@ -102,9 +100,8 @@ public final class RposedBridge {
* @see #hookAllConstructors
*/
public static RC_MethodHook.Unhook hookMethod(Member hookMethod, RC_MethodHook callback) {
RatelToolKit.usedHookProvider.hookMethod(hookMethod, callback);
return callback.new Unhook(hookMethod);
return RatelToolKit.usedHookProvider.hookMethod(hookMethod, callback);
// return callback.new Unhook(hookMethod);
}
/**
......@@ -113,7 +110,8 @@ public final class RposedBridge {
* @param hookMethod The method for which the callback should be removed.
* @param callback The reference to the callback as specified in {@link #hookMethod}.
* @deprecated Use {@link RC_MethodHook.Unhook#unhook} instead. An instance of the {@code Unhook}
* class is returned when you hook the method.
* class is returned when you hook the method.<br>
* 请注意,不要通过这个方法调用unhook,底层并没有实现他,请使用
*/
@Deprecated
public static void unhookMethod(Member hookMethod, RC_MethodHook callback) {
......
......@@ -926,9 +926,10 @@ public final class RposedHelpers {
/**
* Returns the value of an object field in the given object instance. A class reference is not sufficient! See also {@link #findField}.
*/
public static Object getObjectField(Object obj, String fieldName) {
@SuppressWarnings("unchecked")
public static <T> T getObjectField(Object obj, String fieldName) {
try {
return findField(obj.getClass(), fieldName).get(obj);
return (T) findField(obj.getClass(), fieldName).get(obj);
} catch (IllegalAccessException e) {
// should not happen
RposedBridge.log(e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment