From ae3c59163889f291d9560440e519328f43349308 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Sat, 29 Mar 2025 01:35:33 +0800 Subject: [PATCH] Manager: Enhanced Device Model Retrieval with One Plus' Market Name Checking --- .../main/java/shirkneko/zako/sukisu/ui/screen/Home.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt index 2b0e92ae..f742d118 100644 --- a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt +++ b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/Home.kt @@ -579,16 +579,21 @@ private fun WarningCardPreview() { @SuppressLint("PrivateApi") 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 -> - val systemProperties = Class.forName("android.os.SystemProperties") - val getMethod = systemProperties.getMethod("get", String::class.java, String::class.java) getMethod.invoke(null, "ro.product.marketname", "") as String } ?: "" if (marketName.isNotEmpty()) { marketName } else { - Build.DEVICE + val MarketName = getMethod.invoke(null, "ro.vendor.oplus.market.name", "") as String + if (MarketName.isNotEmpty()) { + MarketName + } else { + Build.DEVICE + } } } catch (e: Exception) { Build.DEVICE