Modify add global exception catch for Xposed entry method and change some exception note in YukiHookBridge, YukiBridgeFactory

This commit is contained in:
2022-11-29 02:20:44 +08:00
parent c77ad3757b
commit 36578fc113
2 changed files with 9 additions and 6 deletions

View File

@@ -35,6 +35,7 @@ import com.highcapable.yukihookapi.annotation.YukiGenerateApi
import com.highcapable.yukihookapi.hook.factory.classOf import com.highcapable.yukihookapi.hook.factory.classOf
import com.highcapable.yukihookapi.hook.factory.field import com.highcapable.yukihookapi.hook.factory.field
import com.highcapable.yukihookapi.hook.factory.hasClass import com.highcapable.yukihookapi.hook.factory.hasClass
import com.highcapable.yukihookapi.hook.log.yLoggerE
import com.highcapable.yukihookapi.hook.param.PackageParam import com.highcapable.yukihookapi.hook.param.PackageParam
import com.highcapable.yukihookapi.hook.param.type.HookEntryType import com.highcapable.yukihookapi.hook.param.type.HookEntryType
import com.highcapable.yukihookapi.hook.param.wrapper.PackageParamWrapper import com.highcapable.yukihookapi.hook.param.wrapper.PackageParamWrapper
@@ -263,11 +264,13 @@ object YukiHookBridge {
else null else null
else -> null else -> null
}?.also { }?.also {
runCatching {
if (it.isCorrectProcess) YukiHookAPI.onXposedLoaded(it) if (it.isCorrectProcess) YukiHookAPI.onXposedLoaded(it)
if (it.type != HookEntryType.ZYGOTE && it.packageName == modulePackageName) if (it.type != HookEntryType.ZYGOTE && it.packageName == modulePackageName)
AppParasitics.hookModuleAppRelated(it.appClassLoader, it.type) AppParasitics.hookModuleAppRelated(it.appClassLoader, it.type)
if (it.type == HookEntryType.PACKAGE) AppParasitics.registerToAppLifecycle(it.packageName) if (it.type == HookEntryType.PACKAGE) AppParasitics.registerToAppLifecycle(it.packageName)
if (it.type == HookEntryType.RESOURCES) isSupportResourcesHook = true if (it.type == HookEntryType.RESOURCES) isSupportResourcesHook = true
}.onFailure { yLoggerE(msg = "An exception occurred in the Hooking Process of YukiHookAPI", e = it) }
} }
} }
} }

View File

@@ -91,7 +91,7 @@ internal object YukiHookHelper {
else -> error("Unexpected BaseFinder result interface type") else -> error("Unexpected BaseFinder result interface type")
} }
hookMember(member, callback) hookMember(member, callback)
}.onFailure { yLoggerE(msg = "Hooking Process exception occurred", e = it) }.getOrNull() ?: Pair(null, false) }.onFailure { yLoggerE(msg = "An exception occurred when hooking internal function", e = it) }.getOrNull() ?: Pair(null, false)
/** /**
* Hook [Member] * Hook [Member]