manager: Add kpmmgr to build workflows and optimize device model retrieval logic
This commit is contained in:
@@ -581,20 +581,18 @@ private fun getDeviceModel(context: Context): String {
|
||||
return try {
|
||||
val systemProperties = Class.forName("android.os.SystemProperties")
|
||||
val getMethod = systemProperties.getMethod("get", String::class.java, String::class.java)
|
||||
val marketName = context.getSystemService(Context.APP_OPS_SERVICE)?.let { appOps ->
|
||||
getMethod.invoke(null, "ro.product.marketname", "") as String
|
||||
} ?: ""
|
||||
|
||||
if (marketName.isNotEmpty()) {
|
||||
marketName
|
||||
} else {
|
||||
val MarketName = getMethod.invoke(null, "ro.vendor.oplus.market.name", "") as String
|
||||
if (MarketName.isNotEmpty()) {
|
||||
MarketName
|
||||
} else {
|
||||
Build.DEVICE
|
||||
val marketNameKeys = listOf(
|
||||
"ro.product.marketname",
|
||||
"ro.vendor.oplus.market.name",
|
||||
"ro.vivo.market.name"
|
||||
)
|
||||
for (key in marketNameKeys) {
|
||||
val marketName = getMethod.invoke(null, key, "") as String
|
||||
if (marketName.isNotEmpty()) {
|
||||
return marketName
|
||||
}
|
||||
}
|
||||
Build.DEVICE
|
||||
} catch (e: Exception) {
|
||||
Build.DEVICE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user