Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84f57a4e authored by septs's avatar septs Committed by Peter Cai
Browse files

feat: detect network lock in quick compatibility (#303)

parent a75478dd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -173,6 +173,8 @@ open class QuickCompatibilityFragment : Fragment(), UnprivilegedEuiccContextMark
        appendLine("MODEL: ${Build.MODEL}")
        appendLine("VERSION.RELEASE: ${Build.VERSION.RELEASE}")
        appendLine("VERSION.SDK_INT: ${Build.VERSION.SDK_INT}")
        val carrier = getSystemProperty("ro.carrier")
        if (carrier != "unknown") appendLine("CARRIER: $carrier")
    }
}

@@ -181,3 +183,8 @@ private inline val Reader.isSIM: Boolean

private inline val Reader.slotIndex: Int
    get() = (name.replace("SIM", "").toIntOrNull() ?: 1) - 1 // 0-based index

fun getSystemProperty(name: String): String =
    Runtime.getRuntime().exec(arrayOf("getprop", name))
        .inputStream.bufferedReader()
        .use { it.readLine() }.ifEmpty { "unknown" }