From: Hwankyu Jhun Date: Tue, 14 Jul 2020 03:38:19 +0000 (+0900) Subject: Fix functions related to attach/detach window X-Git-Tag: submit/tizen/20200714.042458~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F238439%2F2;p=platform%2Fcore%2Fapi%2Fapp-manager.git Fix functions related to attach/detach window - Separates errors - Adds descriptions about errors Change-Id: I019b236699c579450d8673a8fa0eb347840dbb57 Signed-off-by: Hwankyu Jhun --- diff --git a/include/app_manager_extension.h b/include/app_manager_extension.h index 4f244ac..5b24761 100644 --- a/include/app_manager_extension.h +++ b/include/app_manager_extension.h @@ -148,7 +148,11 @@ int app_manager_get_focused_app_context(app_context_h *app_context); * otherwise a negative error value * @retval #APP_MANAGER_ERROR_NONE Successful * @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #APP_MANAGER_ERROR_IO_ERROR Internal I/O error + * @retval #APP_MANAGER_ERROR_IO_ERROR I/O error + * @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #APP_MANAGER_ERROR_NO_SUCH_APP No such application + * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * */ int app_manager_attach_window(const char *parent_app_id, const char *child_app_id); @@ -161,7 +165,10 @@ int app_manager_attach_window(const char *parent_app_id, const char *child_app_i * otherwise a negative error value * @retval #APP_MANAGER_ERROR_NONE Successful * @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #APP_MANAGER_ERROR_IO_ERROR Internal I/O error + * @retval #APP_MANAGER_ERROR_IO_ERROR I/O error + * @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #APP_MANAGER_ERROR_NO_SUCH_APP No such application + * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied */ int app_manager_detach_window(const char *app_id); diff --git a/src/app_manager.c b/src/app_manager.c index f6cdb7c..cd0cd25 100644 --- a/src/app_manager.c +++ b/src/app_manager.c @@ -64,6 +64,22 @@ static const char *app_manager_error_to_string(app_manager_error_e error) } } +static int __aul_error_convert(int error) +{ + switch (error) { + case AUL_R_EINVAL: + return APP_MANAGER_ERROR_INVALID_PARAMETER; + case AUL_R_EILLACC: + return APP_MANAGER_ERROR_PERMISSION_DENIED; + case AUL_R_ENOENT: + return APP_MANAGER_ERROR_NO_SUCH_APP; + case AUL_R_ENOMEM: + return APP_MANAGER_ERROR_OUT_OF_MEMORY; + default: + return APP_MANAGER_ERROR_IO_ERROR; + } +} + int app_manager_error(app_manager_error_e error, const char *function, const char *description) { if (description) @@ -651,8 +667,8 @@ API int app_manager_attach_window(const char *parent_app_id, const char *child_a return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); ret = aul_window_attach(parent_app_id, child_app_id); - if (ret != 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + if (ret != AUL_R_OK) + return app_manager_error(__aul_error_convert(ret), __FUNCTION__, NULL); return APP_MANAGER_ERROR_NONE; } @@ -665,8 +681,8 @@ API int app_manager_detach_window(const char *app_id) return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); ret = aul_window_detach(app_id); - if (ret != 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + if (ret != AUL_R_OK) + return app_manager_error(__aul_error_convert(ret), __FUNCTION__, NULL); return APP_MANAGER_ERROR_NONE; }