Merge branch 'dev_robotaxi-d_240807_6.6.0' into tmp_6.7.0_arrow
This commit is contained in:
@@ -177,9 +177,9 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
BadCaseManager.init(mContext!!)
|
||||
if (DebugConfig.isDebug()) {
|
||||
SdtManager.init(mContext!!, true, DetectResultImpl())
|
||||
// 监听弱网
|
||||
WeakNetworkStrategy.startListen()
|
||||
}
|
||||
// 监听弱网
|
||||
WeakNetworkStrategy.startListen()
|
||||
lookAroundDataProvider.init(mContext!!)
|
||||
(mContext as? Application)?.also {
|
||||
mofangProvider.init(it)
|
||||
@@ -237,34 +237,34 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
/**
|
||||
* 检查上传崩溃日志
|
||||
*/
|
||||
override fun checkUploadCrashLog() {
|
||||
mContext?.let {
|
||||
val crashDir = File(it.getExternalFilesDir(null), "crash")
|
||||
if(crashDir.exists() && crashDir.canExecute() && crashDir.listFiles()?.isNotEmpty() == true){
|
||||
it.lifeCycleScope.launch(Dispatchers.IO){
|
||||
val startTime = crashDir.lastModified() - 60*1000
|
||||
val endTime = if(System.currentTimeMillis() - crashDir.lastModified()>60*1000){
|
||||
crashDir.lastModified() + 60*1000
|
||||
}else{
|
||||
System.currentTimeMillis()
|
||||
}
|
||||
var isUploadSuccess = false
|
||||
try {
|
||||
MoGoLogRecordProviderImpl.isUploadExtraFile = false
|
||||
CallerDevaToolsManager.logcat()?.upload(startTime, endTime)
|
||||
isUploadSuccess = true
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
} finally {
|
||||
MoGoLogRecordProviderImpl.isUploadExtraFile = true
|
||||
}
|
||||
if(isUploadSuccess){
|
||||
crashDir.deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// override fun checkUploadCrashLog() {
|
||||
// mContext?.let {
|
||||
// val crashDir = File(it.getExternalFilesDir(null), "crash")
|
||||
// if(crashDir.exists() && crashDir.canExecute() && crashDir.listFiles()?.isNotEmpty() == true){
|
||||
// it.lifeCycleScope.launch(Dispatchers.IO){
|
||||
// val startTime = crashDir.lastModified() - 60*1000
|
||||
// val endTime = if(System.currentTimeMillis() - crashDir.lastModified()>60*1000){
|
||||
// crashDir.lastModified() + 60*1000
|
||||
// }else{
|
||||
// System.currentTimeMillis()
|
||||
// }
|
||||
// var isUploadSuccess = false
|
||||
// try {
|
||||
// MoGoLogRecordProviderImpl.isUploadExtraFile = false
|
||||
// CallerDevaToolsManager.logcat()?.upload(startTime, endTime)
|
||||
// isUploadSuccess = true
|
||||
// } catch (t: Throwable) {
|
||||
// t.printStackTrace()
|
||||
// } finally {
|
||||
// MoGoLogRecordProviderImpl.isUploadExtraFile = true
|
||||
// }
|
||||
// if(isUploadSuccess){
|
||||
// crashDir.deleteRecursively()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 受channel业务影响的功能,需要更新,todo 建议有流程
|
||||
|
||||
@@ -52,7 +52,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsList
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
@@ -127,7 +126,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
MogoStatusManager.getInstance()
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
if(ProjectUtils.isSaas()){
|
||||
CallerFsm2024ListenerManager.addListener(TAG,this)
|
||||
// CallerFsm2024ListenerManager.addListener(TAG,this)
|
||||
CallerAutopilotStatisticsListenerManager.addListener(TAG,this)
|
||||
CallerOrderListenerManager.addListener(TAG,this)
|
||||
CallerAutoPilotStatusListenerManager.addListener("RecordViewManager",this)
|
||||
@@ -570,36 +569,36 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
*/
|
||||
override fun onFSM2024State(fsmState: Fsm2024.FSMStateMsg) {
|
||||
Log.i(TAG,"onFSM2024State fsmState.pilotStandbyFlag="+fsmState.pilotStandbyFlag+" pilotNotStandbyReason="+ fsmState.pilotNotStandbyReason)
|
||||
if(fsmState.pilotStandbyFlag){
|
||||
BadCaseConfig.fsmAlreadyStandby = true
|
||||
}
|
||||
if(BadCaseConfig.fsmAlreadyStandby){
|
||||
if(!fsmState.pilotStandbyFlag){
|
||||
//pilotStandbyFlag == false代表自动驾驶无法启动
|
||||
if(!BadCaseConfig.alreadyShowOneReport){
|
||||
//触发一键上报
|
||||
ThreadUtils.runOnUiThread {
|
||||
val activity = AppStateManager.currentActivity()
|
||||
if (activity !is AppCompatActivity) {
|
||||
return@runOnUiThread
|
||||
}
|
||||
if(reportTypeWindow == null){
|
||||
reportTypeWindow = ReportTypeWindow(activity)
|
||||
reportTypeWindow?.setClickListener(object: ReportTypeWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
reportTypeWindow?.hideFloatWindow()
|
||||
reportTypeWindow = null
|
||||
}
|
||||
})
|
||||
}
|
||||
reportTypeWindow?.showOneClickReportWindow(xPosition,yPosition)
|
||||
BadCaseConfig.alreadyShowOneReport = true
|
||||
}
|
||||
}
|
||||
}else{
|
||||
BadCaseConfig.alreadyShowOneReport = false
|
||||
}
|
||||
}
|
||||
// if(fsmState.pilotStandbyFlag){
|
||||
// BadCaseConfig.fsmAlreadyStandby = true
|
||||
// }
|
||||
// if(BadCaseConfig.fsmAlreadyStandby){
|
||||
// if(!fsmState.pilotStandbyFlag){
|
||||
// //pilotStandbyFlag == false代表自动驾驶无法启动
|
||||
// if(!BadCaseConfig.alreadyShowOneReport){
|
||||
// //触发一键上报
|
||||
// ThreadUtils.runOnUiThread {
|
||||
// val activity = AppStateManager.currentActivity()
|
||||
// if (activity !is AppCompatActivity) {
|
||||
// return@runOnUiThread
|
||||
// }
|
||||
// if(reportTypeWindow == null){
|
||||
// reportTypeWindow = ReportTypeWindow(activity)
|
||||
// reportTypeWindow?.setClickListener(object: ReportTypeWindow.ClickListener{
|
||||
// override fun closeWindow() {
|
||||
// reportTypeWindow?.hideFloatWindow()
|
||||
// reportTypeWindow = null
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// reportTypeWindow?.showOneClickReportWindow(xPosition,yPosition)
|
||||
// BadCaseConfig.alreadyShowOneReport = true
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// BadCaseConfig.alreadyShowOneReport = false
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -702,4 +701,14 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
BadCaseConfig.tenantId = tenantId
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听登录登出状态
|
||||
*/
|
||||
override fun onLoginStatusUpdate(isLogin: Boolean) {
|
||||
if(reportTypeWindow?.getWindowShowStatus() == true){
|
||||
reportTypeWindow?.hideFloatWindow()
|
||||
reportTypeWindow = null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ object BadCaseConfig {
|
||||
//本次问题是否已经触发一键上报
|
||||
@JvmField
|
||||
var alreadyShowOneReport: Boolean = false
|
||||
//FSM是否已经变为可以启自驾
|
||||
@JvmField
|
||||
var fsmAlreadyStandby: Boolean = false
|
||||
// //FSM是否已经变为可以启自驾
|
||||
// @JvmField
|
||||
// var fsmAlreadyStandby: Boolean = false
|
||||
//租户ID
|
||||
@JvmField
|
||||
var tenantId: Long = 0
|
||||
|
||||
@@ -12,6 +12,10 @@ import android.view.WindowManager
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.ToggleButton
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig.coDriverStatus
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig.mainDriverStatus
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig.rearRowStatus
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.msgbox.AutopilotMsg
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
@@ -223,6 +227,35 @@ class ExamControlWindow constructor(activity: Activity): View.OnTouchListener{
|
||||
ivEmergencyStop.setOnClickListener {
|
||||
CallerAutoPilotControlManager.sendPlanningPullOverCmd(3)
|
||||
}
|
||||
|
||||
//主驾
|
||||
tbSeatMainDriver.isChecked = mainDriverStatus
|
||||
tbSeatMainDriver.setOnCheckedChangeListener{compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
mainDriverStatus = isChecked
|
||||
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
|
||||
}
|
||||
//副驾
|
||||
tbSeatPassenger.isChecked = coDriverStatus
|
||||
tbSeatPassenger.setOnCheckedChangeListener{compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
coDriverStatus = isChecked
|
||||
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
|
||||
}
|
||||
//后排
|
||||
tbSeatRear.isChecked = rearRowStatus
|
||||
tbSeatRear.setOnCheckedChangeListener{compoundButton, isChecked ->
|
||||
if(!compoundButton.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
rearRowStatus = isChecked
|
||||
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
|
||||
@@ -27,8 +27,12 @@ import com.mogo.core.log.record.model.UploadError
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.function.api.devatools.logcat.*
|
||||
import com.mogo.eagle.core.utilcode.download.DownloadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhidao.cosupload.callback.CosStatusCallback
|
||||
import com.zhidao.cosupload.callback.CosStatusCallbackManager
|
||||
import com.zhidao.cosupload.model.CallbackData
|
||||
import com.zhidao.loglib.bean.RemoteLogPushContent
|
||||
import com.zhjt.mogo_core_function_devatools.BuildConfig
|
||||
import com.zhidao.loglib.upload.UploadManager
|
||||
import com.zhjt.mogo_core_function_devatools.logcat.checker.AnrLogChecker
|
||||
import com.zhjt.mogo_core_function_devatools.logcat.config.LogRecordConfig
|
||||
import com.zhjt.mogo_core_function_devatools.logcat.uploader.*
|
||||
@@ -37,6 +41,7 @@ import java.io.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeUnit.MINUTES
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
|
||||
@@ -142,7 +147,7 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
|
||||
builder.crashConfig(
|
||||
CrashConfig.Builder()
|
||||
.enabled(true)
|
||||
.uploader(CrashLogUploader(context))
|
||||
.uploader(CrashLogUploader())
|
||||
.crashDir(File(context.getExternalFilesDir(null), "crash"))
|
||||
.expireDuration(TimeUnit.DAYS.toMillis(3))
|
||||
.javaCrash(true)
|
||||
@@ -243,32 +248,97 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
|
||||
SystemClock.sleep(15000)
|
||||
}
|
||||
|
||||
private class CrashLogUploader(private val mContext: Context): ICrashFileUploader {
|
||||
private class CrashLogUploader : ICrashFileUploader {
|
||||
|
||||
override suspend fun upload(
|
||||
type: CrashType,
|
||||
crashTime: String,
|
||||
file: File,
|
||||
extra: Map<String, String>?
|
||||
): Boolean {
|
||||
try {
|
||||
val keyMessage = when(type) {
|
||||
JavaCrash -> extra?.get("java stacktrace") ?: extra?.get("backtrace") ?: "#"
|
||||
NativeCrash -> extra?.get("backtrace") ?: "#"
|
||||
ANRCrash -> extra?.get("backtrace") ?: "#"
|
||||
}
|
||||
val typeStr = when(type){
|
||||
JavaCrash -> "JavaCrash"
|
||||
NativeCrash -> "NativeCrash"
|
||||
ANRCrash -> "ANRCrash"
|
||||
}
|
||||
CrashLogAnalyticsManager.crashLogAnalytics(typeStr,keyMessage)
|
||||
return true
|
||||
} catch (t: Throwable) {
|
||||
return false
|
||||
}
|
||||
companion object {
|
||||
private const val TAG = "CrashLogUploader"
|
||||
}
|
||||
|
||||
}
|
||||
override suspend fun upload(type: CrashType, crashTime: String, file: File, extra: Map<String, String>?): Boolean = suspendCancellableCoroutine {
|
||||
val isStartUpload = AtomicBoolean(false)
|
||||
val isInvoked = AtomicBoolean(false)
|
||||
val retry = AtomicInteger(0)
|
||||
CosStatusCallbackManager.getInstance().register(object : CosStatusCallback {
|
||||
override fun onStartUpload(data: CallbackData?) {
|
||||
if (data?.localPath == file.absolutePath) {
|
||||
isStartUpload.set(true)
|
||||
Log.d(TAG, "---- onStartUpload ---: $data")
|
||||
}
|
||||
}
|
||||
|
||||
override fun uploadCosCompleted(data: CallbackData?) {
|
||||
if (data?.localPath == file.absolutePath && isInvoked.compareAndSet(false, true)) {
|
||||
try {
|
||||
isStartUpload.set(true)
|
||||
Log.d(TAG, "---- uploadCosCompleted ---: $data")
|
||||
CosStatusCallbackManager.getInstance().unregister(this)
|
||||
} finally {
|
||||
try {
|
||||
val keyMessage = when (type) {
|
||||
JavaCrash -> extra?.get("java stacktrace") ?: extra?.get("backtrace") ?: "#"
|
||||
NativeCrash -> extra?.get("backtrace") ?: "#"
|
||||
ANRCrash -> extra?.get("backtrace") ?: "#"
|
||||
}
|
||||
val typeStr = when (type) {
|
||||
JavaCrash -> "JavaCrash"
|
||||
NativeCrash -> "NativeCrash"
|
||||
ANRCrash -> "ANRCrash"
|
||||
}
|
||||
CrashLogAnalyticsManager.crashLogAnalytics(typeStr, keyMessage)
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
it.resumeWith(Result.success(true))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun uploadCosFailed(data: CallbackData?) {
|
||||
if (data?.localPath == file.absolutePath && isInvoked.compareAndSet(false, true)) {
|
||||
try {
|
||||
Log.d(TAG, "---- uploadCosFailed ---: $data")
|
||||
isStartUpload.set(true)
|
||||
CosStatusCallbackManager.getInstance().unregister(this)
|
||||
} finally {
|
||||
it.resumeWith(Result.failure(IllegalStateException(data?.exception ?: "上传崩溃文件失败")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProgress(data: CallbackData?) {
|
||||
if (data?.localPath == file.absolutePath) {
|
||||
isStartUpload.set(true)
|
||||
Log.d(TAG, "---- onProgress ---: $data")
|
||||
}
|
||||
}
|
||||
})
|
||||
ThreadUtils.getIoPool().execute {
|
||||
try {
|
||||
while (retry.get() < 3 && !isStartUpload.get()) {
|
||||
try {
|
||||
Log.d(TAG, "---- 上传开始 ---: ${retry.get()}")
|
||||
UploadManager.getInstance().uploadSingleFile(file.absolutePath)
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
SystemClock.sleep(5000)
|
||||
retry.addAndGet(1)
|
||||
}
|
||||
if (!isStartUpload.get() && isInvoked.compareAndSet(false, true)) {
|
||||
it.resumeWith(Result.failure(IllegalStateException("重试3次,还没有开始上传, 真无语...")))
|
||||
return@execute
|
||||
}
|
||||
if (retry.get() > 3 && isInvoked.compareAndSet(false, true)) {
|
||||
it.resumeWith(Result.failure(IllegalStateException("重试3次,没有收到结果回调,真无语...")))
|
||||
return@execute
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
if (isInvoked.compareAndSet(false, true)) {
|
||||
it.resumeWith(Result.failure(t))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,8 @@ object StatusManager {
|
||||
}
|
||||
listeners.clear()
|
||||
flows.clear()
|
||||
model.resetData()
|
||||
last.set(null)
|
||||
}
|
||||
|
||||
fun addListener(tag: String, listener: IStatusListener) {
|
||||
@@ -178,6 +180,10 @@ object StatusManager {
|
||||
return
|
||||
}
|
||||
listeners[tag] = listener
|
||||
try {
|
||||
val all = model.status.value?.second ?: emptyList()
|
||||
listener.onStatusChanged(all, all)
|
||||
} catch (ignore: Throwable) {}
|
||||
}
|
||||
|
||||
fun removeListener(tag: String) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import android.content.Context
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoNodeStateListener
|
||||
import com.mogo.eagle.core.function.api.order.IOrderListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerNodeStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
@@ -21,7 +24,7 @@ import kotlinx.coroutines.launch
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStatusListener,
|
||||
IMoGoFsm2024Listener, IMoGoNodeStateListener {
|
||||
IMoGoFsm2024Listener, IMoGoNodeStateListener, IOrderListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "FSMImpl"
|
||||
@@ -73,8 +76,8 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerFsm2024ListenerManager.addListener(TAG, this)
|
||||
CallerNodeStateListenerManager.addNodeStateListener(TAG, setOf(AdasConstants.NodeName.FSM2024), this)
|
||||
CallerOrderListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onAutopilotIpcConnectStatusChanged(
|
||||
status: AdasConstants.IpcConnectionStatus,
|
||||
reason: String?
|
||||
@@ -124,11 +127,20 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLoginStatusUpdate(isLogin: Boolean) {
|
||||
super.onLoginStatusUpdate(isLogin)
|
||||
if (!isLogin) {
|
||||
CallerLogger.d(TAG, "onLoginStatusUpdate isLogin=$isLogin")
|
||||
CallerHmiManager.dismissFSMStatusDetailWindow()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
CallerLogger.d("$M_DEVA$TAG", "-- onDestroy --")
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerFsm2024ListenerManager.removeListener(TAG)
|
||||
CallerNodeStateListenerManager.removeNodeStateListener(TAG)
|
||||
CallerOrderListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,11 @@ internal class StatusModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun resetData() {
|
||||
status.value = DEFAULTS
|
||||
old.set(null)
|
||||
}
|
||||
|
||||
private fun getExceptionStatus(l: ArrayList<Status>): Status? {
|
||||
return l.find { it.isException() }
|
||||
}
|
||||
|
||||
@@ -34,6 +34,21 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
||||
init()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second.filter { (it !is IAutopilotPreLaunchStatus) || (it is FSMStatus)}) }?.also { adapter -> rv.adapter = adapter }
|
||||
adapter?.let { _ ->
|
||||
observer?.also { model.status.removeObserver(it) }
|
||||
model.status.observeForever(Observer<Pair<Status?, ArrayList<Status>>> { data ->
|
||||
val old = adapter.data
|
||||
val update = data.second.filter { (it !is IAutopilotPreLaunchStatus) || (it is FSMStatus) }
|
||||
val result = DiffUtil.calculateDiff(StatusDiffCallback(old, update))
|
||||
adapter.data = update
|
||||
result.dispatchUpdatesTo(adapter)
|
||||
}.also { observer = it })
|
||||
}
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
rv.also { itx ->
|
||||
itx.itemAnimator?.run {
|
||||
@@ -49,16 +64,6 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
||||
.horizontalInnerSpace(10.PX)
|
||||
.build()
|
||||
)
|
||||
val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second.filter { (it !is IAutopilotPreLaunchStatus) || (it is FSMStatus)}) }?.also { adapter -> itx.adapter = adapter }
|
||||
adapter?.let { _ ->
|
||||
model.status.observeForever(Observer<Pair<Status?, ArrayList<Status>>> { data ->
|
||||
val old = adapter.data
|
||||
val update = data.second.filter { (it !is IAutopilotPreLaunchStatus) || (it is FSMStatus) }
|
||||
val result = DiffUtil.calculateDiff(StatusDiffCallback(old, update))
|
||||
adapter.data = update
|
||||
result.dispatchUpdatesTo(adapter)
|
||||
}.also { observer = it })
|
||||
}
|
||||
}
|
||||
|
||||
// onDetach {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhjt.mogo_core_function_devatools.weaknetwork
|
||||
import android.util.Log
|
||||
import com.mogo.cloud.network.WeakNetworkManager
|
||||
import com.mogo.cloud.network.WeakNetworkManager.setListener
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
@@ -10,6 +11,7 @@ import com.mogo.weak.network.SdtManager
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||
|
||||
|
||||
object WeakNetworkStrategy {
|
||||
|
||||
private const val TAG = "WeakNetworkStrategy"
|
||||
@@ -19,7 +21,8 @@ object WeakNetworkStrategy {
|
||||
|
||||
private const val WEAK_HTTP_RTT = 1300
|
||||
|
||||
private const val VERY_CONSUMING_TIME_URL = "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync"
|
||||
private const val VERY_CONSUMING_TIME_URL =
|
||||
"/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync"
|
||||
|
||||
private var lastOutputTime = 0L
|
||||
|
||||
@@ -41,16 +44,37 @@ object WeakNetworkStrategy {
|
||||
setListener(object : WeakNetworkManager.OnWeakHttpListener {
|
||||
override fun onHttpRttReceived(hashCode: Int, url: String, timeStamp: Long) {
|
||||
if (VERY_CONSUMING_TIME_URL in url) return
|
||||
outputLog(url, timeStamp)
|
||||
//outputLog(url, timeStamp)
|
||||
}
|
||||
|
||||
override fun onFailEvent(hashCode: Int, url: String, timeStamp: Long, currentFailCount: Long) {
|
||||
outputLog(url, timeStamp, true)
|
||||
override fun onFailEvent(
|
||||
hashCode: Int,
|
||||
url: String,
|
||||
timeStamp: Long,
|
||||
currentFailCount: Long
|
||||
) {
|
||||
//outputLog(url, timeStamp, true)
|
||||
}
|
||||
|
||||
override fun onWeakNetworkEvent() {
|
||||
// // 大而全接口干扰,需排除掉
|
||||
// Log.d(TAG, "收到弱网事件!")
|
||||
// 大而全接口干扰,需排除掉
|
||||
//Log.d(TAG, "收到弱网事件!")
|
||||
}
|
||||
|
||||
override fun logMethod(name: String, startTime: Long) {
|
||||
// 网络耗时大于5秒的提示
|
||||
// if ((startTime / 1000000000.0) > 5) {
|
||||
// ToastUtils.showShort("当前网络质量差!")
|
||||
// }
|
||||
|
||||
// 网络质量差的请求上报埋点
|
||||
val elapsedTime: Long = System.nanoTime() - startTime
|
||||
val properties: MutableMap<String, Any> = HashMap()
|
||||
properties["http_request"] = name
|
||||
properties["http_request_start_time"] = startTime
|
||||
properties["http_request_elapsed_time"] = elapsedTime
|
||||
|
||||
MogoAnalyticUtils.track("http_net_status", properties)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
// takeOverListAdapter?.notifyRecordItemRemoved(removeRecord)
|
||||
iterator.remove()
|
||||
}
|
||||
recordList = CallerTakeOverManager.getAllRecord(context)
|
||||
recordList = CallerTakeOverManager.getAllRecord(context).asReversed()
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(recordList.isNullOrEmpty()){
|
||||
tvRecordNoData.visibility = View.VISIBLE
|
||||
@@ -188,7 +188,7 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
*/
|
||||
private fun refreshList(){
|
||||
scope.launch(Dispatchers.IO){
|
||||
recordList = CallerTakeOverManager.getAllRecord(context)
|
||||
recordList = CallerTakeOverManager.getAllRecord(context).asReversed()
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(recordList.isNullOrEmpty()){
|
||||
tvRecordNoData.visibility = View.VISIBLE
|
||||
@@ -196,7 +196,7 @@ class TakeOverRecordView @JvmOverloads constructor(
|
||||
}else{
|
||||
tvRecordNoData.visibility = View.GONE
|
||||
recordGroup.visibility = View.VISIBLE
|
||||
//更新列表
|
||||
//更新列表,倒序显示
|
||||
takeOverListAdapter?.setData(recordList!!)
|
||||
}
|
||||
|
||||
|
||||
@@ -361,6 +361,10 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
context?.let { StatusView.statusView.toggle(it) }
|
||||
}
|
||||
|
||||
override fun hideStatusSummaryDialog() {
|
||||
context?.let { StatusView.statusView.toggle(it) }
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ class FSMStatusDetailWindowManager private constructor() {
|
||||
offsetY = AutoSizeUtils.dp2px(context, 112f),
|
||||
offsetX = AutoSizeUtils.dp2px(context, (214f) * -1L)
|
||||
)
|
||||
.setImmersionStatusBar(true)
|
||||
.setImmersionStatusBar(false)
|
||||
.slideDel(false)
|
||||
.setWindowHeight(WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
.setWindowWidth(AutoSizeUtils.dp2px(context, 538f))
|
||||
|
||||
@@ -8,6 +8,8 @@ import android.view.WindowManager
|
||||
import android.view.animation.OvershootInterpolator
|
||||
import com.mogo.eagle.core.data.enums.SidePattern
|
||||
import com.mogo.eagle.core.data.status.StatusSummaryEntity
|
||||
import com.mogo.eagle.core.function.api.order.IOrderListener
|
||||
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
||||
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
@@ -22,12 +24,25 @@ class StatusView private constructor() {
|
||||
private var mStatusSummaryViewFloat: WarningFloat.Builder? = null
|
||||
private var mStatusSummaryView: StatusSummaryView? = null
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = "StatusSummaryView"
|
||||
val statusView by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
StatusView()
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
CallerOrderListenerManager.addListener(TAG, object : IOrderListener{
|
||||
override fun onLoginStatusUpdate(isLogin: Boolean) {
|
||||
super.onLoginStatusUpdate(isLogin)
|
||||
if (!isLogin) {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun toggle(context: Context, gravity: Int = Gravity.RIGHT, sidePattern: SidePattern = SidePattern.RIGHT) {
|
||||
if (mStatusSummaryViewFloat != null) {
|
||||
dismiss()
|
||||
|
||||
@@ -208,7 +208,7 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
startLeakMonitor()
|
||||
}
|
||||
CallerDevaToolsManager.checkMonitorDb()
|
||||
CallerDevaToolsManager.checkUploadCrashLog()
|
||||
// CallerDevaToolsManager.checkUploadCrashLog()
|
||||
}
|
||||
|
||||
private fun startLeakMonitor() {
|
||||
|
||||
@@ -17,7 +17,7 @@ class CrossRoad(private val delayTime: Long = 0, unit: TimeUnit = TimeUnit.SECON
|
||||
Scene(delayTime, unit) {
|
||||
|
||||
override fun getVisualAngleMode(): VisualAngleMode {
|
||||
if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
return VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS
|
||||
}
|
||||
return MAP_STYLE_VR_ANGLE_CROSS_NEW
|
||||
@@ -36,7 +36,7 @@ class CrossRoad(private val delayTime: Long = 0, unit: TimeUnit = TimeUnit.SECON
|
||||
}
|
||||
|
||||
override fun getScreenToOriginDis(): ScreenToOriginDis {
|
||||
if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
return NONE
|
||||
}
|
||||
return DOWN
|
||||
|
||||
@@ -16,7 +16,7 @@ class Default(val delayTime: Long = 0, val unit: TimeUnit = TimeUnit.SECONDS, va
|
||||
|
||||
override fun getVisualAngleMode(): VisualAngleMode {
|
||||
Log.d("Default", "---- 1 --------------")
|
||||
if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
Log.d("Default", "---- 2 --------------")
|
||||
return VisualAngleMode.MAP_STYLE_VR_ERHAI_B2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user