diff --git a/app/src/androidTest/java/com/mogo/functions/test/SafetyStopCarTest.kt b/app/src/androidTest/java/com/mogo/functions/test/SafetyStopCarTest.kt new file mode 100644 index 0000000000..cc7b7c34ff --- /dev/null +++ b/app/src/androidTest/java/com/mogo/functions/test/SafetyStopCarTest.kt @@ -0,0 +1,4 @@ +package com.mogo.functions.test + +class SafetyStopCarTest { +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt index cdf553419d..c6262754d8 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt @@ -11,6 +11,7 @@ import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.launcher.ARouter import com.mogo.commons.AbsMogoApplication import com.mogo.commons.debug.DebugConfig +import com.mogo.commons.voice.AIAssist import com.mogo.eagle.core.data.EnvConfig import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig.isShowRouteStrategy @@ -59,6 +60,7 @@ import com.zhjt.mogo_core_function_devatools.block.MoGoBlockProviderImpl import com.zhjt.mogo_core_function_devatools.coldstart.ColdStartManager import com.zhjt.mogo_core_function_devatools.driver.video.DriveSeatVideoProviderImpl import com.mogo.eagle.core.function.api.driver.video.IDriveSeatVideoProvider +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager import com.zhjt.mogo_core_function_devatools.exam.ExamControlManager import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter @@ -76,6 +78,7 @@ import com.zhjt.mogo_core_function_devatools.report.IPCReportManager.Companion.i import com.zhjt.mogo_core_function_devatools.scene.SceneManager.Companion.sceneManager import com.zhjt.mogo_core_function_devatools.status.StatusManager import com.zhjt.mogo_core_function_devatools.status.entity.RouteDownloadStatus +import com.zhjt.mogo_core_function_devatools.status.entity.SafetyStopCarStatus import com.zhjt.mogo_core_function_devatools.status.entity.Status import com.zhjt.mogo_core_function_devatools.status.ui.AutoPilotLaunchBeforeView import com.zhjt.mogo_core_function_devatools.strict.StrictModeProviderImpl @@ -87,6 +90,7 @@ import com.zhjt.mogo_core_function_devatools.weaknetwork.DetectResultImpl import com.zhjt.mogo_core_function_devatools.weaknetwork.WeakNetworkStrategy import com.zhjt.mogo_core_function_devatools.workorder.WorkOrderManager import com.zhjt.service.chain.ChainLog +import fsm.Fsm2024 import kotlinx.coroutines.delay import kotlinx.coroutines.launch import java.lang.ref.WeakReference @@ -142,6 +146,25 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener { listener.invoke(s.state.ordinal) } } + } else if (s is SafetyStopCarStatus) { + val state = s.data?.functionState + if (state != null) { + if (state == Fsm2024.State.SAFETY_STOP) { + if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { + AppStateManager.currentActivity()?.also { + AIAssist.getInstance(it).speakTTSVoice("识别故障即将停车,请注意观察,小心接管") + } + CallerHmiManager.toggleSafetyStopCarWarning(true) + } + } + if (state == Fsm2024.State.SAFETY_STOPPED) { + if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { + AppStateManager.currentActivity()?.also { + AIAssist.getInstance(it).speakTTSVoice("请接管恢复停车状态") + } + } + } + } } } val status = getExceptionStatusBeforeLaunchAutopilot(-2) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt index 9575316ac7..35b94870e5 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt @@ -29,6 +29,7 @@ import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.SpeedImpl import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.SteerImpl import com.zhjt.mogo_core_function_devatools.status.flow.can.CanImpl import com.zhjt.mogo_core_function_devatools.status.flow.fsm.FSMImpl +import com.zhjt.mogo_core_function_devatools.status.flow.fsm.SafetyStopCarImpl import com.zhjt.mogo_core_function_devatools.status.flow.gps.GpsImpl import com.zhjt.mogo_core_function_devatools.status.flow.ipc.IpcImpl import com.zhjt.mogo_core_function_devatools.status.flow.rtk.RTKImpl @@ -99,6 +100,7 @@ object StatusManager { is FSMStatus -> FSMImpl(ctx) is RouteDownloadStatus -> RouteDownloadImpl(ctx) is OtherErrorStatus -> OtherErrorImpl(ctx) + is SafetyStopCarStatus -> SafetyStopCarImpl(ctx) } }.also { flows += it } for (f in flows) { @@ -192,7 +194,7 @@ object StatusManager { } var xor = 0 model.status.value?.second?.filter { - it is IAutopilotPreLaunchStatus + it is IAutopilotBeforeLaunchStatus }?.takeIf { it.isNotEmpty() }?.also { l -> diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt index a64e0b0495..2c935728c6 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt @@ -18,6 +18,14 @@ import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.TRACK_LOAD_FAIL import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.TRACK_NOT_EXIST import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.UNKNOWN +import fsm.Fsm2024 + +interface IAutopilotLaunchStatus + +interface IAutopilotBeforeLaunchStatus: IAutopilotLaunchStatus + +interface IAutopilotAfterLaunchStatus: IAutopilotLaunchStatus + sealed class Status(var rawData: Any? = null) { @@ -143,7 +151,7 @@ enum class FSMStateCode { /** * FSM模块状态 */ -class FSMStatus(var state: FSMStateCode, var descList: List = emptyList()): Status(), IAutopilotPreLaunchStatus { +class FSMStatus(var state: FSMStateCode, var descList: List = emptyList()): Status(), IAutopilotBeforeLaunchStatus { override fun equals(other: Any?): Boolean { if (javaClass != other?.javaClass) return false @@ -342,12 +350,11 @@ fun String.toState(msg: String?): Tracing? { } } -interface IAutopilotPreLaunchStatus /** * 速度 */ -data class SpeedStatus(val speed: Int): Status(), IAutopilotPreLaunchStatus { +data class SpeedStatus(val speed: Int): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { return false @@ -368,7 +375,7 @@ data class SpeedStatus(val speed: Int): Status(), IAutopilotPreLaunchStatus { /** * 方向盘转角 */ -data class SteerStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { +data class SteerStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { @@ -394,7 +401,7 @@ data class SteerStatus(val angle: Float, var isError: Boolean = false): Status() /** * 油门 */ -data class AcceleratorStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { +data class AcceleratorStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING @@ -423,7 +430,7 @@ data class AcceleratorStatus(val angle: Int, var isError: Boolean = false): Stat /** * 刹车 */ -data class BrakeStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { +data class BrakeStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING @@ -456,7 +463,7 @@ data class BrakeStatus(val angle: Int, var isError: Boolean = false): Status(), /** * 双闪 */ -data class DoubleFlashStatus(val type: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { +data class DoubleFlashStatus(val type: Int, var isError: Boolean = false): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING @@ -487,7 +494,7 @@ data class DoubleFlashStatus(val type: Int, var isError: Boolean = false): Statu /** * 由于其它原因导致的启自驾异常 */ -data class OtherErrorStatus(val type: UnableType?, val reason: UnableLaunchReason?): Status(), IAutopilotPreLaunchStatus { +data class OtherErrorStatus(val type: UnableType?, val reason: UnableLaunchReason?): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { return type != null || reason != null @@ -501,7 +508,7 @@ data class OtherErrorStatus(val type: UnableType?, val reason: UnableLaunchReaso /** * 挡位 */ -data class GearStatus(val value: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { +data class GearStatus(val value: Int, var isError: Boolean = false): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING @@ -543,7 +550,7 @@ enum class RouteState { /** * 轨迹下载状态 */ -data class RouteDownloadStatus(val lineId: Long = Long.MIN_VALUE, val state: RouteState = RouteNone): Status(), IAutopilotPreLaunchStatus { +data class RouteDownloadStatus(val lineId: Long = Long.MIN_VALUE, val state: RouteState = RouteNone): Status(), IAutopilotBeforeLaunchStatus { override fun isException(): Boolean { return (state == RouteStart || state == RouteFailed) && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING @@ -573,4 +580,27 @@ data class RouteDownloadStatus(val lineId: Long = Long.MIN_VALUE, val state: Rou } +/*** + * FSM功能异常,触发安全停车 + */ +data class SafetyStopCarStatus(val data: Fsm2024.FSMStateMsg? = null): Status(), IAutopilotAfterLaunchStatus { + + override fun isException(): Boolean { + return data?.functionState == Fsm2024.State.SAFETY_STOP + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + other as SafetyStopCarStatus + return this.data?.functionState == other.data?.functionState + + } + + override fun hashCode(): Int { + return this.data?.functionState?.hashCode() ?: 0 + } +} + + diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/fsm/SafetyStopCarImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/fsm/SafetyStopCarImpl.kt new file mode 100644 index 0000000000..9c14dcf911 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/fsm/SafetyStopCarImpl.kt @@ -0,0 +1,32 @@ +package com.zhjt.mogo_core_function_devatools.status.flow.fsm + +import android.content.Context +import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener +import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager +import com.zhjt.mogo_core_function_devatools.status.entity.SafetyStopCarStatus +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow +import fsm.Fsm2024 +import fsm.Fsm2024.FSMStateMsg + +internal class SafetyStopCarImpl(ctx: Context): IFlow(ctx), IMoGoFsm2024Listener { + + companion object { + private const val TAG = "SafetyStopCarImpl" + } + + override fun onCreate() { + CallerFsm2024ListenerManager.addListener(TAG, this) + } + + + override fun onFSM2024State(fsmState: FSMStateMsg) { + if (fsmState.functionState == Fsm2024.State.SAFETY_STOP || fsmState.functionState == Fsm2024.State.SAFETY_STOPPED) { + send(SafetyStopCarStatus(fsmState)) + } + } + + override fun onDestroy() { + super.onDestroy() + CallerFsm2024ListenerManager.removeListener(TAG) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt index b7ceb9a117..4bc25acfb2 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt @@ -29,6 +29,7 @@ internal class StatusModel : ViewModel() { it += OtherErrorStatus(null, null) it += RouteDownloadStatus() it += SpeedStatus(0) + it += SafetyStopCarStatus() }) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/AutoPilotLaunchBeforeView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/AutoPilotLaunchBeforeView.kt index 4bdb9850f9..270d189f4c 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/AutoPilotLaunchBeforeView.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/AutoPilotLaunchBeforeView.kt @@ -22,7 +22,7 @@ import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus import com.zhjt.mogo_core_function_devatools.status.entity.BrakeStatus import com.zhjt.mogo_core_function_devatools.status.entity.DoubleFlashStatus import com.zhjt.mogo_core_function_devatools.status.entity.GearStatus -import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotPreLaunchStatus +import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotBeforeLaunchStatus import com.zhjt.mogo_core_function_devatools.status.entity.SpeedStatus import com.zhjt.mogo_core_function_devatools.status.entity.Status import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus @@ -66,7 +66,7 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener { @SuppressLint("SetTextI18n") override fun onStatusChanged(changed: List, all: List) { - changed.filter { it is IAutopilotPreLaunchStatus }.forEach { status -> + changed.filter { it is IAutopilotBeforeLaunchStatus }.forEach { status -> val isError = status.isException() && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING Logger.d(TAG, "--- onChanged ---:$isError") when(status) { diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt index 7d27a8bda0..5594c5f677 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt @@ -9,8 +9,7 @@ import androidx.recyclerview.widget.* import com.mogo.eagle.core.utilcode.kotlin.* import com.mogo.eagle.core.utilcode.rv.divider.* import com.zhjt.mogo_core_function_devatools.R -import com.zhjt.mogo_core_function_devatools.status.entity.FSMStatus -import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotPreLaunchStatus +import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotLaunchStatus import com.zhjt.mogo_core_function_devatools.status.entity.Status import com.zhjt.mogo_core_function_devatools.status.model.StatusModel import com.zhjt.mogo_core_function_devatools.status.ui.adapter.StatusAdapter @@ -36,12 +35,12 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra override fun onAttachedToWindow() { super.onAttachedToWindow() - val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second.filter { it !is IAutopilotPreLaunchStatus }) }?.also { adapter -> rv.adapter = adapter } + val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second.filter { (it !is IAutopilotLaunchStatus) }) }?.also { adapter -> rv.adapter = adapter } adapter?.let { _ -> observer?.also { model.status.removeObserver(it) } model.status.observeForever(Observer>> { data -> val old = adapter.data - val update = data.second.filter { it !is IAutopilotPreLaunchStatus } + val update = data.second.filter { it !is IAutopilotLaunchStatus } val result = DiffUtil.calculateDiff(StatusDiffCallback(old, update)) adapter.data = update result.dispatchUpdatesTo(adapter) @@ -65,10 +64,6 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra .build() ) } - -// onDetach { -// observer?.also { model.status.removeObserver(it) } -// } } override fun onVisibilityChanged(changedView: View, visibility: Int) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/status/StartAutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/status/StartAutoPilotStatusView.kt index ecb7e589d9..8710c64a88 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/status/StartAutoPilotStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/status/StartAutoPilotStatusView.kt @@ -21,7 +21,7 @@ import com.zhjt.mogo_core_function_devatools.status.entity.DoubleFlashStatus import com.zhjt.mogo_core_function_devatools.status.entity.FSMStateCode import com.zhjt.mogo_core_function_devatools.status.entity.FSMStatus import com.zhjt.mogo_core_function_devatools.status.entity.GearStatus -import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotPreLaunchStatus +import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotBeforeLaunchStatus import com.zhjt.mogo_core_function_devatools.status.entity.Status import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus import kotlinx.android.synthetic.main.view_start_autopilot_status.view.fSMStatusLayout @@ -250,7 +250,7 @@ class StartAutoPilotStatusView @JvmOverloads constructor( * @param all: 所有状态数据 */ override fun onStatusChanged(changed: List, all: List) { - changed.filter { it is IAutopilotPreLaunchStatus }.forEach { status -> + changed.filter { it is IAutopilotBeforeLaunchStatus }.forEach { status -> Logger.d(TAG, "onStatusChanged --> ${status::class.simpleName}") when (status) { is FSMStatus -> { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt index 1750383276..822c87ecd4 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt @@ -7,6 +7,12 @@ import android.view.Gravity import android.view.View import android.view.ViewGroup import android.view.ViewStub +import android.view.WindowManager +import android.view.animation.AccelerateDecelerateInterpolator +import android.widget.FrameLayout +import androidx.core.content.ContextCompat +import androidx.core.view.ViewCompat +import androidx.core.view.doOnAttach import androidx.lifecycle.ProcessLifecycleOwner import androidx.lifecycle.lifecycleScope import androidx.transition.Slide @@ -61,6 +67,7 @@ import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView import com.mogo.eagle.core.function.hmi.xiaozhi.XiaoZhiStateManager import com.mogo.eagle.core.utilcode.floating.MoGoPopWindow import com.mogo.eagle.core.utilcode.kotlin.safeCancel +import com.mogo.eagle.core.utilcode.kotlin.scope 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_HMI @@ -107,6 +114,11 @@ class MoGoHmiProvider : IMoGoHmiProvider { */ private val popOfVisualAngleAdjust by lazy { AtomicReference>() } + /** + * fsm异常触发异常停车弹窗 + */ + private val popOfSafetyStopCar by lazy { AtomicReference>() } + override fun init(context: Context?) { this.context = context } @@ -599,4 +611,39 @@ class MoGoHmiProvider : IMoGoHmiProvider { } } + override fun toggleSafeStopCarWarning(show: Boolean) { + val activity = AppStateManager.currentActivity() ?: return + val old = popOfSafetyStopCar.get()?.get() + if (show) { + if (old != null && old.isShowing()) { + return + } + val content = FrameLayout(activity) + ViewCompat.setBackground(content, ContextCompat.getDrawable(activity, R.drawable.fg_fsm_exception_status)) + content.scope.launch { + while (true) { + content.animate().setInterpolator(AccelerateDecelerateInterpolator()).alpha(0f).setDuration(500).start() + delay(500) + content.animate().setInterpolator(AccelerateDecelerateInterpolator()).alpha(1.0f).setDuration(500).start() + delay(500) + } + } + MoGoPopWindow.Builder() + .attachToActivity(activity) + .width(WindowManager.LayoutParams.MATCH_PARENT) + .height(WindowManager.LayoutParams.MATCH_PARENT) + .contentView(content) + .onDismissed { + popOfSafetyStopCar.set(null) + } + .build() + .also { + popOfSafetyStopCar.set(WeakReference(it)) + it.show() + } + } else { + old?.takeIf { it.isShowing() }?.also { it.hide() } + } + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/fg_fsm_exception_status.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/fg_fsm_exception_status.png new file mode 100644 index 0000000000..8bd86dc16c Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/fg_fsm_exception_status.png differ diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt index a06852b5cd..d321b82c0f 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt @@ -312,4 +312,9 @@ interface IMoGoHmiProvider :IProvider{ * 展示冷启动弹窗 */ fun showColdStartWindow() + + /** + * 是否触发展示安全停车弹窗 + */ + fun toggleSafeStopCarWarning(show: Boolean) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 09cfc17552..4c7f9518f4 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -455,4 +455,11 @@ object CallerHmiManager { hmiProviderApi?.showColdStartWindow() } + /** + * 是否触发展示安全停车弹窗 + */ + fun toggleSafetyStopCarWarning(show: Boolean) { + hmiProviderApi?.toggleSafeStopCarWarning(show) + } + } \ No newline at end of file