Enable avd hack for debug build

This commit is contained in:
vvb2060
2023-04-25 04:37:28 +08:00
committed by John Wu
parent 83d837d868
commit 68c2817d40
6 changed files with 13 additions and 32 deletions

View File

@@ -4,6 +4,7 @@
#include <libgen.h>
#include <base.hpp>
#include <flags.h>
#include <selinux.hpp>
#include <magisk.hpp>
@@ -219,17 +220,18 @@ mount_root:
bool is_two_stage = access("/apex", F_OK) == 0;
LOGD("is_two_stage: [%d]\n", is_two_stage);
#if ENABLE_AVD_HACK
if (!is_two_stage) {
if (config->emulator) {
avd_hack = true;
// These values are hardcoded for API 28 AVD
xmkdir("/dev/block", 0755);
strcpy(blk_info.block_dev, "/dev/block/vde1");
strcpy(blk_info.partname, "vendor");
setup_block();
xmount(blk_info.block_dev, "/vendor", "ext4", MS_RDONLY, nullptr);
}
#if MAGISK_DEBUG
// For API 28 AVD, it uses legacy SAR setup that requires
// special hacks in magiskinit to work properly. We do not
// necessarily want this enabled in production builds.
if (!is_two_stage && config->emulator) {
avd_hack = true;
// These values are hardcoded for API 28 AVD
xmkdir("/dev/block", 0755);
strcpy(blk_info.block_dev, "/dev/block/vde1");
strcpy(blk_info.partname, "vendor");
setup_block();
xmount(blk_info.block_dev, "/vendor", "ext4", MS_RDONLY, nullptr);
}
#endif