diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt
index 5737c524a940..2ab3e01ce9dc 100644
--- a/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt
+++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt
@@ -127,7 +127,7 @@ private fun BottomBar(navController: NavHostController) {
}
},
label = { Text(stringResource(destination.label)) },
- alwaysShowLabel = false
+ alwaysShowLabel = true
)
}
}
diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt
index 55c7e99d64a1..75769d2e96b6 100644
--- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt
+++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt
@@ -22,10 +22,12 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.content.pm.PackageInfoCompat
@@ -93,6 +95,7 @@ fun HomeScreen(navigator: DestinationsNavigator) {
stringResource(id = R.string.grant_root_failed)
)
}
+ SusfsCard()
val checkUpdate =
LocalContext.current.getSharedPreferences("settings", Context.MODE_PRIVATE)
.getBoolean("check_update", true)
@@ -100,8 +103,6 @@ fun HomeScreen(navigator: DestinationsNavigator) {
UpdateCard()
}
InfoCard()
- DonateCard()
- LearnMoreCard()
Spacer(Modifier)
}
}
@@ -337,55 +338,53 @@ fun WarningCard(
}
@Composable
-fun LearnMoreCard() {
- val uriHandler = LocalUriHandler.current
- val url = stringResource(R.string.home_learn_kernelsu_url)
-
- ElevatedCard {
-
- Row(modifier = Modifier
- .fillMaxWidth()
- .clickable {
- uriHandler.openUri(url)
- }
- .padding(24.dp), verticalAlignment = Alignment.CenterVertically) {
- Column {
- Text(
- text = stringResource(R.string.home_learn_kernelsu),
- style = MaterialTheme.typography.titleSmall
- )
- Spacer(Modifier.height(4.dp))
- Text(
- text = stringResource(R.string.home_click_to_learn_kernelsu),
- style = MaterialTheme.typography.bodyMedium
- )
- }
- }
- }
-}
-
-@Composable
-fun DonateCard() {
- val uriHandler = LocalUriHandler.current
+private fun SusfsCard(
+) {
+ val susfsVersion = getSusfsVersion()
ElevatedCard {
-
Row(modifier = Modifier
.fillMaxWidth()
- .clickable {
- uriHandler.openUri("https://patreon.com/weishu")
- }
.padding(24.dp), verticalAlignment = Alignment.CenterVertically) {
- Column {
- Text(
- text = stringResource(R.string.home_support_title),
- style = MaterialTheme.typography.titleSmall
- )
- Spacer(Modifier.height(4.dp))
- Text(
- text = stringResource(R.string.home_support_content),
- style = MaterialTheme.typography.bodyMedium
- )
+ Icon(
+ ImageVector.vectorResource(R.drawable.ic_susfs),
+ stringResource(R.string.susfs),
+ modifier = Modifier.size(24.dp)
+ )
+ Column(Modifier.padding(start = 20.dp)) {
+ when {
+ susfsVersion.isNotBlank() -> {
+ Text(
+ text =
+ "${stringResource(R.string.susfs)} " +
+ "$susfsVersion " +
+ "(${getSusfsVariant()})",
+ style = MaterialTheme.typography.bodyMedium
+ )
+ Spacer(Modifier.height(4.dp))
+ Text(
+ text = stringResource(
+ R.string.susfs_sus_su_mode,
+ if (getSusfsSSMode().length == 1) getSusfsSSMode() else "Unsupported"
+ ),
+ style = MaterialTheme.typography.bodyMedium
+ )
+ Spacer(Modifier.height(4.dp))
+ Text(
+ text = stringResource(
+ R.string.susfs_auto_hide,
+ if (getSusfsAutoHide()) "Yes" else "No"
+ ),
+ style = MaterialTheme.typography.bodyMedium
+ )
+ }
+ else -> {
+ Text(
+ text = "${stringResource(R.string.susfs)} ${stringResource(R.string.susfs_unsupported)}",
+ style = MaterialTheme.typography.titleMedium
+ )
+ }
+ }
}
}
}
diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt
index 1a2416b280d2..9b33b2df61a1 100644
--- a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt
+++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt
@@ -33,6 +33,10 @@ private fun getKsuDaemonPath(): String {
return ksuApp.applicationInfo.nativeLibraryDir + File.separator + "libksud.so"
}
+private fun getSusfsPath(): String {
+ return ksuApp.applicationInfo.nativeLibraryDir + File.separator + "libsusfs.so"
+}
+
object KsuCli {
val SHELL: Shell = createRootShell()
val GLOBAL_MNT_SHELL: Shell = createRootShell(true)
@@ -438,3 +442,23 @@ fun restartApp(packageName: String) {
forceStopApp(packageName)
launchApp(packageName)
}
+
+fun getSusfsVersion(): String {
+ val shell = getRootShell()
+ return ShellUtils.fastCmd(shell, "${getSusfsPath()} show version")
+}
+
+fun getSusfsVariant(): String {
+ val shell = getRootShell()
+ return ShellUtils.fastCmd(shell, "${getSusfsPath()} show variant")
+}
+
+fun getSusfsAutoHide(): Boolean {
+ val shell = getRootShell()
+ return ShellUtils.fastCmdResult(shell, "${getSusfsPath()} show enabled_features | grep AUTO")
+}
+
+fun getSusfsSSMode(): String {
+ val shell = getRootShell()
+ return ShellUtils.fastCmd(shell, "${getSusfsPath()} sus_su show_working_mode")
+}
\ No newline at end of file
diff --git a/manager/app/src/main/res/drawable/ic_susfs.xml b/manager/app/src/main/res/drawable/ic_susfs.xml
new file mode 100644
index 000000000000..8d7b141c1f35
--- /dev/null
+++ b/manager/app/src/main/res/drawable/ic_susfs.xml
@@ -0,0 +1,14 @@
+
+
+
+
diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml
index ca5ad819e63e..35cdeb238572 100644
--- a/manager/app/src/main/res/values/strings.xml
+++ b/manager/app/src/main/res/values/strings.xml
@@ -19,6 +19,10 @@
Enforcing
Permissive
Unknown
+ SuSFS
+ Auto-hide: %s
+ SUS_SU mode: %s
+ Unsupported
Superuser
Failed to enable module: %s
Failed to disable module: %s