From 7c792dc8fea321ff6a308ce3424668f81019df58 Mon Sep 17 00:00:00 2001 From: xueshiji <1402816661@qq.com> Date: Thu, 18 Jun 2026 22:27:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=AF=E5=8A=A8=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E5=8F=8AgetAccessKey=E6=9F=A5=E6=89=BE=E5=A4=B1=E6=95=88=20(#1?= =?UTF-8?q?717)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit initHookInfo 的 biliAccounts 块依赖 "initFacial enter" 字符串锚点定位 getAccessKey,该锚点在8.98.0被移除导致查找失败;readHookInfo 缓存校验中的 getAccessKey 非空条件又会使该失败状态触发每次启动全量重扫死循环(约2.6s卡顿)。 - readHookInfo: 移除 getAccessKey 非空缓存校验,消除死循环 - initHookInfo: biliAccounts 块在锚点反推失败时回退到 declaredMethods 按签名/方法名查找,兼容8.98.0(方法名未混淆);保留原调用图反推以兼容 方法名被混淆的历史版本 fix #1716 --- .../me/iacn/biliroaming/BiliBiliPackage.kt | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt index 15f33545ee..8bcc320830 100644 --- a/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt +++ b/app/src/main/java/me/iacn/biliroaming/BiliBiliPackage.kt @@ -708,7 +708,9 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex }?.declaringClass ?: return@biliAccounts class_ = class_ { name = biliAccountsClass.name } val biliAccountIndex = dexHelper.encodeClassIndex(biliAccountsClass) - val biliAuthFragmentMethodIndex = dexHelper.findMethodUsingString( + // 调用图反推兼容方法名被混淆的历史版本;锚点 "initFacial enter" 失效时 + // (如 8.98.0 方法名未混淆),回退到按签名/方法名直接查找 + val calledMethods = dexHelper.findMethodUsingString( "initFacial enter", true, -1, @@ -719,30 +721,38 @@ class BiliBiliPackage constructor(private val mClassLoader: ClassLoader, mContex null, null, true - ).firstOrNull() ?: return@biliAccounts - val calledMethods = dexHelper.findMethodInvoking( - biliAuthFragmentMethodIndex, - -1, - -1, - null, - biliAccountIndex, - null, - null, - null, - false - ).asSequence().mapNotNull { - dexHelper.decodeMethodIndex(it) as? Method + ).firstOrNull()?.let { + dexHelper.findMethodInvoking( + it, + -1, + -1, + null, + biliAccountIndex, + null, + null, + null, + false + ).asSequence().mapNotNull { m -> + dexHelper.decodeMethodIndex(m) as? Method + } } get = method { - name = calledMethods.firstOrNull { + name = calledMethods?.firstOrNull { it.isStatic && it.parameterTypes.size == 1 && it.parameterTypes[0] == Context::class.java && it.returnType == biliAccountsClass + }?.name ?: biliAccountsClass.declaredMethods.firstOrNull { + it.isStatic && it.parameterTypes.size == 1 + && it.parameterTypes[0] == Context::class.java + && it.returnType == biliAccountsClass }?.name ?: return@method } - getAccessKey = method { - name = calledMethods.firstOrNull { + name = calledMethods?.firstOrNull { it.isNotStatic && it.parameterTypes.isEmpty() && it.returnType == String::class.java + }?.name ?: biliAccountsClass.declaredMethods.firstOrNull { + it.name == "getAccessKey" && it.isNotStatic + && it.parameterTypes.isEmpty() + && it.returnType == String::class.java }?.name ?: return@method } }