manager: Set up in real time using the correct method

This commit is contained in:
ShirkNeko
2025-11-16 17:19:48 +08:00
parent c4d8c49e5c
commit cbcaa07fd5
5 changed files with 12 additions and 8 deletions

View File

@@ -327,7 +327,7 @@ void ksu_sulog_report_syscall(uid_t uid, const char *comm, const char *syscall,
int ksu_sulog_init(void)
{
if (ksu_register_feature_handler(&sulog_handler)) {
pr_err("Failed to register su_compat feature handler\n");
pr_err("Failed to register sulog feature handler\n");
}
sulog_workqueue = alloc_workqueue("ksu_sulog", WQ_UNBOUND | WQ_HIGHPRI, 1);

View File

@@ -12,7 +12,7 @@
extern struct timezone sys_tz;
#define SULOG_PATH "/data/adb/ksu/log/sulog.log"
#define SULOG_MAX_SIZE (128 * 1024 * 1024) // 128MB
#define SULOG_MAX_SIZE (32 * 1024 * 1024) // 128MB
#define SULOG_ENTRY_MAX_LEN 512
#define SULOG_COMM_LEN 256
#define DEDUP_SECS 10

View File

@@ -79,6 +79,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
val snackBarHost = LocalSnackbarHost.current
val context = LocalContext.current
val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
var isSuLogEnabled by remember { mutableStateOf(Natives.isSuLogEnabled()) }
var selectedEngine by rememberSaveable {
mutableStateOf(
prefs.getString("webui_engine", "default") ?: "default"
@@ -280,7 +281,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
)
}
SuperDropdown(
icon = Icons.Rounded.RemoveCircle,
icon = Icons.Filled.NoAccounts,
title = stringResource(id = R.string.settings_disable_sulog),
summary = stringResource(id = R.string.settings_disable_sulog_summary),
items = modeItems,
@@ -292,6 +293,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
execKsud("feature save", true)
prefs.edit { putInt("kernel_sulog_mode", 0) }
kernelSuLogMode = 0
isSuLogEnabled = true
}
// Temporarily disable: save enabled state first, then disable
@@ -300,6 +302,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
if (Natives.setSuLogEnabled(false)) {
prefs.edit { putInt("kernel_sulog_mode", 0) }
kernelSuLogMode = 1
isSuLogEnabled = false
}
}
@@ -308,6 +311,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
execKsud("feature save", true)
prefs.edit { putInt("kernel_sulog_mode", 2) }
kernelSuLogMode = 2
isSuLogEnabled = false
}
}
}
@@ -445,7 +449,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
// 查看使用日志
KsuIsValid {
if (Natives.isSuLogEnabled()) {
if (isSuLogEnabled) {
SettingItem(
icon = Icons.Filled.Visibility,
title = stringResource(R.string.log_viewer_view_logs),

View File

@@ -751,6 +751,6 @@
<string name="apply_config">应用配置</string>
<string name="config_applied">配置已应用到内核</string>
<string name="group_contains_apps">包含 %1$d 个应用</string>
<string name="settings_disable_sulog">禁用 KernelSU 超级用户访问日志记录</string>
<string name="settings_disable_sulog_summary">禁用超级用户日志记录功能</string>
<string name="settings_disable_sulog"> 禁用超级用户日志 </string>
<string name="settings_disable_sulog_summary">禁用 KernelSU 超级用户访问记录</string>
</resources>

View File

@@ -761,6 +761,6 @@ Important Note:\n
<string name="config_applied">Configuration applied to kernel</string>
<string name="mnt_detach">MNT_DETACH</string>
<string name="group_contains_apps">Contains %d apps</string>
<string name="settings_disable_sulog">Disable KernelSU superuser access logging</string>
<string name="settings_disable_sulog_summary">Disable superuser logging functionality</string>
<string name="settings_disable_sulog">Disable superuser logging</string>
<string name="settings_disable_sulog_summary">Disable KernelSU superuser access logging</string>
</resources>