From 1ce99f8cdb11c03376a916bdeaf9c92b4f872089 Mon Sep 17 00:00:00 2001 From: renwj Date: Mon, 9 May 2022 17:09:31 +0800 Subject: [PATCH] =?UTF-8?q?[BadCase]BadCase=E5=85=A5=E5=8F=A3=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E8=B6=85=E8=BF=874=E5=B0=8F=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 8 ++++---- .../functions/test/AutoPilotBadCaseTest.kt | 1 + .../autopilot/adapter/MoGoAdasListenerImpl.kt | 2 ++ .../badcase/BadCaseManager.kt | 3 ++- .../IMoGoAutopilotVehicleStateListener.kt | 1 - ...lerAutopilotVehicleStateListenerManager.kt | 19 +++++++++++++++---- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aed4fbd960..14008b885a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,9 +25,9 @@ if (!isAndroidTestBuild()) { } } -//if (!isAndroidTestBuild()) { +if (!isAndroidTestBuild()) { apply plugin: 'apm-plugin' -//} +} //if (!isAndroidTestBuild()) { // apply plugin: 'bytex.threadOpt' @@ -265,7 +265,7 @@ dependencies { androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core } -//if (!isAndroidTestBuild()) { +if (!isAndroidTestBuild()) { ApmPlugin { // 是否进行插桩 enable true @@ -289,7 +289,7 @@ dependencies { ] } -//} +} android.applicationVariants.all { variant -> def buildTime = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00")) diff --git a/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt b/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt index 41984bba30..766ef7cb4e 100644 --- a/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt +++ b/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt @@ -33,6 +33,7 @@ class AutoPilotBadCaseTest { @Test fun showBadCaseEntrance1(): Unit = runBlocking(Dispatchers.Main) { ensureMoGoHmiFragmentShow() + delay(TimeUnit.MILLISECONDS.toSeconds(30)) var index = 0 (1 until 50) .map { it } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index dafacd5491..2deec258b6 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -175,6 +175,8 @@ class MoGoAdasListenerImpl : OnAdasListener { autopilotState: MessagePad.AutopilotState? ) { if (autopilotState != null) { + //工控机模拟时间 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotTime(header.timestamp.toLong()) if (HdMapBuildConfig.isMapLoaded) { // 初始化自动驾驶状态信息 val autopilotStatusInfo = getAutoPilotStatusInfo() diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt index 930224fd9d..6bb8c3fdae 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt @@ -14,6 +14,7 @@ import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.lifecycleScope import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA import com.mogo.eagle.core.utilcode.kotlin.PX import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger @@ -193,7 +194,7 @@ internal object BadCaseManager : LifecycleEventObserver { private fun CoroutineScope.showBadCaseInternal(record: AutoPilotRecord) = launch { viewHolder?.get()?.also { itx -> - presenter.updateLastModified(record.toLongTime()) + presenter.updateLastModified(CallerAutopilotVehicleStateListenerManager.getAutopilotTimeStamp()) showEntry() itx.onClick { showBadCaseFloat( diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt index 5ed01d9298..a980b68591 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt @@ -30,5 +30,4 @@ interface IMoGoAutopilotVehicleStateListener { * @param gear 档位 */ fun onAutopilotGearData(gear: Chassis.GearPosition) - } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt index 92dee2d168..f08725d29c 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt @@ -15,6 +15,9 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { private val M_AUTOPILOT_VEHICLE_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() + @Volatile + private var timeStamp: Long = 0L + /** * 添加 ADAS车辆状态&定位 监听 * @param tag 标记,用来注销监听使用 @@ -57,7 +60,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * 车辆转向灯数据回调 * @param lightSwitch */ - @Synchronized fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) { M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value @@ -69,7 +71,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * 车辆刹车灯数据回调 * @param brakeLight */ - @Synchronized fun invokeAutopilotBrakeLightData(brakeLight: Boolean) { M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value @@ -81,7 +82,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * 车辆方向盘转向角回调 * @param steering 方向盘转向角 */ - @Synchronized fun invokeAutopilotSteeringData(steering: Float){ M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ val listener = it.value @@ -93,7 +93,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * 车辆挂挡档位 * @param gear 档位 */ - @Synchronized fun invokeAutopilotGearData(gear: Chassis.GearPosition){ M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ val listener = it.value @@ -101,5 +100,17 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { } } + /** + * 工控机时间回调 + */ + fun invokeAutopilotTime(time: Long) { + this.timeStamp = time + } + /** + * 获取工控机的时间, 单位是秒 + */ + fun getAutopilotTimeStamp(): Long { + return this.timeStamp + } } \ No newline at end of file