From d1cd2a0c3f5bfa449fd8cd0fb25d509627e9c16e Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 7 Mar 2023 19:03:23 +0800 Subject: [PATCH] [2.13.0-arch-opt] Volatile --- .../passenger/model/TaxiPassengerModel.java | 7 ++- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 3 -- .../datacenter/v2x/TrafficLightDispatcher.kt | 2 + .../report/IPCReportManager.kt | 45 ++++++++++--------- .../hmi/ui/setting/DebugSettingView.kt | 1 + .../function/hmi/ui/widget/SpeedPanelView.kt | 1 + .../business/SpeedLimitDataManager.java | 2 +- 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java index bfef8a0271..daaf6b231c 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java @@ -117,8 +117,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback private IOCHTaxiPassengerADASStatusCallback mADASStatusCallback; //Model->Presenter:自动驾驶状态相关 private IOCHTaxiPassengerAutopilotPlanningCallback mAutopilotPlanningCallback; //Model->Presenter:自动驾驶线路规划 - private Map mOrderStatusCallbackMap = new ConcurrentHashMap<>(); - private Map mControllerStatusCallbackMap = new ConcurrentHashMap<>(); + private final Map mOrderStatusCallbackMap = new ConcurrentHashMap<>(); + private final Map mControllerStatusCallbackMap = new ConcurrentHashMap<>(); private ITaxiPassengerVeloctityCallback mVeloctityCallback;//道路限速返回 @@ -130,7 +130,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback private double mLongitude, mLatitude; private MogoLocation mLocation = null; - private List mLocationsModels = new ArrayList<>(); + private final List mLocationsModels = new ArrayList<>(); private TaxiPassengerModel() { } @@ -517,7 +517,6 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback @Override public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) { - if (autopilotStatusInfo == null) return; int state = autopilotStatusInfo.getState(); // CallerLogger.INSTANCE.d( M_TAXI_P + TAG, "state = %s", state ); if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index dfcd3dd961..85b14a2962 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -134,8 +134,6 @@ class MoGoAdasListenerImpl : OnAdasListener { if (gnssInfo != null) { if (1 == FunctionBuildConfig.gpsProvider) { - // 同步给MAP地图 - //CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(gnssInfo) // 同步更新经纬度和系统时间至 AutoPilotStatusListener CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon( gnssInfo.satelliteTime, @@ -146,7 +144,6 @@ class MoGoAdasListenerImpl : OnAdasListener { } } - /** * 老底盘信息,透传底盘状态,pb参考底盘 * TODO 目前由于M1车型不会在新底盘PB添加新的字段 所以临时保留 diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt index 521aa5c3a4..4112baf491 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt @@ -50,9 +50,11 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight private var mContext: Context? = null //是否有AI获取红绿灯灯态 + @Volatile private var hasAiLightStatus: Boolean = false //obu数据 + @Volatile private var hasObuLightStatus: Boolean = false fun initServer(context: Context) { diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/report/IPCReportManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/report/IPCReportManager.kt index d9a7997639..d338f02da8 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/report/IPCReportManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/report/IPCReportManager.kt @@ -10,6 +10,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils +import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.TimeUtils import mogo_msg.MogoReportMsg @@ -69,29 +70,30 @@ class IPCReportManager : IMoGoAutopilotStatusListener { *工控机监控节点上报 */ override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) { - guardianInfo?.let{ - if(it.resultList.contains(RESULT_AUTOPILOT_DISABLE) - || it.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED) - || it.resultList.contains(RESULT_REMOTEPILOT_DISABLE) - || it.resultList.contains(RESULT_AUTOPILOT_INFERIOR) - || it.resultList.contains(RESULT_SHOW_WARNING) - || it.resultList.contains(RESULT_REMOTEPILOT_INFERIOR)){ - val reportEntity = ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()), - it.src,it.level,it.msg,it.code,it.resultList,it.actionsList) - CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.REPORT, reportEntity)) - } + ThreadUtils.runOnUiThread { + guardianInfo?.let{ + if(it.resultList.contains(RESULT_AUTOPILOT_DISABLE) + || it.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED) + || it.resultList.contains(RESULT_REMOTEPILOT_DISABLE) + || it.resultList.contains(RESULT_AUTOPILOT_INFERIOR) + || it.resultList.contains(RESULT_SHOW_WARNING) + || it.resultList.contains(RESULT_REMOTEPILOT_INFERIOR)){ + val reportEntity = ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()), + it.src,it.level,it.msg,it.code,it.resultList,it.actionsList) + CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.REPORT, reportEntity)) + } - if (reportList.size > 49) { - reportList.removeLast() - } - reportList.add( - 0, - ReportEntity( - TimeUtils.millis2String(System.currentTimeMillis()), - it.src, it.level, it.msg, it.code, it.resultList, it.actionsList + if (reportList.size > 49) { + reportList.removeLast() + } + reportList.add( + 0, + ReportEntity( + TimeUtils.millis2String(System.currentTimeMillis()), + it.src, it.level, it.msg, it.code, it.resultList, it.actionsList + ) ) - ) - reportListFloatWindow?.refreshData(reportList) + reportListFloatWindow?.refreshData(reportList) // //Error 弹窗并有提示音 // if(it.resultList.contains(RESULT_AUTOPILOT_DISABLE) @@ -128,6 +130,7 @@ class IPCReportManager : IMoGoAutopilotStatusListener { // } // } // } + } } } 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 d855300e60..fac708c747 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 @@ -117,6 +117,7 @@ internal class DebugSettingView @JvmOverloads constructor( private var logInfoView: LogInfoView? = null private var logViewAttach = false + @Volatile private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null private var mGnssInfo: MogoLocation? = null diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt index b7f531c972..325c33de50 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt @@ -27,6 +27,7 @@ class SpeedPanelView @JvmOverloads constructor( var mContext: Context var mSpeedChartView: SpeedChartView + @Volatile var mLatLng: MogoLocation? = null init { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java index 60c7d0eba3..7d77a80af3 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/SpeedLimitDataManager.java @@ -23,7 +23,7 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener private final static String TAG = "SpeedLimitDataManager"; private static volatile SpeedLimitDataManager instance; - private MogoLocation mLocation; + private volatile MogoLocation mLocation; private SpeedLimitDataManager() { }