Add a new internal API for service app termination 16/282316/2
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 30 Sep 2022 01:10:31 +0000 (01:10 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 30 Sep 2022 04:31:33 +0000 (04:31 +0000)
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 <h.jhun@samsung.com>
include/app_manager_extension.h
src/app_manager.c

index 82a40fc..d7d96f7 100644 (file)
@@ -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);
+
+/**
  * @}
  */
 
index 1ef0262..13d8cd2 100644 (file)
@@ -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;
+}