增加初始化延时,增加稳定性

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-01-05 18:28:43 +08:00
parent 88fb409a39
commit 57dbfbba3e
4 changed files with 8 additions and 90 deletions

View File

@@ -340,12 +340,12 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, PushUIConstants.NAME));
// 碰撞报警模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING, "IMogoCrashWarnProvider"));
// ADAS模块慢慢被 域控制器模块 替换掉)
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
// 前方碰撞预警
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING, "IV2XManagerProvider"));
// 全局语音唤醒
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake"));
// ADAS模块慢慢被 域控制器模块 替换掉)
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
if (!DebugConfig.isLauncher()) {
PersistentManager.getInstance().initManager(this);

View File

@@ -5,19 +5,14 @@ import static com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT;
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.location.Location;
import android.os.Bundle;
import android.os.Trace;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
@@ -113,7 +108,6 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mMapLoaded = false;
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
private Marker mSelfMarker;
public AMapViewWrapper(MapAutoView mMapView) {
startTime = System.currentTimeMillis();
@@ -274,7 +268,6 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnMapClickListener(null);
mMapView.getLocationClient().unRegisterListener(this);
mMapView.setOnCameraChangeListener(null);
mSelfMarker = null;
Logger.d(TAG, "map onDestroy");
}
}
@@ -798,85 +791,6 @@ public class AMapViewWrapper implements IMogoMapView,
MapStyleController.getInstance().onLocationChanged(location, this);
}
}
if (mSelfMarker == null) {
try {
mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker();
mSelfMarker.setInfoWindowEnable(true);
} catch (Exception e) {
e.printStackTrace();
}
} else {
// 通过不同的方向类型来改变车模目前暂定三种模型drawlevel 1 绿,2 黄,3 红,绿色的时候需要把相应的切换为默认模型
// Logger.d("liyz", " mDrawlevel = " + mDrawlevel);
// if (mDrawlevel == 1 && isShowWarn) {
// mSelfMarker.marker3DIcon(R.raw.car);
// isShowWarn = false;
// } else if (mDrawlevel == 2) { //不处理
//
// } else if (mDrawlevel == 3 && !isShowWarn) {
// //继续判断相应的方位,目前是只有 前方 TODO
// mSelfMarker.marker3DIcon(R.raw.qfpz);
// isShowWarn = true;
// }
//
// UiThreadHandler.postDelayed(() -> {
// if (!isShowWarn) {
// mSelfMarker.marker3DIcon(R.raw.qfpz);
// isShowWarn = true;
// }
// }, 6_000L);
}
//showSelfSpeed(location.getSpeed());
}
private TextView mSpeedView = null;
private int mLastYOffset = 20;
private void showSelfSpeed(float speed) {
if (!checkAMapView()) {
return;
}
if (mSelfMarker == null) {
return;
}
if (mCurrentUI != EnumMapUI.Type_VR) {
mSelfMarker.hideInfoWindow();
return;
}
int speedIntVal = (int) (speed * 3.6);
if (speedIntVal <= 0) {
mSelfMarker.hideInfoWindow();
return;
}
String speedVal = String.valueOf(speedIntVal);
String infoResName = ResIdCache.getVal(speedVal);
int offset = 20;
if (!mMapView.getMapAutoViewHelper().getLockMode()) {
offset = 30;
}
if (offset != mLastYOffset) {
mLastYOffset = offset;
}
mSelfMarker.setInfoWindowOffset(0, offset);
if (TextUtils.isEmpty(infoResName)) {
if (mSpeedView == null) {
mSpeedView = new TextView(mMapView.getContext());
mSpeedView.setTextColor(Color.WHITE);
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
mSpeedView.setText(speedVal);
mSelfMarker.setInfoWindowView(mSpeedView);
ResIdCache.putVal(speedVal, mSelfMarker.getMarkeOptions().getMarkerInfoName());
} else {
mSelfMarker.setMarkerInfoName(infoResName);
}
}
@Override

View File

@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.main">
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<application>
<service
android:name=".service.MogoMainService"

View File

@@ -27,6 +27,8 @@ import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
import com.mogo.eagle.core.utilcode.util.AppUtils;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.MogoApisHandler;
@@ -241,7 +243,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
loadOthersModules();
loadFunctionFragment();
}
}, 1000);
}, 3000);
Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
});
loadFunctionMapView();
@@ -288,7 +290,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
// 启动一些基本的服务:定位等
startBaseService();
}
private void initAdasControlStatusListener() {
@@ -318,6 +319,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
@Override
public void loadFunctionFragment() {
Logger.d(TAG,"loadFunctionFragment……");
// 加载 HMI 图层
BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation();
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment);
@@ -457,6 +459,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
SchemeIntent.getInstance().clear();
FloatingViewHandler.clear();
mServiceApis.getShareManager().releaseContext();
ProcessUtils.killAllBackgroundProcesses();
}
@Override