manager: enhanced device model retrieval with Huawei' market name checking

Signed-off-by: WenHao2130 <WenHao2130@outlook.com>
This commit is contained in:
WenHao2130
2025-03-29 16:11:39 +08:00
parent 11ec41aadb
commit ddd0da86cd

View File

@@ -582,9 +582,10 @@ private fun getDeviceModel(context: Context): String {
val systemProperties = Class.forName("android.os.SystemProperties") val systemProperties = Class.forName("android.os.SystemProperties")
val getMethod = systemProperties.getMethod("get", String::class.java, String::class.java) val getMethod = systemProperties.getMethod("get", String::class.java, String::class.java)
val marketNameKeys = listOf( val marketNameKeys = listOf(
"ro.product.marketname", "ro.product.marketname", // Xiaomi
"ro.vendor.oplus.market.name", "ro.vendor.oplus.market.name", // Oppo, OnePlus, Realme
"ro.vivo.market.name" "ro.vivo.market.name", // Vivo
"ro.config.marketing_name" // Huawei
) )
for (key in marketNameKeys) { for (key in marketNameKeys) {
val marketName = getMethod.invoke(null, key, "") as String val marketName = getMethod.invoke(null, key, "") as String