From fd0c73382df150ffb3d289589fb13833ed0c7319 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 18 Feb 2020 10:12:01 +0900 Subject: [PATCH] Fix app_control_prepare_app_defined_loader() function - Fixes description - Sets loader id to the bundle object Requires: - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/225161/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/amd/+/225160/ - https://review.tizen.org/gerrit/#/c/platform/core/api/app-control/+/225157/ Change-Id: I09b9cc036b90d6cccf34e29e246e0792b46f9075 Signed-off-by: Hwankyu Jhun --- include/app_control_internal.h | 2 ++ src/app_control.c | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/app_control_internal.h b/include/app_control_internal.h index 993b3ba..b4bd905 100644 --- a/include/app_control_internal.h +++ b/include/app_control_internal.h @@ -291,6 +291,8 @@ int app_control_send_resume_request(app_control_h app_control, app_control_resul * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory * @retval #APP_CONTROL_ERROR_IO_ERROR I/O error + * + * @remarks This function is only available for platform level signed applications. */ int app_control_prepare_app_defined_loader(app_control_h app_control, const char *loader_id); diff --git a/src/app_control.c b/src/app_control.c index a9ed623..cf5fa55 100644 --- a/src/app_control.c +++ b/src/app_control.c @@ -71,7 +71,6 @@ struct app_control_s { app_control_type_e type; bundle *data; int launch_pid; - int loader_id; }; typedef struct app_control_request_context_s { @@ -2461,9 +2460,10 @@ static int __convert_aul_error(int result) int app_control_prepare_app_defined_loader(app_control_h app_control, const char *loader_id) { + const char *loader_name = loader_id; /* for readability */ int ret; - if (!app_control || !loader_id) { + if (!app_control || !loader_name) { return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Inivalid parameter"); } @@ -2473,14 +2473,26 @@ int app_control_prepare_app_defined_loader(app_control_h app_control, __FUNCTION__, "Invalid parameter"); } - ret = aul_prepare_app_defined_loader(loader_id); + ret = aul_prepare_app_defined_loader(loader_name); if (ret < 0) { return app_control_error(__convert_aul_error(ret), __FUNCTION__, "Failed to prepare app defined loader"); } - app_control->loader_id = ret; + bundle_del(app_control->data, AUL_K_APP_DEFINED_LOADER); + bundle_add(app_control->data, AUL_K_APP_DEFINED_LOADER, loader_name); + + ret = aul_svc_set_loader_id(app_control->data, ret); + if (ret < 0) { + if (ret == AUL_SVC_RET_EINVAL) + ret = APP_CONTROL_ERROR_INVALID_PARAMETER; + else + ret = APP_CONTROL_ERROR_OUT_OF_MEMORY; + + return app_control_error(ret, __FUNCTION__, + "Failed to set loader id"); + } return APP_CONTROL_ERROR_NONE; } -- 2.34.1