Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0'
Dev arch opt 3.0 See merge request zhjt/AndroidApp/MoGoEagleEye!729
This commit is contained in:
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.data.deva.scene.SceneTAG
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
|
||||
import com.mogo.eagle.core.function.api.devatools.apm.*
|
||||
import com.mogo.eagle.core.function.api.devatools.strict.*
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhjt.mogo_core_function_devatools.apm.*
|
||||
@@ -35,6 +36,7 @@ import com.zhjt.mogo_core_function_devatools.report.IPCReportManager
|
||||
import com.zhjt.mogo_core_function_devatools.report.IPCReportManager.Companion.iPCReportManager
|
||||
import com.zhjt.mogo_core_function_devatools.scene.SceneManager.Companion.sceneManager
|
||||
import com.zhjt.mogo_core_function_devatools.status.StatusManager
|
||||
import com.zhjt.mogo_core_function_devatools.strict.*
|
||||
import com.zhjt.mogo_core_function_devatools.trace.TraceManager.Companion.traceManager
|
||||
import com.zhjt.mogo_core_function_devatools.tts.TtsManager.Companion.ttsManager
|
||||
import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeManager.Companion.upgradeManager
|
||||
@@ -48,7 +50,9 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
private val apmEnvProvider by lazy { ApmEnvProviderImpl }
|
||||
private val apmEnvProvider by lazy { ApmEnvProviderImpl() }
|
||||
|
||||
private val strictModeProvider by lazy { StrictModeProviderImpl() }
|
||||
|
||||
@Volatile
|
||||
private var mDockerVersion: String? = null
|
||||
@@ -253,4 +257,5 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
override fun queryObuUpgrade(obuVersionName: String) {
|
||||
bindingCarManager.queryObuUpgrade(obuVersionName)
|
||||
}
|
||||
override fun strict(): IStrictModeProvider = strictModeProvider
|
||||
}
|
||||
@@ -17,9 +17,9 @@ import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.coroutines.*
|
||||
|
||||
object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
class ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
|
||||
private const val TAG = "ApmEnvProvider"
|
||||
private val TAG = "ApmEnvProvider"
|
||||
|
||||
private val scope by lazy { CoroutineScope(Dispatchers.IO + SupervisorJob()) }
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.zhjt.mogo_core_function_devatools.strict
|
||||
|
||||
import android.os.*
|
||||
import android.os.StrictMode.ThreadPolicy.Builder
|
||||
import android.os.StrictMode.VmPolicy
|
||||
import com.mogo.eagle.core.function.api.devatools.strict.*
|
||||
|
||||
/**
|
||||
* 严格模式功能管理
|
||||
* 1. 监测主线程磁盘读写
|
||||
* 2. 监测主线程网络请求
|
||||
* 3. 监测磁盘输入输出流使用异常(未及时关闭)
|
||||
* 4. 监测数据库查询操作异常(cursor使用未关闭)
|
||||
* 5. 监测资源类型不匹配(TypedValue)
|
||||
* 6. 监测文件读写未使用Buffer(增加buffer可以减少系统调用,降低性能损耗)
|
||||
*/
|
||||
class StrictModeProviderImpl: IStrictModeProvider {
|
||||
|
||||
|
||||
override fun enable() {
|
||||
StrictMode.setThreadPolicy(
|
||||
Builder()
|
||||
.detectAll()
|
||||
.penaltyLog()
|
||||
.penaltyDropBox()
|
||||
.build())
|
||||
StrictMode.setVmPolicy(
|
||||
VmPolicy.Builder()
|
||||
.detectAll()
|
||||
.penaltyLog()
|
||||
.penaltyDropBox()
|
||||
.build())
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -42,6 +43,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.selects.*
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
/**
|
||||
@@ -60,6 +62,8 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
private var lastShowV2XJob: Job? = null
|
||||
private var context: Context? = null
|
||||
|
||||
private val scope by lazy { CoroutineScope(Dispatchers.Default + SupervisorJob()) }
|
||||
|
||||
override fun init(context: Context?) {
|
||||
this.context = context
|
||||
}
|
||||
@@ -137,13 +141,37 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
CallerV2XWarningListenerManager.dismiss()
|
||||
}
|
||||
|
||||
Log.d("CODE", "---- 00 ------ tts_content: $ttsContent")
|
||||
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
|
||||
val last = lastSpeakJob.get()
|
||||
if (last != null && !last.isCompleted) {
|
||||
Log.d("CODE", "---- 0 ------: last: $last")
|
||||
if (last != null && !last.isCompleted) {
|
||||
Log.d("CODE", "---- 1 ------")
|
||||
return
|
||||
}
|
||||
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
|
||||
speak(it, ttsContent)
|
||||
scope.launch {
|
||||
Log.d("CODE", "---- 2 ------")
|
||||
val d1 = async {
|
||||
Log.d("CODE", "---- 2_1 start ------")
|
||||
speak(it, ttsContent)
|
||||
Log.d("CODE", "---- 2_1 end ------")
|
||||
}
|
||||
val d2 = async {
|
||||
Log.d("CODE", "---- 2_2 start ------")
|
||||
delay((305.75 * ttsContent.length).toLong())
|
||||
Log.d("CODE", "---- 2_2 end ------")
|
||||
}
|
||||
val ret = select<Int> {
|
||||
d1.onAwait { 1 }
|
||||
d2.onAwait { 2 }
|
||||
}
|
||||
if (ret == 1) {
|
||||
d2.cancel()
|
||||
Log.d("CODE", "---- 3 ------")
|
||||
} else {
|
||||
d1.cancel()
|
||||
Log.d("CODE", "---- 4 ------")
|
||||
}
|
||||
}.also { itx ->
|
||||
lastSpeakJob.set(itx)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Process
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
@@ -64,9 +65,7 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
|
||||
@@ -81,7 +80,7 @@ import com.mogo.map.uicontroller.VisualAngleMode.*
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect
|
||||
import kotlinx.android.synthetic.main.view_sop_setting.view.*
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -642,6 +641,18 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tbIsDemoMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
tbIsStrictMode?.also {
|
||||
it.isChecked = SharedPrefs.getInstance(Utils.getApp()).getBoolean("MOGO_STRICT_MODE_ENABLED", false)
|
||||
it.setOnCheckedChangeListener { _, isChecked ->
|
||||
SharedPrefs.getInstance(Utils.getApp()).putBoolean("MOGO_STRICT_MODE_ENABLED", isChecked)
|
||||
scope.launch {
|
||||
ToastUtils.showShort("配置生效, 2秒后重启应用...")
|
||||
delay(2000)
|
||||
restartApp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 雨天模式,上一次勾选的数据
|
||||
tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
//雨天模式
|
||||
@@ -1651,11 +1662,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
mRouteInfoSize = 0
|
||||
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
tbIsDemoMode.text = "关闭美化模式"
|
||||
tbIsDemoMode?.text = "关闭美化模式"
|
||||
} else {
|
||||
tbIsDemoMode.text = "开启美化模式"
|
||||
tbIsDemoMode?.text = "开启美化模式"
|
||||
}
|
||||
|
||||
//obu信息,排查obu相关问题使用
|
||||
tvObuInfoContent.text = mObuInfoStr
|
||||
|
||||
@@ -2058,6 +2068,11 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun restartApp() {
|
||||
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
|
||||
override fun fwThreadClose() {
|
||||
refreshTraceInfo()
|
||||
}
|
||||
|
||||
@@ -230,6 +230,18 @@
|
||||
android:layout_height="1dp"
|
||||
android:background="#F0F0F0" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbIsStrictMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:textOff="开启严格模式"
|
||||
android:textOn="关闭严格模式"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbIsDemoMode"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user