From bf187249b3b74a265dc75899f6f518542cb48ced Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 24 Jul 2019 12:06:58 +0900 Subject: [PATCH] Fix the wrong implementation To use component_manager_is_running(), the packagemanager.info privilege is needed. And, if the component context in the function cannot be created with COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT, the running flag should be "false". Change-Id: Ide782a88809daefcb739b51aaa63b982735a49cd Signed-off-by: Hwankyu Jhun --- include/component_manager.h | 3 +++ src/component_manager.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/component_manager.h b/include/component_manager.h index 2412420..d42a8a9 100644 --- a/include/component_manager.h +++ b/include/component_manager.h @@ -171,6 +171,8 @@ int component_manager_get_component_info(const char *comp_id, component_info_h * /** * @brief Checks whether the component is running or not. * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info * * @param[in] comp_id The component ID * @param[out] running @c true if the component is running, \n @@ -178,6 +180,7 @@ int component_manager_get_component_info(const char *comp_id, component_info_h * * @return @c 0 on success, * otherwise a negative error value * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory diff --git a/src/component_manager.c b/src/component_manager.c index 871d4ed..8a6a82c 100644 --- a/src/component_manager.c +++ b/src/component_manager.c @@ -105,8 +105,14 @@ EXPORT_API int component_manager_is_running(const char *comp_id, bool *running) } ret = component_context_create(comp_id, &handle); - if (ret != COMPONENT_MANAGER_ERROR_NONE) + if (ret != COMPONENT_MANAGER_ERROR_NONE) { + if (ret == COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT) { + *running = false; + return COMPONENT_MANAGER_ERROR_NONE; + } + return ret; + } ret = component_context_is_running(handle, running); component_context_destroy(handle); -- 2.7.4