This commit is contained in:
Cloudburst 2023-01-02 11:25:12 +00:00
parent c433df0f29
commit 30ff7d988f

View file

@ -357,31 +357,31 @@ class InAppUpdater {
} }
return false return false
} }
}
fun isMiUi(): Boolean { fun isMiUi(): Boolean {
return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.name")) return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.name"))
} }
fun getSystemProperty(propName: String): String? { fun getSystemProperty(propName: String): String? {
var line: String? = null var line: String? = null
var input: BufferedReader? = null var input: BufferedReader? = null
try { try {
val p = Runtime.getRuntime().exec("getprop $propName") val p = Runtime.getRuntime().exec("getprop $propName")
input = BufferedReader(InputStreamReader(p.inputStream), 1024) input = BufferedReader(InputStreamReader(p.inputStream), 1024)
line = input.readLine() line = input.readLine()
input.close() input.close()
} catch (ex: IOException) { } catch (ex: IOException) {
return null return null
} finally { } finally {
if (input != null) { if (input != null) {
try { try {
input.close() input.close()
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
}
} }
} }
return line
} }
return line
} }
} }