From 5e036cb883cce5f1c9dc5008458041f4d0e9cf69 Mon Sep 17 00:00:00 2001 From: Rifat Azad Date: Sun, 22 Dec 2024 02:54:20 +0600 Subject: [PATCH] manager: Detect SuSFS support --- .../java/com/rifsxd/ksunext/ui/screen/Home.kt | 15 +++++++++++++ .../java/com/rifsxd/ksunext/ui/util/KsuCli.kt | 22 +++++++++++++++++++ manager/app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 39 insertions(+) diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt index 048c48c0..c66eeccb 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Home.kt @@ -267,6 +267,11 @@ private fun StatusCard( text = stringResource(R.string.home_module_count, getModuleCount()), style = MaterialTheme.typography.bodyMedium ) + Spacer(Modifier.height(4.dp)) + Text( + text = stringResource(R.string.home_susfs, getSuSFS()), + style = MaterialTheme.typography.bodyMedium + ) } } @@ -393,6 +398,16 @@ private fun InfoCard() { content = getSELinuxStatus(), icon = Icons.Filled.Security, ) + + Spacer(Modifier.height(16.dp)) + val suSfsStatus = getSuSFS() + if (suSfsStatus != "Unsupported") { + InfoCardItem( + label = stringResource(R.string.home_susfs_version), + content = getSuSFSVersion(), + icon = Icons.Filled.SettingsSuggest, + ) + } } } } diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt index 2d8fa8bd..73af1010 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/util/KsuCli.kt @@ -120,6 +120,28 @@ fun getModuleCount(): Int { }.getOrElse { return 0 } } +fun getSuSFS(): String { + val shell = getRootShell() + val result = ShellUtils.fastCmd(shell, "dmesg | grep -i susfs") + + return if (result.isNotBlank()) { + "Supported" + } else { + "Unsupported" + } +} + +fun getSuSFSVersion(): String { + val shell = getRootShell() + val result = ShellUtils.fastCmd(shell, "su -c ksu_susfs show version") + + return if (result.startsWith("v")) { + result + } else { + "Unavailable" + } +} + fun getSuperuserCount(): Int { return Natives.allowList.size } diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml index 4ab6d57e..a65d4336 100644 --- a/manager/app/src/main/res/values/strings.xml +++ b/manager/app/src/main/res/values/strings.xml @@ -19,6 +19,8 @@ KernelSU Next v2 signature not found in kernel! [ !KSU_NEXT || != size/hash ] Ask your kernel developer to integrate KernelSU Next! Kernel + SuSFS: %s + SuSFS Android Manager SELinux