[6.4.4][apm] 注释掉apm相关逻辑

This commit is contained in:
renwj
2024-06-12 15:46:36 +08:00
parent 26f8349cb9
commit 507e6ae642
8 changed files with 277 additions and 278 deletions

View File

@@ -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()