From: Hwankyu Jhun Date: Thu, 23 May 2019 10:21:02 +0000 (+0900) Subject: Support instance termination X-Git-Tag: submit/tizen/20190603.010409~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F206708%2F1;p=platform%2Fcore%2Fapi%2Fapp-control.git Support instance termination From Tizen 5.5, the component-based application is supported. To terminate each running instance, app_control_send_terminate_request() is modified. It calls aul_svc_subapp_terminate_request() instead of aul_svc_subapp_terminate_request_pid(). Change-Id: I9ecdb8263990320bb51b28ebe54c07517f01045c Signed-off-by: Hwankyu Jhun --- diff --git a/src/app_control.c b/src/app_control.c index a3f2c2e..b899a4f 100644 --- a/src/app_control.c +++ b/src/app_control.c @@ -942,7 +942,6 @@ static void __handle_launch_result(int launched_pid, void *data) app_control_reply_cb reply_cb; void *user_data; char callee[255] = {0, }; - char instance_id[256] = {0,}; int ret; if (data == NULL) @@ -958,17 +957,11 @@ static void __handle_launch_result(int launched_pid, void *data) ret = aul_app_get_appid_bypid(launched_pid, callee, sizeof(callee)); if (ret < 0) LOGE("aul_app_get_appid_bypid failed: %d", launched_pid); + else + app_control_set_app_id(reply, callee); - app_control_set_app_id(reply, callee); LOGI("app control async result callback callee pid:%d", launched_pid); - ret = aul_app_get_instance_id_bypid(launched_pid, instance_id, - sizeof(instance_id)); - if (ret == AUL_R_OK) { - app_control_set_instance_id(reply, instance_id); - LOGI("instance id(%s)", instance_id); - } - result = APP_CONTROL_RESULT_APP_STARTED; request = request_context->app_control; user_data = request_context->user_data; @@ -1164,11 +1157,34 @@ static int __launch_request_send(struct launch_request_s *req) return APP_CONTROL_ERROR_NONE; } +static void __copy_callee_info(app_control_h dst, app_control_h src) +{ + const char *id; + + if (!dst || !src) + return; + + id = bundle_get_val(src->data, AUL_K_APPID); + if (id) { + bundle_del(dst->data, AUL_K_APPID); + bundle_add(dst->data, AUL_K_APPID, id); + } + + id = bundle_get_val(src->data, AUL_K_INSTANCE_ID); + if (id) { + bundle_del(dst->data, AUL_K_INSTANCE_ID); + bundle_add(dst->data, AUL_K_INSTANCE_ID, id); + } +} + static int __launch_request_complete(struct launch_request_s *req) { app_control_h app_control = req->app_control; app_control_request_context_h request_context = req->request_context; + if (request_context) + __copy_callee_info(request_context->app_control, app_control); + if (req->result_cb) return APP_CONTROL_ERROR_NONE; @@ -1246,7 +1262,8 @@ int app_control_send_terminate_request(app_control_h app_control) if (app_control->type != APP_CONTROL_TYPE_REQUEST || app_control->launch_pid < 0) return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); - aul_svc_subapp_terminate_request_pid(app_control->launch_pid); + aul_svc_subapp_terminate_request(app_control->data, + app_control->launch_pid); return APP_CONTROL_ERROR_NONE; }