mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 05:44:39 +00:00
parent
f4299fbea8
commit
493068c073
@ -757,6 +757,8 @@ void boot_complete(int client) {
|
||||
if (!pfs_done)
|
||||
return;
|
||||
|
||||
auto_start_magiskhide();
|
||||
|
||||
if (access(MANAGERAPK, F_OK) == 0) {
|
||||
// Install Magisk Manager if exists
|
||||
rename(MANAGERAPK, "/data/magisk.apk");
|
||||
|
@ -217,7 +217,7 @@ static void set_hide_config() {
|
||||
db_err(err);
|
||||
}
|
||||
|
||||
static inline void launch_err(int client, int code = DAEMON_ERROR) {
|
||||
[[noreturn]] static void launch_err(int client, int code = DAEMON_ERROR) {
|
||||
if (code != HIDE_IS_ENABLED)
|
||||
hide_enabled = false;
|
||||
if (client >= 0) {
|
||||
@ -280,10 +280,14 @@ int stop_magiskhide() {
|
||||
}
|
||||
|
||||
void auto_start_magiskhide() {
|
||||
db_settings dbs;
|
||||
get_db_settings(dbs, HIDE_CONFIG);
|
||||
if (dbs[HIDE_CONFIG]) {
|
||||
new_daemon_thread([]{ launch_magiskhide(-1); });
|
||||
if (hide_enabled) {
|
||||
pthread_kill(proc_monitor_thread, SIGZYGOTE);
|
||||
} else if (SDK_INT >= 19) {
|
||||
db_settings dbs;
|
||||
get_db_settings(dbs, HIDE_CONFIG);
|
||||
if (dbs[HIDE_CONFIG]) {
|
||||
new_daemon_thread([]{ launch_magiskhide(-1); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <daemon.h>
|
||||
|
||||
#define SIGTERMTHRD SIGUSR1
|
||||
#define SIGZYGOTE SIGUSR2
|
||||
|
||||
#define SAFETYNET_COMPONENT "com.google.android.gms/.droidguard.DroidGuardService"
|
||||
#define SAFETYNET_PROCESS "com.google.android.gms.unstable"
|
||||
|
@ -155,6 +155,10 @@ static void inotify_event(int) {
|
||||
check_zygote();
|
||||
}
|
||||
|
||||
static void check_zygote(int) {
|
||||
check_zygote();
|
||||
}
|
||||
|
||||
// Workaround for the lack of pthread_cancel
|
||||
static void term_thread(int) {
|
||||
LOGD("proc_monitor: cleaning up\n");
|
||||
@ -312,6 +316,8 @@ void proc_monitor() {
|
||||
sigaction(SIGTERMTHRD, &act, nullptr);
|
||||
act.sa_handler = inotify_event;
|
||||
sigaction(SIGIO, &act, nullptr);
|
||||
act.sa_handler = check_zygote;
|
||||
sigaction(SIGZYGOTE, &act, nullptr);
|
||||
|
||||
setup_inotify();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user