1
0
mirror of https://github.com/topjohnwu/Magisk.git synced 2025-04-02 10:52:15 +00:00

Move avd_hack boolean out of init class

This commit is contained in:
topjohnwu 2023-04-25 23:34:45 -07:00
parent 3733c9a091
commit 0cf0d2b821
3 changed files with 8 additions and 4 deletions

@ -59,10 +59,6 @@ private:
bool hijack_sepolicy(); bool hijack_sepolicy();
void setup_tmp(const char *path); void setup_tmp(const char *path);
protected: 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_rw_root();
void patch_ro_root(); void patch_ro_root();
public: public:

@ -23,6 +23,10 @@ struct devinfo {
static vector<devinfo> dev_list; static vector<devinfo> 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) { static void parse_device(devinfo *dev, const char *uevent) {
dev->partname[0] = '\0'; dev->partname[0] = '\0';
dev->devpath[0] = '\0'; dev->devpath[0] = '\0';

@ -5,6 +5,7 @@
#include <magisk.hpp> #include <magisk.hpp>
#include <base.hpp> #include <base.hpp>
#include <selinux.hpp> #include <selinux.hpp>
#include <flags.h>
#include "init.hpp" #include "init.hpp"
@ -244,6 +245,8 @@ void MagiskInit::patch_ro_root() {
xrename("overlay.d", ROOTOVL); xrename("overlay.d", ROOTOVL);
#if MAGISK_DEBUG
extern bool avd_hack;
// Handle avd hack // Handle avd hack
if (avd_hack) { if (avd_hack) {
int src = xopen("/init", O_RDONLY | O_CLOEXEC); int src = xopen("/init", O_RDONLY | O_CLOEXEC);
@ -256,6 +259,7 @@ void MagiskInit::patch_ro_root() {
close(src); close(src);
close(dest); close(dest);
} }
#endif
load_overlay_rc(ROOTOVL); load_overlay_rc(ROOTOVL);
if (access(ROOTOVL "/sbin", F_OK) == 0) { if (access(ROOTOVL "/sbin", F_OK) == 0) {