[6.7.0]冷启动更改
This commit is contained in:
@@ -55,6 +55,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager
|
||||
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.env.EnvChangeManager
|
||||
import com.zhjt.mogo_core_function_devatools.exam.ExamControlManager
|
||||
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter
|
||||
@@ -172,6 +173,7 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
BindingCarManager.init(mContext!!)
|
||||
// apmEnvProvider.init(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
BadCaseManager.init(mContext!!)
|
||||
ColdStartManager.init(mContext!!)
|
||||
if (DebugConfig.isDebug()) {
|
||||
SdtManager.init(mContext!!, true, DetectResultImpl())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zhjt.mogo_core_function_devatools.coldstart
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
|
||||
/**
|
||||
* 冷启动关键节点埋点统计管理
|
||||
*/
|
||||
object ColdStartAnalyticsManager {
|
||||
|
||||
private const val coldStartStep = "cold_start_step" //冷启动步骤埋点Key
|
||||
|
||||
private const val eventParamPlateNumber = "plateNumber" //车牌号
|
||||
private const val eventParamCarSn = "carSn" //鹰眼SN
|
||||
private const val eventParamMapVersion = "mapVersion" //工控机版本
|
||||
private const val eventParamEyeVersion = "eyeVersion" //鹰眼版本
|
||||
private const val eventParamAppFlavor = "appFlavor" //渠道信息
|
||||
private const val eventParamBranchHash = "branchHash" //Git Hash
|
||||
private const val eventParamLatitude = "latitude" //纬度
|
||||
private const val eventParamLongitude = "longitude" //经度
|
||||
private const val eventParamStep = "step" //冷启动步骤
|
||||
|
||||
const val ipcConnectSuccess = "ipcConnectSuccess" //域控连接成功
|
||||
const val ipcConnectFail = "ipcConnectFail"//域控连接失败
|
||||
const val ssmConnectSuccess = "ssmConnectSuccess" //SSM连接成功
|
||||
const val ssmConnectFail = "ssmConnectFail"//SSM连接失败
|
||||
const val coldStartSuccess = "coldStartSuccess" //冷启动成功
|
||||
const val coldStartFail = "coldStartFail"//冷启动失败
|
||||
const val coldStartNow = "coldStartNow" //立即用车
|
||||
|
||||
/**
|
||||
* 冷启动埋点统计
|
||||
* @param plateNumber 车牌号
|
||||
* @param carSn 鹰眼SN
|
||||
* @param mapVersion 工控机版本
|
||||
* @param eyeVersion 鹰眼版本
|
||||
* @param appFlavor 渠道信息
|
||||
* @param branchHash Git Hash
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @param step 冷启动步骤
|
||||
*/
|
||||
private fun realColdStartStepAnalytics(plateNumber: String,carSn: String,mapVersion: String,eyeVersion: String,
|
||||
appFlavor: String,branchHash: String,latitude: String,longitude: String,
|
||||
step: String){
|
||||
val coldStartParams = HashMap<String,Any>()
|
||||
coldStartParams[eventParamPlateNumber] = plateNumber
|
||||
coldStartParams[eventParamCarSn] = carSn
|
||||
coldStartParams[eventParamMapVersion] = mapVersion
|
||||
coldStartParams[eventParamEyeVersion] = eyeVersion
|
||||
coldStartParams[eventParamAppFlavor] = appFlavor
|
||||
coldStartParams[eventParamBranchHash] = branchHash
|
||||
coldStartParams[eventParamLatitude] = latitude
|
||||
coldStartParams[eventParamLongitude] = longitude
|
||||
coldStartParams[eventParamStep] = step
|
||||
MogoAnalyticUtils.track(coldStartStep,coldStartParams)
|
||||
}
|
||||
|
||||
/**
|
||||
* 冷启动埋点统计
|
||||
* @param step 冷启动步骤
|
||||
*/
|
||||
fun coldStartStepAnalytics(step: String){
|
||||
realColdStartStepAnalytics(AppConfigInfo.plateNumber, SharedPrefsMgr.getInstance().sn,
|
||||
CallerAutoPilotStatusListenerManager.getDockerVersion() ?: "",
|
||||
AppUtils.getAppVersionName(), AppConfigInfo.flavor,AppConfigInfo.workingBranchHash,
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude.toString(),
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude.toString(),step)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zhjt.mogo_core_function_devatools.coldstart
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.SPUtils
|
||||
|
||||
/**
|
||||
* 冷启动配置参数
|
||||
*/
|
||||
object ColdStartConfig {
|
||||
|
||||
private var isShowing: Boolean = false
|
||||
|
||||
private const val coldStartTime = "COLD_START_TIME" //启动时间
|
||||
private const val coldStartNow = "COLD_START_NOW" //立即用车
|
||||
|
||||
fun getShowWindowStatus(): Boolean{
|
||||
return isShowing
|
||||
}
|
||||
|
||||
fun setShowWindowStatus(isShowing: Boolean){
|
||||
this.isShowing = isShowing
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上一次冷启动启动成功日期
|
||||
*/
|
||||
fun getColdStartSuccessTime(): Long{
|
||||
return SPUtils.getInstance().getLong(coldStartTime)
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录冷启动成功日期
|
||||
*/
|
||||
fun setColdStartSuccessTime(successTime: Long){
|
||||
SPUtils.getInstance().put(coldStartTime,successTime)
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录立即用车点击时间
|
||||
*/
|
||||
fun setColdStartNowState(coldStartNowTime: Long){
|
||||
SPUtils.getInstance().put(coldStartNow,coldStartNowTime)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取立即用车点击时间
|
||||
*/
|
||||
fun getColdStartNowTime(): Long{
|
||||
return SPUtils.getInstance().getLong(coldStartNow)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zhjt.mogo_core_function_devatools.coldstart
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.api.och.IOchFunctionCallNotify
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
|
||||
/**
|
||||
* 冷启动管理
|
||||
*/
|
||||
object ColdStartManager: IMoGoAutopilotStatusListener, IDataCenterBizListener {
|
||||
|
||||
const val TAG = "ColdStartManager"
|
||||
private var isColdStartNow: Boolean = false //当天是否点击了“立即用车”
|
||||
private var isColdStartSuccess: Boolean = false //当天是否冷启动成功
|
||||
private var loginStatus: Boolean = false //当前登录状态
|
||||
private var ipcConnectedTime: Long = System.currentTimeMillis()
|
||||
|
||||
|
||||
fun init(context: Context){
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerDataCenterBizListener.addListener(TAG,this)
|
||||
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
|
||||
//获取当天是否点击过“立即用车”
|
||||
val coldStartNowDay = millis2String(ColdStartConfig.getColdStartNowTime(), TimeUtils.getMdFormat())
|
||||
if(coldStartNowDay == currentDay){
|
||||
isColdStartNow = true
|
||||
}
|
||||
//获取当天是否冷启动成功
|
||||
val coldStartSuccessDay = millis2String(ColdStartConfig.getColdStartSuccessTime(), TimeUtils.getMdFormat())
|
||||
if(coldStartSuccessDay == currentDay){
|
||||
isColdStartSuccess = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotIpcConnectStatusChanged(
|
||||
status: AdasConstants.IpcConnectionStatus,
|
||||
reason: String?
|
||||
){
|
||||
//域控连接异常
|
||||
if(status != AdasConstants.IpcConnectionStatus.CONNECTED){
|
||||
//当前进入主页方式为立即用车,则在主页面不再展示冷启动页面
|
||||
if(isColdStartNow && !isColdStartSuccess){
|
||||
return
|
||||
}
|
||||
if(isColdStartNow && ColdStartConfig.getColdStartNowTime() > ColdStartConfig.getColdStartSuccessTime()){
|
||||
return
|
||||
}
|
||||
//已登录且距离上次冷启动成功超过1分钟,再次展示冷启动页面
|
||||
if(!ColdStartConfig.getShowWindowStatus() && loginStatus && System.currentTimeMillis().minus(ColdStartConfig.getColdStartSuccessTime())>60000){
|
||||
if(System.currentTimeMillis().minus(ipcConnectedTime) > 60000){
|
||||
CallerHmiManager.showColdStartWindow()
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ipcConnectedTime = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登录状态
|
||||
* @param isLogin 是否登录
|
||||
*/
|
||||
override fun invokeLoginStatus(isLogin: Boolean) {
|
||||
super.invokeLoginStatus(isLogin)
|
||||
loginStatus = isLogin
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user