Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复hook状态栏歌词崩溃问题,更新规则描述,更新hook名字 #210

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/src/main/assets/app_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"apiVersion": 0,
"useApi": false,
"getLyricType": 0,
"remarks": ""
"remarks": "需在APP设置中打开状态栏歌词开关,如遇到开启开关无法显示歌词请issues带版本及官方签名apk反馈"
}
]
},
Expand All @@ -166,7 +166,7 @@
"apiVersion": 0,
"useApi": false,
"getLyricType": 0,
"remarks": "需在APP设置中打开状态栏歌词开关"
"remarks": "需在APP设置中打开状态栏歌词开关,如遇到开启开关无法显示歌词请issues带版本及官方签名apk反馈"
}
]
},
Expand Down Expand Up @@ -543,6 +543,6 @@
]
}
],
"appRulesVersion": 12,
"version": 9
"appRulesVersion": 13,
"version": 10
}
23 changes: 18 additions & 5 deletions app/src/main/kotlin/cn/lyric/getter/hook/app/Kugou.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import cn.lyric.getter.tool.HookTools
import cn.lyric.getter.tool.HookTools.eventTools
import cn.lyric.getter.tool.HookTools.fuckTinker
import cn.lyric.getter.tool.Tools.getVersionCode
import cn.xiaowine.xkt.LogTool.log
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass
import com.github.kyuubiran.ezxhelper.EzXHelper.classLoader
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import cn.xiaowine.xkt.LogTool.log
import android.os.Process
import java.util.Arrays

object Kugou : BaseHook() {
override fun init() {
Expand All @@ -26,30 +27,34 @@ object Kugou : BaseHook() {
"com.kugou.android" -> {
if (getProcessName(app) == "com.kugou.android") return@getApplication
when {
verCode <= 10000 -> hookMethodForVersionA()
verCode <= 10000 -> hookcarLyric()
verCode <= 12009 -> {
HookTools.MockFlyme().mock()
hookLocalBroadcast("android.support.v4.content.LocalBroadcastManager")
hookfixStatusBarLyric()
}

else -> {
HookTools.MockFlyme().mock()
hookLocalBroadcast("androidx.localbroadcastmanager.content.LocalBroadcastManager")
hookfixStatusBarLyric()
}
}
}

"com.kugou.android.lite" -> {
when {
verCode <= 10648 -> hookMethodForVersionA()
verCode <= 10648 -> hookcarLyric()
verCode <= 10999 -> {
HookTools.MockFlyme().mock()
hookLocalBroadcast("android.support.v4.content.LocalBroadcastManager")
hookfixStatusBarLyric()
}

else -> {
HookTools.MockFlyme().mock()
hookLocalBroadcast("androidx.localbroadcastmanager.content.LocalBroadcastManager")
hookfixStatusBarLyric()
}
}
}
Expand All @@ -68,7 +73,7 @@ object Kugou : BaseHook() {
return null
}

private fun hookMethodForVersionA() {
private fun hookcarLyric() {
loadClass("com.kugou.framework.player.c").methodFinder()
.filterByParamTypes(HashMap::class.java).first { name == "a" }
.createHook {
Expand All @@ -78,7 +83,15 @@ object Kugou : BaseHook() {
}
}
}

private fun hookfixStatusBarLyric() {
loadClass("com.kugou.android.lyric.e").methodFinder()
.first { name == "a" && parameterTypes.size == 3 && parameterTypes[2] == Boolean::class.java}
.createHook {
before { param ->
param.args[2] = true
}
}
}
private fun hookLocalBroadcast(className: String) {
loadClass(className, classLoader).methodFinder()
.first { name == "sendBroadcast" }
Expand Down
Loading