diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt index 31d352aaee..5aa3369d3d 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt @@ -2,6 +2,9 @@ package com.mogo.eagle.function.biz.v2x.busstation import android.os.Handler import android.os.HandlerThread +import androidx.lifecycle.ProcessLifecycleOwner +import androidx.lifecycle.lifecycleScope +import com.mogo.commons.utils.MogoAnalyticUtils import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.enums.EventTypeEnumNew @@ -39,10 +42,12 @@ import kotlin.random.Random object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { const val TAG = "PassBusStationEventManager" + const val ANALYTICS_KEY = "biz_v2x_road_pass_bus_station_manager" private val coroutineExceptionHandler = CoroutineExceptionHandler { coroutineContext, exception -> Logger.e(TAG, "coroutineExceptionHandler --> Handle $exception in $coroutineContext") + trackEvent("coroutineExceptionHandler --> Handle $exception in $coroutineContext") isCalculateNearByStation.set(false) } @@ -123,6 +128,7 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { if (angle >= 90) { CallerRoadV2NEventWindowListenerManager.dismiss(it.getBusStationId()) busStationListNeedNotified.remove(it.getBusStationId()) + trackEvent("dismiss --> busStationId=${it.getBusStationId()}") Logger.d( TAG, "removeNeedNotifiedBusStation --> ${it.toString()}" @@ -181,6 +187,7 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { ).toString() ).toString() ) + trackEvent("showBusStationNotification --> ${it.toString()}") Logger.d( TAG, "showBusStationNotification --> ${it.toString()}" @@ -207,6 +214,7 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { fun init() { CallerChassisLocationWGS84ListenerManager.addListener(TAG, 1, this) handler?.post(checkDistanceRunnable) + trackEvent("init") } fun unInit() { @@ -217,6 +225,7 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { handler?.removeCallbacks(checkDistanceRunnable) handler?.removeCallbacks(notificationCheckRunnable) handler?.looper?.quit() + trackEvent("unInit") } override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { @@ -282,6 +291,17 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { } } + fun trackEvent(msg: String) { + ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.IO) { + val map: MutableMap = HashMap() + map["msg"] = msg + MogoAnalyticUtils.track( + ANALYTICS_KEY, + map + ) + } + } + private var hasShownBorderPointHDMarker = false private fun busStationHDMarkerStrategy() { if (HmiBuildConfig.isShowBusStationStrategyBorderPoint) {