Commit 795c09b2 authored by swift_gan's avatar swift_gan

tweak demo

parent 59726be9
...@@ -2,6 +2,7 @@ package com.swift.sandhook; ...@@ -2,6 +2,7 @@ package com.swift.sandhook;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.os.Build;
import android.util.Log; import android.util.Log;
import com.swift.sandhook.test.TestClass; import com.swift.sandhook.test.TestClass;
...@@ -35,7 +36,10 @@ public class MyApp extends Application { ...@@ -35,7 +36,10 @@ public class MyApp extends Application {
} }
SandHook.disableVMInline(); SandHook.disableVMInline();
if (SandHookConfig.SDK_INT >= Build.VERSION_CODES.P) {
SandHook.passApiCheck(); SandHook.passApiCheck();
}
try { try {
SandHook.addHookClass(JniHooker.class, SandHook.addHookClass(JniHooker.class,
......
...@@ -38,7 +38,11 @@ public class CtrHook { ...@@ -38,7 +38,11 @@ public class CtrHook {
@HookMode(HookMode.INLINE) @HookMode(HookMode.INLINE)
public static void onAdd1(TestClass thiz) throws Throwable { public static void onAdd1(TestClass thiz) throws Throwable {
Log.e("TestClassHook", "add1 been hooked"); Log.e("TestClassHook", "add1 been hooked");
try {
SandHook.callOriginByBackup(add1backup, thiz); SandHook.callOriginByBackup(add1backup, thiz);
} catch (Exception e) {
e.printStackTrace();
}
} }
@HookMethod("add2") @HookMethod("add2")
......
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