From f38e0c8bc66eff5bf9e32fa862f6c39bd4c56a1a Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 29 Aug 2026 14:46:30 -0700 Subject: [PATCH] su: Enable logging and notify by default When a UID makes a root request for the first time, no row exists in the policies table. Previously, RootSettings derived Default, which initialized log and notify to false. As a result, connect_app() skipped calling app_log() or app_notify() immediately after user approval on the initial su request. Explicitly implement Default for RootSettings with log and notify set to true by default. Assisted-by: Gemini 3.7 Flash --- native/src/core/su/db.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/native/src/core/su/db.rs b/native/src/core/su/db.rs index 38a3d0bb5..67b85ae54 100644 --- a/native/src/core/su/db.rs +++ b/native/src/core/su/db.rs @@ -12,13 +12,22 @@ impl Default for SuPolicy { } } -#[derive(Default)] pub struct RootSettings { pub policy: SuPolicy, pub log: bool, pub notify: bool, } +impl Default for RootSettings { + fn default() -> Self { + RootSettings { + policy: SuPolicy::Query, + log: true, + notify: true, + } + } +} + impl SqlTable for RootSettings { fn on_row(&mut self, columns: &[String], values: &DbValues) { for (i, column) in columns.iter().enumerate() {