mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-06 03:05:17 +08:00
feat: use handleAppCrashLSPB method on system higher than Android 11
This commit is contained in:
@@ -407,6 +407,25 @@ object FrameworkHooker : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
/** 注入自定义错误对话框 */
|
/** 注入自定义错误对话框 */
|
||||||
AppErrorsClass.apply {
|
AppErrorsClass.apply {
|
||||||
|
when {
|
||||||
|
Build.VERSION.SDK_INT > Build.VERSION_CODES.R -> {
|
||||||
|
method {
|
||||||
|
name = "handleAppCrashLSPB"
|
||||||
|
paramCount = 6
|
||||||
|
}.hook().after {
|
||||||
|
/** 当前实例 */
|
||||||
|
val context = appContext ?: field { name = "mContext" }.get(instance).cast<Context>() ?: return@after
|
||||||
|
|
||||||
|
/** 当前进程信息 */
|
||||||
|
val proc = args().first().any() ?: return@after YLog.warn("Received but got null ProcessRecord (Show UI failed)")
|
||||||
|
|
||||||
|
/** 当前错误数据 */
|
||||||
|
val resultData = args().last().any()
|
||||||
|
/** 创建 APP 进程异常数据类 */
|
||||||
|
AppErrorsProcessData(instance, proc, resultData).handleShowAppErrorUi(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
method {
|
method {
|
||||||
name = "handleShowAppErrorUi"
|
name = "handleShowAppErrorUi"
|
||||||
param(MessageClass)
|
param(MessageClass)
|
||||||
@@ -422,6 +441,8 @@ object FrameworkHooker : YukiBaseHooker() {
|
|||||||
/** 创建 APP 进程异常数据类 */
|
/** 创建 APP 进程异常数据类 */
|
||||||
AppErrorsProcessData(instance, proc, resultData).handleShowAppErrorUi(context)
|
AppErrorsProcessData(instance, proc, resultData).handleShowAppErrorUi(context)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
method {
|
method {
|
||||||
name = "handleAppCrashInActivityController"
|
name = "handleAppCrashInActivityController"
|
||||||
returnType = BooleanType
|
returnType = BooleanType
|
||||||
|
Reference in New Issue
Block a user