2020-05-30 15:42:04 +00:00
|
|
|
package com.vanced.manager.utils
|
|
|
|
|
|
|
|
import java.io.BufferedReader
|
|
|
|
import java.io.IOException
|
|
|
|
import java.io.InputStreamReader
|
|
|
|
|
|
|
|
object MiuiHelper {
|
|
|
|
|
2020-11-14 23:24:15 +00:00
|
|
|
private const val MIUI_PROP_NAME = "ro.miui.ui.version.name"
|
|
|
|
|
|
|
|
fun isMiui(): Boolean = !getSystemProps(MIUI_PROP_NAME).isNullOrEmpty()
|
2020-06-30 16:47:59 +00:00
|
|
|
|
2020-05-30 15:42:04 +00:00
|
|
|
private fun getSystemProps(propname: String): String? {
|
|
|
|
var input: BufferedReader? = null
|
2020-11-14 23:24:15 +00:00
|
|
|
return try {
|
|
|
|
val process = Runtime.getRuntime().exec("getprop $propname")
|
|
|
|
input = BufferedReader(InputStreamReader(process.inputStream), 1024)
|
|
|
|
input.readLine()
|
2020-05-30 15:42:04 +00:00
|
|
|
} catch (e: IOException) {
|
2020-11-14 23:24:15 +00:00
|
|
|
null
|
2020-05-30 15:42:04 +00:00
|
|
|
} finally {
|
2020-11-14 23:24:15 +00:00
|
|
|
input?.close()
|
2020-05-30 15:42:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|