From fe2d3c47c8d9c35e4f422c51dfadcc7fab32d599 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 16 Mar 2023 19:16:08 +0800 Subject: [PATCH] [2.15.0] debug setting view bug --- .../autopilot/MoGoTelematicProvider.kt | 2 +- .../hmi/ui/setting/DebugSettingView.kt | 25 ++++++++++++++----- .../api/telematic/IMogoTelematicProvider.kt | 2 +- .../call/telematic/CallerTelematicManager.kt | 6 ++++- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoTelematicProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoTelematicProvider.kt index 12eeedf1da..f2e06deda1 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoTelematicProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoTelematicProvider.kt @@ -24,7 +24,7 @@ class MoGoTelematicProvider: IMogoTelematicProvider { return NSDNettyManager.getInstance().connServerIp } - override fun getServerToken(): String { + override fun getServerToken(): String? { return NSDNettyManager.getInstance().serverSn } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 97fd707836..ed9d95f62a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -181,11 +181,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() @@ -226,6 +235,7 @@ internal class DebugSettingView @JvmOverloads constructor( logInfoView!!.onEnterForeground() } // 开启定时查询速度 + isRunCheck = true Timer().schedule(timerTaskRefresh, Date(), 300) if (AppConfigInfo.isConnectAutopilot && (AppConfigInfo.plateNumber.isNullOrEmpty() || AppConfigInfo.iPCMacAddress.isNullOrEmpty())) { //查询工控机基础配置信息 @@ -273,6 +283,7 @@ internal class DebugSettingView @JvmOverloads constructor( logInfoView!!.onEnterBackground() } try { + isRunCheck = false timerTaskRefresh.cancel() } catch (e: Exception) { e.printStackTrace() @@ -1517,7 +1528,7 @@ internal class DebugSettingView @JvmOverloads constructor( "移动数据" } else { //WiFi - CommonUtils.getWifiName(context) + CommonUtils.getWifiName(context)?:"" } } else { @@ -1557,7 +1568,7 @@ internal class DebugSettingView @JvmOverloads constructor( else -> { "乘客端${ when { - AppConfigInfo.serverSn.isNotEmpty() -> "(司机屏SN是:${AppConfigInfo.serverSn})" + !AppConfigInfo.serverSn.isNullOrEmpty() -> "(司机屏SN是:${AppConfigInfo.serverSn?:""})" else -> "" } }连接" @@ -1593,10 +1604,12 @@ internal class DebugSettingView @JvmOverloads constructor( }" ) - val autopilotJson = GsonUtils.toJson(mAutoPilotStatusInfo) - tvAutopilotInfo.text = autopilotJson - tvIpcInfo.text = autopilotJson - tvIpcInfoKey.text = autopilotJson + mAutoPilotStatusInfo?.let { + val autopilotJson = GsonUtils.toJson(it) + tvAutopilotInfo.text = autopilotJson + tvIpcInfo.text = autopilotJson + tvIpcInfoKey.text = autopilotJson + } tvCmdbCarInfoContent.text = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO)?:"" tvCarInfo.text = diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IMogoTelematicProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IMogoTelematicProvider.kt index 39ff7d0f62..f93e5328dd 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IMogoTelematicProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IMogoTelematicProvider.kt @@ -9,7 +9,7 @@ interface IMogoTelematicProvider: IProvider { fun getServerIp(): String - fun getServerToken(): String + fun getServerToken(): String? fun sendMsgToAllClients(type: Int, byteArray: ByteArray) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicManager.kt index c164e12b15..b70b90befc 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicManager.kt @@ -32,7 +32,11 @@ object CallerTelematicManager { } fun getServerToken(): String { - return providerApi?.getServerToken() ?: "" + providerApi?.let { + return it.getServerToken()?:"" + }.also{ + return "" + } } /**