「Fix」修复Service过早初始化调用UI导致异常

https://bugly.qq.com/v2/crash-reporting/crashes/ac71228f85/8?pid=1
#8 java.lang.NullPointerException
null cannot be cast to non-null type com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider

com.mogo.eagle.core.function.call.hmi.CallerHmiManager.getWaringProviderApi(CallerHmiManager.kt:20)

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-12 21:18:28 +08:00
parent 9f3fe2bad4
commit c2019586e0

View File

@@ -69,9 +69,9 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
ThreadUtils.runOnUiThread {
Logger.d(TAG, "vipIdentification")
if (visible) {
flVipIdentificationView.visibility = View.VISIBLE
flVipIdentificationView?.visibility = View.VISIBLE
} else {
flVipIdentificationView.visibility = View.GONE
flVipIdentificationView?.visibility = View.GONE
}
}
}
@@ -85,7 +85,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
override fun initViews() {
initViewShowWithConfig()
ivCameraIcon.setOnClickListener {
ivCameraIcon?.setOnClickListener {
if (cameraViewFloat == null) {
showCameraList(CallerMonitorManager.getCameraList())
}
@@ -183,19 +183,19 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
}
override fun setSpeedChartViewVisibility(visibility: Int) {
viewSpeedChart.visibility = visibility
viewSpeedChart?.visibility = visibility
}
override fun setAutopilotStatusViewVisibility(visibility: Int) {
viewAutopilotStatus.visibility = visibility
viewAutopilotStatus?.visibility = visibility
}
override fun setPerspectiveSwitchViewVisibility(visibility: Int) {
viewPerspectiveSwitch.visibility = visibility
viewPerspectiveSwitch?.visibility = visibility
}
override fun setCheckStatusViewVisibility(visibility: Int) {
viewCheckStatus.visibility = visibility
viewCheckStatus?.visibility = visibility
}
/**
@@ -292,26 +292,26 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* @param checkLightId 0-都是默认不亮起1-红2-黄3-绿
*/
override fun showWarningTrafficLight(checkLightId: Int) {
viewTrafficLightVr.showWarningTrafficLight(checkLightId)
viewTrafficLightVr?.showWarningTrafficLight(checkLightId)
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
override fun disableWarningTrafficLight() {
viewTrafficLightVr.disableWarningTrafficLight()
viewTrafficLightVr?.disableWarningTrafficLight()
}
override fun changeCountdownRed(redNum: Int) {
viewTrafficLightVr.changeCountdownRed(redNum)
viewTrafficLightVr?.changeCountdownRed(redNum)
}
override fun changeCountdownYellow(yellowNum: Int) {
viewTrafficLightVr.changeCountdownYellow(yellowNum)
viewTrafficLightVr?.changeCountdownYellow(yellowNum)
}
override fun changeCountdownGreen(greenNum: Int) {
viewTrafficLightVr.changeCountdownGreen(greenNum)
viewTrafficLightVr?.changeCountdownGreen(greenNum)
}
/**
@@ -320,7 +320,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* @param greenNum 绿灯倒计时
*/
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
viewTrafficLightVr.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
viewTrafficLightVr?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
}
/**
@@ -328,11 +328,11 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
*/
override fun showLimitingVelocity(limitingSpeed: Int) {
if (limitingSpeed > 0) {
tvLimitingVelocity.visibility = View.VISIBLE
tvLimitingVelocity.text = "$limitingSpeed"
tvLimitingVelocity?.visibility = View.VISIBLE
tvLimitingVelocity?.text = "$limitingSpeed"
} else {
tvLimitingVelocity.visibility = View.INVISIBLE
tvLimitingVelocity.text = "0"
tvLimitingVelocity?.visibility = View.INVISIBLE
tvLimitingVelocity?.text = "0"
}
}
@@ -340,8 +340,8 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* 控制关闭限速标志及内容
*/
override fun disableLimitingVelocity() {
tvLimitingVelocity.visibility = View.GONE
tvLimitingVelocity.text = "0"
tvLimitingVelocity?.visibility = View.GONE
tvLimitingVelocity?.text = "0"
}
/**
@@ -350,7 +350,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* @see WarningDirectionEnum
*/
override fun showWarning(direction: WarningDirectionEnum) {
flV2XWarningView.showWarning(direction)
flV2XWarningView?.showWarning(direction)
}
/**
@@ -360,7 +360,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* @param closeTime 倒计时
*/
override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
flV2XWarningView.showWarning(direction, closeTime)
flV2XWarningView?.showWarning(direction, closeTime)
}
/**
@@ -369,7 +369,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
*/
override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData?) {
ThreadUtils.runOnUiThread {
activity.let {
activity?.let {
val noticeBannerView = this.context?.let { it1 -> NoticeBannerView(it1) }
noticeBannerView?.refreshWithData(trafficStylePushData)
mNoticeFloat = it?.let { it1 ->
@@ -418,10 +418,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
override fun showNoticeNormalData(normalData: NoticeNormalData?) {
ThreadUtils.runOnUiThread {
activity.let {
activity?.let {
val noticeBannerView = this.context?.let { it1 -> NoticeNormalBannerView(it1) }
noticeBannerView?.setPushData(normalData)
mNoticeFloat = it?.let { it1 ->
mNoticeFloat = it.let { it1 ->
noticeBannerView?.let { it2 ->
WarningFloat.with(it1)
.setTag(tag)
@@ -433,8 +433,8 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
.addWarningStatusListener(object : IMoGoWarningStatusListener {
override fun onShow() {
// 创建弹窗成功才进行TTS播报
// AIAssist.getInstance(activity)
// .speakTTSVoice("")
// AIAssist.getInstance(activity)
// .speakTTSVoice("")
}
})
.setAnimator(object : DefaultAnimator() {