mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-04 02:05:16 +08:00
Fix the app first crash report not responded problem in some customize ROMs in FrameworkHooker
This commit is contained in:
@@ -58,6 +58,7 @@ import com.highcapable.yukihookapi.hook.log.loggerI
|
|||||||
import com.highcapable.yukihookapi.hook.log.loggerW
|
import com.highcapable.yukihookapi.hook.log.loggerW
|
||||||
import com.highcapable.yukihookapi.hook.type.android.BundleClass
|
import com.highcapable.yukihookapi.hook.type.android.BundleClass
|
||||||
import com.highcapable.yukihookapi.hook.type.android.MessageClass
|
import com.highcapable.yukihookapi.hook.type.android.MessageClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.*
|
||||||
|
|
||||||
object FrameworkHooker : YukiBaseHooker() {
|
object FrameworkHooker : YukiBaseHooker() {
|
||||||
|
|
||||||
@@ -360,8 +361,8 @@ object FrameworkHooker : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
injectMember {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "crashApplication"
|
name = "handleAppCrashInActivityController"
|
||||||
paramCount = 2
|
returnType = BooleanType
|
||||||
}
|
}
|
||||||
afterHook {
|
afterHook {
|
||||||
/** 当前进程信息 */
|
/** 当前进程信息 */
|
||||||
@@ -372,16 +373,9 @@ object FrameworkHooker : YukiBaseHooker() {
|
|||||||
|
|
||||||
/** 当前 APP 信息 */
|
/** 当前 APP 信息 */
|
||||||
val appInfo = ProcessRecordClass.toClass().field { name = "info" }.get(proc).cast<ApplicationInfo>()
|
val appInfo = ProcessRecordClass.toClass().field { name = "info" }.get(proc).cast<ApplicationInfo>()
|
||||||
/** 启动新线程延迟防止方法执行顺序在前导致无法正确获取数据 */
|
/** 添加当前异常信息到第一位 */
|
||||||
newThread {
|
appErrorsRecords.add(0, AppErrorsInfoBean.clone(pid, appInfo?.packageName, appUserIdRecords[pid], args(index = 1).cast()))
|
||||||
/** 延迟 50ms */
|
loggerI(msg = "Received crash application data --pid $pid")
|
||||||
Thread.sleep(50)
|
|
||||||
/** 添加当前异常信息到第一位 */
|
|
||||||
appErrorsRecords.add(
|
|
||||||
0, AppErrorsInfoBean.clone(pid, appInfo?.packageName, appUserIdRecords[pid], args().last().cast())
|
|
||||||
)
|
|
||||||
loggerI(msg = "Received crash application data --pid $pid")
|
|
||||||
}
|
|
||||||
/** 保存异常记录到本地 */
|
/** 保存异常记录到本地 */
|
||||||
saveAllAppErrorsRecords()
|
saveAllAppErrorsRecords()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user