[6.4.4][apm] 注释掉apm相关逻辑
This commit is contained in:
@@ -18,7 +18,7 @@ import com.mogo.eagle.core.data.deva.scene.SceneModule
|
||||
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.apm.*
|
||||
import com.mogo.eagle.core.function.api.devatools.block.*
|
||||
import com.mogo.eagle.core.function.api.devatools.strict.*
|
||||
import com.mogo.eagle.core.function.api.devatools.download.*
|
||||
@@ -37,7 +37,7 @@ import com.tencent.matrix.report.Issue
|
||||
import com.tencent.matrix.trace.TracePlugin
|
||||
import com.tencent.matrix.trace.config.SharePluginInfo
|
||||
import com.tencent.matrix.trace.config.TraceConfig
|
||||
import com.zhjt.mogo_core_function_devatools.apm.*
|
||||
//import com.zhjt.mogo_core_function_devatools.apm.*
|
||||
import com.mogo.eagle.core.function.api.upgrade.*
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
|
||||
@@ -90,7 +90,7 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
private val apmEnvProvider by lazy { ApmEnvProviderImpl() }
|
||||
// private val apmEnvProvider by lazy { ApmEnvProviderImpl() }
|
||||
|
||||
private val strictModeProvider by lazy { StrictModeProviderImpl() }
|
||||
|
||||
@@ -159,7 +159,7 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
//升级(鹰眼/工控)与监控服务
|
||||
iPCReportManager.initServer()
|
||||
BindingCarManager.init(mContext!!)
|
||||
apmEnvProvider.init(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
// apmEnvProvider.init(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
BadCaseManager.init(mContext!!)
|
||||
if (DebugConfig.isDebug()) {
|
||||
SdtManager.init(mContext!!, true, DetectResultImpl())
|
||||
@@ -513,13 +513,13 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
}
|
||||
|
||||
override fun envConfigChange(cityCode: String, netMode: Int) {
|
||||
apmEnvProvider.onEnvChanged(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
// apmEnvProvider.onEnvChanged(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
EnvChangeManager.changeTo(cityCode, netMode)
|
||||
}
|
||||
|
||||
override fun dockerVersion(dockerVersion: String?) {
|
||||
mDockerVersion = dockerVersion
|
||||
apmEnvProvider.onEnvChanged(if(DebugConfig.isDebug()) "0" else "1","${ DebugConfig.getNetMode() }", dockerVersion ?: "")
|
||||
// apmEnvProvider.onEnvChanged(if(DebugConfig.isDebug()) "0" else "1","${ DebugConfig.getNetMode() }", dockerVersion ?: "")
|
||||
BadCaseConfig.dockerVersion = dockerVersion
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
BindingCarManager.queryAppUpgrade()
|
||||
}
|
||||
|
||||
override fun apmEnvProvider(): IApmEnvProvider = apmEnvProvider
|
||||
// override fun apmEnvProvider(): IApmEnvProvider = apmEnvProvider
|
||||
|
||||
override fun queryObuUpgrade(obuVersionName: String) {
|
||||
BindingCarManager.queryObuUpgrade(obuVersionName)
|
||||
|
||||
@@ -1,145 +1,145 @@
|
||||
package com.zhjt.mogo_core_function_devatools.apm
|
||||
|
||||
import android.os.Process
|
||||
import android.text.TextUtils
|
||||
import android.widget.Toast
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_INIT_ENV_RESTART
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_INIT
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_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 kotlinx.coroutines.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.coroutines.*
|
||||
|
||||
class ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
|
||||
private val TAG = "ApmEnvProvider"
|
||||
|
||||
private val scope by lazy { CoroutineScope(Dispatchers.IO + SupervisorJob()) }
|
||||
|
||||
private val hasInit by lazy { AtomicBoolean(false) }
|
||||
|
||||
private val mBuildType by lazy { AtomicReference<String>() }
|
||||
private val mNetType by lazy { AtomicReference<String>() }
|
||||
private val mDockerVersion by lazy { AtomicReference<String>() }
|
||||
|
||||
override val coroutineContext: CoroutineContext
|
||||
get() = scope.coroutineContext
|
||||
|
||||
override fun init(buildType: String, netType: String, dockerVersion: String) {
|
||||
launch {
|
||||
if (ApmEnvConfig.isFirstEnter()) {
|
||||
if (!TextUtils.isEmpty(buildType)) {
|
||||
ApmEnvConfig.setBuildType(buildType)
|
||||
}
|
||||
if (!TextUtils.isEmpty(netType)) {
|
||||
ApmEnvConfig.setNetType(netType)
|
||||
}
|
||||
if (!TextUtils.isEmpty(dockerVersion)) {
|
||||
ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
}
|
||||
}
|
||||
hasInit.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEnvChanged(buildType: String, netType: String, dockerVersion: String) {
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
if (mBuildType.get() == buildType && mNetType.get() == netType && mDockerVersion.get() == dockerVersion) {
|
||||
return
|
||||
}
|
||||
launch {
|
||||
var buildTypeChanged = false
|
||||
if (ApmEnvConfig.getBuildType() != buildType) {
|
||||
buildTypeChanged = true
|
||||
ApmEnvConfig.setBuildType(buildType)
|
||||
}
|
||||
var netTypeChanged = false
|
||||
if (ApmEnvConfig.getNetType() != netType) {
|
||||
netTypeChanged = true
|
||||
ApmEnvConfig.setNetType(netType)
|
||||
}
|
||||
var dockerVersionChanged = false
|
||||
val version = ApmEnvConfig.getDockerVersion()
|
||||
if (!TextUtils.isEmpty(version) && !TextUtils.isEmpty(dockerVersion) && version != dockerVersion) {
|
||||
val f1 = version?.endsWith("release", true) == true
|
||||
val f2 = dockerVersion.endsWith("release", true)
|
||||
dockerVersionChanged = if (f1 && f2) false else f1 || f2
|
||||
if (dockerVersionChanged) {
|
||||
ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
}
|
||||
}
|
||||
var isFirstDockerVersionSet = false
|
||||
if (TextUtils.isEmpty(version) && !TextUtils.isEmpty(dockerVersion)) {
|
||||
isFirstDockerVersionSet = true
|
||||
ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
}
|
||||
var isEnvValid = true
|
||||
if (dockerVersionChanged || isFirstDockerVersionSet) {
|
||||
isEnvValid = buildType == "0" || (buildType == "1" && netType == DebugConfig.NET_MODE_RELEASE.toString() && dockerVersion.endsWith("release", true))
|
||||
}
|
||||
val appRelaunched = ApmEnvConfig.isAppRelaunched()
|
||||
if ((!isEnvValid || (buildTypeChanged || netTypeChanged || dockerVersionChanged)) && !appRelaunched) {
|
||||
ApmEnvConfig.setAppRelaunched(true)
|
||||
restartApp(mapOf<String,Any>("buildType" to buildType, "netType" to netType,"dockerVersion" to dockerVersion))
|
||||
return@launch
|
||||
}
|
||||
if (isFirstDockerVersionSet) {
|
||||
return@launch
|
||||
}
|
||||
|
||||
if (appRelaunched) {
|
||||
ApmEnvConfig.setAppRelaunched(false)
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(buildType)) {
|
||||
mBuildType.set(buildType)
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(netType)) {
|
||||
mNetType.set(netType)
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(dockerVersion)) {
|
||||
mDockerVersion.set(dockerVersion)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_STATUS,
|
||||
linkCode = CHAIN_SOURCE_INIT,
|
||||
nodeAliasCode = CHAIN_CODE_INIT_ENV_RESTART,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
private fun restartApp(envStr:Map<String,Any>) {
|
||||
launch(Dispatchers.Main) {
|
||||
Toast.makeText(Utils.getApp(), "发现系统环境不一致,正在重启...", Toast.LENGTH_SHORT).show()
|
||||
delay(50)
|
||||
Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName)?.also {
|
||||
ActivityUtils.startActivity(it)
|
||||
}
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
}
|
||||
|
||||
override fun isDebugEnabled(): Boolean? {
|
||||
return runBlocking {
|
||||
val oldBuildType = ApmEnvConfig.getBuildType()
|
||||
val oldNetType = ApmEnvConfig.getNetType()
|
||||
val oldDockerVersion = ApmEnvConfig.getDockerVersion()
|
||||
if (TextUtils.isEmpty(oldBuildType) || TextUtils.isEmpty(oldNetType) || TextUtils.isEmpty(oldDockerVersion)) {
|
||||
null
|
||||
} else {
|
||||
DebugConfig.isDebug() || (oldBuildType != "1" || oldNetType != DebugConfig.NET_MODE_RELEASE.toString() || !(oldDockerVersion?.endsWith("release", true) ?: false))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.zhjt.mogo_core_function_devatools.apm
|
||||
//
|
||||
//import android.os.Process
|
||||
//import android.text.TextUtils
|
||||
//import android.widget.Toast
|
||||
//import com.mogo.commons.debug.DebugConfig
|
||||
//import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_INIT_ENV_RESTART
|
||||
//import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_INIT
|
||||
//import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_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 kotlinx.coroutines.*
|
||||
//import java.util.concurrent.atomic.AtomicBoolean
|
||||
//import java.util.concurrent.atomic.AtomicReference
|
||||
//import kotlin.coroutines.*
|
||||
//
|
||||
//class ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
//
|
||||
// private val TAG = "ApmEnvProvider"
|
||||
//
|
||||
// private val scope by lazy { CoroutineScope(Dispatchers.IO + SupervisorJob()) }
|
||||
//
|
||||
// private val hasInit by lazy { AtomicBoolean(false) }
|
||||
//
|
||||
// private val mBuildType by lazy { AtomicReference<String>() }
|
||||
// private val mNetType by lazy { AtomicReference<String>() }
|
||||
// private val mDockerVersion by lazy { AtomicReference<String>() }
|
||||
//
|
||||
// override val coroutineContext: CoroutineContext
|
||||
// get() = scope.coroutineContext
|
||||
//
|
||||
// override fun init(buildType: String, netType: String, dockerVersion: String) {
|
||||
// launch {
|
||||
// if (ApmEnvConfig.isFirstEnter()) {
|
||||
// if (!TextUtils.isEmpty(buildType)) {
|
||||
// ApmEnvConfig.setBuildType(buildType)
|
||||
// }
|
||||
// if (!TextUtils.isEmpty(netType)) {
|
||||
// ApmEnvConfig.setNetType(netType)
|
||||
// }
|
||||
// if (!TextUtils.isEmpty(dockerVersion)) {
|
||||
// ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
// }
|
||||
// }
|
||||
// hasInit.set(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onEnvChanged(buildType: String, netType: String, dockerVersion: String) {
|
||||
// if (!hasInit.get()) {
|
||||
// return
|
||||
// }
|
||||
// if (mBuildType.get() == buildType && mNetType.get() == netType && mDockerVersion.get() == dockerVersion) {
|
||||
// return
|
||||
// }
|
||||
// launch {
|
||||
// var buildTypeChanged = false
|
||||
// if (ApmEnvConfig.getBuildType() != buildType) {
|
||||
// buildTypeChanged = true
|
||||
// ApmEnvConfig.setBuildType(buildType)
|
||||
// }
|
||||
// var netTypeChanged = false
|
||||
// if (ApmEnvConfig.getNetType() != netType) {
|
||||
// netTypeChanged = true
|
||||
// ApmEnvConfig.setNetType(netType)
|
||||
// }
|
||||
// var dockerVersionChanged = false
|
||||
// val version = ApmEnvConfig.getDockerVersion()
|
||||
// if (!TextUtils.isEmpty(version) && !TextUtils.isEmpty(dockerVersion) && version != dockerVersion) {
|
||||
// val f1 = version?.endsWith("release", true) == true
|
||||
// val f2 = dockerVersion.endsWith("release", true)
|
||||
// dockerVersionChanged = if (f1 && f2) false else f1 || f2
|
||||
// if (dockerVersionChanged) {
|
||||
// ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
// }
|
||||
// }
|
||||
// var isFirstDockerVersionSet = false
|
||||
// if (TextUtils.isEmpty(version) && !TextUtils.isEmpty(dockerVersion)) {
|
||||
// isFirstDockerVersionSet = true
|
||||
// ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
// }
|
||||
// var isEnvValid = true
|
||||
// if (dockerVersionChanged || isFirstDockerVersionSet) {
|
||||
// isEnvValid = buildType == "0" || (buildType == "1" && netType == DebugConfig.NET_MODE_RELEASE.toString() && dockerVersion.endsWith("release", true))
|
||||
// }
|
||||
// val appRelaunched = ApmEnvConfig.isAppRelaunched()
|
||||
// if ((!isEnvValid || (buildTypeChanged || netTypeChanged || dockerVersionChanged)) && !appRelaunched) {
|
||||
// ApmEnvConfig.setAppRelaunched(true)
|
||||
// restartApp(mapOf<String,Any>("buildType" to buildType, "netType" to netType,"dockerVersion" to dockerVersion))
|
||||
// return@launch
|
||||
// }
|
||||
// if (isFirstDockerVersionSet) {
|
||||
// return@launch
|
||||
// }
|
||||
//
|
||||
// if (appRelaunched) {
|
||||
// ApmEnvConfig.setAppRelaunched(false)
|
||||
// }
|
||||
//
|
||||
// if (!TextUtils.isEmpty(buildType)) {
|
||||
// mBuildType.set(buildType)
|
||||
// }
|
||||
//
|
||||
// if (!TextUtils.isEmpty(netType)) {
|
||||
// mNetType.set(netType)
|
||||
// }
|
||||
//
|
||||
// if (!TextUtils.isEmpty(dockerVersion)) {
|
||||
// mDockerVersion.set(dockerVersion)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @ChainLog(
|
||||
// linkChainLog = CHAIN_TYPE_STATUS,
|
||||
// linkCode = CHAIN_SOURCE_INIT,
|
||||
// nodeAliasCode = CHAIN_CODE_INIT_ENV_RESTART,
|
||||
// paramIndexes = [0]
|
||||
// )
|
||||
// private fun restartApp(envStr:Map<String,Any>) {
|
||||
// launch(Dispatchers.Main) {
|
||||
// Toast.makeText(Utils.getApp(), "发现系统环境不一致,正在重启...", Toast.LENGTH_SHORT).show()
|
||||
// delay(50)
|
||||
// Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName)?.also {
|
||||
// ActivityUtils.startActivity(it)
|
||||
// }
|
||||
// Process.killProcess(Process.myPid())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun isDebugEnabled(): Boolean? {
|
||||
// return runBlocking {
|
||||
// val oldBuildType = ApmEnvConfig.getBuildType()
|
||||
// val oldNetType = ApmEnvConfig.getNetType()
|
||||
// val oldDockerVersion = ApmEnvConfig.getDockerVersion()
|
||||
// if (TextUtils.isEmpty(oldBuildType) || TextUtils.isEmpty(oldNetType) || TextUtils.isEmpty(oldDockerVersion)) {
|
||||
// null
|
||||
// } else {
|
||||
// DebugConfig.isDebug() || (oldBuildType != "1" || oldNetType != DebugConfig.NET_MODE_RELEASE.toString() || !(oldDockerVersion?.endsWith("release", true) ?: false))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1626,46 +1626,46 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}.show()
|
||||
}
|
||||
|
||||
if (JunkConfig.isSupportJunkDetect) {
|
||||
// 上传APM日志
|
||||
upload_apm_log_group?.visibility = View.VISIBLE
|
||||
upload_apm_log?.onClick { v ->
|
||||
ListPopupWindow(v.context).also { p ->
|
||||
val items = ApmVLogUploadDuration.values()
|
||||
p.setAdapter(ApmVLogUploadAdapter(v.context, items))
|
||||
p.anchorView = v
|
||||
p.isModal = true
|
||||
p.setBackgroundDrawable(ColorDrawable(Color.WHITE))
|
||||
p.setOnItemClickListener { _, _, position, _ ->
|
||||
val provider = (ARouter.getInstance().build(CrashReportConstants.PATH).navigation() as? ITestCrashReportProvider) ?: return@setOnItemClickListener
|
||||
val item = items[position]
|
||||
v.visibility = View.INVISIBLE
|
||||
upload_apm_log_loading?.visibility = View.VISIBLE
|
||||
p.dismiss()
|
||||
v.scope.launch(Dispatchers.IO) {
|
||||
val endTime = System.currentTimeMillis()
|
||||
val startTime = when(item) {
|
||||
ApmVLogUploadDuration.IN_15M -> endTime - TimeUnit.MINUTES.toMillis(15)
|
||||
ApmVLogUploadDuration.IN_45M -> endTime - TimeUnit.MINUTES.toMillis(45)
|
||||
ApmVLogUploadDuration.IN_1H -> endTime - TimeUnit.HOURS.toMillis(1)
|
||||
ApmVLogUploadDuration.IN_2H -> endTime - TimeUnit.HOURS.toMillis(2)
|
||||
ApmVLogUploadDuration.IN_3H -> endTime - TimeUnit.HOURS.toMillis(3)
|
||||
ApmVLogUploadDuration.IN_6H -> endTime - TimeUnit.HOURS.toMillis(6)
|
||||
ApmVLogUploadDuration.ALL -> 0
|
||||
}
|
||||
provider.uploadVlog(startTime, endTime)
|
||||
withContext(Dispatchers.Main) {
|
||||
ToastUtils.showShort("上传成功")
|
||||
upload_apm_log_loading?.visibility = View.INVISIBLE
|
||||
upload_apm_log?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}.show()
|
||||
}
|
||||
} else {
|
||||
upload_apm_log_group?.visibility = View.GONE
|
||||
}
|
||||
// if (JunkConfig.isSupportJunkDetect) {
|
||||
// // 上传APM日志
|
||||
// upload_apm_log_group?.visibility = View.VISIBLE
|
||||
// upload_apm_log?.onClick { v ->
|
||||
// ListPopupWindow(v.context).also { p ->
|
||||
// val items = ApmVLogUploadDuration.values()
|
||||
// p.setAdapter(ApmVLogUploadAdapter(v.context, items))
|
||||
// p.anchorView = v
|
||||
// p.isModal = true
|
||||
// p.setBackgroundDrawable(ColorDrawable(Color.WHITE))
|
||||
// p.setOnItemClickListener { _, _, position, _ ->
|
||||
// val provider = (ARouter.getInstance().build(CrashReportConstants.PATH).navigation() as? ITestCrashReportProvider) ?: return@setOnItemClickListener
|
||||
// val item = items[position]
|
||||
// v.visibility = View.INVISIBLE
|
||||
// upload_apm_log_loading?.visibility = View.VISIBLE
|
||||
// p.dismiss()
|
||||
// v.scope.launch(Dispatchers.IO) {
|
||||
// val endTime = System.currentTimeMillis()
|
||||
// val startTime = when(item) {
|
||||
// ApmVLogUploadDuration.IN_15M -> endTime - TimeUnit.MINUTES.toMillis(15)
|
||||
// ApmVLogUploadDuration.IN_45M -> endTime - TimeUnit.MINUTES.toMillis(45)
|
||||
// ApmVLogUploadDuration.IN_1H -> endTime - TimeUnit.HOURS.toMillis(1)
|
||||
// ApmVLogUploadDuration.IN_2H -> endTime - TimeUnit.HOURS.toMillis(2)
|
||||
// ApmVLogUploadDuration.IN_3H -> endTime - TimeUnit.HOURS.toMillis(3)
|
||||
// ApmVLogUploadDuration.IN_6H -> endTime - TimeUnit.HOURS.toMillis(6)
|
||||
// ApmVLogUploadDuration.ALL -> 0
|
||||
// }
|
||||
// provider.uploadVlog(startTime, endTime)
|
||||
// withContext(Dispatchers.Main) {
|
||||
// ToastUtils.showShort("上传成功")
|
||||
// upload_apm_log_loading?.visibility = View.INVISIBLE
|
||||
// upload_apm_log?.visibility = View.VISIBLE
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }.show()
|
||||
// }
|
||||
// } else {
|
||||
// upload_apm_log_group?.visibility = View.GONE
|
||||
// }
|
||||
|
||||
/**
|
||||
* 展示、关闭日志过滤面板
|
||||
@@ -1807,52 +1807,52 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
private inner class Holder(val text: TextView? = null)
|
||||
}
|
||||
|
||||
private enum class ApmVLogUploadDuration(val text: String) {
|
||||
IN_15M("15分钟内"),
|
||||
IN_45M("45分钟内"),
|
||||
IN_1H("1小时内"),
|
||||
IN_2H("2小时内"),
|
||||
IN_3H("3小时内"),
|
||||
IN_6H("6小时内"),
|
||||
ALL("上传所有")
|
||||
}
|
||||
|
||||
private class ApmVLogUploadAdapter(private val ctx: Context, private val items: Array<ApmVLogUploadDuration>): BaseAdapter() {
|
||||
override fun getCount(): Int {
|
||||
return items.size
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Any {
|
||||
return items[position]
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return items[position].ordinal.toLong()
|
||||
}
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||
var result = convertView
|
||||
val duration = items[position]
|
||||
if (result == null) {
|
||||
val temp = View.inflate(ctx, android.R.layout.simple_list_item_1, null)
|
||||
temp.tag = Holder(temp.findViewById(android.R.id.text1))
|
||||
result = temp
|
||||
}
|
||||
val holder = result?.tag as? Holder
|
||||
if (holder != null) {
|
||||
holder.text?.setTextColor(Color.BLACK)
|
||||
holder.text?.text = duration.text
|
||||
} else {
|
||||
val text = result?.findViewById<TextView>(android.R.id.text1)
|
||||
text?.setTextColor(Color.BLACK)
|
||||
text?.text = duration.text
|
||||
result?.tag = Holder(text)
|
||||
}
|
||||
return result!!
|
||||
}
|
||||
|
||||
private inner class Holder(val text: TextView? = null)
|
||||
}
|
||||
// private enum class ApmVLogUploadDuration(val text: String) {
|
||||
// IN_15M("15分钟内"),
|
||||
// IN_45M("45分钟内"),
|
||||
// IN_1H("1小时内"),
|
||||
// IN_2H("2小时内"),
|
||||
// IN_3H("3小时内"),
|
||||
// IN_6H("6小时内"),
|
||||
// ALL("上传所有")
|
||||
// }
|
||||
//
|
||||
// private class ApmVLogUploadAdapter(private val ctx: Context, private val items: Array<ApmVLogUploadDuration>): BaseAdapter() {
|
||||
// override fun getCount(): Int {
|
||||
// return items.size
|
||||
// }
|
||||
//
|
||||
// override fun getItem(position: Int): Any {
|
||||
// return items[position]
|
||||
// }
|
||||
//
|
||||
// override fun getItemId(position: Int): Long {
|
||||
// return items[position].ordinal.toLong()
|
||||
// }
|
||||
//
|
||||
// override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||
// var result = convertView
|
||||
// val duration = items[position]
|
||||
// if (result == null) {
|
||||
// val temp = View.inflate(ctx, android.R.layout.simple_list_item_1, null)
|
||||
// temp.tag = Holder(temp.findViewById(android.R.id.text1))
|
||||
// result = temp
|
||||
// }
|
||||
// val holder = result?.tag as? Holder
|
||||
// if (holder != null) {
|
||||
// holder.text?.setTextColor(Color.BLACK)
|
||||
// holder.text?.text = duration.text
|
||||
// } else {
|
||||
// val text = result?.findViewById<TextView>(android.R.id.text1)
|
||||
// text?.setTextColor(Color.BLACK)
|
||||
// text?.text = duration.text
|
||||
// result?.tag = Holder(text)
|
||||
// }
|
||||
// return result!!
|
||||
// }
|
||||
//
|
||||
// private inner class Holder(val text: TextView? = null)
|
||||
// }
|
||||
|
||||
private fun refreshTraceInfo() {
|
||||
val traceInfoMap = CallerDevaToolsManager.getTraceInfo()
|
||||
|
||||
@@ -267,7 +267,7 @@ interface IDevaToolsProvider : IProvider {
|
||||
|
||||
fun dockerVersion(dockerVersion: String?)
|
||||
|
||||
fun apmEnvProvider(): IApmEnvProvider
|
||||
// fun apmEnvProvider(): IApmEnvProvider
|
||||
|
||||
/**
|
||||
* 升级相关状态查询
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.mogo.eagle.core.function.api.devatools.apm
|
||||
|
||||
import androidx.annotation.WorkerThread
|
||||
|
||||
interface IApmEnvProvider {
|
||||
|
||||
fun init(buildType: String, netType: String, dockerVersion: String)
|
||||
|
||||
fun onEnvChanged(buildType: String, netType: String, dockerVersion: String)
|
||||
|
||||
@WorkerThread
|
||||
fun isDebugEnabled(): Boolean?
|
||||
}
|
||||
//interface IApmEnvProvider {
|
||||
//
|
||||
// fun init(buildType: String, netType: String, dockerVersion: String)
|
||||
//
|
||||
// fun onEnvChanged(buildType: String, netType: String, dockerVersion: String)
|
||||
//
|
||||
// @WorkerThread
|
||||
// fun isDebugEnabled(): Boolean?
|
||||
//}
|
||||
@@ -14,7 +14,6 @@ import com.mogo.eagle.core.data.deva.scene.SceneModule
|
||||
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.block.*
|
||||
import com.mogo.eagle.core.function.api.devatools.download.*
|
||||
import com.mogo.eagle.core.function.api.devatools.logcat.*
|
||||
@@ -350,7 +349,7 @@ object CallerDevaToolsManager {
|
||||
devaToolsProviderApi?.queryAppUpgrade()
|
||||
}
|
||||
|
||||
fun apmEnvProvider(): IApmEnvProvider? = devaToolsProviderApi?.apmEnvProvider()
|
||||
// fun apmEnvProvider(): IApmEnvProvider? = devaToolsProviderApi?.apmEnvProvider()
|
||||
|
||||
fun queryObuUpgrade(obuVersionName: String) {
|
||||
devaToolsProviderApi?.queryObuUpgrade(obuVersionName)
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.CarInfo;
|
||||
import com.mogo.eagle.core.function.api.devatools.apm.IApmEnvProvider;
|
||||
//import com.mogo.eagle.core.function.api.devatools.apm.IApmEnvProvider;
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -51,37 +51,37 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Observable.defer(() -> {
|
||||
IApmEnvProvider provider = CallerDevaToolsManager.INSTANCE.apmEnvProvider();
|
||||
boolean isDebug = DebugConfig.isDebug();
|
||||
if (provider != null) {
|
||||
Boolean enabled = provider.isDebugEnabled();
|
||||
if (enabled != null) {
|
||||
isDebug = enabled;
|
||||
}
|
||||
}
|
||||
return Observable.just(isDebug);
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe();
|
||||
|
||||
// Observable.defer(() -> {
|
||||
// IApmEnvProvider provider = CallerDevaToolsManager.INSTANCE.apmEnvProvider();
|
||||
// boolean isDebug = DebugConfig.isDebug();
|
||||
// if (provider != null) {
|
||||
// Boolean enabled = provider.isDebugEnabled();
|
||||
// if (enabled != null) {
|
||||
// isDebug = enabled;
|
||||
// }
|
||||
// }
|
||||
// return Observable.just(isDebug);
|
||||
// })
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe();
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean uploadVlog(long startTime, long endTime) {
|
||||
AtomicBoolean result = new AtomicBoolean(false);
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result.get();
|
||||
}
|
||||
// @Override
|
||||
// public boolean uploadVlog(long startTime, long endTime) {
|
||||
// AtomicBoolean result = new AtomicBoolean(false);
|
||||
// CountDownLatch latch = new CountDownLatch(1);
|
||||
// try {
|
||||
// latch.await();
|
||||
// } catch (InterruptedException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// return result.get();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@ interface ITestCrashReportProvider : IProvider {
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
*/
|
||||
fun uploadVlog(startTime: Long, endTime: Long): Boolean
|
||||
// fun uploadVlog(startTime: Long, endTime: Long): Boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user