Merge branch 'dev_robotaxi-d_240523_6.4.4' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_240523_6.4.4

This commit is contained in:
xinfengkun
2024-06-05 18:09:24 +08:00
26 changed files with 364 additions and 286 deletions

View File

@@ -1,8 +1,10 @@
package com.mogo.och.bus.passenger.ui;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
@@ -16,9 +18,11 @@ import androidx.recyclerview.widget.RecyclerView;
import com.amap.api.maps.model.LatLng;
import com.elegant.utils.UiThreadHandler;
import com.mogo.eagle.core.data.enums.SidePattern;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView;
import com.mogo.eagle.core.function.hmi.ui.widget.DriverMonitorView;
import com.mogo.commons.storage.SharedPrefsMgr;
import com.mogo.map.overlay.IMoGoOverlayManager;
@@ -124,6 +128,18 @@ public class BusPassengerRouteFragment extends
}
});
mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Context context = getContext();
if(context!=null){
ToggleDebugView.Companion.
getToggleDebugView().toggle(context, Gravity.RIGHT, SidePattern.RIGHT);
}
return true;
}
});
mapAndLiveVideoView = findViewById(R.id.mapAndLiveVideoView);
initLiveView();

View File

@@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.R
import com.mogo.och.common.module.manager.autopilot.trajectory.TrajectoryManager
import com.mogo.och.common.module.utils.CallerBase
import com.zhjt.mogo.adas.data.AdasConstants
@@ -13,11 +15,31 @@ import mogo_msg.MogoReportMsg
import system_master.SsmInfo
import system_master.SystemStatusInfo
import java.lang.Exception
import kotlin.properties.Delegates
object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListener>(),IMoGoAutopilotStatusListener,
(Boolean) -> Unit {
const val TAG = "OCHAutoPilotStatusListenerManager"
private var autopilotState: Int by Delegates.observable(0) { _, oldValue, newValue ->
if (oldValue != newValue) {
if(oldValue==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
if(newValue==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){
ToastUtils.showLong(R.string.common_change2_autopilot2_manual)
}
}else if(oldValue==IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
if(newValue==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){
ToastUtils.showLong(R.string.common_change2_pxjs_manual)
}
}
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotStatusResponse(newValue)
}
}
}
init {
//2021.11.1 鹰眼架构整合由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
@@ -37,10 +59,7 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
override fun onAutopilotStatusResponse(state: Int) {
super.onAutopilotStatusResponse(state)
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotStatusResponse(state)
}
autopilotState = state
}
override fun onAutopilotDockerInfo(dockerVersion: String) {

View File

@@ -17,4 +17,7 @@
<string name="qr_cancel">取消</string>
<string name="bind_driver_qr_title">扫描二维码完成车辆绑定</string>
<string name="common_change2_autopilot2_manual">自动驾驶已退出,请立即接管,注意周边环境 小心驾驶</string>
<string name="common_change2_pxjs_manual">平行驾驶已退出,请立即接管,注意周边环境 小心驾驶</string>
</resources>

View File

@@ -1,8 +1,10 @@
package com.mogo.och.shuttle.passenger.ui;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.text.Html;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
@@ -15,9 +17,11 @@ import androidx.recyclerview.widget.RecyclerView;
import com.amap.api.maps.model.LatLng;
import com.elegant.utils.UiThreadHandler;
import com.mogo.eagle.core.data.enums.SidePattern;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView;
import com.mogo.map.overlay.IMoGoOverlayManager;
import com.mogo.och.common.module.utils.ResourcesUtils;
import com.mogo.och.shuttle.passenger.R;
@@ -88,7 +92,6 @@ public class BusPassengerRouteFragment extends
mNoLineInfoView =findViewById(R.id.bus_p_no_order_data_view);
emptyTv = findViewById(R.id.no_order_data_tv);
// mCarPlateNum = findViewById(R.id.bus_p_driver_num_plate_tv);
mLineName = findViewById(R.id.bus_p_line_name_tv);
mAutopilotIv = findViewById(R.id.auto_status_iv);
mCurrentArriveStation = findViewById(R.id.bus_p_cur_station_name);
@@ -103,6 +106,15 @@ public class BusPassengerRouteFragment extends
mStationsListRv.setLayoutManager(manager);
mAdapter = new BusPassengerLineStationsAdapter(getContext(), mStationsList);
mStationsListRv.setAdapter(mAdapter);
mSpeedTv.setOnLongClickListener(v -> {
Context context = getContext();
if(context!=null){
ToggleDebugView.Companion.
getToggleDebugView().toggle(context, Gravity.RIGHT, SidePattern.RIGHT);
}
return true;
});
}
@Override

View File

@@ -198,8 +198,6 @@ dependencies {
compileOnly rootProject.ext.dependencies.google_auto_service
compileOnly rootProject.ext.dependencies.apm_insight
compileOnly rootProject.ext.dependencies.serialport
}

View File

@@ -29,7 +29,6 @@ buildscript {
classpath "com.bytedance.android.byteX:base-plugin:${plugin_version}"
classpath "com.mogo.cloud:hook:${service_chain_version}"
classpath "com.mogo.cloud:bizconfig:${plugin_version}"
classpath 'com.volcengine:apm_insight_plugin:1.4.2'
classpath "com.mogo.thread.opt:plg:10.10.0"
classpath "com.mogo.cloud:systrace:${plugin_version}"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'

View File

@@ -133,8 +133,6 @@ ext {
crashreport : "com.mogo.test:crashreport:${CRASHREPORT_VERSION}",
crashreportapmbyte : "com.mogo.test:crashreport-apmbyte:${CRASHREPORT_APMBYTE_VERSION}",
crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}",
apm_insight : 'com.volcengine:apm_insight:1.5.4.cn-rc.1',
apm_insight_crash : 'com.volcengine:apm_insight_crash:1.5.0',
cicle_indicator : 'me.relex:circleindicator:2.1.6',
//========================= TTS语音 Maven 版本管理 =========================

View File

@@ -69,12 +69,19 @@ object DataManager {
}
/**
* FSM消息(缓存数据库时使用)
* FM消息(缓存数据库时使用)
*/
private val fmInfoList by lazy {
mutableListOf<MsgBoxBean>()
}
/**
* FSM消息(缓存数据库时使用)
*/
private val fsmInfoList by lazy {
mutableListOf<MsgBoxBean>()
}
private val scope by lazy {
Utils.getApp().lifeCycleScope
}
@@ -149,6 +156,13 @@ object DataManager {
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
}
MsgBoxType.FSM -> {
synchronized(this) {
fsmInfoList.add(msg)
}
CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg)
}
MsgBoxType.SSMINFO -> {// 不存数据库
CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, msg)
}
@@ -346,6 +360,18 @@ object DataManager {
}
}
MsgBoxType.FSM.ordinal -> {
return@map MsgBoxBean(
MsgBoxType.FSM,
GsonUtils.fromJson(json, FSMMsg::class.java)
).apply {
this.timestamp = msgInfo.timeStamp
withContext(Dispatchers.Main) {
cacheNotifyList.add(this@apply)
}
}
}
else -> {
return@map null
}
@@ -396,6 +422,13 @@ object DataManager {
fmInfoList.clear()
}
if (fsmInfoList.isNotEmpty()) {
fsmInfoList.forEach {
msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp))
}
fsmInfoList.clear()
}
if (msgInfoList.isNotEmpty()) {
MsgBoxDb.getDb(context)
.monitorDao()

View File

@@ -39,6 +39,7 @@ import com.tencent.matrix.trace.config.SharePluginInfo
import com.tencent.matrix.trace.config.TraceConfig
import com.zhjt.mogo_core_function_devatools.apm.*
import com.mogo.eagle.core.function.api.upgrade.*
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.mogo.eagle.core.utilcode.util.IAppStateListener
@@ -73,8 +74,10 @@ import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeManager.Companion.up
import com.zhjt.mogo_core_function_devatools.weaknetwork.DetectResultImpl
import com.zhjt.mogo_core_function_devatools.weaknetwork.WeakNetworkStrategy
import com.zhjt.service.chain.ChainLog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.io.File
import java.lang.ref.WeakReference
import java.util.concurrent.ConcurrentHashMap
@@ -217,6 +220,35 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
}
}
/**
* 检查上传崩溃日志
*/
override fun checkUploadCrashLog() {
mContext?.let {
val crashDir = File(it.getExternalFilesDir(null), "crash")
if(crashDir.exists() && crashDir.canExecute() && crashDir.listFiles()?.isNotEmpty() == true){
it.lifeCycleScope.launch(Dispatchers.IO){
val startTime = crashDir.lastModified() - 60*1000
val endTime = if(System.currentTimeMillis() - crashDir.lastModified()>60*1000){
crashDir.lastModified() + 60*1000
}else{
System.currentTimeMillis()
}
var isUploadSuccess = false
try {
CallerDevaToolsManager.logcat()?.upload(startTime, endTime)
isUploadSuccess = true
} catch (t: Throwable) {
t.printStackTrace()
}
if(isUploadSuccess){
crashDir.deleteRecursively()
}
}
}
}
}
private fun initMatrix() {
val builder: Matrix.Builder = Matrix.Builder(AbsMogoApplication.getApp())
builder.pluginListener(object : PluginListener {

View File

@@ -23,7 +23,6 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.function.api.devatools.logcat.*
import com.mogo.eagle.core.utilcode.download.DownloadUtils
import com.zhidao.loglib.bean.RemoteLogPushContent
import com.zhjt.mogo_core_function_devatools.BuildConfig
import com.zhjt.mogo_core_function_devatools.logcat.checker.AnrLogChecker
import com.zhjt.mogo_core_function_devatools.logcat.config.LogRecordConfig
import com.zhjt.mogo_core_function_devatools.logcat.uploader.*
@@ -130,18 +129,16 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
.systemTags("ActivityManager")
.checker(AnrLogChecker())
}
if (BuildConfig.DEBUG) {
builder.crashConfig(
CrashConfig.Builder()
.enabled(true)
.crashDir(File(context.getExternalFilesDir(null), "crash"))
.expireDuration(TimeUnit.DAYS.toMillis(3))
.javaCrash(true)
.nativeCrash(true)
.anr(true)
.build()
)
}
builder.crashConfig(
CrashConfig.Builder()
.enabled(true)
.crashDir(File(context.getExternalFilesDir(null), "crash"))
.expireDuration(TimeUnit.DAYS.toMillis(3))
.javaCrash(true)
.nativeCrash(true)
.anr(true)
.build()
)
builder.extraFilesToUpload(object : IExtraFileToUpload {
override fun filesToUpload(): List<ToUploadFile> {
return ArrayList<ToUploadFile>().also {

View File

@@ -46,7 +46,8 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val fm: Int = 6
private val ssm: Int = 7
private val autopilot: Int = 8
private val none: Int = 9
private val fsm: Int = 9
private val none: Int = 10
private var changeViewListener: ChangeViewListener?=null
@@ -103,6 +104,10 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_autopilot,parent,false)
return BubbleAutopilotHolder(view)
}
fsm -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_fsm,parent,false)
return BubbleFSMHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
@@ -308,6 +313,16 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
holder.tvAutopilotTime.text = TimeUtils.millis2String(autopilotMsg.timestamp,getHourMinFormat())
}
}
//FSM消息
is BubbleFSMHolder ->{
data?.let {
val fsmMsg = it[position].msgBoxBean.bean as FSMMsg
holder.tvFSMTitle.text = fsmMsg.title
holder.tvFSMContent.text = fsmMsg.content
holder.tvFSMTime.text = TimeUtils.millis2String(fsmMsg.timestamp,getHourMinFormat())
}
}
}
val msgBoxBean: MsgBoxCountDownBean = data!![position]
@@ -361,6 +376,8 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
ssm
}else if(data!![position].msgBoxBean.type == MsgBoxType.AUTOPILOT){
autopilot
}else if(data!![position].msgBoxBean.type == MsgBoxType.FSM){
fsm
} else {
v2x
}
@@ -445,6 +462,14 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvAutopilotContent: TextView = itemView.findViewById(R.id.tvAutopilotContent)
}
//FSM状态消息(现阶段提示启动自驾失败消息过渡阶段提示未来展示fsm消息提醒)
class BubbleFSMHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var ivFSMImage: ImageView = itemView.findViewById(R.id.ivFSMImage)
var tvFSMTitle: TextView = itemView.findViewById(R.id.tvFSMTitle)
var tvFSMTime: TextView = itemView.findViewById(R.id.tvFSMTime)
var tvFSMContent: TextView = itemView.findViewById(R.id.tvFSMContent)
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}

View File

@@ -48,6 +48,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
private val summary: Int = 8 //汇总消息
private val ssm: Int = 9 //SSM连接消息
private val autopilot = 20 //工控机连接消息
private val fsm = 21 //fsm消息
private val none = -1
@@ -131,6 +132,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
.inflate(R.layout.item_msg_box_autopilot,parent,false)
return MsgBoxAutopilot(view)
}
fsm -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_fsm,parent,false)
return MsgBoxFSM(view)
}
else -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_v2x, parent, false)
@@ -696,6 +702,15 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
holder.tvAutopilotTime.text = TimeUtils.millis2String(autopilotMsg.timestamp,getHourMinFormat())
}
}
//fsm消息
is MsgBoxFSM ->{
data?.let {
val fsmMsg = it[position].bean as FSMMsg
holder.tvFSMTitle.text = fsmMsg.title
holder.tvFSMContent.text = fsmMsg.content
holder.tvFSMTime.text = TimeUtils.millis2String(fsmMsg.timestamp,getHourMinFormat())
}
}
}
}
@@ -736,6 +751,8 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
ssm
} else if(data!![position].type == MsgBoxType.AUTOPILOT){
autopilot
} else if(data!![position].type == MsgBoxType.FSM){
fsm
} else if(data!![position].type == MsgBoxType.V2X || data!![position].type == MsgBoxType.OBU){
v2x
} else {
@@ -852,4 +869,12 @@ class DriverMsgBoxListAdapter(private val activity: Activity) :
var tvAutopilotContent: TextView = itemView.findViewById(R.id.tvAutopilotContent)
}
//fsm状态
class MsgBoxFSM(itemView: View) : RecyclerView.ViewHolder(itemView){
var ivFSMImage: ImageView = itemView.findViewById(R.id.ivFSMImage)
var tvFSMTitle: TextView = itemView.findViewById(R.id.tvFSMTitle)
var tvFSMTime: TextView = itemView.findViewById(R.id.tvFSMTime)
var tvFSMContent: TextView = itemView.findViewById(R.id.tvFSMContent)
}
}

View File

@@ -212,6 +212,7 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
startLeakMonitor()
}
CallerDevaToolsManager.checkMonitorDb()
CallerDevaToolsManager.checkUploadCrashLog()
}
private fun startLeakMonitor() {

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_804"
android:layout_height="@dimen/dp_160"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_v2x"
android:layout_gravity="center_horizontal"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp">
<ImageView
android:id="@+id/ivFSMImage"
android:layout_width="110dp"
android:layout_height="110dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_margin="25dp"
android:src="@drawable/icon_warning_take_over"
/>
<TextView
android:id="@+id/tvFSMTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvFSMContent"
app:layout_constraintLeft_toRightOf="@id/ivFSMImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/dp_32"
/>
<TextView
android:id="@+id/tvFSMTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvFSMTitle"
app:layout_constraintBottom_toBottomOf="@id/tvFSMTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
<TextView
android:id="@+id/tvFSMContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvFSMTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvFSMTitle"
app:layout_constraintRight_toRightOf="@id/tvFSMTime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/dp_28"
android:maxLines="2"
android:ellipsize="end"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clFSMLayout"
android:layout_width="@dimen/dp_804"
android:layout_height="@dimen/dp_160"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_msg_box_v2x"
android:layout_gravity="center_horizontal"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
>
<ImageView
android:id="@+id/ivFSMImage"
android:layout_width="110dp"
android:layout_height="110dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_margin="25dp"
android:src="@drawable/icon_warning_take_over"
/>
<TextView
android:id="@+id/tvFSMTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvFSMContent"
app:layout_constraintLeft_toRightOf="@id/ivFSMImage"
android:layout_marginStart="@dimen/dp_15"
android:textColor="#FFFFFFFF"
android:textSize="@dimen/dp_32"
/>
<TextView
android:id="@+id/tvFSMTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvFSMTitle"
app:layout_constraintBottom_toBottomOf="@id/tvFSMTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
<TextView
android:id="@+id/tvFSMContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvFSMTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvFSMTitle"
app:layout_constraintRight_toRightOf="@id/tvFSMTime"
android:textColor="#B3FFFFFF"
android:textSize="@dimen/dp_28"
android:maxLines="2"
android:ellipsize="end"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,11 @@
package com.mogo.eagle.core.data.msgbox
/**
* fsm相关的消息
*/
data class FSMMsg(
val type: Int,
val title: String?,
val content: String?,
val timestamp : Long
)

View File

@@ -2,5 +2,5 @@ package com.mogo.eagle.core.data.msgbox
enum class MsgBoxType {
// 按功能划分为几大类运营、通知、V2X模块、OBU模块、工控机Report、录制、交通、FM、语音、SSM、工控机相关等
OPERATION, NOTICE, V2X, OBU, REPORT, RECORD, TRAFFIC, FMINFO, VOICE, SSMINFO, AUTOPILOT
OPERATION, NOTICE, V2X, OBU, REPORT, RECORD, TRAFFIC, FMINFO, VOICE, SSMINFO, AUTOPILOT, FSM
}

View File

@@ -34,6 +34,11 @@ interface IDevaToolsProvider : IProvider {
fun checkMonitorDb()
/**
* 检查上传崩溃日志
*/
fun checkUploadCrashLog()
/**
* 开始抓取日志默认10min
*/

View File

@@ -1,13 +1,45 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.msgbox.FSMMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.trace.CallerTrace
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import kotlin.properties.Delegates
object CallerAutopilotStatisticsListenerManager : CallerBase<IMoGoAutopilotStatisticsListener>() {
private var autopilotStatistics: AutopilotStatistics? by Delegates.observable(null) { _, _, newV ->
newV?.let {
if (!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isTakeoverRemind &&
it.status == AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.FSM,
FSMMsg(
0,
"自动驾驶启动失败",
it.failedMessage.msg,
System.currentTimeMillis()
)
)
)
} else {
CallerTrace.write("AutopilotStatistics", mapOf("autopilotStatistics" to it,
"isDemoMode" to FunctionBuildConfig.isDemoMode,
"isTakeoverRemind" to FunctionBuildConfig.isTakeoverRemind))
}
}
}
@Synchronized
fun invokeAutopilotStatistics(statistics: AutopilotStatistics?) {
autopilotStatistics = statistics
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotStatistics(statistics)

View File

@@ -42,6 +42,13 @@ object CallerDevaToolsManager {
devaToolsProviderApi?.checkMonitorDb()
}
/**
* 检查上传崩溃日志
*/
fun checkUploadCrashLog(){
devaToolsProviderApi?.checkUploadCrashLog()
}
/**
* 开始抓取全量日志
*/

View File

@@ -66,8 +66,6 @@ dependencies {
implementation rootProject.ext.dependencies.material
implementation rootProject.ext.dependencies.guava
compileOnly rootProject.ext.dependencies.apm_insight
implementation rootProject.ext.dependencies.gson
implementation rootProject.ext.dependencies.glideanno
implementation rootProject.ext.dependencies.glideokhttp3

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.utilcode.util
import android.os.Handler
import android.os.HandlerThread
import android.util.Log
import com.apm.insight.log.VLog
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
class VLogUtils {

View File

@@ -14,7 +14,6 @@ if (!isAndroidTest) {
apply from: rootProject.file('gradle/bytex/bytex_sticky_service.gradle')
apply from: rootProject.file('gradle/bytex/bytex_thread_opt.gradle')
apply from: rootProject.file('gradle/bytex/bytex_lancetx.gradle')
apply from: rootProject.file('gradle/bytex/bytex_apm.gradle')
apply from: rootProject.file('gradle/bytex/bytex_systrace.gradle')
apply from: rootProject.file('gradle/bytex/bytex_matrix.gradle')
apply from: rootProject.file('gradle/bytex/bytex_handler_proxy.gradle')

View File

@@ -1,24 +0,0 @@
apply plugin: 'apm-plugin'
ApmPlugin {
// 是否进行插桩
enable true
// 是否在Debug包插桩默认不插桩
enableInDebug true
// DEBUG("DEBUG"), INFO("INFO"), WARN("WARN"), ERROR("ERROR");
// INFO 级别Log会汇总所有被插桩处理的类供查看路径 app/build/ByteX/ApmPlugin
logLevel "DEBUG"
// 启动分析开关监控App启动耗时需要同时开启pageLoadSwitch
startSwitch = true
// 页面响应开关监控Activity的生命周期耗时
pageLoadSwitch = true
// 网络监控开关监控okhttp3的网络请求
okHttp3Switch = false
// 白名单下的包进行插桩,需要填写要插装类所在的包名,支持前缀配置
whiteList = [
"com.mogo"
]
// 黑名单包下类不进行插桩,可以配置包名和类名,没有可以填空
blackList = [
]
}

View File

@@ -54,8 +54,6 @@ dependencies {
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.apm_insight_crash
implementation rootProject.ext.dependencies.apm_insight
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
api rootProject.ext.dependencies.crashreport

View File

@@ -4,12 +4,6 @@ import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.apm.insight.ExitType;
import com.apm.insight.MonitorCrash;
import com.apm.insight.log.VLog;
import com.bytedance.apm.insight.ApmInsight;
import com.bytedance.apm.insight.ApmInsightAgent;
import com.bytedance.apm.insight.ApmInsightInitConfig;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.app.AppConfigInfo;
@@ -70,241 +64,18 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnNext(isDebug -> {
initCrash(context, isDebug);
initApmInsight(context, isDebug);
}).subscribe();
.subscribe();
}
private void initCrash(final Context context, boolean isDebug) {
MonitorCrash.Config config =
MonitorCrash.Config
.app(isDebug ? BYTEAMP_APPID_DEV : BYTEAMP_APPID)
.token(isDebug ? BYTEAMP_AppToken_DEV : BYTEAMP_AppToken)// 设置鉴权token可从平台应用信息处获取token错误无法上报数据
.versionCode(CommonUtils.getVersionCode(context))// 可选默认取PackageInfo中的versionCode
.versionName(CommonUtils.getVersionName(context))// 可选默认取PackageInfo中的versionName
.channel(FunctionBuildConfig.appIdentityMode)// 可选设置App发布渠道在平台可以筛选
// .url("www.xxx.com")// 默认不需要,私有化部署才配置上报地址
//可选,可以设置自定义 did不设置会使用内部默认的
.dynamicParams(new MonitorCrash.Config.IDynamicParams() {
@Override
public String getDid() {//返回空会使用内部默认的did
String sn = SharedPrefsMgr.getInstance().getString("sn");
if (sn != null && !sn.isEmpty()) {
return sn;
} else {
return DeviceUtils.getDeviceSN().isEmpty() ? null : DeviceUtils.getDeviceSN();
}
}
@Override
public String getUserId() {
return DeviceUtils.getDeviceSN();
}
})
//应用崩溃后会执行这里,可选,添加业务自定义数据,在崩溃详情页->现场数据展示->自定义数据
.customData(crashType -> {
//车辆所在位置
mCityCode = SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.LOCATION_CITY_CODE);
mLat = SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.LOCATION_LATITUDE);
mLogt = SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.LOCATION_LONGITUDE);
//车辆信息
String carInfoString = SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.CAR_INFO);
if (carInfoString != null && !carInfoString.isEmpty()) {
mInfo = GsonUtils.fromJson(carInfoString, CarInfo.class);
}
//======================================== 自定义维度值 begin========================================
HashMap<String, String> dimension = new HashMap<>();
// dimension.put("Devices_SN_DeviceId", sn + "__" + DeviceUtils.getDeviceSN());
// dimension.put("Devices_SN_WidevineID_MD5", sn + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
// dimension.put("Devices_SN_WidevineID", sn + "__" + DeviceIdUtils.getWidevineID(context));
//************************************* APP构建的信息 ***********************************************
// Git版本信息
dimension.put("GIT_BRANCH", AppConfigInfo.INSTANCE.getWorkingBranchName());
dimension.put("GIT_HASH", AppConfigInfo.INSTANCE.getWorkingBranchHash());
// 地图版本
dimension.put("APP_MAP_SDK_VERSION", DebugConfig.getMapVersion());
// 渠道信息
dimension.put("APP_CHANNEL", FunctionBuildConfig.appIdentityMode);
// 车辆类型
dimension.put("APP_CAR_TYPE", AppIdentityModeUtils.INSTANCE.getBuildCarType(FunctionBuildConfig.appIdentityMode));
//************************************* APP构建的信息 ***********************************************
//************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
// 连接的OBU 状态
dimension.put("OBU_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectObu());
// 车牌号,从工控机获取的数据
dimension.put("IPC_PLATE_NUMBER", AppConfigInfo.INSTANCE.getPlateNumber());
// 连接的工控机 状态
dimension.put("IPC_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectAutopilot());
// 连接的工控机 MAC地址
dimension.put("IPC_MAC", AppConfigInfo.INSTANCE.getIPCMacAddress());
// 连接的工控机 Docker版本
dimension.put("IPC_MAP_VERSION", AppConfigInfo.INSTANCE.getDockerVersion());
// 连接的工控机 Protocol版本
dimension.put("IPC_MAP_PROTOCOL_VERSION", "" + AppConfigInfo.INSTANCE.getProtocolVersionNumber());
//************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
//************************************* 位置信息 ***********************************************
// 城市信息
dimension.put("LOCATION_CITY_CODE", mCityCode);
dimension.put("LOCATION_LATITUDE", mLat);
dimension.put("LOCATION_LONGITUTE", mLogt);
//************************************* 位置信息 ***********************************************
//************************************* CMDB绑定的信息 ***********************************************
if (mInfo != null) {
dimension.put("CMDB_PLATE_NUMBER", mInfo.getNumber_plate());
dimension.put("CMDB_BRAND", mInfo.getBrand());
dimension.put("CMDB_MODEL", mInfo.getModel());
}
//************************************* CMDB绑定的信息 ***********************************************
HashMap<String, Double> metric = new HashMap<>();
//指标值
//metric.put("Devices_ID_metric", (double) 100);
ApmInsightAgent.monitorEvent("Devices_ID_EVENT", dimension, metric);
//======================================== 自定义维度值 end========================================
//===================================== 自定义收集一些信息,在崩溃详情页->现场数据展示->自定义数据 begin========================================
HashMap<String, String> map = new HashMap<>();
//************************************* APP构建的信息 ***********************************************
// Git版本信息
map.put("GIT_BRANCH", AppConfigInfo.INSTANCE.getWorkingBranchName());
map.put("GIT_HASH", AppConfigInfo.INSTANCE.getWorkingBranchHash());
// 地图版本
map.put("APP_MAP_SDK_VERSION", DebugConfig.getMapVersion());
// 渠道信息
map.put("APP_CHANNEL", FunctionBuildConfig.appIdentityMode);
// 车辆类型
map.put("APP_CAR_TYPE", AppIdentityModeUtils.INSTANCE.getBuildCarType(FunctionBuildConfig.appIdentityMode));
//************************************* APP构建的信息 ***********************************************
//************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
// 连接的OBU 状态
map.put("OBU_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectObu());
// 车牌号,从工控机获取的数据
map.put("IPC_PLATE_NUMBER", AppConfigInfo.INSTANCE.getPlateNumber());
// 连接的工控机 状态
map.put("IPC_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectAutopilot());
// 连接的工控机 MAC地址
map.put("IPC_MAC", AppConfigInfo.INSTANCE.getIPCMacAddress());
// 连接的工控机 Docker版本
map.put("IPC_MAP_VERSION", AppConfigInfo.INSTANCE.getDockerVersion());
// 连接的工控机 Protocol版本
map.put("IPC_MAP_PROTOCOL_VERSION", "" + AppConfigInfo.INSTANCE.getProtocolVersionNumber());
//************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
//************************************* 位置信息 ***********************************************
// 城市信息
map.put("LOCATION_CITY_CODE", mCityCode);
map.put("LOCATION_LATITUDE", mLat);
map.put("LOCATION_LONGITUTE", mLogt);
//************************************* 位置信息 ***********************************************
//************************************* CMDB绑定的信息 ***********************************************
if (mInfo != null) {
CallerLogger.d(TAG, "nuber = " + mInfo.getNumber_plate() + "--brand = " + mInfo.getBrand() + "--modle = " + mInfo.getModel());
map.put("CMDB_PLATE_NUMBER", mInfo.getNumber_plate());
map.put("CMDB_BRAND", mInfo.getBrand());
map.put("CMDB_MODEL", mInfo.getModel());
}
//************************************* CMDB绑定的信息 ***********************************************
return map;
//===================================== 自定义收集一些信息,在崩溃详情页->现场数据展示->自定义数据 end========================================
})
// 可选添加pv事件的自定义tag可以用来筛选崩溃率计算的分母数据
//.pageViewTags(<<Map<String, String>>>)
.exitType(ExitType.ALL) // 上报应用退出原因
.crashProtect(true) // 开启崩溃防护
.build();
MonitorCrash monitorCrash = MonitorCrash.init(context, config);
}
/**
* ApmInsight性能监控初始化
*/
private void initApmInsight(Context context, boolean isDebug) {
ApmInsightInitConfig.Builder builder = ApmInsightInitConfig.builder();
//设置分配的appid
builder.aid(isDebug ? BYTEAMP_APPID_DEV : BYTEAMP_APPID);
//设置分配的AppToken
builder.token(isDebug ? BYTEAMP_AppToken_DEV : BYTEAMP_AppToken);
//是否开启卡顿功能
builder.blockDetect(true);
//是否开启严重卡顿功能
builder.seriousBlockDetect(true);
//是否开启流畅性和丢帧
builder.fpsMonitor(true);
//控制是否打开WebVeiw监控
builder.enableWebViewMonitor(true);
//控制是否打开内存监控
builder.memoryMonitor(true);
//控制是否打开电量监控
builder.batteryMonitor(true);
//控制是否打开CPU监控
builder.cpuMonitor(true);
//控制是否打开磁盘监控
builder.diskMonitor(true);
//控制是否打开流量监控
builder.trafficMonitor(true);
//是否打印日志线上release版本要配置为false
builder.debugMode(true);
//支持用户自定义user_id把平台数据和自己用户关联起来可以不配置
// builder.userId(MoGoAiCloudClientConfig.getInstance().getSn());
//私有化部署:配置数据上报的域名 私有化部署才需要配置内部有默认域名测试支持设置http://www.xxx.com 默认是https协议
// builder.defaultReportDomain("www.xxx.com");
//设置渠道。1.3.16版本增加接口
builder.channel(FunctionBuildConfig.appIdentityMode);
//打开自定义日志回捞能力1.4.1版本新增接口
builder.enableLogRecovery(true);
//设置数据和Rangers Applog数据打通设备标识did必填。1.3.16版本增加接口
// builder.setDynamicParams(new IDynamicParams() {
// @Override
// public String getUserUniqueID() {
// //可选。依赖AppLog可以通过AppLog.getUserUniqueID()获取否则可以返回null。
// return null;
// }
//
// @Override
// public String getAbSdkVersion() {
// //可选。如果依赖AppLog可以通过AppLog.getAbSdkVersion()获取否则可以返回null。
// return null;
// }
//
// @Override
// public String getSsid() {
// //可选。依赖AppLog可以通过AppLog.getSsid()获取否则可以返回null。
// return null;
// }
//
// @Override
// public String getDid() {
// //1.4.0版本及以上可选其他版本必填。设备的唯一标识如果依赖AppLog可以通过 AppLog.getDid() 获取,也可以自己生成。
// return AppLog.getDid();
// }
// });
ApmInsight.getInstance().init(context, builder.build());
//初始化自定日志配置自定义日志最大占用磁盘内部一般配置20,代表最大20M磁盘占用。1.4.1版本开始存在这个api
VLog.init(context, 50);
}
@Override
public boolean uploadVlog(long startTime, long endTime) {
AtomicBoolean result = new AtomicBoolean(false);
CountDownLatch latch = new CountDownLatch(1);
ApmInsightAgent.uploadVlog(startTime, endTime, (success, msg) -> {
Log.d(TAG, "--- uploadVlog callback ---:" + success + ", msg:" + msg);
result.set(success);
latch.countDown();
});
try {
latch.await();
} catch (InterruptedException e) {