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