You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
manager: susfs feature overhaul and some minor bug fixes
susfs: more prctl syscalls added
This commit is contained in:
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user