Revert "manager: Removed SUSFS_UMOUNT_FOR_ZYGOTE_ISO_SERVICE which are no longer used in susfs 1.5.10."

This reverts commit 475b3998a1.

- bump susfs version 1.5.10
This commit is contained in:
ShirkNeko
2025-09-30 23:08:34 +08:00
parent c950705044
commit e552163d9e
14 changed files with 154 additions and 0 deletions

View File

@@ -392,16 +392,72 @@ fun SusMountsContent(
@Composable
fun TryUmountContent(
tryUmounts: Set<String>,
umountForZygoteIsoService: Boolean,
isLoading: Boolean,
onAddUmount: () -> Unit,
onRemoveUmount: (String) -> Unit,
onEditUmount: ((String) -> Unit)? = null,
onToggleUmountForZygoteIsoService: (Boolean) -> Unit
) {
Box(modifier = Modifier.fillMaxSize()) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
if (isSusVersion158()) {
item {
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surface
),
shape = RoundedCornerShape(12.dp)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(12.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Column(
modifier = Modifier.weight(1f)
) {
Row(
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Default.Security,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(18.dp)
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = stringResource(R.string.umount_zygote_iso_service),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Medium,
color = MaterialTheme.colorScheme.onSurface
)
}
Spacer(modifier = Modifier.height(6.dp))
Text(
text = stringResource(R.string.umount_zygote_iso_service_description),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
lineHeight = 14.sp
)
}
Switch(
checked = umountForZygoteIsoService,
onCheckedChange = onToggleUmountForZygoteIsoService,
enabled = !isLoading
)
}
}
}
}
if (tryUmounts.isEmpty()) {
item {
EmptyStateCard(

View File

@@ -101,6 +101,8 @@ fun SuSFSConfigScreen(
// SUS挂载隐藏控制状态
var hideSusMountsForAllProcs by remember { mutableStateOf(true) }
var umountForZygoteIsoService by remember { mutableStateOf(false) }
// Kstat配置相关状态
var kstatConfigs by remember { mutableStateOf(emptySet<String>()) }
var addKstatPaths by remember { mutableStateOf(emptySet<String>()) }
@@ -254,6 +256,7 @@ fun SuSFSConfigScreen(
hideSusMountsForAllProcs = SuSFSManager.getHideSusMountsForAllProcs(context)
enableHideBl = SuSFSManager.getEnableHideBl(context)
enableCleanupResidue = SuSFSManager.getEnableCleanupResidue(context)
umountForZygoteIsoService = SuSFSManager.getUmountForZygoteIsoService(context)
enableAvcLogSpoofing = SuSFSManager.getEnableAvcLogSpoofing(context)
loadSlotInfo()
@@ -424,6 +427,7 @@ fun SuSFSConfigScreen(
hideSusMountsForAllProcs = SuSFSManager.getHideSusMountsForAllProcs(context)
enableHideBl = SuSFSManager.getEnableHideBl(context)
enableCleanupResidue = SuSFSManager.getEnableCleanupResidue(context)
umountForZygoteIsoService = SuSFSManager.getUmountForZygoteIsoService(context)
enableAvcLogSpoofing = SuSFSManager.getEnableAvcLogSpoofing(context)
}
isLoading = false
@@ -1259,6 +1263,7 @@ fun SuSFSConfigScreen(
SuSFSTab.TRY_UMOUNT -> {
TryUmountContent(
tryUmounts = tryUmounts,
umountForZygoteIsoService = umountForZygoteIsoService,
isLoading = isLoading,
onAddUmount = { showAddUmountDialog = true },
onRemoveUmount = { umountEntry ->
@@ -1273,6 +1278,16 @@ fun SuSFSConfigScreen(
onEditUmount = { umountEntry ->
editingUmount = umountEntry
showAddUmountDialog = true
},
onToggleUmountForZygoteIsoService = { enabled ->
coroutineScope.launch {
isLoading = true
val success = SuSFSManager.setUmountForZygoteIsoService(context, enabled)
if (success) {
umountForZygoteIsoService = enabled
}
isLoading = false
}
}
)
}

View File

@@ -48,6 +48,7 @@ object SuSFSManager {
private const val KEY_HIDE_SUS_MOUNTS_FOR_ALL_PROCS = "hide_sus_mounts_for_all_procs"
private const val KEY_ENABLE_CLEANUP_RESIDUE = "enable_cleanup_residue"
private const val KEY_ENABLE_HIDE_BL = "enable_hide_bl"
private const val KEY_UMOUNT_FOR_ZYGOTE_ISO_SERVICE = "umount_for_zygote_iso_service"
private const val KEY_ENABLE_AVC_LOG_SPOOFING = "enable_avc_log_spoofing"
@@ -157,6 +158,7 @@ object SuSFSManager {
val support158: Boolean,
val enableHideBl: Boolean,
val enableCleanupResidue: Boolean,
val umountForZygoteIsoService: Boolean,
val enableAvcLogSpoofing: Boolean
) {
/**
@@ -266,6 +268,7 @@ object SuSFSManager {
support158 = isSusVersion158(),
enableHideBl = getEnableHideBl(context),
enableCleanupResidue = getEnableCleanupResidue(context),
umountForZygoteIsoService = getUmountForZygoteIsoService(context),
enableAvcLogSpoofing = getEnableAvcLogSpoofing(context)
)
}
@@ -329,6 +332,13 @@ object SuSFSManager {
fun getEnableCleanupResidue(context: Context): Boolean =
getPrefs(context).getBoolean(KEY_ENABLE_CLEANUP_RESIDUE, false)
// Zygote隔离服务卸载控制
fun saveUmountForZygoteIsoService(context: Context, enabled: Boolean) =
getPrefs(context).edit { putBoolean(KEY_UMOUNT_FOR_ZYGOTE_ISO_SERVICE, enabled) }
fun getUmountForZygoteIsoService(context: Context): Boolean =
getPrefs(context).getBoolean(KEY_UMOUNT_FOR_ZYGOTE_ISO_SERVICE, false)
// AVC日志欺骗配置
fun saveEnableAvcLogSpoofing(context: Context, enabled: Boolean) =
getPrefs(context).edit { putBoolean(KEY_ENABLE_AVC_LOG_SPOOFING, enabled) }
@@ -527,6 +537,7 @@ object SuSFSManager {
KEY_HIDE_SUS_MOUNTS_FOR_ALL_PROCS to getHideSusMountsForAllProcs(context),
KEY_ENABLE_HIDE_BL to getEnableHideBl(context),
KEY_ENABLE_CLEANUP_RESIDUE to getEnableCleanupResidue(context),
KEY_UMOUNT_FOR_ZYGOTE_ISO_SERVICE to getUmountForZygoteIsoService(context),
KEY_ENABLE_AVC_LOG_SPOOFING to getEnableAvcLogSpoofing(context),
)
}
@@ -1197,6 +1208,29 @@ object SuSFSManager {
}
}
// Zygote隔离服务卸载控制
suspend fun setUmountForZygoteIsoService(context: Context, enabled: Boolean): Boolean {
if (!isSusVersion158()) {
return false
}
val result = executeSusfsCommandWithOutput(context, "umount_for_zygote_iso_service ${if (enabled) 1 else 0}")
val success = result.isSuccess && result.output.isEmpty()
if (success) {
saveUmountForZygoteIsoService(context, enabled)
if (isAutoStartEnabled(context)) updateMagiskModule(context)
showToast(context, if (enabled)
context.getString(R.string.umount_zygote_iso_service_enabled)
else
context.getString(R.string.umount_zygote_iso_service_disabled)
)
} else {
showToast(context, context.getString(R.string.susfs_command_failed))
}
return success
}
// 添加kstat配置
suspend fun addKstatStatically(context: Context, path: String, ino: String, dev: String, nlink: String,
size: String, atime: String, atimeNsec: String, mtime: String, mtimeNsec: String,

View File

@@ -392,6 +392,8 @@ object ScriptGenerator {
appendLine()
}
generateUmountZygoteIsoServiceSection(config.umountForZygoteIsoService, config.support158)
// 添加AVC日志欺骗设置
generateAvcLogSpoofingSection(config.enableAvcLogSpoofing)
@@ -399,6 +401,17 @@ object ScriptGenerator {
}
}
// 添加新的生成方法
private fun StringBuilder.generateUmountZygoteIsoServiceSection(umountForZygoteIsoService: Boolean, support158: Boolean) {
if (support158) {
appendLine("# 设置Zygote隔离服务卸载状态")
val umountValue = if (umountForZygoteIsoService) 1 else 0
appendLine("\"${'$'}SUSFS_BIN\" umount_for_zygote_iso_service $umountValue")
appendLine("echo \"$(get_current_time): Zygote隔离服务卸载设置为: ${if (umountForZygoteIsoService) "启用" else "禁用"}\" >> \"${'$'}LOG_FILE\"")
appendLine()
}
}
/**
* 生成post-mount.sh脚本内容
*/