From 04f14d40ba4559ce18e9b59efa95c902d94c940c Mon Sep 17 00:00:00 2001 From: Denys Dmytriyenko Date: Tue, 11 Apr 2023 01:33:09 +0000 Subject: Handle "failed" signal When application exits abnormally, it emits "failed" signal, instead of "inactive" one. Handle it accordingly, so the internal state doesn't get out of sync and prevents starting the app again. Bug-AGL: SPEC-4199 Signed-off-by: Denys Dmytriyenko Change-Id: I307a6c6973f98d8f57af477bc03ebfb1218559db (cherry picked from commit 5cab14e6a98519e0b6c6043a1a19e42f094d6522) --- src/systemd_manager.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/systemd_manager.c b/src/systemd_manager.c index e6d67f8..7eba643 100644 --- a/src/systemd_manager.c +++ b/src/systemd_manager.c @@ -363,6 +363,15 @@ static void unit_properties_changed_cb(GDBusProxy *proxy, g_signal_emit(data->mgr, signals[STARTED], 0, app_info_get_app_id(app_info)); } } + else if(!g_strcmp0(new_state, "failed")) + { + g_debug("Application %s has failed", app_info_get_app_id(app_info)); + app_info_set_status(app_info, APP_STATUS_INACTIVE); + app_info_set_runtime_data(app_info, NULL); + + g_signal_emit(data->mgr, signals[TERMINATED], 0, app_info_get_app_id(app_info)); + systemd_manager_free_runtime_data(data); + } g_free(new_state); } -- cgit 1.2.3-korg