diff --git a/native/src/init/init.hpp b/native/src/init/init.hpp index 078bd30c5..f8d737360 100644 --- a/native/src/init/init.hpp +++ b/native/src/init/init.hpp @@ -59,10 +59,6 @@ private: bool hijack_sepolicy(); void setup_tmp(const char *path); protected: - // When this boolean is set, this means we are currently - // running magiskinit on legacy SAR AVD emulator - bool avd_hack = false; - void patch_rw_root(); void patch_ro_root(); public: diff --git a/native/src/init/mount.cpp b/native/src/init/mount.cpp index e1c220a44..251a49405 100644 --- a/native/src/init/mount.cpp +++ b/native/src/init/mount.cpp @@ -23,6 +23,10 @@ struct devinfo { static vector dev_list; +// When this boolean is set, this means we are currently +// running magiskinit on legacy SAR AVD emulator +bool avd_hack = false; + static void parse_device(devinfo *dev, const char *uevent) { dev->partname[0] = '\0'; dev->devpath[0] = '\0'; diff --git a/native/src/init/rootdir.cpp b/native/src/init/rootdir.cpp index 42bb97e35..ccde27cad 100644 --- a/native/src/init/rootdir.cpp +++ b/native/src/init/rootdir.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "init.hpp" @@ -244,6 +245,8 @@ void MagiskInit::patch_ro_root() { xrename("overlay.d", ROOTOVL); +#if MAGISK_DEBUG + extern bool avd_hack; // Handle avd hack if (avd_hack) { int src = xopen("/init", O_RDONLY | O_CLOEXEC); @@ -256,6 +259,7 @@ void MagiskInit::patch_ro_root() { close(src); close(dest); } +#endif load_overlay_rc(ROOTOVL); if (access(ROOTOVL "/sbin", F_OK) == 0) {