[bugfix]
[bus] [自驾状态启动自驾埋点超时、中途进入应用 上报自驾启动成功]
This commit is contained in:
@@ -380,7 +380,7 @@ public class OrderModel {
|
||||
private final OchAdasStartFailureCallback mAdasStartFailureListener = new OchAdasStartFailureCallback() {
|
||||
@Override
|
||||
public void onStartAutopilotFailure(@NotNull String startFailedCode, @NonNull String startFailedMessage) {
|
||||
BusAnalyticsManager.getInstance().triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage);
|
||||
BusAnalyticsManager.INSTANCE.triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage);
|
||||
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode){
|
||||
CallerLogger.INSTANCE.e( M_BUS + TAG, "mAdasStartFailureListener = "+startFailedMessage );
|
||||
mADASStatusCallback.onStartAdasFailure();
|
||||
@@ -661,6 +661,13 @@ public class OrderModel {
|
||||
CallerLogger.INSTANCE.e(M_BUS + TAG, "isPassStartAutopilotCommand = " +
|
||||
FunctionBuildConfig.isPassStartAutopilotCommand);
|
||||
|
||||
if(CallerAutoPilotStatusListenerManager.INSTANCE.getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
ToastUtils.showShort("自驾中、请勿重复启动");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
|
||||
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
|
||||
", 请稍候重试");
|
||||
@@ -1190,7 +1197,7 @@ public class OrderModel {
|
||||
}
|
||||
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
BusAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestart, send,
|
||||
BusAnalyticsManager.INSTANCE.triggerStartAutopilotEvent(isRestart, send,
|
||||
currentStation.getName(), nextStation.getName(), currentLineId);
|
||||
}
|
||||
|
||||
@@ -1200,7 +1207,7 @@ public class OrderModel {
|
||||
}
|
||||
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
BusAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
BusAnalyticsManager.INSTANCE.triggerUnableStartAPReasonEvent(
|
||||
currentStation.getName(), nextStation.getName(), currentLineId,
|
||||
OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason());
|
||||
}
|
||||
|
||||
@@ -1,82 +1,51 @@
|
||||
package com.mogo.och.bus.util;
|
||||
package com.mogo.och.bus.util
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
import java.util.HashMap;
|
||||
import android.text.TextUtils
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
/**
|
||||
* OCH Bus埋点工具
|
||||
*
|
||||
* Created on 2022/3/24
|
||||
*/
|
||||
public class BusAnalyticsManager {
|
||||
object BusAnalyticsManager {
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusAnalyticsManager INSTANCE = new BusAnalyticsManager();
|
||||
private var mStartAutopilotKey: String? = null
|
||||
private val mStartAutopilotParams = HashMap<String, Any>()
|
||||
|
||||
var startAutopiloTimeOut: Disposable? = null
|
||||
|
||||
fun triggerStartAutopilotFailureEventByAdas(failCode: String, failMsg: String) {
|
||||
RxUtils.disposeSubscribe(startAutopiloTimeOut)
|
||||
triggerStartAutopilotFailureEvent(failCode, failMsg)
|
||||
}
|
||||
|
||||
public static BusAnalyticsManager getInstance() {
|
||||
return BusAnalyticsManager.SingletonHolder.INSTANCE;
|
||||
private fun clearStartAutopilotParams() {
|
||||
mStartAutopilotParams.clear()
|
||||
}
|
||||
|
||||
private String mStartAutopilotKey;
|
||||
private HashMap<String, Object> mStartAutopilotParams = new HashMap<>();
|
||||
|
||||
private Runnable startAutopilotRunnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
triggerStartAutopilotFailureEvent("", "15s后app等待超时");
|
||||
};
|
||||
|
||||
public void triggerStartAutopilotFailureEventByAdas(String failCode, String failMsg){
|
||||
removeWaitingCallback();
|
||||
triggerStartAutopilotFailureEvent(failCode, failMsg);
|
||||
}
|
||||
|
||||
private void triggerStartAutopilotFailureEvent(String failCode, String failMsg){
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
|
||||
CallerLogger.INSTANCE.e( M_BUS + "triggerStartAutopilotFailureEvent", failMsg );
|
||||
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getState() !=
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG, failMsg);
|
||||
private fun triggerStartAutopilotFailureEvent(failCode: String, failMsg: String) {
|
||||
if (mStartAutopilotParams.isEmpty()) return
|
||||
CallerLogger.e(SceneConstant.M_BUS + "triggerStartAutopilotFailureEvent", failMsg)
|
||||
if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_CODE] = failCode
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_MSG] = failMsg
|
||||
}
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT
|
||||
, CallerAutoPilotStatusListenerManager.INSTANCE.getState() ==
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
|
||||
MogoAnalyticUtils.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
}
|
||||
|
||||
private void removeWaitingCallback() {
|
||||
if (startAutopilotRunnable != null) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearStartAutopilotFailureMSG(){
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_CODE, "");
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG, "");
|
||||
}
|
||||
|
||||
private void clearStartAutopilotParams(){
|
||||
mStartAutopilotParams.clear();
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_RESULT] =
|
||||
CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
MogoAnalyticUtils.track(mStartAutopilotKey, mStartAutopilotParams)
|
||||
clearStartAutopilotParams() //清空参数数据,防止误传
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,35 +54,32 @@ public class BusAnalyticsManager {
|
||||
* @param restart false(点击'滑动出发'启动)/true(接管后点击'自动驾驶'按钮启动)
|
||||
* @param send 是否直接发送埋点(15s内开启成功则直接发送成功埋点)
|
||||
*/
|
||||
public void triggerStartAutopilotEvent(
|
||||
boolean restart, boolean send, String startName, String endName, int lineId) {
|
||||
mStartAutopilotKey = restart ?
|
||||
BusConst.EVENT_KEY_RESTART_AUTOPILOT : BusConst.EVENT_KEY_START_SERVICE;
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_SN, sn);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_TIME, dateTime);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_NAME, startName);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_END_NAME, endName);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
|
||||
fun triggerStartAutopilotEvent(
|
||||
restart: Boolean, send: Boolean, startName: String, endName: String, lineId: Int
|
||||
) {
|
||||
mStartAutopilotKey = if (restart) BusConst.EVENT_KEY_RESTART_AUTOPILOT else BusConst.EVENT_KEY_START_SERVICE
|
||||
if (send) {
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
if (mStartAutopilotParams.isEmpty()) return
|
||||
// 开启成功,上报埋点
|
||||
clearStartAutopilotFailureMSG();
|
||||
removeWaitingCallback();
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT, true);
|
||||
MogoAnalyticUtils.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_CODE] = ""
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_MSG] = ""
|
||||
RxUtils.disposeSubscribe(startAutopiloTimeOut)
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_RESULT] = true
|
||||
MogoAnalyticUtils.track(mStartAutopilotKey, mStartAutopilotParams)
|
||||
clearStartAutopilotParams() //清空参数数据,防止误传
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, BusConst.LOOP_PERIOD_15S);
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_SN] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_NAME] = startName
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_END_NAME] = endName
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_LINE_ID] = lineId
|
||||
startAutopiloTimeOut = RxUtils.createSubscribeOnOwnThread(BusConst.LOOP_PERIOD_15S) {
|
||||
// 15s内未开启,上报失败埋点
|
||||
triggerStartAutopilotFailureEvent("", "15s后app等待超时")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,24 +89,20 @@ public class BusAnalyticsManager {
|
||||
* @param endName
|
||||
* @param lineId
|
||||
*/
|
||||
public void triggerUnableStartAPReasonEvent(String startName, String endName, int lineId,
|
||||
String reason) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
|
||||
params.put(BusConst.EVENT_PARAM_SN, sn);
|
||||
params.put(BusConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(BusConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
params.put(BusConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(BusConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(BusConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(BusConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
params.put(BusConst.EVENT_PARAM_UNABLE_START_REASON, reason);
|
||||
MogoAnalyticUtils.INSTANCE.track(BusConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
|
||||
fun triggerUnableStartAPReasonEvent(
|
||||
startName: String, endName: String, lineId: Int,
|
||||
reason: String
|
||||
) {
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
val params = HashMap<String, Any>()
|
||||
params[BusConst.EVENT_PARAM_SN] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
params[BusConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
params[BusConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
|
||||
params[BusConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
params[BusConst.EVENT_PARAM_START_NAME] = startName
|
||||
params[BusConst.EVENT_PARAM_END_NAME] = endName
|
||||
params[BusConst.EVENT_PARAM_LINE_ID] = lineId
|
||||
params[BusConst.EVENT_PARAM_UNABLE_START_REASON] = reason
|
||||
MogoAnalyticUtils.track(BusConst.EVENT_KEY_AP_UNABLE_START_REASON, params)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user