manager: Implement version restrictions for certain features
This commit is contained in:
@@ -23,7 +23,7 @@ object Natives {
|
||||
const val MINIMAL_SUPPORTED_SU_COMPAT = 12040
|
||||
const val KERNEL_SU_DOMAIN = "u:r:su:s0"
|
||||
|
||||
const val MINIMAL_SUPPORTED_KERNEL_FULL = "v3.1.8"
|
||||
const val MINIMAL_SUPPORTED_KERNEL_FULL = "v3.1.8"
|
||||
|
||||
const val MINIMAL_SUPPORTED_KPM = 12800
|
||||
|
||||
@@ -31,6 +31,8 @@ object Natives {
|
||||
|
||||
const val MINIMAL_SUPPORTED_UID_SCANNER = 13347
|
||||
|
||||
const val MINIMAL_NEW_IOCTL_KERNEL = 13490
|
||||
|
||||
const val ROOT_UID = 0
|
||||
const val ROOT_GID = 0
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
var isSuDisabled by rememberSaveable {
|
||||
mutableStateOf(!Natives.isSuEnabled())
|
||||
}
|
||||
|
||||
SwitchItem(
|
||||
icon = Icons.Filled.RemoveModerator,
|
||||
title = stringResource(R.string.settings_disable_su),
|
||||
@@ -166,21 +167,26 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
)
|
||||
}
|
||||
|
||||
var isKernelUmountDisabled by rememberSaveable {
|
||||
mutableStateOf(!Natives.isKernelUmountEnabled())
|
||||
}
|
||||
SwitchItem(
|
||||
icon = Icons.Rounded.FolderDelete,
|
||||
title = stringResource(id = R.string.settings_disable_kernel_umount),
|
||||
summary = stringResource(id = R.string.settings_disable_kernel_umount_summary),
|
||||
checked = isKernelUmountDisabled,
|
||||
onCheckedChange = { checked: Boolean ->
|
||||
val shouldEnable = !checked
|
||||
if (Natives.setKernelUmountEnabled(shouldEnable)) {
|
||||
isKernelUmountDisabled = !shouldEnable
|
||||
}
|
||||
// 禁用内核卸载开关
|
||||
if (Natives.version >= Natives.MINIMAL_NEW_IOCTL_KERNEL) {
|
||||
var isKernelUmountDisabled by rememberSaveable {
|
||||
mutableStateOf(!Natives.isKernelUmountEnabled())
|
||||
}
|
||||
)
|
||||
|
||||
SwitchItem(
|
||||
icon = Icons.Rounded.FolderDelete,
|
||||
title = stringResource(id = R.string.settings_disable_kernel_umount),
|
||||
summary = stringResource(id = R.string.settings_disable_kernel_umount_summary),
|
||||
checked = isKernelUmountDisabled,
|
||||
onCheckedChange = { checked: Boolean ->
|
||||
val shouldEnable = !checked
|
||||
if (Natives.setKernelUmountEnabled(shouldEnable)) {
|
||||
isKernelUmountDisabled = !shouldEnable
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// 强制签名验证开关
|
||||
var forceSignatureVerification by rememberSaveable {
|
||||
|
||||
@@ -357,7 +357,7 @@ private fun AdvancedSettings(
|
||||
SusFSSettings(state = state, handlers = handlers)
|
||||
|
||||
// 动态管理器设置
|
||||
if (Natives.version >= Natives.MINIMAL_SUPPORTED_DYNAMIC_MANAGER) {
|
||||
if (Natives.version >= Natives.MINIMAL_SUPPORTED_DYNAMIC_MANAGER && Natives.version >= Natives.MINIMAL_NEW_IOCTL_KERNEL) {
|
||||
SettingItem(
|
||||
icon = Icons.Filled.Security,
|
||||
title = stringResource(R.string.dynamic_manager_title),
|
||||
|
||||
Reference in New Issue
Block a user