Merge branch 'dev' of https://github.com/ShirkNeko/SukiSU-Ultra into dev
This commit is contained in:
@@ -528,9 +528,9 @@ fun controlKpmModule(name: String, args: String? = null): String {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun printKpmModules(): String {
|
fun getKpmVersion(): String {
|
||||||
val shell = getRootShell()
|
val shell = getRootShell()
|
||||||
val cmd = "${getKpmmgrPath()} print"
|
val cmd = "${getKpmmgrPath()} version"
|
||||||
val result = ShellUtils.fastCmd(shell, cmd)
|
val result = ShellUtils.fastCmd(shell, cmd)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,21 +50,16 @@ class KpmViewModel : ViewModel() {
|
|||||||
|
|
||||||
val modules = parseModuleList(moduleInfo)
|
val modules = parseModuleList(moduleInfo)
|
||||||
moduleList = modules
|
moduleList = modules
|
||||||
|
|
||||||
|
// 获取 KPM 版本信息
|
||||||
|
val kpmVersion = getKpmVersion()
|
||||||
|
Log.d("KsuCli", "KPM Version: $kpmVersion")
|
||||||
} finally {
|
} finally {
|
||||||
isRefreshing = false
|
isRefreshing = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getInstalledKernelPatches(): List<ModuleInfo> {
|
|
||||||
return try {
|
|
||||||
val output = printKpmModules()
|
|
||||||
parseModuleList(output)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun parseModuleList(output: String): List<ModuleInfo> {
|
private fun parseModuleList(output: String): List<ModuleInfo> {
|
||||||
return output.split("\n").mapNotNull { line ->
|
return output.split("\n").mapNotNull { line ->
|
||||||
if (line.isBlank()) return@mapNotNull null
|
if (line.isBlank()) return@mapNotNull null
|
||||||
|
|||||||
Reference in New Issue
Block a user