mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Only create app_id_map if necessary
This commit is contained in:
parent
73d36fdff0
commit
e68dd866a3
@ -24,6 +24,8 @@ static pthread_mutex_t data_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
atomic<bool> denylist_enabled = false;
|
||||
|
||||
static void rebuild_map() {
|
||||
if (!zygisk_enabled)
|
||||
return;
|
||||
app_id_proc_map->clear();
|
||||
string data_path(APP_DATA_DIR);
|
||||
size_t len = data_path.length();
|
||||
@ -146,6 +148,8 @@ static bool validate(const char *pkg, const char *proc) {
|
||||
static void add_hide_set(const char *pkg, const char *proc) {
|
||||
LOGI("denylist add: [%s/%s]\n", pkg, proc);
|
||||
deny_set->emplace(pkg, proc);
|
||||
if (!zygisk_enabled)
|
||||
return;
|
||||
if (strcmp(pkg, ISOLATED_MAGIC) == 0) {
|
||||
// Kill all matching isolated processes
|
||||
kill_process<&str_starts>(proc, true);
|
||||
@ -237,7 +241,7 @@ static bool init_list() {
|
||||
db_err_cmd(err, return false);
|
||||
|
||||
// If Android Q+, also kill blastula pool and all app zygotes
|
||||
if (SDK_INT >= 29) {
|
||||
if (SDK_INT >= 29 && zygisk_enabled) {
|
||||
kill_process("usap32", true);
|
||||
kill_process("usap64", true);
|
||||
kill_process<&str_ends_safe>("_zygote", true);
|
||||
@ -309,6 +313,7 @@ int enable_deny() {
|
||||
|
||||
denylist_enabled = true;
|
||||
|
||||
if (zygisk_enabled) {
|
||||
default_new(app_id_proc_map);
|
||||
rebuild_map();
|
||||
|
||||
@ -320,6 +325,7 @@ int enable_deny() {
|
||||
register_poll(&inotify_pfd, inotify_handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update_deny_config();
|
||||
return DAEMON_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user