From 384349e14351e6b0e57df223956d4375403e6f9b Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Mon, 25 Sep 2017 17:08:36 +0900 Subject: [PATCH] Add app_manager_set_app_icon API - Add app_manager_set_app_icon API to allow change app icon dynamically. - Please note that icon file to be changed should be included in pkg and icon will not change dynamically. Change-Id: I9975e2907442240e162da7c5bdf265f96996635a Signed-off-by: Junghyun Yeon --- include/app_manager.h | 22 ++++++++++++++++++++++ src/app_manager.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/include/app_manager.h b/include/app_manager.h index a9214ad..b15514b 100644 --- a/include/app_manager.h +++ b/include/app_manager.h @@ -490,6 +490,28 @@ int app_manager_unset_event_cb(app_manager_event_h handle); */ int app_manager_event_destroy(app_manager_event_h handle); +/** + * @platform + * @brief Sets the application's icon path into given path. + * @since_tizen 5.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/packagemanager.admin + * @remarks The icon file should be included in package which the applications belongs to. + * @param[in] app_id The ID of the application + * @param[in] icon_path The path of icon file + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #APP_MANAGER_ERROR_NONE Successful + * @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory + * @retval #APP_MANAGER_ERROR_IO_ERROR Internal error + * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * + * @see app_manager_event_create() + */ +int app_manager_set_app_icon(const char *app_id, const char *icon_path); /** * @} diff --git a/src/app_manager.c b/src/app_manager.c index 88a3895..f6cdb7c 100644 --- a/src/app_manager.c +++ b/src/app_manager.c @@ -430,6 +430,45 @@ API int app_manager_set_splash_screen_display(const char *app_id, bool display) return r; } +API int app_manager_set_app_icon(const char *app_id, const char *icon_path) +{ + int r; + pkgmgr_client *pc; + + if (app_id == NULL) + return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, + __FUNCTION__, NULL); + + pc = pkgmgr_client_new(PC_REQUEST); + if (pc == NULL) + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, + __FUNCTION__, NULL); + + r = pkgmgr_client_set_app_icon(pc, (char *)app_id, (char *)icon_path); + pkgmgr_client_free(pc); + + switch (r) { + case PKGMGR_R_OK: + r = APP_MANAGER_ERROR_NONE; + break; + case PKGMGR_R_EINVAL: + r = app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, + __FUNCTION__, NULL); + break; + case PKGMGR_R_EPRIV: + r = app_manager_error(APP_MANAGER_ERROR_PERMISSION_DENIED, + __FUNCTION__, NULL); + break; + default: + r = app_manager_error(APP_MANAGER_ERROR_IO_ERROR, + __FUNCTION__, NULL); + break; + } + + return r; +} + + API int app_manager_event_create(app_manager_event_h *handle) { pkgmgr_client *pc = NULL; -- 2.7.4