From 6ffe20911bbec50e972151a3af3cced7dd81718f Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 19 Jun 2019 13:46:23 +0900 Subject: [PATCH] Add descriptions Change-Id: Id48a908cb38ff38a4500f69d506919e5751832e5 Signed-off-by: Hwankyu Jhun --- doc/appfw_component_manager_doc.h | 6 +- include/component_context.h | 128 ++++++++++++++++++++-- include/component_info.h | 179 ++++++++++++++++++++++++++++-- include/component_manager.h | 182 ++++++++++++++++++++++++++++--- include/component_manager_extension.h | 26 ++--- src/component_context.c | 24 ++-- src/component_context_internal.h | 70 ++++++------ src/component_info.c | 50 +++++---- src/component_info_internal.h | 13 ++- unit_tests/mock/mock.cc | 14 +-- unit_tests/mock/mock_aul_comp_context.h | 4 +- unit_tests/mock/mock_aul_comp_info.h | 10 +- unit_tests/src/test_component_context.cc | 24 ++-- unit_tests/src/test_component_info.cc | 30 ++--- unit_tests/src/test_component_manager.cc | 14 +-- 15 files changed, 605 insertions(+), 169 deletions(-) diff --git a/doc/appfw_component_manager_doc.h b/doc/appfw_component_manager_doc.h index cc15b4a..e05fb0a 100755 --- a/doc/appfw_component_manager_doc.h +++ b/doc/appfw_component_manager_doc.h @@ -27,12 +27,12 @@ * * @section CAPI_COMPONENT_MANAGER_MODULE_OVERVIEW Overview * The @ref CAPI_COMPONENT_MANAGER_MODULE API provides information about components. There are several different sorts of queries. - * Two iterator functions step through a list of components. One is used in running components(#component_manager_foreach_component_context()), and - * the other is used in available ("installed") but not necessarily running components(#component_manager_foreach_component_info()). + * Two iterator functions step through a list of components. One is used in running components(component_manager_foreach_component_context()), and + * the other is used in available ("installed") but not necessarily running components(component_manager_foreach_component_info()). * Each will call a callback function, passing the package name of each component found. * A query function will respond whether the component represented by a particular application name is running. * Other query functions return static information about a component, such as a name, a type, an icon path. - * The API provides functions to manage components also. By using them, it is possible to resume(#component_manager_resume_component) components. + * The API provides functions to manage components also. By using them, it is possible to resume(component_manager_resume_component()) components. */ /** diff --git a/include/component_context.h b/include/component_context.h index 1d166f5..d9a4339 100644 --- a/include/component_context.h +++ b/include/component_context.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __TIZEN_APPFW_COMPONENT_CONTEXT_H -#define __TIZEN_APPFW_COMPONENT_CONTEXT_H +#ifndef __TIZEN_APPFW_COMPONENT_CONTEXT_H__ +#define __TIZEN_APPFW_COMPONENT_CONTEXT_H__ #include #include @@ -34,30 +34,138 @@ extern "C" { * @{ */ + +/** + * @brief Component context handle. + * @since_tizen 5.5 + */ typedef void *component_context_h; +/** + * @brief Enumeration for the component state. + * @since_tizen 5.5 + */ typedef enum { - COMPONENT_STATE_UNDEFINED, - COMPONENT_STATE_FOREGROUND, - COMPONENT_STATE_BACKGROUND, - COMPONENT_STATE_SERVICE, - COMPONENT_STATE_TERMINATED, + COMPONENT_STATE_UNDEFINED, /**< The undefined state. */ + COMPONENT_STATE_FOREGROUND, /**< The frame component is running in the foreground. */ + COMPONENT_STATE_BACKGROUND, /**< The frame component is running in the background. */ + COMPONENT_STATE_SERVICE, /**< The service component is running. */ + COMPONENT_STATE_TERMINATED, /**< The component is terminated. */ } component_state_e; +/** + * @brief Destroys the component context handle and releases all its resources. + * @since_tizen 5.5 + * + * @param[in] handle The component context handle + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + */ int component_context_destroy(component_context_h handle); +/** + * @brief Gets the application ID of the component. + * @since_tizen 5.5 + * @remarks You MUST release @c app_id using free(). + * + * @param[in] handle The component context handle + * @param[out] app_id The application ID + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ int component_context_get_app_id(component_context_h handle, char **app_id); -int component_context_get_comp_id(component_context_h handle, char **comp_id); +/** + * @brief Gets the ID of the component. + * @since_tizen 5.5 + * @remarks You MUST release @c comp_id using free(). + * + * @param[in] handle The component context handle + * @param[out] component_id The component ID + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ +int component_context_get_component_id(component_context_h handle, char **component_id); +/** + * @brief Gets the instance ID of the component. + * @since_tizen 5.5 + * @remarks You MUST release @c instance_id using free(). + * + * @param[in] handle The component context handle + * @param[out] instance_id The instance ID + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ int component_context_get_instance_id(component_context_h handle, char **instance_id); +/** + * @brief Gets the state of the component. + * @since_tizen 5.5 + * + * @param[in] handle The component context handle + * @param[out] state The component state + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + */ int component_context_get_component_state(component_context_h handle, component_state_e *state); +/** + * @brief Checks whether the component is terminated or not. + * @since_tizen 5.5 + * + * @param[in] handle The component context handle + * @param[out] terminated @c true if the component is terminated, \n + * otherwise @c false if the component is running + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + */ int component_context_is_terminated(component_context_h handle, bool *terminated); -int component_context_is_sub_comp(component_context_h handle, bool *is_sub_comp); +/** + * @brief Checks whether the component is running as sub component of the group. + * @since_tizen 5.5 + * + * @param[in] handle The component context handle + * @param[out] is_subcomponent @c true if the sub component of the group, \n + * otherwise @c false if the main component of the group + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + */ +int component_context_is_subcomponent(component_context_h handle, bool *is_subcomponent); +/** + * @brief Clones the component context handle. + * @since_tizen 5.5 + * @remarks The @a clone should be released using component_context_destroy(). + * + * @param[out] clone A newly created component context handle, if cloning is successful + * @param[in] handle The component context handle + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ int component_context_clone(component_context_h *clone, component_context_h handle); /** @@ -68,4 +176,4 @@ int component_context_clone(component_context_h *clone, component_context_h hand } #endif -#endif /* __TIZEN_APPFW_COMPONENT_CONTEXT_H */ +#endif /* __TIZEN_APPFW_COMPONENT_CONTEXT_H__ */ diff --git a/include/component_info.h b/include/component_info.h index ae10449..f40c675 100644 --- a/include/component_info.h +++ b/include/component_info.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __TIZEN_APPFW_COMPONENT_INFO_H -#define __TIZEN_APPFW_COMPONENT_INFO_H +#ifndef __TIZEN_APPFW_COMPONENT_INFO_H__ +#define __TIZEN_APPFW_COMPONENT_INFO_H__ #include @@ -32,33 +32,194 @@ extern "C" { * @{ */ +/** + * @brief Component information handle. + * @since_tizen 5.5 + */ typedef void *component_info_h; +/** + * @brief Enumeration for component type. + * @since_tizen 5.5 + * @see component_info_get_component_type() + */ typedef enum { - COMPONENT_INFO_COMPONENT_TYPE_FRAME, - COMPONENT_INFO_COMPONENT_TYPE_SERVICE, + COMPONENT_INFO_COMPONENT_TYPE_FRAME, /**< Frame component */ + COMPONENT_INFO_COMPONENT_TYPE_SERVICE, /**< Service component */ } component_info_component_type_e; -int component_info_create(const char *comp_id, component_info_h *handle); +/** + * @brief Creates the component information handle. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info + * @remarks The @a handle should be released using component_info_destroy(). + * + * @param[in] component_id The component ID + * @param[out] handle The component information handle + * @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_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ +int component_info_create(const char *component_id, component_info_h *handle); +/** + * @brief Destroys the component information handle. + * @since_tizen 5.5 + * + * @param[in] handle The component information handle + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + */ int component_info_destroy(component_info_h handle); +/** + * @brief Gets the application ID of the component. + * @since_tizen 5.5 + * @remarks You must release @a app_id using free(). + * + * @param[in] handle The component information handle + * @param[out] app_id The application ID + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @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 + */ int component_info_get_app_id(component_info_h handle, char **app_id); -int component_info_get_comp_id(component_info_h handle, char **comp_id); +/** + * @brief Gets the component ID. + * @since_tizen 5.5 + * @remarks You must release @a component_id using free(). + * + * @param[in] handle The component information handle + * @param[out] component_id The component ID + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @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 + */ +int component_info_get_component_id(component_info_h handle, char **component_id); +/** + * @brief Gets the type of component. + * @since_tizen 5.5 + * + * @param[in] handle The component information handle + * @param[out] type The component type + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @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 + * @see #component_info_component_type_e + */ int component_info_get_component_type(component_info_h handle, component_info_component_type_e *type); +/** + * @brief Checks whether the icon of the component should be displayed or not. + * @since_tizen 5.5 + * + * @param[in] handle The component information handle + * @param[out] icon_display @c true if the icon should be displayed, \n + * otherwise @c false + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + */ int component_info_is_icon_display(component_info_h handle, bool *icon_display); -int component_info_is_taskmanage(component_info_h handle, bool *taskmanage); +/** + * @brief Checks whether the component should be managed by task-manager or not. + * @since_tizen 5.5 + * + * @param[in] handle The component information handle + * @param[out] managed @c if the component should be managed by task-manager, \n + * otherwise @c false + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + */ +int component_info_is_managed_by_task_manager(component_info_h handle, bool *managed); +/** + * @brief Gets the icon path of the component. + * @since_tizen 5.5 + * @remarks You must release @a path using free(). + * + * @param[in] handle The component information handle + * @param[out] path The icon path of the component + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @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 + */ int component_info_get_icon(component_info_h handle, char **path); +/** + * @brief Gets the label of the component. + * @since_tizen 5.5 + * @remarks You must release @a label using free(). + * + * @param[in] handle The component information handle + * @param[out] label The label of the component + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @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 + */ int component_info_get_label(component_info_h handle, char **label); -int component_info_get_localed_label(component_info_h handle, const char *locale, char **label); +/** + * @brief Gets the localized label of the component. + * @since_tizen 5.5 + * @remarks You must release @a label using free(). + * + * @param[in] handle The component information handle + * @param[in] locale The locale information + * @param[out] label The localized label of the component + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_LABEL_NOT_FOUND The localized label does not exist + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ +int component_info_get_localized_label(component_info_h handle, const char *locale, char **label); +/** + * @brief Clones the component information handle. + * @since_tizen 5.5 + * @remarks You must release @a clone using component_info_destroy(). + * + * @param[out] clone A newly created component information handle, if successfully cloned + * @param[in] handle The component information + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ int component_info_clone(component_info_h *clone, component_info_h handle); /** @@ -69,4 +230,4 @@ int component_info_clone(component_info_h *clone, component_info_h handle); } #endif -#endif /* __TIZEN_APPFW_COMPONENT_INFO_H */ +#endif /* __TIZEN_APPFW_COMPONENT_INFO_H__ */ diff --git a/include/component_manager.h b/include/component_manager.h index 687f7f8..2412420 100644 --- a/include/component_manager.h +++ b/include/component_manager.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __TIZEN_APPFW_COMPONENT_MANAGER_H -#define __TIZEN_APPFW_COMPONENT_MANAGER_H +#ifndef __TIZEN_APPFW_COMPONENT_MANAGER_H__ +#define __TIZEN_APPFW_COMPONENT_MANAGER_H__ #include @@ -35,35 +35,191 @@ extern "C" { * @{ */ +#ifndef TIZEN_ERROR_COMPONENT_MANAGER +#define TIZEN_ERROR_COMPONENT_MANAGER -0x03040000 +#endif + +/** + * @brief Enumerations for Component Manager Error. + * @since_tizen 5.5 + */ typedef enum { - COMPONENT_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE, - COMPONENT_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, - COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, - COMPONENT_MANAGER_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, - COMPONENT_MANAGER_ERROR_NO_SUCH_COMP = TIZEN_ERROR_APPLICATION_MANAGER | 0x01, - COMPONENT_MANAGER_ERROR_DB_FAILED = TIZEN_ERROR_APPLICATION_MANAGER | 0x03, - COMPONENT_MANAGER_ERROR_INVALID_APPLICATION = TIZEN_ERROR_APPLICATION_MANAGER | 0x04, - COMPONENT_MANAGER_ERROR_NOT_RUNNING = TIZEN_ERROR_APPLICATION_MANAGER | 0x05, - COMPONENT_MANAGER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, - COMPONENT_MANAGER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED + COMPONENT_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + COMPONENT_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + COMPONENT_MANAGER_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */ + COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT = TIZEN_ERROR_COMPONENT_MANAGER | 0x01, /**< No such component */ + COMPONENT_MANAGER_ERROR_DB_FAILED = TIZEN_ERROR_COMPONENT_MANAGER | 0x03, /**< Database error */ + COMPONENT_MANAGER_ERROR_INVALID_APPLICATION = TIZEN_ERROR_COMPONENT_MANAGER | 0x04, /**< Invalid application ID */ + COMPONENT_MANAGER_ERROR_NOT_RUNNING = TIZEN_ERROR_COMPONENT_MANAGER | 0x05, /**< Component is not running */ + COMPONENT_MANAGER_ERROR_LABEL_NOT_FOUND = TIZEN_ERROR_COMPONENT_MANAGER | 0x06, /**< Label not found */ + COMPONENT_MANAGER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ } component_manager_error_e; +/** + * @brief Called to get the component context once for each running component. + * @since_tizen 5.5 + * @remarks The @a handle should not be released. + * The @a handle can be used only in the callback. To use outside, make a copy using component_context_clone(). + * + * @param[in] handle The component context of each running component + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n + * otherwise @c false to break out of the loop + * @pre component_manager_foreach_component_context() will invoke this callback. + * @see component_manager_foreach_component_context() + */ typedef bool (*component_manager_component_context_cb)(component_context_h handle, void *user_data); +/** + * @brief Called to get the component information once for each installed component. + * @since_tizen 5.5 + * @remarks The @a handle should not be released. + * The @a handle can be used only in the callback. To use outside, make a copy using component_info_clone(). + * + * @param[in] handle The component information of each installed component + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n + * otherwise @c false to break out of the loop + * @pre component_manager_foreach_component_info() will invoke this callback. + * @see component_manager_foreach_component_info() + */ typedef bool (*component_manager_component_info_cb)(component_info_h handle, void *user_data); +/** + * @brief Retrieves all component contexts of running components. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info + * + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * + * @see component_manager_component_context_cb() + */ int component_manager_foreach_component_context(component_manager_component_context_cb callback, void *user_data); +/** + * @brief Retrieves all installed components information. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info + * + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * + * @see component_manager_component_info_cb() + */ int component_manager_foreach_component_info(component_manager_component_info_cb callback, void *user_data); +/** + * @brief Gets the component context for the given component ID. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info + * @remarks This function returns #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT if the component with the given component ID is not running. \n + * You MUST release @c handle using component_context_destroy(). + * + * @param[in] comp_id The component ID + * @param[out] handle The component context of the given component ID + * @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_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + */ int component_manager_get_component_context(const char *comp_id, component_context_h *handle); +/** + * @brief Gets the component information for the given component ID. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info + * @remarks You MUST release @c handle using component_info_destroy(). + * + * @param[in] comp_id The component ID + * @param[out] handle The component information of the given component ID + * @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_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + */ int component_manager_get_component_info(const char *comp_id, component_info_h *handle); +/** + * @brief Checks whether the component is running or not. + * @since_tizen 5.5 + * + * @param[in] comp_id The component ID + * @param[out] running @c true if the component is running, \n + * otherwise @c false if not running + * @return @c 0 on success, + * otherwise a negative error value + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @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 + */ int component_manager_is_running(const char *comp_id, bool *running); +/** + * @brief Resumes the component. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/appmanager.launch + * + * @param[in] handle The component context handle + * @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 + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + */ int component_manager_resume_component(component_context_h handle); +/** + * @brief Terminates the background component. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/appmanager.kill.bgapp + * @remarks This function returns after it just sends a request for terminating a background component. + * Platform will decide if the target component could be terminated or not according to the state of the target component. + * + * @param[in] handle The component context handle + * @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 + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + */ int component_manager_terminate_bg_component(component_context_h handle); /** @@ -74,4 +230,4 @@ int component_manager_terminate_bg_component(component_context_h handle); } #endif -#endif /* __TIZEN_APPFW_COMPONENT_MANAGER_H */ +#endif /* __TIZEN_APPFW_COMPONENT_MANAGER_H__ */ diff --git a/include/component_manager_extension.h b/include/component_manager_extension.h index e4f28bf..0da09d2 100644 --- a/include/component_manager_extension.h +++ b/include/component_manager_extension.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __TIZEN_APPFW_COMPONENT_MANAGER_EXTENSION_H -#define __TIZEN_APPFW_COMPONENT_MANAGER_EXTENSION_H +#ifndef __TIZEN_APPFW_COMPONENT_MANAGER_EXTENSION_H__ +#define __TIZEN_APPFW_COMPONENT_MANAGER_EXTENSION_H__ #include @@ -43,11 +43,11 @@ extern "C" { * @param[in] handle The component context handle * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component - * #retval COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied */ int component_manager_pause_component(component_context_h handle); @@ -60,11 +60,11 @@ int component_manager_pause_component(component_context_h handle); * @param[in] handle The component context handle * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component - * #retval COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied */ int component_manager_terminate_component(component_context_h handle); @@ -76,4 +76,4 @@ int component_manager_terminate_component(component_context_h handle); } #endif -#endif /* __TIZEN_APPFW_COMPONENT_MANAGER_EXTENSION_H */ +#endif /* __TIZEN_APPFW_COMPONENT_MANAGER_EXTENSION_H__ */ diff --git a/src/component_context.c b/src/component_context.c index dd1632b..52765cb 100644 --- a/src/component_context.c +++ b/src/component_context.c @@ -36,7 +36,7 @@ static int __convert_aul_error(int ret) return COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY; case AUL_R_ENOENT: case AUL_R_ENOAPP: - return COMPONENT_MANAGER_ERROR_NO_SUCH_COMP; + return COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT; case AUL_R_EILLACC: return COMPONENT_MANAGER_ERROR_PERMISSION_DENIED; case AUL_R_EINVAL: @@ -175,8 +175,8 @@ int component_context_foreach(component_manager_component_context_cb callback, return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } - ret = aul_comp_context_foreach((aul_comp_context_cb)callback, - user_data); + ret = aul_comp_context_foreach_comp_context( + (aul_comp_context_cb)callback, user_data); if (ret != AUL_R_OK) { LOGE("Failed to retrieve component context. error(%d)", ret); return __convert_aul_error(ret); @@ -226,14 +226,14 @@ EXPORT_API int component_context_get_app_id(component_context_h handle, return COMPONENT_MANAGER_ERROR_NONE; } -EXPORT_API int component_context_get_comp_id(component_context_h handle, - char **comp_id) +EXPORT_API int component_context_get_component_id(component_context_h handle, + char **component_id) { aul_comp_context_h context = HANDLE_TO_AUL_HANDLE(handle); const char *value = NULL; int ret; - if (!handle || !comp_id) { + if (!handle || !component_id) { LOGE("Invalid parameter"); return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } @@ -244,8 +244,8 @@ EXPORT_API int component_context_get_comp_id(component_context_h handle, return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } - *comp_id = strdup(value); - if (*comp_id == NULL) { + *component_id = strdup(value); + if (*component_id == NULL) { LOGE("Failed to duplicate component ID"); return COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY; } @@ -349,14 +349,14 @@ EXPORT_API int component_context_is_terminated(component_context_h handle, return COMPONENT_MANAGER_ERROR_NONE; } -EXPORT_API int component_context_is_sub_comp(component_context_h handle, - bool *is_sub_comp) +EXPORT_API int component_context_is_subcomponent(component_context_h handle, + bool *is_subcomponent) { aul_comp_context_h context = HANDLE_TO_AUL_HANDLE(handle); bool value = false; int ret; - if (!handle || !is_sub_comp) { + if (!handle || !is_subcomponent) { LOGE("Invalid parameter"); return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } @@ -367,7 +367,7 @@ EXPORT_API int component_context_is_sub_comp(component_context_h handle, return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } - *is_sub_comp = value; + *is_subcomponent = value; return COMPONENT_MANAGER_ERROR_NONE; } diff --git a/src/component_context_internal.h b/src/component_context_internal.h index 40bd4d6..9fd9c18 100644 --- a/src/component_context_internal.h +++ b/src/component_context_internal.h @@ -36,16 +36,19 @@ extern "C" { * @brief Creates the component context handle. * @since_tizen 5.5 * @remarks You MUST release @c handle using component_context_destroy(). + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info * * @param[in] comp_id The component ID * @param[out] handle The component context handle * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component + * @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_OUT_OF_MEMORY Out of memory + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component */ int component_context_create(const char *comp_id, component_context_h *handle); @@ -58,9 +61,9 @@ int component_context_create(const char *comp_id, component_context_h *handle); * otherwise @c false if not running * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error */ int component_context_is_running(component_context_h handle, bool *running); @@ -73,11 +76,11 @@ int component_context_is_running(component_context_h handle, bool *running); * @param[in] handle The component context handle * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component - * #retval COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied */ int component_context_resume(component_context_h handle); @@ -90,11 +93,11 @@ int component_context_resume(component_context_h handle); * @param[in] handle The component context handle * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component - * #retval COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied */ int component_context_pause(component_context_h handle); @@ -107,11 +110,11 @@ int component_context_pause(component_context_h handle); * @param[in] handle The component context handle * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component - * #retval COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied */ int component_context_terminate_bg_component(component_context_h handle); @@ -124,26 +127,29 @@ int component_context_terminate_bg_component(component_context_h handle); * @param[in] handle The component context handle * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component - * #retval COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #COMPONENT_MANAGER_ERROR_NONE Successful + * @retval #COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @retval #COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_PERMISSION_DENIED Permission denied */ int component_context_terminate(component_context_h handle); /** * @brief Retrieves all running components context. * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info * * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed from the callback function * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component + * @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_NO_SUCH_COMPONENT No such component */ int component_context_foreach(component_manager_component_context_cb callback, void *user_data); diff --git a/src/component_info.c b/src/component_info.c index c1a8168..2bdc879 100644 --- a/src/component_info.c +++ b/src/component_info.c @@ -41,11 +41,14 @@ int component_info_foreach(component_manager_component_info_cb callback, return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } - ret = aul_comp_info_foreach((aul_comp_info_cb)callback, user_data); + ret = aul_comp_info_foreach_comp_info((aul_comp_info_cb)callback, + user_data); if (ret != AUL_R_OK) { LOGE("Failed to retrieve component info. error(%d)", ret); + if (ret == AUL_R_EILLACC) + return COMPONENT_MANAGER_ERROR_PERMISSION_DENIED; if (ret == AUL_R_ENOENT) - return COMPONENT_MANAGER_ERROR_NO_SUCH_COMP; + return COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT; if (ret == AUL_R_ENOMEM) return COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY; @@ -69,8 +72,10 @@ EXPORT_API int component_info_create(const char *comp_id, ret = aul_comp_info_create(comp_id, &h); if (ret != AUL_R_OK) { LOGE("Failed to get component info. error(%d)", ret); + if (ret == AUL_R_EILLACC) + return COMPONENT_MANAGER_ERROR_PERMISSION_DENIED; if (ret == AUL_R_ENOENT) - return COMPONENT_MANAGER_ERROR_NO_SUCH_COMP; + return COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT; return COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY; } @@ -121,14 +126,14 @@ EXPORT_API int component_info_get_app_id(component_info_h handle, return COMPONENT_MANAGER_ERROR_NONE; } -EXPORT_API int component_info_get_comp_id(component_info_h handle, - char **comp_id) +EXPORT_API int component_info_get_component_id(component_info_h handle, + char **component_id) { aul_comp_info_h h = HANDLE_TO_AUL_HANDLE(handle); const char *value = NULL; int ret; - if (!handle || !comp_id) { + if (!handle || !component_id) { LOGE("Invalid parameter"); return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } @@ -139,8 +144,8 @@ EXPORT_API int component_info_get_comp_id(component_info_h handle, return COMPONENT_MANAGER_ERROR_IO_ERROR; } - *comp_id = strdup(value); - if (*comp_id == NULL) { + *component_id = strdup(value); + if (*component_id == NULL) { LOGE("Failed to duplicate component ID"); return COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY; } @@ -199,14 +204,14 @@ EXPORT_API int component_info_is_icon_display(component_info_h handle, return COMPONENT_MANAGER_ERROR_NONE; } -EXPORT_API int component_info_is_taskmanage(component_info_h handle, - bool *taskmanage) +EXPORT_API int component_info_is_managed_by_task_manager( + component_info_h handle, bool *managed) { aul_comp_info_h h = HANDLE_TO_AUL_HANDLE(handle); bool value = false; int ret; - if (!handle || !taskmanage) { + if (!handle || !managed) { LOGE("Invalid parameter"); return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } @@ -217,7 +222,7 @@ EXPORT_API int component_info_is_taskmanage(component_info_h handle, return COMPONENT_MANAGER_ERROR_IO_ERROR; } - *taskmanage = value; + *managed = value; return COMPONENT_MANAGER_ERROR_NONE; } @@ -274,12 +279,11 @@ EXPORT_API int component_info_get_label(component_info_h handle, char **label) return COMPONENT_MANAGER_ERROR_NONE; } -EXPORT_API int component_info_get_localed_label(component_info_h handle, +EXPORT_API int component_info_get_localized_label(component_info_h handle, const char *locale, char **label) { aul_comp_info_h h = HANDLE_TO_AUL_HANDLE(handle); - const char *comp_id = NULL; - char *value = NULL; + const char *value = NULL; int ret; if (!handle || !locale || !label) { @@ -287,22 +291,20 @@ EXPORT_API int component_info_get_localed_label(component_info_h handle, return COMPONENT_MANAGER_ERROR_INVALID_PARAMETER; } - ret = aul_comp_info_get_comp_id(h, &comp_id); - if (ret != AUL_R_OK) { - LOGE("Failed to get component ID"); - return COMPONENT_MANAGER_ERROR_IO_ERROR; - } - - ret = aul_comp_info_get_localed_label(comp_id, locale, &value); + ret = aul_comp_info_get_localed_label(h, locale, &value); if (ret != AUL_R_OK) { LOGE("Failed to get localed label"); if (ret == AUL_R_ENOENT) - return COMPONENT_MANAGER_ERROR_NO_SUCH_COMP; + return COMPONENT_MANAGER_ERROR_LABEL_NOT_FOUND; return COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY; } - *label = value; + *label = strdup(value); + if (*label == NULL) { + LOGE("Failed to duplicate localized label"); + return COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY; + } return COMPONENT_MANAGER_ERROR_NONE; } diff --git a/src/component_info_internal.h b/src/component_info_internal.h index f7bfd3a..5f1876a 100644 --- a/src/component_info_internal.h +++ b/src/component_info_internal.h @@ -35,16 +35,19 @@ extern "C" { /** * @brief Retrieves all running component context. * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/packagemanager.info * * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed from the callback function * @return @c 0 on success, * otherwise a negative error value - * #retval COMPONENT_MANAGER_ERROR_NONE Successful - * #retval COMPONENT_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter - * #retval COMPONENT_MANAGER_ERROR_NO_SUCH_COMP No such component - * #retval COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory - * #retval COMPONENT_MANAGER_ERROR_IO_ERROR I/O error + * @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_NO_SUCH_COMPONENT No such component + * @retval #COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #COMPONENT_MANAGER_ERROR_IO_ERROR I/O error */ int component_info_foreach(component_manager_component_info_cb callback, void *user_data); diff --git a/unit_tests/mock/mock.cc b/unit_tests/mock/mock.cc index 473c3b9..e1f7b0e 100644 --- a/unit_tests/mock/mock.cc +++ b/unit_tests/mock/mock.cc @@ -28,20 +28,20 @@ DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_get_icon, aul_comp_info_h, const char DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_get_label, aul_comp_info_h, const char **); -DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_get_localed_label,const char *, const char *, char **); +DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_get_localed_label, aul_comp_info_h, const char *, char **); DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_clone, aul_comp_info_h, aul_comp_info_h *); -DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_from_app, const char *, aul_comp_info_cb, void *); +DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_comp_info_from_app, const char *, aul_comp_info_cb, void *); -DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_usr_from_app, const char *, uid_t, aul_comp_info_cb, void *); +DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_usr_foreach_comp_info_from_app, const char *, uid_t, aul_comp_info_cb, void *); -DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach, aul_comp_info_cb, void *); +DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_comp_info, aul_comp_info_cb, void *); -DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_usr, uid_t, aul_comp_info_cb, void *); +DEFINE_FAKE_VALUE_FUNC(int, aul_comp_info_usr_foreach_comp_info, uid_t, aul_comp_info_cb, void *); // aul_comp_context.h -DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_foreach, aul_comp_context_cb, void *); +DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_foreach_comp_context, aul_comp_context_cb, void *); DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_get_app_id, aul_comp_context_h, const char **); @@ -59,7 +59,7 @@ DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_is_sub_comp, aul_comp_context_h, bo DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_create, const char *, aul_comp_context_h *); -DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_create_usr, const char *, uid_t, aul_comp_context_h *); +DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_usr_create, const char *, uid_t, aul_comp_context_h *); DEFINE_FAKE_VALUE_FUNC(int, aul_comp_context_destroy, aul_comp_context_h); diff --git a/unit_tests/mock/mock_aul_comp_context.h b/unit_tests/mock/mock_aul_comp_context.h index 3d67b6e..629384d 100644 --- a/unit_tests/mock/mock_aul_comp_context.h +++ b/unit_tests/mock/mock_aul_comp_context.h @@ -31,7 +31,7 @@ typedef void *aul_comp_context_h; typedef bool (*aul_comp_context_cb)(aul_comp_context_h handle, void *user_data); -DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_foreach, aul_comp_context_cb, void *); +DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_foreach_comp_context, aul_comp_context_cb, void *); DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_get_app_id, aul_comp_context_h, const char **); @@ -49,7 +49,7 @@ DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_is_sub_comp, aul_comp_context_h, b DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_create, const char *, aul_comp_context_h *); -DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_create_usr, const char *, uid_t, aul_comp_context_h *); +DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_usr_create, const char *, uid_t, aul_comp_context_h *); DECLARE_FAKE_VALUE_FUNC(int, aul_comp_context_destroy, aul_comp_context_h); diff --git a/unit_tests/mock/mock_aul_comp_info.h b/unit_tests/mock/mock_aul_comp_info.h index 60840fb..58939cc 100644 --- a/unit_tests/mock/mock_aul_comp_info.h +++ b/unit_tests/mock/mock_aul_comp_info.h @@ -48,17 +48,17 @@ DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_get_icon, aul_comp_info_h, const char DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_get_label, aul_comp_info_h, const char **); -DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_get_localed_label, const char *, const char *, char **); +DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_get_localed_label, aul_comp_info_h, const char *, char **); DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_clone, aul_comp_info_h, aul_comp_info_h *); -DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_from_app, const char *, aul_comp_info_cb, void *); +DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_comp_info_from_app, const char *, aul_comp_info_cb, void *); -DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_usr_from_app, const char *, uid_t, aul_comp_info_cb, void *); +DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_usr_foreach_comp_info_from_app, const char *, uid_t, aul_comp_info_cb, void *); -DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach, aul_comp_info_cb, void *); +DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_comp_info, aul_comp_info_cb, void *); -DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_foreach_usr, uid_t, aul_comp_info_cb, void *); +DECLARE_FAKE_VALUE_FUNC(int, aul_comp_info_usr_foreach_comp_info, uid_t, aul_comp_info_cb, void *); #ifdef __cplusplus } diff --git a/unit_tests/src/test_component_context.cc b/unit_tests/src/test_component_context.cc index 5c7695d..650c25d 100644 --- a/unit_tests/src/test_component_context.cc +++ b/unit_tests/src/test_component_context.cc @@ -206,18 +206,18 @@ TEST_F(ComponentContextTest, component_context_get_app_id_Negative) { EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } -TEST_F(ComponentContextTest, component_context_get_comp_id_Positive) { +TEST_F(ComponentContextTest, component_context_get_component_id_Positive) { component_context_h handle = GetHandle(); - char* comp_id = nullptr; + char* component_id = nullptr; - int ret = component_context_get_comp_id(handle, &comp_id); - auto p = std::unique_ptr(comp_id, std::free); + int ret = component_context_get_component_id(handle, &component_id); + auto p = std::unique_ptr(component_id, std::free); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_NONE); EXPECT_EQ(std::string(p.get()), "TestComponent"); } -TEST_F(ComponentContextTest, component_context_get_comp_id_Negative) { - int ret = component_context_get_comp_id(nullptr, nullptr); +TEST_F(ComponentContextTest, component_context_get_component_id_Negative) { + int ret = component_context_get_component_id(nullptr, nullptr); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } @@ -264,17 +264,17 @@ TEST_F(ComponentContextTest, component_context_is_terminated_Negative) { EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } -TEST_F(ComponentContextTest, component_context_is_sub_comp_Positive) { +TEST_F(ComponentContextTest, component_context_is_subcomponent_Positive) { component_context_h handle = GetHandle(); - bool is_sub_comp; + bool is_subcomponent; - int ret = component_context_is_sub_comp(handle, &is_sub_comp); + int ret = component_context_is_subcomponent(handle, &is_subcomponent); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_NONE); - EXPECT_EQ(is_sub_comp, false); + EXPECT_EQ(is_subcomponent, false); } -TEST_F(ComponentContextTest, component_context_is_sub_comp_Negative) { - int ret = component_context_is_sub_comp(nullptr, nullptr); +TEST_F(ComponentContextTest, component_context_is_subcomponent_Negative) { + int ret = component_context_is_subcomponent(nullptr, nullptr); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } diff --git a/unit_tests/src/test_component_info.cc b/unit_tests/src/test_component_info.cc index 4b71895..fec4a5f 100644 --- a/unit_tests/src/test_component_info.cc +++ b/unit_tests/src/test_component_info.cc @@ -90,7 +90,7 @@ static int __fake_aul_comp_info_get_label(aul_comp_info_h handle, return AUL_R_OK; } -static int __fake_aul_comp_info_get_localed_label(const char* compid, +static int __fake_aul_comp_info_get_localed_label(aul_comp_info_h handle, const char* locale, char** label) { *label = strdup("Kor_TestComponent"); return AUL_R_OK; @@ -197,18 +197,18 @@ TEST_F(ComponentInfoTest, component_info_get_app_id_Negative) { EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } -TEST_F(ComponentInfoTest, component_info_get_comp_id_Positive) { +TEST_F(ComponentInfoTest, component_info_get_component_id_Positive) { component_info_h handle = GetHandle(); char* value = nullptr; - int ret = component_info_get_comp_id(handle, &value); + int ret = component_info_get_component_id(handle, &value); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_NONE); auto p = std::unique_ptr(value, std::free); EXPECT_EQ(std::string(p.get()), "TestComponent"); } -TEST_F(ComponentInfoTest, component_info_get_comp_id_Negative) { - int ret = component_info_get_comp_id(nullptr, nullptr); +TEST_F(ComponentInfoTest, component_info_get_component_id_Negative) { + int ret = component_info_get_component_id(nullptr, nullptr); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } @@ -240,17 +240,17 @@ TEST_F(ComponentInfoTest, component_info_is_icon_display_Negative) { EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } -TEST_F(ComponentInfoTest, component_info_is_taskmanage_Positive) { +TEST_F(ComponentInfoTest, component_info_is_managed_by_task_manager_Positive) { component_info_h handle = GetHandle(); - bool taskmanage = false; - int ret = component_info_is_taskmanage(handle, &taskmanage); + bool managed = false; + int ret = component_info_is_managed_by_task_manager(handle, &managed); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_NONE); - EXPECT_EQ(taskmanage, true); + EXPECT_EQ(managed, true); } -TEST_F(ComponentInfoTest, component_info_is_taskmanage_Negative) { - int ret = component_info_is_taskmanage(nullptr, nullptr); +TEST_F(ComponentInfoTest, component_info_is_managed_by_task_manager_Negative) { + int ret = component_info_is_managed_by_task_manager(nullptr, nullptr); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } @@ -284,18 +284,18 @@ TEST_F(ComponentInfoTest, component_info_get_label_Nagative) { EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } -TEST_F(ComponentInfoTest, component_info_get_localed_label_Positive) { +TEST_F(ComponentInfoTest, component_info_get_localized_label_Positive) { component_info_h handle = GetHandle(); char* value = nullptr; - int ret = component_info_get_localed_label(handle, "ko-kr", &value); + int ret = component_info_get_localized_label(handle, "ko-kr", &value); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_NONE); auto p = std::unique_ptr(value, std::free); EXPECT_EQ(std::string(p.get()), "Kor_TestComponent"); } -TEST_F(ComponentInfoTest, component_info_get_localed_label_Negative) { - int ret = component_info_get_localed_label(nullptr, nullptr, nullptr); +TEST_F(ComponentInfoTest, component_info_get_localized_label_Negative) { + int ret = component_info_get_localized_label(nullptr, nullptr, nullptr); EXPECT_EQ(ret, COMPONENT_MANAGER_ERROR_INVALID_PARAMETER); } diff --git a/unit_tests/src/test_component_manager.cc b/unit_tests/src/test_component_manager.cc index 9d5b123..fe9da27 100644 --- a/unit_tests/src/test_component_manager.cc +++ b/unit_tests/src/test_component_manager.cc @@ -25,7 +25,7 @@ #include "mock_aul_comp_context.h" #include "component_manager.h" -static int __fake_aul_comp_info_foreach(aul_comp_info_cb callback, +static int __fake_aul_comp_info_foreach_comp_info(aul_comp_info_cb callback, void* user_data) { aul_comp_info_h handle = nullptr; callback(handle, user_data); @@ -50,8 +50,8 @@ static int __fake_aul_comp_info_destroy(aul_comp_info_h handle) { return AUL_R_OK; } -static int __fake_aul_comp_context_foreach(aul_comp_context_cb callback, - void* user_data) { +static int __fake_aul_comp_context_foreach_comp_context( + aul_comp_context_cb callback, void* user_data) { aul_comp_context_h handle = nullptr; callback(handle, user_data); return AUL_R_OK; @@ -93,14 +93,14 @@ static int __fake_aul_comp_context_terminate_bg_comp( class ComponentManagerTest : public testing::Test { public: virtual void SetUp() { - aul_comp_info_foreach_fake.custom_fake = - __fake_aul_comp_info_foreach; + aul_comp_info_foreach_comp_info_fake.custom_fake = + __fake_aul_comp_info_foreach_comp_info; aul_comp_info_create_fake.custom_fake = __fake_aul_comp_info_create; aul_comp_info_destroy_fake.custom_fake = __fake_aul_comp_info_destroy; - aul_comp_context_foreach_fake.custom_fake = - __fake_aul_comp_context_foreach; + aul_comp_context_foreach_comp_context_fake.custom_fake = + __fake_aul_comp_context_foreach_comp_context; aul_comp_context_create_fake.custom_fake = __fake_aul_comp_context_create; aul_comp_context_destroy_fake.custom_fake = -- 2.7.4