From e3fd2902a2b9d192069c0b74143fbe1cd7d5360b Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Tue, 26 Aug 2025 15:48:34 +0200 Subject: [PATCH] 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. --- tools/actions/session_manager.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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() -- 2.47.3