Merge branch 'rifsxd:next' into next

This commit is contained in:
Cycle1337
2024-12-23 07:21:14 +08:00
committed by GitHub
6 changed files with 132 additions and 16 deletions

View File

@@ -406,7 +406,7 @@ private fun InfoCard() {
if (suSFS != "Unsupported") {
InfoCardItem(
label = stringResource(R.string.home_susfs_version),
content = "${getSuSFSVersion()} (${getSuSFSVariant()})",
content = "${getSuSFSVersion()} (${getSuSFSVariant()}) [+] sus_su mode: ${susfsSUSSU_Mode()}",
icon = Icons.Filled.SettingsSuggest,
)
}

View File

@@ -19,17 +19,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Undo
import androidx.compose.material.icons.filled.BugReport
import androidx.compose.material.icons.filled.Compress
import androidx.compose.material.icons.filled.ContactPage
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.DeleteForever
import androidx.compose.material.icons.filled.DeveloperMode
import androidx.compose.material.icons.filled.Fence
import androidx.compose.material.icons.filled.RemoveModerator
import androidx.compose.material.icons.filled.Save
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.filled.Update
import androidx.compose.material.icons.filled.*
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@@ -87,6 +77,7 @@ import com.rifsxd.ksunext.ui.component.rememberCustomDialog
import com.rifsxd.ksunext.ui.component.rememberLoadingDialog
import com.rifsxd.ksunext.ui.util.LocalSnackbarHost
import com.rifsxd.ksunext.ui.util.getBugreportFile
import com.rifsxd.ksunext.ui.util.*
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
@@ -196,6 +187,26 @@ fun SettingScreen(navigator: DestinationsNavigator) {
enableWebDebugging = it
}
val suSFSVar = getSuSFSVariant()
if (suSFSVar != "NON-GKI") {
var isEnabled by rememberSaveable {
mutableStateOf(susfsSUSSU_Mode() == "2")
}
SwitchItem(
icon = Icons.Filled.VisibilityOff,
title = stringResource(id = R.string.settings_susfs_toggle),
summary = stringResource(id = R.string.settings_susfs_toggle_summary),
checked = isEnabled
) {
if (it) {
susfsSUSSU_1()
} else {
susfsSUSSU_0()
}
isEnabled = it
}
}
var showBottomsheet by remember { mutableStateOf(false) }
ListItem(

View File

@@ -142,6 +142,24 @@ fun getSuSFSVariant(): String {
return result
}
fun susfsSUSSU_0(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su 0")
return result
}
fun susfsSUSSU_1(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su 2")
return result
}
fun susfsSUSSU_Mode(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su show_working_mode")
return result
}
fun getSuperuserCount(): Int {
return Natives.allowList.size
}
@@ -426,7 +444,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

@@ -89,6 +89,8 @@
<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_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>
<string name="profile_selinux_rules">Rules</string>