Merge branch 'dev_robotaxi-d_230711_3.4.0' into dev_20230708_unmanned_3.5.0

This commit is contained in:
wangmingjun
2023-08-02 11:25:02 +08:00
99 changed files with 1035 additions and 511 deletions

View File

@@ -29,7 +29,7 @@ class BizBroadcastReceiver: BroadcastReceiver() {
CallerLogger.d("${SceneConstant.M_OCHCOMMON}${TAG}",
"类型:${type} 频率:${frequency} 命令所在文件:${sourceFilePath}"
)
DebugDataDispatch.disPathc(type,frequency,sourceFilePath)
DebugDataDispatch.disPathc(type,frequency,sourceFilePath,intent)
} catch (e: Exception) {
e.printStackTrace()
}

View File

@@ -1,12 +1,17 @@
package com.mogo.och.common.module.debug
import android.content.Intent
import android.os.Environment
import chassis.Chassis.DoorNumber
import chassis.VehicleStateOuterClass
import com.amap.api.maps.model.LatLng
import com.google.gson.reflect.TypeToken
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.utilcode.geometry.S2LaxPolygonShape.MultiList
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.GsonUtils
@@ -26,12 +31,18 @@ object DebugDataDispatch {
const val globalPathMock = "globalPath"
const val locationMock = "location"
const val carDoorMock = "carDoor"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "sy73_log.json"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "carDoor" --ei doorPostion 1 --ei doorStatus 1
val ROOT_PATH =
Environment.getExternalStorageDirectory().absolutePath + File.separator + "MLog" + File.separator + "APPLog" + File.separator //程序外部存储跟目录
fun disPathc(type: String?, frequency: Int, sourceFilePath: String?) {
fun disPathc(type: String?, frequency: Int, sourceFilePath: String?, intent: Intent) {
when (type) {
globalPathMock -> {
sourceFilePath?.let {
@@ -43,6 +54,20 @@ object DebugDataDispatch {
getLocaitonByLog(ROOT_PATH+it)
}
}
carDoorMock -> {
// 1--5
val intArrayExtra = intent.getIntExtra("doorPostion",0)
// 0 -1
val booleanArrayExtra = intent.getIntExtra("doorStatus",0)
val newBuilder = VehicleStateOuterClass.DoorStateV2.newBuilder()
newBuilder.number = DoorNumber.forNumber(intArrayExtra)
newBuilder.status = booleanArrayExtra
val multiList = mutableListOf<VehicleStateOuterClass.DoorStateV2>()
multiList.add(newBuilder.build())
CallerChassisDoorStateListenerManager.invokeAutopilotDoorState(multiList)
}
else -> {}
}
}

View File

@@ -46,12 +46,17 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
if (TaxiPassengerModel.currentOCHOrder!!.orderStatus == TaxiPassengerOrderStatusEnum.UserArriveAtStart.code) {
startServicePilotDone()
}
if(CallerAutoPilotStatusListenerManager.getState()
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
ToastUtils.showShort("自驾中、请勿重复启动");
return;
}
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) {
ToastUtils.showLong(
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason +
", 请稍候重试"
)
TaxiPassengerAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
TaxiPassengerAnalyticsManager.triggerUnableStartAPReasonEvent(
TaxiPassengerModel.currentOCHOrder!!.startSiteAddr,
TaxiPassengerModel.currentOCHOrder!!.endSiteAddr,
TaxiPassengerModel.currentOCHOrder!!.orderNo,
@@ -75,13 +80,7 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
+ " ,startSiteName=" + TaxiPassengerModel.currentOCHOrder!!.startSiteAddr
+ " ,endSiteName=" + TaxiPassengerModel.currentOCHOrder!!.endSiteAddr
)
TaxiPassengerAnalyticsManager.getInstance().triggerStartAutopilotEvent(
false,
false,
TaxiPassengerModel.currentOCHOrder!!.startSiteAddr,
TaxiPassengerModel.currentOCHOrder!!.endSiteAddr,
TaxiPassengerModel.currentOCHOrder!!.orderNo
)
TaxiPassengerAnalyticsManager.triggerStartAutopilotEvent(false, false, TaxiPassengerModel.currentOCHOrder!!.startSiteAddr, TaxiPassengerModel.currentOCHOrder!!.endSiteAddr, TaxiPassengerModel.currentOCHOrder!!.orderNo)
}
private fun initAutopilotControlParameters(): AutopilotControlParameters? {
@@ -157,7 +156,7 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
when (state) {
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
if (TaxiPassengerModel.currentOCHOrder != null && TaxiPassengerModel.curOrderStatus === TaxiPassengerOrderStatusEnum.UserArriveAtStart) {
TaxiPassengerAnalyticsManager.getInstance().triggerStartAutopilotEvent(
TaxiPassengerAnalyticsManager.triggerStartAutopilotEvent(
false,
true,
TaxiPassengerModel.currentOCHOrder!!.startSiteAddr,

View File

@@ -235,7 +235,7 @@ object TaxiPassengerModel {
private val mAdasStartFailureListener: OchAdasStartFailureCallback = object : OchAdasStartFailureCallback {
override fun onStartAutopilotFailure(startFailedCode: String, startFailedMessage: String) {
TaxiPassengerAnalyticsManager.getInstance().triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage)
TaxiPassengerAnalyticsManager.triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage)
}
}
private val iMsgBoxEventListener: IMsgBoxEventListener = object : IMsgBoxEventListener {

View File

@@ -23,6 +23,7 @@ import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_fron
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_orderinfo
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_rear_left_door
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_rear_right_door
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.iv_xiaozhi_belt
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.starting_autopilot_view_close
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_btn_bg
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_starting
@@ -53,6 +54,7 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
private var taxiPStartAutopilot: AnimationsContainer?=null
private var taxiPStartAutopilotCar: AnimationsContainer?=null
private var taxiPXiaozhiBelt: AnimationsContainer?=null
init {
@@ -73,6 +75,12 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
}
})
taxiPXiaozhiBelt = AnimationsContainer(R.array.xiaozhi_belt, 15,iv_xiaozhi_belt)
taxiPXiaozhiBelt?.setOnAnimStopListener(object :AnimationsContainer.OnAnimationStoppedListener{
override fun AnimationStopped() {
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
}
})
}
fun startAutopilotBgAnimatorDrawable(isStart: Boolean) {
@@ -227,9 +235,7 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
starting_autopilot_view_close.onClick {
closeAllAnimsAndView()
}
v_xiaozhi_belt_info_bg.onClick {
handleStartAutopilotBtnStatus(true)
}
taxiPXiaozhiBelt?.start()
}
@@ -237,6 +243,7 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
isStarting = false
clearStartingAnimFrame()
clearBgAnimDrawable()
taxiPXiaozhiBelt?.stop()
super.onDetachedFromWindow()
}
}

View File

@@ -7,6 +7,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisDoorStateListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
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.UiThreadHandler
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback
import com.mogo.och.taxi.passenger.model.AutopilotManager
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel
@@ -34,29 +35,7 @@ class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallbac
val doorList = CallerChassisDoorStateListenerManager.getDoorList()
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化初始化:${doorList}")
doorList?.forEach {
when (it.number) {
DoorNumber.FRONT_LEFT -> {
viewCallback?.setDoorStatus(DoorPosition.FRONT_LEFT,it.status==1)
}
DoorNumber.FRONT_RIGHT -> {
viewCallback?.setDoorStatus(DoorPosition.FRONT_RIGHT,it.status==1)
}
DoorNumber.REAR_LEFT -> {
viewCallback?.setDoorStatus(DoorPosition.REAR_LEFT,it.status==1)
}
DoorNumber.REAR_RIGHT -> {
viewCallback?.setDoorStatus(DoorPosition.REAR_RIGHT,it.status==1)
}
DoorNumber.MIDDLE -> {
viewCallback?.setDoorStatus(DoorPosition.MIDDLE,it.status==1)
}
else -> {}
}
exchangeEnum(it.number,it.status==1)
}
}
@@ -100,31 +79,42 @@ class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallbac
override fun onAutopilotSingleDoorState(num: Chassis.DoorNumber, open: Boolean) {
super.onAutopilotSingleDoorState(num, open)
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化:${num}--${open}")
exchangeEnum(num,open)
}
private fun exchangeEnum(num: Chassis.DoorNumber,open: Boolean){
when (num) {
DoorNumber.FRONT_LEFT -> {
viewCallback?.setDoorStatus(DoorPosition.FRONT_LEFT,open)
runMain(DoorPosition.FRONT_LEFT,open)
}
DoorNumber.FRONT_RIGHT -> {
viewCallback?.setDoorStatus(DoorPosition.FRONT_RIGHT,open)
runMain(DoorPosition.FRONT_RIGHT,open)
}
DoorNumber.REAR_LEFT -> {
viewCallback?.setDoorStatus(DoorPosition.REAR_LEFT,open)
runMain(DoorPosition.REAR_LEFT,open)
}
DoorNumber.REAR_RIGHT -> {
viewCallback?.setDoorStatus(DoorPosition.REAR_RIGHT,open)
runMain(DoorPosition.REAR_RIGHT,open)
}
DoorNumber.MIDDLE -> {
viewCallback?.setDoorStatus(DoorPosition.MIDDLE,open)
runMain(DoorPosition.MIDDLE,open)
}
else -> {}
}
}
private fun runMain(posttion:DoorPosition,isOpen: Boolean){
UiThreadHandler.post {
viewCallback?.setDoorStatus(posttion,isOpen)
}
}
interface StartAutopilotCallback {
fun handleStartAutopilotBtnStatus(isBoarded: Boolean)
fun setOrderInfo(show: String)

View File

@@ -96,6 +96,9 @@ internal class InfoVideoView @JvmOverloads constructor(
override fun onVisibilityChanged(changedView: View, visibility: Int) {
super.onVisibilityChanged(changedView, visibility)
if(changedView!=this){
return
}
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
when (visibility) {

View File

@@ -1,150 +0,0 @@
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.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.taxi.passenger.constant.TaxiPassengerConst;
import java.util.HashMap;
/**
* OCH Taxi埋点工具
*
* Created on 2022/3/24
*/
public class TaxiPassengerAnalyticsManager {
private static final class SingletonHolder {
private static final TaxiPassengerAnalyticsManager INSTANCE = new TaxiPassengerAnalyticsManager();
}
public static TaxiPassengerAnalyticsManager getInstance() {
return TaxiPassengerAnalyticsManager.SingletonHolder.INSTANCE;
}
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(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.getState() ==
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
MogoAnalyticUtils.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.removeCallbacks(startAutopilotRunnable);
}
}
/**
* 触发'开启自动驾驶'埋点流程
* 开启自动驾驶15s内成功则发送成功埋点否则发送失败埋点
* @param restart false点击'开始服务'启动)/true接管后点击'自动驾驶'按钮启动)
* @param send 是否直接发送埋点15s内开启成功则直接发送成功埋点
*/
public void triggerStartAutopilotEvent(
boolean restart, boolean send, String startName, String endName, String orderNo) {
mStartAutopilotKey = restart ?
TaxiPassengerConst.EVENT_KEY_RESTART_AUTOPILOT : TaxiPassengerConst.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(TaxiPassengerConst.EVENT_PARAM_SN, sn);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_ENV_ONLINE,
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_TIME, dateTime);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_NAME, startName);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_END_NAME, endName);
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_ORDER_NUMBER, orderNo);
if (send) {
if (mStartAutopilotParams.isEmpty()) return;
// 开启成功,取消失败定时任务
clearStartAutopilotFailureMSG();
removeWaitingCallback();
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_RESULT, true);
MogoAnalyticUtils.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
clearStartAutopilotParams();
} else {
UiThreadHandler.postDelayed(startAutopilotRunnable, TaxiPassengerConst.LOOP_PERIOD_15S);
}
}
/**
* 触发"无法开启自驾已知异常"埋点
* @param startName
* @param endName
* @param orderNo
*/
public void triggerUnableStartAPReasonEvent(String startName, String endName, String orderNo,
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(TaxiPassengerConst.EVENT_PARAM_SN, sn);
params.put(TaxiPassengerConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
params.put(TaxiPassengerConst.EVENT_PARAM_ENV_ONLINE,
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
params.put(TaxiPassengerConst.EVENT_PARAM_TIME, dateTime);
params.put(TaxiPassengerConst.EVENT_PARAM_START_NAME, startName);
params.put(TaxiPassengerConst.EVENT_PARAM_END_NAME, endName);
params.put(TaxiPassengerConst.EVENT_PARAM_ORDER_NUMBER, orderNo);
params.put(TaxiPassengerConst.EVENT_PARAM_UNABLE_START_REASON, reason);
MogoAnalyticUtils.INSTANCE.track(TaxiPassengerConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
}
}

View File

@@ -0,0 +1,116 @@
package com.mogo.och.taxi.passenger.utils
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.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI_P
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.och.common.module.utils.RxUtils
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst
import io.reactivex.disposables.Disposable
/**
* OCH Taxi埋点工具
*
* Created on 2022/3/24
*/
object TaxiPassengerAnalyticsManager {
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)
}
private fun clearStartAutopilotParams() {
mStartAutopilotParams.clear()
}
/**
* ① 15s超时调用
* ② 底盘明确给出错误原因
* 启动自驾失败写日志
*/
private fun triggerStartAutopilotFailureEvent(failCode: String, failMsg: String) {
if (mStartAutopilotParams.isEmpty()) return
e(M_TAXI_P + "triggerStartAutopilotFailureEvent", failMsg)
if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_START_FAILURE_CODE] = failCode
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_START_FAILURE_MSG] = failMsg
}
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_START_RESULT] =
CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
MogoAnalyticUtils.track(mStartAutopilotKey, mStartAutopilotParams)
clearStartAutopilotParams() //清空参数数据,防止误传
}
/**
*
* ① 自检完成后 启动自驾
* ② 自驾由其他状态转换到自驾中回调
* 触发'开启自动驾驶'埋点流程
* 开启自动驾驶15s内成功则发送成功埋点否则发送失败埋点
* @param restart false点击'开始服务'启动)/true接管后点击'自动驾驶'按钮启动)
* @param send 是否直接发送埋点15s内开启成功则直接发送成功埋点
*/
fun triggerStartAutopilotEvent(restart: Boolean, send: Boolean, startName: String, endName: String, orderNo: String) {
mStartAutopilotKey = if (restart) TaxiPassengerConst.EVENT_KEY_RESTART_AUTOPILOT else TaxiPassengerConst.EVENT_KEY_START_SERVICE
if (send) {
if (mStartAutopilotParams.isEmpty()) return
// 开启成功,取消失败定时任务
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_START_FAILURE_CODE] = ""
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_START_FAILURE_MSG] = ""
// 取消15s超时
RxUtils.disposeSubscribe(startAutopiloTimeOut)
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_START_RESULT] = true
MogoAnalyticUtils.track(mStartAutopilotKey, mStartAutopilotParams)
clearStartAutopilotParams() //清空参数数据,防止误传
} else {
val plateNum = AppConfigInfo.plateNumber
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_SN] = MoGoAiCloudClientConfig.getInstance().sn
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_START_NAME] = startName
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_END_NAME] = endName
mStartAutopilotParams[TaxiPassengerConst.EVENT_PARAM_ORDER_NUMBER] = orderNo
startAutopiloTimeOut = RxUtils.createSubscribeOnOwnThread(TaxiPassengerConst.LOOP_PERIOD_15S) {
// 15s内未开启上报失败埋点
triggerStartAutopilotFailureEvent("", "15s后app等待超时")
}
}
}
/**
* 触发"无法开启自驾已知异常"埋点
* @param startName
* @param endName
* @param orderNo
*/
fun triggerUnableStartAPReasonEvent(startName: String, endName: String, orderNo: String, reason: String) {
val plateNum = AppConfigInfo.plateNumber
val params = HashMap<String, Any>()
params[TaxiPassengerConst.EVENT_PARAM_SN] = MoGoAiCloudClientConfig.getInstance().sn
params[TaxiPassengerConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
params[TaxiPassengerConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
params[TaxiPassengerConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
params[TaxiPassengerConst.EVENT_PARAM_START_NAME] = startName
params[TaxiPassengerConst.EVENT_PARAM_END_NAME] = endName
params[TaxiPassengerConst.EVENT_PARAM_ORDER_NUMBER] = orderNo
params[TaxiPassengerConst.EVENT_PARAM_UNABLE_START_REASON] = reason
MogoAnalyticUtils.track(TaxiPassengerConst.EVENT_KEY_AP_UNABLE_START_REASON, params)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -16,9 +16,9 @@
app:compassDrawable="@drawable/taxi_p_map_car_light"
app:mapStyleExtraPath="style_extra.data"
app:mapStylePath="style.data"
app:leftPadding="80"
app:rightPadding="80"
app:topPadding="120"
app:leftPadding="160"
app:rightPadding="160"
app:topPadding="160"
app:bottomPadding="160"
/>
@@ -99,7 +99,7 @@
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:traffic_light_user="taxi_p"
app:traffic_light_user="traffic_light_taxi_p"
/>
<!--转向灯-->

View File

@@ -10,8 +10,8 @@
<TextClock
android:id="@+id/cl_order_time"
android:format12Hour="M月d日 HH:mm"
android:format24Hour="M月d日 HH:mm"
android:format12Hour="M月d日 "
android:format24Hour="M月d日 "
android:gravity="center"
android:fontFamily="@font/din"
app:layout_constraintStart_toStartOf="parent"
@@ -20,7 +20,21 @@
android:textColor="@color/taxi_p_111D2F"
android:textSize="@dimen/dp_52"
android:layout_marginStart="@dimen/dp_92"
android:letterSpacing="-0.05"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<TextClock
android:id="@+id/cl_order_time_hhmm"
android:format12Hour="HH:mm"
android:format24Hour="HH:mm"
android:gravity="center"
android:fontFamily="@font/din"
app:layout_constraintStart_toEndOf="@+id/cl_order_time"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:textColor="@color/taxi_p_111D2F"
android:letterSpacing="0.1"
android:textSize="@dimen/dp_52"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>

View File

@@ -39,7 +39,7 @@
app:layout_constraintBaseline_toBaselineOf="@+id/actv_speed_value"
app:layout_constraintStart_toEndOf="@+id/actv_speed_value"
android:layout_marginStart="@dimen/dp_24"
android:text="KM/h" />
android:text="KM/H" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_endstation"

View File

@@ -26,7 +26,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/infoVideoPlaylist"
android:layout_marginTop="67dp"
android:layout_marginTop="@dimen/dp_44"
app:vpi_orientation="horizontal"
app:vpi_slide_mode="scale"
app:vpi_slider_checked_color="@color/taxi_p_traffic_light_red_color_up"

View File

@@ -29,7 +29,7 @@
android:id="@+id/tv_welcome_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:layout_marginTop="-40dp"
android:shadowColor="@android:color/white"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_20"

View File

@@ -141,9 +141,9 @@
android:id="@+id/iv_xiaozhi_belt"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_98"
android:layout_marginEnd="@dimen/dp_84"
android:src="@drawable/xiaozhi_safety_belt"
android:layout_marginBottom="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

View File

@@ -186,4 +186,75 @@
<item>@drawable/xiaozhi_love_058</item>
<item>@drawable/xiaozhi_love_059</item>
</string-array>
<string-array name="xiaozhi_belt">
<item>@drawable/xiaozhi_belt_000</item>
<item>@drawable/xiaozhi_belt_001</item>
<item>@drawable/xiaozhi_belt_002</item>
<item>@drawable/xiaozhi_belt_003</item>
<item>@drawable/xiaozhi_belt_004</item>
<item>@drawable/xiaozhi_belt_005</item>
<item>@drawable/xiaozhi_belt_006</item>
<item>@drawable/xiaozhi_belt_007</item>
<item>@drawable/xiaozhi_belt_008</item>
<item>@drawable/xiaozhi_belt_009</item>
<item>@drawable/xiaozhi_belt_010</item>
<item>@drawable/xiaozhi_belt_011</item>
<item>@drawable/xiaozhi_belt_012</item>
<item>@drawable/xiaozhi_belt_013</item>
<item>@drawable/xiaozhi_belt_014</item>
<item>@drawable/xiaozhi_belt_015</item>
<item>@drawable/xiaozhi_belt_016</item>
<item>@drawable/xiaozhi_belt_017</item>
<item>@drawable/xiaozhi_belt_018</item>
<item>@drawable/xiaozhi_belt_019</item>
<item>@drawable/xiaozhi_belt_020</item>
<item>@drawable/xiaozhi_belt_021</item>
<item>@drawable/xiaozhi_belt_022</item>
<item>@drawable/xiaozhi_belt_023</item>
<item>@drawable/xiaozhi_belt_024</item>
<item>@drawable/xiaozhi_belt_025</item>
<item>@drawable/xiaozhi_belt_026</item>
<item>@drawable/xiaozhi_belt_027</item>
<item>@drawable/xiaozhi_belt_028</item>
<item>@drawable/xiaozhi_belt_029</item>
<item>@drawable/xiaozhi_belt_030</item>
<item>@drawable/xiaozhi_belt_031</item>
<item>@drawable/xiaozhi_belt_032</item>
<item>@drawable/xiaozhi_belt_033</item>
<item>@drawable/xiaozhi_belt_034</item>
<item>@drawable/xiaozhi_belt_035</item>
<item>@drawable/xiaozhi_belt_036</item>
<item>@drawable/xiaozhi_belt_037</item>
<item>@drawable/xiaozhi_belt_038</item>
<item>@drawable/xiaozhi_belt_039</item>
<item>@drawable/xiaozhi_belt_040</item>
<item>@drawable/xiaozhi_belt_041</item>
<item>@drawable/xiaozhi_belt_042</item>
<item>@drawable/xiaozhi_belt_043</item>
<item>@drawable/xiaozhi_belt_044</item>
<item>@drawable/xiaozhi_belt_045</item>
<item>@drawable/xiaozhi_belt_046</item>
<item>@drawable/xiaozhi_belt_047</item>
<item>@drawable/xiaozhi_belt_048</item>
<item>@drawable/xiaozhi_belt_049</item>
<item>@drawable/xiaozhi_belt_050</item>
<item>@drawable/xiaozhi_belt_051</item>
<item>@drawable/xiaozhi_belt_052</item>
<item>@drawable/xiaozhi_belt_053</item>
<item>@drawable/xiaozhi_belt_054</item>
<item>@drawable/xiaozhi_belt_055</item>
<item>@drawable/xiaozhi_belt_056</item>
<item>@drawable/xiaozhi_belt_057</item>
<item>@drawable/xiaozhi_belt_058</item>
<item>@drawable/xiaozhi_belt_059</item>
</string-array>
</resources>

View File

@@ -0,0 +1,74 @@
package com.mogo.launcher.lancet;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import com.knightboost.lancet.api.Scope;
import com.knightboost.lancet.api.annotations.Group;
import com.knightboost.lancet.api.annotations.ReplaceInvoke;
import com.knightboost.lancet.api.annotations.TargetClass;
import com.knightboost.lancet.api.annotations.TargetMethod;
import com.knightboost.lancet.api.annotations.Weaver;
import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.CopyOnWriteArraySet;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.MainCoroutineDispatcher;
@Keep
@Weaver
@Group("main_block_check")
public class AsyncHandlerReflectLancet {
@TargetClass(value = "java.lang.reflect.Method",scope = Scope.SELF)
@TargetMethod(methodName = "invoke")
@ReplaceInvoke
public static Object hookMethodInvoke(Method method, Object obj, Object... args) throws InvocationTargetException, IllegalAccessException {
Object ret = method.invoke(obj, args);
if (ret instanceof Handler && "createAsync".equals(method.getName())) {
CopyOnWriteArraySet<WeakReference<Handler>> asyncHandlers = MainBlockCheck.Companion.getAsyncHandlers();
asyncHandlers.add(new WeakReference<>((Handler) ret));
}
return ret;
}
@TargetClass(value = "android.os.Handler",scope = Scope.SELF)
@TargetMethod(methodName = "createAsync")
@ReplaceInvoke(isStatic = true)
public static Handler createAsync(Looper looper) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
Handler handler = Handler.createAsync(looper);
CopyOnWriteArraySet<WeakReference<Handler>> asyncHandlers = MainBlockCheck.Companion.getAsyncHandlers();
asyncHandlers.add(new WeakReference<>(handler));
return handler;
} else {
return new Handler(looper);
}
}
@TargetClass(value = "android.os.Handler",scope = Scope.SELF)
@TargetMethod(methodName = "createAsync")
@ReplaceInvoke(isStatic = true)
public static Handler createAsync(Looper looper, Handler.Callback callback) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
Handler handler = Handler.createAsync(looper, callback);
CopyOnWriteArraySet<WeakReference<Handler>> asyncHandlers = MainBlockCheck.Companion.getAsyncHandlers();
asyncHandlers.add(new WeakReference<>(handler));
return handler;
} else {
return new Handler(looper, callback);
}
}
}

View File

@@ -1,16 +1,15 @@
package com.mogo.launcher.lancet
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.graphics.Canvas
import android.app.*
import android.content.*
import android.graphics.*
import android.os.*
import android.os.Handler.Callback
import android.util.*
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.*
import androidx.annotation.*
import androidx.collection.ArrayMap
import androidx.core.os.HandlerCompat
import androidx.core.util.Pools
import com.knightboost.lancet.api.*
import com.knightboost.lancet.api.Scope.ALL
import com.knightboost.lancet.api.Scope.LEAF
@@ -22,8 +21,9 @@ import com.mogo.eagle.core.function.call.devatools.*
import com.mogo.eagle.core.utilcode.util.*
import kotlinx.coroutines.*
import kotlinx.coroutines.Runnable
import java.lang.ref.WeakReference
import java.util.LinkedList
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.*
import com.mogo.eagle.core.block.runtime.message.Message as Holder
@Keep
@@ -33,11 +33,61 @@ class MainBlockCheck {
companion object {
@JvmStatic
val tokens = ArrayMap<Any, Holder>(128)
private const val TAG = "MAIN_BLOCK_CHECK"
@JvmStatic
val whats by lazy { ConcurrentHashMap<Int, LinkedList<Holder>>() }
private val tokens = ConcurrentHashMap<Int, WeakReference<Holder>>(128)
private val pool by lazy { Executors.newFixedThreadPool(1) }
val asyncHandlers by lazy { CopyOnWriteArraySet<WeakReference<Handler>>() }
private val asyncHandlersMap by lazy { ConcurrentHashMap<Int, Boolean>() }
private val whats by lazy { ConcurrentHashMap<Int, LinkedList<WeakReference<Holder>>>() }
private data class PoolAction(var type: Int, var what: Int, var holder: Holder?, var elapsedTime: Long = -1, var duration:Long = -1): Runnable {
override fun run() {
try {
val h = holder
if (type == 0 && h != null) {
whats.getOrPut(what) { LinkedList<WeakReference<Holder>>() }.add(
WeakReference(h)
)
getRecorder()?.insert(h)
}
if (type == 1) {
val holders = whats.remove(what)?.mapNotNull { it.get() }
if (!holders.isNullOrEmpty()) {
getRecorder()?.remove(holders)
}
}
if (type == 2 && h != null) {
val what = h.what
if (what != null) {
whats.remove(what)?.removeAll { it.get() == h }
}
getRecorder()?.recycle(h.id, elapsedTime, duration)
}
} finally {
reset()
actionPool.release(this)
}
}
fun reset() {
type = -1
what = Int.MIN_VALUE
holder = null
elapsedTime = -1
duration = -1
}
}
private val actionPool by lazy { Pools.SynchronizedPool<PoolAction>(500) }
private fun getAction(): PoolAction = actionPool.acquire() ?: PoolAction(-1, 0, null)
@JvmStatic
fun getRecorder(): IMessageRecorder? {
@@ -48,20 +98,23 @@ class MainBlockCheck {
return block.recorder()
}
@JvmStatic val HANDLER by lazy {
Handler(Looper.getMainLooper()) { msg ->
val enclose = msg.obj as? Holder ?: throw AssertionError()
enclose.what?.also {
whats[it]?.remove(enclose)
@JvmStatic val callback by lazy {
Callback { msg ->
val enclose = msg.obj as? Holder
if (enclose == null) {
Log.w(TAG, "--- handleMessage --- 1 ---")
return@Callback true
}
if (!enclose.isValid()) {
Log.w(TAG, "--- handleMessage --- 2 ---:$enclose")
return@Callback true
}
val h = enclose.handler
val action = enclose.action
val oldMsg = enclose.origin
val oldObj = enclose.obj
val now = now()
if (enclose.enqueueTime <= 0) {
throw AssertionError("illegal: $enclose")
}
val elapsedTime = now - enclose.enqueueTime
try {
if (action != null) {
@@ -76,12 +129,20 @@ class MainBlockCheck {
}
} finally {
val duration = now() - now
getRecorder()?.recycle(enclose.id, elapsedTime, duration)
recycle(enclose, elapsedTime, duration)
}
true
}
}
@JvmStatic val ASYNC_HANDLER by lazy {
HandlerCompat.createAsync(Looper.getMainLooper(), callback)
}
@JvmStatic val HANDLER by lazy {
Handler(Looper.getMainLooper(), callback)
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "post")
@@ -90,144 +151,16 @@ class MainBlockCheck {
if (Looper.getMainLooper() != handler.looper) {
return handler.post(action)
}
val what = ObjectHashCodeUtils.getHashCodeIfNeed(action)
val msg = Message.obtain(handler, action)
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler)
val what = ObjectHashCodeUtils.getHashCodeIfNeed(newHandler, action)
msg.what = what
val holder = Holder.acquire(handler, action = action, what = what)
val holder = Holder.acquire(newHandler, action = action, isAsync = isAsync)
msg.obj = holder
val inserted = HANDLER.sendMessage(msg)
val inserted = newHandler.sendMessage(msg)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendEmptyMessage")
@ReplaceInvoke
fun handlerSendEmptyMessage(handler: Handler, what: Int): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendEmptyMessage(what)
}
val msg = Message.obtain(handler, what)
val holder = Holder.acquire(handler, what = what)
msg.obj = holder
val inserted = HANDLER.sendMessage(msg)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendEmptyMessageAtTime")
@ReplaceInvoke
fun handlerSendEmptyMessageAtTime(handler: Handler, what: Int, uptimeMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendEmptyMessageAtTime(what, uptimeMillis)
}
val msg = Message.obtain(handler, what)
val holder = Holder.acquire(handler, what = what, delay = uptimeMillis - SystemClock.uptimeMillis())
msg.obj = holder
val inserted = HANDLER.sendMessageAtTime(msg, uptimeMillis)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendEmptyMessageDelayed")
@ReplaceInvoke
fun handlerSendEmptyMessageDelayed(handler: Handler, what: Int, delayMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendEmptyMessageDelayed(what, delayMillis)
}
val msg = Message.obtain(handler, what)
val holder = Holder.acquire(handler, what = what, delay = delayMillis)
msg.obj = holder
val inserted = HANDLER.sendMessageDelayed(msg, delayMillis)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendMessage")
@ReplaceInvoke
fun handlerSendMessage(handler: Handler, msg: Message): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendMessage(msg)
}
val obj: Holder = Holder.acquire(handler, msg, obj = msg.obj, what = msg.what)
val oldObj = msg.obj
msg.obj = obj
if (oldObj != null) {
synchronized(tokens) {
tokens[oldObj] = obj
}
}
val inserted = HANDLER.sendMessage(msg)
if (inserted) {
getRecorder()?.insert(obj)
whats.getOrPut(msg.what) { LinkedList() }.add(obj)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendMessageAtTime")
@ReplaceInvoke
fun handlerSendMessageAtTime(handler: Handler, msg: Message, uptimeMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendMessageAtTime(msg, uptimeMillis)
}
val obj= Holder.acquire(handler, msg, obj = msg.obj, what = msg.what, delay = uptimeMillis - SystemClock.uptimeMillis())
val oldObj = msg.obj
msg.obj = obj
if (oldObj != null) {
synchronized(tokens) {
tokens[oldObj] = obj
}
}
val inserted = HANDLER.sendMessageAtTime(msg, uptimeMillis)
if (inserted) {
whats.getOrPut(msg.what) { LinkedList() }.add(obj)
getRecorder()?.insert(obj)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendMessageAtFrontOfQueue")
@ReplaceInvoke
fun handlerSendMessageAtFrontOfQueue(handler: Handler, msg: Message): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendMessageAtFrontOfQueue(msg)
}
val obj = Holder.acquire(handler, msg, obj = msg.obj, what = msg.what)
val old = msg.obj
msg.obj = obj
if (old != null) {
synchronized(tokens) {
tokens[old] = obj
}
}
val inserted = HANDLER.sendMessageAtFrontOfQueue(msg)
if (inserted) {
whats.getOrPut(msg.what) { LinkedList() }.add(obj)
getRecorder()?.insert(obj)
insert(what, holder)
}
return inserted
}
@@ -240,33 +173,290 @@ class MainBlockCheck {
if (Looper.getMainLooper() != handler.looper) {
return handler.postDelayed(action, delayMillis)
}
val what = ObjectHashCodeUtils.getHashCodeIfNeed(action)
val msg = Message.obtain(handler, action)
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler)
val what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
msg.what = what
val holder = Holder.acquire(handler, action = action, what = what, delay = delayMillis)
val holder = Holder.acquire(handler, action = action, delay = delayMillis, isAsync = isAsync)
msg.obj = holder
val inserted = HANDLER.sendMessageDelayed(msg, delayMillis)
val inserted = newHandler.sendMessageDelayed(msg, delayMillis)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "postAtTime")
@ReplaceInvoke
fun handlerPostDelayProxy2(handler: Handler, action: Runnable, token: Any?, delayMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return HandlerCompat.postDelayed(handler, action, token, delayMillis)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler)
val what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
msg.what = what
val holder = Holder.acquire(handler, action = action, delay = delayMillis, obj = token)
msg.obj = holder
if (token != null) {
synchronized(tokens) {
tokens[token.hashCode()] = WeakReference(holder)
}
}
val inserted = HandlerCompat.postDelayed(newHandler, action, token, delayMillis)
if (inserted) {
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "postAtFrontOfQueue")
@ReplaceInvoke
fun handlerPostAtFrontOfQueueProxy(handler: Handler, action: Runnable): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.postAtFrontOfQueue(action)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler)
val what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
msg.what = what
val holder = Holder.acquire(handler, action = action)
msg.obj = holder
val inserted = newHandler.sendMessageAtFrontOfQueue(msg)
if (inserted) {
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "postAtTime")
@ReplaceInvoke
fun handlerPostAtTimeProxy(handler: Handler, action: Runnable, uptimeMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.postAtTime(action, uptimeMillis)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler)
val what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
msg.what = what
val delta = uptimeMillis - SystemClock.uptimeMillis()
val holder = Holder.acquire(handler, action = action, delay = if (delta > 0) delta else 0)
msg.obj = holder
val inserted = newHandler.sendMessageAtTime(msg, uptimeMillis)
if (inserted) {
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "postAtTime")
@ReplaceInvoke
fun handlerPostAtTimeProxy2(handler: Handler, action: Runnable, token: Any?, uptimeMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.postAtTime(action, uptimeMillis)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler)
val what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
msg.what = what
val delta = uptimeMillis - SystemClock.uptimeMillis()
val holder = Holder.acquire(handler, action = action, delay = if (delta > 0) delta else 0, obj = token)
msg.obj = holder
if (token != null) {
synchronized(tokens) {
tokens[token.hashCode()] = WeakReference(holder)
}
}
val inserted = newHandler.sendMessageAtTime(msg, uptimeMillis)
if (inserted) {
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendEmptyMessage")
@ReplaceInvoke
fun handlerSendEmptyMessage(handler: Handler, what: Int): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendEmptyMessage(what)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler, what)
val holder = Holder.acquire(handler, what = what, isAsync = isAsync)
msg.obj = holder
val inserted = newHandler.sendMessage(msg)
if (inserted) {
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendEmptyMessageAtTime")
@ReplaceInvoke
fun handlerSendEmptyMessageAtTime(handler: Handler, what: Int, uptimeMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendEmptyMessageAtTime(what, uptimeMillis)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler, what)
val delta = uptimeMillis - SystemClock.uptimeMillis()
val holder = Holder.acquire(handler, what = what, delay = if (delta > 0) delta else 0, isAsync = isAsync)
msg.obj = holder
val inserted = newHandler.sendMessageAtTime(msg, uptimeMillis)
if (inserted) {
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendEmptyMessageDelayed")
@ReplaceInvoke
fun handlerSendEmptyMessageDelayed(handler: Handler, what: Int, delayMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendEmptyMessageDelayed(what, delayMillis)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
val msg = Message.obtain(newHandler, what)
val holder = Holder.acquire(handler, what = what, delay = delayMillis, isAsync = isAsync)
msg.obj = holder
val inserted = newHandler.sendMessageDelayed(msg, delayMillis)
if (inserted) {
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendMessage")
@ReplaceInvoke
fun handlerSendMessage(handler: Handler, msg: Message): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendMessage(msg)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
var newMsg = msg
val action = msg.callback
if (action != null) {
newMsg = Message.obtain(newHandler)
newMsg.what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
}
val obj: Holder = Holder.acquire(handler, originMsg = msg, action = msg.callback, obj = msg.obj, what = msg.what, isAsync = isAsync)
val oldObj = msg.obj
newMsg.obj = obj
if (oldObj != null) {
synchronized(tokens) {
tokens[oldObj.hashCode()] = WeakReference(obj)
}
}
val inserted = newHandler.sendMessage(newMsg)
if (inserted) {
insert(newMsg.what, obj)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendMessageAtTime")
@ReplaceInvoke
fun handlerSendMessageAtTime(handler: Handler, msg: Message, uptimeMillis: Long): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendMessageAtTime(msg, uptimeMillis)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
var newMsg = msg
val action = msg.callback
if (action != null) {
newMsg = Message.obtain(newHandler)
newMsg.what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
}
val delta = uptimeMillis - SystemClock.uptimeMillis()
val obj= Holder.acquire(handler, msg, obj = msg.obj, action = msg.callback, what = msg.what, delay = if (delta > 0) delta else 0, isAsync = isAsync)
val oldObj = msg.obj
newMsg.obj = obj
if (oldObj != null) {
synchronized(tokens) {
tokens[oldObj.hashCode()] = WeakReference(obj)
}
}
val inserted = newHandler.sendMessageAtTime(newMsg, uptimeMillis)
if (inserted) {
insert(newMsg.what, obj)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "sendMessageAtFrontOfQueue")
@ReplaceInvoke
fun handlerSendMessageAtFrontOfQueue(handler: Handler, msg: Message): Boolean {
if (Looper.getMainLooper() != handler.looper) {
return handler.sendMessageAtFrontOfQueue(msg)
}
val isAsync = asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }
val newHandler = getHandler(isAsync)
var newMsg = msg
val action = msg.callback
if (action != null) {
newMsg = Message.obtain(newHandler)
newMsg.what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
}
val obj = Holder.acquire(handler, msg, obj = msg.obj, action = msg.callback, what = msg.what, isAsync = isAsync)
val old = msg.obj
newMsg.obj = obj
if (old != null) {
synchronized(tokens) {
tokens[old.hashCode()] = WeakReference(obj)
}
}
val inserted = newHandler.sendMessageAtFrontOfQueue(newMsg)
if (inserted) {
insert(newMsg.what, obj)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.app.Activity", scope = ALL)
@TargetMethod(methodName = "post")
@ReplaceInvoke
fun runOnUiThreadOfActivityProxy(activity: Activity, action: Runnable) {
val what = ObjectHashCodeUtils.getHashCodeIfNeed(action)
val msg = Message.obtain()
val what = ObjectHashCodeUtils.getHashCodeIfNeed(activity, action)
msg.what = what
val holder = Holder.acquire(null, action = action, what = what)
val holder = Holder.acquire(null, action = action, what = msg.what, extra = mutableMapOf("runOnUiThread" to "${activity.javaClass.simpleName}#${action.javaClass.name}"))
msg.obj = holder
val inserted = HANDLER.sendMessage(msg)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
insert(what, holder)
}
}
@@ -275,15 +465,14 @@ class MainBlockCheck {
@TargetMethod(methodName = "post")
@ReplaceInvoke
fun postOfViewProxy(view: View, action: Runnable): Boolean {
val what = ObjectHashCodeUtils.getHashCodeIfNeed(action)
val msg = Message.obtain()
val what = ObjectHashCodeUtils.getHashCodeIfNeed(view, action)
msg.what = what
val holder = Holder.acquire(null, action = action, what = what)
val holder = Holder.acquire(null, action = action, what = what, extra = mutableMapOf("post" to "${view.javaClass.simpleName}#${action.javaClass.name}"))
msg.obj = holder
val inserted = HANDLER.sendMessage(msg)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
insert(what, holder)
}
return inserted
}
@@ -293,20 +482,18 @@ class MainBlockCheck {
@TargetMethod(methodName = "postDelayed")
@ReplaceInvoke
fun postDelayedOfViewProxy(view: View, action: Runnable, delayMillis: Long): Boolean {
val what = ObjectHashCodeUtils.getHashCodeIfNeed(action)
val msg = Message.obtain()
val what = ObjectHashCodeUtils.getHashCodeIfNeed(view, action)
msg.what = what
val holder = Holder.acquire(null, action = action, what = what, delay = delayMillis)
val holder = Holder.acquire(null, action = action, delay = delayMillis, what = what, extra = mutableMapOf("post" to "${view.javaClass.simpleName}#${action.javaClass.name}"))
msg.obj = holder
val inserted = HANDLER.sendMessageDelayed(msg, delayMillis)
if (inserted) {
getRecorder()?.insert(holder)
whats.getOrPut(what) { LinkedList() }.add(holder)
insert(what, holder)
}
return inserted
}
@JvmStatic
@TargetClass(value = "android.os.Handler", scope = ALL)
@TargetMethod(methodName = "removeCallbacks")
@@ -315,12 +502,9 @@ class MainBlockCheck {
if (Looper.getMainLooper() != handler.looper) {
return handler.removeCallbacks(action)
}
val what = ObjectHashCodeUtils.getHashCodeIfNeed(action)
HANDLER.removeMessages(what)
val holders = whats.remove(what)
if (!holders.isNullOrEmpty()) {
getRecorder()?.remove(holders)
}
val what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
getHandler(asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }).removeMessages(what)
remove(what)
}
@JvmStatic
@@ -331,12 +515,9 @@ class MainBlockCheck {
if (Looper.getMainLooper() != handler.looper) {
return handler.removeCallbacks(action, token)
}
val what = ObjectHashCodeUtils.getHashCodeIfNeed(action)
val holders = whats.remove(what)
if (!holders.isNullOrEmpty()) {
getRecorder()?.remove(holders)
}
HANDLER.removeMessages(what, if (token != null) { synchronized(tokens) { tokens.remove(token) } } else null)
val what = ObjectHashCodeUtils.getHashCodeIfNeed(handler, action)
getHandler(asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }).removeMessages(what, if (token != null) { synchronized(tokens) { tokens.remove(token.hashCode())?.get() } } else null)
remove(what)
}
@JvmStatic
@@ -347,11 +528,19 @@ class MainBlockCheck {
if (Looper.getMainLooper() != handler.looper) {
return handler.removeMessages(what)
}
val holders = whats.remove(what)
if (!holders.isNullOrEmpty()) {
getRecorder()?.remove(holders)
}
getHandler(asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }).removeMessages(what)
remove(what)
}
@JvmStatic
@TargetClass(value = "android.view.View", scope = ALL)
@TargetMethod(methodName = "removeCallbacks")
@ReplaceInvoke
fun viewRemoveCallback(view: View, action: Runnable): Boolean {
val what = ObjectHashCodeUtils.getHashCodeIfNeed(view, action)
HANDLER.removeMessages(what)
remove(what)
return true
}
@JvmStatic
@@ -362,19 +551,57 @@ class MainBlockCheck {
if (Looper.getMainLooper() != handler.looper) {
return handler.removeMessages(what, token)
}
val holders = whats.remove(what)
if (!holders.isNullOrEmpty()) {
getRecorder()?.remove(holders)
getHandler(asyncHandlersMap.getOrPut(handler.hashCode()) { computeIsAsyncHandler(handler) }).removeMessages(what, if (token != null) synchronized(tokens) { tokens.remove(token.hashCode())?.get() } else null)
remove(what)
}
private fun computeIsAsyncHandler(handler: Handler): Boolean {
return asyncHandlers.find { it.get() === handler } != null
}
fun insert(what: Int, holder: Holder) {
val action = getAction()
action.type = 0
action.what = what
action.holder = holder
pool.execute(action)
}
private fun remove(what: Int) {
val action = getAction()
action.type = 1
action.what = what
pool.execute(action)
}
fun recycle(holder: Holder, elapsedTime: Long, duration: Long) {
val action = getAction()
action.type = 2
action.holder = holder
action.elapsedTime = elapsedTime
action.duration = duration
pool.execute(action)
}
fun getHandler(isAsync: Boolean): Handler {
return if (isAsync) {
ASYNC_HANDLER
} else {
HANDLER
}
HANDLER.removeMessages(what, if (token != null) synchronized(tokens) { tokens.remove(token) } else null)
}
}
@TargetClass(value = "android.view.View", scope = LEAF)
@Insert(mayCreateSuper = true)
@TargetMethod(methodName = "onMeasure")
fun proxyViewOnMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val holder = Holder.acquire(handler = null, obj = "View[${This.get().javaClass.name}]:onMeasure")
pool.execute {
getRecorder()?.insert(holder)
}
val now = now()
try {
Origin.callVoid()
@@ -382,7 +609,9 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - now
getRecorder()?.insert(Holder.acquire(spend, "View[${This.get().javaClass.name}]:onMeasure"))
pool.execute {
getRecorder()?.recycle(holder.id, 0, spend)
}
}
}
@@ -391,7 +620,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onLayout")
fun proxyViewOnLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
val holder = Holder.acquire(handler = null, obj = "View[${This.get().javaClass.name}]:onLayout")
getRecorder()?.insert(holder)
insert(-1, holder)
val now = now()
try {
Origin.callVoid()
@@ -399,7 +628,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - now
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -409,7 +638,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onDraw")
fun proxyViewOnDraw(canvas: Canvas) {
val holder = Holder.acquire(handler = null, obj = "View[${This.get().javaClass.name}]:onDraw")
getRecorder()?.insert(holder)
insert(-1, holder)
val now = now()
try {
Origin.callVoid()
@@ -417,7 +646,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - now
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -426,7 +655,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onCreate")
fun proxyActivityOnCreate(savedInstanceState: Bundle?) {
val holder = Holder.acquire(handler = null, obj = "Activity[${This.get().javaClass.name}]:onCreate")
getRecorder()?.insert(holder)
insert(-1, holder)
val now = now()
try {
Origin.callVoid()
@@ -435,7 +664,7 @@ class MainBlockCheck {
} finally {
val spend = now() - now
CallerDevaToolsManager.block()?.monitor((This.get() as Activity).window)
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -444,7 +673,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onStart")
fun proxyActivityOnStart() {
val holder = Holder.acquire(handler = null, obj = "Activity[${This.get().javaClass.name}]:onStart")
getRecorder()?.insert(holder)
insert(-1, holder)
val now = now()
try {
Origin.callVoid()
@@ -452,7 +681,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - now
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -461,7 +690,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onResume")
fun proxyActivityOnResume() {
val holder = Holder.acquire(handler = null, obj = "Activity[${This.get().javaClass.name}]:onResume")
getRecorder()?.insert(holder)
insert(-1, holder)
val now = now()
CallerDevaToolsManager.block()?.resume((This.get() as Activity).window)
try {
@@ -470,7 +699,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - now
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -479,7 +708,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onPause")
fun proxyActivityOnPause() {
val holder = Holder.acquire(handler = null, obj = "Activity[${This.get().javaClass.name}]:onPause")
getRecorder()?.insert(holder)
insert(-1, holder)
CallerDevaToolsManager.block()?.pause((This.get() as Activity).window)
val now = now()
try {
@@ -488,7 +717,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - now
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -509,7 +738,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onCreateView")
fun proxyFragmentOnCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle?) {
val holder = Holder.acquire(handler = null, obj = "Fragment[${This.get().javaClass.name}]:onCreateView")
getRecorder()?.insert(holder)
insert(-1, holder)
val startTime = now()
try {
Origin.callVoid()
@@ -517,7 +746,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - startTime
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -526,7 +755,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onCreate")
fun proxyFragmentOnCreate(savedInstanceState: Bundle?) {
val holder = Holder.acquire(handler = null, obj = "Fragment[${This.get().javaClass.name}]:onCreate")
getRecorder()?.insert(holder)
insert(-1, holder)
val startTime = now()
try {
Origin.callVoid()
@@ -534,7 +763,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - startTime
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -543,7 +772,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onViewCreated")
fun proxyFragmentOnViewCreated(view: View, savedInstanceState: Bundle?) {
val holder = Holder.acquire(handler = null, obj = "Fragment[${This.get().javaClass.name}]:onViewCreated")
getRecorder()?.insert(holder)
insert(-1, holder)
val startTime = now()
try {
Origin.callVoid()
@@ -551,7 +780,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - startTime
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
@@ -560,7 +789,7 @@ class MainBlockCheck {
@TargetMethod(methodName = "onReceive")
fun proxyBroadcastReceiver(ctx: Context?, intent: Intent?) {
val holder = Holder.acquire(handler = null, obj = "Receiver[${This.get().javaClass.name}]:onReceive")
getRecorder()?.insert(holder)
insert(-1, holder)
val startTime = now()
try {
Origin.callVoid()
@@ -568,7 +797,7 @@ class MainBlockCheck {
throw t
} finally {
val spend = now() - startTime
getRecorder()?.recycle(holder.id, 0, spend)
recycle(holder, 0, spend)
}
}
}

View File

@@ -220,13 +220,13 @@ ext {
btrace : "com.bytedance.btrace:rhea-core:2.0.0",
mofang_runtime : "com.mogo.eagle.core.mofang:runtime:2.0.6",
log_runtime : "com.mogo.eagle.core.log.record:runtime:1.0.6",
log_runtime : "com.mogo.eagle.core.log.record:runtime:1.0.7",
// 安全证书
passport_secret : "com.zhidaoauto:sdk-java:1.0.5-SNAPSHOT",
// 主线程卡顿监测
block_detector : "com.mogo.eagle.core.block:runtime:10.0.0"
block_detector : "com.mogo.eagle.core.block:runtime:10.0.21"
]
android = [
launcherApplicationId : "com.mogo.launcher",

View File

@@ -88,28 +88,6 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
)
if (!hasObuLightStatus) {
if (!hasAiLightStatus) {
lastLightTime = System.currentTimeMillis()
if (lightCountDownTimer == null) {
lightCountDownTimer = object : CountDownTimer(300000, 1000) {
override fun onTick(millisUntilFinished: Long) {
if ((System.currentTimeMillis() - lastLightTime) > 1000) {
//隐藏红绿灯显示
hide("感知倒计时结束隐藏", DataSourceType.TELEMATIC)
lightCountDownTimer?.cancel()
lightCountDownTimer = null
}
}
override fun onFinish() {
lightCountDownTimer?.cancel()
lightCountDownTimer = null
}
}
lightCountDownTimer?.start()
}
trafficLights?.let { it ->
var light: TrafficLight? = null
if (it.hasStraight()) {
@@ -232,7 +210,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}
/**
* 红绿灯数据
* OBU红绿灯数据
*/
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT,
@@ -253,6 +231,31 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
"${SceneConstant.M_D_C}${TAG}",
"onTrafficLightPlusSource ----- light = $light ---remain = $remain ---lightSource = $lightSource ---hasObuLightStatus = $hasObuLightStatus ---hasAiLightStatus = $hasAiLightStatus"
)
//倒计时,超时还未更新数据则隐藏红绿灯
lastLightTime = System.currentTimeMillis()
if (lightCountDownTimer == null) {
lightCountDownTimer = object : CountDownTimer(300000, 1000) {
override fun onTick(millisUntilFinished: Long) {
if ((System.currentTimeMillis() - lastLightTime) > 1500) {
//隐藏红绿灯显示
hide("倒计时结束隐藏", lightSource)
lightCountDownTimer?.cancel()
lightCountDownTimer = null
}
}
override fun onFinish() {
//隐藏红绿灯显示
hide("倒计时结束隐藏", lightSource)
lightCountDownTimer?.cancel()
lightCountDownTimer = null
}
}
lightCountDownTimer?.start()
}
CallerTrafficLightListenerManager.showTrafficLight(light, lightSource)
if (remain == -1) {
CallerTrafficLightListenerManager.disableTrafficLightCountDown()

View File

@@ -7,6 +7,7 @@ import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
@@ -20,7 +21,7 @@ import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils.*
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.hmi_view_traffic_light.view.*
@@ -58,7 +59,11 @@ class SingleTrafficLightView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
LayoutInflater.from(context).inflate(R.layout.hmi_view_traffic_light, this, true)
if(trafficLightUser==1){
LayoutInflater.from(context).inflate(R.layout.hmi_view_traffic_light_taxi_p, this, true)
}else{
LayoutInflater.from(context).inflate(R.layout.hmi_view_traffic_light, this, true)
}
mLightIconIV = findViewById(R.id.hmi_traffic_light_iv)
mLightIconBG = findViewById(R.id.hmi_traffic_light_bg)
mLightTimeTV = findViewById(R.id.hmi_traffic_light_time_tv)
@@ -71,8 +76,8 @@ class SingleTrafficLightView @JvmOverloads constructor(
if(trafficLightUser==1){
hmi_traffic_light_bg.setBackgroundResource(R.drawable.traffic_light_bg_taxi_p)
hmi_traffic_light_source.setTextColor(resources.getColor(R.color.color_2D3E5F))
hmi_traffic_light_divider.setBackgroundColor(resources.getColor(R.color.color_2D3E5F))
hmi_traffic_light_source.setTextColor(ContextCompat.getColor(context,R.color.color_FF213757))
hmi_traffic_light_divider.setBackgroundColor(ContextCompat.getColor(context,R.color.color_CC5C71AB))
}
}
@@ -89,17 +94,17 @@ class SingleTrafficLightView @JvmOverloads constructor(
}
override fun onSkinModeChange(skinMode: Int) {
ThreadUtils.runOnUiThread {
runOnUiThread {
when (skinMode) {
0 -> {
hmi_traffic_light_bg.setBackgroundResource(R.drawable.traffic_light_bg)
hmi_traffic_light_source.setTextColor(resources.getColor(R.color.color_FFFFFF))
hmi_traffic_light_divider.setBackgroundColor(resources.getColor(R.color.color_FFFFFF))
hmi_traffic_light_source.setTextColor(ContextCompat.getColor(context,R.color.color_FFFFFF))
hmi_traffic_light_divider.setBackgroundColor(ContextCompat.getColor(context,R.color.color_FFFFFF))
}
1 -> {
hmi_traffic_light_bg.setBackgroundResource(R.drawable.traffic_light_bg_day_light)
hmi_traffic_light_source.setTextColor(resources.getColor(R.color.color_2D3E5F))
hmi_traffic_light_divider.setBackgroundColor(resources.getColor(R.color.color_2D3E5F))
hmi_traffic_light_source.setTextColor(ContextCompat.getColor(context,R.color.color_2D3E5F))
hmi_traffic_light_divider.setBackgroundColor(ContextCompat.getColor(context,R.color.color_2D3E5F))
}
}
}
@@ -184,12 +189,22 @@ class SingleTrafficLightView @JvmOverloads constructor(
if (redNum > 0) {
resetView()
mLightTimeTV!!.setVertical(true)
mLightTimeTV!!.setColorList(
intArrayOf(
resources.getColor(R.color.hmi_traffic_light_red_color_up),
resources.getColor(R.color.hmi_traffic_light_red_color_down)
if(trafficLightUser == 1){
mLightTimeTV!!.setColorList(
intArrayOf(
ContextCompat.getColor(context,R.color.color_FF384D6E),
ContextCompat.getColor(context,R.color.color_FF384D6E)
)
)
)
}else{
mLightTimeTV!!.setColorList(
intArrayOf(
ContextCompat.getColor(context,R.color.hmi_traffic_light_red_color_up),
ContextCompat.getColor(context,R.color.hmi_traffic_light_red_color_down)
)
)
}
mLightTimeTV!!.text = redNum.toString()
} else {
disableTrafficLightCountDown()
@@ -204,12 +219,21 @@ class SingleTrafficLightView @JvmOverloads constructor(
if (greenNum > 0) {
resetView()
mLightTimeTV!!.setVertical(true)
mLightTimeTV!!.setColorList(
intArrayOf(
resources.getColor(R.color.hmi_traffic_light_green_color_up),
resources.getColor(R.color.hmi_traffic_light_green_color_down)
if(trafficLightUser == 1){
mLightTimeTV!!.setColorList(
intArrayOf(
ContextCompat.getColor(context,R.color.color_FF384D6E),
ContextCompat.getColor(context,R.color.color_FF384D6E)
)
)
)
}else{
mLightTimeTV!!.setColorList(
intArrayOf(
ContextCompat.getColor(context,R.color.hmi_traffic_light_green_color_up),
ContextCompat.getColor(context,R.color.hmi_traffic_light_green_color_down)
)
)
}
mLightTimeTV!!.text = greenNum.toString()
} else {
disableTrafficLightCountDown()
@@ -224,12 +248,21 @@ class SingleTrafficLightView @JvmOverloads constructor(
if (yellowNum > 0) {
resetView()
mLightTimeTV!!.setVertical(true)
mLightTimeTV!!.setColorList(
intArrayOf(
resources.getColor(R.color.hmi_traffic_light_yellow_color_up),
resources.getColor(R.color.hmi_traffic_light_yellow_color_down)
if(trafficLightUser == 1){
mLightTimeTV!!.setColorList(
intArrayOf(
ContextCompat.getColor(context,R.color.color_FF384D6E),
ContextCompat.getColor(context,R.color.color_FF384D6E)
)
)
)
}else{
mLightTimeTV!!.setColorList(
intArrayOf(
ContextCompat.getColor(context,R.color.hmi_traffic_light_yellow_color_up),
ContextCompat.getColor(context,R.color.hmi_traffic_light_yellow_color_down)
)
)
}
mLightTimeTV!!.text = yellowNum.toString()
} else {
disableTrafficLightCountDown()
@@ -247,28 +280,40 @@ class SingleTrafficLightView @JvmOverloads constructor(
private fun updateTrafficLightIcon(lightId: TrafficLightEnum, lightSource: DataSourceType) {
when (lightId) {
TrafficLightEnum.RED -> {
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_red_nor)
if(trafficLightUser == 1){
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_red_taxi_p)
}else{
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_red_nor)
}
this@SingleTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.YELLOW -> {
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_lightyellow_nor)
if(trafficLightUser == 1){
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_lightyellow_taxi_p)
}else{
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_lightyellow_nor)
}
this@SingleTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.GREEN -> {
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_green_nor)
if(trafficLightUser == 1){
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_green_taxi_p)
}else{
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_green_nor)
}
this@SingleTrafficLightView.visibility = VISIBLE
}
else -> this@SingleTrafficLightView.visibility = GONE
}
when (lightSource) {
DataSourceType.AICLOUD -> {
mLightSourceTV!!.text = "云端下发"
mLightSourceTV!!.text = context.getString(R.string.light_source_ai_cloud)
}
DataSourceType.TELEMATIC -> {
mLightSourceTV!!.text = "自车感知"
mLightSourceTV!!.text = context.getString(R.string.light_source_perception)
}
DataSourceType.OBU -> {
mLightSourceTV!!.text = "OBU"
mLightSourceTV!!.text = context.getString(R.string.light_source_obu)
}
else -> {
mLightSourceTV!!.visibility = GONE

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/hmi_traffic_light_bus_layout_width"
android:layout_height="@dimen/hmi_traffic_light_layout_height"
xmlns:tools="http://schemas.android.com/tools"
android:visibility="visible">
<ImageView
android:id="@+id/hmi_traffic_light_bg"
android:layout_width="@dimen/hmi_traffic_light_bus_bg_width"
android:layout_height="@dimen/hmi_traffic_light_bg_height"
android:layout_marginStart="@dimen/hmi_traffic_light_bg_margin_left"
android:layout_marginTop="@dimen/hmi_traffic_light_bg_margin_top"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<ImageView
android:id="@+id/hmi_traffic_light_iv"
android:layout_width="@dimen/dp_116"
android:layout_height="@dimen/dp_116"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/dp_19"
android:scaleType="fitXY"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.GradientTextView
android:id="@+id/hmi_traffic_light_time_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="@dimen/hmi_traffic_light_time_size"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/hmi_traffic_light_divider"
android:layout_marginStart="@dimen/dp_116"
/>
<TextView
android:id="@+id/hmi_traffic_light_source"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="自车感知"
android:textSize="@dimen/hmi_traffic_light_source_size"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="@dimen/dp_30"
android:textStyle="bold"
/>
<View
android:id="@+id/hmi_traffic_light_divider"
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_47"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/hmi_traffic_light_source"
android:layout_marginEnd="@dimen/dp_25"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -79,7 +79,7 @@
<declare-styleable name="TrafficLightView">
<attr name="traffic_light_user">
<enum name="taxi_p" value="1" />
<enum name="traffic_light_taxi_p" value="1" />
</attr>
</declare-styleable>

View File

@@ -25,6 +25,9 @@
<color name="color_D4D8DC">#D4D8DC</color>
<color name="color_27FFFFFF">#27FFFFFF</color>
<color name="color_1E111111">#1E111111</color>
<color name="color_FF213757">#FF213757</color>
<color name="color_CC5C71AB">#335C71AB</color>
<color name="color_FF384D6E">#FF384D6E</color>
<color name="background_wtf">#FF999900</color>
<color name="background_error">#FFCC0000</color>

View File

@@ -82,4 +82,8 @@
<string name="hint_exit_app_again">再按一次退出应用</string>
<!--消息盒子V2X消息Title-->
<string name="v2x_title_content">%s-%s</string>
<!--红绿灯数据来源-->
<string name="light_source_ai_cloud">云端下发</string>
<string name="light_source_perception">自车感知</string>
<string name="light_source_obu">\u2000OBU\u2000</string>
</resources>

View File

@@ -253,11 +253,11 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
if (FunctionBuildConfig.isSecure) {
context?.let {
val authStatus =
SharedPrefsMgr.getInstance(it).getBoolean("passportAuth-${DebugConfig.getNetMode()}", false)
SharedPrefsMgr.getInstance(it).getBoolean("securityKey-${DebugConfig.getNetMode()}", false)
if (authStatus) {
// clientConfig设置auth值并带入header
clientConfig.authPubKey = SharedPrefsMgr.getInstance(it)
.getString("passportAuthKey-${DebugConfig.getNetMode()}", "")
.getString("securityKey-${DebugConfig.getNetMode()}", "")
return@let
}
// 安全校验
@@ -271,15 +271,15 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
nodeAliasCode = CHAIN_CODE_CLOUD_PASSPORT_AUTH_OK,
paramIndexes = [0]
)
override fun onSuccess(secretKey: String) {
override fun onSuccess(securityKey: String) {
CallerLogger.d(
"$M_MAIN$TAG",
"onSuccess secretKey:$secretKey , thread:${Thread.currentThread().name}"
"onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}"
)
clientConfig.authPubKey = secretKey
clientConfig.securityKey = securityKey
SharedPrefsMgr.getInstance(it)
.putString("passportAuthKey-${DebugConfig.getNetMode()}", secretKey)
SharedPrefsMgr.getInstance(it).putBoolean("passportAuth-${DebugConfig.getNetMode()}", true)
.putString("securityKey-${DebugConfig.getNetMode()}", securityKey)
SharedPrefsMgr.getInstance(it).putBoolean("securityKey-${DebugConfig.getNetMode()}", true)
}
@ChainLog(

View File

@@ -37,6 +37,7 @@ public class PassPortSecret {
}
this.secretCB = secretCB;
PassportService passportService = new PassportService();
passportService.setEnableLog(DebugConfig.isDebug());
domain.R<Passport> r = initLow(passportService, deviceId, path);
if (r.getCode() != ErrorCode.OK.getCode()) {
secretCB.onFailed(r.getCode(), r.getMsg());

View File

@@ -49,11 +49,11 @@ interface IMoGoTrafficLightListener {
fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {}
/**
* @param readNum 红灯倒计时
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {}
fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {}
fun changeCountdownGreen(greenNum: Int) {}

View File

@@ -58,12 +58,12 @@ object CallerChassisDoorStateListenerManager : CallerBase<IMoGoChassisDoorStateL
listCache.clear()
listCache.addAll(doorList)
doorList.forEach {
when (it.number) {
Chassis.DoorNumber.FRONT_LEFT -> frontLeft = it.status
Chassis.DoorNumber.FRONT_RIGHT -> frontRight = it.status
Chassis.DoorNumber.REAR_LEFT -> backLeft = it.status
Chassis.DoorNumber.REAR_RIGHT -> backRight = it.status
Chassis.DoorNumber.MIDDLE -> middle = it.status
when (it.number.number) {
Chassis.DoorNumber.FRONT_LEFT.number -> frontLeft = it.status
Chassis.DoorNumber.FRONT_RIGHT.number -> frontRight = it.status
Chassis.DoorNumber.REAR_LEFT.number -> backLeft = it.status
Chassis.DoorNumber.REAR_RIGHT.number -> backRight = it.status
Chassis.DoorNumber.MIDDLE.number -> middle = it.status
else -> {}
}
}

View File

@@ -71,10 +71,10 @@ object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener>
}
}
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
M_LISTENERS.forEach {
val listener = it.value
listener.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
listener.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
}
}

View File

@@ -11,18 +11,41 @@ public class ObjectHashCodeUtils {
private static final ConcurrentHashMap<String, Integer> hashCodes = new ConcurrentHashMap<>();
private static final StringBuilder keyBuilder = new StringBuilder(128);
public static int getHashCodeIfNeed(Object obj) {
if (obj == null) {
return -1;
public static int getHashCodeIfNeed(Object obj1, Object obj2) {
if (obj1 == null && obj2 == null) {
throw new AssertionError();
}
String name = obj.getClass().getName();
Integer value = hashCodes.get(name);
synchronized (keyBuilder) {
keyBuilder.setLength(0);
boolean flag = false;
if (obj1 != null) {
flag = true;
keyBuilder.append(obj1.hashCode());
}
if (obj2 != null) {
if (flag) {
keyBuilder.append("#");
}
keyBuilder.append(obj2.getClass().getName());
}
}
String key = keyBuilder.toString();
Integer value = hashCodes.get(key);
if (value != null) {
return value;
}
int hashCode = - System.identityHashCode(obj);
hashCodes.put(name, hashCode);
Object obj = obj2 == null ? obj1 : obj2;
int hashCode = -System.identityHashCode(obj);
if (hashCodes.containsValue(hashCode)) {
hashCode = -System.identityHashCode(new Object());
}
hashCodes.put(key, hashCode);
return hashCode;
}
public static int getHashCodeIfNeed(Object obj) {
return getHashCodeIfNeed(null, obj);
}
}

View File

@@ -66,23 +66,23 @@ SERVICE_BIZ_VERSION=1.2.4
LOGLIB_VERSION=1.7.0
######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.7.11
MOGO_NETWORK_VERSION=1.4.7.12
# 鉴权
MOGO_PASSPORT_VERSION=1.4.7.11
MOGO_PASSPORT_VERSION=1.4.7.12
# 常链接
MOGO_SOCKET_VERSION=1.4.7.11
MOGO_SOCKET_VERSION=1.4.7.12
# 数据采集
MOGO_REALTIME_VERSION=1.4.7.11
MOGO_REALTIME_VERSION=1.4.7.12
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.7.11
MOGO_TANLU_VERSION=1.4.7.12
# 直播推流
MOGO_LIVE_VERSION=1.4.7.11
MOGO_LIVE_VERSION=1.4.7.12
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.7.11
MOGO_TRAFFICLIVE_VERSION=1.4.7.12
# 定位服务
MOGO_LOCATION_VERSION=1.4.7.11
MOGO_LOCATION_VERSION=1.4.7.12
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.7.11
MOGO_TELEMATIC_VERSION=1.4.7.12
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=2.14.1.5

View File

@@ -19,7 +19,7 @@ LancetX {
enable true
}
main_block_check {
enable false
enable true
}
}
}