From: Alessandro Astone Date: Tue, 26 Aug 2025 13:48:34 +0000 (+0200) Subject: session_manager: Stop the container on logout X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/commitdiff_plain/e3fd2902a2b9d192069c0b74143fbe1cd7d5360b?ds=sidebyside session_manager: Stop the container on logout On logout, the session dbus process is killed. The default behaviour for libdbus is to exit(1) on bus disconnect, which would leave the container running in the background with Android bootlooping while trying to establish a Wayland connection again. Intercept the disconnect signal and gracefully stop the container instead. --- diff --git a/tools/actions/session_manager.py b/tools/actions/session_manager.py index 51d9d4c..e128c9d 100644 --- a/tools/actions/session_manager.py +++ b/tools/actions/session_manager.py @@ -24,7 +24,16 @@ class DbusSessionManager(dbus.service.Object): do_stop(self.args, self.looper) stop_container(quit_session=False) +def handle_disconnect(args, looper): + do_stop(args, looper) + stop_container(quit_session=False) + def service(args, looper): + bus = dbus.SessionBus() + bus.set_exit_on_disconnect(False) + bus.add_signal_receiver(lambda: handle_disconnect(args, looper), + signal_name='Disconnected', + dbus_interface='org.freedesktop.DBus.Local') dbus_obj = DbusSessionManager(looper, dbus.SessionBus(), '/SessionManager', args) looper.run()