[6.2.4][Feat]新增QUIC请求延时回调和协议开关
This commit is contained in:
@@ -407,4 +407,8 @@ class DevaToolsProvider : IDevaToolsProvider {
|
|||||||
override fun block(): IMoGoBlockProvider? = block
|
override fun block(): IMoGoBlockProvider? = block
|
||||||
|
|
||||||
override fun usage(): IMoGoCpuUsageProvider? = usage
|
override fun usage(): IMoGoCpuUsageProvider? = usage
|
||||||
|
|
||||||
|
override fun setNetworkMode(isDebug: Boolean) {
|
||||||
|
WeakNetworkStrategy.setDebug(isDebug)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ object WeakNetworkStrategy {
|
|||||||
private const val TAG = "WeakNetworkStrategy"
|
private const val TAG = "WeakNetworkStrategy"
|
||||||
|
|
||||||
// 记录到链路日志中的时间间隔
|
// 记录到链路日志中的时间间隔
|
||||||
private const val OUTPUT_TIME_INTERVAL = 15000
|
private const val OUTPUT_TIME_INTERVAL = 2500
|
||||||
|
|
||||||
private const val WEAK_HTTP_RTT = 1300
|
private const val WEAK_HTTP_RTT = 1300
|
||||||
|
|
||||||
@@ -23,6 +23,8 @@ object WeakNetworkStrategy {
|
|||||||
|
|
||||||
private var lastOutputTime = 0L
|
private var lastOutputTime = 0L
|
||||||
|
|
||||||
|
private var isDebug = false
|
||||||
|
|
||||||
private val lock by lazy {
|
private val lock by lazy {
|
||||||
ReentrantReadWriteLock()
|
ReentrantReadWriteLock()
|
||||||
}
|
}
|
||||||
@@ -53,6 +55,10 @@ object WeakNetworkStrategy {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setDebug(isDebug: Boolean) {
|
||||||
|
this.isDebug = isDebug
|
||||||
|
}
|
||||||
|
|
||||||
fun stopListen() {
|
fun stopListen() {
|
||||||
setListener(null)
|
setListener(null)
|
||||||
}
|
}
|
||||||
@@ -63,10 +69,13 @@ object WeakNetworkStrategy {
|
|||||||
try {
|
try {
|
||||||
val currentTime = System.currentTimeMillis()
|
val currentTime = System.currentTimeMillis()
|
||||||
if (currentTime - lastOutputTime > OUTPUT_TIME_INTERVAL) {
|
if (currentTime - lastOutputTime > OUTPUT_TIME_INTERVAL) {
|
||||||
|
if (isDebug) {
|
||||||
|
invokeWeakResult("url为:$url, 耗时为:$timeStamp${if (isFail) " 连接失败!" else ""}")
|
||||||
|
}
|
||||||
if (timeStamp >= WEAK_HTTP_RTT) {
|
if (timeStamp >= WEAK_HTTP_RTT) {
|
||||||
ToastUtils.showShort("当前网络质量差!")
|
ToastUtils.showShort("当前网络质量差!")
|
||||||
} else if (timeStamp in 300 until WEAK_HTTP_RTT) {
|
} else if (timeStamp in 300 until WEAK_HTTP_RTT) {
|
||||||
invokeWeakResult("url为:$url, 耗时为:$timeStamp${if (isFail) " 连接失败!" else ""}")
|
// invokeWeakResult("url为:$url, 耗时为:$timeStamp${if (isFail) " 连接失败!" else ""}")
|
||||||
SdtManager.startActiveCheck()
|
SdtManager.startActiveCheck()
|
||||||
}
|
}
|
||||||
lastOutputTime = currentTime
|
lastOutputTime = currentTime
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.os.Build
|
|||||||
import android.os.Process
|
import android.os.Process
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
@@ -21,6 +22,7 @@ import androidx.core.view.MenuCompat
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import chassis.Chassis
|
import chassis.Chassis
|
||||||
|
import com.mogo.cloud.network.cronet.NetworkQualityListener
|
||||||
import com.mogo.cloud.network.cronet.QuicConfig
|
import com.mogo.cloud.network.cronet.QuicConfig
|
||||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
@@ -86,6 +88,7 @@ import com.mogo.eagle.core.utilcode.util.*
|
|||||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||||
import com.mogo.map.uicontroller.VisualAngleMode
|
import com.mogo.map.uicontroller.VisualAngleMode
|
||||||
import com.mogo.map.uicontroller.VisualAngleMode.*
|
import com.mogo.map.uicontroller.VisualAngleMode.*
|
||||||
|
import com.zhjt.service.chain.ChainLog
|
||||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import mogo.telematics.pad.MessagePad
|
import mogo.telematics.pad.MessagePad
|
||||||
@@ -773,7 +776,35 @@ internal class DebugSettingView @JvmOverloads constructor(
|
|||||||
FunctionBuildConfig.isObuWarningFusionUnion = isChecked
|
FunctionBuildConfig.isObuWarningFusionUnion = isChecked
|
||||||
}
|
}
|
||||||
tbCronet.setOnCheckedChangeListener { _, isChecked ->
|
tbCronet.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
if (!isChecked) {
|
||||||
|
CallerDevaToolsManager.setNetworkMode(true)
|
||||||
|
}
|
||||||
QuicConfig.setEnable(context, isChecked)
|
QuicConfig.setEnable(context, isChecked)
|
||||||
|
QuicConfig.setNetworkListener(object : NetworkQualityListener {
|
||||||
|
override fun onLatencyObservation(rttMs: Int, url: String?) {
|
||||||
|
invokeCronetResult("****** Cronet Request Completed, the latency is $rttMs ms;url is $url")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailed(error: String?, url: String?) {
|
||||||
|
invokeCronetResult("****** Cronet Request onFailed, error is $error;url is $url")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCanceled(url: String?) {
|
||||||
|
invokeCronetResult("****** Cronet Request onFailed, url is: $url")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRttObservation(rttMs: Int, whenMs: Long, source: Int) {
|
||||||
|
invokeCronetResult("rttMs is:$rttMs ms,source is:$source")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onThroughputObservation(
|
||||||
|
throughputKbps: Int,
|
||||||
|
whenMs: Long,
|
||||||
|
source: Int
|
||||||
|
) {
|
||||||
|
invokeCronetResult("downstream throughput is:$throughputKbps,source is:$source")
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//重启工控机所有节点
|
//重启工控机所有节点
|
||||||
@@ -2310,4 +2341,13 @@ internal class DebugSettingView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ChainLog(
|
||||||
|
linkChainLog = ChainConstant.CHAIN_TYPE_WEAK_NETWORK,
|
||||||
|
linkCode = ChainConstant.CHAIN_SOURCE_WEAK_NETWORK,
|
||||||
|
nodeAliasCode = ChainConstant.CHAIN_CODE_RECORD_WEAK_NETWORK,
|
||||||
|
paramIndexes = [0]
|
||||||
|
)
|
||||||
|
private fun invokeCronetResult(json: String) {
|
||||||
|
Log.d("CronetNetwork", json)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2372,7 +2372,7 @@
|
|||||||
android:padding="@dimen/dp_20"
|
android:padding="@dimen/dp_20"
|
||||||
android:background="@drawable/radio_button_normal_background_right"
|
android:background="@drawable/radio_button_normal_background_right"
|
||||||
android:textColor="#000"
|
android:textColor="#000"
|
||||||
android:textOff="开启QUIC协议(服务器暂不支持)"
|
android:textOff="开启QUIC协议(目前QA环境可用)"
|
||||||
android:textOn="关闭QUIC协议"
|
android:textOn="关闭QUIC协议"
|
||||||
android:textSize="@dimen/dp_24" />
|
android:textSize="@dimen/dp_24" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -249,4 +249,6 @@ interface IDevaToolsProvider : IProvider {
|
|||||||
* 各线程CPU使用率
|
* 各线程CPU使用率
|
||||||
*/
|
*/
|
||||||
fun usage(): IMoGoCpuUsageProvider?
|
fun usage(): IMoGoCpuUsageProvider?
|
||||||
|
|
||||||
|
fun setNetworkMode(isDebug: Boolean)
|
||||||
}
|
}
|
||||||
@@ -291,4 +291,8 @@ object CallerDevaToolsManager {
|
|||||||
fun block(): IMoGoBlockProvider? = devaToolsProviderApi?.block()
|
fun block(): IMoGoBlockProvider? = devaToolsProviderApi?.block()
|
||||||
|
|
||||||
fun usage(): IMoGoCpuUsageProvider? = devaToolsProviderApi?.usage()
|
fun usage(): IMoGoCpuUsageProvider? = devaToolsProviderApi?.usage()
|
||||||
|
|
||||||
|
fun setNetworkMode(isDebug: Boolean) {
|
||||||
|
devaToolsProviderApi?.setNetworkMode(isDebug)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,10 @@ import com.mogo.commons.debug.DebugConfig;
|
|||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||||
|
|
||||||
public class HostConst {
|
public class HostConst {
|
||||||
public static final String HOST_DEV = "http://eagle-qa.zhidaozhixing.com";
|
public static final String HOST_DEV = "https://eagle-qa.zhidaozhixing.com";
|
||||||
public static final String HOST_RELEASE = "http://eagle-mis.zhidaozhixing.com";
|
public static final String HOST_RELEASE = "http://eagle-mis.zhidaozhixing.com";
|
||||||
|
|
||||||
public static final String HOST_EAGLE_QA = "http://eagle-dns-qa.zhidaozhixing.com/";
|
public static final String HOST_EAGLE_QA = "https://eagle-dns-qa.zhidaozhixing.com/";
|
||||||
public static final String HOST_EAGLE_RELEASE = "http://eagle-dns.zhidaozhixing.com/";
|
public static final String HOST_EAGLE_RELEASE = "http://eagle-dns.zhidaozhixing.com/";
|
||||||
|
|
||||||
public static String getHost() {
|
public static String getHost() {
|
||||||
|
|||||||
@@ -64,21 +64,21 @@ bytex.ASM_API=ASM7
|
|||||||
LOGLIB_VERSION=1.10.7
|
LOGLIB_VERSION=1.10.7
|
||||||
######## MogoAiCloudSDK Version ########
|
######## MogoAiCloudSDK Version ########
|
||||||
# 网络请求LOGLIB_VERSION
|
# 网络请求LOGLIB_VERSION
|
||||||
MOGO_NETWORK_VERSION=1.4.7.19
|
MOGO_NETWORK_VERSION=1.4.7.20
|
||||||
# 鉴权
|
# 鉴权
|
||||||
MOGO_PASSPORT_VERSION=1.4.7.19
|
MOGO_PASSPORT_VERSION=1.4.7.20
|
||||||
# 长链接
|
# 长链接
|
||||||
MOGO_SOCKET_VERSION=1.4.7.19
|
MOGO_SOCKET_VERSION=1.4.7.20
|
||||||
# 数据采集
|
# 数据采集
|
||||||
MOGO_REALTIME_VERSION=1.4.7.19
|
MOGO_REALTIME_VERSION=1.4.7.20
|
||||||
# 直播推流
|
# 直播推流
|
||||||
MOGO_LIVE_VERSION=1.4.7.19
|
MOGO_LIVE_VERSION=1.4.7.20
|
||||||
# 直播拉流
|
# 直播拉流
|
||||||
MOGO_TRAFFICLIVE_VERSION=1.4.7.19
|
MOGO_TRAFFICLIVE_VERSION=1.4.7.20
|
||||||
# 定位服务
|
# 定位服务
|
||||||
MOGO_LOCATION_VERSION=1.4.7.19
|
MOGO_LOCATION_VERSION=1.4.7.20
|
||||||
# 远程通讯模块
|
# 远程通讯模块
|
||||||
MOGO_TELEMATIC_VERSION=1.4.7.19
|
MOGO_TELEMATIC_VERSION=1.4.7.20
|
||||||
######## MogoAiCloudSDK Version ########
|
######## MogoAiCloudSDK Version ########
|
||||||
# 自研地图
|
# 自研地图
|
||||||
MAP_SDK_VERSION=3.3.0.10
|
MAP_SDK_VERSION=3.3.0.10
|
||||||
|
|||||||
Reference in New Issue
Block a user