Merge remote-tracking branch 'origin/dev_robotaxi-d_230612_3.3.0' into dev_robotaxi-d_230612_3.3.0
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.mogo.eagle.function.biz.v2x
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
@@ -17,9 +16,7 @@ class V2XBizTrace {
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
fun onAck(data: Any, data1: Any) {
|
||||
if (DebugConfig.isDebug()) {
|
||||
CallerLogger.d("$M_V2X${data.toString()}", data1)
|
||||
}
|
||||
CallerLogger.d("$M_V2X${data.toString()}", data1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
return
|
||||
}
|
||||
}
|
||||
CallerLogger.d("$M_V2X$TAG", "poiType : $poiType , 触发道路事件")
|
||||
V2XBizTrace.onAck("$M_V2X$TAG","poiType : $poiType , 触发道路事件")
|
||||
CallerHmiManager.warningV2X(
|
||||
poiType,
|
||||
tts,
|
||||
|
||||
@@ -76,6 +76,7 @@ internal object V2NIdentifyDrawer {
|
||||
val distance = CoordinateUtils.calculateLineDistance(itx.longitude, itx.latitude, car.longitude, car.latitude)
|
||||
val alertContent = getAlertContent(poiType, distance.toDouble())
|
||||
val ttsContent = getTtsContent(poiType, distance.toDouble())
|
||||
V2XBizTrace.onAck("V2NIdentifyDrawer","绘制poi事件:$poiType")
|
||||
saveMsgBox(MsgBoxBean(V2X, V2XMsg(poiType, alertContent, ttsContent)))
|
||||
CallerHmiManager.warningV2X(poiType, alertContent, ttsContent, object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.graphics.Color
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.core.util.Pair
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
@@ -83,7 +82,6 @@ class AiRoadMarker {
|
||||
marker.entity?.apply { roadMarker.drawMarkers(this, wrapper) }
|
||||
}
|
||||
if (drawRoadLine) {
|
||||
Log.d(TAG, "--- marker --- 1 ---")
|
||||
//施工中心点前方的自车行驶方向上300米距离
|
||||
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(
|
||||
marker.poi_lon,
|
||||
@@ -92,7 +90,6 @@ class AiRoadMarker {
|
||||
300f
|
||||
)
|
||||
//施工中心点后方的自车行驶方向上300米距离
|
||||
Log.d(TAG, "--- marker --- 3 --- l1:$l1")
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", l1)
|
||||
val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(
|
||||
marker.poi_lon,
|
||||
@@ -101,11 +98,9 @@ class AiRoadMarker {
|
||||
-300f
|
||||
)
|
||||
if (l1.points.isEmpty() || l2.points.isEmpty()) {
|
||||
Log.d(TAG, " --- marker --- 3 --- return ----")
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 3 --- return ----", "")
|
||||
return@post
|
||||
}
|
||||
Log.d(TAG, " --- marker --- 4 --- l2: $l2")
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 4 --- l2:", l2)
|
||||
val points = LinkedList<MogoLatLng>()
|
||||
if (l2 != null && l2.points.isNotEmpty()) {
|
||||
@@ -115,7 +110,6 @@ class AiRoadMarker {
|
||||
}
|
||||
val centerX = marker.poi_lon
|
||||
val centerY = marker.poi_lat
|
||||
Log.d(TAG, "--- marker --- 5 --- marker: $marker")
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 5 --- marker:", marker)
|
||||
val farthestPoint = marker.polygon?.let {
|
||||
var find: Pair<Double, Double> = Pair(centerX, centerY)
|
||||
@@ -136,7 +130,6 @@ class AiRoadMarker {
|
||||
MogoLatLng(find.second, find.first)
|
||||
} ?: MogoLatLng(centerY, centerX)
|
||||
marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat)
|
||||
Log.d(TAG, "--- marker --- 6 --- marker:$marker")
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 6 --- marker:", marker)
|
||||
if (l1 != null && l1.points.isNotEmpty()) {
|
||||
for (l in l1.points) {
|
||||
@@ -169,7 +162,6 @@ class AiRoadMarker {
|
||||
builder.points(points)
|
||||
builder.colors(colors)
|
||||
builder.setVisible(true)
|
||||
Log.d(TAG, "--- marker --- 7 --- points:${points.size}")
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 7 --- points:", "${points.size}")
|
||||
val line = overlayManager?.showOrUpdateLine(builder.build())
|
||||
if (line != null) {
|
||||
@@ -186,10 +178,8 @@ class AiRoadMarker {
|
||||
|
||||
private fun removeLine() {
|
||||
val old = line.get()
|
||||
Log.d(TAG, " --- removeRedLine --- 1")
|
||||
V2XBizTrace.onAck("$TAG --- removeRedLine --- 1", "")
|
||||
if (old != null) {
|
||||
Log.d(TAG,"--- removeRedLine --- 2")
|
||||
V2XBizTrace.onAck("$TAG --- removeRedLine --- 2", "")
|
||||
line.set(null)
|
||||
old.delegate?.remove()
|
||||
@@ -198,7 +188,6 @@ class AiRoadMarker {
|
||||
|
||||
private fun unMarker(marker: Marker) {
|
||||
v2nDrawHandler.post {
|
||||
Log.d(TAG,"$TAG --- unMarker ---")
|
||||
V2XBizTrace.onAck("$TAG --- unMarker ---", "")
|
||||
this.marker.set(null)
|
||||
removeLine()
|
||||
@@ -209,13 +198,11 @@ class AiRoadMarker {
|
||||
}
|
||||
|
||||
fun receive() {
|
||||
Log.d(TAG, " --- receive --- 1 ---")
|
||||
V2XBizTrace.onAck("$TAG --- receive --- 1 ---", "")
|
||||
val poi = this.marker.get()
|
||||
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
if (poi != null) {
|
||||
val distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, poi.poi_lon, poi.poi_lat)
|
||||
Log.d(TAG ," --- receive --- 2 ---car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance")
|
||||
V2XBizTrace.onAck(
|
||||
"$TAG --- receive --- 2 ---",
|
||||
"car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance"
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
|
||||
import com.mogo.eagle.function.biz.v2x.V2XBizTrace;
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.scenario.view.IV2XMarker;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
@@ -44,7 +45,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
@Override
|
||||
public void init(V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
|
||||
try {
|
||||
Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
V2XBizTrace.Companion.onAck("v2XMessageEntity",GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
|
||||
if (v2XRoadEventEntity != null) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
|
||||
@@ -41,22 +41,23 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
bizLog(SceneConstant.M_D_C + TAG, "自动驾驶状态变化:$state")
|
||||
createSubscribe?.let {
|
||||
if (!it.isDisposed) {
|
||||
bizLog(SceneConstant.M_D_C + TAG, "自动驾驶状态变化,取消前置轨迹请求,间隔2s重新请求底盘轨迹")
|
||||
createSubscribe?.dispose()
|
||||
}
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
createSubscribe = Observable.timer(2000L, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
bizLog(SceneConstant.M_D_C + TAG, "请求底盘轨迹")
|
||||
CallerAutoPilotControlManager.getGlobalPath()
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
createSubscribe = Observable.timer(2000L, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
bizLog(SceneConstant.M_D_C + TAG, "请求底盘轨迹")
|
||||
CallerAutoPilotControlManager.getGlobalPath()
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,18 +129,31 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
}
|
||||
alertContent = EventTypeEnumNew.getWarningContent(appId)
|
||||
ttsContent = EventTypeEnumNew.getWarningTts(appId)
|
||||
alertContent = String.format( //事件才有影响范围
|
||||
alertContent,
|
||||
Math.round(rsiWarningData.warningMsgList[0].distance).toString(),
|
||||
Math.round(rsiWarningData.warningMsgList[0].eventRadius).toString()
|
||||
)
|
||||
ttsContent = String.format(
|
||||
ttsContent,
|
||||
ConvertUtils.intToChinese(
|
||||
rsiWarningData.warningMsgList[0].distance.roundToInt()),
|
||||
ConvertUtils.intToChinese(
|
||||
rsiWarningData.warningMsgList[0].eventRadius.roundToInt())
|
||||
)
|
||||
//他车超速行驶
|
||||
if(EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType == appId){
|
||||
//同向正后方、同向邻道左后方、同向邻道右后方 提示他车超速行驶
|
||||
if(rsiWarningData.warningMsgList[0].targetPosition == MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE
|
||||
|| rsiWarningData.warningMsgList[0].targetPosition == MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_LEFT
|
||||
|| rsiWarningData.warningMsgList[0].targetPosition == MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT){
|
||||
alertContent = String.format(alertContent, direction.desc)
|
||||
ttsContent = String.format(ttsContent, direction.desc)
|
||||
}else{
|
||||
return
|
||||
}
|
||||
}else{
|
||||
alertContent = String.format( //事件才有影响范围
|
||||
alertContent,
|
||||
Math.round(rsiWarningData.warningMsgList[0].distance).toString(),
|
||||
Math.round(rsiWarningData.warningMsgList[0].eventRadius).toString()
|
||||
)
|
||||
ttsContent = String.format(
|
||||
ttsContent,
|
||||
ConvertUtils.intToChinese(
|
||||
rsiWarningData.warningMsgList[0].distance.roundToInt()),
|
||||
ConvertUtils.intToChinese(
|
||||
rsiWarningData.warningMsgList[0].eventRadius.roundToInt())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//车内标牌
|
||||
@@ -290,6 +303,10 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
|
||||
}
|
||||
|
||||
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
|
||||
if(EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType == appId){
|
||||
saveObuToDcData(appId, alertContent, ttsContent)
|
||||
showWarning(appId, alertContent, ttsContent, direction)
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
|
||||
@@ -115,7 +115,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
}
|
||||
|
||||
fun setHvInfoSendCycle(time: Int) {
|
||||
ObuManager.getInstance().setHvInfoPushCycle(time);
|
||||
ObuManager.getInstance().setHvInfoPushCycle(time)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,8 +136,8 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
*/
|
||||
fun deleteObuFile() {
|
||||
UiThreadHandler.post {
|
||||
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
|
||||
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
|
||||
val isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
|
||||
val isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}",
|
||||
"deleteObuFile isDeleteSuccess = $isDeleteSuccess ----isDeleteUnzipSuccess = $isDeleteUnzipSuccess"
|
||||
@@ -154,11 +154,11 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
|
||||
/**
|
||||
* 传递obu升级包给硬件
|
||||
* @param upgradePackage 升级包文件绝对路径 只能包含 升级包MD5文件和升级包文件
|
||||
* @param isUpgradeNow 是否立即升级
|
||||
* upgradePackage 升级包文件绝对路径 只能包含 升级包MD5文件和升级包文件
|
||||
* isUpgradeNow 是否立即升级
|
||||
* false:OBU设备下次上电时执行升级程序
|
||||
* ture: OBU设备立即执行升级程序 TODO 警告:执行立即升级时请确保车辆是静止状态。车辆在运行过程中升级设备可能会影响驾驶,严重时可能造成安全隐患!!!
|
||||
* @param listener 升级回调
|
||||
* listener 升级回调
|
||||
* @return 是否调用成功
|
||||
*/
|
||||
fun uploadObuPack(filePathArray: Array<String>) {
|
||||
@@ -231,8 +231,11 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
}
|
||||
|
||||
override fun onObuCallResult(result: BaseResult?) {
|
||||
if(result == null){
|
||||
return
|
||||
}
|
||||
val builder = StringBuilder("调用结果:\n")
|
||||
when (result!!.function) {
|
||||
when (result.function) {
|
||||
MogoObuConstants.CALL_FUNCTION.CONFIG -> {
|
||||
val configResult = result as MogoObuCallConfigResult
|
||||
builder.append(configResult.type.desc).append("配置调用= ")
|
||||
@@ -592,6 +595,10 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
}
|
||||
|
||||
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
|
||||
if(EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType == appId){
|
||||
saveObuData(appId, alertContent, ttsContent)
|
||||
showWarning(appId, alertContent, ttsContent, direction)
|
||||
}
|
||||
}
|
||||
|
||||
MogoObuShowConstants.STATUS.DELETE -> { // 删除
|
||||
@@ -624,13 +631,13 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
) {
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"onMogoObuRsmWarning ------> ${data.toString()}"
|
||||
"onMogoObuRsmWarning ------> ${data?.toString()}"
|
||||
)
|
||||
if (HmiBuildConfig.isShowObuV2iView) {
|
||||
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
|
||||
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
|
||||
if (data != null && data.participant != null) {
|
||||
var v2xType = when (data.participant.ptcType) {
|
||||
val v2xType = when (data.participant.ptcType) {
|
||||
1 -> { //机动车
|
||||
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
|
||||
}
|
||||
@@ -646,7 +653,6 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
}
|
||||
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
|
||||
val alertContent = EventTypeEnumNew.getWarningContent(v2xType)
|
||||
var level = -1
|
||||
val direction = getMessageDirection(data.participant.targetPosition)
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
@@ -654,10 +660,9 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
)
|
||||
when (data.status) {
|
||||
MogoObuShowConstants.STATUS.ADD -> { // 添加
|
||||
// 更新数据,模型变色的时候是不是update,如果不是更新,可能导致模型不变色,(add的时候,是否有level高的) TODO
|
||||
// 更新数据,模型变色的时候是不是update,如果不是更新,可能导致模型不变色,(add的时候,是否有level高的)
|
||||
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)
|
||||
?.let {
|
||||
|
||||
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
}
|
||||
@@ -666,7 +671,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
}
|
||||
|
||||
MogoObuShowConstants.STATUS.DELETE -> { // 删除
|
||||
// 更新数据 TODO 删除原来的,改变颜色,删除marker。不影响别的模型添加
|
||||
// 更新数据 删除原来的,改变颜色,删除marker。不影响别的模型添加
|
||||
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)
|
||||
?.let {
|
||||
// 事件结束,还原交通参与者颜色
|
||||
@@ -681,7 +686,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
|
||||
//预警status
|
||||
if (data.warningMsg != null && data.warningMsg.warningDataList != null && data.warningMsg.warningDataList.size > 0) {
|
||||
level = data.warningMsg.warningDataList[0].warningLevel //默认是1个
|
||||
val level = data.warningMsg.warningDataList[0].warningLevel //默认是1个
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningDataList[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent ---level = $level"
|
||||
@@ -784,7 +789,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
/**
|
||||
* 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示
|
||||
* @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容
|
||||
* @see com.mogo.module.common.enums.EventTypeEnumNew
|
||||
* @see com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
* EventTypeEnumNew在定义的id为了防止重复,和原始数据是不一样的,有对应关系
|
||||
*/
|
||||
private fun handleSdkObu(
|
||||
@@ -999,7 +1004,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
// 添加
|
||||
MogoObuShowConstants.STATUS.ADD,
|
||||
MogoObuShowConstants.STATUS.UPDATE -> {
|
||||
if (lights != null && lights.isNotEmpty()) {
|
||||
if (lights.isNotEmpty()) {
|
||||
changeTrafficLightStatus(appId, lights)
|
||||
}
|
||||
}
|
||||
@@ -1066,8 +1071,8 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
if (HmiBuildConfig.isShowGreenWaveView) {
|
||||
if (!isShowGreenWave) {
|
||||
isShowGreenWave = true
|
||||
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
|
||||
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
|
||||
var minSpeedTemp = (currentLight.suggestMinSpeed * 3.6).roundToInt()
|
||||
val maxSpeedTemp = (currentLight.suggestMaxSpeed * 3.6).roundToInt()
|
||||
if (minSpeedTemp == maxSpeedTemp) {
|
||||
minSpeedTemp -= 5
|
||||
}
|
||||
@@ -1087,7 +1092,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
|
||||
val maxSpeed = currentLight.suggestMaxSpeed
|
||||
if (maxSpeed > 0) {
|
||||
var currentSpeed =
|
||||
val currentSpeed =
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed.toDouble()
|
||||
if (currentSpeed > 0) {
|
||||
ttsContentNew =
|
||||
|
||||
@@ -90,6 +90,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.koomnative
|
||||
implementation rootProject.ext.dependencies.koomxhook
|
||||
implementation rootProject.ext.dependencies.mofang_runtime
|
||||
implementation rootProject.ext.dependencies.log_runtime
|
||||
implementation group: "com.tencent.matrix", name: "matrix-android-lib", version: MATRIX_VERSION, changing: true
|
||||
implementation group: "com.tencent.matrix", name: "matrix-android-commons", version: MATRIX_VERSION, changing: true
|
||||
implementation group: "com.tencent.matrix", name: "matrix-trace-canary", version: MATRIX_VERSION, changing: true
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
|
||||
import com.mogo.eagle.core.function.api.devatools.apm.*
|
||||
import com.mogo.eagle.core.function.api.devatools.strict.*
|
||||
import com.mogo.eagle.core.function.api.devatools.download.*
|
||||
import com.mogo.eagle.core.function.api.devatools.logcat.*
|
||||
import com.mogo.eagle.core.function.api.devatools.mofang.*
|
||||
import com.mogo.eagle.core.function.api.lookaround.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -43,6 +44,7 @@ import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
|
||||
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter
|
||||
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigImpl
|
||||
import com.zhjt.mogo_core_function_devatools.koom.KoomInitTask
|
||||
import com.zhjt.mogo_core_function_devatools.logcat.*
|
||||
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchManager
|
||||
import com.zhjt.mogo_core_function_devatools.lookaround.*
|
||||
import com.zhjt.mogo_core_function_devatools.matrix.DynamicConfigImpl
|
||||
@@ -79,6 +81,8 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
|
||||
private val mofangProvider by lazy { MoGoMoFangProviderImpl() }
|
||||
|
||||
private val logRecordProvider by lazy { MoGoLogRecordProviderImpl() }
|
||||
|
||||
@Volatile
|
||||
private var mDockerVersion: String? = null
|
||||
|
||||
@@ -113,6 +117,11 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
(mContext as? Application)?.also {
|
||||
mofangProvider.init(it)
|
||||
}
|
||||
|
||||
mContext?.also {
|
||||
logRecordProvider.init(it)
|
||||
logRecordProvider.start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun checkMonitorDb() {
|
||||
@@ -195,8 +204,8 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_ANR,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_ANR,
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_ANR_LEAK,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_ANR_LEAK,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_RECORD_ANR,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
@@ -366,4 +375,6 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
override fun lookAroundDataProvider(): IMoGoLookAroundProvider = lookAroundDataProvider
|
||||
|
||||
override fun mofang(): IMoGoMoFangProvider = mofangProvider
|
||||
|
||||
override fun logRecord(): IMoGoLogRecordProvider = logRecordProvider
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zhjt.mogo_core_function_devatools.logcat
|
||||
|
||||
import android.content.*
|
||||
import android.os.Process
|
||||
import android.util.*
|
||||
import com.mogo.core.log.record.*
|
||||
import com.mogo.core.log.record.config.*
|
||||
import com.mogo.core.log.record.config.crash.*
|
||||
import com.mogo.eagle.core.function.api.devatools.logcat.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.zhjt.mogo_core_function_devatools.logcat.uploader.*
|
||||
import kotlinx.coroutines.*
|
||||
import java.io.*
|
||||
import java.util.concurrent.TimeUnit.MINUTES
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider {
|
||||
|
||||
private val flag by lazy { AtomicBoolean(false) }
|
||||
|
||||
private val scope by lazy { CoroutineScope(Dispatchers.IO + SupervisorJob()) }
|
||||
|
||||
override fun init(context: Context) {
|
||||
val zipDir = File(context.getExternalFilesDir(null), "logcat/zip")
|
||||
LogcatManager.init(LogcatConfig.Builder().context(context)
|
||||
.recordPeriod(MINUTES.toMillis(1)) // 1分钟一个文件
|
||||
.maxSizeInLogDir((512 * 1024 * 1024).toLong()) // 512M最大容量
|
||||
.recordDir(File(context.getExternalFilesDir(null), "logcat"))
|
||||
.pid(Process.myPid())
|
||||
.generateZipDir(zipDir.absolutePath)
|
||||
.crashConfig(CrashConfig.Builder()
|
||||
.enabled(true)
|
||||
.crashDir(File(context.getExternalFilesDir(null), "logcat/crash"))
|
||||
.javaCrash(true)
|
||||
.anr(true)
|
||||
.build())
|
||||
.uploader(LogRecordUploader()))
|
||||
scope.launch {
|
||||
try {
|
||||
if (zipDir.exists()) {
|
||||
zipDir.listFiles()?.forEach {
|
||||
it.delete()
|
||||
}
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun start() {
|
||||
if (flag.get()) {
|
||||
return
|
||||
}
|
||||
flag.set(true)
|
||||
LogcatManager.start()
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
if (!flag.get()) {
|
||||
return
|
||||
}
|
||||
flag.set(false)
|
||||
LogcatManager.stop()
|
||||
}
|
||||
|
||||
override fun upload(startTime: Long, endTime: Long) {
|
||||
scope.launch {
|
||||
val result = LogcatManager.upload(startTime, endTime)
|
||||
Log.d(TAG, "上传日志:[startTime:$startTime, endTime: $endTime], 结果: $result")
|
||||
}
|
||||
}
|
||||
|
||||
override fun export(): File? {
|
||||
return LogcatManager.export()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhjt.mogo_core_function_devatools.logcat.uploader
|
||||
|
||||
import com.mogo.core.log.record.config.uploader.*
|
||||
import com.mogo.core.log.record.model.*
|
||||
|
||||
internal class LogRecordUploader: ILogcatUploader {
|
||||
|
||||
override suspend fun upload(startTime: Long, endTime: Long, generatedZipPath: String): UploadState {
|
||||
throw AssertionError("Not Implementation")
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,23 @@ package com.zhjt.mogo_core_function_devatools.mofang
|
||||
import android.annotation.*
|
||||
import android.app.*
|
||||
import android.bluetooth.*
|
||||
import android.graphics.*
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.util.*
|
||||
import android.view.*
|
||||
import android.view.Window.Callback
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.*
|
||||
import androidx.lifecycle.*
|
||||
import com.mogo.core.mofang.connect.MoFangManager
|
||||
import com.mogo.core.mofang.connect.device.*
|
||||
import com.mogo.core.mofang.connect.listener.*
|
||||
import com.mogo.eagle.core.function.api.devatools.mofang.*
|
||||
import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangProvider.OnMoFangStatusListener
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.eagle.core.utilcode.floating.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companion.EVENT_BATTERY
|
||||
import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companion.EVENT_BATTERY_VALUE
|
||||
import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companion.EVENT_INPUT
|
||||
@@ -24,6 +30,8 @@ import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companio
|
||||
import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companion.EVENT_SUB_DISCONNECT_SUCCESS
|
||||
import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companion.EVENT_SUB_START_CONNECT
|
||||
import com.zhjt.mogo_core_function_devatools.mofang.MoFangAnalyticUtils.Companion.EVENT_SUB_START_DISCONNECT
|
||||
import kotlinx.coroutines.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
@@ -33,9 +41,9 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MoGoMoFangProviderImpl"
|
||||
}
|
||||
|
||||
private val battery by lazy { AtomicInteger(0) }
|
||||
private const val SP_KEY_TEST_ENABLE = "sp_mofang_test_enable"
|
||||
}
|
||||
|
||||
private val listeners by lazy { ConcurrentHashMap<String, OnMoFangStatusListener>() }
|
||||
|
||||
@@ -43,12 +51,15 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
|
||||
private val linkedLog by lazy { MoFangLinkedLog().also { executor.setLinkedLog(it) } }
|
||||
|
||||
private val isTest by lazy { AtomicBoolean(false) }
|
||||
private val isTest by lazy { AtomicBoolean(SPUtils.getInstance().getBoolean(SP_KEY_TEST_ENABLE) && isConnected()) }
|
||||
|
||||
private val toast by lazy { AtomicReference<Toast>() }
|
||||
private var toast: MoGoPopWindow? = null
|
||||
|
||||
private var job: Job? = null
|
||||
|
||||
override fun enableTest(enable: Boolean) {
|
||||
isTest.set(enable)
|
||||
SPUtils.getInstance().put(SP_KEY_TEST_ENABLE, enable)
|
||||
}
|
||||
|
||||
override fun isEnableTest(): Boolean {
|
||||
@@ -126,13 +137,10 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
override fun onBluetoothBatteryChanged(battery: Int) {
|
||||
linkedLog.record(mapOf("callback" to "onBluetoothBatteryChanged:$battery"))
|
||||
MoFangAnalyticUtils.track(EVENT_BATTERY, mutableMapOf(EVENT_BATTERY_VALUE to "$battery"))
|
||||
if (this.battery.get() != battery) {
|
||||
UiThreadHandler.post {
|
||||
listeners.values.forEach {
|
||||
it.onMoFangBatteryChanged(battery)
|
||||
}
|
||||
UiThreadHandler.post {
|
||||
listeners.values.forEach {
|
||||
it.onMoFangBatteryChanged(battery)
|
||||
}
|
||||
this.battery.set(battery)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,13 +175,9 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
}
|
||||
|
||||
override fun onBluetoothKeyBoardCombineClicked(vararg keyCodes: Int) {
|
||||
val keycodesText = keyCodes.joinToString(",") { KeyEvent.keyCodeToString(it) }
|
||||
val keycodesText = keyCodes.joinToString(",") { KeyEvent.keyCodeToString(it).replace("KEYCODE_", "", true) }
|
||||
if (isTest.get()) {
|
||||
toast.get()?.cancel()
|
||||
Toast.makeText(Utils.getApp(), "组合键[$keycodesText]触发了\n[正式使用时,请关闭运营面板上的\"魔方指令\"测试开关]", Toast.LENGTH_SHORT).also {
|
||||
toast.set(it)
|
||||
}.show()
|
||||
return
|
||||
showToast("组合键[$keycodesText]触发了")
|
||||
}
|
||||
try {
|
||||
MoFangAnalyticUtils.track(EVENT_INPUT, mutableMapOf(EVENT_INPUT_SUB_KEYCODE to keycodesText, EVENT_INPUT_SUB_TYPE to "3"))
|
||||
@@ -188,11 +192,7 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
|
||||
override fun onBluetoothKeyBoardLongClicked(keyCode: Int) {
|
||||
if (isTest.get()) {
|
||||
toast.get()?.cancel()
|
||||
Toast.makeText(Utils.getApp(), "长按键[${KeyEvent.keyCodeToString(keyCode)}]触发了\n[正式使用时,请关闭运营面板上的\"魔方指令\"测试开关]", Toast.LENGTH_SHORT).also {
|
||||
toast.set(it)
|
||||
}.show()
|
||||
return
|
||||
showToast("长按键[${KeyEvent.keyCodeToString(keyCode).replace("KEYCODE_", "", true)}]触发了")
|
||||
}
|
||||
try {
|
||||
MoFangAnalyticUtils.track(EVENT_INPUT, mutableMapOf(EVENT_INPUT_SUB_KEYCODE to keyCode.toString(), EVENT_INPUT_SUB_TYPE to "2"))
|
||||
@@ -210,11 +210,7 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
override fun onBluetoothKeyboardClicked(keyCode: Int) {
|
||||
val keycodeText = KeyEvent.keyCodeToString(keyCode)
|
||||
if (isTest.get()) {
|
||||
toast.get()?.cancel()
|
||||
Toast.makeText(Utils.getApp(), "单击键[$keycodeText]触发了\n[正式使用时,请关闭运营面板上的\"魔方指令\"测试开关]", Toast.LENGTH_SHORT).also {
|
||||
toast.set(it)
|
||||
}.show()
|
||||
return
|
||||
showToast("单击键[${keycodeText.replace("KEYCODE_", "", true)}]触发了")
|
||||
}
|
||||
try {
|
||||
MoFangAnalyticUtils.track(EVENT_INPUT, mutableMapOf(EVENT_INPUT_SUB_KEYCODE to keyCode.toString(), EVENT_INPUT_SUB_TYPE to "1"))
|
||||
@@ -229,6 +225,39 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
}
|
||||
}
|
||||
|
||||
private fun showToast(text: String) {
|
||||
toast?.hide()
|
||||
val activity = AppStateManager.currentActivity()
|
||||
if (activity !is AppCompatActivity) {
|
||||
return
|
||||
}
|
||||
val padding = AutoSizeUtils.dp2px(activity, 10.0f)
|
||||
MoGoPopWindow.Builder()
|
||||
.attachToActivity(activity)
|
||||
.contentView(TextView(activity).also {
|
||||
it.setPadding(padding)
|
||||
it.setTextColor(Color.WHITE)
|
||||
it.background = ColorDrawable(Color.BLACK)
|
||||
it.textSize = AutoSizeUtils.sp2px(activity, 12f).toFloat()
|
||||
it.text = text
|
||||
})
|
||||
.width(WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
.height(WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
.gravityInActivity(Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL)
|
||||
.offsetY(AutoSizeUtils.dp2px(activity, 200.0f))
|
||||
.onDismissed {
|
||||
toast = null
|
||||
}
|
||||
.onShowed {
|
||||
job?.cancel()
|
||||
activity.lifecycleScope.launch {
|
||||
delay(2000)
|
||||
toast?.hide()
|
||||
}.also { job = it }
|
||||
}
|
||||
.build().also { toast = it }.show()
|
||||
}
|
||||
|
||||
override fun onBluetoothKeyboardEvent(event: KeyEvent) { }
|
||||
|
||||
override fun onBluetoothKeyboardInputInvalid() {
|
||||
@@ -263,4 +292,9 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
Toast.makeText(Utils.getApp(), "检测到魔方未正确连接,请在系统蓝牙设置页面,找到魔方并配对连接...", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBluetoothKeyboardAbnormalDisconnected(status: Int) {
|
||||
Log.d(TAG, "--- onBluetoothKeyboardAbnormalDisconnected(status: $status) ---")
|
||||
linkedLog.record(mapOf("callback" to "onBluetoothKeyboardAbnormalDisconnected:$status"))
|
||||
}
|
||||
}
|
||||
@@ -72,9 +72,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_HMI] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_HMI_ACTIONS)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_NATIVE_LEAK] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_RECORD_NATIVE_LEAK)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_ANR] =
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_ANR_LEAK] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_RECORD_ANR)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_V2X] =
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_V2X)
|
||||
@@ -102,9 +100,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
ChainLogParam(true, "ADAS红绿灯数据")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_HMI] =
|
||||
ChainLogParam(true, "人机交互行为")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_NATIVE_LEAK] =
|
||||
ChainLogParam(true, "Native Leak Record")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_ANR] =
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_ANR_LEAK] =
|
||||
ChainLogParam(true, "ANR Record")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_V2X] =
|
||||
ChainLogParam(true, "V2X(V2N/V2I)")
|
||||
@@ -113,8 +109,10 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_WEAK_NETWORK] =
|
||||
ChainLogParam(true, "WeakNetWork Record")
|
||||
|
||||
MoGoAiCloudClientConfig.getInstance()
|
||||
|
||||
FileWriteManager.getInstance()
|
||||
.init(context, MoGoAiCloudClientConfig.getInstance().sn, pkgName, fwBuildMap)
|
||||
.init(context, "", pkgName, fwBuildMap)
|
||||
FileWriteManager.getInstance().registerListener { type ->
|
||||
val param = traceInfoCache[type]
|
||||
param?.let {
|
||||
|
||||
@@ -5,7 +5,9 @@ import android.app.Activity
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.*
|
||||
import android.os.Build
|
||||
import android.os.Process
|
||||
import android.text.Html
|
||||
@@ -16,6 +18,7 @@ import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.*
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import chassis.Chassis
|
||||
@@ -1363,6 +1366,38 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
//导出全量日志
|
||||
exportAllLogs?.onClick { v ->
|
||||
v.visibility = View.INVISIBLE
|
||||
logLoadingView?.visibility = View.VISIBLE
|
||||
v.scope.launch(Dispatchers.IO) {
|
||||
val file = CallerDevaToolsManager.logcat()?.export()
|
||||
if (file != null && file.exists()) {
|
||||
withContext(Dispatchers.Main) {
|
||||
var activity = AppStateManager.currentActivity()
|
||||
while (activity == null) {
|
||||
delay(2000)
|
||||
activity = AppStateManager.currentActivity()
|
||||
if (activity != null) {
|
||||
break
|
||||
}
|
||||
}
|
||||
activity?.startActivity(Intent.createChooser(Intent().also {
|
||||
it.action = Intent.ACTION_SEND
|
||||
it.type = "application/zip"
|
||||
it.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(activity, "${activity.packageName}.fileProvider", file))
|
||||
}, "分享全量日志压缩包到"))
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("全量日志压缩文件生成失败")
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
logLoadingView?.visibility = View.INVISIBLE
|
||||
exportAllLogs?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示、关闭日志过滤面板
|
||||
*/
|
||||
|
||||
@@ -320,7 +320,7 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
mfTest.isEnabled = true
|
||||
mfTest.isEnabled = mf?.isConnected() ?: false
|
||||
mfTest.isChecked = mf?.isEnableTest() ?: false
|
||||
mfTest.setOnCheckedChangeListener { _, isChecked ->
|
||||
mf?.enableTest(isChecked)
|
||||
@@ -410,6 +410,8 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
mfStatusLayout?.also {
|
||||
it.hideLoadingView()
|
||||
it.setClickedTextAndTag("断开魔方连接", 0)
|
||||
mfTest?.isEnabled = true
|
||||
mfTest?.isChecked = CallerDevaToolsManager.mofang()?.isEnableTest() ?: false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,6 +419,7 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
mfStatusLayout?.also {
|
||||
it.hideLoadingView()
|
||||
it.setClickedTextAndTag("开始连接魔方", 1)
|
||||
mfTest?.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -260,8 +260,8 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_NATIVE_LEAK,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_LEAK,
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_ANR_LEAK,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_ANR_LEAK,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_RECORD_NATIVE_LEAK,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/hmi_traffic_light_iv"
|
||||
android:layout_marginStart="-30dp"
|
||||
android:layout_marginStart="-40dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -2217,6 +2217,50 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_mf_sop_operator"
|
||||
android:paddingBottom="10dip"
|
||||
android:layout_marginStart="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:paddingTop="10dip">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/logLoadingView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:visibility="invisible"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<TextView
|
||||
android:text="正在压缩全量日志,请稍候"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20dip"/>
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginStart="10dip"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exportAllLogs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20dip"
|
||||
android:text="导出全量日志"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="10dip"
|
||||
android:layout_marginBottom="10dip" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -48,6 +48,7 @@ class SmallMapView @JvmOverloads constructor(
|
||||
private var mCameraUpdate: CameraUpdate? = null
|
||||
private var mContext: Context? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var globalPathResp: MessagePad.GlobalPathResp? = null
|
||||
|
||||
companion object {
|
||||
const val TAG = "SmallMapView"
|
||||
@@ -121,12 +122,7 @@ class SmallMapView @JvmOverloads constructor(
|
||||
)
|
||||
)
|
||||
// 绘制线
|
||||
mPolyline = mAMap!!.addPolyline(
|
||||
PolylineOptions()
|
||||
.addAll(mCoordinatesLatLng)
|
||||
.color(Color.argb(255, 31, 127, 255))
|
||||
.width(12f)
|
||||
)
|
||||
mPolyline?.points = mCoordinatesLatLng
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView drawPolyline size is = ${mCoordinatesLatLng.size} ")
|
||||
}
|
||||
@@ -136,8 +132,7 @@ class SmallMapView @JvmOverloads constructor(
|
||||
@UiThread
|
||||
fun clearPolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline!!.remove()
|
||||
mPolyline = null
|
||||
mPolyline!!.points = emptyList()
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker!!.isVisible = false
|
||||
@@ -157,6 +152,12 @@ class SmallMapView @JvmOverloads constructor(
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10, this)
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
|
||||
mPolyline = mAMap!!.addPolyline(
|
||||
PolylineOptions()
|
||||
.color(Color.argb(255, 31, 127, 255))
|
||||
.width(12f)
|
||||
)
|
||||
}
|
||||
|
||||
private fun initAMapView() {
|
||||
@@ -311,43 +312,53 @@ class SmallMapView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (state != 2) {
|
||||
if(state == 2){
|
||||
drawRotting()
|
||||
}else{
|
||||
UiThreadHandler.post {
|
||||
clearPolyline()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotRouteLineId(lineId: Long) {
|
||||
super.onAutopilotRouteLineId(lineId)
|
||||
if(lineId == 0L){
|
||||
this.globalPathResp = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawRotting(){
|
||||
globalPathResp?.let {
|
||||
val latLngList: MutableList<MogoLatLng> = ArrayList()
|
||||
for (routeModel in globalPathResp!!.wayPointsList) {
|
||||
latLngList.add(MogoLatLng(routeModel.latitude, routeModel.longitude))
|
||||
}
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView latLngList.size = ${latLngList.size}")
|
||||
if (latLngList.size > 0) {
|
||||
UiThreadHandler.post {
|
||||
convert(latLngList)
|
||||
drawablePolyline()
|
||||
}
|
||||
} else {
|
||||
UiThreadHandler.post {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView latLngList.size = ${latLngList.size} clearPolyline ---->")
|
||||
clearPolyline()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView globalPathResp = $globalPathResp")
|
||||
if (globalPathResp == null || globalPathResp.wayPointsList.size == 0) {
|
||||
return
|
||||
}
|
||||
if(CallerAutoPilotStatusListenerManager.getState() != 2){
|
||||
UiThreadHandler.post {
|
||||
clearPolyline()
|
||||
}
|
||||
return
|
||||
}
|
||||
val latLngList: MutableList<MogoLatLng> = ArrayList()
|
||||
for (routeModel in globalPathResp.wayPointsList) {
|
||||
latLngList.add(MogoLatLng(routeModel.latitude, routeModel.longitude))
|
||||
}
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView latLngList.size = ${latLngList.size}")
|
||||
if (latLngList.size > 0) {
|
||||
UiThreadHandler.post {
|
||||
convert(latLngList)
|
||||
drawablePolyline()
|
||||
}
|
||||
} else {
|
||||
UiThreadHandler.post {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView latLngList.size = ${latLngList.size} clearPolyline ---->")
|
||||
clearPolyline()
|
||||
}
|
||||
}
|
||||
this.globalPathResp = globalPathResp
|
||||
drawRotting()
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user