[6.4.4][应用升级][bugfix] 配置动态更新导致升级请求失败
(cherry picked from commit f0a7901658)
This commit is contained in:
@@ -252,5 +252,9 @@ object BindingCarManager : IMoGoAutopilotCarConfigListener, IMoGoCloudListener {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun getMacAddress(): String? {
|
||||
return mAddress
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhjt.mogo_core_function_devatools.upgrade
|
||||
|
||||
import android.content.*
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import android.widget.Toast
|
||||
import com.mogo.commons.constants.*
|
||||
@@ -22,8 +23,10 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.getMisChannelCode
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.*
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.eagle.core.utilcode.util.FileUtils
|
||||
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager
|
||||
import kotlinx.coroutines.*
|
||||
import okhttp3.*
|
||||
import java.util.TreeMap
|
||||
@@ -55,9 +58,25 @@ class UpgradeAppNetWorkManager private constructor() {
|
||||
fun getAppUpgradeInfo(context: Context?, mac: String, screenType: String) {
|
||||
upgradeJob?.safeCancel()
|
||||
scope.launch {
|
||||
val sn = SharedPrefsMgr.getInstance().sn
|
||||
val macAddress = mac //"48:b0:2d:4d:31:7f"
|
||||
val type = screenType //"10"
|
||||
var sn = SharedPrefsMgr.getInstance().sn
|
||||
var macAddress = mac //"48:b0:2d:4d:31:7f"
|
||||
var type = screenType //"10"
|
||||
while (sn == null || TextUtils.isEmpty(sn)) {
|
||||
Logger.d(TAG, "sn is null or empty.")
|
||||
delay(TimeUnit.MINUTES.toMillis(1))
|
||||
sn = SharedPrefsMgr.getInstance().sn
|
||||
}
|
||||
while (TextUtils.isEmpty(macAddress)) {
|
||||
Logger.d(TAG, "mac address is null or empty.")
|
||||
delay(TimeUnit.MINUTES.toMillis(1))
|
||||
macAddress = BindingCarManager.getMacAddress() ?: ""
|
||||
}
|
||||
while (type == "0") {
|
||||
Logger.d(TAG, "type is 0")
|
||||
delay((TimeUnit.MINUTES.toMillis(1)))
|
||||
type = AppIdentityModeUtils.getMisChannelCode(FunctionBuildConfig.appIdentityMode).toString()
|
||||
}
|
||||
Logger.d(TAG, "start upgrade request ...")
|
||||
SharedPrefsMgr.getInstance().putString(SharedPrefsConstants.HOST_ADDRESS, HostConst.getHost())
|
||||
try {
|
||||
val records = provider?.getUpgradeRecords()?.also {
|
||||
@@ -67,7 +86,7 @@ class UpgradeAppNetWorkManager private constructor() {
|
||||
"${ it.first } -> ${ it.second }"
|
||||
}
|
||||
}
|
||||
itx["role"] = AppIdentityModeUtils.getMisChannelCode(FunctionBuildConfig.appIdentityMode)
|
||||
itx["role"] = type
|
||||
})
|
||||
}
|
||||
Log.d(TAG, "getAppUpgradeInfo: -> records:" + records?.entries?.joinToString(",") { itx -> "key:${itx.key} -> value:[${itx.value.joinToString(",") { "${it.first},${it.second}" } }]"})
|
||||
@@ -98,7 +117,7 @@ class UpgradeAppNetWorkManager private constructor() {
|
||||
if (mDownloadRequested) {
|
||||
mDownloadRequested = false
|
||||
}
|
||||
getAppUpgradeInfo(context, mac, screenType)
|
||||
getAppUpgradeInfo(context, macAddress, type)
|
||||
}.also {
|
||||
upgradeJob = it
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user