diff --git a/edxp-common/src/main/java/com/elderdrivers/riru/edxp/hooker/XposedInstallerHooker.java b/edxp-common/src/main/java/com/elderdrivers/riru/edxp/hooker/XposedInstallerHooker.java index 719b757c..07953b16 100644 --- a/edxp-common/src/main/java/com/elderdrivers/riru/edxp/hooker/XposedInstallerHooker.java +++ b/edxp-common/src/main/java/com/elderdrivers/riru/edxp/hooker/XposedInstallerHooker.java @@ -21,8 +21,13 @@ public class XposedInstallerHooker { final String xposedAppClass = LEGACY_INSTALLER_PACKAGE_NAME + ".XposedApp"; final Class InstallZipUtil = XposedHelpers.findClass(LEGACY_INSTALLER_PACKAGE_NAME + ".util.InstallZipUtil", classLoader); - XposedHelpers.findAndHookMethod(xposedAppClass, classLoader, "getActiveXposedVersion", - XC_MethodReplacement.returnConstant(XposedBridge.getXposedVersion())); + XposedHelpers.findAndHookMethod(xposedAppClass, classLoader, "getActiveXposedVersion", new XC_MethodHook() { + @Override + protected void afterHookedMethod(MethodHookParam param) throws Throwable { + Utils.logD("after getActiveXposedVersion..."); + param.setResult(XposedBridge.getXposedVersion()); + } + }); XposedHelpers.findAndHookMethod(xposedAppClass, classLoader, "reloadXposedProp", new XC_MethodHook() { @Override diff --git a/edxp-core/build.gradle b/edxp-core/build.gradle index 84f22687..bc2e4ce8 100644 --- a/edxp-core/build.gradle +++ b/edxp-core/build.gradle @@ -167,11 +167,16 @@ afterEvaluate { } } def libPathRelease = "${buildDir}/intermediates/cmake/${variantLowered}/obj" + def exclude_list = ["riru.sh"] + if(backendLowered == "yahfa") { + exclude_list.add("system/lib/libsandhook-native.so") + exclude_list.add("system/lib64/libsandhook-native.so") + } doLast { copy { from "${projectDir}/template_override" into zipPathMagiskRelease - exclude 'riru.sh' + exclude exclude_list } copy { from "${projectDir}/template_override" diff --git a/edxp-core/src/main/cpp/main/include/art/runtime/class_linker.h b/edxp-core/src/main/cpp/main/include/art/runtime/class_linker.h index 60d2aeef..4924765e 100644 --- a/edxp-core/src/main/cpp/main/include/art/runtime/class_linker.h +++ b/edxp-core/src/main/cpp/main/include/art/runtime/class_linker.h @@ -6,6 +6,7 @@ #include #include #include "runtime.h" +#include "config.h" #include "jni_env_ext.h" #include "edxp_context.h" #include "jni/edxp_pending_hooks.h" @@ -84,7 +85,11 @@ namespace art { HOOK_FUNC(FixupStaticTrampolines, "_ZN3art11ClassLinker22FixupStaticTrampolinesENS_6ObjPtrINS_6mirror5ClassEEE"); - if (GetAndroidApiLevel() >= __ANDROID_API_R__) { + + // Sandhook will hook ShouldUseInterpreterEntrypoint, so we just skip + // edxp::Context::GetInstance()->GetVariant() will not work here, so we use smh dirty hack + if (GetAndroidApiLevel() >= __ANDROID_API_R__ && access(edxp::kLibSandHookNativePath.c_str(), F_OK) == -1) { + LOGD("Not sandhook, installing _ZN3art11ClassLinker30ShouldUseInterpreterEntrypointEPNS_9ArtMethodEPKv"); HOOK_FUNC(ShouldUseInterpreterEntrypoint, "_ZN3art11ClassLinker30ShouldUseInterpreterEntrypointEPNS_9ArtMethodEPKv"); } diff --git a/edxp-core/src/main/cpp/main/src/native_hook.cpp b/edxp-core/src/main/cpp/main/src/native_hook.cpp index 79e9bad0..7e286eb3 100644 --- a/edxp-core/src/main/cpp/main/src/native_hook.cpp +++ b/edxp-core/src/main/cpp/main/src/native_hook.cpp @@ -30,18 +30,6 @@ namespace edxp { void InstallFwkHooks(void *fwk_handle); - bool InstallLinkerHooks(const char *linker_path); - - CREATE_HOOK_STUB_ENTRIES(void *, mydlopen, const char *file_name, int flags, - const void *ext_info, - const void *caller) { - void *handle = mydlopenBackup(file_name, flags, ext_info, caller); - if (file_name != nullptr && std::string(file_name).find(kLibArtName) != std::string::npos) { - InstallArtHooks(handle); - } - return handle; - } - void InstallInlineHooks() { if (installed) { LOGI("Inline hooks have been installed, skip");