You've already forked ZygiskNext
mirror of
https://github.com/Dr-TSNG/ZygiskNext.git
synced 2025-08-27 23:46:34 +00:00
31 lines
832 B
Rust
31 lines
832 B
Rust
use anyhow::{bail, Result};
|
|
use std::process::{Command, Stdio};
|
|
use crate::constants::MIN_MAGISK_VERSION;
|
|
|
|
pub fn is_magisk() -> Result<bool> {
|
|
let version: Option<i32> = Command::new("magisk")
|
|
.arg("-V")
|
|
.stdout(Stdio::piped())
|
|
.spawn().ok()
|
|
.and_then(|child| child.wait_with_output().ok())
|
|
.and_then(|output| String::from_utf8(output.stdout).ok())
|
|
.and_then(|output| output.trim().parse().ok());
|
|
if let Some(version) = version {
|
|
if version < MIN_MAGISK_VERSION {
|
|
bail!("Magisk version too old: {}", version);
|
|
}
|
|
return Ok(true);
|
|
}
|
|
Ok(false)
|
|
}
|
|
|
|
pub fn uid_on_allowlist(uid: i32) -> bool {
|
|
// TODO: uid_on_allowlist
|
|
return false;
|
|
}
|
|
|
|
pub fn uid_on_denylist(uid: i32) -> bool {
|
|
// TODO: uid_on_denylist
|
|
return false;
|
|
}
|