diff --git a/edxp-sandhook/build.gradle b/edxp-sandhook/build.gradle index 642aeba3..a0bf289b 100644 --- a/edxp-sandhook/build.gradle +++ b/edxp-sandhook/build.gradle @@ -24,7 +24,7 @@ dependencies { compileOnly files("libs/framework-stub.jar") implementation project(':edxp-common') implementation project(':xposed-bridge') - implementation 'com.swift.sandhook:hooklib:3.2.8' + implementation 'com.swift.sandhook:hooklib:3.3.3' compileOnly project(':dexmaker') } diff --git a/edxp-sandhook/src/main/java/com/elderdrivers/riru/edxp/sandhook/entry/Router.java b/edxp-sandhook/src/main/java/com/elderdrivers/riru/edxp/sandhook/entry/Router.java index c95016bf..1240845e 100644 --- a/edxp-sandhook/src/main/java/com/elderdrivers/riru/edxp/sandhook/entry/Router.java +++ b/edxp-sandhook/src/main/java/com/elderdrivers/riru/edxp/sandhook/entry/Router.java @@ -30,6 +30,7 @@ public class Router { private static volatile AtomicBoolean bootstrapHooked = new AtomicBoolean(false); + static boolean useSandHook = false; public static void prepare(boolean isSystem) { // this flag is needed when loadModules @@ -61,7 +62,7 @@ public class Router { } Router.startBootstrapHook(isSystem); XposedInit.initForZygote(isSystem); - SandHookConfig.compiler = !isSystem; + //SandHookConfig.compiler = !isSystem; } catch (Throwable t) { Utils.logE("error during Xposed initialization", t); XposedBridge.disableHooks = true; @@ -81,18 +82,46 @@ public class Router { Utils.logD("startBootstrapHook starts: isSystem = " + isSystem); ClassLoader classLoader = XposedBridge.BOOTCLASSLOADER; if (isSystem) { - XposedCompat.addHookers(classLoader, SysBootstrapHookInfo.hookItems); + if (useSandHook) { + XposedCompat.addHookers(classLoader, SysBootstrapHookInfo.hookItems); + } else { + HookMain.doHookDefault( + Router.class.getClassLoader(), + classLoader, + SysBootstrapHookInfo.class.getName()); + } } else { - XposedCompat.addHookers(classLoader, AppBootstrapHookInfo.hookItems); + if (useSandHook) { + XposedCompat.addHookers(classLoader, AppBootstrapHookInfo.hookItems); + } else { + HookMain.doHookDefault( + Router.class.getClassLoader(), + classLoader, + AppBootstrapHookInfo.class.getName()); + } } } public static void startSystemServerHook() { - XposedCompat.addHookers(SystemMainHooker.systemServerCL, SysInnerHookInfo.hookItems); + if (useSandHook) { + XposedCompat.addHookers(SystemMainHooker.systemServerCL, SysInnerHookInfo.hookItems); + } else { + HookMain.doHookDefault( + Router.class.getClassLoader(), + SystemMainHooker.systemServerCL, + SysInnerHookInfo.class.getName()); + } } public static void startWorkAroundHook() { - XposedCompat.addHookers(XposedBridge.BOOTCLASSLOADER, WorkAroundHookInfo.hookItems); + if (useSandHook) { + XposedCompat.addHookers(XposedBridge.BOOTCLASSLOADER, WorkAroundHookInfo.hookItems); + } else { + HookMain.doHookDefault( + Router.class.getClassLoader(), + XposedBridge.BOOTCLASSLOADER, + WorkAroundHookInfo.class.getName()); + } } public static void onEnterChildProcess() { diff --git a/edxp-sandhook/src/main/java/com/swift/sandhook/xposedcompat/hookstub/HookStubManager.java b/edxp-sandhook/src/main/java/com/swift/sandhook/xposedcompat/hookstub/HookStubManager.java index 75773d47..571b8ba5 100644 --- a/edxp-sandhook/src/main/java/com/swift/sandhook/xposedcompat/hookstub/HookStubManager.java +++ b/edxp-sandhook/src/main/java/com/swift/sandhook/xposedcompat/hookstub/HookStubManager.java @@ -314,7 +314,6 @@ public class HookStubManager { try { ((XC_MethodHook) snapshot[afterIdx]).callAfterHookedMethod(param); } catch (Throwable t) { - XposedBridge.log(t); if (lastThrowable == null) param.setResult(lastResult); else @@ -384,7 +383,6 @@ public class HookStubManager { try { ((XC_MethodHook) snapshot[afterIdx]).callAfterHookedMethod(param); } catch (Throwable t) { - XposedBridge.log(t); if (lastThrowable == null) param.setResult(lastResult); else diff --git a/edxp-sandhook/template_override/system/lib/libsandhook.edxp.so b/edxp-sandhook/template_override/system/lib/libsandhook.edxp.so old mode 100644 new mode 100755 index a2a75892..18596562 Binary files a/edxp-sandhook/template_override/system/lib/libsandhook.edxp.so and b/edxp-sandhook/template_override/system/lib/libsandhook.edxp.so differ diff --git a/edxp-sandhook/template_override/system/lib64/libsandhook.edxp.so b/edxp-sandhook/template_override/system/lib64/libsandhook.edxp.so old mode 100644 new mode 100755 index 02225e39..d0c13135 Binary files a/edxp-sandhook/template_override/system/lib64/libsandhook.edxp.so and b/edxp-sandhook/template_override/system/lib64/libsandhook.edxp.so differ