Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0'
Dev arch opt 3.0 See merge request zhjt/AndroidApp/MoGoEagleEye!687
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user