修复获取不到完整信息的bug

This commit is contained in:
liankong
2025-04-01 15:53:58 +08:00
parent 0c5dcec7bc
commit af81308097
4 changed files with 22 additions and 5 deletions

View File

@@ -25,6 +25,14 @@ apksign {
} }
android { android {
signingConfigs {
getByName("debug") {
storeFile = file("D:\\SukiSU\\release-key.keystore")
storePassword = "2832165"
keyAlias = "shirkneko"
keyPassword = "2832165"
}
}
namespace = "shirkneko.zako.sukisu" namespace = "shirkneko.zako.sukisu"
buildTypes { buildTypes {

View File

@@ -507,11 +507,19 @@ fun getKpmModuleCount(): Int {
return result.trim().toIntOrNull() ?: 0 return result.trim().toIntOrNull() ?: 0
} }
fun runCmd(shell : Shell, cmd : String) : String {
return shell.newJob()
.add(cmd)
.to(mutableListOf<String>(), null)
.exec().out
.joinToString("\n")
}
fun listKpmModules(): String { fun listKpmModules(): String {
val shell = getRootShell() val shell = getRootShell()
val cmd = "${getKpmmgrPath()} list" val cmd = "${getKpmmgrPath()} list"
return try { return try {
ShellUtils.fastCmd(shell, cmd).trim() runCmd(shell, cmd).trim()
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG, "Failed to list KPM modules", e) Log.e(TAG, "Failed to list KPM modules", e)
"" ""
@@ -522,7 +530,7 @@ fun getKpmModuleInfo(name: String): String {
val shell = getRootShell() val shell = getRootShell()
val cmd = "${getKpmmgrPath()} info $name" val cmd = "${getKpmmgrPath()} info $name"
return try { return try {
ShellUtils.fastCmd(shell, cmd).trim() runCmd(shell, cmd).trim()
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG, "Failed to get KPM module info: $name", e) Log.e(TAG, "Failed to get KPM module info: $name", e)
"" ""
@@ -532,7 +540,7 @@ fun getKpmModuleInfo(name: String): String {
fun controlKpmModule(name: String, args: String? = null): Int { fun controlKpmModule(name: String, args: String? = null): Int {
val shell = getRootShell() val shell = getRootShell()
val cmd = "${getKpmmgrPath()} control $name ${args ?: ""}" val cmd = "${getKpmmgrPath()} control $name ${args ?: ""}"
val result = ShellUtils.fastCmd(shell, cmd) val result = runCmd(shell, cmd)
return result.trim().toIntOrNull() ?: -1 return result.trim().toIntOrNull() ?: -1
} }

View File

@@ -48,7 +48,8 @@ class KpmViewModel : ViewModel() {
private fun getAllKpmModuleInfo(): List<ModuleInfo> { private fun getAllKpmModuleInfo(): List<ModuleInfo> {
val result = mutableListOf<ModuleInfo>() val result = mutableListOf<ModuleInfo>()
try { try {
val moduleNames = listKpmModules() val str = listKpmModules()
val moduleNames = str
.split("\n") .split("\n")
.filter { it.isNotBlank() } .filter { it.isNotBlank() }

View File

@@ -237,7 +237,7 @@
<string name="kpm_install_success">Load of kpm module successful</string> <string name="kpm_install_success">Load of kpm module successful</string>
<string name="kpm_install_failed">Load of kpm module failed</string> <string name="kpm_install_failed">Load of kpm module failed</string>
<string name="kpm_args">kpm parameters</string> <string name="kpm_args">kpm parameters</string>
<string name="kpm_control">kpm control</string> <string name="kpm_control">执行</string>
<string name="home_kpm_version">KPM Version</string> <string name="home_kpm_version">KPM Version</string>
<string name="close_notice">close</string> <string name="close_notice">close</string>
<string name="kernel_module_notice">The following kernel module functions were developed by KernelPatch and modified to include the kernel module functions of SukiSU Ultra</string> <string name="kernel_module_notice">The following kernel module functions were developed by KernelPatch and modified to include the kernel module functions of SukiSU Ultra</string>