manager: bump susfs version to 2.0.0

- Remove versions below susfs 2.0.0 that are no longer supported.
This commit is contained in:
ShirkNeko
2025-11-14 21:53:17 +08:00
parent c17d7b38eb
commit 906c4bdb01
55 changed files with 30 additions and 399 deletions

View File

@@ -52,7 +52,7 @@ import com.sukisu.ultra.ui.theme.getCardColors
import com.sukisu.ultra.ui.theme.getCardElevation
import com.sukisu.ultra.ui.susfs.util.SuSFSManager
import com.sukisu.ultra.ui.util.checkNewVersion
import com.sukisu.ultra.ui.util.getSuSFS
import com.sukisu.ultra.ui.util.getSuSFSVersion
import com.sukisu.ultra.ui.util.module.LatestVersionInfo
import com.sukisu.ultra.ui.util.reboot
import com.sukisu.ultra.ui.viewmodel.HomeViewModel
@@ -296,7 +296,8 @@ private fun TopBar(
actions = {
if (isDataLoaded) {
// SuSFS 配置按钮
if (getSuSFS() == "Supported" && SuSFSManager.isBinaryAvailable(context)) {
val susfsVersion = getSuSFSVersion()
if (susfsVersion.isNotEmpty() && !susfsVersion.startsWith("[-]") && SuSFSManager.isBinaryAvailable(context)) {
IconButton(onClick = {
navigator.navigate(SuSFSConfigScreenDestination)
}) {
@@ -827,21 +828,15 @@ private fun InfoCard(
private fun SuSFSInfoText(systemInfo: HomeViewModel.SystemInfo): String = buildString {
append(systemInfo.suSFSVersion)
val isSUS_SU = systemInfo.suSFSFeatures == "CONFIG_KSU_SUSFS_SUS_SU"
val isKprobesHook = Natives.getHookType() == "Kprobes"
when {
isSUS_SU && isKprobesHook -> {
append(" (${systemInfo.suSFSVariant})")
if (systemInfo.susSUMode.isNotEmpty()) {
append(" ${stringResource(R.string.sus_su_mode)} ${systemInfo.susSUMode}")
}
}
Natives.getHookType() == "Manual" -> {
append(" (${stringResource(R.string.manual_hook)})")
}
Natives.getHookType() == "Inline" -> {
append(" (${stringResource(R.string.inline_hook)})")
}
else -> {
append(" (${Natives.getHookType()})")
}

View File

@@ -68,7 +68,7 @@ object SuSFSManager {
private const val MIN_VERSION_FOR_HIDE_MOUNT = "1.5.8"
private const val MIN_VERSION_FOR_LOOP_PATH = "1.5.9"
private const val MIN_VERSION_SUS_MAPS = "1.5.12"
const val MAX_SUSFS_VERSION = "1.5.12"
const val MAX_SUSFS_VERSION = "2.0.0"
private const val BACKUP_FILE_EXTENSION = ".susfs_backup"
private const val MEDIA_DATA_PATH = "/data/media/0/Android/data"
private const val CGROUP_UID_PATH_PREFIX = "/sys/fs/cgroup/uid_"

View File

@@ -542,51 +542,27 @@ fun restartApp(packageName: String) {
}
fun getSuSFSDaemonPath(): String {
return ksuApp.applicationInfo.nativeLibraryDir + File.separator + "libsusfsd.so"
}
fun getSuSFS(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} support")
return result
return ksuApp.applicationInfo.nativeLibraryDir + File.separator + "libksu_susfs.so"
}
fun getSuSFSVersion(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} version")
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} show version")
return result
}
fun getSuSFSVariant(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} variant")
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} show variant")
return result
}
fun getSuSFSFeatures(): String {
val shell = getRootShell()
val cmd = "${getSuSFSDaemonPath()} features"
val cmd = "${getSuSFSDaemonPath()} show enabled_features"
return runCmd(shell, cmd)
}
fun susfsSUS_SU_0(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} sus_su 0")
return result
}
fun susfsSUS_SU_2(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} sus_su 2")
return result
}
fun susfsSUS_SU_Mode(): String {
val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} sus_su mode")
return result
}
fun getZygiskImplement(): String {
val shell = getRootShell()

View File

@@ -49,7 +49,6 @@ class HomeViewModel : ViewModel() {
val suSFSVersion: String = "",
val suSFSVariant: String = "",
val suSFSFeatures: String = "",
val susSUMode: String = "",
val superuserCount: Int = 0,
val moduleCount: Int = 0,
val kpmModuleCount: Int = 0,
@@ -237,7 +236,6 @@ class HomeViewModel : ViewModel() {
suSFSVersion = suSFSInfo.second,
suSFSVariant = suSFSInfo.third,
suSFSFeatures = suSFSInfo.fourth,
susSUMode = suSFSInfo.fifth
)
}
@@ -436,16 +434,21 @@ class HomeViewModel : ViewModel() {
}
}
private suspend fun loadSuSFSInfo(): Tuple5<String, String, String, String, String> {
private suspend fun loadSuSFSInfo(): Tuple4<String, String, String, String> {
return withContext(Dispatchers.IO) {
val suSFS = try {
getSuSFS()
val rawFeature = getSuSFSFeatures()
if (rawFeature.isNotEmpty() && !rawFeature.startsWith("[-]")) {
"Supported"
} else {
rawFeature
}
} catch (_: Exception) {
"Unknown"
}
if (suSFS != "Supported") {
return@withContext Tuple5(suSFS, "", "", "", "")
return@withContext Tuple4(suSFS, "", "", "")
}
val suSFSVersion = try {
@@ -455,7 +458,7 @@ class HomeViewModel : ViewModel() {
}
if (suSFSVersion.isEmpty()) {
return@withContext Tuple5(suSFS, "", "", "", "")
return@withContext Tuple4(suSFS, "", "", "")
}
val suSFSVariant = try {
@@ -470,17 +473,7 @@ class HomeViewModel : ViewModel() {
""
}
val susSUMode = if (suSFSFeatures == "CONFIG_KSU_SUSFS_SUS_SU") {
try {
susfsSUS_SU_Mode()
} catch (_: Exception) {
""
}
} else {
""
}
Tuple5(suSFS, suSFSVersion, suSFSVariant, suSFSFeatures, susSUMode)
Tuple4(suSFS, suSFSVersion, suSFSVariant, suSFSFeatures)
}
}
@@ -582,6 +575,13 @@ class HomeViewModel : ViewModel() {
val fifth: T5
)
data class Tuple4<T1, T2, T3, T4>(
val first: T1,
val second: T2,
val third: T3,
val fourth: T4
)
override fun onCleared() {
super.onCleared()
loadingJobs.forEach { it.cancel() }

View File

@@ -353,9 +353,6 @@ private fun AdvancedSettings(
onChange = handlers::handleSelinuxChange
)
// SuSFS 开关(仅在支持时显示)
SusFSSettings(state = state, handlers = handlers)
// 动态管理器设置
if (Natives.version >= Natives.MINIMAL_SUPPORTED_DYNAMIC_MANAGER && Natives.version >= Natives.MINIMAL_NEW_IOCTL_KERNEL) {
SettingItem(
@@ -372,25 +369,6 @@ private fun AdvancedSettings(
}
}
@Composable
private fun SusFSSettings(
state: MoreSettingsState,
handlers: MoreSettingsHandlers
) {
val suSFS = getSuSFS()
val isSUS_SU = getSuSFSFeatures()
if (suSFS == "Supported" && isSUS_SU == "CONFIG_KSU_SUSFS_SUS_SU") {
SwitchSettingItem(
icon = Icons.Filled.Security,
title = stringResource(id = R.string.settings_susfs_toggle),
summary = stringResource(id = R.string.settings_susfs_toggle_summary),
checked = state.isSusFSEnabled,
onChange = handlers::handleSusFSChange
)
}
}
@Composable
private fun ThemeColorSelection(state: MoreSettingsState) {
SettingItem(

View File

@@ -82,15 +82,6 @@ class MoreSettingsHandlers(
state.dynamicSignHash = config.hash
}
}
// 初始化 SuSFS 状态
val currentMode = susfsSUS_SU_Mode()
val wasManuallyDisabled = prefs.getBoolean("enable_sus_su", true)
if (currentMode != "2" && wasManuallyDisabled) {
susfsSUS_SU_2()
prefs.edit { putBoolean("enable_sus_su", true) }
}
state.isSusFSEnabled = currentMode == "2"
}
/**
@@ -375,30 +366,6 @@ class MoreSettingsHandlers(
}
}
/**
* 处理SuSFS变更
*/
fun handleSusFSChange(enabled: Boolean) {
if (enabled) {
susfsSUS_SU_2()
prefs.edit { putBoolean("enable_sus_su", true) }
Toast.makeText(
context,
context.getString(R.string.susfs_enabled),
Toast.LENGTH_SHORT
).show()
} else {
susfsSUS_SU_0()
prefs.edit { putBoolean("enable_sus_su", false) }
Toast.makeText(
context,
context.getString(R.string.susfs_disabled),
Toast.LENGTH_SHORT
).show()
}
state.isSusFSEnabled = enabled
}
/**
* 处理动态管理器配置
*/