[2.13.0] 司机端/乘客屏启动自驾埋点处理

This commit is contained in:
wangmingjun
2022-12-16 16:14:14 +08:00
parent 74b3b5d995
commit e7cc18eeb4
5 changed files with 79 additions and 15 deletions

View File

@@ -50,17 +50,21 @@ public class BusAnalyticsManager {
if (mStartAutopilotParams.isEmpty()) return;
CallerLogger.INSTANCE.e( M_BUS + "triggerStartAutopilotFailureEvent", failMsg );
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() !=
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG, failMsg);
}
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT
, CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ==
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
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")
private void removeWaitingCallback() {
if (startAutopilotRunnable != null &&
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
@@ -102,6 +106,7 @@ public class BusAnalyticsManager {
mStartAutopilotParams.put(BusConst.EVENT_PARAM_LINE_ID, lineId);
if (send) {
if (mStartAutopilotParams.isEmpty()) return;
// 开启成功,上报埋点
clearStartAutopilotFailureMSG();
removeWaitingCallback();

View File

@@ -56,6 +56,7 @@ class TaxiPassengerConst {
const val EVENT_PARAM_END_NAME = "end_name"
const val EVENT_PARAM_ORDER_NUMBER = "order_num"
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
const val EVENT_PARAM_START_FAILURE_CODE = "start_autopilot_failure_code" // 启动自驾失败code
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境true/false

View File

@@ -38,6 +38,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
@@ -83,6 +84,7 @@ import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
/**
@@ -244,6 +246,9 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
CallLimitingVelocityListenerManager.INSTANCE.addListener(TAG,limitingVelocityListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
//开启自驾后 异常信息返回
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener);
}
private void releaseListeners() {
@@ -260,6 +265,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
CallLimitingVelocityListenerManager.INSTANCE.removeListener(limitingVelocityListener);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null);
}
/**
@@ -588,6 +595,13 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
};
private final OchAdasStartFailureCallback mAdasStartFailureListener = new OchAdasStartFailureCallback() {
@Override
public void onStartAutopilotFailure(@NotNull String startFailedCode, @NonNull String startFailedMessage) {
TaxiPassengerAnalyticsManager.getInstance().triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage);
}
};
public void startToRouteAndWipe(List<MessagePad.Location> models) {
List<MogoLocation> locationsModels = CoordinateCalculateRouteUtil
.coordinateConverterWgsToGcjLocations(mContext,models);

View File

@@ -1,11 +1,16 @@
package com.mogo.och.taxi.passenger.utils;
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.eagle.core.function.call.analytics.AnalyticsManager;
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.taxi.passenger.constant.TaxiPassengerConst;
@@ -34,16 +39,51 @@ public class TaxiPassengerAnalyticsManager {
private Runnable startAutopilotRunnable = () -> {
// 15s内未开启上报失败埋点
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_RESULT, false);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_FAILURE_MSG,
"15s后app等待超时");
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
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.getAutoPilotStatusInfo().getState() !=
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_FAILURE_MSG,
failMsg);
}
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_RESULT
, CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ==
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
clearStartAutopilotParams();//清空参数数据,防止误传
}
public void clearStartAutopilotFailureMSG(){
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_FAILURE_CODE, "");
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_FAILURE_MSG, "");
}
private void clearStartAutopilotParams(){
mStartAutopilotParams.clear();
}
private void removeWaitingCallback() {
if (startAutopilotRunnable != null &&
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
}
}
/**
* 触发'开启自动驾驶'埋点流程
* 开启自动驾驶15s内成功则发送成功埋点否则发送失败埋点
@@ -69,14 +109,14 @@ public class TaxiPassengerAnalyticsManager {
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_ORDER_NUMBER, orderNo);
if (send) {
if (mStartAutopilotParams.isEmpty()) return;
// 开启成功,取消失败定时任务
clearStartAutopilotFailureMSG();
if (startAutopilotRunnable != null &&
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
}
removeWaitingCallback();
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_RESULT, true);
// AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
clearStartAutopilotParams();
} else {
UiThreadHandler.postDelayed(startAutopilotRunnable, TaxiPassengerConst.LOOP_PERIOD_15S);
}

View File

@@ -57,12 +57,15 @@ public class TaxiAnalyticsManager {
if (mStartAutopilotParams.isEmpty()) return;
CallerLogger.INSTANCE.e(M_TAXI + "triggerStartAutopilotFailureEvent", failMsg);
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() !=
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_MSG,
failMsg);
}
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT,
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ==
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_MSG,
failMsg);
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
clearStartAutopilotParams();//清空参数数据,防止误传
@@ -104,6 +107,7 @@ public class TaxiAnalyticsManager {
// CallerLogger.INSTANCE.d(M_TAXI + "埋点==","restart = "+restart+", send= "+send);
if (send) {
if (mStartAutopilotParams.isEmpty()) return;
// 开启成功,上报埋点
clearStartAutopilotFailureMSG();
removeWaitingCallback();