From 2dbef61f564668b2ba54fa7b5c8b6958cacf0fae Mon Sep 17 00:00:00 2001 From: zhongchao Date: Wed, 28 Dec 2022 18:21:33 +0800 Subject: [PATCH] [2.13.0-arch-opt] remove acc --- .../function/v2x/events/V2XEventManager.kt | 180 +++++++----------- .../v2x/events/alarm/V2XAlarmServer.java | 2 +- .../function/v2x/events/consts/V2XConst.java | 8 - .../manager/impl/MoGoV2XStatusManager.java | 3 - .../v2x/events/utils/FatigueDrivingUtils.java | 87 --------- .../v2x/events/utils/RoadConditionUtils.java | 40 ---- .../function/v2x/events/utils/V2XUtils.java | 48 ----- .../mogo-commons/src/main/AndroidManifest.xml | 12 -- .../module/intent/AccStatusIntentHandler.java | 52 ----- .../module/intent/IntentHandlerFactory.java | 2 - .../module/receiver/AccStatusReceiver.java | 16 -- .../module/status/IMogoStatusManager.java | 31 --- .../module/status/MogoStatusManager.java | 20 -- .../module/status/StatusDescriptor.java | 11 -- .../com/mogo/commons/utils/CarSeries.java | 125 ------------ 15 files changed, 72 insertions(+), 565 deletions(-) delete mode 100644 core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java delete mode 100644 core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/RoadConditionUtils.java delete mode 100644 core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XUtils.java delete mode 100644 foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AccStatusIntentHandler.java delete mode 100644 foudations/mogo-commons/src/main/java/com/mogo/commons/module/receiver/AccStatusReceiver.java delete mode 100644 foudations/mogo-commons/src/main/java/com/mogo/commons/utils/CarSeries.java diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index 0047affd45..36f94c984f 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -1,25 +1,30 @@ package com.mogo.eagle.core.function.v2x.events -import android.content.* -import android.os.* -import android.provider.Settings.System -import android.util.* +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.os.Handler +import android.os.Looper +import android.util.Log import androidx.core.util.Pair -import androidx.localbroadcastmanager.content.* -import com.mogo.cloud.commons.utils.* -import com.mogo.cloud.passport.* +import androidx.localbroadcastmanager.content.LocalBroadcastManager +import com.mogo.cloud.commons.utils.CoordinateUtils +import com.mogo.cloud.passport.IMoGoTokenCallback +import com.mogo.cloud.passport.MoGoAiCloudClient +import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.module.ServiceConst.CARD_TYPE_ROAD_CONDITION import com.mogo.commons.module.status.IMogoStatusChangedListener import com.mogo.commons.module.status.MogoStatusManager import com.mogo.commons.module.status.StatusDescriptor -import com.mogo.eagle.core.data.enums.EventTypeEnum -import com.mogo.eagle.core.data.enums.EventTypeHelper -import com.mogo.commons.network.* +import com.mogo.commons.network.ParamsUtil import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N -import com.mogo.eagle.core.data.enums.* -import com.mogo.eagle.core.data.map.* +import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.enums.EventTypeHelper +import com.mogo.eagle.core.data.enums.TrafficTypeEnum +import com.mogo.eagle.core.data.map.MogoLatLng +import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.map.entity.MarkerExploreWay import com.mogo.eagle.core.data.map.entity.MarkerShowEntity import com.mogo.eagle.core.data.map.entity.V2XMessageEntity @@ -27,57 +32,67 @@ import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg -import com.mogo.eagle.core.data.traffic.* -import com.mogo.eagle.core.function.api.hmi.warning.* -import com.mogo.eagle.core.function.api.map.listener.* -import com.mogo.eagle.core.function.call.hmi.* -import com.mogo.eagle.core.function.call.map.* +import com.mogo.eagle.core.data.traffic.TrafficData +import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener +import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager +import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager +import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager -import com.mogo.eagle.core.function.v2x.events.alarm.* -import com.mogo.eagle.core.function.v2x.events.bridge.* +import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context -import com.mogo.eagle.core.function.v2x.events.consts.* +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.* -import com.mogo.eagle.core.function.v2x.events.entity.net.* -import com.mogo.eagle.core.function.v2x.events.manager.* -import com.mogo.eagle.core.function.v2x.events.network.* -import com.mogo.eagle.core.function.v2x.events.observer.* -import com.mogo.eagle.core.function.v2x.events.receiver.* -import com.mogo.eagle.core.function.v2x.events.scenario.impl.* -import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.* +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSeekHelpRes +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XStrategyPushRes +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback +import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver +import com.mogo.eagle.core.function.v2x.events.receiver.SceneBroadcastReceiver +import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager +import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker.Marker -import com.mogo.eagle.core.function.v2x.events.utils.* import com.mogo.eagle.core.function.v2x.events.utils.MapUtils -import com.mogo.eagle.core.function.v2x.events.voice.* -import com.mogo.eagle.core.network.utils.* -import com.mogo.eagle.core.utilcode.mogo.logger.* +import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager +import com.mogo.eagle.core.network.utils.GsonUtil +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X -import com.mogo.eagle.core.utilcode.mogo.storage.* -import com.mogo.eagle.core.utilcode.util.* -import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr +import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.Utils -import com.mogo.map.listener.* -import com.mogo.map.marker.* +import com.mogo.map.marker.IMogoMarker +import com.mogo.map.marker.IMogoMarkerClickListener import com.mogo.map.marker.MogoMarkersHandler.Companion.mogoMarkersHandler -import com.mogo.v2x.* -import com.mogo.v2x.callback.* -import com.mogo.v2x.config.* +import com.mogo.v2x.V2XManager +import com.mogo.v2x.callback.IV2XCallback +import com.mogo.v2x.config.V2XConfig import com.mogo.v2x.data.* -import com.mogo.v2x.event.* -import com.shuyu.gsyvideoplayer.* -import com.shuyu.gsyvideoplayer.cache.* -import com.shuyu.gsyvideoplayer.model.* -import com.shuyu.gsyvideoplayer.player.* -import com.shuyu.gsyvideoplayer.utils.* -import com.zhjt.service.chain.* -import kotlinx.coroutines.* -import kotlinx.coroutines.android.* +import com.mogo.v2x.event.V2XEvent +import com.shuyu.gsyvideoplayer.GSYVideoManager +import com.shuyu.gsyvideoplayer.cache.CacheFactory +import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager +import com.shuyu.gsyvideoplayer.model.VideoOptionModel +import com.shuyu.gsyvideoplayer.player.IjkPlayerManager +import com.shuyu.gsyvideoplayer.player.PlayerFactory +import com.shuyu.gsyvideoplayer.utils.GSYVideoType +import com.zhjt.service.chain.ChainLog +import com.zhjt.service.chain.TracingConstants +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.android.asCoroutineDispatcher +import kotlinx.coroutines.cancel +import kotlinx.coroutines.launch import roadwork.Road.RW_PB -import tv.danmaku.ijk.media.player.* -import java.util.concurrent.* -import java.util.concurrent.atomic.* +import tv.danmaku.ijk.media.player.IjkMediaPlayer +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicBoolean object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallback, @@ -91,9 +106,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb private val hasInit by lazy { AtomicBoolean(false) } - // 记录历史行驶轨迹,用于车行驶方向计算,只保留两个数据 - private val historyPath = arrayOfNulls(2) - fun init(context: Context) { BridgeApi.init(context) if (hasInit.compareAndSet(false, true)) { @@ -116,8 +128,11 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb V2XVoiceManager.init(context) registerListener() - initData() + refreshStrategyConfig() + initCarForHelpStatus() + V2XManager.forceRefresh() MoGoAiCloudClient.getInstance().addTokenCallbacks(this) + // 注册广播接收场景弹窗使用的 val localReceiver = SceneBroadcastReceiver() val localBroadcastManager = LocalBroadcastManager.getInstance(context) @@ -137,8 +152,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb return super.onMarkerClicked(marker) } }) - MogoStatusManager.getInstance() - .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this) MogoStatusManager.getInstance() .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this) @@ -148,38 +161,8 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb V2XManager.removeCallback(this) CallerMapLocationListenerManager.removeListener(TAG, false) mogoMarkersHandler.unregisterMarkerClickListener(CARD_TYPE_ROAD_CONDITION) - MogoStatusManager.getInstance() - .unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this) MogoStatusManager.getInstance() .unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this) - - } - - private fun initData() { - try { // 查询ACC状态 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putBoolean("descriptor_ACC_STATUS", isAccOn()) - if (isAccOn()) { // 记录开机时间 - FatigueDrivingUtils.refreshAccOnTime() - } else { // 记录关机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString()) - } - } catch (e: Exception) { - e.printStackTrace() - } // 刷新配置文件 - refreshStrategyConfig() - } - - /** - * 是否是ACC ON操作 - * - * @return true-ACC ON | false - ACC OFF - */ - private fun isAccOn(): Boolean { - val accState = System.getInt(context().contentResolver, "mcu_state", -0x02) - //CallerLogger.d("$M_V2X$TAG", "状态发生改变\ndescriptor:ACC_STSTUS" + "\nisTrue:" + accState); - return accState == 1 } private fun handleRoadConditionMarkerClick(marker: IMogoMarker?) { @@ -242,19 +225,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) { CallerLogger.d("$M_V2X$TAG", "状态发生改变\ndescriptor:$descriptor\nisTrue:$isTrue") // 记录状态更改 // 记录状态更改 - SharedPrefsMgr.getInstance(Utils.getApp()).putBoolean("descriptor_$descriptor", isTrue) - if (descriptor == StatusDescriptor.ACC_STATUS) { - if (isTrue) { // 刷新配置文件 - refreshStrategyConfig() - // 记录开机时间 - FatigueDrivingUtils.refreshAccOnTime() - initCarForHelpStatus() - V2XManager.forceRefresh() - } else { // 记录关机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString()) - } - } else if (descriptor == StatusDescriptor.SEEK_HELPING) { + if (descriptor == StatusDescriptor.SEEK_HELPING) { refreshMeSeekHelp(isTrue) } } @@ -478,15 +449,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb ) } -// private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map? = null): V2XRoadEventEntity { // 记录道路事件 -// val v2XRoadEventEntity = V2XRoadEventEntity() -// v2XRoadEventEntity.location = e.location.toMarkerLocation() // 探路目前只有上报拥堵 -// v2XRoadEventEntity.poiType = EventTypeEnum.AI_ROAD_WORK.poiType -// v2XRoadEventEntity.noveltyInfo = e.toMarkExploreWay(extra) -// v2XRoadEventEntity.expireTime = 20000 -// return v2XRoadEventEntity -// } - private fun handleWarningTargetEvent(data: V2XWarningTarget) { val v2xMessageEntity = V2XMessageEntity() v2xMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java index 7525e6b364..510b54c0e1 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java @@ -25,7 +25,7 @@ import io.netty.util.internal.ConcurrentSet; public class V2XAlarmServer { // 记录道路播报的事件 - private static ConcurrentSet showedEvents = new ConcurrentSet<>(); + private static final ConcurrentSet showedEvents = new ConcurrentSet<>(); /** * 获取当前车辆前方距离最近的道路事件 */ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/V2XConst.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/V2XConst.java index 1be40996cc..0694a93473 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/V2XConst.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/V2XConst.java @@ -25,10 +25,7 @@ public class V2XConst { */ public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType"; - public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast"; - public static final String V2X_ACC_ON_TIME_STR = "v2x_acc_on_time_str"; - public static final String V2X_ACC_OFF_TIME_STR = "v2x_acc_off_time_str"; public static final String V2X_STRATEGY_PUSH = "v2x_strategy_push"; @@ -46,11 +43,6 @@ public class V2XConst { */ public static final String V2X_EVENT_ALARM_POI = "V2X_EVENT_ALARM_POI"; - /** - * V2X 特殊车辆 - */ - public static final String V2X_MARKER_SPECIAL_CAR = "V2X_MARKER_SPECIAL_CAR"; - /* *V2X 车路云前方预警-识别物 * */ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XStatusManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XStatusManager.java index 6a490ac288..9f04357bb1 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XStatusManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XStatusManager.java @@ -3,9 +3,7 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl; import android.content.Context; import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.commons.module.status.MogoStatusManager; import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; -import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusChangedListener; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor; @@ -53,7 +51,6 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager { @Override public void setRoadEventPOIShow(String tag, boolean show) { - MogoStatusManager.getInstance().setV2XUIShow(V2XConst.MODULE_NAME, show); mStatus.put(V2XStatusDescriptor.RoadEventPOI_UI, show); invokeStatusChangedListener(V2XStatusDescriptor.RoadEventPOI_UI, show); recordStatusModifier(tag, V2XStatusDescriptor.RoadEventPOI_UI); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java deleted file mode 100644 index 69ccb966d1..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.mogo.eagle.core.function.v2x.events.utils; - -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; - -import android.text.TextUtils; - -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; -import com.mogo.eagle.core.function.v2x.events.entity.net.V2XStrategyPushRes; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.constant.TimeConstants; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.utilcode.util.Utils; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/26 3:12 PM - * desc : 疲劳驾驶的工具类 - * version: 1.0 - */ -public class FatigueDrivingUtils { - - /** - * 获取驾驶时常 - * - * @return 驾驶市场 - */ - public static long getDrivingTime() { - // 获取 ACC ON 时间 - String accOnTime = SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_ACC_ON_TIME_STR); - if (TextUtils.isEmpty(accOnTime)) { - accOnTime = TimeUtils.getNowString(); - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, accOnTime); - } - return Math.abs(TimeUtils.getTimeSpanByNow(accOnTime, TimeConstants.MIN)); - } - - /** - * 刷新ACC ON时间记录 - * 获取上次记录的开机事件,判断如果当前acc on时间与上次acc off时间<20min的忽略 - */ - public static void refreshAccOnTime() { - // 获取 ACC ON 时间 - String localAccONTime = SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_ACC_ON_TIME_STR); - CallerLogger.INSTANCE.d(M_V2X + "FatigueDrivingUtils", "ACC ON时间:" + localAccONTime); - - // 如果本地没有记录时间则记录 - if (!TextUtils.isEmpty(localAccONTime)) { - // 获取配置信息 - V2XStrategyPushRes.ResultBean strategyPushEntity = - GsonUtil.objectFromJson(SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_STRATEGY_PUSH), V2XStrategyPushRes.ResultBean.class); - if (strategyPushEntity != null) { - // 获取 当前 ACC ON 时间 - String accOnTime = TimeUtils.getNowString(); - // 获取 ACC OFF 时间 - String accOFFTime = SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_ACC_OFF_TIME_STR); - if (!TextUtils.isEmpty(accOFFTime)) { - // 比较开关机时间,如果acc of 比 acc on 时间还要靠近说明acc on 时间记录有问题,需要更新同步 - long timeSpan = TimeUtils.getTimeSpan(accOnTime, accOFFTime, TimeConstants.MIN); - CallerLogger.INSTANCE.d(M_V2X + "FatigueDrivingUtils", "开关机时间间隔:" + timeSpan); - if (timeSpan >= strategyPushEntity.getRestIgnoreMinutes()) { - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, accOnTime); - } - } - } else { - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, TimeUtils.getNowString()); - } - } else { - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, TimeUtils.getNowString()); - } - } - -} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/RoadConditionUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/RoadConditionUtils.java deleted file mode 100644 index 6327431ded..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/RoadConditionUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mogo.eagle.core.function.v2x.events.utils; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; -import com.mogo.eagle.core.utilcode.util.Utils; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/16 2:25 PM - * desc : 调用探路模块相关的工具 - * version: 1.0 - * @author donghongyu - */ -public class RoadConditionUtils { - - /** - * 提交网络 - */ - public static void sendShareReceiverInfo(String infoId, - String poiType, - int likeOrDislike) { - showTip(); - BridgeApi.INSTANCE.refreshModel() - .addPoiInfoFabulous( - null, - infoId, - poiType, - likeOrDislike); - } - - /** - * 显示Toast - */ - private static void showTip() { - AIAssist.getInstance(Utils.getApp()).speakTTSVoiceWithLevel("已反馈", AIAssist.LEVEL2,null); - TipToast.tip("已反馈"); - } -} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XUtils.java deleted file mode 100644 index 5f9af48ce1..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XUtils.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.mogo.eagle.core.function.v2x.events.utils; - -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.Utils; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/21 3:58 PM - * desc : - * version: 1.0 - */ -public class V2XUtils { - - // 两次点击间隔不能少于1000ms - private static final int FAST_CLICK_DELAY_TIME = 1000; - private static long lastClickTime; - - public static boolean isFastClick() { - boolean flag = true; - long currentClickTime = System.currentTimeMillis(); - if ((currentClickTime - lastClickTime) >= FAST_CLICK_DELAY_TIME) { - flag = false; - } - lastClickTime = currentClickTime; - return flag; - } - - /** - * 当天第一次 - */ - public static boolean isFirstTodayWithKey(String key) { - SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.US); - String formatString = format.format(new Date()); - String value = SharedPrefsMgr.getInstance(Utils.getApp()).getString(key); - if (value.equals(formatString)) { - return true; - } else { - SharedPrefsMgr.getInstance(Utils.getApp()).putString(key, formatString); - return false; - } - } - -} diff --git a/foudations/mogo-commons/src/main/AndroidManifest.xml b/foudations/mogo-commons/src/main/AndroidManifest.xml index 4e20539844..be5afff8c7 100644 --- a/foudations/mogo-commons/src/main/AndroidManifest.xml +++ b/foudations/mogo-commons/src/main/AndroidManifest.xml @@ -4,16 +4,4 @@ - - - - - - - - - - diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AccStatusIntentHandler.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AccStatusIntentHandler.java deleted file mode 100644 index baa219f0a9..0000000000 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AccStatusIntentHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.mogo.commons.module.intent; - -import android.content.Context; -import android.content.Intent; - -import com.mogo.commons.module.ServiceConst; -import com.mogo.commons.module.status.MogoStatusManager; -import com.mogo.commons.utils.CarSeries; - - -/** - * @author congtaowang - * @since 2020/6/5 - * - * 描述 - */ -public class AccStatusIntentHandler implements IntentHandler { - - private static volatile AccStatusIntentHandler sInstance; - - private AccStatusIntentHandler() { - } - - public static AccStatusIntentHandler getInstance() { - if ( sInstance == null ) { - synchronized ( AccStatusIntentHandler.class ) { - if ( sInstance == null ) { - sInstance = new AccStatusIntentHandler(); - } - } - } - return sInstance; - } - - public synchronized void release() { - sInstance = null; - } - - @Override - public void handle( Context context, Intent intent ) { - String action = intent.getAction(); - if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) { - if ( CarSeries.isF8xxSeries() ) { - MogoStatusManager.getInstance().setAccStatus( ServiceConst.TYPE, true ); - } - } else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) { - if ( CarSeries.isF8xxSeries() ) { - MogoStatusManager.getInstance().setAccStatus( ServiceConst.TYPE, false ); - } - } - } -} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandlerFactory.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandlerFactory.java index 93ccf07129..dda7012546 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandlerFactory.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandlerFactory.java @@ -20,8 +20,6 @@ public class IntentHandlerFactory { private IntentHandlerFactory() { // private constructor mHandlers.put( MogoReceiver.ACTION_VOICE_UI, new VoiceUiIntentHandler() ); - mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() ); - mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() ); mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() ); } diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/receiver/AccStatusReceiver.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/receiver/AccStatusReceiver.java deleted file mode 100644 index ba12e69d9c..0000000000 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/receiver/AccStatusReceiver.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.commons.module.receiver; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import com.mogo.commons.module.intent.IntentHandlerFactory; - - -public class AccStatusReceiver extends BroadcastReceiver { - - @Override - public void onReceive( Context context, Intent intent ) { - IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent ); - } -} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusManager.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusManager.java index b7d4e29ab0..08bbe21565 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusManager.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusManager.java @@ -23,20 +23,6 @@ public interface IMogoStatusManager extends IProvider { */ boolean isVoiceShow(); - /** - * v2x UI 是否在展示 - * - * @return - */ - boolean isV2XShow(); - - /** - * 是否开机 - * - * @return true - 开机 false - 关机 - */ - boolean isAccOn(); - /** * 主页是否显示 * @@ -79,23 +65,6 @@ public interface IMogoStatusManager extends IProvider { */ void setVoiceUIShow( String tag, boolean show ); - /** - * 设置 V2X UI 状态 - *

- * - * @param tag 业务类型 - * @param show true - 显示 false - 隐藏 - */ - void setV2XUIShow( String tag, boolean show ); - - /** - * 设置 acc 状态 - * - * @param tag 业务类型 - * @param isOn true - on, false - off - */ - void setAccStatus( String tag, boolean isOn ); - /** * 主页 resume 状态 * diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/MogoStatusManager.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/MogoStatusManager.java index 7eb24a5b1e..e4a5c18f89 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/MogoStatusManager.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/MogoStatusManager.java @@ -58,16 +58,6 @@ public class MogoStatusManager implements IMogoStatusManager { return get_bool_val(StatusDescriptor.VR_MODE); } - @Override - public boolean isV2XShow() { - return get_bool_val(StatusDescriptor.V2X_UI); - } - - @Override - public boolean isAccOn() { - return get_bool_val(StatusDescriptor.ACC_STATUS); - } - @Override public boolean isMainPageOnResume() { return get_bool_val(StatusDescriptor.MAIN_PAGE_RESUME); @@ -103,16 +93,6 @@ public class MogoStatusManager implements IMogoStatusManager { doSetStatus(tag, StatusDescriptor.VOICE_UI, show); } - @Override - public void setV2XUIShow(String tag, boolean show) { - doSetStatus(tag, StatusDescriptor.V2X_UI, show); - } - - @Override - public void setAccStatus(String tag, boolean isOn) { - doSetStatus(tag, StatusDescriptor.ACC_STATUS, isOn); - } - @Override public void setMainPageResumeStatus(String tag, boolean resume) { doSetStatus(tag, StatusDescriptor.MAIN_PAGE_RESUME, resume); diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/StatusDescriptor.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/StatusDescriptor.java index f4e4a9b462..e15ba786ea 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/StatusDescriptor.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/StatusDescriptor.java @@ -8,21 +8,11 @@ package com.mogo.commons.module.status; */ public enum StatusDescriptor { - /** - * v2x UI - */ - V2X_UI, - /** * 小智语音交互 UI */ VOICE_UI, - /** - * 开机状态 - */ - ACC_STATUS, - /** * 主页 resume 状态 */ @@ -43,7 +33,6 @@ public enum StatusDescriptor { */ SEEK_HELPING, - /** * 是否已经进入vr模式 */ diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/CarSeries.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/CarSeries.java deleted file mode 100644 index 2b32ca441e..0000000000 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/CarSeries.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.mogo.commons.utils; - -import android.text.TextUtils; - -import com.mogo.commons.debug.DebugConfig; - -import java.lang.reflect.Method; - -/** - * @author congtaowang - * @since 2020-03-26 - *

- * 车机类型 - */ -public class CarSeries { - - private static boolean invokeFlag = false; - private static boolean isF8xxSeries = false; - - public static boolean isF8xxSeries() { - if ( invokeFlag ) { - return isF8xxSeries; - } - isF8xxSeries = DebugConfig.getProductFlavor().startsWith( "f" ); - invokeFlag = true; - return isF8xxSeries; - } - - @Deprecated - public static final int CAR_SERIES_C80X = 10; - @Deprecated - public static final int CAR_SERIES_D80X = 20; - @Deprecated - public static final int CAR_SERIES_D81X = 21; - @Deprecated - public static final int CAR_SERIES_D82X = 22; - @Deprecated - public static final int CAR_SERIES_D84X = 23; - @Deprecated - public static final int CAR_SERIES_F80X = 30; - @Deprecated - public static final int CAR_SERIES_G80X = 40; - @Deprecated - public static final int CAR_SERIES_E84X = 50; - @Deprecated - public static final int CAR_SERIES_E84XCD = 51; - @Deprecated - public static final int CAR_SERIES_E85X = 50; - @Deprecated - public static final int CAR_SERIES_E85XCD = 51; - @Deprecated - public static final int CAR_SERIES_E85XJD = 51; - - @Deprecated - public static int CAR_SERIES = 0; - - /** - * Deprecated. - * Use {@link DebugConfig#getProductFlavor()} instead. - * - * @return - */ - @Deprecated - public static int getSeries() { - if ( CAR_SERIES != 0 ) { - return CAR_SERIES; - } - synchronized ( CarSeries.class ) { - if ( CAR_SERIES != 0 ) { - return CAR_SERIES; - } - String device = get( "ro.fota.device" ); - if ( TextUtils.isEmpty( device ) ) { - return CAR_SERIES_F80X; - } - - if ( "FG166".equals( device ) ) { - CAR_SERIES = CAR_SERIES_C80X; - } else if ( "D801-802".equals( device ) ) { - CAR_SERIES = CAR_SERIES_D80X; - } else if ( "D801B-802B".equals( device ) ) { - // 2+16G - CAR_SERIES = CAR_SERIES_D80X; - } else if ( "D811-812".equals( device ) ) { - CAR_SERIES = CAR_SERIES_D81X; - } else if ( "D821-822".equals( device ) ) { - CAR_SERIES = CAR_SERIES_D82X; - } else if ( "D841-842".equals( device ) ) { - CAR_SERIES = CAR_SERIES_D84X; - } else if ( "G801-802".equals( device ) ) { - CAR_SERIES = CAR_SERIES_G80X; - } else if ( "F801-802".equals( device ) ) { - CAR_SERIES = CAR_SERIES_F80X; - } else if ( "E841-842".equals( device ) ) { - CAR_SERIES = CAR_SERIES_E84X; - } else if ( "E84XCD".equals( device ) ) { - CAR_SERIES = CAR_SERIES_E84XCD; - } else if ( "E851-852".equals( device ) ) { - CAR_SERIES = CAR_SERIES_E85X; - } else if ( "E85XCD".equals( device ) ) { - CAR_SERIES = CAR_SERIES_E85XCD; - } else if ( "E85XJD".equals( device ) ) { - CAR_SERIES = CAR_SERIES_E85XJD; - } else if ( device.startsWith( "E85" ) ) { - CAR_SERIES = CAR_SERIES_E85XJD; - } else { - CAR_SERIES = CAR_SERIES_F80X; - } - return CAR_SERIES; - } - } - - @Deprecated - private static String get( String key ) { - String value = ""; - try { - Class< ? > c = Class.forName( "android.os.SystemProperties" ); - Method get = c.getMethod( "get", new Class[]{String.class, String.class} ); - value = ( String ) get.invoke( c, new Object[]{key, "unknown"} ); - } catch ( Exception e ) { - value = ""; - } - return value; - } -}