Support fill response group 28/191528/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 17 Oct 2018 12:31:06 +0000 (21:31 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 18 Oct 2018 05:12:20 +0000 (14:12 +0900)
Change-Id: I4739dcb25a56e94a6abb94558109619d3a9ca9ac
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
19 files changed:
client/autofill.c
client/autofill_proxy.c
client/autofill_proxy.h
common/autofill_fill_response.c
common/autofill_fill_response_group.c [new file with mode: 0644]
include/autofill_common.h
include/autofill_private.h
server/autofill_service_proxy.c
server/autofill_service_proxy.h
server/autofill_stub.c
server/autofill_stub.h
server/main.c
service/service_main.c
service_lib/autofill_service.c
service_lib/autofill_service_stub.c
service_lib/autofill_service_stub.h
test/ecore_imf_example.c
tidl/autofill.tidl
tidl/autofill_service.tidl

index e85119a..d166c69 100644 (file)
@@ -47,9 +47,9 @@ static bool fill_response_item_cb(rpc_port_autofill_response_item_h response_ite
     char *id = NULL;
     char *presentation_text = NULL;
     char *value = NULL;
-    autofill_fill_response_h fill_response = (autofill_fill_response_h)user_data;
+    autofill_fill_response_group_h res_group = (autofill_fill_response_group_h)user_data;
 
-    if (!fill_response)
+    if (!res_group)
         return true;
 
     rpc_port_autofill_response_item_get_id(response_items, &id);
@@ -65,7 +65,7 @@ static bool fill_response_item_cb(rpc_port_autofill_response_item_h response_ite
     autofill_fill_response_item_set_presentation_text(ritem, presentation_text);
     autofill_fill_response_item_set_value(ritem, value);
 
-    autofill_fill_response_add_item(fill_response, ritem);
+    autofill_fill_response_group_add_item(res_group, ritem);
 
     if (id)
         free(id);
@@ -76,14 +76,34 @@ static bool fill_response_item_cb(rpc_port_autofill_response_item_h response_ite
     if (value)
         free(value);
 
+    autofill_fill_response_item_destroy(ritem);
+
+    return true;
+}
+
+static bool fill_response_group_cb(rpc_port_autofill_response_group_h response_groups, void *user_data)
+{
+    autofill_fill_response_h rh = (autofill_fill_response_h)user_data;
+    autofill_fill_response_group_h res_group;
+
+    LOGD("");
+
+    autofill_fill_response_group_create(&res_group);
+
+    rpc_port_autofill_response_group_foreach_response_items(response_groups, fill_response_item_cb, res_group);
+
+    autofill_fill_response_add_group(rh, res_group);
+
+    autofill_fill_response_group_destroy(res_group);
+
     return true;
 }
 
 static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_fill_response_h response_h)
 {
     char *view_id = NULL;
-
     autofill_fill_response_h rh;
+
     autofill_fill_response_create(&rh);
 
     rpc_port_autofill_fill_response_get_view_id(response_h, &view_id);
@@ -93,7 +113,7 @@ static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_fill_resp
     LOGD("view id : %s", view_id);
     free(view_id);
 
-    rpc_port_autofill_fill_response_foreach_response_items(response_h, fill_response_item_cb, rh);
+    rpc_port_autofill_fill_response_foreach_response_groups(response_h, fill_response_group_cb, rh);
 
     if (g_autofill_fill_response_cb)
         g_autofill_fill_response_cb(rh, g_autofill_fill_response_data);
index b279edf..adb3113 100644 (file)
@@ -1816,10 +1816,250 @@ int rpc_port_autofill_response_item_get_value(rpc_port_autofill_response_item_h
        return 0;
 }
 
+struct autofill_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *response_items;
+};
+
+static void __autofill_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __autofill_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_response_item_h value = NULL;
+
+                       rpc_port_autofill_response_item_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->response_items = g_list_append(h->response_items, value);
+               }
+       } while (0);
+}
+
+int rpc_port_autofill_response_group_create(rpc_port_autofill_response_group_h *h)
+{
+       struct autofill_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct autofill_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __autofill_response_group_to;
+       handle->parcelable.from = __autofill_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_destroy(rpc_port_autofill_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_response_item_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->response_items);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_clone(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_group_h *clone)
+{
+       rpc_port_autofill_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_autofill_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create autofill_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h new_value;
+                       rpc_port_autofill_response_item_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_response_item_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_add_response_items(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_item_h response_items)
+{
+       if (!h || !response_items) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_response_item_h value = NULL;
+
+               rpc_port_autofill_response_item_clone(response_items, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->response_items = g_list_append(h->response_items, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_foreach_response_items(rpc_port_autofill_response_group_h h,
+               bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_remove_response_items(rpc_port_autofill_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->response_items, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_response_item_h value = iter->data;
+       h->response_items = g_list_remove_link(h->response_items, iter);
+       rpc_port_autofill_response_item_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_get_response_items_length(rpc_port_autofill_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->response_items);
+
+       return 0;
+}
+
 struct autofill_fill_response_s {
        rpc_port_parcelable_t parcelable;
        char *view_id;
-       GList *response_items;
+       GList *response_groups;
 };
 
 static void __autofill_fill_response_to(rpc_port_parcel_h parcel, void *data)
@@ -1832,13 +2072,13 @@ static void __autofill_fill_response_to(rpc_port_parcel_h parcel, void *data)
        }
 
        rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
-       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_groups));
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -1865,16 +2105,16 @@ static void __autofill_fill_response_from(rpc_port_parcel_h parcel, void *data)
 
                rpc_port_parcel_read_array_count(parcel, &len);
                for (int i = 0; i < len; i++) {
-                       rpc_port_autofill_response_item_h value = NULL;
+                       rpc_port_autofill_response_group_h value = NULL;
 
-                       rpc_port_autofill_response_item_create(&value);
+                       rpc_port_autofill_response_group_create(&value);
                        if (!value) {
                                _E("Failed to create handle");
                                return;
                        }
 
                        rpc_port_parcel_read(parcel, &value->parcelable, value);
-                       h->response_items = g_list_append(h->response_items, value);
+                       h->response_groups = g_list_append(h->response_groups, value);
                }
        } while (0);
 }
@@ -1915,15 +2155,15 @@ int rpc_port_autofill_fill_response_destroy(rpc_port_autofill_fill_response_h h)
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h value = iter->data;
                        if (value)
-                               rpc_port_autofill_response_item_destroy(value);
+                               rpc_port_autofill_response_group_destroy(value);
 
                        iter = g_list_next(iter);
                }
-               g_list_free(h->response_items);
+               g_list_free(h->response_groups);
        } while (0);
 
        free(h);
@@ -1958,10 +2198,10 @@ int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, r
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h new_value;
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h new_value;
+                       rpc_port_autofill_response_group_h value = iter->data;
 
                        if (!value) {
                                _E("Error: value is NULL");
@@ -1969,14 +2209,14 @@ int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, r
                                return -1;
                        }
 
-                       rpc_port_autofill_response_item_clone(value, &new_value);
+                       rpc_port_autofill_response_group_clone(value, &new_value);
                        if (!new_value) {
                                _E("Failed to duplicate value");
                                rpc_port_autofill_fill_response_destroy(handle);
                                return -1;
                        }
 
-                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       handle->response_groups = g_list_append(handle->response_groups, new_value);
                        iter = g_list_next(iter);
                }
        } while (0);
@@ -2007,23 +2247,23 @@ int rpc_port_autofill_fill_response_set_view_id(rpc_port_autofill_fill_response_
        return 0;
 }
 
-int rpc_port_autofill_fill_response_add_response_items(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_item_h response_items)
+int rpc_port_autofill_fill_response_add_response_groups(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_group_h response_groups)
 {
-       if (!h || !response_items) {
+       if (!h || !response_groups) {
                _E("Invalid parameter");
                return -1;
        }
 
        do {
-               rpc_port_autofill_response_item_h value = NULL;
+               rpc_port_autofill_response_group_h value = NULL;
 
-               rpc_port_autofill_response_item_clone(response_items, &value);
+               rpc_port_autofill_response_group_clone(response_groups, &value);
                if (!value) {
                        _E("Out of memory");
                        return -1;
                }
 
-               h->response_items = g_list_append(h->response_items, value);
+               h->response_groups = g_list_append(h->response_groups, value);
        } while (0);
 
        return 0;
@@ -2050,8 +2290,8 @@ int rpc_port_autofill_fill_response_get_view_id(rpc_port_autofill_fill_response_
        return 0;
 }
 
-int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fill_response_h h,
-               bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data)
+int rpc_port_autofill_fill_response_foreach_response_groups(rpc_port_autofill_fill_response_h h,
+               bool (*callback)(rpc_port_autofill_response_group_h response_groups, void *user_data), void *user_data)
 {
        if (!h || !callback) {
                _E("Invalid parameter");
@@ -2061,9 +2301,9 @@ int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fil
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -2080,7 +2320,7 @@ int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fil
        return 0;
 }
 
-int rpc_port_autofill_fill_response_remove_response_items(rpc_port_autofill_fill_response_h h, unsigned int nth)
+int rpc_port_autofill_fill_response_remove_response_groups(rpc_port_autofill_fill_response_h h, unsigned int nth)
 {
        GList *iter;
 
@@ -2089,26 +2329,26 @@ int rpc_port_autofill_fill_response_remove_response_items(rpc_port_autofill_fill
                return -1;
        }
 
-       iter = g_list_nth(h->response_items, nth);
+       iter = g_list_nth(h->response_groups, nth);
        if (iter == NULL)
                return -1;
 
-       rpc_port_autofill_response_item_h value = iter->data;
-       h->response_items = g_list_remove_link(h->response_items, iter);
-       rpc_port_autofill_response_item_destroy(value);
+       rpc_port_autofill_response_group_h value = iter->data;
+       h->response_groups = g_list_remove_link(h->response_groups, iter);
+       rpc_port_autofill_response_group_destroy(value);
        g_list_free(iter);
 
        return 0;
 }
 
-int rpc_port_autofill_fill_response_get_response_items_length(rpc_port_autofill_fill_response_h h, unsigned int *length)
+int rpc_port_autofill_fill_response_get_response_groups_length(rpc_port_autofill_fill_response_h h, unsigned int *length)
 {
        if (!h || !length) {
                _E("Invalid parameter");
                return -1;
        }
 
-       *length = g_list_length(h->response_items);
+       *length = g_list_length(h->response_groups);
 
        return 0;
 }
@@ -2353,6 +2593,246 @@ int rpc_port_list_autofill_item_get_list_autofill_items_length(rpc_port_list_aut
        return 0;
 }
 
+struct list_autofill_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *list_autofill_response_groups;
+};
+
+static void __list_autofill_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_response_groups));
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __list_autofill_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_response_group_h value = NULL;
+
+                       rpc_port_autofill_response_group_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->list_autofill_response_groups = g_list_append(h->list_autofill_response_groups, value);
+               }
+       } while (0);
+}
+
+int rpc_port_list_autofill_response_group_create(rpc_port_list_autofill_response_group_h *h)
+{
+       struct list_autofill_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct list_autofill_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __list_autofill_response_group_to;
+       handle->parcelable.from = __list_autofill_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_destroy(rpc_port_list_autofill_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_response_group_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->list_autofill_response_groups);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_clone(rpc_port_list_autofill_response_group_h h, rpc_port_list_autofill_response_group_h *clone)
+{
+       rpc_port_list_autofill_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_list_autofill_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create list_autofill_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h new_value;
+                       rpc_port_autofill_response_group_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_list_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_response_group_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_list_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->list_autofill_response_groups = g_list_append(handle->list_autofill_response_groups, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_add_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, rpc_port_autofill_response_group_h list_autofill_response_groups)
+{
+       if (!h || !list_autofill_response_groups) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_response_group_h value = NULL;
+
+               rpc_port_autofill_response_group_clone(list_autofill_response_groups, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->list_autofill_response_groups = g_list_append(h->list_autofill_response_groups, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_foreach_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h,
+               bool (*callback)(rpc_port_autofill_response_group_h list_autofill_response_groups, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_remove_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->list_autofill_response_groups, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_response_group_h value = iter->data;
+       h->list_autofill_response_groups = g_list_remove_link(h->list_autofill_response_groups, iter);
+       rpc_port_autofill_response_group_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_get_list_autofill_response_groups_length(rpc_port_list_autofill_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->list_autofill_response_groups);
+
+       return 0;
+}
+
 struct list_autofill_response_item_s {
        rpc_port_parcelable_t parcelable;
        GList *list_autofill_response_items;
index 2d129f5..327f38c 100644 (file)
@@ -171,6 +171,23 @@ int rpc_port_autofill_response_item_get_presentation_text(rpc_port_autofill_resp
 
 int rpc_port_autofill_response_item_get_value(rpc_port_autofill_response_item_h h, char **value);
 
+typedef struct autofill_response_group_s *rpc_port_autofill_response_group_h;
+
+int rpc_port_autofill_response_group_create(rpc_port_autofill_response_group_h *h);
+
+int rpc_port_autofill_response_group_destroy(rpc_port_autofill_response_group_h h);
+
+int rpc_port_autofill_response_group_clone(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_group_h *clone);
+
+int rpc_port_autofill_response_group_add_response_items(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_item_h response_items);
+
+int rpc_port_autofill_response_group_foreach_response_items(rpc_port_autofill_response_group_h h,
+        bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data);
+
+int rpc_port_autofill_response_group_remove_response_items(rpc_port_autofill_response_group_h h, unsigned int nth);
+
+int rpc_port_autofill_response_group_get_response_items_length(rpc_port_autofill_response_group_h h, unsigned int *length);
+
 typedef struct autofill_fill_response_s *rpc_port_autofill_fill_response_h;
 
 int rpc_port_autofill_fill_response_create(rpc_port_autofill_fill_response_h *h);
@@ -181,16 +198,16 @@ int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, r
 
 int rpc_port_autofill_fill_response_set_view_id(rpc_port_autofill_fill_response_h h, const char *view_id);
 
-int rpc_port_autofill_fill_response_add_response_items(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_item_h response_items);
+int rpc_port_autofill_fill_response_add_response_groups(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_group_h response_groups);
 
 int rpc_port_autofill_fill_response_get_view_id(rpc_port_autofill_fill_response_h h, char **view_id);
 
-int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fill_response_h h,
-        bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data);
+int rpc_port_autofill_fill_response_foreach_response_groups(rpc_port_autofill_fill_response_h h,
+        bool (*callback)(rpc_port_autofill_response_group_h response_groups, void *user_data), void *user_data);
 
-int rpc_port_autofill_fill_response_remove_response_items(rpc_port_autofill_fill_response_h h, unsigned int nth);
+int rpc_port_autofill_fill_response_remove_response_groups(rpc_port_autofill_fill_response_h h, unsigned int nth);
 
-int rpc_port_autofill_fill_response_get_response_items_length(rpc_port_autofill_fill_response_h h, unsigned int *length);
+int rpc_port_autofill_fill_response_get_response_groups_length(rpc_port_autofill_fill_response_h h, unsigned int *length);
 
 typedef struct list_autofill_item_s *rpc_port_list_autofill_item_h;
 
@@ -209,6 +226,23 @@ int rpc_port_list_autofill_item_remove_list_autofill_items(rpc_port_list_autofil
 
 int rpc_port_list_autofill_item_get_list_autofill_items_length(rpc_port_list_autofill_item_h h, unsigned int *length);
 
+typedef struct list_autofill_response_group_s *rpc_port_list_autofill_response_group_h;
+
+int rpc_port_list_autofill_response_group_create(rpc_port_list_autofill_response_group_h *h);
+
+int rpc_port_list_autofill_response_group_destroy(rpc_port_list_autofill_response_group_h h);
+
+int rpc_port_list_autofill_response_group_clone(rpc_port_list_autofill_response_group_h h, rpc_port_list_autofill_response_group_h *clone);
+
+int rpc_port_list_autofill_response_group_add_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, rpc_port_autofill_response_group_h list_autofill_response_groups);
+
+int rpc_port_list_autofill_response_group_foreach_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h,
+        bool (*callback)(rpc_port_autofill_response_group_h list_autofill_response_groups, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_response_group_remove_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, unsigned int nth);
+
+int rpc_port_list_autofill_response_group_get_list_autofill_response_groups_length(rpc_port_list_autofill_response_group_h h, unsigned int *length);
+
 typedef struct list_autofill_response_item_s *rpc_port_list_autofill_response_item_h;
 
 int rpc_port_list_autofill_response_item_create(rpc_port_list_autofill_response_item_h *h);
index 67e5bf5..058e196 100644 (file)
@@ -29,8 +29,6 @@
 
 EXPORT_API int autofill_fill_response_create(autofill_fill_response_h *h)
 {
-    LOGD("autofill fill response item create");
-
     if (!h)
         return AUTOFILL_ERROR_INVALID_PARAMETER;
 
@@ -52,9 +50,9 @@ EXPORT_API int autofill_fill_response_destroy(autofill_fill_response_h h)
         free(h->view_id);
 
     // Release memory autofill fill response item list
-    autofill_fill_response_item_h it_h;
-    EINA_LIST_FREE(h->autofill_fill_response_item_list, it_h)
-        autofill_fill_response_item_destroy(it_h);
+    autofill_fill_response_group_h it_h;
+    EINA_LIST_FREE(h->autofill_fill_response_group_list, it_h)
+        autofill_fill_response_group_destroy(it_h);
 
     free(h);
 
@@ -115,35 +113,33 @@ EXPORT_API int autofill_fill_response_get_view_id(autofill_fill_response_h h, ch
     return AUTOFILL_ERROR_NONE;
 }
 
-EXPORT_API int autofill_fill_response_add_item(autofill_fill_response_h h, autofill_fill_response_item_h it)
+EXPORT_API int autofill_fill_response_add_group(autofill_fill_response_h h, autofill_fill_response_group_h it)
 {
     if (!h || !it)
         return AUTOFILL_ERROR_INVALID_PARAMETER;
 
-    LOGD("autofill fill response item : %p", it);
-
-    autofill_fill_response_item_h clone;
-    autofill_fill_response_item_clone(it, &clone);
+    autofill_fill_response_group_h clone;
+    autofill_fill_response_group_clone(it, &clone);
     if (!clone) {
         LOGW("Out of memory");
         return AUTOFILL_ERROR_OUT_OF_MEMORY;
     }
 
-    h->autofill_fill_response_item_list = eina_list_append(h->autofill_fill_response_item_list, clone);
+    h->autofill_fill_response_group_list = eina_list_append(h->autofill_fill_response_group_list, clone);
 
     return AUTOFILL_ERROR_NONE;
 }
 
-EXPORT_API int autofill_fill_response_foreach_items(autofill_fill_response_h h,
-        bool (*callback)(autofill_fill_response_item_h item, void *user_data), void *user_data)
+EXPORT_API int autofill_fill_response_foreach_groups(autofill_fill_response_h h,
+        bool (*callback)(autofill_fill_response_group_h item, void *user_data), void *user_data)
 {
     if (!h || !callback) {
         return AUTOFILL_ERROR_INVALID_PARAMETER;
     }
 
     Eina_List *l;
-    autofill_fill_response_item_h it;
-    EINA_LIST_FOREACH(h->autofill_fill_response_item_list, l, it)
+    autofill_fill_response_group_h it;
+    EINA_LIST_FOREACH(h->autofill_fill_response_group_list, l, it)
     {
         bool ret = callback(it, user_data);
         if (!ret)
@@ -152,3 +148,13 @@ EXPORT_API int autofill_fill_response_foreach_items(autofill_fill_response_h h,
 
     return 0;
 }
+
+EXPORT_API int autofill_fill_response_get_group_count(autofill_fill_response_h h, int *count)
+{
+    if (!h || !count)
+        return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+    *count = eina_list_count(h->autofill_fill_response_group_list);
+
+    return AUTOFILL_ERROR_NONE;
+}
diff --git a/common/autofill_fill_response_group.c b/common/autofill_fill_response_group.c
new file mode 100644 (file)
index 0000000..34e10ec
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlog.h>
+#include <unistd.h>
+#include "autofill_private.h"
+#include <autofill_common.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AUTOFILL"
+
+EXPORT_API int autofill_fill_response_group_create(autofill_fill_response_group_h *h)
+{
+    if (!h)
+        return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+    autofill_fill_response_group_h ri = (autofill_fill_response_group_h)calloc(1, sizeof(struct autofill_fill_response_group_s));
+    if (!ri)
+        return AUTOFILL_ERROR_OUT_OF_MEMORY;
+
+    *h = (autofill_fill_response_group_h)ri;
+
+    return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_fill_response_group_destroy(autofill_fill_response_group_h h)
+{
+    if (!h)
+        return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+    // Release memory autofill fill response item list
+    autofill_fill_response_item_h it_h;
+    EINA_LIST_FREE(h->autofill_fill_response_item_list, it_h)
+        autofill_fill_response_item_destroy(it_h);
+
+    free(h);
+
+    return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_fill_response_group_clone(autofill_fill_response_group_h h, autofill_fill_response_group_h *clone)
+{
+    autofill_fill_response_group_h handle;
+
+    if (!h || !clone) {
+        LOGW("Invalid parameter");
+        return AUTOFILL_ERROR_INVALID_PARAMETER;
+    }
+
+    autofill_fill_response_group_create(&handle);
+    if (!handle) {
+        LOGW("Failed to create autofill_item handle");
+        return AUTOFILL_ERROR_OPERATION_FAILED;
+    }
+
+    Eina_List *l;
+    autofill_fill_response_item_h it_h;
+    autofill_fill_response_item_h new_it_h;
+    EINA_LIST_FOREACH(h->autofill_fill_response_item_list, l, it_h)
+    {
+        if (!it_h) {
+            LOGW("Can't get response item");
+            autofill_fill_response_group_destroy(handle);
+            return AUTOFILL_ERROR_OPERATION_FAILED;
+        }
+
+        autofill_fill_response_item_clone(it_h, &new_it_h);
+        if (!new_it_h) {
+            LOGW("Failed to duplicate reponse item");
+            autofill_fill_response_group_destroy(handle);
+            return AUTOFILL_ERROR_OPERATION_FAILED;
+        }
+
+        handle->autofill_fill_response_item_list = eina_list_append(handle->autofill_fill_response_item_list, new_it_h);
+    }
+
+    *clone = handle;
+
+    return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_fill_response_group_add_item(autofill_fill_response_group_h h, autofill_fill_response_item_h it)
+{
+    if (!h || !it)
+        return AUTOFILL_ERROR_INVALID_PARAMETER;
+
+    autofill_fill_response_item_h clone;
+    autofill_fill_response_item_clone(it, &clone);
+    if (!clone) {
+        LOGW("Out of memory");
+        return AUTOFILL_ERROR_OUT_OF_MEMORY;
+    }
+
+    h->autofill_fill_response_item_list = eina_list_append(h->autofill_fill_response_item_list, clone);
+
+    return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_fill_response_group_foreach_items(autofill_fill_response_group_h h,
+        bool (*callback)(autofill_fill_response_item_h item, void *user_data), void *user_data)
+{
+    if (!h || !callback) {
+        return AUTOFILL_ERROR_INVALID_PARAMETER;
+    }
+
+    Eina_List *l;
+    autofill_fill_response_item_h it;
+    EINA_LIST_FOREACH(h->autofill_fill_response_item_list, l, it)
+    {
+        bool ret = callback(it, user_data);
+        if (!ret)
+            break;
+    }
+
+    return 0;
+}
index b3755e8..921891c 100644 (file)
@@ -56,6 +56,7 @@ typedef struct autofill_item_s *autofill_item_h;
 typedef struct autofill_auth_info_s *autofill_auth_info_h;
 typedef struct autofill_view_info_s *autofill_view_info_h;
 typedef struct autofill_fill_response_s *autofill_fill_response_h;
+typedef struct autofill_fill_response_group_s *autofill_fill_response_group_h;
 typedef struct autofill_response_item_s *autofill_fill_response_item_h;
 typedef struct autofill_save_item_s *autofill_save_item_h;
 typedef struct autofill_save_view_info_s *autofill_save_view_info_h;
@@ -635,6 +636,85 @@ int autofill_fill_response_set_view_id(autofill_fill_response_h h, const char *v
 int autofill_fill_response_get_view_id(autofill_fill_response_h h, char **view_id);
 
 /**
+ * @brief Add autofill fill response group
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_fill_response_add_group(autofill_fill_response_h h, autofill_fill_response_group_h it);
+
+/**
+ * @brief Retrieve all groups of each fill response
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_fill_response_foreach_groups(autofill_fill_response_h h, bool (*callback)(autofill_fill_response_group_h item, void *user_data), void *user_data);
+
+/**
+ * @brief Get the number of fill response group
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_fill_response_get_group_count(autofill_fill_response_h h, int *count);
+
+/**
+ * @brief Create autofill fill response group
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUTOFILL_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int autofill_fill_response_group_create(autofill_fill_response_group_h *h);
+
+/**
+ * @brief Destroy autofill fill response group
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_fill_response_group_destroy(autofill_fill_response_group_h h);
+
+/**
+ * @brief Clone autofill fill response group
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_fill_response_group_clone(autofill_fill_response_group_h h, autofill_fill_response_group_h *clone);
+
+/**
  * @brief Add autofill item
  *
  * @since_tizen 5.5
@@ -643,8 +723,23 @@ int autofill_fill_response_get_view_id(autofill_fill_response_h h, char **view_i
  *
  * @return 0 on success, otherwise a negative error value
  * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUTOFILL_ERROR_OUT_OF_MEMORY Out of memory
  */
-int autofill_fill_response_add_item(autofill_fill_response_h h, autofill_fill_response_item_h it);
+int autofill_fill_response_group_add_item(autofill_fill_response_group_h h, autofill_fill_response_item_h it);
+
+/**
+ * @brief Retrieve all fill response items of each group
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUTOFILL_ERROR_NONE No error
+ */
+int autofill_fill_response_group_foreach_items(autofill_fill_response_group_h h, bool (*callback)(autofill_fill_response_item_h item, void *user_data), void *user_data);
 
 // fill response item
 /**
@@ -755,8 +850,6 @@ int autofill_fill_response_item_set_presentation_text(autofill_fill_response_ite
  */
 int autofill_fill_response_item_get_presentation_text(autofill_fill_response_item_h it, char ** presentation_text);
 
-int autofill_fill_response_foreach_items(autofill_fill_response_h h, bool (*callback)(autofill_fill_response_item_h item, void *user_data), void *user_data);
-
 // save item
 /**
  * @brief Create autofill save item
index 47f1ac0..a552da0 100644 (file)
@@ -35,6 +35,10 @@ struct autofill_save_view_info_s {
 struct autofill_fill_response_s {
     char *app_id; // app ID
     char *view_id; // view unique ID
+    Eina_List *autofill_fill_response_group_list; // autofill_fill_response_group_h list
+};
+
+struct autofill_fill_response_group_s {
     Eina_List *autofill_fill_response_item_list; // autofill_fill_response_item_h list
 };
 
index 0c31104..bcda662 100644 (file)
@@ -1930,11 +1930,251 @@ int rpc_port_autofill_svc_response_item_get_value(rpc_port_autofill_svc_response
        return 0;
 }
 
+struct autofill_svc_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *response_items;
+};
+
+static void __autofill_svc_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __autofill_svc_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_svc_response_item_h value = NULL;
+
+                       rpc_port_autofill_svc_response_item_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->response_items = g_list_append(h->response_items, value);
+               }
+       } while (0);
+}
+
+int rpc_port_autofill_svc_response_group_create(rpc_port_autofill_svc_response_group_h *h)
+{
+       struct autofill_svc_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct autofill_svc_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __autofill_svc_response_group_to;
+       handle->parcelable.from = __autofill_svc_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_destroy(rpc_port_autofill_svc_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_svc_response_item_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->response_items);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_clone(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h *clone)
+{
+       rpc_port_autofill_svc_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_autofill_svc_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create autofill_svc_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h new_value;
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_svc_response_item_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_add_response_items(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_item_h response_items)
+{
+       if (!h || !response_items) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_svc_response_item_h value = NULL;
+
+               rpc_port_autofill_svc_response_item_clone(response_items, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->response_items = g_list_append(h->response_items, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_foreach_response_items(rpc_port_autofill_svc_response_group_h h,
+               bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_remove_response_items(rpc_port_autofill_svc_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->response_items, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_svc_response_item_h value = iter->data;
+       h->response_items = g_list_remove_link(h->response_items, iter);
+       rpc_port_autofill_svc_response_item_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_get_response_items_length(rpc_port_autofill_svc_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->response_items);
+
+       return 0;
+}
+
 struct autofill_svc_fill_response_s {
        rpc_port_parcelable_t parcelable;
        char *app_id;
        char *view_id;
-       GList *response_items;
+       GList *response_groups;
 };
 
 static void __autofill_svc_fill_response_to(rpc_port_parcel_h parcel, void *data)
@@ -1948,13 +2188,13 @@ static void __autofill_svc_fill_response_to(rpc_port_parcel_h parcel, void *data
 
        rpc_port_parcel_write_string(parcel, h->app_id ? h->app_id : "");
        rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
-       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_groups));
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -1982,16 +2222,16 @@ static void __autofill_svc_fill_response_from(rpc_port_parcel_h parcel, void *da
 
                rpc_port_parcel_read_array_count(parcel, &len);
                for (int i = 0; i < len; i++) {
-                       rpc_port_autofill_svc_response_item_h value = NULL;
+                       rpc_port_autofill_svc_response_group_h value = NULL;
 
-                       rpc_port_autofill_svc_response_item_create(&value);
+                       rpc_port_autofill_svc_response_group_create(&value);
                        if (!value) {
                                _E("Failed to create handle");
                                return;
                        }
 
                        rpc_port_parcel_read(parcel, &value->parcelable, value);
-                       h->response_items = g_list_append(h->response_items, value);
+                       h->response_groups = g_list_append(h->response_groups, value);
                }
        } while (0);
 }
@@ -2035,15 +2275,15 @@ int rpc_port_autofill_svc_fill_response_destroy(rpc_port_autofill_svc_fill_respo
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
                        if (value)
-                               rpc_port_autofill_svc_response_item_destroy(value);
+                               rpc_port_autofill_svc_response_group_destroy(value);
 
                        iter = g_list_next(iter);
                }
-               g_list_free(h->response_items);
+               g_list_free(h->response_groups);
        } while (0);
 
        free(h);
@@ -2087,10 +2327,10 @@ int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_respons
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h new_value;
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h new_value;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
 
                        if (!value) {
                                _E("Error: value is NULL");
@@ -2098,14 +2338,14 @@ int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_respons
                                return -1;
                        }
 
-                       rpc_port_autofill_svc_response_item_clone(value, &new_value);
+                       rpc_port_autofill_svc_response_group_clone(value, &new_value);
                        if (!new_value) {
                                _E("Failed to duplicate value");
                                rpc_port_autofill_svc_fill_response_destroy(handle);
                                return -1;
                        }
 
-                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       handle->response_groups = g_list_append(handle->response_groups, new_value);
                        iter = g_list_next(iter);
                }
        } while (0);
@@ -2157,23 +2397,23 @@ int rpc_port_autofill_svc_fill_response_set_view_id(rpc_port_autofill_svc_fill_r
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_add_response_items(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_item_h response_items)
+int rpc_port_autofill_svc_fill_response_add_response_groups(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_group_h response_groups)
 {
-       if (!h || !response_items) {
+       if (!h || !response_groups) {
                _E("Invalid parameter");
                return -1;
        }
 
        do {
-               rpc_port_autofill_svc_response_item_h value = NULL;
+               rpc_port_autofill_svc_response_group_h value = NULL;
 
-               rpc_port_autofill_svc_response_item_clone(response_items, &value);
+               rpc_port_autofill_svc_response_group_clone(response_groups, &value);
                if (!value) {
                        _E("Out of memory");
                        return -1;
                }
 
-               h->response_items = g_list_append(h->response_items, value);
+               h->response_groups = g_list_append(h->response_groups, value);
        } while (0);
 
        return 0;
@@ -2221,8 +2461,8 @@ int rpc_port_autofill_svc_fill_response_get_view_id(rpc_port_autofill_svc_fill_r
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill_svc_fill_response_h h,
-               bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data)
+int rpc_port_autofill_svc_fill_response_foreach_response_groups(rpc_port_autofill_svc_fill_response_h h,
+               bool (*callback)(rpc_port_autofill_svc_response_group_h response_groups, void *user_data), void *user_data)
 {
        if (!h || !callback) {
                _E("Invalid parameter");
@@ -2232,9 +2472,9 @@ int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -2251,7 +2491,7 @@ int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_remove_response_items(rpc_port_autofill_svc_fill_response_h h, unsigned int nth)
+int rpc_port_autofill_svc_fill_response_remove_response_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth)
 {
        GList *iter;
 
@@ -2260,26 +2500,26 @@ int rpc_port_autofill_svc_fill_response_remove_response_items(rpc_port_autofill_
                return -1;
        }
 
-       iter = g_list_nth(h->response_items, nth);
+       iter = g_list_nth(h->response_groups, nth);
        if (iter == NULL)
                return -1;
 
-       rpc_port_autofill_svc_response_item_h value = iter->data;
-       h->response_items = g_list_remove_link(h->response_items, iter);
-       rpc_port_autofill_svc_response_item_destroy(value);
+       rpc_port_autofill_svc_response_group_h value = iter->data;
+       h->response_groups = g_list_remove_link(h->response_groups, iter);
+       rpc_port_autofill_svc_response_group_destroy(value);
        g_list_free(iter);
 
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_get_response_items_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length)
+int rpc_port_autofill_svc_fill_response_get_response_groups_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length)
 {
        if (!h || !length) {
                _E("Invalid parameter");
                return -1;
        }
 
-       *length = g_list_length(h->response_items);
+       *length = g_list_length(h->response_groups);
 
        return 0;
 }
@@ -2524,6 +2764,246 @@ int rpc_port_list_autofill_svc_item_get_list_autofill_svc_items_length(rpc_port_
        return 0;
 }
 
+struct list_autofill_svc_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *list_autofill_svc_response_groups;
+};
+
+static void __list_autofill_svc_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_response_groups));
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __list_autofill_svc_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_svc_response_group_h value = NULL;
+
+                       rpc_port_autofill_svc_response_group_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->list_autofill_svc_response_groups = g_list_append(h->list_autofill_svc_response_groups, value);
+               }
+       } while (0);
+}
+
+int rpc_port_list_autofill_svc_response_group_create(rpc_port_list_autofill_svc_response_group_h *h)
+{
+       struct list_autofill_svc_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct list_autofill_svc_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __list_autofill_svc_response_group_to;
+       handle->parcelable.from = __list_autofill_svc_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_destroy(rpc_port_list_autofill_svc_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_svc_response_group_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->list_autofill_svc_response_groups);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_clone(rpc_port_list_autofill_svc_response_group_h h, rpc_port_list_autofill_svc_response_group_h *clone)
+{
+       rpc_port_list_autofill_svc_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_list_autofill_svc_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create list_autofill_svc_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h new_value;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_list_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_svc_response_group_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_list_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->list_autofill_svc_response_groups = g_list_append(handle->list_autofill_svc_response_groups, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_add_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups)
+{
+       if (!h || !list_autofill_svc_response_groups) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_svc_response_group_h value = NULL;
+
+               rpc_port_autofill_svc_response_group_clone(list_autofill_svc_response_groups, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->list_autofill_svc_response_groups = g_list_append(h->list_autofill_svc_response_groups, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_foreach_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h,
+               bool (*callback)(rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_remove_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->list_autofill_svc_response_groups, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_svc_response_group_h value = iter->data;
+       h->list_autofill_svc_response_groups = g_list_remove_link(h->list_autofill_svc_response_groups, iter);
+       rpc_port_autofill_svc_response_group_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_get_list_autofill_svc_response_groups_length(rpc_port_list_autofill_svc_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->list_autofill_svc_response_groups);
+
+       return 0;
+}
+
 struct list_autofill_svc_response_item_s {
        rpc_port_parcelable_t parcelable;
        GList *list_autofill_svc_response_items;
index 604047b..c01ab22 100644 (file)
@@ -179,6 +179,23 @@ int rpc_port_autofill_svc_response_item_get_presentation_text(rpc_port_autofill_
 
 int rpc_port_autofill_svc_response_item_get_value(rpc_port_autofill_svc_response_item_h h, char **value);
 
+typedef struct autofill_svc_response_group_s *rpc_port_autofill_svc_response_group_h;
+
+int rpc_port_autofill_svc_response_group_create(rpc_port_autofill_svc_response_group_h *h);
+
+int rpc_port_autofill_svc_response_group_destroy(rpc_port_autofill_svc_response_group_h h);
+
+int rpc_port_autofill_svc_response_group_clone(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h *clone);
+
+int rpc_port_autofill_svc_response_group_add_response_items(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_item_h response_items);
+
+int rpc_port_autofill_svc_response_group_foreach_response_items(rpc_port_autofill_svc_response_group_h h,
+        bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data);
+
+int rpc_port_autofill_svc_response_group_remove_response_items(rpc_port_autofill_svc_response_group_h h, unsigned int nth);
+
+int rpc_port_autofill_svc_response_group_get_response_items_length(rpc_port_autofill_svc_response_group_h h, unsigned int *length);
+
 typedef struct autofill_svc_fill_response_s *rpc_port_autofill_svc_fill_response_h;
 
 int rpc_port_autofill_svc_fill_response_create(rpc_port_autofill_svc_fill_response_h *h);
@@ -191,18 +208,18 @@ int rpc_port_autofill_svc_fill_response_set_app_id(rpc_port_autofill_svc_fill_re
 
 int rpc_port_autofill_svc_fill_response_set_view_id(rpc_port_autofill_svc_fill_response_h h, const char *view_id);
 
-int rpc_port_autofill_svc_fill_response_add_response_items(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_item_h response_items);
+int rpc_port_autofill_svc_fill_response_add_response_groups(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_group_h response_groups);
 
 int rpc_port_autofill_svc_fill_response_get_app_id(rpc_port_autofill_svc_fill_response_h h, char **app_id);
 
 int rpc_port_autofill_svc_fill_response_get_view_id(rpc_port_autofill_svc_fill_response_h h, char **view_id);
 
-int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill_svc_fill_response_h h,
-        bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data);
+int rpc_port_autofill_svc_fill_response_foreach_response_groups(rpc_port_autofill_svc_fill_response_h h,
+        bool (*callback)(rpc_port_autofill_svc_response_group_h response_groups, void *user_data), void *user_data);
 
-int rpc_port_autofill_svc_fill_response_remove_response_items(rpc_port_autofill_svc_fill_response_h h, unsigned int nth);
+int rpc_port_autofill_svc_fill_response_remove_response_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth);
 
-int rpc_port_autofill_svc_fill_response_get_response_items_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length);
+int rpc_port_autofill_svc_fill_response_get_response_groups_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length);
 
 typedef struct list_autofill_svc_item_s *rpc_port_list_autofill_svc_item_h;
 
@@ -221,6 +238,23 @@ int rpc_port_list_autofill_svc_item_remove_list_autofill_svc_items(rpc_port_list
 
 int rpc_port_list_autofill_svc_item_get_list_autofill_svc_items_length(rpc_port_list_autofill_svc_item_h h, unsigned int *length);
 
+typedef struct list_autofill_svc_response_group_s *rpc_port_list_autofill_svc_response_group_h;
+
+int rpc_port_list_autofill_svc_response_group_create(rpc_port_list_autofill_svc_response_group_h *h);
+
+int rpc_port_list_autofill_svc_response_group_destroy(rpc_port_list_autofill_svc_response_group_h h);
+
+int rpc_port_list_autofill_svc_response_group_clone(rpc_port_list_autofill_svc_response_group_h h, rpc_port_list_autofill_svc_response_group_h *clone);
+
+int rpc_port_list_autofill_svc_response_group_add_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups);
+
+int rpc_port_list_autofill_svc_response_group_foreach_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h,
+        bool (*callback)(rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_svc_response_group_remove_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, unsigned int nth);
+
+int rpc_port_list_autofill_svc_response_group_get_list_autofill_svc_response_groups_length(rpc_port_list_autofill_svc_response_group_h h, unsigned int *length);
+
 typedef struct list_autofill_svc_response_item_s *rpc_port_list_autofill_svc_response_item_h;
 
 int rpc_port_list_autofill_svc_response_item_create(rpc_port_list_autofill_svc_response_item_h *h);
index 2c9de73..f4a93a4 100644 (file)
@@ -1816,10 +1816,250 @@ int rpc_port_autofill_response_item_get_value(rpc_port_autofill_response_item_h
        return 0;
 }
 
+struct autofill_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *response_items;
+};
+
+static void __autofill_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __autofill_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_response_item_h value = NULL;
+
+                       rpc_port_autofill_response_item_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->response_items = g_list_append(h->response_items, value);
+               }
+       } while (0);
+}
+
+int rpc_port_autofill_response_group_create(rpc_port_autofill_response_group_h *h)
+{
+       struct autofill_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct autofill_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __autofill_response_group_to;
+       handle->parcelable.from = __autofill_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_destroy(rpc_port_autofill_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_response_item_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->response_items);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_clone(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_group_h *clone)
+{
+       rpc_port_autofill_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_autofill_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create autofill_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h new_value;
+                       rpc_port_autofill_response_item_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_response_item_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_add_response_items(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_item_h response_items)
+{
+       if (!h || !response_items) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_response_item_h value = NULL;
+
+               rpc_port_autofill_response_item_clone(response_items, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->response_items = g_list_append(h->response_items, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_foreach_response_items(rpc_port_autofill_response_group_h h,
+               bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_remove_response_items(rpc_port_autofill_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->response_items, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_response_item_h value = iter->data;
+       h->response_items = g_list_remove_link(h->response_items, iter);
+       rpc_port_autofill_response_item_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_autofill_response_group_get_response_items_length(rpc_port_autofill_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->response_items);
+
+       return 0;
+}
+
 struct autofill_fill_response_s {
        rpc_port_parcelable_t parcelable;
        char *view_id;
-       GList *response_items;
+       GList *response_groups;
 };
 
 static void __autofill_fill_response_to(rpc_port_parcel_h parcel, void *data)
@@ -1832,13 +2072,13 @@ static void __autofill_fill_response_to(rpc_port_parcel_h parcel, void *data)
        }
 
        rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
-       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_groups));
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -1865,16 +2105,16 @@ static void __autofill_fill_response_from(rpc_port_parcel_h parcel, void *data)
 
                rpc_port_parcel_read_array_count(parcel, &len);
                for (int i = 0; i < len; i++) {
-                       rpc_port_autofill_response_item_h value = NULL;
+                       rpc_port_autofill_response_group_h value = NULL;
 
-                       rpc_port_autofill_response_item_create(&value);
+                       rpc_port_autofill_response_group_create(&value);
                        if (!value) {
                                _E("Failed to create handle");
                                return;
                        }
 
                        rpc_port_parcel_read(parcel, &value->parcelable, value);
-                       h->response_items = g_list_append(h->response_items, value);
+                       h->response_groups = g_list_append(h->response_groups, value);
                }
        } while (0);
 }
@@ -1915,15 +2155,15 @@ int rpc_port_autofill_fill_response_destroy(rpc_port_autofill_fill_response_h h)
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h value = iter->data;
                        if (value)
-                               rpc_port_autofill_response_item_destroy(value);
+                               rpc_port_autofill_response_group_destroy(value);
 
                        iter = g_list_next(iter);
                }
-               g_list_free(h->response_items);
+               g_list_free(h->response_groups);
        } while (0);
 
        free(h);
@@ -1958,10 +2198,10 @@ int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, r
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h new_value;
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h new_value;
+                       rpc_port_autofill_response_group_h value = iter->data;
 
                        if (!value) {
                                _E("Error: value is NULL");
@@ -1969,14 +2209,14 @@ int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, r
                                return -1;
                        }
 
-                       rpc_port_autofill_response_item_clone(value, &new_value);
+                       rpc_port_autofill_response_group_clone(value, &new_value);
                        if (!new_value) {
                                _E("Failed to duplicate value");
                                rpc_port_autofill_fill_response_destroy(handle);
                                return -1;
                        }
 
-                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       handle->response_groups = g_list_append(handle->response_groups, new_value);
                        iter = g_list_next(iter);
                }
        } while (0);
@@ -2007,23 +2247,23 @@ int rpc_port_autofill_fill_response_set_view_id(rpc_port_autofill_fill_response_
        return 0;
 }
 
-int rpc_port_autofill_fill_response_add_response_items(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_item_h response_items)
+int rpc_port_autofill_fill_response_add_response_groups(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_group_h response_groups)
 {
-       if (!h || !response_items) {
+       if (!h || !response_groups) {
                _E("Invalid parameter");
                return -1;
        }
 
        do {
-               rpc_port_autofill_response_item_h value = NULL;
+               rpc_port_autofill_response_group_h value = NULL;
 
-               rpc_port_autofill_response_item_clone(response_items, &value);
+               rpc_port_autofill_response_group_clone(response_groups, &value);
                if (!value) {
                        _E("Out of memory");
                        return -1;
                }
 
-               h->response_items = g_list_append(h->response_items, value);
+               h->response_groups = g_list_append(h->response_groups, value);
        } while (0);
 
        return 0;
@@ -2050,8 +2290,8 @@ int rpc_port_autofill_fill_response_get_view_id(rpc_port_autofill_fill_response_
        return 0;
 }
 
-int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fill_response_h h,
-               bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data)
+int rpc_port_autofill_fill_response_foreach_response_groups(rpc_port_autofill_fill_response_h h,
+               bool (*callback)(rpc_port_autofill_response_group_h response_groups, void *user_data), void *user_data)
 {
        if (!h || !callback) {
                _E("Invalid parameter");
@@ -2061,9 +2301,9 @@ int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fil
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_response_item_h value = iter->data;
+                       rpc_port_autofill_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -2080,7 +2320,7 @@ int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fil
        return 0;
 }
 
-int rpc_port_autofill_fill_response_remove_response_items(rpc_port_autofill_fill_response_h h, unsigned int nth)
+int rpc_port_autofill_fill_response_remove_response_groups(rpc_port_autofill_fill_response_h h, unsigned int nth)
 {
        GList *iter;
 
@@ -2089,26 +2329,26 @@ int rpc_port_autofill_fill_response_remove_response_items(rpc_port_autofill_fill
                return -1;
        }
 
-       iter = g_list_nth(h->response_items, nth);
+       iter = g_list_nth(h->response_groups, nth);
        if (iter == NULL)
                return -1;
 
-       rpc_port_autofill_response_item_h value = iter->data;
-       h->response_items = g_list_remove_link(h->response_items, iter);
-       rpc_port_autofill_response_item_destroy(value);
+       rpc_port_autofill_response_group_h value = iter->data;
+       h->response_groups = g_list_remove_link(h->response_groups, iter);
+       rpc_port_autofill_response_group_destroy(value);
        g_list_free(iter);
 
        return 0;
 }
 
-int rpc_port_autofill_fill_response_get_response_items_length(rpc_port_autofill_fill_response_h h, unsigned int *length)
+int rpc_port_autofill_fill_response_get_response_groups_length(rpc_port_autofill_fill_response_h h, unsigned int *length)
 {
        if (!h || !length) {
                _E("Invalid parameter");
                return -1;
        }
 
-       *length = g_list_length(h->response_items);
+       *length = g_list_length(h->response_groups);
 
        return 0;
 }
@@ -2353,6 +2593,246 @@ int rpc_port_list_autofill_item_get_list_autofill_items_length(rpc_port_list_aut
        return 0;
 }
 
+struct list_autofill_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *list_autofill_response_groups;
+};
+
+static void __list_autofill_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_response_groups));
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __list_autofill_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_response_group_h value = NULL;
+
+                       rpc_port_autofill_response_group_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->list_autofill_response_groups = g_list_append(h->list_autofill_response_groups, value);
+               }
+       } while (0);
+}
+
+int rpc_port_list_autofill_response_group_create(rpc_port_list_autofill_response_group_h *h)
+{
+       struct list_autofill_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct list_autofill_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __list_autofill_response_group_to;
+       handle->parcelable.from = __list_autofill_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_destroy(rpc_port_list_autofill_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_response_group_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->list_autofill_response_groups);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_clone(rpc_port_list_autofill_response_group_h h, rpc_port_list_autofill_response_group_h *clone)
+{
+       rpc_port_list_autofill_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_list_autofill_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create list_autofill_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h new_value;
+                       rpc_port_autofill_response_group_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_list_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_response_group_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_list_autofill_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->list_autofill_response_groups = g_list_append(handle->list_autofill_response_groups, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_add_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, rpc_port_autofill_response_group_h list_autofill_response_groups)
+{
+       if (!h || !list_autofill_response_groups) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_response_group_h value = NULL;
+
+               rpc_port_autofill_response_group_clone(list_autofill_response_groups, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->list_autofill_response_groups = g_list_append(h->list_autofill_response_groups, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_foreach_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h,
+               bool (*callback)(rpc_port_autofill_response_group_h list_autofill_response_groups, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_response_groups;
+               while (iter) {
+                       rpc_port_autofill_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_remove_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->list_autofill_response_groups, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_response_group_h value = iter->data;
+       h->list_autofill_response_groups = g_list_remove_link(h->list_autofill_response_groups, iter);
+       rpc_port_autofill_response_group_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_response_group_get_list_autofill_response_groups_length(rpc_port_list_autofill_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->list_autofill_response_groups);
+
+       return 0;
+}
+
 struct list_autofill_response_item_s {
        rpc_port_parcelable_t parcelable;
        GList *list_autofill_response_items;
index 132cf3f..f19b2d9 100644 (file)
@@ -171,6 +171,23 @@ int rpc_port_autofill_response_item_get_presentation_text(rpc_port_autofill_resp
 
 int rpc_port_autofill_response_item_get_value(rpc_port_autofill_response_item_h h, char **value);
 
+typedef struct autofill_response_group_s *rpc_port_autofill_response_group_h;
+
+int rpc_port_autofill_response_group_create(rpc_port_autofill_response_group_h *h);
+
+int rpc_port_autofill_response_group_destroy(rpc_port_autofill_response_group_h h);
+
+int rpc_port_autofill_response_group_clone(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_group_h *clone);
+
+int rpc_port_autofill_response_group_add_response_items(rpc_port_autofill_response_group_h h, rpc_port_autofill_response_item_h response_items);
+
+int rpc_port_autofill_response_group_foreach_response_items(rpc_port_autofill_response_group_h h,
+        bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data);
+
+int rpc_port_autofill_response_group_remove_response_items(rpc_port_autofill_response_group_h h, unsigned int nth);
+
+int rpc_port_autofill_response_group_get_response_items_length(rpc_port_autofill_response_group_h h, unsigned int *length);
+
 typedef struct autofill_fill_response_s *rpc_port_autofill_fill_response_h;
 
 int rpc_port_autofill_fill_response_create(rpc_port_autofill_fill_response_h *h);
@@ -181,16 +198,16 @@ int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, r
 
 int rpc_port_autofill_fill_response_set_view_id(rpc_port_autofill_fill_response_h h, const char *view_id);
 
-int rpc_port_autofill_fill_response_add_response_items(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_item_h response_items);
+int rpc_port_autofill_fill_response_add_response_groups(rpc_port_autofill_fill_response_h h, rpc_port_autofill_response_group_h response_groups);
 
 int rpc_port_autofill_fill_response_get_view_id(rpc_port_autofill_fill_response_h h, char **view_id);
 
-int rpc_port_autofill_fill_response_foreach_response_items(rpc_port_autofill_fill_response_h h,
-        bool (*callback)(rpc_port_autofill_response_item_h response_items, void *user_data), void *user_data);
+int rpc_port_autofill_fill_response_foreach_response_groups(rpc_port_autofill_fill_response_h h,
+        bool (*callback)(rpc_port_autofill_response_group_h response_groups, void *user_data), void *user_data);
 
-int rpc_port_autofill_fill_response_remove_response_items(rpc_port_autofill_fill_response_h h, unsigned int nth);
+int rpc_port_autofill_fill_response_remove_response_groups(rpc_port_autofill_fill_response_h h, unsigned int nth);
 
-int rpc_port_autofill_fill_response_get_response_items_length(rpc_port_autofill_fill_response_h h, unsigned int *length);
+int rpc_port_autofill_fill_response_get_response_groups_length(rpc_port_autofill_fill_response_h h, unsigned int *length);
 
 typedef struct list_autofill_item_s *rpc_port_list_autofill_item_h;
 
@@ -209,6 +226,23 @@ int rpc_port_list_autofill_item_remove_list_autofill_items(rpc_port_list_autofil
 
 int rpc_port_list_autofill_item_get_list_autofill_items_length(rpc_port_list_autofill_item_h h, unsigned int *length);
 
+typedef struct list_autofill_response_group_s *rpc_port_list_autofill_response_group_h;
+
+int rpc_port_list_autofill_response_group_create(rpc_port_list_autofill_response_group_h *h);
+
+int rpc_port_list_autofill_response_group_destroy(rpc_port_list_autofill_response_group_h h);
+
+int rpc_port_list_autofill_response_group_clone(rpc_port_list_autofill_response_group_h h, rpc_port_list_autofill_response_group_h *clone);
+
+int rpc_port_list_autofill_response_group_add_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, rpc_port_autofill_response_group_h list_autofill_response_groups);
+
+int rpc_port_list_autofill_response_group_foreach_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h,
+        bool (*callback)(rpc_port_autofill_response_group_h list_autofill_response_groups, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_response_group_remove_list_autofill_response_groups(rpc_port_list_autofill_response_group_h h, unsigned int nth);
+
+int rpc_port_list_autofill_response_group_get_list_autofill_response_groups_length(rpc_port_list_autofill_response_group_h h, unsigned int *length);
+
 typedef struct list_autofill_response_item_s *rpc_port_list_autofill_response_item_h;
 
 int rpc_port_list_autofill_response_item_create(rpc_port_list_autofill_response_item_h *h);
index f706ef0..c1b5df1 100644 (file)
@@ -405,9 +405,7 @@ static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, rpc_port
 
 bool fill_response_item_cb(rpc_port_autofill_svc_response_item_h response_items, void *user_data)
 {
-    //autofill_fill_response_s *fill_response = (autofill_fill_response_s *)user_data;
-
-    rpc_port_autofill_fill_response_h svi = (rpc_port_autofill_fill_response_h)user_data;
+    rpc_port_autofill_response_group_h res_group = (rpc_port_autofill_response_group_h)user_data;
 
     char *id = NULL;
     char *presentation_text = NULL;
@@ -428,7 +426,7 @@ bool fill_response_item_cb(rpc_port_autofill_svc_response_item_h response_items,
 
     LOGD("id : %s, presentation text : %s, value : %s", id, presentation_text, value);
 
-    rpc_port_autofill_fill_response_add_response_items(svi, res_item);
+    rpc_port_autofill_response_group_add_response_items(res_group, res_item);
 
     if (id)
         free(id);
@@ -444,6 +442,22 @@ bool fill_response_item_cb(rpc_port_autofill_svc_response_item_h response_items,
     return true;
 }
 
+bool fill_response_group_cb(rpc_port_autofill_svc_response_group_h response_groups, void *user_data)
+{
+    rpc_port_autofill_fill_response_h fr_h = (rpc_port_autofill_fill_response_h)user_data;
+
+    rpc_port_autofill_response_group_h res_group;
+    rpc_port_autofill_response_group_create(&res_group);
+
+    rpc_port_autofill_svc_response_group_foreach_response_items(response_groups, fill_response_item_cb, res_group);
+
+    rpc_port_autofill_fill_response_add_response_groups(fr_h, res_group);
+
+    rpc_port_autofill_response_group_destroy(res_group);
+
+    return true;
+}
+
 static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_svc_fill_response_h response_h)
 {
     // recv fill response from service
@@ -459,7 +473,7 @@ static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_svc_fill_
     rpc_port_autofill_fill_response_create(&fill_response_h);
     rpc_port_autofill_fill_response_set_view_id(fill_response_h, view_id);
 
-    rpc_port_autofill_svc_fill_response_foreach_response_items(response_h, fill_response_item_cb, fill_response_h);
+    rpc_port_autofill_svc_fill_response_foreach_response_groups(response_h, fill_response_group_cb, fill_response_h);
 
     autofill_client_s *sender_client = get_autofill_client(app_id);
     if (sender_client)
index 342b0dc..d34a7bf 100644 (file)
@@ -152,29 +152,64 @@ static void _fill_request_cb(autofill_view_info_h vi, void *user_data)
     if (view_id)
         free(view_id);
 
+    autofill_fill_response_group_h res_group_h[2];
     autofill_fill_response_item_h ritem_h[2];
 
+    /* group 1 */
+    autofill_fill_response_group_create(&res_group_h[0]);
+
     /* item 1 */
     autofill_fill_response_item_create(&ritem_h[0]);
     autofill_fill_response_item_set_id(ritem_h[0], "id");
     autofill_fill_response_item_set_presentation_text(ritem_h[0], "Input ID");
-    autofill_fill_response_item_set_value(ritem_h[0], "tester");
+    autofill_fill_response_item_set_value(ritem_h[0], "tester1");
 
-    autofill_fill_response_add_item(fill_response, ritem_h[0]);
+    autofill_fill_response_group_add_item(res_group_h[0], ritem_h[0]);
 
     /* item 2 */
     autofill_fill_response_item_create(&ritem_h[1]);
     autofill_fill_response_item_set_id(ritem_h[1], "password");
     autofill_fill_response_item_set_presentation_text(ritem_h[1], "Input Password");
-    autofill_fill_response_item_set_value(ritem_h[1], "testerpw");
+    autofill_fill_response_item_set_value(ritem_h[1], "testerpw1");
 
-    autofill_fill_response_add_item(fill_response, ritem_h[1]);
+    autofill_fill_response_group_add_item(res_group_h[0], ritem_h[1]);
 
-    autofill_service_send_fill_response(fill_response);
+    autofill_fill_response_item_destroy(ritem_h[0]);
+    autofill_fill_response_item_destroy(ritem_h[1]);
+
+    autofill_fill_response_add_group(fill_response, res_group_h[0]);
+
+    autofill_fill_response_group_destroy(res_group_h[0]);
+
+    /* group 2 */
+    autofill_fill_response_group_create(&res_group_h[1]);
+
+    /* item 1 */
+    autofill_fill_response_item_create(&ritem_h[0]);
+    autofill_fill_response_item_set_id(ritem_h[0], "id");
+    autofill_fill_response_item_set_presentation_text(ritem_h[0], "Input ID");
+    autofill_fill_response_item_set_value(ritem_h[0], "tester2");
+
+    autofill_fill_response_group_add_item(res_group_h[0], ritem_h[0]);
+
+    /* item 2 */
+    autofill_fill_response_item_create(&ritem_h[1]);
+    autofill_fill_response_item_set_id(ritem_h[1], "password");
+    autofill_fill_response_item_set_presentation_text(ritem_h[1], "Input Password");
+    autofill_fill_response_item_set_value(ritem_h[1], "testerpw2");
+
+    autofill_fill_response_group_add_item(res_group_h[0], ritem_h[1]);
 
     autofill_fill_response_item_destroy(ritem_h[0]);
     autofill_fill_response_item_destroy(ritem_h[1]);
 
+    autofill_fill_response_add_group(fill_response, res_group_h[1]);
+
+    autofill_fill_response_group_destroy(res_group_h[1]);
+
+    /* Send fill response */
+    autofill_service_send_fill_response(fill_response);
+
     autofill_fill_response_destroy(fill_response);
 }
 
index 464ee97..c935264 100644 (file)
@@ -192,7 +192,7 @@ static void __autofill_fill_request_cb(rpc_port_stub_AutofillSvcPort_context_h c
     rpc_port_autofill_svc_view_info_get_app_id(vi, &app_id);
     rpc_port_autofill_svc_view_info_get_view_id(vi, &view_id);
 
-    LOGD("app id ; %s, view id : %s", app_id, view_id);
+    LOGD("app id : %s, view id : %s", app_id, view_id);
 
     autofill_view_info_h view_info;
     autofill_view_info_create(&view_info);
@@ -478,16 +478,56 @@ EXPORT_API int autofill_service_set_fill_request_cb(autofill_service_fill_reques
     return AUTOFILL_ERROR_NONE;
 }
 
-EXPORT_API int autofill_service_send_fill_response(autofill_fill_response_h h)
+bool __fill_response_item_cb(autofill_fill_response_item_h it, void * user_data)
 {
-    /* create autofill response */
-    rpc_port_autofill_svc_fill_response_h fill_response_h;
     char *id = NULL;
     char *value = NULL;
     char *presentation_text = NULL;
 
+    rpc_port_autofill_svc_response_group_h res_group_h = (rpc_port_autofill_svc_response_group_h)user_data;
+
+    rpc_port_autofill_svc_response_item_h ritem_h;
+
+    autofill_fill_response_item_get_id(it, &id);
+    autofill_fill_response_item_get_value(it, &value);
+    autofill_fill_response_item_get_presentation_text(it, &presentation_text);
+
+    LOGD("it : %p, id : %s, value : %s, presentation text : %s", it, id, value, presentation_text);
+
+    rpc_port_autofill_svc_response_item_create(&ritem_h);
+    rpc_port_autofill_svc_response_item_set_id(ritem_h, id);
+    rpc_port_autofill_svc_response_item_set_presentation_text(ritem_h, presentation_text);
+    rpc_port_autofill_svc_response_item_set_value(ritem_h, value);
+
+    rpc_port_autofill_svc_response_group_add_response_items(res_group_h, ritem_h);
+
+    if (id) {
+        free(id);
+        id = NULL;
+    }
+
+    if (value) {
+        free(value);
+        value = NULL;
+    }
+
+    if (presentation_text) {
+        free(presentation_text);
+        presentation_text= NULL;
+    }
+
+    rpc_port_autofill_svc_response_item_destroy(ritem_h);
+
+    return true;
+}
+
+EXPORT_API int autofill_service_send_fill_response(autofill_fill_response_h h)
+{
+    /* create autofill response */
+    rpc_port_autofill_svc_fill_response_h fill_response_h;
+
     Eina_List *l;
-    autofill_fill_response_item_h it;
+    autofill_fill_response_group_h it;
 
     if (!h) {
         LOGW("parameter is NULL");
@@ -502,43 +542,17 @@ EXPORT_API int autofill_service_send_fill_response(autofill_fill_response_h h)
     if (h->view_id)
         rpc_port_autofill_svc_fill_response_set_view_id(fill_response_h, h->view_id);
 
-    rpc_port_autofill_svc_response_item_h ritem_h;
+    rpc_port_autofill_svc_response_group_h res_group_h;
 
-    int i = 0, count = 0;
-    EINA_LIST_FOREACH(h->autofill_fill_response_item_list, l, it)
+    EINA_LIST_FOREACH(h->autofill_fill_response_group_list, l, it)
     {
-        autofill_fill_response_item_get_id(it, &id);
-        autofill_fill_response_item_get_value(it, &value);
-        autofill_fill_response_item_get_presentation_text(it, &presentation_text);
-
-        LOGD("it : %p, id : %s, value : %s, presentation text : %s", it, id, value, presentation_text);
-
-        rpc_port_autofill_svc_response_item_create(&ritem_h);
-        rpc_port_autofill_svc_response_item_set_id(ritem_h, id);
-        rpc_port_autofill_svc_response_item_set_presentation_text(ritem_h, presentation_text);
-        rpc_port_autofill_svc_response_item_set_value(ritem_h, value);
-
-        rpc_port_autofill_svc_fill_response_add_response_items(fill_response_h, ritem_h);
-
-        if (id) {
-            free(id);
-            id = NULL;
-        }
-
-        if (value) {
-            free(value);
-            value = NULL;
-        }
+        rpc_port_autofill_svc_response_group_create(&res_group_h);
 
-        if (presentation_text) {
-            free(presentation_text);
-            presentation_text= NULL;
-        }
+        autofill_fill_response_group_foreach_items(it, __fill_response_item_cb, res_group_h);
 
-        rpc_port_autofill_svc_response_item_destroy(ritem_h);
+        rpc_port_autofill_svc_fill_response_add_response_groups(fill_response_h, res_group_h);
 
-        count++;
-        i++;
+        rpc_port_autofill_svc_response_group_destroy(res_group_h);
     }
 
     rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_invoke(g_fill_response_cb, fill_response_h);
index 8c894d5..1d87c3a 100644 (file)
@@ -1930,11 +1930,251 @@ int rpc_port_autofill_svc_response_item_get_value(rpc_port_autofill_svc_response
        return 0;
 }
 
+struct autofill_svc_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *response_items;
+};
+
+static void __autofill_svc_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __autofill_svc_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_svc_response_item_h value = NULL;
+
+                       rpc_port_autofill_svc_response_item_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->response_items = g_list_append(h->response_items, value);
+               }
+       } while (0);
+}
+
+int rpc_port_autofill_svc_response_group_create(rpc_port_autofill_svc_response_group_h *h)
+{
+       struct autofill_svc_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct autofill_svc_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __autofill_svc_response_group_to;
+       handle->parcelable.from = __autofill_svc_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_destroy(rpc_port_autofill_svc_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_svc_response_item_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->response_items);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_clone(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h *clone)
+{
+       rpc_port_autofill_svc_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_autofill_svc_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create autofill_svc_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h new_value;
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_svc_response_item_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_add_response_items(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_item_h response_items)
+{
+       if (!h || !response_items) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_svc_response_item_h value = NULL;
+
+               rpc_port_autofill_svc_response_item_clone(response_items, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->response_items = g_list_append(h->response_items, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_foreach_response_items(rpc_port_autofill_svc_response_group_h h,
+               bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->response_items;
+               while (iter) {
+                       rpc_port_autofill_svc_response_item_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_remove_response_items(rpc_port_autofill_svc_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->response_items, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_svc_response_item_h value = iter->data;
+       h->response_items = g_list_remove_link(h->response_items, iter);
+       rpc_port_autofill_svc_response_item_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_autofill_svc_response_group_get_response_items_length(rpc_port_autofill_svc_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->response_items);
+
+       return 0;
+}
+
 struct autofill_svc_fill_response_s {
        rpc_port_parcelable_t parcelable;
        char *app_id;
        char *view_id;
-       GList *response_items;
+       GList *response_groups;
 };
 
 static void __autofill_svc_fill_response_to(rpc_port_parcel_h parcel, void *data)
@@ -1948,13 +2188,13 @@ static void __autofill_svc_fill_response_to(rpc_port_parcel_h parcel, void *data
 
        rpc_port_parcel_write_string(parcel, h->app_id ? h->app_id : "");
        rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : "");
-       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_items));
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_groups));
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -1982,16 +2222,16 @@ static void __autofill_svc_fill_response_from(rpc_port_parcel_h parcel, void *da
 
                rpc_port_parcel_read_array_count(parcel, &len);
                for (int i = 0; i < len; i++) {
-                       rpc_port_autofill_svc_response_item_h value = NULL;
+                       rpc_port_autofill_svc_response_group_h value = NULL;
 
-                       rpc_port_autofill_svc_response_item_create(&value);
+                       rpc_port_autofill_svc_response_group_create(&value);
                        if (!value) {
                                _E("Failed to create handle");
                                return;
                        }
 
                        rpc_port_parcel_read(parcel, &value->parcelable, value);
-                       h->response_items = g_list_append(h->response_items, value);
+                       h->response_groups = g_list_append(h->response_groups, value);
                }
        } while (0);
 }
@@ -2035,15 +2275,15 @@ int rpc_port_autofill_svc_fill_response_destroy(rpc_port_autofill_svc_fill_respo
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
                        if (value)
-                               rpc_port_autofill_svc_response_item_destroy(value);
+                               rpc_port_autofill_svc_response_group_destroy(value);
 
                        iter = g_list_next(iter);
                }
-               g_list_free(h->response_items);
+               g_list_free(h->response_groups);
        } while (0);
 
        free(h);
@@ -2087,10 +2327,10 @@ int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_respons
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h new_value;
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h new_value;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
 
                        if (!value) {
                                _E("Error: value is NULL");
@@ -2098,14 +2338,14 @@ int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_respons
                                return -1;
                        }
 
-                       rpc_port_autofill_svc_response_item_clone(value, &new_value);
+                       rpc_port_autofill_svc_response_group_clone(value, &new_value);
                        if (!new_value) {
                                _E("Failed to duplicate value");
                                rpc_port_autofill_svc_fill_response_destroy(handle);
                                return -1;
                        }
 
-                       handle->response_items = g_list_append(handle->response_items, new_value);
+                       handle->response_groups = g_list_append(handle->response_groups, new_value);
                        iter = g_list_next(iter);
                }
        } while (0);
@@ -2157,23 +2397,23 @@ int rpc_port_autofill_svc_fill_response_set_view_id(rpc_port_autofill_svc_fill_r
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_add_response_items(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_item_h response_items)
+int rpc_port_autofill_svc_fill_response_add_response_groups(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_group_h response_groups)
 {
-       if (!h || !response_items) {
+       if (!h || !response_groups) {
                _E("Invalid parameter");
                return -1;
        }
 
        do {
-               rpc_port_autofill_svc_response_item_h value = NULL;
+               rpc_port_autofill_svc_response_group_h value = NULL;
 
-               rpc_port_autofill_svc_response_item_clone(response_items, &value);
+               rpc_port_autofill_svc_response_group_clone(response_groups, &value);
                if (!value) {
                        _E("Out of memory");
                        return -1;
                }
 
-               h->response_items = g_list_append(h->response_items, value);
+               h->response_groups = g_list_append(h->response_groups, value);
        } while (0);
 
        return 0;
@@ -2221,8 +2461,8 @@ int rpc_port_autofill_svc_fill_response_get_view_id(rpc_port_autofill_svc_fill_r
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill_svc_fill_response_h h,
-               bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data)
+int rpc_port_autofill_svc_fill_response_foreach_response_groups(rpc_port_autofill_svc_fill_response_h h,
+               bool (*callback)(rpc_port_autofill_svc_response_group_h response_groups, void *user_data), void *user_data)
 {
        if (!h || !callback) {
                _E("Invalid parameter");
@@ -2232,9 +2472,9 @@ int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill
        do {
                GList *iter;
 
-               iter = h->response_items;
+               iter = h->response_groups;
                while (iter) {
-                       rpc_port_autofill_svc_response_item_h value = iter->data;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
 
                        iter = g_list_next(iter);
                        if (!value) {
@@ -2251,7 +2491,7 @@ int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_remove_response_items(rpc_port_autofill_svc_fill_response_h h, unsigned int nth)
+int rpc_port_autofill_svc_fill_response_remove_response_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth)
 {
        GList *iter;
 
@@ -2260,26 +2500,26 @@ int rpc_port_autofill_svc_fill_response_remove_response_items(rpc_port_autofill_
                return -1;
        }
 
-       iter = g_list_nth(h->response_items, nth);
+       iter = g_list_nth(h->response_groups, nth);
        if (iter == NULL)
                return -1;
 
-       rpc_port_autofill_svc_response_item_h value = iter->data;
-       h->response_items = g_list_remove_link(h->response_items, iter);
-       rpc_port_autofill_svc_response_item_destroy(value);
+       rpc_port_autofill_svc_response_group_h value = iter->data;
+       h->response_groups = g_list_remove_link(h->response_groups, iter);
+       rpc_port_autofill_svc_response_group_destroy(value);
        g_list_free(iter);
 
        return 0;
 }
 
-int rpc_port_autofill_svc_fill_response_get_response_items_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length)
+int rpc_port_autofill_svc_fill_response_get_response_groups_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length)
 {
        if (!h || !length) {
                _E("Invalid parameter");
                return -1;
        }
 
-       *length = g_list_length(h->response_items);
+       *length = g_list_length(h->response_groups);
 
        return 0;
 }
@@ -2524,6 +2764,246 @@ int rpc_port_list_autofill_svc_item_get_list_autofill_svc_items_length(rpc_port_
        return 0;
 }
 
+struct list_autofill_svc_response_group_s {
+       rpc_port_parcelable_t parcelable;
+       GList *list_autofill_svc_response_groups;
+};
+
+static void __list_autofill_svc_response_group_to(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_response_groups));
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+                       rpc_port_parcel_write(parcel, &value->parcelable, value);
+               }
+       } while (0);
+}
+
+static void __list_autofill_svc_response_group_from(rpc_port_parcel_h parcel, void *data)
+{
+       rpc_port_list_autofill_svc_response_group_h h = data;
+
+       if (!parcel || !h) {
+               _E("Invalid parameter");
+               return;
+       }
+
+       do {
+               int len = 0;
+
+               rpc_port_parcel_read_array_count(parcel, &len);
+               for (int i = 0; i < len; i++) {
+                       rpc_port_autofill_svc_response_group_h value = NULL;
+
+                       rpc_port_autofill_svc_response_group_create(&value);
+                       if (!value) {
+                               _E("Failed to create handle");
+                               return;
+                       }
+
+                       rpc_port_parcel_read(parcel, &value->parcelable, value);
+                       h->list_autofill_svc_response_groups = g_list_append(h->list_autofill_svc_response_groups, value);
+               }
+       } while (0);
+}
+
+int rpc_port_list_autofill_svc_response_group_create(rpc_port_list_autofill_svc_response_group_h *h)
+{
+       struct list_autofill_svc_response_group_s *handle;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       handle = calloc(1, sizeof(struct list_autofill_svc_response_group_s));
+       if (!handle) {
+               _E("Out of memory");
+               return -1;
+       }
+
+       handle->parcelable.to = __list_autofill_svc_response_group_to;
+       handle->parcelable.from = __list_autofill_svc_response_group_from;
+
+       *h = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_destroy(rpc_port_list_autofill_svc_response_group_h h)
+{
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+                       if (value)
+                               rpc_port_autofill_svc_response_group_destroy(value);
+
+                       iter = g_list_next(iter);
+               }
+               g_list_free(h->list_autofill_svc_response_groups);
+       } while (0);
+
+       free(h);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_clone(rpc_port_list_autofill_svc_response_group_h h, rpc_port_list_autofill_svc_response_group_h *clone)
+{
+       rpc_port_list_autofill_svc_response_group_h handle = NULL;
+
+       if (!h || !clone) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       rpc_port_list_autofill_svc_response_group_create(&handle);
+       if (!handle) {
+               _E("Failed to create list_autofill_svc_response_group handle");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h new_value;
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+
+                       if (!value) {
+                               _E("Error: value is NULL");
+                               rpc_port_list_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       rpc_port_autofill_svc_response_group_clone(value, &new_value);
+                       if (!new_value) {
+                               _E("Failed to duplicate value");
+                               rpc_port_list_autofill_svc_response_group_destroy(handle);
+                               return -1;
+                       }
+
+                       handle->list_autofill_svc_response_groups = g_list_append(handle->list_autofill_svc_response_groups, new_value);
+                       iter = g_list_next(iter);
+               }
+       } while (0);
+
+       *clone = handle;
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_add_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups)
+{
+       if (!h || !list_autofill_svc_response_groups) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               rpc_port_autofill_svc_response_group_h value = NULL;
+
+               rpc_port_autofill_svc_response_group_clone(list_autofill_svc_response_groups, &value);
+               if (!value) {
+                       _E("Out of memory");
+                       return -1;
+               }
+
+               h->list_autofill_svc_response_groups = g_list_append(h->list_autofill_svc_response_groups, value);
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_foreach_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h,
+               bool (*callback)(rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups, void *user_data), void *user_data)
+{
+       if (!h || !callback) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       do {
+               GList *iter;
+
+               iter = h->list_autofill_svc_response_groups;
+               while (iter) {
+                       rpc_port_autofill_svc_response_group_h value = iter->data;
+
+                       iter = g_list_next(iter);
+                       if (!value) {
+                               _W("Warning: value is NULL");
+                               continue;
+                       }
+
+                       bool ret = callback(value, user_data);
+                       if (!ret)
+                               break;
+               }
+       } while (0);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_remove_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, unsigned int nth)
+{
+       GList *iter;
+
+       if (!h) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       iter = g_list_nth(h->list_autofill_svc_response_groups, nth);
+       if (iter == NULL)
+               return -1;
+
+       rpc_port_autofill_svc_response_group_h value = iter->data;
+       h->list_autofill_svc_response_groups = g_list_remove_link(h->list_autofill_svc_response_groups, iter);
+       rpc_port_autofill_svc_response_group_destroy(value);
+       g_list_free(iter);
+
+       return 0;
+}
+
+int rpc_port_list_autofill_svc_response_group_get_list_autofill_svc_response_groups_length(rpc_port_list_autofill_svc_response_group_h h, unsigned int *length)
+{
+       if (!h || !length) {
+               _E("Invalid parameter");
+               return -1;
+       }
+
+       *length = g_list_length(h->list_autofill_svc_response_groups);
+
+       return 0;
+}
+
 struct list_autofill_svc_response_item_s {
        rpc_port_parcelable_t parcelable;
        GList *list_autofill_svc_response_items;
index 35c3efa..b4c4619 100644 (file)
@@ -179,6 +179,23 @@ int rpc_port_autofill_svc_response_item_get_presentation_text(rpc_port_autofill_
 
 int rpc_port_autofill_svc_response_item_get_value(rpc_port_autofill_svc_response_item_h h, char **value);
 
+typedef struct autofill_svc_response_group_s *rpc_port_autofill_svc_response_group_h;
+
+int rpc_port_autofill_svc_response_group_create(rpc_port_autofill_svc_response_group_h *h);
+
+int rpc_port_autofill_svc_response_group_destroy(rpc_port_autofill_svc_response_group_h h);
+
+int rpc_port_autofill_svc_response_group_clone(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h *clone);
+
+int rpc_port_autofill_svc_response_group_add_response_items(rpc_port_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_item_h response_items);
+
+int rpc_port_autofill_svc_response_group_foreach_response_items(rpc_port_autofill_svc_response_group_h h,
+        bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data);
+
+int rpc_port_autofill_svc_response_group_remove_response_items(rpc_port_autofill_svc_response_group_h h, unsigned int nth);
+
+int rpc_port_autofill_svc_response_group_get_response_items_length(rpc_port_autofill_svc_response_group_h h, unsigned int *length);
+
 typedef struct autofill_svc_fill_response_s *rpc_port_autofill_svc_fill_response_h;
 
 int rpc_port_autofill_svc_fill_response_create(rpc_port_autofill_svc_fill_response_h *h);
@@ -191,18 +208,18 @@ int rpc_port_autofill_svc_fill_response_set_app_id(rpc_port_autofill_svc_fill_re
 
 int rpc_port_autofill_svc_fill_response_set_view_id(rpc_port_autofill_svc_fill_response_h h, const char *view_id);
 
-int rpc_port_autofill_svc_fill_response_add_response_items(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_item_h response_items);
+int rpc_port_autofill_svc_fill_response_add_response_groups(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_response_group_h response_groups);
 
 int rpc_port_autofill_svc_fill_response_get_app_id(rpc_port_autofill_svc_fill_response_h h, char **app_id);
 
 int rpc_port_autofill_svc_fill_response_get_view_id(rpc_port_autofill_svc_fill_response_h h, char **view_id);
 
-int rpc_port_autofill_svc_fill_response_foreach_response_items(rpc_port_autofill_svc_fill_response_h h,
-        bool (*callback)(rpc_port_autofill_svc_response_item_h response_items, void *user_data), void *user_data);
+int rpc_port_autofill_svc_fill_response_foreach_response_groups(rpc_port_autofill_svc_fill_response_h h,
+        bool (*callback)(rpc_port_autofill_svc_response_group_h response_groups, void *user_data), void *user_data);
 
-int rpc_port_autofill_svc_fill_response_remove_response_items(rpc_port_autofill_svc_fill_response_h h, unsigned int nth);
+int rpc_port_autofill_svc_fill_response_remove_response_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth);
 
-int rpc_port_autofill_svc_fill_response_get_response_items_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length);
+int rpc_port_autofill_svc_fill_response_get_response_groups_length(rpc_port_autofill_svc_fill_response_h h, unsigned int *length);
 
 typedef struct list_autofill_svc_item_s *rpc_port_list_autofill_svc_item_h;
 
@@ -221,6 +238,23 @@ int rpc_port_list_autofill_svc_item_remove_list_autofill_svc_items(rpc_port_list
 
 int rpc_port_list_autofill_svc_item_get_list_autofill_svc_items_length(rpc_port_list_autofill_svc_item_h h, unsigned int *length);
 
+typedef struct list_autofill_svc_response_group_s *rpc_port_list_autofill_svc_response_group_h;
+
+int rpc_port_list_autofill_svc_response_group_create(rpc_port_list_autofill_svc_response_group_h *h);
+
+int rpc_port_list_autofill_svc_response_group_destroy(rpc_port_list_autofill_svc_response_group_h h);
+
+int rpc_port_list_autofill_svc_response_group_clone(rpc_port_list_autofill_svc_response_group_h h, rpc_port_list_autofill_svc_response_group_h *clone);
+
+int rpc_port_list_autofill_svc_response_group_add_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups);
+
+int rpc_port_list_autofill_svc_response_group_foreach_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h,
+        bool (*callback)(rpc_port_autofill_svc_response_group_h list_autofill_svc_response_groups, void *user_data), void *user_data);
+
+int rpc_port_list_autofill_svc_response_group_remove_list_autofill_svc_response_groups(rpc_port_list_autofill_svc_response_group_h h, unsigned int nth);
+
+int rpc_port_list_autofill_svc_response_group_get_list_autofill_svc_response_groups_length(rpc_port_list_autofill_svc_response_group_h h, unsigned int *length);
+
 typedef struct list_autofill_svc_response_item_s *rpc_port_list_autofill_svc_response_item_h;
 
 int rpc_port_list_autofill_svc_response_item_create(rpc_port_list_autofill_svc_response_item_h *h);
index d838be4..85a1d09 100644 (file)
@@ -151,12 +151,23 @@ static bool _fill_response_item_cb(autofill_fill_response_item_h item, void *use
     return true;
 }
 
+static bool _fill_response_group_cb(autofill_fill_response_group_h group_h, void *user_data)
+{
+    autofill_fill_response_group_foreach_items(group_h, _fill_response_item_cb, NULL);
+
+    return true;
+}
+
 static void
 _autofill_fill_response_cb(autofill_fill_response_h fill_response, void *data)
 {
     if (!fill_response)
         return;
 
+    int count;
+    autofill_fill_response_get_group_count(fill_response, &count);
+    LOGD("group count : %d", count);
+
 #if 0
     if (eina_list_count(fill_response->autofill_fill_response_item_list) == 1)
     {
@@ -180,7 +191,7 @@ _autofill_fill_response_cb(autofill_fill_response_h fill_response, void *data)
     }
 #endif
 
-    autofill_fill_response_foreach_items(fill_response, _fill_response_item_cb, NULL);
+    autofill_fill_response_foreach_groups(fill_response, _fill_response_group_cb, NULL);
 }
 
 static void
index 07663e7..a571ba9 100644 (file)
@@ -39,9 +39,13 @@ struct autofill_response_item {
     string value;
 }
 
+struct autofill_response_group {
+    list<autofill_response_item> response_items;
+}
+
 struct autofill_fill_response {
     string view_id;
-    list<autofill_response_item> response_items;
+    list<autofill_response_group> response_groups;
 }
 
 interface AutofillAppPort {
index e30c395..2395354 100644 (file)
@@ -41,10 +41,14 @@ struct autofill_svc_response_item {
     string value;
 }
 
+struct autofill_svc_response_group {
+    list<autofill_svc_response_item> response_items;
+}
+
 struct autofill_svc_fill_response {
     string app_id;
     string view_id;
-    list<autofill_svc_response_item> response_items;
+    list<autofill_svc_response_group> response_groups;
 }
 
 interface AutofillSvcPort {