Merge branch 'dev_robotaxi-d-app-module_2130_221116_2.13.0' into dev_arch_opt_3.0
This commit is contained in:
@@ -55,6 +55,10 @@ if (!isAndroidTestBuild()) {
|
||||
leak_canary_crash_fix {
|
||||
enable !isReleaseBuild
|
||||
}
|
||||
|
||||
anr_fix {
|
||||
enable true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
71
app/src/main/java/com/mogo/launcher/lancet/ANRFix.kt
Normal file
71
app/src/main/java/com/mogo/launcher/lancet/ANRFix.kt
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.mogo.launcher.lancet
|
||||
|
||||
import androidx.annotation.*
|
||||
import com.knightboost.lancet.api.*
|
||||
import com.knightboost.lancet.api.annotations.*
|
||||
import com.knightboost.lancet.api.annotations.Weaver
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import kotlinx.coroutines.Runnable
|
||||
|
||||
@Keep
|
||||
@Weaver
|
||||
@Group("anr_fix")
|
||||
class ANRFix {
|
||||
|
||||
@Insert
|
||||
@TargetClass("com.zhidao.cosupload.service.UploadService")
|
||||
@TargetMethod(methodName = "addUploadPaths")
|
||||
private fun fixAddUploadPathsANR() {
|
||||
ThreadUtils.getIoPool().execute(ANRFixTask(This.get(), "addUploadPaths"))
|
||||
}
|
||||
|
||||
@Insert
|
||||
@TargetClass("com.zhidao.cosupload.service.UploadService")
|
||||
@TargetMethod(methodName = "upload")
|
||||
private fun fixUploadANR(@ClassOf("com.zhidao.cosupload.model.CacheUploadIdData") data: Any?) {
|
||||
ThreadUtils.getIoPool().execute(ANRFixTask2(This.get(), "upload", data))
|
||||
}
|
||||
|
||||
@Insert
|
||||
@TargetClass("com.zhidao.cosupload.manager.CosUploadManagerImpl")
|
||||
@TargetMethod(methodName = "upload")
|
||||
private fun fixCosUploadManagerImplANR(productLine: String?, paths: List<String>?, eventId: String?, @ClassOf("com.zhidao.cosupload.DbPriorityConfig") config: Any?) {
|
||||
ThreadUtils.getIoPool().execute(ANRFixTask3(This.get(), "upload", productLine, paths, eventId, config))
|
||||
}
|
||||
}
|
||||
|
||||
class ANRFixTask(private val delegate: Any, private val methodName: String): Runnable {
|
||||
|
||||
override fun run() {
|
||||
delegate.javaClass.declaredMethods.find {
|
||||
it.name != methodName && it.name.contains(methodName)
|
||||
}?.also {
|
||||
it.isAccessible = true
|
||||
it.invoke(delegate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ANRFixTask2(private val delegate: Any, private val methodName: String, private val p: Any?): Runnable {
|
||||
|
||||
override fun run() {
|
||||
delegate.javaClass.declaredMethods.find {
|
||||
it.name != methodName && it.name.contains(methodName)
|
||||
}?.also {
|
||||
it.isAccessible = true
|
||||
it.invoke(delegate, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ANRFixTask3(private val delegate: Any, private val methodName: String,private val productLine: String?, private val paths: List<String>?, private val eventId: String?, private val config: Any?): Runnable {
|
||||
|
||||
override fun run() {
|
||||
delegate.javaClass.declaredMethods.find {
|
||||
it.name != methodName && it.name.contains(methodName)
|
||||
}?.also {
|
||||
it.isAccessible = true
|
||||
it.invoke(delegate, productLine, paths, eventId, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user