[dev_arch_opt_3.0]

[Change]
[
1、统一降低定位回调的频率为5Hz即200ms一次,来解决因频放回调hreadUtils.runOnUiThread 、UiThreadHandler.post导致UI卡死问题
]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-03-13 15:13:41 +08:00
parent 4ba2088fe0
commit cceb92531b
3 changed files with 27 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
initMapView()
CallerSkinModeListenerManager.addListener(TAG, this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 20,this)
CallerChassisLamplightListenerManager.addListener(TAG, this)
}

View File

@@ -73,7 +73,19 @@ object CallerChassisLocationGCJ02ListenerManager : CallerBase<IMoGoChassisLocati
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
}
} else {
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
//Logger.d(TAG, "没设置监听频率使用默认5HZ")
val hzTime = (1.0 / 5) * 1000
// 获取最后一次回调的时间
val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag]
if (hzLastSendTime != null && hzLastSendTime > 0) {
// 计算是否进入下一次回调周期
val nowTime = TimeUtils.getNowMills()
if (nowTime - hzLastSendTime > hzTime) {
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
}
} else {
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
}
}
}
}

View File

@@ -59,7 +59,19 @@ object CallerChassisLocationWGS84ListenerManager : CallerBase<IMoGoChassisLocati
syncLocationCallback(tag, it, mGnssInfo, sourceType)
}
} else {
syncLocationCallback(tag, it, mGnssInfo, sourceType)
//Logger.d(TAG, "没设置监听频率使用默认5HZ")
val hzTime = (1.0 / 5) * 1000
// 获取最后一次回调的时间
val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag]
if (hzLastSendTime != null && hzLastSendTime > 0) {
// 计算是否进入下一次回调周期
val nowTime = TimeUtils.getNowMills()
if (nowTime - hzLastSendTime > hzTime) {
syncLocationCallback(tag, it, mGnssInfo, sourceType)
}
} else {
syncLocationCallback(tag, it, mGnssInfo, sourceType)
}
}
}
}