Merge branch 'dev_robotaxi-d-app-module_2130_221116_2.13.0' into dev_arch_opt_3.0
This commit is contained in:
@@ -47,6 +47,8 @@ public class BusAnalyticsManager {
|
||||
}
|
||||
|
||||
private void triggerStartAutopilotFailureEvent(String failCode, String failMsg){
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
|
||||
CallerLogger.INSTANCE.e( M_BUS + "triggerStartAutopilotFailureEvent", failMsg );
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT
|
||||
, CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ==
|
||||
@@ -54,6 +56,8 @@ public class BusAnalyticsManager {
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG, failMsg);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@@ -69,6 +73,10 @@ public class BusAnalyticsManager {
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG, "");
|
||||
}
|
||||
|
||||
private void clearStartAutopilotParams(){
|
||||
mStartAutopilotParams.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发'开启自动驾驶'埋点流程
|
||||
* 开启自动驾驶,15s内成功则发送成功埋点,否则发送失败埋点
|
||||
@@ -99,6 +107,8 @@ public class BusAnalyticsManager {
|
||||
removeWaitingCallback();
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, BusConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
|
||||
@@ -52,12 +52,20 @@ public class TaxiAnalyticsManager {
|
||||
}
|
||||
|
||||
private void triggerStartAutopilotFailureEvent(String failCode, String failMsg){
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
|
||||
CallerLogger.INSTANCE.e(M_TAXI + "triggerStartAutopilotFailureEvent", failMsg);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT, false);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_MSG,
|
||||
failMsg);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
}
|
||||
|
||||
private void clearStartAutopilotParams(){
|
||||
mStartAutopilotParams.clear();
|
||||
}
|
||||
|
||||
public void clearStartAutopilotFailureMSG(){
|
||||
@@ -97,6 +105,8 @@ public class TaxiAnalyticsManager {
|
||||
removeWaitingCallback();
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, TaxiConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
|
||||
@@ -55,12 +55,14 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
} else {
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.SystemClock
|
||||
import android.util.*
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
|
||||
@@ -16,7 +18,6 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import kotlinx.coroutines.*
|
||||
@@ -64,33 +65,48 @@ object CallerVisualAngleManager {
|
||||
|
||||
private val beginLocation = AtomicReference<MogoLocation>()
|
||||
|
||||
private val distanceOfCarToStopLine = AtomicReference<Double>()
|
||||
|
||||
private val listener = object : OnRoadListener {
|
||||
private var roadId = ""
|
||||
|
||||
override fun onRoadIdInfo(roadId: String) {
|
||||
val oldRoadId = this.roadId
|
||||
if (oldRoadId != roadId) {
|
||||
if (hasCrossRoad) {
|
||||
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.roadId} -> curr: $roadId")
|
||||
val startLoc = beginLocation.get()
|
||||
val currLoc = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
var triggerClose = false
|
||||
val distance = distanceOfCarToStopLine.get()
|
||||
if (hasCrossRoad && distance > 0 && oldRoadId != roadId && startLoc != null && currLoc != null && CoordinateUtils.calculateLineDistance(startLoc.longitude, startLoc.latitude, currLoc.longitude, currLoc.latitude).also {
|
||||
Log.d(TAG, "d1: $it, d2: $distance")
|
||||
} >= distance) {
|
||||
distanceOfCarToStopLine.set(0.0)
|
||||
hasCrossRoad = false
|
||||
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
|
||||
triggerClose = true
|
||||
}
|
||||
if (!triggerClose && hasCrossRoad && oldRoadId == roadId) {
|
||||
val beginLoc = beginLocation.get()
|
||||
val endLoc = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
if (beginLoc != null && endLoc != null && abs(beginLoc.bearing - endLoc.bearing) >= 170) {
|
||||
Log.d(TAG, "-- onRoadIdInfo --: trigger close 2 --")
|
||||
triggerClose = true
|
||||
hasCrossRoad = false
|
||||
changeVisualAngle(CrossRoad(false))
|
||||
}
|
||||
} else {
|
||||
if (hasCrossRoad) {
|
||||
val beginLoc = beginLocation.get()
|
||||
val endLoc = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
if (beginLoc != null && endLoc != null && abs(beginLoc.bearing - endLoc.bearing) >= 170) {
|
||||
hasCrossRoad = false
|
||||
changeVisualAngle(CrossRoad(false))
|
||||
}
|
||||
beginLocation.set(null)
|
||||
}
|
||||
}
|
||||
if (triggerClose) {
|
||||
changeVisualAngle(CrossRoad(false))
|
||||
}
|
||||
this.roadId = roadId
|
||||
}
|
||||
|
||||
|
||||
override fun onStopLineInfo(info: StopLine) {
|
||||
Log.d(TAG, "-- onStopLineInfo --: ${info.distanceOfCarToStopLine}")
|
||||
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
|
||||
hasCrossRoad = true
|
||||
distanceOfCarToStopLine.set(info.distanceOfCarToStopLine)
|
||||
beginLocation.set(CallerMapLocationListenerManager.getCurrentLocation())
|
||||
changeVisualAngle(CrossRoad(true))
|
||||
}
|
||||
@@ -150,6 +166,10 @@ object CallerVisualAngleManager {
|
||||
|
||||
override val displayThreshold: Long
|
||||
get() = -1
|
||||
|
||||
override fun toString(): String {
|
||||
return "Turning(open: ${open}, priority=$priority, displayThreshold: $displayThreshold, priority=$priority)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,6 +183,10 @@ object CallerVisualAngleManager {
|
||||
|
||||
override val displayThreshold: Long
|
||||
get() = SECONDS.toMillis(8)
|
||||
|
||||
override fun toString(): String {
|
||||
return "TooClose(priority=$priority, displayThreshold: $displayThreshold, priority=$priority)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,6 +200,10 @@ object CallerVisualAngleManager {
|
||||
|
||||
override val displayThreshold: Long
|
||||
get() = SECONDS.toMillis(8)
|
||||
|
||||
override fun toString(): String {
|
||||
return "RoadEvent(priority=${priority}, displayThreshold: ${displayThreshold}, priority=${priority})"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -187,6 +215,10 @@ object CallerVisualAngleManager {
|
||||
override val priority: Int = 4
|
||||
override val displayThreshold: Long
|
||||
get() = -1
|
||||
|
||||
override fun toString(): String {
|
||||
return "CrossRoad(open: ${open}, priority=${priority}, displayThreshold: ${displayThreshold}, priority=${priority})"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,77 +248,88 @@ object CallerVisualAngleManager {
|
||||
}
|
||||
val triggerTime = SystemClock.elapsedRealtime()
|
||||
scope.launch {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 1 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 1 ---")
|
||||
val displayed = getDisplayed()
|
||||
if (displayed == null) {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 2 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 2 ---")
|
||||
val top = getTop() //堆顶
|
||||
if (top != null) {
|
||||
if (top.target.priority >= scene.priority) {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 3 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 3 ---")
|
||||
top.triggerTime = triggerTime
|
||||
doChangeAngle(top)
|
||||
synchronized(heap){
|
||||
heap += Record(scene, triggerTime = -1)
|
||||
}
|
||||
} else {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 4 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 4 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
}
|
||||
} else {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 4 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 5 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
}
|
||||
} else {
|
||||
if (scene.javaClass == displayed.target.javaClass) {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 5 ---")
|
||||
defaultDelayJob?.safeCancel()
|
||||
return@launch
|
||||
}
|
||||
val prev = displayed.target
|
||||
Log.d("${M_DEVA}${TAG}", "--- 6 --- old: $prev -> cur: $scene")
|
||||
val prevTriggerTime = displayed.triggerTime
|
||||
if (scene !is Default && prev.priority >= scene.priority && (prev is RoadEvent || prev is TooClose)) {
|
||||
|
||||
val displayDuration = triggerTime - prevTriggerTime
|
||||
Log.d("${M_DEVA}${TAG}", "--- 7 ---:duration: $displayDuration")
|
||||
if (displayDuration < prev.displayThreshold) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 8 --- old: $prev -> cur: $scene")
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (prev.priority > scene.priority) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 9 --- old: $prev -> cur: $scene")
|
||||
if (prev.displayThreshold < 0) {
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (scene is Turning) {
|
||||
val isOpen = scene.open
|
||||
if (!isOpen) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 10 --- old: $prev -> cur: $scene")
|
||||
changeVisualAngle(Default())
|
||||
heap -= displayed
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (scene is CrossRoad) {
|
||||
val isOpen = scene.open
|
||||
if (!isOpen) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 11 --- old: $prev -> cur: $scene")
|
||||
changeVisualAngle(Default())
|
||||
heap -= displayed
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (scene !is Default && prev.priority >= scene.priority && (prev is RoadEvent || prev is TooClose)) {
|
||||
val displayDuration = triggerTime - prevTriggerTime
|
||||
if (displayDuration < prev.displayThreshold) {
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
|
||||
if (scene is Default) {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 6 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 12 ---")
|
||||
defaultDelayJob?.safeCancel()
|
||||
launch {
|
||||
val delay = scene.unit.toMillis(scene.delay)
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 7 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 13 ---")
|
||||
delay(delay)
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 8 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 14 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
heap -= displayed
|
||||
}.also { itx ->
|
||||
itx.invokeOnCompletion {
|
||||
if (it is CancellationException) {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 9 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 15 ---")
|
||||
}
|
||||
}
|
||||
defaultDelayJob = itx
|
||||
}
|
||||
} else {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${scene} --- 10 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 16 ---")
|
||||
defaultDelayJob?.safeCancel()
|
||||
if (displayed.target.priority < scene.priority) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 17 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
}
|
||||
}
|
||||
@@ -298,14 +341,13 @@ object CallerVisualAngleManager {
|
||||
private fun doChangeAngle(record: Record) {
|
||||
val angle = record.target.angle
|
||||
CallerMapUIServiceManager.getMapUIController()?.also {
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${record.target} --- 13 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- doChangeAngle ---: ${record.target}")
|
||||
if (record.target !is Default) {
|
||||
record.isDisplay = true
|
||||
synchronized(heap) {
|
||||
heap += record
|
||||
}
|
||||
}
|
||||
Logger.d("${M_DEVA}${TAG}", "触发场景:${record.target} --- 15 ---> angle: $angle")
|
||||
it.changeMapVisualAngle(angle, null)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user