*/
int app_control_set_caller_instance_id(app_control_h app_control, const char *instance_id);
+/**
+ * @brief Sends the resumption request asynchronously.
+ *
+ * @since_tizen 5.5
+ * @param[in] app_control The app_control handle
+ * @param[in] callback The callback function to be called when the result is delivered
+ * @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 #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_CONTROL_ERROR_APP_NOT_FOUND The application to run the given resume request is not found
+ * @retval #APP_CONTROL_ERROR_LAUNCH_REJECTED The application cannot be resumed in current context
+ * @retval #APP_CONTROL_ERROR_LAUNCH_FAILED Failed to resume the application
+ * @see app_control_result_cb()
+ */
+int app_control_send_resume_request(app_control_h app_control, app_control_result_cb callback, void *user_data);
+
/**
* @}
*/
return APP_CONTROL_ERROR_NONE;
}
+
+static int __resume_request_verify_appid(struct launch_request_s *req)
+{
+ app_control_h app_control = req->app_control;
+ const char *appid;
+
+ appid = aul_svc_get_appid(app_control->data);
+ if (!appid) {
+ return app_control_error(APP_CONTROL_ERROR_APP_NOT_FOUND,
+ __FUNCTION__,
+ "Application ID must be specified");
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+static int __resume_request_send(struct launch_request_s *req)
+{
+ app_control_h app_control = req->app_control;
+ aul_svc_err_cb result_cb = app_control_request_result_broker;
+ int ret;
+
+ __add_pending_item(req->id);
+
+ ret = aul_svc_send_resume_request_for_uid(app_control->data,
+ req->id, result_cb, req->request_context, getuid());
+
+ if (ret < 0) {
+ __remove_pending_item(req->id);
+ return app_control_error(__launch_request_convert_error(ret),
+ __FUNCTION__, NULL);
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
+static int __send_resume_request(app_control_h app_control,
+ app_control_result_cb result_cb,
+ void *user_data)
+{
+ static launch_request_handler handlers[] = {
+ __resume_request_verify_appid,
+ __launch_request_prepare_request_context,
+ __resume_request_send,
+ __launch_request_complete,
+ };
+ struct launch_request_s req = {
+ .implicit_default_operation = false,
+ .request_context = NULL,
+ .app_control = app_control,
+ .result_cb = result_cb,
+ .reply_cb = NULL,
+ .user_data = user_data,
+ .reply = NULL,
+ .result = APP_CONTROL_RESULT_FAILED,
+ };
+ int ret;
+ int i;
+
+ if (app_control_validate(app_control)) {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ }
+
+ req.id = __generate_request_id();
+ for (i =0; i < ARRAY_SIZE(handlers); i++) {
+ if (handlers[i]) {
+ ret = handlers[i](&req);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ break;
+ }
+ }
+
+ if (ret != APP_CONTROL_ERROR_NONE && req.request_context) {
+ if (req.request_context->app_control)
+ app_control_destroy(req.request_context->app_control);
+
+ free(req.request_context);
+ }
+
+ return ret;
+}
+
+int app_control_send_resume_request(app_control_h app_control,
+ app_control_result_cb result_cb,
+ void *user_data)
+{
+ if (!app_control || !result_cb) {
+ return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, "Invalid parameter");
+ }
+
+ return __send_resume_request(app_control, result_cb, user_data);
+}