[dev_arch_opt_3.0]

[Change]
[1、将Call中注册,反注册操作下沉CallerBase]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-01-04 20:00:32 +08:00
parent 9559cfc131
commit 06810f339c
54 changed files with 373 additions and 1454 deletions

View File

@@ -49,14 +49,14 @@ class PncActionsView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotPlanningActionsListenerManager.addListener(TAG, this)
CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
CallerTrafficLightListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotPlanningActionsListenerManager.removeListener(TAG)
CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
CallerTrafficLightListenerManager.removeListener(TAG)
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {

View File

@@ -7,7 +7,6 @@ import android.content.ClipboardManager
import android.content.Context
import android.graphics.Color
import android.os.Build
import android.telecom.Call
import android.text.Html
import android.util.AttributeSet
import android.view.LayoutInflater
@@ -48,6 +47,7 @@ import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListen
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.business.routeoverlay.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
@@ -60,6 +60,7 @@ import com.mogo.eagle.core.function.call.map.CallerSmpManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
@@ -71,18 +72,15 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.*
import com.mogo.eagle.core.function.business.routeoverlay.*
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission
import com.zhidao.easysocket.utils.L
import com.zhjt.mogo_core_function_devatools.env.*
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import java.text.SimpleDateFormat
@@ -100,11 +98,17 @@ class DebugSettingView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener,
IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener,
IMoGoAutopilotPlanningListener,
IMoGoAutopilotVehicleStateListener, IMoGoDevaToolsFuncConfigListener {
) : ConstraintLayout(context, attrs, defStyleAttr),
IMoGoObuStatusListener,
IMoGoAutopilotStatusListener,
IMoGoAutopilotCarStateListener,
IMoGoMapLocationListener,
IMoGoAutopilotIdentifyListener,
IMoGoAutopilotPlanningListener,
IMoGoAutopilotVehicleStateListener,
IMoGoDevaToolsFuncConfigListener,
IMoGoChassisLamplightListener,
IMoGoDevaToolsListener{
private val TAG = "DebugSettingView"
@@ -197,6 +201,8 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutopilotPlanningListenerManager.addListener(TAG, this)
//添加 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.addListener(TAG, this)
//添加 开发套件工具接口 监听
CallerDevaToolsListenerManager.addListener(TAG, this)
//添加 业务配置监听
CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener(
@@ -230,6 +236,8 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutopilotPlanningListenerManager.removeListener(TAG)
// 移除 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
// 移除 开发套件工具接口 监听
CallerDevaToolsListenerManager.removeListener(TAG)
// 移除 业务配置监听
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( FuncBizConfig.FOUNDATION, TAG)
@@ -1385,54 +1393,6 @@ class DebugSettingView @JvmOverloads constructor(
CallerDevaToolsManager.stopCatchLog()
}
}
CallerDevaToolsListenerManager.registerDevaToolsLogCatchListener(TAG,
object : IMoGoDevaToolsListener {
override fun onLogCatchStart() {
super.onLogCatchStart()
tbLogCatch.isChecked = true
}
override fun onLogCatchClose() {
super.onLogCatchClose()
tbLogCatch.isChecked = false
}
override fun onLogCatch(lineLog: String) {
logInfoView?.let {
if (logViewAttach) {
it.onLogCatch(lineLog)
}
}
}
override fun fwThreadClose() {
refreshTraceInfo()
}
override fun moduleLogChanged(moduleTag: MutableMap<String, SceneModule>) {
//模块日志 tag 发生变化,需要更新对应 UI
setLogCheckedChangeListener()
}
override fun upgradeVersionUrls(urls: Map<String, String>?) {
//版本信息更新
urls?.let {
upgradeVersionList.clear()
it.iterator().forEach { map ->
val name =
if (map.key.contains("{")) map.key.replace("{", "") else map.key
val url = if (map.value.contains("}")) map.value.replace(
"}",
""
) else map.value
upgradeVersionList.add(UpgradeVersionEntity(name.trim(), url))
}
upgradeVersionList.sortByDescending { upgradeVersionEntity -> upgradeVersionEntity.name }
upgradeListAdapter?.setDada(dataFilter(upgradeVersionList))
upgradeListAdapter?.notifyDataSetChanged()
}
}
})
/**
* 展示、关闭日志过滤面板
@@ -2233,5 +2193,50 @@ class DebugSettingView @JvmOverloads constructor(
fun showReportListWindow(show: Boolean)
}
override fun onLogCatchStart() {
super.onLogCatchStart()
tbLogCatch.isChecked = true
}
override fun onLogCatchClose() {
super.onLogCatchClose()
tbLogCatch.isChecked = false
}
override fun onLogCatch(lineLog: String) {
logInfoView?.let {
if (logViewAttach) {
it.onLogCatch(lineLog)
}
}
}
override fun fwThreadClose() {
refreshTraceInfo()
}
override fun moduleLogChanged(moduleTag: MutableMap<String, SceneModule>) {
//模块日志 tag 发生变化,需要更新对应 UI
setLogCheckedChangeListener()
}
override fun upgradeVersionUrls(urls: Map<String, String>?) {
//版本信息更新
urls?.let {
upgradeVersionList.clear()
it.iterator().forEach { map ->
val name =
if (map.key.contains("{")) map.key.replace("{", "") else map.key
val url = if (map.value.contains("}")) map.value.replace(
"}",
""
) else map.value
upgradeVersionList.add(UpgradeVersionEntity(name.trim(), url))
}
upgradeVersionList.sortByDescending { upgradeVersionEntity -> upgradeVersionEntity.name }
upgradeListAdapter?.setDada(dataFilter(upgradeVersionList))
upgradeListAdapter?.notifyDataSetChanged()
}
}
}

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.util.AttributeSet;
@@ -32,8 +34,6 @@ import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
* @author Jing
* @description 方向盘
@@ -185,22 +185,6 @@ public class SteeringWheelView extends ConstraintLayout {
}
/**
* 车辆转向灯
* @param lightSwitch
*/
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
}
/**
* 刹车灯
* @param brakeLight
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
}
/**
* 车辆加速度
* @param carAcc

View File

@@ -274,7 +274,7 @@ class SystemVersionView @JvmOverloads constructor(
return
}
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerBindingCarListenerManager.registerDevaToolsLogCatchListener(TAG,this)
CallerBindingCarListenerManager.addListener(TAG,this)
needQueryContainers = true
}
@@ -284,7 +284,7 @@ class SystemVersionView @JvmOverloads constructor(
return
}
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerBindingCarListenerManager.unRegisterDevaToolsLogCatchListener(TAG)
CallerBindingCarListenerManager.removeListener(TAG)
needQueryContainers = false
}

View File

@@ -27,7 +27,6 @@ import org.jetbrains.annotations.NotNull;
import chassis.Chassis;
import chassis.VehicleStateOuterClass;
import mogo.telematics.pad.MessagePad;
/**
* @author Jing
@@ -127,26 +126,6 @@ public class TrafficDataView extends ConstraintLayout {
public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) {
}
/**
* 车辆转向灯
* @param lightSwitch
*/
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
if (lightSwitch != null) {
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
}
}
/**
* 刹车灯
* @param brakeLight
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight);
}
/**
* 方向盘转向角 左+右-
* @param steering

View File

@@ -2,8 +2,8 @@ package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.app.NotificationManager;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Process;
@@ -27,7 +27,6 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb;
import com.mogo.eagle.core.function.overview.OverviewDb;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
@@ -136,6 +135,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}).start();
}
// TODO 李小鹏 这里需要将逻辑抽离出去,单独使用更新服务控制
private void upgradeProgressListener() {
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
// builder.setSmallIcon(R.mipmap.icon1001);//todo emArrow 更换图标,去除地图下载图标的依赖关系
@@ -143,7 +143,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
builder.setContentText("正在下载");
final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
CallerDevaToolsUpgradeListenerManager.INSTANCE.registerDevaToolsUpgradeListener(TAG, new IMogoDevaToolsUpgradeListener() {
CallerDevaToolsUpgradeListenerManager.INSTANCE.addListener(TAG, new IMogoDevaToolsUpgradeListener() {
@Override
public void onStart(@Nullable String url) {