From 6831a81593810d3a8c53297350f97f920f217920 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 25 Apr 2016 10:09:58 +0900 Subject: [PATCH] Add a new API to enable/disable the splash screen Change-Id: I1376ae97053bb0e76f69487b6044a7b084bc1825 Signed-off-by: Hwankyu Jhun --- include/app_manager_extension.h | 20 ++++++++++++++++++ src/app_manager.c | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/include/app_manager_extension.h b/include/app_manager_extension.h index 9f98b81..b68c933 100644 --- a/include/app_manager_extension.h +++ b/include/app_manager_extension.h @@ -17,6 +17,8 @@ #ifndef __TIZEN_APPFW_APP_MANAGER_EXTENSION_H #define __TIZEN_APPFW_APP_MANAGER_EXTENSION_H +#include + #include "app_manager.h" #ifdef __cplusplus @@ -48,6 +50,24 @@ extern "C" { int app_manager_terminate_app(app_context_h app_context); /** + * @brief Sets the display flag to enable/disable the splash screen. + * @since_tizen 3.0 + * @privilege platform + * @privilege %http://tizen.org/privilege/packagemanager.admin + * @param[in] app_id The ID of the application + * @param[in] display The display flag to enable/disable the splash screen + * + * @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_PERMISSION_DENIED Permission denied + * @retval #APP_MANAGER_ERROR_IO_ERROR Internal I/O error + */ +int app_manager_set_splash_screen_display(const char *app_id, bool display); + +/** * @} */ diff --git a/src/app_manager.c b/src/app_manager.c index 8b000a1..e578baa 100644 --- a/src/app_manager.c +++ b/src/app_manager.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "app_manager.h" #include "app_manager_internal.h" @@ -430,3 +431,48 @@ API int app_manager_get_external_shared_data_path(const char *app_id, char **pat return r; } +API int app_manager_set_splash_screen_display(const char *app_id, bool display) +{ + 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); + + if (display) + r = pkgmgr_client_enable_splash_screen(pc, app_id); + else + r = pkgmgr_client_disable_splash_screen(pc, app_id); + 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; + case PKGMGR_R_ENOMEM: + r = app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, + __FUNCTION__, NULL); + break; + default: + r = app_manager_error(APP_MANAGER_ERROR_IO_ERROR, + __FUNCTION__, NULL); + break; + } + + return r; +} + -- 2.7.4