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
This commit is contained in:
topjohnwu
2026-08-30 00:03:52 +00:00
committed by John Wu
parent b8b140fafa
commit f38e0c8bc6
+10 -1
View File
@@ -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() {