Commit 42543579 authored by swift_gan's avatar swift_gan

fix 5.1, jni need fix

parent b8775fba
...@@ -9,14 +9,27 @@ import com.swift.sandhook.wrapper.HookMethod; ...@@ -9,14 +9,27 @@ import com.swift.sandhook.wrapper.HookMethod;
import com.swift.sandhook.wrapper.HookMethodBackup; import com.swift.sandhook.wrapper.HookMethodBackup;
import com.swift.sandhook.wrapper.MethodParams; import com.swift.sandhook.wrapper.MethodParams;
import java.lang.reflect.Method;
@HookClass(Activity.class) @HookClass(Activity.class)
public class ActivityHooker { public class ActivityHooker {
@HookMethodBackup("onCreate")
@MethodParams(Bundle.class)
static Method onCreateBackup;
@HookMethodBackup("onPause")
static Method onPauseBackup;
@HookMethod("onCreate") @HookMethod("onCreate")
@MethodParams(Bundle.class) @MethodParams(Bundle.class)
public static void onCreate(Activity thiz, Bundle bundle) { public static void onCreate(Activity thiz, Bundle bundle) {
Log.e("ActivityHooker", "hooked onCreate success " + thiz); Log.e("ActivityHooker", "hooked onCreate success " + thiz);
onCreateBackup(thiz, bundle); try {
onCreateBackup.invoke(thiz, bundle);
} catch (Exception e) {
e.printStackTrace();
}
} }
@HookMethodBackup("onCreate") @HookMethodBackup("onCreate")
...@@ -28,7 +41,11 @@ public class ActivityHooker { ...@@ -28,7 +41,11 @@ public class ActivityHooker {
@HookMethod("onPause") @HookMethod("onPause")
public static void onPause(Activity thiz) { public static void onPause(Activity thiz) {
Log.e("ActivityHooker", "hooked onPause success " + thiz); Log.e("ActivityHooker", "hooked onPause success " + thiz);
onPauseBackup(thiz); try {
onPauseBackup.invoke(thiz);
} catch (Exception e) {
e.printStackTrace();
}
} }
@HookMethodBackup("onPause") @HookMethodBackup("onPause")
......
...@@ -21,7 +21,12 @@ public class CustmizeHooker { ...@@ -21,7 +21,12 @@ public class CustmizeHooker {
@MethodParams({int.class, int.class}) @MethodParams({int.class, int.class})
public static int staticMethodHooked(int a, int b) { public static int staticMethodHooked(int a, int b) {
Log.e("CustmizeHooker", "methodBeHooked be hooked"); Log.e("CustmizeHooker", "methodBeHooked be hooked");
return staticMethodHookedBackup(a, b); try {
return (int) backup.invoke(null, a, b);
} catch (Exception e) {
e.printStackTrace();
}
return 0;
} }
@HookMethodBackup("methodBeHooked") @HookMethodBackup("methodBeHooked")
......
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