diff --git a/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/BizBroadcastReceiver.kt b/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/BizBroadcastReceiver.kt index b33df5e396..5bcaf39ad8 100644 --- a/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/BizBroadcastReceiver.kt +++ b/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/BizBroadcastReceiver.kt @@ -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() } diff --git a/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt b/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt index ed7619f7b4..fcf51b39bf 100644 --- a/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt +++ b/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt @@ -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() + multiList.add(newBuilder.build()) + + CallerChassisDoorStateListenerManager.invokeAutopilotDoorState(multiList) + } else -> {} } } diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt index a3b49abe26..03c2e935df 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/AutopilotManager.kt @@ -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, diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt index fa4b262c37..0b9acd515d 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt @@ -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 { diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotView.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotView.kt index a0d0556852..969d1b2568 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotView.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotView.kt @@ -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() } } \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotViewModel.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotViewModel.kt index 5482ef3dda..969d3a59a3 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotViewModel.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/startautopilot/StartAutopilotViewModel.kt @@ -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) diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt index a94fe96e70..cb6bcc2ea9 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt @@ -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) { diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/utils/TaxiPassengerAnalyticsManager.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/utils/TaxiPassengerAnalyticsManager.java deleted file mode 100644 index a3b8d863a1..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/utils/TaxiPassengerAnalyticsManager.java +++ /dev/null @@ -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 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 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); - } -} diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/utils/TaxiPassengerAnalyticsManager.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/utils/TaxiPassengerAnalyticsManager.kt new file mode 100644 index 0000000000..5b4f60df6b --- /dev/null +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/utils/TaxiPassengerAnalyticsManager.kt @@ -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() + + 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() + 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) + } + +} \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car.png index 3dc7578590..560ba9a367 100644 Binary files a/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car.png and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car_light.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car_light.png index c980c18981..3d4acc9951 100644 Binary files a/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car_light.png and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable-xhdpi/taxi_p_map_car_light.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_000.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_000.png new file mode 100755 index 0000000000..dc02d142fc Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_000.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_001.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_001.png new file mode 100755 index 0000000000..bbdea63868 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_001.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_002.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_002.png new file mode 100755 index 0000000000..2e47294ae0 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_002.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_003.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_003.png new file mode 100755 index 0000000000..cdf8848baa Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_003.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_004.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_004.png new file mode 100755 index 0000000000..428b2e6089 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_004.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_005.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_005.png new file mode 100755 index 0000000000..b5848a97f8 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_005.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_006.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_006.png new file mode 100755 index 0000000000..68f6057614 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_006.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_007.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_007.png new file mode 100755 index 0000000000..85f75927b0 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_007.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_008.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_008.png new file mode 100755 index 0000000000..8ff0c749ee Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_008.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_009.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_009.png new file mode 100755 index 0000000000..bce367e306 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_009.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_010.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_010.png new file mode 100755 index 0000000000..89e66f1d6a Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_010.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_011.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_011.png new file mode 100755 index 0000000000..149ab11fba Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_011.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_012.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_012.png new file mode 100755 index 0000000000..5e58823550 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_012.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_013.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_013.png new file mode 100755 index 0000000000..d3079ef2da Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_013.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_014.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_014.png new file mode 100755 index 0000000000..5f2524166a Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_014.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_015.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_015.png new file mode 100755 index 0000000000..216249be50 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_015.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_016.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_016.png new file mode 100755 index 0000000000..4465305efc Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_016.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_017.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_017.png new file mode 100755 index 0000000000..533a974f5b Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_017.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_018.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_018.png new file mode 100755 index 0000000000..8dce9ab91f Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_018.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_019.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_019.png new file mode 100755 index 0000000000..5aa9065b4f Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_019.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_020.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_020.png new file mode 100755 index 0000000000..9594926e7c Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_020.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_021.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_021.png new file mode 100755 index 0000000000..dc3ab0f50d Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_021.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_022.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_022.png new file mode 100755 index 0000000000..bb5e8ee278 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_022.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_023.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_023.png new file mode 100755 index 0000000000..9647352845 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_023.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_024.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_024.png new file mode 100755 index 0000000000..27aa8b213d Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_024.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_025.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_025.png new file mode 100755 index 0000000000..88e8fee290 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_025.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_026.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_026.png new file mode 100755 index 0000000000..718de44286 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_026.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_027.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_027.png new file mode 100755 index 0000000000..baef995016 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_027.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_028.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_028.png new file mode 100755 index 0000000000..51c492f00f Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_028.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_029.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_029.png new file mode 100755 index 0000000000..42ae9da6b9 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_029.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_030.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_030.png new file mode 100755 index 0000000000..8422896d73 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_030.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_031.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_031.png new file mode 100755 index 0000000000..2a92bba341 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_031.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_032.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_032.png new file mode 100755 index 0000000000..02081c5a36 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_032.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_033.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_033.png new file mode 100755 index 0000000000..673c1f8301 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_033.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_034.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_034.png new file mode 100755 index 0000000000..5ffe7bbb2c Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_034.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_035.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_035.png new file mode 100755 index 0000000000..89b156fc30 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_035.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_036.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_036.png new file mode 100755 index 0000000000..eb99f327c0 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_036.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_037.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_037.png new file mode 100755 index 0000000000..b002816e80 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_037.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_038.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_038.png new file mode 100755 index 0000000000..92b56f031b Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_038.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_039.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_039.png new file mode 100755 index 0000000000..ee1fd2d15e Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_039.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_040.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_040.png new file mode 100755 index 0000000000..efbebc1c84 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_040.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_041.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_041.png new file mode 100755 index 0000000000..a976070776 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_041.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_042.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_042.png new file mode 100755 index 0000000000..ca1edadfd7 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_042.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_043.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_043.png new file mode 100755 index 0000000000..7b255286bb Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_043.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_044.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_044.png new file mode 100755 index 0000000000..710755927c Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_044.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_045.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_045.png new file mode 100755 index 0000000000..7c9123c8bc Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_045.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_046.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_046.png new file mode 100755 index 0000000000..82fc0d5753 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_046.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_047.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_047.png new file mode 100755 index 0000000000..c7c91207c3 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_047.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_048.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_048.png new file mode 100755 index 0000000000..28032ff402 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_048.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_049.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_049.png new file mode 100755 index 0000000000..2c6830833f Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_049.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_050.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_050.png new file mode 100755 index 0000000000..04afd5754c Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_050.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_051.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_051.png new file mode 100755 index 0000000000..ba9e72c76f Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_051.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_052.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_052.png new file mode 100755 index 0000000000..3468c9dbe4 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_052.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_053.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_053.png new file mode 100755 index 0000000000..46da555c6f Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_053.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_054.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_054.png new file mode 100755 index 0000000000..15cf6b1a89 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_054.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_055.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_055.png new file mode 100755 index 0000000000..01903dda51 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_055.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_056.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_056.png new file mode 100755 index 0000000000..372bad7c5d Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_056.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_057.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_057.png new file mode 100755 index 0000000000..2d27f781a0 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_057.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_058.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_058.png new file mode 100755 index 0000000000..4812010741 Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_058.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_059.png b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_059.png new file mode 100755 index 0000000000..47e92e74ce Binary files /dev/null and b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/xiaozhi_belt_059.png differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/font/din.ttf b/OCH/mogo-och-taxi-passenger/src/main/res/font/din.ttf index db558e4dbc..60e06cb75f 100644 Binary files a/OCH/mogo-och-taxi-passenger/src/main/res/font/din.ttf and b/OCH/mogo-och-taxi-passenger/src/main/res/font/din.ttf differ diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml index eb7cbdbcd4..5367e1e268 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml @@ -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" /> diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_bottom_bar.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_bottom_bar.xml index a43e39baef..db389e16c1 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_bottom_bar.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_bottom_bar.xml @@ -10,8 +10,8 @@ + + diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_itinerary.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_itinerary.xml index 7ef46d3e44..852c6b1fb4 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_itinerary.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_itinerary.xml @@ -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" /> diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values/arrays.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values/arrays.xml index d72eb2b061..1776029165 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values/arrays.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values/arrays.xml @@ -186,4 +186,75 @@ @drawable/xiaozhi_love_058 @drawable/xiaozhi_love_059 + + + + @drawable/xiaozhi_belt_000 + @drawable/xiaozhi_belt_001 + @drawable/xiaozhi_belt_002 + @drawable/xiaozhi_belt_003 + @drawable/xiaozhi_belt_004 + @drawable/xiaozhi_belt_005 + @drawable/xiaozhi_belt_006 + @drawable/xiaozhi_belt_007 + @drawable/xiaozhi_belt_008 + @drawable/xiaozhi_belt_009 + + @drawable/xiaozhi_belt_010 + @drawable/xiaozhi_belt_011 + @drawable/xiaozhi_belt_012 + @drawable/xiaozhi_belt_013 + @drawable/xiaozhi_belt_014 + @drawable/xiaozhi_belt_015 + @drawable/xiaozhi_belt_016 + @drawable/xiaozhi_belt_017 + @drawable/xiaozhi_belt_018 + @drawable/xiaozhi_belt_019 + + @drawable/xiaozhi_belt_020 + @drawable/xiaozhi_belt_021 + @drawable/xiaozhi_belt_022 + @drawable/xiaozhi_belt_023 + @drawable/xiaozhi_belt_024 + @drawable/xiaozhi_belt_025 + @drawable/xiaozhi_belt_026 + @drawable/xiaozhi_belt_027 + @drawable/xiaozhi_belt_028 + @drawable/xiaozhi_belt_029 + + + @drawable/xiaozhi_belt_030 + @drawable/xiaozhi_belt_031 + @drawable/xiaozhi_belt_032 + @drawable/xiaozhi_belt_033 + @drawable/xiaozhi_belt_034 + @drawable/xiaozhi_belt_035 + @drawable/xiaozhi_belt_036 + @drawable/xiaozhi_belt_037 + @drawable/xiaozhi_belt_038 + @drawable/xiaozhi_belt_039 + + @drawable/xiaozhi_belt_040 + @drawable/xiaozhi_belt_041 + @drawable/xiaozhi_belt_042 + @drawable/xiaozhi_belt_043 + @drawable/xiaozhi_belt_044 + @drawable/xiaozhi_belt_045 + @drawable/xiaozhi_belt_046 + @drawable/xiaozhi_belt_047 + @drawable/xiaozhi_belt_048 + @drawable/xiaozhi_belt_049 + + + @drawable/xiaozhi_belt_050 + @drawable/xiaozhi_belt_051 + @drawable/xiaozhi_belt_052 + @drawable/xiaozhi_belt_053 + @drawable/xiaozhi_belt_054 + @drawable/xiaozhi_belt_055 + @drawable/xiaozhi_belt_056 + @drawable/xiaozhi_belt_057 + @drawable/xiaozhi_belt_058 + @drawable/xiaozhi_belt_059 + \ No newline at end of file diff --git a/app/src/main/java/com/mogo/launcher/lancet/AsyncHandlerReflectLancet.java b/app/src/main/java/com/mogo/launcher/lancet/AsyncHandlerReflectLancet.java new file mode 100644 index 0000000000..a651fba406 --- /dev/null +++ b/app/src/main/java/com/mogo/launcher/lancet/AsyncHandlerReflectLancet.java @@ -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> 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> 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> asyncHandlers = MainBlockCheck.Companion.getAsyncHandlers(); + asyncHandlers.add(new WeakReference<>(handler)); + return handler; + } else { + return new Handler(looper, callback); + } + } +} diff --git a/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt b/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt index 31214f5da5..8fd39e4280 100644 --- a/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt +++ b/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt @@ -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(128) + private const val TAG = "MAIN_BLOCK_CHECK" @JvmStatic - val whats by lazy { ConcurrentHashMap>() } + private val tokens = ConcurrentHashMap>(128) + + private val pool by lazy { Executors.newFixedThreadPool(1) } + + val asyncHandlers by lazy { CopyOnWriteArraySet>() } + + private val asyncHandlersMap by lazy { ConcurrentHashMap() } + + private val whats by lazy { ConcurrentHashMap>>() } + + 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>() }.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(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) } } } \ No newline at end of file diff --git a/config.gradle b/config.gradle index 95a31710b8..6b427de3e0 100644 --- a/config.gradle +++ b/config.gradle @@ -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", diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt index bca8361b3e..cbc8fceac5 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt @@ -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() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt index 9c8b4a77b0..8c229f8890 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt @@ -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 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_light_green_taxi_p.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_light_green_taxi_p.png new file mode 100644 index 0000000000..5880ac9fd6 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_light_green_taxi_p.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_light_red_taxi_p.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_light_red_taxi_p.png new file mode 100644 index 0000000000..35886c0737 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_light_red_taxi_p.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_lightyellow_taxi_p.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_lightyellow_taxi_p.png new file mode 100644 index 0000000000..0355f43139 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/hmi_lightyellow_taxi_p.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_traffic_light_taxi_p.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_traffic_light_taxi_p.xml new file mode 100644 index 0000000000..7845671a6b --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_traffic_light_taxi_p.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml index 8519e67a96..ff93b33d7e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml @@ -79,7 +79,7 @@ - + diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index 4db8ecf5b7..25544292eb 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -25,6 +25,9 @@ #D4D8DC #27FFFFFF #1E111111 + #FF213757 + #335C71AB + #FF384D6E #FF999900 #FFCC0000 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml index 2ea3cd0e92..d994155d5b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml @@ -82,4 +82,8 @@ 再按一次退出应用 %s-%s + + 云端下发 + 自车感知 + \u2000OBU\u2000 diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt index ddb508ba99..786ecfd526 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt @@ -253,11 +253,11 @@ class HttpDnsStartUp : AndroidStartup() { 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() { 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( diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java index 0b0edd9a91..cbdd188515 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java @@ -37,6 +37,7 @@ public class PassPortSecret { } this.secretCB = secretCB; PassportService passportService = new PassportService(); + passportService.setEnableLog(DebugConfig.isDebug()); domain.R r = initLow(passportService, deviceId, path); if (r.getCode() != ErrorCode.OK.getCode()) { secretCB.onFailed(r.getCode(), r.getMsg()); diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/union/IMoGoTrafficLightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/union/IMoGoTrafficLightListener.kt index 13491090cd..a612706b6c 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/union/IMoGoTrafficLightListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/union/IMoGoTrafficLightListener.kt @@ -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) {} diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisDoorStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisDoorStateListenerManager.kt index 3db1192539..ef0d8e9275 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisDoorStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisDoorStateListenerManager.kt @@ -58,12 +58,12 @@ object CallerChassisDoorStateListenerManager : CallerBase 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 -> {} } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallerTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallerTrafficLightListenerManager.kt index b795e482a8..b71eb67d59 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallerTrafficLightListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallerTrafficLightListenerManager.kt @@ -71,10 +71,10 @@ object CallerTrafficLightListenerManager : CallerBase } } - 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) } } diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ObjectHashCodeUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ObjectHashCodeUtils.java index b860b5319e..e841673568 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ObjectHashCodeUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ObjectHashCodeUtils.java @@ -11,18 +11,41 @@ public class ObjectHashCodeUtils { private static final ConcurrentHashMap 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); + } } diff --git a/gradle.properties b/gradle.properties index d81a505d36..57733a4e4a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/gradle/bytex/bytex_lancetx.gradle b/gradle/bytex/bytex_lancetx.gradle index ca8aa1f7a4..9beadd492d 100644 --- a/gradle/bytex/bytex_lancetx.gradle +++ b/gradle/bytex/bytex_lancetx.gradle @@ -19,7 +19,7 @@ LancetX { enable true } main_block_check { - enable false + enable true } } }