修复因为工控机数据通道过早建立连接导致渲染崩溃问题

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-01-05 17:05:05 +08:00
parent c8ab0ae124
commit 88fb409a39
9 changed files with 41 additions and 41 deletions

View File

@@ -329,7 +329,8 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider"));
// 超视距,路测、行车记录仪监控
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AI_MONITORING, "IMoGoMonitoringProvider"));
// 云公告发布
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AI_NOTICE, "IMoGoNoticeProvider"));
// V2X 模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_MODULE, "V2XProvider"));
@@ -345,8 +346,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING, "IV2XManagerProvider"));
// 全局语音唤醒
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake"));
// 云公告发布
MogoModulePaths.addModuleFunction(new MogoModule(MogoServicePaths.PATH_AI_NOTICE, "IMoGoNoticeProvider"));
if (!DebugConfig.isLauncher()) {
PersistentManager.getInstance().initManager(this);

View File

@@ -36,7 +36,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.function.smp.utils.MapAssetStyleUtils;
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.utils.DrivingDirectionUtils;
import com.mogo.utils.logger.Logger;
@@ -100,20 +99,6 @@ public class SmallMapDirectionView
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
setOnLongClickListener(view -> {
MogoApisHandler.getInstance().getApis()
.getMapServiceApi()
.getMapUIController()
.changeMapMode(
MogoApisHandler.getInstance()
.getApis()
.getAdasControllerApi()
.getCurrentSkinMode()
);
return false;
});
}
@Override

View File

@@ -41,7 +41,7 @@ class TrafficLightNetWorkModel {
}
onSuccess {
if (it?.result != null) {
if (it.result.rsCrossId.isNotEmpty() && !it.result.rectLatLngs.isNullOrEmpty()) {
if (!it.result.rsCrossId.isNullOrEmpty() && !it.result.rectLatLngs.isNullOrEmpty()) {
onSuccess.invoke(it.result)
} else {
onError.invoke("requestRoadID result rsCrossId is null")

View File

@@ -15,4 +15,11 @@ object HdMapBuildConfig {
@JvmField
var currentCarVrIconRes = R.raw.chuzuche
/**
* 地图是否加载成功
* false-没有。true-成功
*/
@JvmField
var isMapLoaded = false
}

View File

@@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
@@ -65,11 +66,11 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?) {
//LogUtils.dTag(TAG, "$trafficData")
// Logger.d(TAG, "$trafficData")
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
// Logger.d(TAG, "tag:$tag listener:$listener")
listener.onAutopilotIdentifyDataUpdate(trafficData)
}
}
@@ -79,11 +80,11 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) {
//LogUtils.dTag(TAG, "$autopilotWarnMessage")
// Logger.d(TAG, "$autopilotWarnMessage")
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
// Logger.d(TAG, "tag:$tag listener:$listener")
listener.onAutopilotWarnMessage(autopilotWarnMessage)
}
}

View File

@@ -347,19 +347,22 @@ public class AMapViewWrapper implements IMogoMapView,
if (ui == null) {
return;
}
// TODO 这里临时修改关闭2D
Logger.d(TAG, "设置的样式 = %s", ui);
if (checkAMapView()) {
switch (ui) {
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
// TODO 这里临时修改关闭2D
// switch (ui) {
// case CarUp_2D:
// case CarUp_3D:
// case NorthUP_2D:
// setUIMode(ui);
// break;
case Type_VR:
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
return;
// case Type_VR:
// mMapView.getMapAutoViewHelper().setScaleVRMode(true);
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
// return;
// case Type_Light:
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY);
@@ -373,7 +376,7 @@ public class AMapViewWrapper implements IMogoMapView,
// case Type_AUTO_LIGHT_Night:
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(true);
// break;
}
// }
}
}
@@ -888,11 +891,13 @@ public class AMapViewWrapper implements IMogoMapView,
// @Override
// public void onMapInit() {
// Logger.i(TAG, "autoop--onMapInit: ");
// HdMapBuildConfig.isMapLoaded = true;
// MogoMapListenerHandler.getInstance().onMapLoaded();
// }
@Override
public void onMapLoaded() {
Logger.i(TAG, "autoop--onMapLoaded: ");
MapAutoApi.INSTANCE.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true); //修改自车模型,未来需区分车的类型
//mMapView.getMapAutoViewHelper().setRenderFrequency(true, 50);// 地图刷新频率

View File

@@ -9,6 +9,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
@@ -46,8 +47,10 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onRectData(RectInfo rectInfo) {
ArrayList<TrafficData> recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
if (HdMapBuildConfig.isMapLoaded) {
ArrayList<TrafficData> recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
}
}

View File

@@ -18,7 +18,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.BaseFragment;
@@ -221,13 +220,11 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
MogoModulesManager.getInstance().init(this);
if (DebugConfig.isMapBased()) {
if (mServiceApis.getMapServiceApi() != null) {
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostNaviListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostAimlessModeListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener(EventDispatchCenter.getInstance());
}
if (mServiceApis.getMapServiceApi() != null) {
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostNaviListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostAimlessModeListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener(EventDispatchCenter.getInstance());
}
initAdasControlStatusListener();
@@ -242,11 +239,11 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
@Override
public void run() {
loadOthersModules();
loadFunctionFragment();
}
}, 1000);
Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
});
loadFunctionFragment();
loadFunctionMapView();
} else {
loadOthersModules();

View File

@@ -8,6 +8,7 @@ import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -44,10 +45,12 @@ class MogoMainService extends Service implements IMogoLocationListener {
mServiceApis = MogoApisHandler.getInstance().getApis();
initAndStartLocation();
UiThreadHandler.postDelayed(() -> {
Logger.d(TAG, "4秒已过启动基础服务……");
loadBaseModules();
startTanluService();
initADAS();
initGpsSimulatorListener();
HdMapBuildConfig.isMapLoaded = true;
}, 4_000L
);
// 开启延时检测