Avoid zygiskd restarts when boot-complete

This commit is contained in:
LoveSy 2023-12-17 00:07:52 +08:00 committed by topjohnwu
parent 90dcc1cd30
commit 401090d6fe

View File

@ -229,9 +229,11 @@ void zygisk_handler(int client, const sock_cred *cred) {
void reset_zygisk(bool restore) { void reset_zygisk(bool restore) {
if (!zygisk_enabled) return; if (!zygisk_enabled) return;
static atomic_uint zygote_start_count{1}; static atomic_uint zygote_start_count{1};
if (!restore) {
close(zygiskd_sockets[0]); close(zygiskd_sockets[0]);
close(zygiskd_sockets[1]); close(zygiskd_sockets[1]);
zygiskd_sockets[0] = zygiskd_sockets[1] = -1; zygiskd_sockets[0] = zygiskd_sockets[1] = -1;
}
if (restore) { if (restore) {
zygote_start_count = 1; zygote_start_count = 1;
} else if (zygote_start_count.fetch_add(1) > 3) { } else if (zygote_start_count.fetch_add(1) > 3) {