manager: Implement version restrictions for certain features
This commit is contained in:
@@ -214,7 +214,7 @@ bool is_kernel_umount_enabled() {
|
||||
}
|
||||
return value != 0;
|
||||
}
|
||||
// 1. 获取完整版本名称
|
||||
|
||||
void get_full_version(char* buff) {
|
||||
struct ksu_get_full_version_cmd cmd = {0};
|
||||
if (ksuctl(KSU_IOCTL_GET_FULL_VERSION, &cmd) == 0) {
|
||||
@@ -225,7 +225,6 @@ void get_full_version(char* buff) {
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 获取KPM启用状态
|
||||
bool is_KPM_enable(void) {
|
||||
struct ksu_enable_kpm_cmd cmd = {};
|
||||
if (ksuctl(KSU_IOCTL_ENABLE_KPM, &cmd) == 0 && cmd.enabled) {
|
||||
@@ -234,7 +233,6 @@ bool is_KPM_enable(void) {
|
||||
return legacy_is_KPM_enable();
|
||||
}
|
||||
|
||||
// 3. 获取钩子类型
|
||||
void get_hook_type(char *buff) {
|
||||
struct ksu_hook_type_cmd cmd = {0};
|
||||
if (ksuctl(KSU_IOCTL_HOOK_TYPE, &cmd) == 0) {
|
||||
|
||||
@@ -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,9 +167,12 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
)
|
||||
}
|
||||
|
||||
// 禁用内核卸载开关
|
||||
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),
|
||||
@@ -181,6 +185,8 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// 强制签名验证开关
|
||||
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