summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2019-07-15 10:53:36 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2019-07-25 09:00:46 +0900
commitbe8d9c31dfa14f558926ea1395743c80933f6136 (patch)
tree8b74637ad0e3343c6f07d73099366e213b9e14a1 /src
parentf8e74f71eff86a93dce48dca9d847c18687406fe (diff)
downloadlibrua-be8d9c31dfa14f558926ea1395743c80933f6136.tar.gz
librua-be8d9c31dfa14f558926ea1395743c80933f6136.tar.bz2
librua-be8d9c31dfa14f558926ea1395743c80933f6136.zip
Add new APIs for task-manager
Currently, when the rua_rec is changed, the application has crashed if it uses the rua library. To avoid ABI break issue, new functions are added. Adds: - rua_info_get_app_id() - rua_info_get_app_path() - rua_info_get_args() - rua_info_get_launch_time() - rua_info_get_instance_id() - rua_info_get_instance_name() - rua_info_get_icon() - rua_info_get_uri() - rua_info_get_image() - rua_info_get_component_id() - rua_info_is_managed_by_task_manager() - rua_info_get_label() - rua_info_destroy() - rua_info_clone() - rua_context_destroy() - rua_context_get_app_id() - rua_context_get_instance_id() - rua_context_get_component_id() - rua_manager_foreach_rua_info() - rua_manager_delete_rua_info() - rua_manager_delete_all_rua_info() - rua_manager_get_app_control_from_rua_info() - rua_manager_get_rua_context_from_rua_info() - rua_manager_is_running() - rua_manager_resume() - rua_manager_terminate() Change-Id: Iea4a135b1980f855f1f2594b83da4b9a2e80e980 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/rua.c6
-rw-r--r--src/rua_context.c268
-rw-r--r--src/rua_context_internal.h41
-rw-r--r--src/rua_info.c926
-rw-r--r--src/rua_info_internal.h35
-rw-r--r--src/rua_manager.c160
-rw-r--r--src/rua_private.h22
7 files changed, 1453 insertions, 5 deletions
diff --git a/src/rua.c b/src/rua.c
index 9e3ddef..527c66a 100644
--- a/src/rua.c
+++ b/src/rua.c
@@ -133,9 +133,9 @@ API int rua_clear_history(void)
API int rua_history_load_db_for_uid(char ***table, int *nrows, int *ncols, uid_t uid)
{
- static const char query[] =
- "SELECT pkg_name, app_path, arg, launch_time,"
- " instance_id, instance_name, icon, uri, image, comp_id "
+ static const char query[] = "SELECT "
+ "pkg_name, app_path, arg, launch_time, instance_id, "
+ "instance_name, icon, uri, image, comp_id "
"FROM rua_history ORDER BY launch_time DESC";
int r;
char *db_err = NULL;
diff --git a/src/rua_context.c b/src/rua_context.c
new file mode 100644
index 0000000..8b80a16
--- /dev/null
+++ b/src/rua_context.c
@@ -0,0 +1,268 @@
+/*
+ * 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.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <aul.h>
+#include <aul_comp_status.h>
+
+#include "rua_private.h"
+#include "rua_info.h"
+#include "rua_context.h"
+#include "rua_manager.h"
+
+struct rua_context_s {
+ char *app_id;
+ char *instance_id;
+ char *component_id;
+};
+
+static void __destroy_rua_context(struct rua_context_s *context)
+{
+ free(context->component_id);
+ free(context->instance_id);
+ free(context->app_id);
+ free(context);
+}
+
+static struct rua_context_s *__create_rua_context(char *app_id,
+ char *instance_id, char *component_id)
+{
+ struct rua_context_s *context;
+
+ context = calloc(1, sizeof(struct rua_context_s));
+ if (!context) {
+ _E("Out of memory");
+ return NULL;
+ }
+
+ context->app_id = app_id;
+ context->instance_id = instance_id;
+ context->component_id = component_id;
+
+ return context;
+}
+
+int rua_context_create_from_rua_info(rua_info_h info,
+ rua_context_h *context)
+{
+ struct rua_context_s *handle;
+ char *app_id;
+ char *instance_id;
+ char *component_id;
+ int ret;
+
+ if (!info || !context) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = rua_info_get_app_id(info, &app_id);
+ if (ret != RUA_ERROR_NONE)
+ return ret;
+
+ ret = rua_info_get_instance_id(info, &instance_id);
+ if (ret != RUA_ERROR_NONE) {
+ free(app_id);
+ return ret;
+ }
+
+ ret = rua_info_get_component_id(info, &component_id);
+ if (ret != RUA_ERROR_NONE) {
+ free(instance_id);
+ free(app_id);
+ return ret;
+ }
+
+ handle = __create_rua_context(app_id, instance_id, component_id);
+ if (!handle) {
+ free(component_id);
+ free(instance_id);
+ free(app_id);
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ *context = handle;
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_context_destroy(rua_context_h context)
+{
+ if (!context) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ __destroy_rua_context(context);
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_context_get_app_id(rua_context_h context, char **app_id)
+{
+ if (!context || !app_id) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ *app_id = strdup(context->app_id);
+ if (*app_id == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_context_get_instance_id(rua_context_h context, char **instance_id)
+{
+ if (!context || !instance_id) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (context->instance_id) {
+ *instance_id = strdup(context->instance_id);
+ if (*instance_id == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *instance_id = NULL;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_context_get_component_id(rua_context_h context, char **component_id)
+{
+ if (!context || !component_id) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (context->component_id) {
+ *component_id = context->component_id;
+ if (*component_id == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *component_id = NULL;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __convert_aul_error(int error)
+{
+ switch (error) {
+ case AUL_R_EINVAL:
+ return RUA_ERROR_INVALID_PARAMETER;
+ case AUL_R_EILLACC:
+ return RUA_ERROR_PERMISSION_DENIED;
+ case AUL_R_ENOAPP:
+ return RUA_ERROR_NO_SUCH_APP;
+ default:
+ return RUA_ERROR_IO_ERROR;
+ }
+}
+
+int rua_context_is_running(rua_context_h context, bool *running)
+{
+ int ret;
+
+ if (!context || !running) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (context->component_id) {
+ ret = aul_comp_is_running(context->instance_id, running);
+ } else if (context->instance_id) {
+ ret = aul_app_is_running_with_instance_id(context->app_id,
+ context->instance_id, running);
+ } else {
+ ret = aul_app_is_running(context->app_id);
+ if (ret >= 0)
+ *running = (bool)ret;
+ }
+
+ if (ret < 0) {
+ _E("Failed to check running state");
+ return __convert_aul_error(ret);
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+int rua_context_resume(rua_context_h context)
+{
+ int ret;
+
+ if (!context) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (context->component_id) {
+ ret = aul_comp_resume(context->instance_id);
+ } else if (context->instance_id) {
+ ret = aul_resume_app_by_instance_id(context->app_id,
+ context->instance_id);
+ } else {
+ ret = aul_resume_app(context->app_id);
+ }
+
+ if (ret < 0) {
+ _E("Failed to send the resume request. error(%d)", ret);
+ return __convert_aul_error(ret);
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+int rua_context_terminate(rua_context_h context)
+{
+ int ret;
+
+ if (!context) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (context->component_id) {
+ ret = aul_comp_terminate(context->instance_id);
+ } else if (context->instance_id) {
+ ret = aul_terminate_app_with_instance_id(context->app_id,
+ context->instance_id);
+ } else {
+ ret = aul_terminate_app(context->app_id);
+ }
+
+ if (ret < 0) {
+ _E("Failed to send the terminate request. error(%d)", ret);
+ return __convert_aul_error(ret);
+ }
+
+ return RUA_ERROR_NONE;
+}
diff --git a/src/rua_context_internal.h b/src/rua_context_internal.h
new file mode 100644
index 0000000..027cddd
--- /dev/null
+++ b/src/rua_context_internal.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#ifndef __RUA_CONTEXT_INTERNAL_H__
+#define __RUA_CONTEXT_INTERNAL_H__
+
+#include <rua_types.h>
+#include <rua_context.h>
+#include <rua_info.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int rua_context_create_from_rua_info(rua_info_h info,
+ rua_context_h *context);
+
+int rua_context_is_running(rua_context_h context, bool *running);
+
+int rua_context_resume(rua_context_h context);
+
+int rua_context_terminate(rua_context_h context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__RUA_CONTEXT_INTERNAL_H__*/
diff --git a/src/rua_info.c b/src/rua_info.c
new file mode 100644
index 0000000..f194256
--- /dev/null
+++ b/src/rua_info.c
@@ -0,0 +1,926 @@
+/*
+ * 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.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <pkgmgr-info.h>
+#include <aul.h>
+#include <aul_comp_info.h>
+
+#include "rua.h"
+#include "rua_private.h"
+#include "rua_info.h"
+#include "rua_info_internal.h"
+
+#define RUA_INFO_START 0
+
+enum rua_info_e {
+ RUA_INFO_APP_ID = RUA_INFO_START,
+ RUA_INFO_APP_PATH,
+ RUA_INFO_ARGS,
+ RUA_INFO_LAUNCH_TIME,
+ RUA_INFO_INSTANCE_ID,
+ RUA_INFO_INSTANCE_NAME,
+ RUA_INFO_ICON,
+ RUA_INFO_URI,
+ RUA_INFO_IMAGE,
+ RUA_INFO_COMPONENT_ID,
+ RUA_INFO_APP_INFO,
+ RUA_INFO_COMP_INFO,
+ RUA_INFO_MAX,
+};
+
+struct rua_info_s {
+ char *value[RUA_INFO_MAX];
+};
+
+typedef int (*rua_info_add_cb)(struct rua_rec *rec,
+ struct rua_info_s *info);
+typedef void (*rua_info_remove_cb)(void *data);
+typedef int (*rua_info_clone_cb)(struct rua_info_s *info,
+ struct rua_info_s *clone);
+
+typedef struct _rua_info_vft {
+ rua_info_add_cb ctor;
+ rua_info_remove_cb dtor;
+ rua_info_clone_cb clnr;
+} rua_info_vft;
+
+static int __rua_info_add_app_id(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ info->value[RUA_INFO_APP_ID] = strdup(rec->pkg_name);
+ if (!info->value[RUA_INFO_APP_ID]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_app_path(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ info->value[RUA_INFO_APP_PATH] = strdup(rec->app_path);
+ if (!info->value[RUA_INFO_APP_PATH]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_args(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ info->value[RUA_INFO_ARGS] = strdup(rec->arg);
+ if (!info->value[RUA_INFO_ARGS]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_launch_time(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ info->value[RUA_INFO_LAUNCH_TIME] = GINT_TO_POINTER(rec->launch_time);
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_instance_id(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ if (!rec->instance_id)
+ return RUA_ERROR_NONE;
+
+ info->value[RUA_INFO_INSTANCE_ID] = strdup(rec->instance_id);
+ if (!info->value[RUA_INFO_INSTANCE_ID]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_instance_name(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ if (!rec->instance_name)
+ return RUA_ERROR_NONE;
+
+ info->value[RUA_INFO_INSTANCE_NAME] = strdup(rec->instance_name);
+ if (!info->value[RUA_INFO_INSTANCE_NAME]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_icon(struct rua_rec *rec, struct rua_info_s *info)
+{
+ if (!rec->icon)
+ return RUA_ERROR_NONE;
+
+ info->value[RUA_INFO_ICON] = strdup(rec->icon);
+ if (!info->value[RUA_INFO_ICON]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_uri(struct rua_rec *rec, struct rua_info_s *info)
+{
+ if (!rec->uri)
+ return RUA_ERROR_NONE;
+
+ info->value[RUA_INFO_URI] = strdup(rec->uri);
+ if (!info->value[RUA_INFO_URI]) {
+ _E("Ouf of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_image(struct rua_rec *rec, struct rua_info_s *info)
+{
+ if (!rec->image)
+ return RUA_ERROR_NONE;
+
+ info->value[RUA_INFO_IMAGE] = strdup(rec->image);
+ if (!info->value[RUA_INFO_IMAGE]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_component_id(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ if (!rec->comp_id)
+ return RUA_ERROR_NONE;
+
+ info->value[RUA_INFO_COMPONENT_ID] = strdup(rec->comp_id);
+ if (!info->value[RUA_INFO_COMPONENT_ID]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_app_info(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ pkgmgrinfo_appinfo_h app_info;
+ int ret;
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(rec->pkg_name, &app_info);
+ if (ret != PMINFO_R_OK) {
+ _E("Failed to get appinfo");
+ return RUA_ERROR_IO_ERROR;
+ }
+
+ info->value[RUA_INFO_APP_INFO] = app_info;
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_add_comp_info(struct rua_rec *rec,
+ struct rua_info_s *info)
+{
+ aul_comp_info_h comp_info;
+ int ret;
+
+ if (!rec->comp_id)
+ return RUA_ERROR_NONE;
+
+ ret = aul_comp_info_create(rec->comp_id, &comp_info);
+ if (ret != AUL_R_OK) {
+ _E("Failed to create comp info");
+ return RUA_ERROR_IO_ERROR;
+ }
+
+ info->value[RUA_INFO_COMP_INFO] = comp_info;
+
+ return RUA_ERROR_NONE;
+}
+
+static void __rua_info_remove_app_info(void *data)
+{
+ pkgmgrinfo_appinfo_h app_info;
+
+ app_info = (pkgmgrinfo_appinfo_h)data;
+ pkgmgrinfo_appinfo_destroy_appinfo(app_info);
+}
+
+static void __rua_info_remove_comp_info(void *data)
+{
+ aul_comp_info_h comp_info;
+
+ comp_info = (aul_comp_info_h)data;
+ aul_comp_info_destroy(comp_info);
+}
+
+static int __rua_info_clone_app_id(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ clone->value[RUA_INFO_APP_ID] = strdup(info->value[RUA_INFO_APP_ID]);
+ if (!clone->value[RUA_INFO_APP_ID]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_app_path(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ clone->value[RUA_INFO_APP_PATH] =
+ strdup(info->value[RUA_INFO_APP_PATH]);
+ if (!clone->value[RUA_INFO_APP_PATH]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_args(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ clone->value[RUA_INFO_ARGS] = strdup(info->value[RUA_INFO_ARGS]);
+ if (!clone->value[RUA_INFO_ARGS]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_launch_time(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ clone->value[RUA_INFO_LAUNCH_TIME] = info->value[RUA_INFO_LAUNCH_TIME];
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_instance_id(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ if (!info->value[RUA_INFO_INSTANCE_ID])
+ return RUA_ERROR_NONE;
+
+ clone->value[RUA_INFO_INSTANCE_ID] =
+ strdup(info->value[RUA_INFO_INSTANCE_ID]);
+ if (!clone->value[RUA_INFO_INSTANCE_ID]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_instance_name(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ if (!info->value[RUA_INFO_INSTANCE_NAME])
+ return RUA_ERROR_NONE;
+
+ clone->value[RUA_INFO_INSTANCE_NAME] =
+ strdup(info->value[RUA_INFO_INSTANCE_NAME]);
+ if (!clone->value[RUA_INFO_INSTANCE_NAME]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_icon(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ if (!info->value[RUA_INFO_ICON])
+ return RUA_ERROR_NONE;
+
+ clone->value[RUA_INFO_ICON] = strdup(info->value[RUA_INFO_ICON]);
+ if (!clone->value[RUA_INFO_ICON]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_uri(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ if (!info->value[RUA_INFO_URI])
+ return RUA_ERROR_NONE;
+
+ clone->value[RUA_INFO_URI] = strdup(info->value[RUA_INFO_URI]);
+ if (!clone->value[RUA_INFO_URI]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_image(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ if (!info->value[RUA_INFO_IMAGE])
+ return RUA_ERROR_NONE;
+
+ clone->value[RUA_INFO_IMAGE] = strdup(info->value[RUA_INFO_IMAGE]);
+ if (!clone->value[RUA_INFO_IMAGE]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_component_id(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ if (!info->value[RUA_INFO_COMPONENT_ID])
+ return RUA_ERROR_NONE;
+
+ clone->value[RUA_INFO_COMPONENT_ID] =
+ strdup(info->value[RUA_INFO_COMPONENT_ID]);
+ if (!clone->value[RUA_INFO_COMPONENT_ID]) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_app_info(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ pkgmgrinfo_appinfo_h app_info;
+ int ret;
+
+ ret = pkgmgrinfo_appinfo_clone_appinfo(
+ info->value[RUA_INFO_APP_INFO],
+ &app_info);
+ if (ret != RUA_ERROR_NONE) {
+ _E("Failed to clone app info");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ clone->value[RUA_INFO_APP_INFO] = app_info;
+
+ return RUA_ERROR_NONE;
+}
+
+static int __rua_info_clone_comp_info(struct rua_info_s *info,
+ struct rua_info_s *clone)
+{
+ aul_comp_info_h comp_info;
+ int ret;
+
+ if (!info->value[RUA_INFO_COMP_INFO])
+ return RUA_ERROR_NONE;
+
+ ret = aul_comp_info_clone(info->value[RUA_INFO_COMP_INFO],
+ &comp_info);
+ if (ret != RUA_ERROR_NONE) {
+ _E("Failed to clone comp info");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ clone->value[RUA_INFO_COMP_INFO] = comp_info;
+
+ return RUA_ERROR_NONE;
+}
+
+static rua_info_vft __rua_table[] = {
+ [RUA_INFO_APP_ID] = {
+ .ctor = __rua_info_add_app_id,
+ .dtor = free,
+ .clnr = __rua_info_clone_app_id
+ },
+ [RUA_INFO_APP_PATH] = {
+ .ctor = __rua_info_add_app_path,
+ .dtor = free,
+ .clnr = __rua_info_clone_app_path
+ },
+ [RUA_INFO_ARGS] = {
+ .ctor = __rua_info_add_args,
+ .dtor = free,
+ .clnr = __rua_info_clone_args
+ },
+ [RUA_INFO_LAUNCH_TIME] = {
+ .ctor = __rua_info_add_launch_time,
+ .dtor = NULL,
+ .clnr = __rua_info_clone_launch_time
+ },
+ [RUA_INFO_INSTANCE_ID] = {
+ .ctor = __rua_info_add_instance_id,
+ .dtor = free,
+ .clnr = __rua_info_clone_instance_id
+ },
+ [RUA_INFO_INSTANCE_NAME] = {
+ .ctor = __rua_info_add_instance_name,
+ .dtor = free,
+ .clnr = __rua_info_clone_instance_name
+ },
+ [RUA_INFO_ICON] = {
+ .ctor = __rua_info_add_icon,
+ .dtor = free,
+ .clnr = __rua_info_clone_icon
+ },
+ [RUA_INFO_URI] = {
+ .ctor = __rua_info_add_uri,
+ .dtor = free,
+ .clnr = __rua_info_clone_uri
+ },
+ [RUA_INFO_IMAGE] = {
+ .ctor = __rua_info_add_image,
+ .dtor = free,
+ .clnr = __rua_info_clone_image
+ },
+ [RUA_INFO_COMPONENT_ID] = {
+ .ctor = __rua_info_add_component_id,
+ .dtor = free,
+ .clnr = __rua_info_clone_component_id
+ },
+ [RUA_INFO_APP_INFO] = {
+ .ctor = __rua_info_add_app_info,
+ .dtor = __rua_info_remove_app_info,
+ .clnr = __rua_info_clone_app_info
+ },
+ [RUA_INFO_COMP_INFO] = {
+ .ctor = __rua_info_add_comp_info,
+ .dtor = __rua_info_remove_comp_info,
+ .clnr = __rua_info_clone_comp_info
+ },
+};
+
+static void __destroy_rua_info(gpointer data)
+{
+ struct rua_info_s *info = (struct rua_info_s *)data;
+ int i;
+
+ if (!info)
+ return;
+
+ for (i = RUA_INFO_START; i < RUA_INFO_MAX; ++i) {
+ if (!__rua_table[i].dtor)
+ continue;
+
+ __rua_table[i].dtor(info->value[i]);
+ }
+
+ free(info);
+}
+
+static struct rua_info_s *__create_rua_info(struct rua_rec *rec)
+{
+ struct rua_info_s *info;
+ int ret;
+ int i;
+
+ info = calloc(1, sizeof(struct rua_info_s));
+ if (!info) {
+ _E("Out of memory");
+ return NULL;
+ }
+
+ for (i = RUA_INFO_START; i < RUA_INFO_MAX; ++i) {
+ if (!__rua_table[i].ctor)
+ continue;
+
+ ret = __rua_table[i].ctor(rec, info);
+ if (ret != RUA_ERROR_NONE) {
+ __destroy_rua_info(info);
+ return NULL;
+ }
+ }
+
+ return info;
+}
+
+static struct rua_info_s *__clone_rua_info(struct rua_info_s *info)
+{
+ struct rua_info_s *clone;
+ int ret;
+ int i;
+
+ clone = calloc(1, sizeof(struct rua_info_s));
+ if (!clone) {
+ _E("Out of memory");
+ return NULL;
+ }
+
+ for (i = RUA_INFO_START; i < RUA_INFO_MAX; ++i) {
+ if (!__rua_table[i].clnr)
+ continue;
+
+ ret = __rua_table[i].clnr(info, clone);
+ if (ret != RUA_ERROR_NONE) {
+ __destroy_rua_info(clone);
+ return NULL;
+ }
+ }
+
+ return clone;
+}
+
+int rua_info_foreach(rua_manager_rua_info_cb callback, void *user_data)
+{
+ return rua_info_usr_foreach(getuid(), callback, user_data);
+}
+
+int rua_info_usr_foreach(uid_t uid, rua_manager_rua_info_cb callback,
+ void *user_data)
+{
+ struct rua_info_s *info;
+ struct rua_rec rec;
+ GList *list = NULL;
+ GList *iter;
+ char **table = NULL;
+ int nrows = 0;
+ int ncols = 0;
+ int row;
+ int ret;
+
+ if (!callback) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = rua_history_load_db_for_uid(&table, &nrows, &ncols, uid);
+ if (ret < 0) {
+ _E("Failed to load rua history");
+ return RUA_ERROR_IO_ERROR;
+ }
+
+ for (row = 0; row < nrows; ++row) {
+ rua_history_get_rec(&rec, table, nrows, ncols, row);
+ info = __create_rua_info(&rec);
+ if (!info) {
+ rua_history_unload_db(&table);
+ g_list_free_full(list, __destroy_rua_info);
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ list = g_list_append(list, info);
+ }
+
+ rua_history_unload_db(&table);
+
+ iter = list;
+ while (iter) {
+ info = (struct rua_info_s *)iter->data;
+ if (!callback(info, user_data))
+ break;
+
+ iter = g_list_next(iter);
+ }
+
+ g_list_free_full(list, __destroy_rua_info);
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_app_id(rua_info_h info, char **app_id)
+{
+ if (!info || !app_id) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ *app_id = strdup(info->value[RUA_INFO_APP_ID]);
+ if (*app_id == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_app_path(rua_info_h info, char **app_path)
+{
+ if (!info || !app_path) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ *app_path = strdup(info->value[RUA_INFO_APP_PATH]);
+ if (*app_path == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_args(rua_info_h info, char **args)
+{
+ if (!info || !args) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ *args = strdup(info->value[RUA_INFO_ARGS]);
+ if (*args == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_launch_time(rua_info_h info, time_t *launch_time)
+{
+ if (!info || !launch_time) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ *launch_time = GPOINTER_TO_INT(info->value[RUA_INFO_LAUNCH_TIME]);
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_instance_id(rua_info_h info, char **instance_id)
+{
+ if (!info || !instance_id) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->value[RUA_INFO_INSTANCE_ID]) {
+ *instance_id = strdup(info->value[RUA_INFO_INSTANCE_ID]);
+ if (*instance_id == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *instance_id = NULL;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_instance_name(rua_info_h info, char **instance_name)
+{
+ if (!info || !instance_name) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->value[RUA_INFO_INSTANCE_NAME]) {
+ *instance_name = strdup(info->value[RUA_INFO_INSTANCE_NAME]);
+ if (*instance_name == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *instance_name = NULL;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static char *__get_icon(rua_info_h info)
+{
+ pkgmgrinfo_appinfo_h app_info;
+ aul_comp_info_h comp_info;
+ char *icon;
+ int ret;
+
+ if (info->value[RUA_INFO_COMP_INFO]) {
+ comp_info = (aul_comp_info_h)info->value[RUA_INFO_COMP_INFO];
+ ret = aul_comp_info_get_icon(comp_info, (const char **)&icon);
+ if (ret != AUL_R_OK) {
+ _E("Failed to get icon");
+ return NULL;
+ }
+ } else {
+ app_info = (pkgmgrinfo_appinfo_h)info->value[RUA_INFO_APP_INFO];
+ ret = pkgmgrinfo_appinfo_get_icon(app_info, &icon);
+ if (ret != PMINFO_R_OK) {
+ _E("Failed to get icon");
+ return NULL;
+ }
+ }
+
+ if (icon && icon[0] != '\0')
+ return strdup(icon);
+
+ return NULL;
+}
+
+API int rua_info_get_icon(rua_info_h info, char **icon)
+{
+ if (!info || !icon) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->value[RUA_INFO_ICON]) {
+ *icon = strdup(info->value[RUA_INFO_ICON]);
+ if (*icon == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *icon = __get_icon(info);
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_uri(rua_info_h info, char **uri)
+{
+ if (!info || !uri) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->value[RUA_INFO_URI]) {
+ *uri = info->value[RUA_INFO_URI];
+ if (*uri == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *uri = NULL;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_image(rua_info_h info, char **image)
+{
+ if (!info || !image) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->value[RUA_INFO_IMAGE]) {
+ *image = info->value[RUA_INFO_IMAGE];
+ if (*image == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *image = NULL;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_get_component_id(rua_info_h info, char **component_id)
+{
+ if (!info || !component_id) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->value[RUA_INFO_COMPONENT_ID]) {
+ *component_id = info->value[RUA_INFO_COMPONENT_ID];
+ if (*component_id == NULL) {
+ _E("Out of memory");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *component_id = NULL;
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+
+API int rua_info_is_managed_by_task_manager(rua_info_h info, bool *managed)
+{
+ pkgmgrinfo_appinfo_h app_info;
+ aul_comp_info_h comp_info;
+ int ret;
+
+ if (!info || !managed) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->value[RUA_INFO_COMP_INFO]) {
+ comp_info = (aul_comp_info_h)info->value[RUA_INFO_COMP_INFO];
+ ret = aul_comp_info_is_taskmanage(comp_info, managed);
+ if (ret != AUL_R_OK) {
+ _E("Failed to check taskmanage");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+ } else {
+ app_info = (pkgmgrinfo_appinfo_h)info->value[RUA_INFO_APP_INFO];
+ ret = pkgmgrinfo_appinfo_is_taskmanage(app_info, managed);
+ if (ret != PMINFO_R_OK) {
+ _E("Failed to check taskmanage");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+static char *__get_label(rua_info_h info)
+{
+ pkgmgrinfo_appinfo_h app_info;
+ aul_comp_info_h comp_info;
+ char *label;
+ int ret;
+
+ if (info->value[RUA_INFO_COMP_INFO]) {
+ comp_info = (aul_comp_info_h)info->value[RUA_INFO_COMP_INFO];
+ ret = aul_comp_info_get_label(comp_info, (const char **)&label);
+ if (ret != AUL_R_OK) {
+ _E("Failed to get label");
+ return NULL;
+ }
+ } else {
+ app_info = (pkgmgrinfo_appinfo_h)info->value[RUA_INFO_APP_INFO];
+ ret = pkgmgrinfo_appinfo_get_label(app_info, &label);
+ if (ret != PMINFO_R_OK) {
+ _E("Failed to get label");
+ return NULL;
+ }
+ }
+
+ if (label && label[0] != '\0')
+ return strdup(label);
+
+ return NULL;
+}
+
+API int rua_info_get_label(rua_info_h info, char **label)
+{
+ if (!info || !label) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ *label = __get_label(info);
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_destroy(rua_info_h info)
+{
+ if (!info) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ __destroy_rua_info(info);
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_info_clone(rua_info_h info, rua_info_h *clone)
+{
+ if (!info || !clone) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ *clone = __clone_rua_info(info);
+ if (*clone == NULL) {
+ _E("Failed to clone rua info");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ return RUA_ERROR_NONE;
+}
diff --git a/src/rua_info_internal.h b/src/rua_info_internal.h
new file mode 100644
index 0000000..b0ec66e
--- /dev/null
+++ b/src/rua_info_internal.h
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+#ifndef __RUA_INFO_INTERNAL_H__
+#define __RUA_INFO_INTERNAL_H__
+
+#include <rua_types.h>
+#include <rua_manager.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int rua_info_foreach(rua_manager_rua_info_cb, void *user_data);
+
+int rua_info_usr_foreach(uid_t uid, rua_manager_rua_info_cb, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__RUA_INFO_INTERNAL_H__*/
diff --git a/src/rua_manager.c b/src/rua_manager.c
new file mode 100644
index 0000000..134affe
--- /dev/null
+++ b/src/rua_manager.c
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <aul.h>
+#include <app_control_internal.h>
+
+#include "rua.h"
+#include "rua_private.h"
+#include "rua_manager.h"
+#include "rua_context_internal.h"
+#include "rua_info_internal.h"
+
+static int __convert_aul_error(int error)
+{
+ switch (error) {
+ case AUL_R_EINVAL:
+ return RUA_ERROR_INVALID_PARAMETER;
+ case AUL_R_EILLACC:
+ return RUA_ERROR_PERMISSION_DENIED;
+ case AUL_R_ERROR:
+ return RUA_ERROR_OUT_OF_MEMORY;
+ default:
+ return RUA_ERROR_IO_ERROR;
+ }
+}
+
+API int rua_manager_foreach_rua_info(rua_manager_rua_info_cb callback,
+ void *user_data)
+{
+ return rua_info_foreach(callback, user_data);
+}
+
+API int rua_manager_delete_rua_info(rua_info_h info)
+{
+ char *app_id;
+ char *instance_id;
+ int ret;
+
+ if (!info) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = rua_info_get_app_id(info, &app_id);
+ if (ret != RUA_ERROR_NONE)
+ return ret;
+
+ ret = rua_info_get_instance_id(info, &instance_id);
+ if (ret != RUA_ERROR_NONE) {
+ free(app_id);
+ return ret;
+ }
+
+ if (instance_id) {
+ ret = rua_delete_history_with_instance_id(app_id,
+ instance_id);
+ } else {
+ ret = rua_delete_history_with_pkgname(app_id);
+ }
+
+ free(instance_id);
+ free(app_id);
+
+ if (ret < 0) {
+ _E("Failed to delete RUA history. error(%d)", ret);
+ return __convert_aul_error(ret);
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_manager_delete_all_rua_info(void)
+{
+ int ret;
+
+ ret = rua_clear_history();
+ if (ret < 0) {
+ _E("Failed to clear RUA history. error(%d)", ret);
+ return __convert_aul_error(ret);
+ }
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_manager_get_app_control_from_rua_info(rua_info_h info,
+ app_control_h *app_control)
+{
+ app_control_h handle;
+ char *args;
+ bundle *b;
+ int ret;
+
+ if (!info || !app_control) {
+ _E("Invalid parameter");
+ return RUA_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = rua_info_get_args(info, &args);
+ if (ret != RUA_ERROR_NONE)
+ return ret;
+
+ b = bundle_decode((bundle_raw *)args, strlen(args));
+ free(args);
+ if (!b) {
+ _E("Failed to decode bundle");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ ret = app_control_create_request(b, &handle);
+ bundle_free(b);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ _E("Failed to create app_control handle");
+ return RUA_ERROR_OUT_OF_MEMORY;
+ }
+
+ *app_control = handle;
+
+ return RUA_ERROR_NONE;
+}
+
+API int rua_manager_get_rua_context_from_rua_info(rua_info_h info,
+ rua_context_h *context)
+{
+ return rua_context_create_from_rua_info(info, context);
+}
+
+API int rua_manager_is_running(rua_context_h context, bool *running)
+{
+ return rua_context_is_running(context, running);
+}
+
+API int rua_manager_resume(rua_context_h context)
+{
+ return rua_context_resume(context);
+}
+
+API int rua_manager_terminate(rua_context_h context)
+{
+ return rua_context_terminate(context);
+}
diff --git a/src/rua_private.h b/src/rua_private.h
index 08bbd00..fa53318 100644
--- a/src/rua_private.h
+++ b/src/rua_private.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 - 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.
@@ -17,6 +17,8 @@
#ifndef __RUA_PRIVATE_H__
#define __RUA_PRIVATE_H__
+#include <dlog.h>
+
#ifdef LOG_TAG
#undef LOG_TAG
#endif
@@ -30,4 +32,20 @@
#define RUA_DB_NAME ".rua.db"
#define RUA_STAT_DB_NAME ".rua_stat.db"
-#endif /*__RUA_H__*/
+#ifndef _E
+#define _E LOGE
+#endif
+
+#ifndef _W
+#define _W LOGW
+#endif
+
+#ifndef _I
+#define _I LOGI
+#endif
+
+#ifndef _D
+#define _D LOGD
+#endif
+
+#endif /*__RUA_PRIVATE_H__*/