From: Hwankyu Jhun Date: Fri, 8 Feb 2019 01:00:58 +0000 (+0900) Subject: Support handling of each app-control ID X-Git-Tag: accepted/tizen/unified/20190221.015405~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e1738d487ce4ead546cb48f1d3993aa455a369e;p=platform%2Fcore%2Fappfw%2Faul-1.git Support handling of each app-control ID Added: - aul_svc_info_create() - aul_svc_info_get_operation() - aul_svc_info_get_uri() - aul_svc_info_get_uri_scheme() - aul_svc_info_get_uri_host() - aul_svc_info_get_mime() - aul_svc_info_get_mime_type() - aul_svc_info_get_mime_subtype() - aul_svc_info_destroy() Requires: - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/199252/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-core/+/199104/ - https://review.tizen.org/gerrit/#/c/platform/core/api/app-control/+/199105/ Change-Id: I5d274addd6dd724424f8751121ccf3f1af244aeb Signed-off-by: Hwankyu Jhun --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dc9810..895eead 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_rpc_port.h DESTINATION inc INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_complication.h DESTINATION include/aul) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_debug_info.h DESTINATION include/aul) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_watchdog.h DESTINATION include/aul) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_svc_internal.h DESTINATION include/aul) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/aul.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/feature/preexec_list.txt DESTINATION ${SHARE_INSTALL_PREFIX}/aul ) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/miregex DESTINATION ${SHARE_INSTALL_PREFIX}/aul ) diff --git a/include/aul_svc_internal.h b/include/aul_svc_internal.h new file mode 100755 index 0000000..bc66f7d --- /dev/null +++ b/include/aul_svc_internal.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +#include "aul_svc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief The AUL Service information handle. + * @since_tizen 5.5 + * @remarks This API is only for App Framework internally. + */ +typedef void *aul_svc_info_h; + +/** + * @brief Creates the AUL Service information handle. + * @since_tizen 5.5 + * + * @param[in] b The bundle object + * @param[out] h The AUL Service information handle + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_create(bundle *b, aul_svc_info_h *h); + +/** + * @brief Gets the operation to be performed. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @param[out] operation The operation to be performed + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_get_operation(aul_svc_info_h h, char **operation); + +/** + * @brief Gets the URI of the data. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @param[out] uri The URI of the data + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_get_uri(aul_svc_info_h h, char **uri); + +/** + * @brief Gets the scheme of the URI. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @param[out] uri_scheme The scheme of the URI + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_get_uri_scheme(aul_svc_info_h h, char **uri_scheme); + +/** + * @brief Gets the host of the URI. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @param[out] uri_host The host of the URI + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_get_uri_host(aul_svc_info_h h, char **uri_host); + +/** + * @brief Gets the explicit MIME type of the data. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @param[out] mime The explicit MIME type of the data + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_get_mime(aul_svc_info_h h, char **mime); + +/** + * @brief Gets the type of the MIME type. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @param[out] mime_type The type of the MIME type + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_get_mime_type(aul_svc_info_h h, char **mime_type); + +/** + * @brief Gets the subtype of the MIME type. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @param[out] mime_subtype The subtype of the MIME type + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + * @retval #AUL_SVC_RET_ERROR Out of memory + */ +int aul_svc_info_get_mime_subtype(aul_svc_info_h h, char **mime_subtype); + +/** + * @brief Destroys the AUL Service information handle. + * @since_tizen 5.5 + * + * @param[in] h The AUL Service information handle + * @return @c 0 on success, + * otherwise a negative error value + * @retval #AUL_SVC_RET_OK Successful + * @retval #AUL_SVC_RET_EINVAL Invalid parameter + */ +int aul_svc_info_destroy(aul_svc_info_h h); + +#ifdef __cplusplus +} +#endif diff --git a/src/service.c b/src/service.c index 52e00a5..e882b4a 100755 --- a/src/service.c +++ b/src/service.c @@ -37,6 +37,7 @@ #include "aul_util.h" #include "aul_svc_priv_key.h" #include "launch.h" +#include "aul_svc_internal.h" #define MAX_CHECKSUM_BUF 2048 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) @@ -2061,3 +2062,181 @@ API int aul_svc_send_launch_request_sync_for_uid(bundle *b, int request_code, return ret; } + +API int aul_svc_info_create(bundle *b, aul_svc_info_h *h) +{ + aul_svc_resolve_info_t *info; + int r; + + if (!b || !h) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = calloc(1, sizeof(aul_svc_resolve_info_t)); + if (!info) { + _E("Out of memory"); + return AUL_SVC_RET_ERROR; + } + + r = __get_resolve_info(b, info); + if (r < 0) { + _E("Failed to get resolving info"); + __free_resolve_info_data(info); + free(info); + return r; + } + + *h = info; + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_get_operation(aul_svc_info_h h, char **operation) +{ + aul_svc_resolve_info_t *info; + + if (!h || !operation) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + *operation = strdup(info->op ? info->op : "NULL"); + if (*operation == NULL) { + _E("Failed to duplicate operation"); + return AUL_SVC_RET_ERROR; + } + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_get_uri(aul_svc_info_h h, char **uri) +{ + aul_svc_resolve_info_t *info; + + if (!h || !uri) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + *uri = strdup(info->uri ? info->uri : "NULL"); + if (*uri == NULL) { + _E("Failed to duplicate URI"); + return AUL_SVC_RET_ERROR; + } + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_get_uri_scheme(aul_svc_info_h h, char **uri_scheme) +{ + aul_svc_resolve_info_t *info; + + if (!h || !uri_scheme) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + *uri_scheme = strdup(info->scheme ? info->scheme : "NULL"); + if (*uri_scheme == NULL) { + _E("Failed to duplicate URI scheme"); + return AUL_SVC_RET_ERROR; + } + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_get_uri_host(aul_svc_info_h h, char **uri_host) +{ + aul_svc_resolve_info_t *info; + + if (!h || !uri_host) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + *uri_host = strdup(info->host ? info->host : "NULL"); + if (*uri_host == NULL) { + _E("Failed to duplicate URI host"); + return AUL_SVC_RET_ERROR; + } + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_get_mime(aul_svc_info_h h, char **mime) +{ + aul_svc_resolve_info_t *info; + + if (!h || !mime) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + *mime = strdup(info->mime ? info->mime : "NULL"); + if (*mime == NULL) { + _E("Failed to duplicate MIME-Type"); + return AUL_SVC_RET_ERROR; + } + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_get_mime_type(aul_svc_info_h h, char **mime_type) +{ + aul_svc_resolve_info_t *info; + + if (!h || !mime_type) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + *mime_type = strdup(info->m_type ? info->m_type : "NULL"); + if (*mime_type == NULL) { + _E("Failed to duplicate the type of MIME-Type"); + return AUL_SVC_RET_ERROR; + } + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_get_mime_subtype(aul_svc_info_h h, char **mime_subtype) +{ + aul_svc_resolve_info_t *info; + + if (!h || !mime_subtype) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + *mime_subtype = strdup(info->s_type ? info->s_type : "NULL"); + if (*mime_subtype == NULL) { + _E("Failed to duplicate the subtype of MIME-Type"); + return AUL_SVC_RET_ERROR; + } + + return AUL_SVC_RET_OK; +} + +API int aul_svc_info_destroy(aul_svc_info_h h) +{ + aul_svc_resolve_info_t *info; + + if (!h) { + _E("Invalid parameter"); + return AUL_SVC_RET_EINVAL; + } + + info = (aul_svc_resolve_info_t *)h; + __free_resolve_info_data(info); + free(info); + + return AUL_SVC_RET_OK; +}