This commit is contained in:
liankong
2025-03-31 16:00:21 +08:00
2 changed files with 6 additions and 11 deletions

View File

@@ -528,9 +528,9 @@ fun controlKpmModule(name: String, args: String? = null): String {
return result
}
fun printKpmModules(): String {
fun getKpmVersion(): String {
val shell = getRootShell()
val cmd = "${getKpmmgrPath()} print"
val cmd = "${getKpmmgrPath()} version"
val result = ShellUtils.fastCmd(shell, cmd)
return result
}

View File

@@ -50,21 +50,16 @@ class KpmViewModel : ViewModel() {
val modules = parseModuleList(moduleInfo)
moduleList = modules
// 获取 KPM 版本信息
val kpmVersion = getKpmVersion()
Log.d("KsuCli", "KPM Version: $kpmVersion")
} finally {
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> {
return output.split("\n").mapNotNull { line ->
if (line.isBlank()) return@mapNotNull null