[6.2.6]运营面板整理

This commit is contained in:
xuxinchao
2023-12-20 20:29:53 +08:00
parent 7e5c0fdf7f
commit 6900cb706c
7 changed files with 505 additions and 352 deletions

View File

@@ -3,6 +3,9 @@ package com.zhjt.mogo_core_function_devatools.badcase
import android.app.Activity
import android.content.Context
import android.graphics.Bitmap
import android.os.Environment
import android.os.SystemClock
import android.view.View
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
@@ -27,10 +30,15 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -43,14 +51,17 @@ import com.mogo.tts.base.SpeechUtils
import com.zhjt.mogo_core_function_devatools.badcase.biz.*
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
import com.zhjt.mogo_core_function_devatools.badcase.util.RecordBitmapUtils
import com.zhjt.mogo_core_function_devatools.ext.enqueuePop
import me.jessyan.autosize.utils.AutoSizeUtils
import record_cache.RecordPanelOuterClass
import java.io.File
import java.util.Random
import kotlin.math.abs
internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener,
IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener,
IMogoStatusChangedListener {
IMogoStatusChangedListener, IMoGoMapScreenListener {
const val TAG = "BadCase"
@@ -59,6 +70,8 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
@Volatile
private var record: AutoPilotRecord? = null
private var recordKey: Long = 0 //主动录制bag包key
fun init(context: Context) {
CallerAutopilotRecordListenerManager.addListener(TAG, this)
SpeechUtils.init(context)
@@ -183,15 +196,26 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|| BadCaseConfig.dockerVersion!!.contains("2.6.0")
|| BadCaseConfig.dockerVersion!!.contains("2.8.0")
) {
val initiativeBadCaseWindow = InitiativeBadCaseWindow(activity)
initiativeBadCaseWindow.setClickListener(object :
InitiativeBadCaseWindow.ClickListener {
override fun closeWindow() {
initiativeBadCaseWindow.hideFloatWindow()
}
if(FunctionBuildConfig.isShowBagRecordWindow){
//展示录包弹窗并且录包
val initiativeBadCaseWindow = InitiativeBadCaseWindow(activity)
initiativeBadCaseWindow.setClickListener(object :
InitiativeBadCaseWindow.ClickListener {
override fun closeWindow() {
initiativeBadCaseWindow.hideFloatWindow()
}
})
initiativeBadCaseWindow.showFloatWindow(null)
})
initiativeBadCaseWindow.showFloatWindow(null)
}else{
//进行录包,但不展示录包弹窗
BadCaseConfig.notDisplayBagWindow = true
//高精地图屏幕截图
CallerMapScreenListenerManager.addListener(TAG,this)
val recordKey = Random(SystemClock.elapsedRealtime()).nextInt().toLong()
CallerAutoPilotControlManager.recordPackage(BadCaseConfig.type,recordKey.toInt(),
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration)
}
} else {
val caseListDialog = CaseListDialog(activity)
caseListDialog.show()
@@ -273,6 +297,23 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
super.onAutopilotRecordResult(recordPanel)
CallerLogger.d("$M_DEVA$TAG", "recordKey=${recordPanel.key},stat=${recordPanel.stat}")
if(BadCaseConfig.notDisplayBagWindow){
//此时点击主动录包按钮,不能展示上报弹窗,需要在此处做主动录包弹窗中的一些逻辑
//开始录制
if(recordPanel.stat == 300){
recordKey = recordPanel.key
BadCaseConfig.recordKeyList.add(recordPanel.key)
//获取当前主动录包集合
val recordSet = BadCaseConfig.getInitiativeRecordSet()
//保存录包状态
recordSet.add(recordPanel.key.toString())
BadCaseConfig.setInitiativeRecordSet(recordSet)
//开启高精地图截图
CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
//将当次主动录包设置标签还原
BadCaseConfig.notDisplayBagWindow = false
}
}
if (BadCaseConfig.recordKeyList.contains(recordPanel.key)) {
if (recordPanel.stat == 100 || recordPanel.stat == 101) {
//成功结束录制
@@ -383,5 +424,47 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
BadCaseConfig.socketStatus = "云Socket连接${if (isTrue) "正常" else "异常"}"
}
override fun onMapScreen(bitmap: Bitmap) {
super.onMapScreen(bitmap)
//在截图上保存即时信息
val time = "时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
val lineId = "路线ID:${CallerAutoPilotStatusListenerManager.getLineId()}"
val state = when(CallerAutoPilotStatusListenerManager.getState()){
0->"自驾状态:不可自驾"
1->"自驾状态:可自驾"
2->"自驾状态:自驾中"
7->"自驾状态:平行驾驶中"
else->"自驾状态:未知"
}
val speed = "当前车速:${BadCaseConfig.currentSpeed}"
val site = if(CallerAutoPilotStatusListenerManager.getLineStartName().isNullOrEmpty() || CallerAutoPilotStatusListenerManager.getLineEndName().isNullOrEmpty()){
"路线起始点:无"
}else{
"路线起点:${CallerAutoPilotStatusListenerManager.getLineStartName()};终点:${CallerAutoPilotStatusListenerManager.getLineEndName()}"
}
val outBitmap = RecordBitmapUtils.drawTextOnBitmap(bitmap,time,lineId,state,speed,site,
BadCaseConfig.gpsStatus,BadCaseConfig.tracingStatus,BadCaseConfig.socketStatus
,BadCaseConfig.newFMInfoMsg,BadCaseConfig.newReportEntity)
//图片保存本地
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
"MapScreen" + File.separator+ currentDay + File.separator
val fileName = "$recordKey.png"
val path = fileDir + fileName
if (!File(fileDir).exists()) {
File(fileDir).mkdirs()
}
if(outBitmap != null){
RecordBitmapUtils.bitmap2Path(outBitmap,path)
}else{
RecordBitmapUtils.bitmap2Path(bitmap,path)
}
//遍历是否有非当日的文件并删除
RecordBitmapUtils.deleteExpiredFile(currentDay)
//注销高精地图截图监听回调
CallerMapScreenListenerManager.removeListener(TAG)
}
}

View File

@@ -58,6 +58,8 @@ object BadCaseConfig {
@JvmField
var bagManagerList: ArrayList<BagInfoEntity> = ArrayList()
var notDisplayBagWindow: Boolean = false //主动录包不能展示弹窗
private const val resourceInitiative = "RESOURCE_INITIATIVE" //录包来源为主动录包
private const val resourceAiData = "RESOURCE_AI_DATA" //录包来源为AI数据采集
private const val recordFail = "RECORD_FAIL" //录包失败