summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunho Kang <hhstark.kang@samsung.com>2016-10-12 19:32:09 +0900
committerHyunho Kang <hhstark.kang@samsung.com>2016-10-12 08:43:09 -0700
commitb27f94ecb6914c42cce6186027bfc793c076e89e (patch)
tree6b3f9c0bcc97fd6b06d36a997ccac38ad494c1e3
parenta4c44cf0edd2f1a77fc00faac8994945c17f2aa1 (diff)
downloadwidget-service-b27f94ecb6914c42cce6186027bfc793c076e89e.tar.gz
widget-service-b27f94ecb6914c42cce6186027bfc793c076e89e.tar.bz2
widget-service-b27f94ecb6914c42cce6186027bfc793c076e89e.zip
- supports content info of outside processes Change-Id: I158894842029af77b29a3e2f38a9b88c66b9bcf9 Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
-rw-r--r--src/widget_service.c30
-rw-r--r--tool/widget_test.c18
2 files changed, 38 insertions, 10 deletions
diff --git a/src/widget_service.c b/src/widget_service.c
index 48ec538..2f48eae 100644
--- a/src/widget_service.c
+++ b/src/widget_service.c
@@ -1756,8 +1756,8 @@ EAPI int widget_service_get_size_type(int width, int height,
EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, const char *widget_instance_id, bundle **b)
{
- widget_instance_h instance;
char *raw = NULL;
+ int ret;
if (!_is_widget_feature_enabled()) {
_E("not supported");
@@ -1769,15 +1769,27 @@ EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, co
return WIDGET_ERROR_INVALID_PARAMETER;
}
- instance = widget_instance_get_instance(widget_id, widget_instance_id);
+ ret = aul_widget_instance_get_content(widget_id, widget_instance_id, &raw);
+ if (raw) {
+ *b = bundle_decode((const bundle_raw *)raw, strlen(raw));
+ return WIDGET_ERROR_NONE;
+ }
- if (instance) {
- widget_instance_get_content(instance, &raw);
- if (raw) {
- *b = bundle_decode((const bundle_raw *)raw, strlen(raw));
- widget_instance_unref(instance);
- return WIDGET_ERROR_NONE;
- }
+ switch (ret) {
+ case AUL_R_EINVAL:
+ ret = WIDGET_ERROR_INVALID_PARAMETER;
+ break;
+ case AUL_R_ECOMM:
+ ret = WIDGET_ERROR_IO_ERROR;
+ break;
+ case AUL_R_ENOAPP:
+ ret = WIDGET_ERROR_NOT_EXIST;
+ break;
+ case AUL_R_EILLACC:
+ ret = WIDGET_ERROR_PERMISSION_DENIED;
+ break;
+ default:
+ ret = WIDGET_ERROR_FAULT;
}
return WIDGET_ERROR_INVALID_PARAMETER;
diff --git a/tool/widget_test.c b/tool/widget_test.c
index f91a0ad..d1db6a0 100644
--- a/tool/widget_test.c
+++ b/tool/widget_test.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <widget_service.h>
#include <string.h>
+#include <aul.h>
typedef int (*test_fn)(int argc, char **argv);
@@ -42,9 +43,24 @@ int get_widget_list(int argc, char **argv)
return 0;
}
+int get_content(int argc, char **argv)
+{
+ bundle *b;
+ int ret;
+ char *content_info = NULL;
+
+ ret = widget_service_get_content_of_widget_instance(argv[2], argv[3], &b);
+ if (b)
+ bundle_get_str(b, AUL_K_WIDGET_CONTENT_INFO, &content_info);
+
+ printf("ret:%d %s\n", ret, content_info);
+ return 0;
+}
+
test_func_t test_func[] = {
{"get_pkg_id", get_pkg_id, "<widget_id>"},
- {"get_widget_list", get_widget_list, ""}
+ {"get_widget_list", get_widget_list, ""},
+ {"get_content", get_content, ""},
};
static void print_usage(char *pname)