[3.2.0][应用升级] 优化埋点上报逻辑;增加全量升级开始安装状态记录

This commit is contained in:
renwj
2023-05-17 14:24:37 +08:00
parent 641ad6c7dc
commit 495b331153
2 changed files with 9 additions and 2 deletions

View File

@@ -43,12 +43,18 @@ class UpgradeAppNetWorkManager private constructor() {
scope.launch {
val sn = MoGoAiCloudClientConfig.getInstance().sn //null
val macAddress = mac //"48:b0:2d:4d:31:7f"
val type = screenType //10
val type = screenType //"10"
SharedPrefsMgr.getInstance(context!!).putString(SharedPrefsConstants.HOST_ADDRESS, HostConst.getHost())
try {
val records = provider?.getUpgradeRecords()?.also {
MogoAnalyticUtils.track("AppUpgradeRecord", it.let { TreeMap<String, Any>().also { itx -> itx.putAll(it) } })
MogoAnalyticUtils.track("AppUpgradeRecord", TreeMap<String, Any>().also { itx ->
it.entries.forEach { entry ->
itx[entry.key] = entry.value.joinToString(",") {
"${ it.first } -> ${ it.second }"
}
}
})
}
Log.d(TAG, "getAppUpgradeInfo: -> records:" + records?.entries?.joinToString(",") { itx -> "key:${itx.key} -> value:[${itx.value.joinToString(",") { "${it.first},${it.second}" } }]"})
val versionCode = AppUtils.getAppVersionCode()

View File

@@ -166,6 +166,7 @@ class UpgradeManager : IDownloadListener {
}
} else {
val apk = File(localPath)
upgradeProvider?.recordInstallStart()
withContext(Dispatchers.Main) {
ApkInstaller.installApp(Utils.getApp(), apk) { code, reason ->
if (code != PackageInstaller.STATUS_SUCCESS) {