diff --git a/native/src/core/daemon.cpp b/native/src/core/daemon.cpp index e05ae964c7c3..3404e5deb37a 100644 --- a/native/src/core/daemon.cpp +++ b/native/src/core/daemon.cpp @@ -179,11 +179,24 @@ static void handle_request_sync(int client, int code) { case MainRequest::START_DAEMON: rust::get_magiskd().setup_logfile(); break; - case MainRequest::STOP_DAEMON: + case MainRequest::STOP_DAEMON: { + // Unmount all overlays denylist_handler(-1, nullptr); + + // Restore native bridge property + auto nb = get_prop(NBPROP); + auto len = sizeof(ZYGISKLDR) - 1; + if (nb == ZYGISKLDR) { + set_prop(NBPROP, "0"); + } else if (nb.size() > len) { + set_prop(NBPROP, nb.data() + len); + } + write_int(client, 0); + // Terminate the daemon! exit(0); + } default: __builtin_unreachable(); }