mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-08-26 11:17:40 +00:00
Support enable/disable Zygisk
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
using namespace std;
|
||||
|
||||
static bool safe_mode = false;
|
||||
bool zygisk_enabled = false;
|
||||
|
||||
/*********
|
||||
* Setup *
|
||||
@@ -301,7 +302,12 @@ void post_fs_data(int client) {
|
||||
disable_deny();
|
||||
} else {
|
||||
exec_common_scripts("post-fs-data");
|
||||
check_enforce_denylist();
|
||||
db_settings dbs;
|
||||
get_db_settings(dbs, ZYGISK_CONFIG);
|
||||
if (dbs[ZYGISK_CONFIG]) {
|
||||
zygisk_enabled = true;
|
||||
check_enforce_denylist();
|
||||
}
|
||||
handle_modules();
|
||||
}
|
||||
|
||||
@@ -350,8 +356,6 @@ void boot_complete(int client) {
|
||||
if (access(SECURE_DIR, F_OK) != 0)
|
||||
xmkdir(SECURE_DIR, 0700);
|
||||
|
||||
check_enforce_denylist();
|
||||
|
||||
if (!check_manager()) {
|
||||
if (access(MANAGERAPK, F_OK) == 0) {
|
||||
// Only try to install APK when no manager is installed
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
extern bool RECOVERY_MODE;
|
||||
extern int DAEMON_STATE;
|
||||
extern bool zygisk_enabled;
|
||||
|
||||
void unlock_blocks();
|
||||
void reboot();
|
||||
|
@@ -113,6 +113,7 @@ db_settings::db_settings() {
|
||||
data[SU_MULTIUSER_MODE] = MULTIUSER_MODE_OWNER_ONLY;
|
||||
data[SU_MNT_NS] = NAMESPACE_MODE_REQUESTER;
|
||||
data[DENYLIST_CONFIG] = false;
|
||||
data[ZYGISK_CONFIG] = false;
|
||||
}
|
||||
|
||||
int db_settings::get_idx(string_view key) const {
|
||||
|
@@ -616,10 +616,12 @@ void magic_mount() {
|
||||
root->mount();
|
||||
|
||||
// Mount on top of modules to enable zygisk
|
||||
string zygisk_bin = MAGISKTMP + "/" ZYGISKBIN;
|
||||
mkdir(zygisk_bin.data(), 0);
|
||||
mount_zygisk(32)
|
||||
mount_zygisk(64)
|
||||
if (zygisk_enabled) {
|
||||
string zygisk_bin = MAGISKTMP + "/" ZYGISKBIN;
|
||||
mkdir(zygisk_bin.data(), 0);
|
||||
mount_zygisk(32)
|
||||
mount_zygisk(64)
|
||||
}
|
||||
}
|
||||
|
||||
static void prepare_modules() {
|
||||
|
@@ -38,7 +38,8 @@ constexpr const char *DB_SETTING_KEYS[] = {
|
||||
"root_access",
|
||||
"multiuser_mode",
|
||||
"mnt_ns",
|
||||
"denylist"
|
||||
"denylist",
|
||||
"zygisk"
|
||||
};
|
||||
|
||||
// Settings key indices
|
||||
@@ -46,7 +47,8 @@ enum {
|
||||
ROOT_ACCESS = 0,
|
||||
SU_MULTIUSER_MODE,
|
||||
SU_MNT_NS,
|
||||
DENYLIST_CONFIG
|
||||
DENYLIST_CONFIG,
|
||||
ZYGISK_CONFIG
|
||||
};
|
||||
|
||||
// Values for root_access
|
||||
|
Reference in New Issue
Block a user