manager: susfs feature overhaul and some minor bug fixes

susfs: more prctl syscalls added
This commit is contained in:
Rifat Azad
2024-12-23 23:56:58 +06:00
parent eafff027e5
commit 84cb1ac04d
10 changed files with 202 additions and 45 deletions

View File

@@ -65,11 +65,11 @@ class MainActivity : ComponentActivity() {
val prefs = getSharedPreferences("settings", MODE_PRIVATE)
val suSFSVar = getSuSFSVariant()
if (suSFSVar != "NON-GKI") {
if (prefs.getBoolean("enable_susfs", false)) {
if (susfsSUSSU_Mode() != "2") {
susfsSUSSU_1()
val isSUS_SU = getSuSFSFeatures()
if (isSUS_SU == "CONFIG_KSU_SUSFS_SUS_SU") {
if (prefs.getBoolean("enable_sus_su", false)) {
if (susfsSUS_SU_Mode() != "2") {
susfsSUS_SU_2()
}
}
}
@@ -139,7 +139,7 @@ private fun BottomBar(navController: NavHostController) {
}
},
label = { Text(stringResource(destination.label)) },
alwaysShowLabel = false
alwaysShowLabel = true
)
}
}

View File

@@ -21,6 +21,7 @@ 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.painter.Painter
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
@@ -346,15 +347,21 @@ private fun InfoCard() {
val uname = Os.uname()
@Composable
fun InfoCardItem(label: String, content: String, icon: ImageVector? = null) {
fun InfoCardItem(label: String, content: String, icon: Any? = null) {
Row(verticalAlignment = Alignment.CenterVertically) {
if (icon != null) {
Icon(
imageVector = icon,
contentDescription = null,
modifier = Modifier
.padding(end = 20.dp)
)
when (icon) {
is ImageVector -> Icon(
imageVector = icon,
contentDescription = null,
modifier = Modifier.padding(end = 20.dp)
)
is Painter -> Icon(
painter = icon,
contentDescription = null,
modifier = Modifier.padding(end = 20.dp)
)
}
}
Column {
Text(
@@ -375,7 +382,7 @@ private fun InfoCard() {
InfoCardItem(
label = stringResource(R.string.home_kernel),
content = uname.release,
icon = Icons.Filled.Memory,
icon = painterResource(R.drawable.ic_linux),
)
Spacer(Modifier.height(16.dp))
@@ -391,7 +398,7 @@ private fun InfoCard() {
InfoCardItem(
label = stringResource(R.string.home_manager_version),
content = "${managerVersion.first}-next (${managerVersion.second})",
icon = Icons.AutoMirrored.Filled.Article,
icon = painterResource(R.drawable.ic_ksu_next),
)
Spacer(Modifier.height(16.dp))
@@ -402,12 +409,15 @@ private fun InfoCard() {
)
Spacer(Modifier.height(16.dp))
val isSUS_SU = getSuSFSFeatures() == "CONFIG_KSU_SUSFS_SUS_SU"
val suSFS = getSuSFS()
if (suSFS != "Unsupported") {
if (suSFS == "Supported") {
val susSUMode = if (isSUS_SU) "sus su mode: ${susfsSUS_SU_Mode()}" else ""
InfoCardItem(
label = stringResource(R.string.home_susfs_version),
content = "${getSuSFSVersion()} (${getSuSFSVariant()}) [+] sus_su mode: ${susfsSUSSU_Mode()}",
icon = Icons.Filled.SettingsSuggest,
content = "${getSuSFSVersion()} (${getSuSFSVariant()}) | $susSUMode",
icon = painterResource(R.drawable.ic_sus),
)
}
}

View File

@@ -34,6 +34,7 @@ import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.material3.rememberTopAppBarState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -187,11 +188,16 @@ fun SettingScreen(navigator: DestinationsNavigator) {
enableWebDebugging = it
}
val suSFSVar = getSuSFSVariant()
if (suSFSVar != "NON-GKI") {
val isSUS_SU = getSuSFSFeatures()
if (isSUS_SU == "CONFIG_KSU_SUSFS_SUS_SU") {
var isEnabled by rememberSaveable {
mutableStateOf(prefs.getBoolean("enable_susfs", susfsSUSSU_Mode() == "2"))
mutableStateOf(susfsSUS_SU_Mode() == "2")
}
LaunchedEffect(Unit) {
isEnabled = susfsSUS_SU_Mode() == "2"
}
SwitchItem(
icon = Icons.Filled.VisibilityOff,
title = stringResource(id = R.string.settings_susfs_toggle),
@@ -199,11 +205,11 @@ fun SettingScreen(navigator: DestinationsNavigator) {
checked = isEnabled
) {
if (it) {
susfsSUSSU_1()
susfsSUS_SU_2()
} else {
susfsSUSSU_0()
susfsSUS_SU_0()
}
prefs.edit().putBoolean("enable_susfs", it).apply()
prefs.edit().putBoolean("enable_sus_su", it).apply()
isEnabled = it
}
}

View File

@@ -141,22 +141,27 @@ fun getSuSFSVariant(): String {
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} variant")
return result
}
fun getSuSFSFeatures(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} features")
return result
}
fun susfsSUSSU_0(): String {
fun susfsSUS_SU_0(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su 0")
return result
}
fun susfsSUSSU_1(): String {
fun susfsSUS_SU_2(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su 2")
return result
}
fun susfsSUSSU_Mode(): String {
fun susfsSUS_SU_Mode(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su show_working_mode")
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su mode")
return result
}
@@ -444,7 +449,7 @@ fun getAppProfileTemplate(id: String): String {
fun setAppProfileTemplate(id: String, template: String): Boolean {
val shell = getRootShell()
val escapedTemplate = template.replace("\"", "\\\"")
val cmd = """${getKsuDaemonPath()} profile set-template "$id" "$escapedTemplate"""""
val cmd = """${getKsuDaemonPath()} profile set-template "$id" "$escapedTemplate'""""
return shell.newJob().add(cmd)
.to(ArrayList(), null).exec().isSuccess
}

View File

@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12.009,18.259C11.191,18.259 10.558,17.608 10.558,16.808C10.558,16.008 11.191,15.357 12.009,15.357C12.809,15.357 13.46,16.008 13.46,16.808C13.46,17.608 12.809,18.259 12.009,18.259C12.009,18.259 12.009,18.259 12.009,18.259Z"
android:fillColor="#fff"/>
<path
android:pathData="M12.009,22C6.465,22 2,17.535 2,12.009C2,6.465 6.465,2 12.009,2C17.535,2 22,6.465 22,12.009C22,17.535 17.535,22 12.009,22C12.009,22 12.009,22 12.009,22ZM21.088,12.009C21.088,6.986 17.033,2.912 12.009,2.912C12.009,2.912 11.935,2.912 11.935,2.912C6.967,2.967 2.912,7.005 2.912,12.009C2.912,17.033 6.986,21.088 12.009,21.088C12.009,21.088 12.065,21.088 12.065,21.088C17.07,21.051 21.088,17.014 21.088,12.009C21.088,12.009 21.088,12.009 21.088,12.009Z"
android:fillColor="#fff"
android:fillType="evenOdd"/>
<path
android:pathData="M12.009,2.838C17.07,2.838 21.181,6.931 21.181,12.01C21.181,17.052 17.107,21.126 12.065,21.182C14.577,21.126 16.586,19.098 16.586,16.605C16.586,14.075 14.521,12.029 12.009,12.029C9.479,12.029 7.414,9.982 7.414,7.433C7.414,4.922 9.423,2.875 11.916,2.857C11.954,2.838 11.991,2.838 12.009,2.838C12.009,2.838 12.009,2.838 12.009,2.838ZM13.461,7.191C13.461,6.391 12.809,5.74 12.009,5.74C11.191,5.74 10.558,6.391 10.558,7.191C10.558,7.991 11.191,8.643 12.009,8.643C12.809,8.643 13.461,7.991 13.461,7.191C13.461,7.191 13.461,7.191 13.461,7.191Z"
android:fillColor="#fff"
android:fillType="evenOdd"/>
</vector>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="21dp"
android:height="24dp"
android:viewportWidth="448"
android:viewportHeight="512">
<path
android:fillColor="#FF000000"
android:pathData="M196.1 123.6c-.2-1.4 1.9-2.3 3.2-2.9 1.7-.7 3.9-1 5.5-.1.4.2.8.7.6 1.1-.4 1.2-2.4 1-3.5 1.6-1 .5-1.8 1.7-3 1.7-1 .1-2.7-.4-2.8-1.4zm24.7-.3c1 .5 1.8 1.7 3 1.7 1.1 0 2.8-.4 2.9-1.5.2-1.4-1.9-2.3-3.2-2.9-1.7-.7-3.9-1-5.5-.1-.4.2-.8.7-.6 1.1.3 1.3 2.3 1.1 3.4 1.7zm214.7 310.2c-.5 8.2-6.5 13.8-13.9 18.3-14.9 9-37.3 15.8-50.9 32.2l-2.6-2.2 2.6 2.2c-14.2 16.9-31.7 26.6-48.3 27.9-16.5 1.3-32-6.3-40.3-23v-.1c-1.1-2.1-1.9-4.4-2.5-6.7-21.5 1.2-40.2-5.3-55.1-4.1-22 1.2-35.8 6.5-48.3 6.6-4.8 10.6-14.3 17.6-25.9 20.2-16 3.7-36.1 0-55.9-10.4l1.6-3-1.6 3c-18.5-9.8-42-8.9-59.3-12.5-8.7-1.8-16.3-5-20.1-12.3-3.7-7.3-3-17.3 2.2-31.7 1.7-5.1.4-12.7-.8-20.8-.6-3.9-1.2-7.9-1.2-11.8 0-4.3.7-8.5 2.8-12.4 4.5-8.5 11.8-12.1 18.5-14.5 6.7-2.4 12.8-4 17-8.3 5.2-5.5 10.1-14.4 16.6-20.2-2.6-17.2.2-35.4 6.2-53.3 12.6-37.9 39.2-74.2 58.1-96.7 16.1-22.9 20.8-41.3 22.5-64.7C158 103.4 132.4-.2 234.8 0c80.9.1 76.3 85.4 75.8 131.3-.3 30.1 16.3 50.5 33.4 72 15.2 18 35.1 44.3 46.5 74.4 9.3 24.6 12.9 51.8 3.7 79.1 1.4.5 2.8 1.2 4.1 2 1.4.8 2.7 1.8 4 2.9 6.6 5.6 8.7 14.3 10.5 22.4 1.9 8.1 3.6 15.7 7.2 19.7 11.1 12.4 15.9 21.5 15.5 29.7zM220.8 109.1c3.6.9 8.9 2.4 13 4.4-2.1-12.2 4.5-23.5 11.8-23 8.9.3 13.9 15.5 9.1 27.3-.8 1.9-2.8 3.4-3.9 4.6 6.7 2.3 11 4.1 12.6 4.9 7.9-9.5 10.8-26.2 4.3-40.4-9.8-21.4-34.2-21.8-44 .4-3.2 7.2-3.9 14.9-2.9 21.8zm-46.2 18.8c7.8-5.7 6.9-4.7 5.9-5.5-8-6.9-6.6-27.4 1.8-28.1 6.3-.5 10.8 10.7 9.6 19.6 3.1-2.1 6.7-3.6 10.2-4.6 1.7-19.3-9-33.5-19.1-33.5-18.9 0-24 37.5-8.4 52.1zm-9.4 20.9c1.5 4.9 6.1 10.5 14.7 15.3 7.8 4.6 12 11.5 20 15 2.6 1.1 5.7 1.9 9.6 2.1 18.4 1.1 27.1-11.3 38.2-14.9 11.7-3.7 20.1-11 22.7-18.1 3.2-8.5-2.1-14.7-10.5-18.2-11.3-4.9-16.3-5.2-22.6-9.3-10.3-6.6-18.8-8.9-25.9-8.9-14.4 0-23.2 9.8-27.9 14.2-.5.5-7.9 5.9-14.1 10.5-4.2 3.3-5.6 7.4-4.2 12.3zm-33.5 252.8L112.1 366c-6.8-9.2-13.8-14.8-21.9-16-7.7-1.2-12.6 1.4-17.7 6.9-4.8 5.1-8.8 12.3-14.3 18-7.8 6.5-9.3 6.2-19.6 9.9-6.3 2.2-11.3 4.6-14.8 11.3-2.7 5-2.1 12.2-.9 20 1.2 7.9 3 16.3.6 23.9v.2c-5 13.7-5 21.7-2.6 26.4 7.9 15.4 46.6 6.1 76.5 21.9 31.4 16.4 72.6 17.1 75.3-18 2.1-20.5-31.5-49-41-68.9zm153.9 35.8c3.2-11 6.3-21.3 6.8-29 .8-15.2 1.6-28.7 4.4-39.9 3.1-12.6 9.3-23.1 21.4-27.3 2.3-21.1 18.7-21.1 38.3-12.5 18.9 8.5 26 16 22.8 26.1 1 0 2-.1 4.2 0 5.2-16.9-14.3-28-30.7-34.8 2.9-12 2.4-24.1-.4-35.7-6-25.3-22.6-47.8-35.2-59-2.3-.1-2.1 1.9 2.6 6.5 11.6 10.7 37.1 49.2 23.3 84.9-3.9-1-7.6-1.5-10.9-1.4-5.3-29.1-17.5-53.2-23.6-64.6-11.5-21.4-29.5-65.3-37.2-95.7-4.5 6.4-12.4 11.9-22.3 15-4.7 1.5-9.7 5.5-15.9 9-13.9 8-30 8.8-42.4-1.2-4.5-3.6-8-7.6-12.6-10.3-1.6-.9-5.1-3.3-6.2-4.1-2 37.8-27.3 85.3-39.3 112.7-8.3 19.7-13.2 40.8-13.8 61.5-21.8-29.1-5.9-66.3 2.6-82.4 9.5-17.6 11-22.5 8.7-20.8-8.6 14-22 36.3-27.2 59.2-2.7 11.9-3.2 24 .3 35.2 3.5 11.2 11.1 21.5 24.6 29.9 0 0 24.8 14.3 38.3 32.5 7.4 10 9.7 18.7 7.4 24.9-2.5 6.7-9.6 8.9-16.7 8.9 4.8 6 10.3 13 14.4 19.6 37.6 25.7 82.2 15.7 114.3-7.2zM415 408.5c-10-11.3-7.2-33.1-17.1-41.6-6.9-6-13.6-5.4-22.6-5.1-7.7 8.8-25.8 19.6-38.4 16.3-11.5-2.9-18-16.3-18.8-29.5-.3.2-.7.3-1 .5-7.1 3.9-11.1 10.8-13.7 21.1-2.5 10.2-3.4 23.5-4.2 38.7-.7 11.8-6.2 26.4-9.9 40.6-3.5 13.2-5.8 25.2-1.1 36.3 7.2 14.5 19.5 20.4 33.7 19.3 14.2-1.1 30.4-9.8 43.6-25.5 22-26.6 62.3-29.7 63.2-46.5.3-5.1-3.1-13-13.7-24.6zM173.3 148.7c2 1.9 4.7 4.5 8 7.1 6.6 5.2 15.8 10.6 27.3 10.6 11.6 0 22.5-5.9 31.8-10.8 4.9-2.6 10.9-7 14.8-10.4 3.9-3.4 5.9-6.3 3.1-6.6-2.8-.3-2.6 2.6-6 5.1-4.4 3.2-9.7 7.4-13.9 9.8-7.4 4.2-19.5 10.2-29.9 10.2-10.4 0-18.7-4.8-24.9-9.7-3.1-2.5-5.7-5-7.7-6.9-1.5-1.4-1.9-4.6-4.3-4.9-1.4-.1-1.8 3.7 1.7 6.5z"
/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="24"
android:viewportHeight="24"
android:width="24dp"
android:height="24dp">
<path
android:pathData="M3.3 10.6c-1.1 -0.6 -1.8 -1.8 -1.8 -3.1 0 -1.5 0.8 -2.7 2 -3.3 0.7 -2.3 2.9 -4 5.4 -4l3.8 0.1c2.4 0 4.4 1.4 5.2 3.5h1.3c1.5 0 2.7 1.2 2.7 2.7v9.5c0 1.5 -1.2 2.7 -2.7 2.7h-0.9v2.5c0 1.5 -1.2 2.7 -2.6 2.7h-1.4c-1.4 0 -2.6 -1.2 -2.6 -2.7v-1.8h-1.8v1.8c0 1.5 -1.2 2.7 -2.6 2.7h-1.4c-1.4 0 -2.6 -1.2 -2.6 -2.7zm2.3 -6.8h4.2c2 0 3.7 1.6 3.7 3.7 0 2 -1.7 3.7 -3.7 3.7h-4.6q-0.1 0 -0.2 0v10q0 0.2 0.1 0.3 0.1 0.2 0.2 0.3 0.1 0.1 0.3 0.2 0.2 0.1 0.3 0.1h1.4q0.1 0 0.3 -0.1 0.2 -0.1 0.3 -0.2 0.1 -0.1 0.2 -0.3 0 -0.1 0 -0.3v-2.7q0 -0.1 0.1 -0.3 0.1 -0.2 0.2 -0.3 0.1 -0.1 0.3 -0.2 0.2 0 0.3 -0.1h3.6q0.1 0.1 0.3 0.1 0.2 0.1 0.3 0.2 0.1 0.1 0.2 0.3 0.1 0.2 0.1 0.3v2.7q0 0.2 0 0.3 0.1 0.2 0.2 0.3 0.1 0.1 0.3 0.2 0.2 0.1 0.3 0.1h1.4q0.2 0 0.3 -0.1 0.2 -0.1 0.3 -0.2 0.1 -0.1 0.2 -0.3 0.1 -0.1 0.1 -0.3v-15.4c0 -2.1 -1.8 -3.8 -3.9 -3.8h-3.8c-1.4 0 -2.6 0.7 -3.3 1.8zm12.7 13.1h0.9q0.2 0 0.4 -0.1 0.1 0 0.2 -0.1 0.2 -0.2 0.2 -0.3 0.1 -0.2 0.1 -0.4v-9.6q0 -0.1 -0.1 -0.3 0 -0.2 -0.2 -0.3 -0.1 -0.1 -0.2 -0.2 -0.2 -0.1 -0.4 -0.1h-0.9q0 0.2 0 0.3zm-13.1 -11.3c-1.1 0 -1.9 0.8 -1.9 1.9 0 1 0.8 1.9 1.9 1.9h4.6c1 0 1.9 -0.9 1.9 -1.9 0 -1.1 -0.9 -1.9 -1.9 -1.9z"
android:fillColor="#000000" />
</vector>

View File

@@ -2,7 +2,7 @@
<resources>
<string name="issue_report_title">Having Trouble?</string>
<string name="issue_report_body">Encountered a bug or have feedback?</string>
<string name="issue_report_body_2">Let us know as soon as possible!</string>
<string name="issue_report_body_2">Report it as soon as possible!</string>
<string name="issue_report_github">Report on GitHub</string>
<string name="issue_report_telegram">Contact via Telegram</string>
<string name="issue_report_github_link">https://github.com/rifsxd/KernelSU-Next/issues</string>
@@ -21,6 +21,7 @@
<string name="home_kernel">Kernel</string>
<string name="home_susfs">SuSFS: %s</string>
<string name="home_susfs_version">SuSFS</string>
<string name="home_susfs_sus_su">SuS SU</string>
<string name="home_android">Android</string>
<string name="home_manager_version">Manager</string>
<string name="home_selinux_status">SELinux</string>
@@ -89,7 +90,7 @@
<string name="require_kernel_version">The current KernelSU-Next version %d is too low for the manager to work properly. Please upgrade to version %d or higher!</string>
<string name="settings_umount_modules_default">Umount modules by default</string>
<string name="settings_umount_modules_default_summary">The global default value for \"Umount modules\" in App Profile. If enabled, it will remove all module modifications to the system for apps that don\'t have a profile set.</string>
<string name="settings_susfs_toggle">Hide suspecious su with SuSFS</string>
<string name="settings_susfs_toggle">Hide suspecious su hooks</string>
<string name="settings_susfs_toggle_summary">It disables kprobe hooks made by ksu, and instead the non-kprobe inline hooks will be enabled, just the same implementation for non-gki kernel without kprobe supported.</string>
<string name="profile_umount_modules_summary">Enabling this option will allow KernelSU-Next to restore any modified files by the modules for this app.</string>
<string name="profile_selinux_domain">Domain</string>