Implement widget_service_get_instance_count 01/87001/3 accepted/tizen/common/20160908.134529 accepted/tizen/ivi/20160909.001711 accepted/tizen/mobile/20160909.001613 accepted/tizen/tv/20160909.001633 accepted/tizen/wearable/20160909.001650 submit/tizen/20160908.041324
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 6 Sep 2016 02:34:15 +0000 (11:34 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Wed, 7 Sep 2016 07:42:43 +0000 (16:42 +0900)
Change-Id: Id27fa2ac1631558e20c82fd861eb9c50484bff91
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
include/aul.h
include/aul_cmd.h
src/widget.c

index 26df2b3..46fd48a 100644 (file)
@@ -2818,6 +2818,11 @@ int aul_widget_instance_foreach(const char *widget_id, aul_widget_instance_forea
  */
 int aul_widget_instance_update(const char *widget_id, const char *instance_id, bundle *b);
 
+/*
+ * This API is only for Appfw internally.
+ */
+int aul_widget_instance_count(const char *widget_id);
+
 /**
  * @par Description:
  *     This API gets the last caller process id of specified application process id.
index 59a86f9..483a48a 100644 (file)
@@ -85,6 +85,7 @@ enum app_cmd {
        WIDGET_DEL,
        WIDGET_LIST,
        WIDGET_UPDATE,
+       WIDGET_COUNT,
 
        APP_REGISTER_PID,
 
index c3b5796..a4e5c26 100644 (file)
@@ -190,4 +190,26 @@ API int aul_widget_instance_update(const char *widget_id,
                bundle_free(kb);
 
        return ret;
-}
\ No newline at end of file
+}
+
+API int aul_widget_instance_count(const char *widget_id)
+{
+       int ret;
+       bundle *kb;
+
+       if (widget_id == NULL)
+               return AUL_R_EINVAL;
+
+       kb = bundle_create();
+       if (kb == NULL) {
+               _E("out of memory");
+               return AUL_R_ERROR;
+       }
+
+       bundle_add_str(kb, AUL_K_WIDGET_ID, widget_id);
+       ret = app_send_cmd(AUL_UTIL_PID, WIDGET_COUNT, kb);
+       bundle_free(kb);
+
+       return ret;
+}
+