mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
perf: 优化 shizuku 错误提示
This commit is contained in:
parent
5a38217c5c
commit
4f9ba7ec04
|
@ -31,7 +31,12 @@ import kotlin.reflect.typeOf
|
||||||
|
|
||||||
|
|
||||||
fun newActivityTaskManager(): IActivityTaskManager? {
|
fun newActivityTaskManager(): IActivityTaskManager? {
|
||||||
return SystemServiceHelper.getSystemService("activity_task").let(::ShizukuBinderWrapper)
|
val service = SystemServiceHelper.getSystemService("activity_task")
|
||||||
|
if (service == null) {
|
||||||
|
LogUtils.d("shizuku 无法获取 activity_task")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return service.let(::ShizukuBinderWrapper)
|
||||||
.let(IActivityTaskManager.Stub::asInterface)
|
.let(IActivityTaskManager.Stub::asInterface)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ fun DebugPage() {
|
||||||
onCheckedChange = { enableShizuku ->
|
onCheckedChange = { enableShizuku ->
|
||||||
if (enableShizuku) {
|
if (enableShizuku) {
|
||||||
appScope.launchTry(Dispatchers.IO) {
|
appScope.launchTry(Dispatchers.IO) {
|
||||||
// 检验方法是否适配, 再允许使用 shizuku
|
// 校验方法是否适配, 再允许使用 shizuku
|
||||||
val tasks = newActivityTaskManager()?.safeGetTasks()?.firstOrNull()
|
val tasks = newActivityTaskManager()?.safeGetTasks()?.firstOrNull()
|
||||||
if (tasks != null) {
|
if (tasks != null) {
|
||||||
updateStorage(
|
updateStorage(
|
||||||
|
@ -128,6 +128,8 @@ fun DebugPage() {
|
||||||
enableShizuku = true
|
enableShizuku = true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
ToastUtils.showShort("Shizuku方法校验失败,无法使用")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user