Merge branch 'dev_arch_opt_3.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_arch_opt_3.0

This commit is contained in:
xinfengkun
2023-03-15 15:31:21 +08:00

View File

@@ -14,23 +14,29 @@ import com.knightboost.lancet.api.annotations.*
@Group("crash_fix")
class CrashFix {
/**
* 修正Android8.0及之后后台启动Service引起的崩溃
* java.lang.IllegalStateException: Not allowed to start service Intent {
* act=com.zhidao.cosupload.service.UPLOAD_ACTION cmp=com.mogo.launcher.f/com.zhidao.cosupload.service.UploadService }: app is in background uid UidRecord{6443b7b u0a404 LAST bg:+1m15s362ms idle change:idle procs:1 seq(0,0,0)}
*/
@Insert(mayCreateSuper = true)
@TargetClass("android.content.Context", scope = LEAF)
@TargetMethod(methodName = "startService")
fun fixStartServiceCrash(intent: Intent): ComponentName? {
return try {
Origin.call() as ComponentName?
} catch (t: Throwable) {
t.printStackTrace()
null
companion object {
/**
* 修正Android8.0及之后后台启动Service引起的崩溃
* java.lang.IllegalStateException: Not allowed to start service Intent {
* act=com.zhidao.cosupload.service.UPLOAD_ACTION cmp=com.mogo.launcher.f/com.zhidao.cosupload.service.UploadService }: app is in background uid UidRecord{6443b7b u0a404 LAST bg:+1m15s362ms idle change:idle procs:1 seq(0,0,0)}
*/
@JvmStatic
@TargetClass("android.content.Context", scope = ALL)
@TargetMethod(methodName = "startService")
@ReplaceInvoke
fun fixStartServiceCrash(context: Context, intent: Intent): ComponentName? {
return try {
return context.startService(intent)
} catch (t: Throwable) {
t.printStackTrace()
null
}
}
}
/**
* https://console.volcengine.com/apmplus/app/crash/detail/java/bb387ccd9c1a3c6ad2ede4e6f501a5e7?aid=302368&date=%7B%22granularity%22%3A%221h%22%2C%22duration%22%3A%22recently%22%2C%22range%22%3A%221w%22%7D&filters=%7B%22type%22%3A%22and%22%2C%22sub_conditions%22%3A%5B%7B%22dimension%22%3A%22os%22%2C%22op%22%3A%22in%22%2C%22type%22%3A%22expression%22%2C%22values%22%3A%5B%22Android%22%5D%7D%5D%7D&org_id=2100068151&os=Android&page_number=6&status=%5B%22pending%22%2C%22processing%22%2C%22solved%22%2C%22reopen%22%5D
* java.lang.IllegalArgumentException: Invalid audio buffer size.