You've already forked ZygiskNext
mirror of
https://github.com/Dr-TSNG/ZygiskNext.git
synced 2025-08-27 23:46:34 +00:00
Implement uid_on_allowlist for Magisk
This commit is contained in:
@@ -24,8 +24,20 @@ pub fn get_magisk() -> Option<Version> {
|
||||
}
|
||||
|
||||
pub fn uid_on_allowlist(uid: i32) -> bool {
|
||||
// TODO: uid_on_allowlist
|
||||
return false;
|
||||
let output: Option<String> = Command::new("magisk")
|
||||
.arg("--sqlite")
|
||||
.arg("select uid from policies where policy=2")
|
||||
.stdout(Stdio::piped())
|
||||
.spawn().ok()
|
||||
.and_then(|child| child.wait_with_output().ok())
|
||||
.and_then(|output| String::from_utf8(output.stdout).ok());
|
||||
let lines = match &output {
|
||||
Some(output) => output.lines(),
|
||||
None => return false,
|
||||
};
|
||||
lines.into_iter().any(|line| {
|
||||
line.trim().strip_prefix("uid=").and_then(|uid| uid.parse().ok()) == Some(uid)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn uid_on_denylist(uid: i32) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user