You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Implement reboot in Rust
This commit is contained in:
@@ -17,6 +17,7 @@ use base::{
|
||||
use std::fmt::Write as FmtWrite;
|
||||
use std::io::{BufReader, Write};
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::process::Command;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
|
||||
@@ -79,10 +80,6 @@ impl MagiskD {
|
||||
unsafe { MAGISKD.get().unwrap_unchecked() }
|
||||
}
|
||||
|
||||
pub fn is_recovery(&self) -> bool {
|
||||
self.is_recovery
|
||||
}
|
||||
|
||||
pub fn zygisk_enabled(&self) -> bool {
|
||||
self.zygisk_enabled.load(Ordering::Acquire)
|
||||
}
|
||||
@@ -217,6 +214,15 @@ impl MagiskD {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reboot(&self) {
|
||||
if self.is_recovery {
|
||||
Command::new("/system/bin/reboot").arg("recovery").status()
|
||||
} else {
|
||||
Command::new("/system/bin/reboot").status()
|
||||
}
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn daemon_entry() {
|
||||
|
||||
Reference in New Issue
Block a user