[m1-p-1.1.0] fix bug of debug setting view

This commit is contained in:
zhongchao
2023-03-16 19:03:31 +08:00
parent 19f88c597a
commit 0fc8ebd69c
2 changed files with 18 additions and 3 deletions

View File

@@ -180,11 +180,20 @@ internal class DebugSettingView @JvmOverloads constructor(
initView()
}
@Volatile
private var isRunCheck = true
/**
* 定时刷新视图数据防止因为过快更新导致anr异常
*/
private val timerTaskRefresh = object : TimerTask() {
override fun run() {
if(this@DebugSettingView == null){
return
}
if(!isRunCheck){
return
}
UiThreadHandler.post {
// 绘制应用基本信息
drawAppInfo()
@@ -225,6 +234,7 @@ internal class DebugSettingView @JvmOverloads constructor(
logInfoView!!.onEnterForeground()
}
// 开启定时查询速度
isRunCheck = true
Timer().schedule(timerTaskRefresh, Date(), 300)
if (AppConfigInfo.isConnectAutopilot && (AppConfigInfo.plateNumber.isNullOrEmpty() || AppConfigInfo.iPCMacAddress.isNullOrEmpty())) {
//查询工控机基础配置信息
@@ -272,6 +282,7 @@ internal class DebugSettingView @JvmOverloads constructor(
logInfoView!!.onEnterBackground()
}
try {
isRunCheck = false
timerTaskRefresh.cancel()
} catch (e: Exception) {
e.printStackTrace()
@@ -1526,7 +1537,7 @@ internal class DebugSettingView @JvmOverloads constructor(
"移动数据"
} else {
//WiFi
CommonUtils.getWifiName(context)
CommonUtils.getWifiName(context)?:""
}
} else {
@@ -1565,7 +1576,7 @@ internal class DebugSettingView @JvmOverloads constructor(
else -> {
"乘客端${
when {
AppConfigInfo.serverSn.isNotEmpty() -> "(司机屏SN是:${AppConfigInfo.serverSn})"
!AppConfigInfo.serverSn.isNullOrEmpty() -> "(司机屏SN是:${AppConfigInfo.serverSn?:""})"
else -> ""
}
}连接"

View File

@@ -32,7 +32,11 @@ object CallerTelematicManager {
}
fun getServerToken(): String {
return providerApi?.getServerToken() ?: ""
providerApi?.let {
return it.getServerToken()?:""
}.also{
return ""
}
}
/**