From: Hwankyu Jhun Date: Wed, 8 Nov 2023 03:45:56 +0000 (+0900) Subject: Terminate sub app X-Git-Tag: accepted/tizen/6.5/unified/20231109.090247~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dedd29cd376a6d29e7a89b67c7685cac182a4c85;p=platform%2Fcore%2Fappfw%2Famd.git Terminate sub app If the leader process is terminated while executing an application, amd should terminate the sub application. And, when the application type is not a component-based application, the process must be terminated even though the process does not handle the termination request properly. Change-Id: If06788d09dc22a6c16437a418ed23d7357da0826 Signed-off-by: Hwankyu Jhun --- diff --git a/src/lib/amd_launch.c b/src/lib/amd_launch.c index e2b27df9..7b415870 100644 --- a/src/lib/amd_launch.c +++ b/src/lib/amd_launch.c @@ -494,11 +494,28 @@ static int __send_app_request(pid_t pid, uid_t uid, int cmd, int clifd, .cmd = cmd, .data = data }; + app_status_h app_status; info = __create_reply_info(pid, uid, cmd, clifd, data); if (!info) return -ENOMEM; + if (cmd == APP_TERM_BY_PID_ASYNC || + cmd == APP_TERM_BY_PID || + cmd == APP_TERM_INSTANCE_ASYNC || + cmd == APP_TERM_REQ_BY_PID || + cmd == APP_TERM_BY_PID_SYNC) { + app_status = _app_status_find(pid); + if (cmd != APP_TERM_INSTANCE_ASYNC || + _app_status_get_app_type(app_status) != + AT_COMPONENT_BASED_APP) { + _app_status_update_status(app_status, + STATUS_DYING, + false, true); + } + } + + ret = amd_app_request_broker_send(&request, __app_request_result_handler, info); if (ret < 0) { @@ -508,7 +525,7 @@ static int __send_app_request(pid_t pid, uid_t uid, int cmd, int clifd, _anr_monitor_add_timer(pid, cmd); - return 0; + return ret; } int _resume_app(int pid, request_h req) diff --git a/src/modules/ui-core/src/app_group.c b/src/modules/ui-core/src/app_group.c index e493596c..c3e14da5 100644 --- a/src/modules/ui-core/src/app_group.c +++ b/src/modules/ui-core/src/app_group.c @@ -865,6 +865,12 @@ static struct app_group_context_s *__app_group_add( found = g_list_find_custom(__app_group_list, leader_id, __compare_group_id); if (!found) { + if (leader_pid != pid) { + _E("%d is not leader(%d)", pid, leader_pid); + __destroy_app_group_context(ctx); + return NULL; + } + group = __create_app_group(leader_id, leader_pid); if (!group) { _E("Failed to create app group. %s:%d", @@ -935,6 +941,8 @@ static void __app_group_start(pid_t leader_pid, const char *leader_id, bool attach_below = false; app_group_node_h caller_node; app_group_node_h next_node; + amd_app_status_h app_status; + uid_t uid; _D("app_group_start"); @@ -970,6 +978,13 @@ static void __app_group_start(pid_t leader_pid, const char *leader_id, ctx = __app_group_add(leader_pid, leader_id, pid, id, caller_pid, caller_id, launch_mode, false, recycle, before_wid, attach_below); + if (!ctx) { + app_status = amd_app_status_find_by_pid(pid); + if (app_status) { + uid = amd_app_status_get_uid(app_status); + amd_launch_term_sub_inst(pid, id, uid); + } + } } else { ctx = __app_group_add(pid, id, pid, id, caller_pid, caller_id, launch_mode,