From 9c0c40f6a92e11c4ce20f50c6b20fa6f67e93807 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 30 Sep 2022 01:10:31 +0000 Subject: [PATCH] Add a new internal API for service app termination This patch adds a new internal API for inhouse developer. The function sends the termination request to the service application without restarting. Adds: - app_manager_terminate_app_without_restarting() Change-Id: Ibdf14d98df31cce3f500d09eb290bdfa10e9d45f Signed-off-by: Hwankyu Jhun --- include/app_manager_extension.h | 16 ++++++++++++++++ src/app_manager.c | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/include/app_manager_extension.h b/include/app_manager_extension.h index 82a40fc..d7d96f7 100644 --- a/include/app_manager_extension.h +++ b/include/app_manager_extension.h @@ -248,6 +248,22 @@ int app_manager_remove_app_group(int win_id); int app_manager_attach_window_below(const char *parent_appid, const char *child_appid); /** + * @brief Terminates the application without restarting. + * @since_tizen 7.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/appmanager.kill + * @param[in] app_context The application context + * @return @c 0 on success, + * otherwise a negative error value + * @retval #APP_MANAGER_ERROR_NONE Successful + * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied + * @retval #APP_MANAGER_IO_ERROR I/O error + * @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #APP_MANAGER_ERROR_REQUEST_FAILED Internal terminate error + */ +int app_manager_terminate_app_without_restarting(app_context_h app_context); + +/** * @} */ diff --git a/src/app_manager.c b/src/app_manager.c index 1ef0262..13d8cd2 100644 --- a/src/app_manager.c +++ b/src/app_manager.c @@ -727,3 +727,24 @@ API int app_manager_attach_window_below(const char *parent_appid, const char *ch return APP_MANAGER_ERROR_NONE; } + +API int app_manager_terminate_app_without_restarting(app_context_h app_context) +{ + int ret; + pid_t pid = -1; + + if (app_context == NULL) { + return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, + __FUNCTION__, "Invalid parameter"); + } + + app_context_get_pid(app_context, &pid); + + ret = aul_terminate_pid_without_restart(pid); + if (ret != AUL_R_OK) { + return app_manager_error(__aul_error_convert(ret), __FUNCTION__, + "Failed to send termination request"); + } + + return APP_MANAGER_ERROR_NONE; +} -- 2.7.4