[3.2.0][应用升级] 去掉是否是EB5设备的判断
This commit is contained in:
@@ -125,7 +125,7 @@ class UpgradeAppNetWorkManager private constructor() {
|
||||
Log.d("ApkInstaller", "走全量升级 --- 1 ----")
|
||||
provider?.recordUpgradeRecord(info.result.versionName, null, 0)
|
||||
}
|
||||
if (ApkInstaller.isInstallAppStore(Utils.getApp()) && ApkInstaller.isEB5Device(Utils.getApp())) {
|
||||
if (ApkInstaller.isInstallAppStore(Utils.getApp())) {
|
||||
Log.d("ApkInstaller", "EB5设备,直接走静默,不弹窗...")
|
||||
CallerDevaToolsManager.downLoadPackage(if (isGoFullUpgrade) APK else PATCH, downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1), downloadUrl)
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.eagle.core.utilcode.util
|
||||
|
||||
import android.annotation.*
|
||||
import android.app.*
|
||||
import android.content.*
|
||||
import android.content.pm.PackageInstaller.*
|
||||
@@ -37,7 +36,7 @@ class ApkInstaller {
|
||||
return
|
||||
}
|
||||
Log.d("AppInstallReceiver", "-- installApp --")
|
||||
if (isInstallAppStore(context) && isEB5Device(context)) {
|
||||
if (isInstallAppStore(context)) {
|
||||
Log.d("AppInstallReceiver", "-- installApp -- 1 --")
|
||||
val intent = Intent("com.mogo.INSTALL_REQUEST")
|
||||
intent.setPackage("com.mogo.appstore")
|
||||
@@ -64,28 +63,6 @@ class ApkInstaller {
|
||||
val installedPackages = ctx.packageManager.getInstalledPackages(0)
|
||||
return installedPackages.find { it.packageName == "com.mogo.appstore" } != null
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isEB5Device(ctx: Context): Boolean {
|
||||
val sn: String = getSystemPropertyByReflect("persist.device.sn")
|
||||
return sn.startsWith("ZT", true)
|
||||
}
|
||||
|
||||
private fun getSystemPropertyByReflect(key: String): String {
|
||||
try {
|
||||
@SuppressLint("PrivateApi")
|
||||
val clz = Class.forName("android.os.SystemProperties")
|
||||
val getMethod = clz.getMethod(
|
||||
"get",
|
||||
String::class.java,
|
||||
String::class.java
|
||||
)
|
||||
return getMethod.invoke(clz, key, "2") as String
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user