[code_opt_3.3.0] code opt
This commit is contained in:
@@ -7,23 +7,18 @@ import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.LifecycleCoroutineScope
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
@@ -34,14 +29,10 @@ 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.ext.enqueuePop
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener,
|
||||
IMoGoChassisLocationWGS84Listener {
|
||||
internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener {
|
||||
|
||||
const val TAG = "BadCase"
|
||||
|
||||
@@ -50,13 +41,8 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
@Volatile
|
||||
private var record: AutoPilotRecord? = null
|
||||
|
||||
private var longitude: Double = 0.0
|
||||
private var latitude: Double?= 0.0
|
||||
|
||||
fun init(){
|
||||
fun init() {
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,15 +69,20 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
/**
|
||||
* 展示BadCase录包管理页面
|
||||
*/
|
||||
fun showBadCaseManagerWindow(context: Context){
|
||||
fun showBadCaseManagerWindow(context: Context) {
|
||||
val badCaseManagerView = BadCaseManagerView(context)
|
||||
badCaseManagerView.setOnClickListener(object: BadCaseManagerView.ClickListener{
|
||||
badCaseManagerView.setOnClickListener(object : BadCaseManagerView.ClickListener {
|
||||
override fun onClose() {
|
||||
hideFloat?.invoke()
|
||||
hideFloat = null
|
||||
}
|
||||
})
|
||||
context.enqueuePop(badCaseManagerView,AutoSizeUtils.dp2px(context,960f), WindowManager.LayoutParams.MATCH_PARENT, key = "BadCaseManagerView").also {
|
||||
context.enqueuePop(
|
||||
badCaseManagerView,
|
||||
AutoSizeUtils.dp2px(context, 960f),
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
key = "BadCaseManagerView"
|
||||
).also {
|
||||
hideFloat = it
|
||||
}
|
||||
}
|
||||
@@ -246,29 +237,32 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
)
|
||||
)
|
||||
)
|
||||
val lat =
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude
|
||||
val lon =
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude
|
||||
//埋点统计
|
||||
BadCaseAnalyticsManager.bagRecordReceive(recordPanel.key.toString(),recordPanel.filename,
|
||||
System.currentTimeMillis().toString(),recordPanel.stat.toString(),
|
||||
AppConfigInfo.plateNumber,recordPanel.duration.toString(),
|
||||
MoGoAiCloudClientConfig.getInstance().sn,BadCaseConfig.dockerVersion ?:"",
|
||||
AppUtils.getAppVersionName(),latitude.toString(),longitude.toString())
|
||||
BadCaseAnalyticsManager.bagRecordReceive(
|
||||
recordPanel.key.toString(), recordPanel.filename,
|
||||
System.currentTimeMillis().toString(), recordPanel.stat.toString(),
|
||||
AppConfigInfo.plateNumber, recordPanel.duration.toString(),
|
||||
MoGoAiCloudClientConfig.getInstance().sn, BadCaseConfig.dockerVersion ?: "",
|
||||
AppUtils.getAppVersionName(), lat.toString(), lon.toString()
|
||||
)
|
||||
//日志埋点
|
||||
CallerLogger.i("$M_DEVA$TAG", "BadCase Receive Analytics="+"key="+recordPanel.key+" filename="+recordPanel.filename+
|
||||
" receiveTime="+System.currentTimeMillis()+" stat="+recordPanel.stat+" plateNumber="+AppConfigInfo.plateNumber+
|
||||
" totalDuration="+recordPanel.duration+" carSn="+MoGoAiCloudClientConfig.getInstance().sn+" mapVersion="+BadCaseConfig.dockerVersion+
|
||||
" eyeVersion="+AppUtils.getAppVersionName()+" latitude="+latitude+" longitude="+longitude)
|
||||
CallerLogger.i(
|
||||
"$M_DEVA$TAG",
|
||||
"BadCase Receive Analytics=" + "key=" + recordPanel.key + " filename=" + recordPanel.filename +
|
||||
" receiveTime=" + System.currentTimeMillis() + " stat=" + recordPanel.stat + " plateNumber=" + AppConfigInfo.plateNumber +
|
||||
" totalDuration=" + recordPanel.duration + " carSn=" + MoGoAiCloudClientConfig.getInstance().sn + " mapVersion=" + BadCaseConfig.dockerVersion +
|
||||
" eyeVersion=" + AppUtils.getAppVersionName() + " latitude=" + lat + " longitude=" + lon
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onStateChanged(source: LifecycleOwner, event: Event) {
|
||||
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
latitude = gnssInfo.latitude
|
||||
longitude = gnssInfo.longitude
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
@@ -37,7 +36,7 @@ import java.util.*
|
||||
* @since: 2022/7/12
|
||||
*/
|
||||
class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
IMoGoAutopilotRecordListener, IMoGoChassisLocationWGS84Listener {
|
||||
IMoGoAutopilotRecordListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AIDataCollectWindow"
|
||||
@@ -68,8 +67,6 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
|
||||
@Volatile
|
||||
private var recordFileName: String? = null //录制文件包名
|
||||
private var longitude: Double? = null
|
||||
private var latitude: Double? = null
|
||||
|
||||
private lateinit var mFloatLayout: View
|
||||
private var mInViewX = 0f
|
||||
@@ -116,8 +113,6 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
//采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this)
|
||||
//开始录制AI数据采集Bag包
|
||||
CallerAutoPilotControlManager.recordPackage(
|
||||
99,
|
||||
@@ -234,7 +229,8 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
itx["audioUrl"] = "" //音频COS地址
|
||||
itx["mapVersion"] = BadCaseConfig.dockerVersion ?: "" //工控机版本
|
||||
itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本
|
||||
itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标
|
||||
itx["coordinate"] =
|
||||
"latitude:${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude};longitude:${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude}" //坐标
|
||||
|
||||
})
|
||||
if (uploadResult == null || uploadResult.code != 200) {
|
||||
@@ -332,7 +328,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = metrics.widthPixels
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight() - 950
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
}
|
||||
}
|
||||
@@ -353,9 +349,4 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
latitude = gnssInfo.latitude
|
||||
longitude = gnssInfo.longitude
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeAppNetWorkManager
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* //todo emArrow 链路biz
|
||||
* 车辆绑定
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
@@ -61,9 +62,9 @@ object BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
Logger.d("${SceneConstant.M_BINDING}${TAG}", "onAutopilotCarConfig ----------> ")
|
||||
CallerLogger.d("${SceneConstant.M_BINDING}${TAG}", "onAutopilotCarConfig ----------> ")
|
||||
if (!TextUtils.isEmpty(carConfigResp.macAddress)) {
|
||||
Logger.d("${SceneConstant.M_BINDING}${TAG}",
|
||||
CallerLogger.d("${SceneConstant.M_BINDING}${TAG}",
|
||||
"onAutopilotCarConfig carConfigResp.macAddress = ${carConfigResp.macAddress} ")
|
||||
getBindingCarInfo(carConfigResp.macAddress, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
}
|
||||
@@ -75,17 +76,14 @@ object BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
* @param macAddress
|
||||
*/
|
||||
fun getBindingCarInfo(macAddress: String, widevineIDWithMd5: String) {
|
||||
Log.d("UPGRADE", "-- getBindingCarInfo -- 1 -- : [mac: $macAddress, md5: $widevineIDWithMd5]")
|
||||
var flag = false
|
||||
if (!TextUtils.isEmpty(macAddress) && TextUtils.isEmpty(mAddress)) {
|
||||
Log.d("UPGRADE", "-- getBindingCarInfo -- 2 -- : [mac: $macAddress, md5: $widevineIDWithMd5]")
|
||||
flag = true
|
||||
}
|
||||
if (!TextUtils.isEmpty(macAddress) && !TextUtils.equals(macAddress, mAddress)) {
|
||||
mAddress = macAddress
|
||||
}
|
||||
if (flag) {
|
||||
Log.d("UPGRADE", "-- getBindingCarInfo -- 3 -- : [mac: $macAddress, md5: $widevineIDWithMd5]")
|
||||
queryAppUpgrade()
|
||||
val obuVersion = mObuVersion
|
||||
if (obuVersion != null && !TextUtils.isEmpty(obuVersion)) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.view.KeyEvent
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangListener
|
||||
@@ -165,7 +164,10 @@ class MoFangManager private constructor() : IMoGoMoFangListener {
|
||||
* 魔方按键处理
|
||||
*/
|
||||
override fun onMofangHandle(keyCode: Int, action: Int): Boolean {
|
||||
val bluetoothName = SharedPrefsMgr.getInstance(ContextHolderUtil.getContext()).getString(
|
||||
if(mContext == null){
|
||||
return false
|
||||
}
|
||||
val bluetoothName = SharedPrefsMgr.getInstance(mContext!!).getString(
|
||||
MfConstants.BLUETOOTH_NAME)
|
||||
if (bluetoothName == "MINI_KEYBOARD") {
|
||||
if (!isPressEnd) {
|
||||
|
||||
@@ -57,7 +57,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_VEHICLE] =
|
||||
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_VEHICLE)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT] =
|
||||
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_P_OBJECTS] =
|
||||
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_PLANNING_OBJECTS)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_P_ACTIONS] =
|
||||
@@ -87,7 +87,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_VEHICLE] =
|
||||
ChainLogParam(false, "ADAS车辆底盘数据")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT] =
|
||||
ChainLogParam(false, "ADAS红绿灯数据")
|
||||
ChainLogParam(true, "ADAS红绿灯数据")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_P_OBJECTS] =
|
||||
ChainLogParam(false, "ADAS PLANNING 感知障碍物")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_P_ACTIONS] =
|
||||
|
||||
Reference in New Issue
Block a user