[2.13.0-arch-opt] remove unuse code and add trace log
This commit is contained in:
@@ -2,12 +2,17 @@ package com.zhjt.mogo_core_function_devatools.apm
|
||||
|
||||
import android.os.Process
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import android.widget.Toast
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_INIT_ENV_CHECK
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_INIT_ENV_RESTART
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_INIT
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
|
||||
import com.mogo.eagle.core.function.api.devatools.apm.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.zhjt.mogo_core_function_devatools.apm.config.*
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
import kotlinx.coroutines.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
@@ -45,6 +50,14 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
|
||||
linkCode = CHAIN_LINK_INIT,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_INIT_ENV_CHECK,
|
||||
paramIndexes = [0,1,2],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onEnvChanged(buildType: String, netType: String, dockerVersion: String) {
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
@@ -53,7 +66,6 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
return
|
||||
}
|
||||
launch {
|
||||
Log.d(TAG, "onEnvChanged[1]:[buildType: $buildType, netType:$netType, dockerVersion:$dockerVersion]")
|
||||
var buildTypeChanged = false
|
||||
if (ApmEnvConfig.getBuildType() != buildType) {
|
||||
buildTypeChanged = true
|
||||
@@ -80,7 +92,6 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
isEnvValid = buildType == "0" || (buildType == "1" && netType == DebugConfig.NET_MODE_RELEASE.toString() && dockerVersion.endsWith("release", true))
|
||||
}
|
||||
val appRelaunched = ApmEnvConfig.isAppRelaunched()
|
||||
Log.d(TAG, "onEnvChanged[2]: buildTypeChanged: $buildTypeChanged, netTypeChanged: $netTypeChanged, dockerVersionChanged:$dockerVersionChanged], isAppLaunched:$appRelaunched")
|
||||
if ((!isEnvValid || (buildTypeChanged || netTypeChanged || dockerVersionChanged)) && !appRelaunched) {
|
||||
ApmEnvConfig.setAppRelaunched(true)
|
||||
restartApp()
|
||||
@@ -108,9 +119,16 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
|
||||
linkCode = CHAIN_LINK_INIT,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_INIT_ENV_RESTART,
|
||||
paramIndexes = [-1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
private fun restartApp() {
|
||||
launch(Dispatchers.Main) {
|
||||
Log.d(TAG, "restartApp ---")
|
||||
Toast.makeText(Utils.getApp(), "发现系统环境不一致,正在重启...", Toast.LENGTH_SHORT).show()
|
||||
delay(50)
|
||||
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
Reference in New Issue
Block a user