add chain log of startAutopilot(bus and taxi), add new func of upload map log:

This commit is contained in:
zhongchao
2022-05-12 19:21:50 +08:00
parent 629cefa455
commit 26b6066393
18 changed files with 244 additions and 62 deletions

View File

@@ -22,6 +22,8 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
@@ -31,6 +33,7 @@ import com.mogo.eagle.core.data.map.MapRoadInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager;
import com.mogo.eagle.core.function.call.map.CallerMapDevaListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
@@ -60,6 +63,7 @@ import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapViewVisualAngleChangeListener;
import com.zhidaoauto.map.sdk.open.abs.OnRoadInfoListener;
import com.zhidaoauto.map.sdk.open.abs.log.ILog;
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
@@ -96,7 +100,7 @@ public class AMapViewWrapper implements IMogoMapView,
OnMarkClickListener,
OnMapStyleListener,
OnMapViewVisualAngleChangeListener,
OnRoadInfoListener {
OnRoadInfoListener, ILog {
private static final String TAG = "AMapViewWrapper";
private final MapAutoView mMapView;
@@ -116,7 +120,7 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mIsDelayed = false;
public AMapViewWrapper(MapAutoView mMapView) {
CallerLogger.INSTANCE.i(M_MAP+TAG, "autoop--AMapViewWrapper: init");
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
initViews();
initListeners();
@@ -183,17 +187,18 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnMapStyleListener(this);
mMapView.setOnMapViewVisualAngleChangeListener(this);
mMapView.setOnRoadInfoListener(this, 1);
CallerLogger.INSTANCE.d(M_MAP+TAG, "styleop - initListeners - setOnMapStyleListener - view " + mMapView);
MapAutoApi.INSTANCE.registerLogListener(this);
CallerLogger.INSTANCE.d(M_MAP + TAG, "styleop - initListeners - setOnMapStyleListener - view " + mMapView);
}
@Override
public void onRoadIdInfo(@androidx.annotation.Nullable String roadId) {
if (roadId != null && !TextUtils.isEmpty(roadId)) {
CallerLogger.INSTANCE.d(M_MAP+TAG, "onRoadIdInfo::" + roadId);
CallerLogger.INSTANCE.d(M_MAP + TAG, "onRoadIdInfo::" + roadId);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnRoadIdGet(roadId);
} else {
CallerLogger.INSTANCE.d(M_MAP+TAG, "onRoadIdInfo::null");
CallerLogger.INSTANCE.d(M_MAP + TAG, "onRoadIdInfo::null");
}
}
@@ -211,27 +216,27 @@ public class AMapViewWrapper implements IMogoMapView,
* }
*/
String provider = carLoc.getProvider();
CallerLogger.INSTANCE.d(M_MAP+TAG, "car_loc: " + carLoc + "");
CallerLogger.INSTANCE.d(M_MAP + TAG, "car_loc: " + carLoc + "");
if (!MapAutoApi.GPS_FLAG.equals(provider)) {
CallerLogger.INSTANCE.d(M_MAP+TAG, "convert before: car_loc: {lon: " + carLoc.getLongitude() + ", lat: " + carLoc.getLatitude() + "}");
CallerLogger.INSTANCE.d(M_MAP + TAG, "convert before: car_loc: {lon: " + carLoc.getLongitude() + ", lat: " + carLoc.getLatitude() + "}");
LonLatPoint p = new LonLatPoint(carLoc.getLongitude(), carLoc.getLatitude());
p = MapTools.INSTANCE.switchLonLatWGS84(p);
carLoc.setLongitude(p.longitude);
carLoc.setLatitude(p.latitude);
CallerLogger.INSTANCE.d(M_MAP+TAG, "convert after: car_loc: {lon: " + carLoc.getLongitude() + ", lat: " + carLoc.getLatitude() + "}");
CallerLogger.INSTANCE.d(M_MAP + TAG, "convert after: car_loc: {lon: " + carLoc.getLongitude() + ", lat: " + carLoc.getLatitude() + "}");
}
CallerLogger.INSTANCE.d(M_MAP+TAG, "onStopLineInfo:stop_line" + stopLine + ", car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo:stop_line" + stopLine + ", car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
MapRoadInfo.StopLine stopInfo = convert(stopLine);
LonLatPoint p1 = points.get(0);
LonLatPoint p2 = points.get(points.size() - 1);
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.longitude, p1.latitude, p2.longitude, p2.latitude) * 10_0000;
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
CallerLogger.INSTANCE.d(M_MAP+TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnStopLineGet(stopInfo);
}
} else {
if (carLoc != null) {
CallerLogger.INSTANCE.d(M_MAP+TAG, "onStopLineInfo::null, car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo::null, car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
}
}
}
@@ -279,7 +284,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onCreate(Bundle bundle) {
if (mMapView != null) {
mMapView.onCreate(bundle);
CallerLogger.INSTANCE.d(M_MAP+TAG, "map onCreate");
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onCreate");
}
}
@@ -287,7 +292,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onResume() {
if (mMapView != null) {
mMapView.onResume();
CallerLogger.INSTANCE.d(M_MAP+TAG, "map onResume");
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onResume");
}
}
@@ -295,7 +300,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onPause() {
if (mMapView != null) {
mMapView.onPause();
CallerLogger.INSTANCE.d(M_MAP+TAG, "map onPause");
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onPause");
}
}
@@ -309,7 +314,8 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnMapClickListener(null);
mMapView.getLocationClient().unRegisterListener(this);
mMapView.setOnCameraChangeListener(null);
CallerLogger.INSTANCE.d(M_MAP+TAG, "map onDestroy");
MapAutoApi.INSTANCE.unregisterLogListener(this);
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onDestroy");
}
if (mLocationTask != null) {
@@ -321,7 +327,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onSaveInstanceState(Bundle outState) {
if (mMapView != null) {
mMapView.onSaveInstanceState(outState);
CallerLogger.INSTANCE.d(M_MAP+TAG, "map onSaveInstanceState");
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onSaveInstanceState");
}
}
@@ -335,9 +341,9 @@ public class AMapViewWrapper implements IMogoMapView,
if (isVrMold()) {
return MapControlResult.ERROR;
}
CallerLogger.INSTANCE.d(M_MAP+TAG, "changeZoom : " + zoom);
CallerLogger.INSTANCE.d(M_MAP + TAG, "changeZoom : " + zoom);
if (DebugConfig.isDebug()) {
CallerLogger.INSTANCE.d(M_MAP+TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(M_MAP + TAG, Log.getStackTraceString(new Throwable()));
}
getMap().changeZoom(zoom);
return MapControlResult.SUCCESS;
@@ -351,7 +357,7 @@ public class AMapViewWrapper implements IMogoMapView,
mVisualAngleMode = angelMode;
if (angelMode == MODE_CLOSE_SIGHT) {
if (mogoLatLng == null) {
CallerLogger.INSTANCE.e(M_MAP+TAG, "切换地图近景需要传入要移动的经纬度数据");
CallerLogger.INSTANCE.e(M_MAP + TAG, "切换地图近景需要传入要移动的经纬度数据");
return;
}
// 近景传入经纬度为点击地图上静态marker经纬度数据为GPS坐标点。
@@ -374,7 +380,7 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean checkAMapView() {
if (mMapView == null || mMapView.getMapAutoViewHelper() == null) {
CallerLogger.INSTANCE.e(M_MAP+TAG, "自研mapView实例为空请检查");
CallerLogger.INSTANCE.e(M_MAP + TAG, "自研mapView实例为空请检查");
return false;
}
return true;
@@ -382,20 +388,20 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter(MogoLatLng latLng, boolean animate) {
CallerLogger.INSTANCE.d(M_MAP+TAG, "move to center " + latLng);
CallerLogger.INSTANCE.d(M_MAP + TAG, "move to center " + latLng);
if (latLng == null || latLng.lat == 0.0d || latLng.lon == 0.0d) {
CallerLogger.INSTANCE.e(M_MAP+TAG, "latlng = null or is illegal");
CallerLogger.INSTANCE.e(M_MAP + TAG, "latlng = null or is illegal");
return;
}
if (DebugConfig.isDebug()) {
CallerLogger.INSTANCE.d(M_MAP+TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(M_MAP + TAG, Log.getStackTraceString(new Throwable()));
}
mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat));
}
@Override
public void showMyLocation(boolean visible) {
CallerLogger.INSTANCE.d(M_MAP+TAG, "showMyLocation1 " + visible);
CallerLogger.INSTANCE.d(M_MAP + TAG, "showMyLocation1 " + visible);
// 如果是VR模式
if (isVrMold()) {
return;
@@ -418,7 +424,7 @@ public class AMapViewWrapper implements IMogoMapView,
*/
private boolean isVrMold() {
boolean isVrMode = mCurrentUI == EnumMapUI.MAP_STYLE_NIGHT_VR || mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR;
CallerLogger.INSTANCE.d(M_MAP+TAG, "是否是VR模式: " + isVrMode);
CallerLogger.INSTANCE.d(M_MAP + TAG, "是否是VR模式: " + isVrMode);
return isVrMode;
}
@@ -431,14 +437,14 @@ public class AMapViewWrapper implements IMogoMapView,
boolean isDayMode = mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR
|| mCurrentUI == EnumMapUI.MAP_STYLE_DAY
|| mCurrentUI == EnumMapUI.MAP_STYLE_DAY_NAV;
CallerLogger.INSTANCE.d(M_MAP+TAG, "是否是白天模式: " + isDayMode);
CallerLogger.INSTANCE.d(M_MAP + TAG, "是否是白天模式: " + isDayMode);
return isDayMode;
}
@Override
public void showMyLocation(View view) {
if (DebugConfig.isDebug()) {
CallerLogger.INSTANCE.d(M_MAP+TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(M_MAP + TAG, Log.getStackTraceString(new Throwable()));
}
if (checkAMapView()) {
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
@@ -507,7 +513,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (isVrMold()) {
return;
}
CallerLogger.INSTANCE.d(M_MAP+TAG, "setPointToCenter x : " + mapCenterX + " y : " + mapCenterY);
CallerLogger.INSTANCE.d(M_MAP + TAG, "setPointToCenter x : " + mapCenterX + " y : " + mapCenterY);
mMapView.getMapAutoViewHelper().setPointToCenter((float) mapCenterX, (float) mapCenterY);
}
}
@@ -544,7 +550,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (checkAMapView()) {
if (mMapView.getMapAutoViewHelper() != null) {
mMapView.getMapAutoViewHelper().setRenderFps(fps);
CallerLogger.INSTANCE.d(M_MAP+TAG, "设置刷新帧率 fps = " + fps);
CallerLogger.INSTANCE.d(M_MAP + TAG, "设置刷新帧率 fps = " + fps);
}
}
}
@@ -555,16 +561,16 @@ public class AMapViewWrapper implements IMogoMapView,
return;
}
if (isVrMold()) {
CallerLogger.INSTANCE.w(M_MAP+TAG, "vr 模式下忽略该设置");
CallerLogger.INSTANCE.w(M_MAP + TAG, "vr 模式下忽略该设置");
return;
}
CallerLogger.INSTANCE.i(M_MAP+TAG, "showBounds : " + M_MAP+TAG + " , " + carPosition.toString() + " , " + bound.toShortString() + " , " + lockCarPosition);
CallerLogger.INSTANCE.i(M_MAP + TAG, "showBounds : " + M_MAP + TAG + " , " + carPosition.toString() + " , " + bound.toShortString() + " , " + lockCarPosition);
try {
LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds(carPosition, lonLats, lockCarPosition);
mMapView.getMapAutoViewHelper().setCenter(ObjectUtils.fromMogo(carPosition));
mMapView.getMapAutoViewHelper().moveCamera(CameraUpdateFactory.INSTANCE.newLatLngBounds(latLngBounds, bound.left, bound.right, bound.top, bound.bottom));
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAP+TAG, "M_MAP+TAG : " + M_MAP+TAG + " error : " + e);
CallerLogger.INSTANCE.e(M_MAP + TAG, "M_MAP+TAG : " + M_MAP + TAG + " error : " + e);
}
}
@@ -672,6 +678,11 @@ public class AMapViewWrapper implements IMogoMapView,
return ObjectUtils.transformCenterLine(MapDataApi.INSTANCE.getCenterLineInfo(lon, lat, angle));
}
@Override
public void result(@NonNull String filePath) {
CallerMapDevaListenerManager.INSTANCE.invokeUploadLogFile(filePath);
}
private static class LocationTask implements Runnable {
private MogoLocation location;
@@ -698,7 +709,7 @@ public class AMapViewWrapper implements IMogoMapView,
MogoLocation currentLocation = ObjectUtils.fromLocation(location);
if (Looper.myLooper() == Looper.getMainLooper()) {
CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(currentLocation, 1);
} else {
} else {
if (mLocationTask == null) {
mLocationTask = new LocationTask();
}
@@ -742,7 +753,7 @@ public class AMapViewWrapper implements IMogoMapView,
} else {
mIsFirstLocated = true;
mIsDelayed = false;
CallerLogger.INSTANCE.d(M_MAP+TAG, "同步定位:" + GsonUtils.toJson(location));
CallerLogger.INSTANCE.d(M_MAP + TAG, "同步定位:" + GsonUtils.toJson(location));
}
}
}
@@ -755,13 +766,13 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapInit() {
CallerLogger.INSTANCE.i(M_MAP+TAG, "autoop--onMapInit: ");
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapInit: ");
MogoMapListenerHandler.getInstance().onMapLoaded();
}
@Override
public void onMapLoaded() {
CallerLogger.INSTANCE.i(M_MAP+TAG, "autoop--onMapLoaded: ");
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapLoaded: ");
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
Trace.beginSection("timer.onCameraChangeFinish");
@@ -788,7 +799,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onRoadLoaded(@Nullable String s) {
CallerLogger.INSTANCE.i(M_MAP+TAG, "autoop--onMapLoaded: ");
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapLoaded: ");
}
@@ -799,7 +810,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapViewVisualAngleChange(int i) {
CallerLogger.INSTANCE.d(M_MAP+TAG, " 地图自动更改视距 currentThread : " + Thread.currentThread().getName());
CallerLogger.INSTANCE.d(M_MAP + TAG, " 地图自动更改视距 currentThread : " + Thread.currentThread().getName());
mVisualAngleMode = getVisualAngleMode(i);
MogoMapListenerHandler.getInstance().onMapVisualAngleChanged(mVisualAngleMode);
}
@@ -849,8 +860,8 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onChangeMapStyle(int styleId) {
CallerLogger.INSTANCE.d(M_MAP+TAG, "currentMapStyle = " + styleId);
CallerLogger.INSTANCE.d(M_MAP+TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(M_MAP + TAG, "currentMapStyle = " + styleId);
CallerLogger.INSTANCE.d(M_MAP + TAG, Log.getStackTraceString(new Throwable()));
// 映射地图样式ID到鹰眼样式ID
if (styleId == MapAutoApi.MAP_STYLE_DAY
@@ -871,7 +882,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (mCurrentUI != null) {
UiThreadHandler.post(() -> {
try {
CallerLogger.INSTANCE.d(M_MAP+TAG, "currentUI = " + mCurrentUI);
CallerLogger.INSTANCE.d(M_MAP + TAG, "currentUI = " + mCurrentUI);
MogoMapListenerHandler.getInstance().onMapModeChanged(mCurrentUI);
CallerMapStyleListenerManager.INSTANCE.invokeMapStyleChange(styleId);
} catch (Exception e) {
@@ -891,7 +902,7 @@ public class AMapViewWrapper implements IMogoMapView,
TipToast.shortTip(mRtkEnable ? "已开启rtk道路匹配" : "已开启gps道路匹配");
mMapView.getLocationClient().rtkEnable(mRtkEnable);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAP+TAG, "rtkEnable has exception : " + e);
CallerLogger.INSTANCE.e(M_MAP + TAG, "rtkEnable has exception : " + e);
}
}
@@ -901,7 +912,7 @@ public class AMapViewWrapper implements IMogoMapView,
return;
}
if (data == null) {
CallerLogger.INSTANCE.d(M_MAP+TAG, "停止使用rtk定位数据");
CallerLogger.INSTANCE.d(M_MAP + TAG, "停止使用rtk定位数据");
return;
}
double lon = data.optDouble("lon", -1);
@@ -1001,7 +1012,7 @@ public class AMapViewWrapper implements IMogoMapView,
* 加载3D模型
*/
private void loadPreVehicleModel() {
CallerLogger.INSTANCE.d(M_MAP+TAG, "添加感知模型到地图中……");
CallerLogger.INSTANCE.d(M_MAP + TAG, "添加感知模型到地图中……");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
@@ -1038,11 +1049,11 @@ public class AMapViewWrapper implements IMogoMapView,
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DNightIconId());
}
CallerLogger.INSTANCE.d(M_MAP+TAG, logMsg + preVehicleStrWeiZhi);
CallerLogger.INSTANCE.d(M_MAP + TAG, logMsg + preVehicleStrWeiZhi);
if (preVehicleStrWeiZhi == null) {
UiThreadHandler.postDelayed(() -> {
CallerLogger.INSTANCE.w(M_MAP+TAG, "添加感知模型到地图中失败,尝试重复添加……");
CallerLogger.INSTANCE.w(M_MAP + TAG, "添加感知模型到地图中失败,尝试重复添加……");
addPreVehicleModelWeiZhi(typeTrafficId, logMsg);
}, 1000L);
}