From d46cc7bc3f966bc42d6b38cb3316c2711820eeb6 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Oct 2018 16:28:46 +0900 Subject: [PATCH 01/16] sample: save input data in autofill service Change-Id: Idadd00ffdd041837d7664388bccfb97cef55da53 Signed-off-by: Jihoon Kim --- test/ecore_imf_example.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/ecore_imf_example.c b/test/ecore_imf_example.c index ed67853..a6a65d7 100644 --- a/test/ecore_imf_example.c +++ b/test/ecore_imf_example.c @@ -258,8 +258,12 @@ _save_autofill_info() app_get_id(&app_id); autofill_save_view_info_h svi_h = NULL; - autofill_save_item_set_value(en1.si_h, "save data 1"); - autofill_save_item_set_value(en2.si_h, "save data 2"); + const char *str; + str = evas_object_textblock_text_markup_get(en1.txt_obj); + autofill_save_item_set_value(en1.si_h, str ? str : ""); + + str = evas_object_textblock_text_markup_get(en2.txt_obj); + autofill_save_item_set_value(en2.si_h, str ? str : ""); // create autofill view info autofill_save_view_info_create(&svi_h); @@ -274,11 +278,11 @@ _save_autofill_info() ret = autofill_commit(svi_h); if (ret == AUTOFILL_ERROR_NONE) - LOGD("Succeeded to request auth info"); + LOGD("Succeeded to commit"); else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) LOGW("permission denied"); else - LOGW("Failed to request auth info. error : %d", ret); + LOGW("Failed to commit. error : %d", ret); autofill_save_view_info_destroy(svi_h); } -- 2.7.4 From e0a13c6ae641c650f8ee92193f445c79bee2ffce Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Oct 2018 16:49:22 +0900 Subject: [PATCH 02/16] Sample: add sample app icon Change-Id: I809e1bb4fd218299f44686f09e484e47a3f192ee Signed-off-by: Jihoon Kim --- packaging/capi-ui-autofill.spec | 3 ++- test/CMakeLists.txt | 3 +++ test/org.tizen.autofill-test.png | Bin 0 -> 57662 bytes test/org.tizen.autofill-test.xml | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 test/org.tizen.autofill-test.png diff --git a/packaging/capi-ui-autofill.spec b/packaging/capi-ui-autofill.spec index e102295..4556326 100644 --- a/packaging/capi-ui-autofill.spec +++ b/packaging/capi-ui-autofill.spec @@ -110,7 +110,7 @@ rm -rf CMakeFiles rm -rf CMakeCache.txt MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIB_INSTALL_DIR:PATH=%{_libdir} \ - -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES + -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES -DTZ_SYS_RO_ICONS=%TZ_SYS_RO_ICONS make %{?jobs:-j%jobs} @@ -164,6 +164,7 @@ mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon %manifest test/org.tizen.autofill-test.manifest %{TZ_SYS_RO_PACKAGES}/org.tizen.autofill-test.xml %{TZ_SYS_RO_APP}/org.tizen.autofill-test/* +%{TZ_SYS_RO_ICONS}/default/small/* %files -n org.tizen.autofill-daemon %manifest server/org.tizen.autofill-daemon.manifest diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8018441..b879451 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(autofill-test C) +SET(ICONDIR "${TZ_SYS_RO_ICONS}/default/small") + SET(SRCS ecore_imf_example.c ) @@ -43,4 +45,5 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_test_LDFLAGS} capi-ui-autofill) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${TZ_SYS_RO_APP}/org.tizen.${PROJECT_NAME}/bin) INSTALL(FILES ${CMAKE_BINARY_DIR}/test/org.tizen.autofill-test.xml DESTINATION ${TZ_SYS_RO_PACKAGES}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/test/org.tizen.autofill-test.png DESTINATION ${ICONDIR}) #INSTALL(FILES ${CMAKE_BINARY_DIR}/test/autofill-test.manifest DESTINATION ${TZ_SYS_RO_PACKAGES}) diff --git a/test/org.tizen.autofill-test.png b/test/org.tizen.autofill-test.png new file mode 100644 index 0000000000000000000000000000000000000000..9765b1bda7e5bddf0925555ab204b887a873bf24 GIT binary patch literal 57662 zcmdU&2Y{Bv)wXAQhoyJerGpfaq9DE5J1S~atXN|Avn3kQ*!`l$D2ie%v3Ct9iU9$! zARxVWkS4wCvh_dLJny{>uV6_upZ~zTGjrz5nKS2}_RLfEz7vl>A}6zMrgJXms3ZHI zY~lal(^KvD>g2b^T99$|k!M`zTvj!Ff*bL4ZRavixU^rt6HmP4s_U=1?vksn&O54K zzr3rjz3Spie}9p4H!U1_%FscltgqRlVCl}j$J~4S-;TNJ8N(x+7h3`nl`#k2P&{pByWKUm|WHre-Q&QDvN|NLL>eBs{vzbanwhZioN zJGS84sb!<)^<4YLj*;(APaB_}{rHg`PwISo_N#pxR#|@M=aVL{SlzDou*{}cyWI5m zFU-HLv`K<1ysdlpgBp)d`cVb&Nq{W}Uo#k#HS@`5165LsT%de5} z>?1C(+C}&Fcb6RQ-k5&c{R7 zy7#VDF8L2`$QMnT+~ofJq^mw~`{~`c9rRZ2+SX>NC*SKnrfJs!!_G=?drjKur?+d^ za@tX~4yxYeyu|ZH^lmrd<|peMGOSbO`OD}^=eFH2 zF15Vz`RA`HTQmLjt9v`Q;`-ZWl(lL9e%;#-Prdz$vgey^PQK)vtY`nH;DL+ZtK55( zdv^W8(|25rZ3aB|@R$V))~sGV|L945&pPj`({C*sI^o>$rQvN1Z=raO>);PO5s%U;2-D zaK|ApHomX#Ut4|FY-ag|E0?t?PU^X=vwP>Vo(X?=r0pwbUy!u>m=?K%uOGj%z`5-o zU-jwimgz~iU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;~HMXUOxbfJy~c8J0@27o95G zCC^hfb)IOA^Yzi_P?-b8WqcWww0Ma_S6YoyI^98#-M+l(g*@40a+YsG0bLNa^jr<=? zx5y2h+OQ7|<$i5v75h)FT5s3%*4E!ev`3XLRvC?=&9O5ZR~{Dc@Xo)ab&y4LC9i7xGCmoe0{MD!5urgm^q=g69ZU~%imq0h0 zFZ2!4Ot9BIRaYKmR{oN3@*X{2^C5O$DP8HE&8W8hI-bfv}r zLm?dqClFOubrXh8^{FoLS^1eJ>rn&qMdJs|Uwo2!1ic#Vf?b-djrddQ~P z@y7aJ0~5V)`)m9EIjE6pUO5nCT29W(%d2Uh+WEa1@I+I(nS~L$K_g`J5D3ZoPeU1s z5cx_Y*XlJ=`63J7wzuLQTfTfbkIwQS&96GmQuqE`sGIVCGoVT#LQ@oQnVOTEHf`F% zHdQ=f(Z}d*jOItM8iUb8Z}}A?4*G$d%7-CwdC7^%U_{O~AjjFw?|;~{!}Bd4Aemyn zzb!scrN07Q`iG)_lb}jLQd`!VcPK4UMIq`6?FY>(F@k_}g5RW$5yke+hYkW}9Kd?XEQzUukRQ0^7NMWv|@x zwG+T&6#DSD0;1`&kBdyQ56LC)MX~>1olS!p$pSkJiQ^PTspwbpG9e!D!m!-zBA%$k kZ}gYfNaCF}xV$|1>H6z0+kDautofill-test Jihoon Kim autofill-test - + + org.tizen.autofill-test.png - http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/datasharing -- 2.7.4 From 424340569ccbc782a2d64e5ff98094afdc8977d3 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Oct 2018 18:53:16 +0900 Subject: [PATCH 03/16] Remove the TIDL generated files Change-Id: Ifd2256eab2089ed624e249344eea7e141170f2d9 Signed-off-by: Jihoon Kim --- client/autofill_proxy.c | 4047 --------------------------------- client/autofill_proxy.h | 328 --- packaging/capi-ui-autofill.spec | 16 + prebuild.sh | 17 - server/autofill_service_proxy.c | 4161 ---------------------------------- server/autofill_service_proxy.h | 340 --- server/autofill_stub.c | 4079 --------------------------------- server/autofill_stub.h | 323 --- service_lib/autofill_service_stub.c | 4223 ----------------------------------- service_lib/autofill_service_stub.h | 335 --- 10 files changed, 16 insertions(+), 17853 deletions(-) delete mode 100644 client/autofill_proxy.c delete mode 100644 client/autofill_proxy.h delete mode 100755 prebuild.sh delete mode 100644 server/autofill_service_proxy.c delete mode 100644 server/autofill_service_proxy.h delete mode 100644 server/autofill_stub.c delete mode 100644 server/autofill_stub.h delete mode 100644 service_lib/autofill_service_stub.c delete mode 100644 service_lib/autofill_service_stub.h diff --git a/client/autofill_proxy.c b/client/autofill_proxy.c deleted file mode 100644 index adb3113..0000000 --- a/client/autofill_proxy.c +++ /dev/null @@ -1,4047 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "autofill_proxy.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "RPC_PORT_PROXY" - -#ifdef _E -#undef _E -#endif - -#ifdef _W -#undef _W -#endif - -#ifdef _I -#undef _I -#endif - -#ifdef _D -#undef _D -#endif - -#define _E(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _W(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _I(fmt, ...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _D(fmt, ...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -typedef void (*proxy_delegate)(GList **list, rpc_port_parcel_h parcel, int seq_id, int id); - -struct autofill_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_item_create(rpc_port_autofill_item_h *h) -{ - struct autofill_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_item_to; - handle->parcelable.from = __autofill_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_item_destroy(rpc_port_autofill_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_item_clone(rpc_port_autofill_item_h h, rpc_port_autofill_item_h *clone) -{ - rpc_port_autofill_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_item_set_id(rpc_port_autofill_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_set_label(rpc_port_autofill_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_set_value(rpc_port_autofill_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_set_autofill_hint(rpc_port_autofill_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_item_set_is_sensitive_data(rpc_port_autofill_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_item_get_id(rpc_port_autofill_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_get_label(rpc_port_autofill_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_get_value(rpc_port_autofill_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_get_autofill_hint(rpc_port_autofill_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_item_get_is_sensitive_data(rpc_port_autofill_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_view_info_s { - rpc_port_parcelable_t parcelable; - char *view_id; - GList *items; -}; - -static void __autofill_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_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_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_item_h value = NULL; - - rpc_port_autofill_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_view_info_create(rpc_port_autofill_view_info_h *h) -{ - struct autofill_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_view_info_to; - handle->parcelable.from = __autofill_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_view_info_destroy(rpc_port_autofill_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_item_h value = iter->data; - if (value) - rpc_port_autofill_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_view_info_clone(rpc_port_autofill_view_info_h h, rpc_port_autofill_view_info_h *clone) -{ - rpc_port_autofill_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_view_info handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_item_h new_value; - rpc_port_autofill_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_view_info_set_view_id(rpc_port_autofill_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_view_info_add_items(rpc_port_autofill_view_info_h h, rpc_port_autofill_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_item_h value = NULL; - - rpc_port_autofill_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_view_info_get_view_id(rpc_port_autofill_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_view_info_foreach_items(rpc_port_autofill_view_info_h h, - bool (*callback)(rpc_port_autofill_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_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_view_info_remove_items(rpc_port_autofill_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_view_info_get_items_length(rpc_port_autofill_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_save_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h) -{ - struct autofill_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_save_item_to; - handle->parcelable.from = __autofill_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone) -{ - rpc_port_autofill_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_save_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_save_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_save_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_save_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_save_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_save_view_info_s { - rpc_port_parcelable_t parcelable; - char *view_id; - GList *items; -}; - -static void __autofill_save_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_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_save_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_save_item_h value = NULL; - - rpc_port_autofill_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h) -{ - struct autofill_save_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_save_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_save_view_info_to; - handle->parcelable.from = __autofill_save_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_item_h value = iter->data; - if (value) - rpc_port_autofill_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone) -{ - rpc_port_autofill_save_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_save_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_save_view_info handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_save_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_item_h new_value; - rpc_port_autofill_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_save_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_save_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_save_item_h value = NULL; - - rpc_port_autofill_save_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h, - bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_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_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_save_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_auth_info_s { - rpc_port_parcelable_t parcelable; - bool exist_autofill_data; - bool need_authentication; - char *service_name; - char *service_logo_image_path; - char *service_message; -}; - -static void __autofill_auth_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_bool(parcel, h->exist_autofill_data); - rpc_port_parcel_write_bool(parcel, h->need_authentication); - rpc_port_parcel_write_string(parcel, h->service_name ? h->service_name : ""); - rpc_port_parcel_write_string(parcel, h->service_logo_image_path ? h->service_logo_image_path : ""); - rpc_port_parcel_write_string(parcel, h->service_message ? h->service_message : ""); -} - -static void __autofill_auth_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_bool(parcel, &h->exist_autofill_data); - rpc_port_parcel_read_bool(parcel, &h->need_authentication); - rpc_port_parcel_read_string(parcel, &h->service_name); - rpc_port_parcel_read_string(parcel, &h->service_logo_image_path); - rpc_port_parcel_read_string(parcel, &h->service_message); -} - -int rpc_port_autofill_auth_info_create(rpc_port_autofill_auth_info_h *h) -{ - struct autofill_auth_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_auth_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_auth_info_to; - handle->parcelable.from = __autofill_auth_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_auth_info_destroy(rpc_port_autofill_auth_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_name) - free(h->service_name); - - if (h->service_logo_image_path) - free(h->service_logo_image_path); - - if (h->service_message) - free(h->service_message); - - free(h); - - return 0; -} - -int rpc_port_autofill_auth_info_clone(rpc_port_autofill_auth_info_h h, rpc_port_autofill_auth_info_h *clone) -{ - rpc_port_autofill_auth_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_auth_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_auth_info handle"); - return -1; - } - - handle->exist_autofill_data = h->exist_autofill_data; - handle->need_authentication = h->need_authentication; - if (h->service_name) { - handle->service_name = strdup(h->service_name); - if (!handle->service_name) { - _E("Failed to duplicate h->service_name"); - rpc_port_autofill_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_logo_image_path) { - handle->service_logo_image_path = strdup(h->service_logo_image_path); - if (!handle->service_logo_image_path) { - _E("Failed to duplicate h->service_logo_image_path"); - rpc_port_autofill_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_message) { - handle->service_message = strdup(h->service_message); - if (!handle->service_message) { - _E("Failed to duplicate h->service_message"); - rpc_port_autofill_auth_info_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_auth_info_set_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool exist_autofill_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->exist_autofill_data = exist_autofill_data; - return 0; -} - -int rpc_port_autofill_auth_info_set_need_authentication(rpc_port_autofill_auth_info_h h, bool need_authentication) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->need_authentication = need_authentication; - return 0; -} - -int rpc_port_autofill_auth_info_set_service_name(rpc_port_autofill_auth_info_h h, const char *service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_name) { - free(h->service_name); - h->service_name = NULL; - } - - h->service_name = strdup(service_name); - if (!h->service_name) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_set_service_logo_image_path(rpc_port_autofill_auth_info_h h, const char *service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_logo_image_path) { - free(h->service_logo_image_path); - h->service_logo_image_path = NULL; - } - - h->service_logo_image_path = strdup(service_logo_image_path); - if (!h->service_logo_image_path) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_set_service_message(rpc_port_autofill_auth_info_h h, const char *service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_message) { - free(h->service_message); - h->service_message = NULL; - } - - h->service_message = strdup(service_message); - if (!h->service_message) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_get_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool *exist_autofill_data) -{ - if (!h || !exist_autofill_data) { - _E("Invalid parameter"); - return -1; - } - - *exist_autofill_data = h->exist_autofill_data; - return 0; -} - -int rpc_port_autofill_auth_info_get_need_authentication(rpc_port_autofill_auth_info_h h, bool *need_authentication) -{ - if (!h || !need_authentication) { - _E("Invalid parameter"); - return -1; - } - - *need_authentication = h->need_authentication; - return 0; -} - -int rpc_port_autofill_auth_info_get_service_name(rpc_port_autofill_auth_info_h h, char **service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_name) { - _E("Invalid parameter: h->service_name is NULL"); - return -1; - } - - *service_name = strdup(h->service_name); - if (*service_name == NULL) { - _E("Failed to duplicate service_name"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_get_service_logo_image_path(rpc_port_autofill_auth_info_h h, char **service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_logo_image_path) { - _E("Invalid parameter: h->service_logo_image_path is NULL"); - return -1; - } - - *service_logo_image_path = strdup(h->service_logo_image_path); - if (*service_logo_image_path == NULL) { - _E("Failed to duplicate service_logo_image_path"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_get_service_message(rpc_port_autofill_auth_info_h h, char **service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_message) { - _E("Invalid parameter: h->service_message is NULL"); - return -1; - } - - *service_message = strdup(h->service_message); - if (*service_message == NULL) { - _E("Failed to duplicate service_message"); - return -1; - } - - return 0; -} - -struct autofill_response_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *presentation_text; - char *value; -}; - -static void __autofill_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->presentation_text ? h->presentation_text : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); -} - -static void __autofill_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->presentation_text); - rpc_port_parcel_read_string(parcel, &h->value); -} - -int rpc_port_autofill_response_item_create(rpc_port_autofill_response_item_h *h) -{ - struct autofill_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_response_item_to; - handle->parcelable.from = __autofill_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_response_item_destroy(rpc_port_autofill_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->presentation_text) - free(h->presentation_text); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_response_item_clone(rpc_port_autofill_response_item_h h, rpc_port_autofill_response_item_h *clone) -{ - rpc_port_autofill_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_response_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_response_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_response_item_destroy(handle); - return -1; - } - } - - if (h->presentation_text) { - handle->presentation_text = strdup(h->presentation_text); - if (!handle->presentation_text) { - _E("Failed to duplicate h->presentation_text"); - rpc_port_autofill_response_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_response_item_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_response_item_set_id(rpc_port_autofill_response_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_set_presentation_text(rpc_port_autofill_response_item_h h, const char *presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (h->presentation_text) { - free(h->presentation_text); - h->presentation_text = NULL; - } - - h->presentation_text = strdup(presentation_text); - if (!h->presentation_text) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_set_value(rpc_port_autofill_response_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_get_id(rpc_port_autofill_response_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_get_presentation_text(rpc_port_autofill_response_item_h h, char **presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (!h->presentation_text) { - _E("Invalid parameter: h->presentation_text is NULL"); - return -1; - } - - *presentation_text = strdup(h->presentation_text); - if (*presentation_text == NULL) { - _E("Failed to duplicate presentation_text"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_get_value(rpc_port_autofill_response_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - 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_groups; -}; - -static void __autofill_fill_response_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_groups)); - do { - GList *iter; - - iter = h->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 __autofill_fill_response_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - 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->response_groups = g_list_append(h->response_groups, value); - } - } while (0); -} - -int rpc_port_autofill_fill_response_create(rpc_port_autofill_fill_response_h *h) -{ - struct autofill_fill_response_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_fill_response_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_fill_response_to; - handle->parcelable.from = __autofill_fill_response_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_fill_response_destroy(rpc_port_autofill_fill_response_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->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->response_groups); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, rpc_port_autofill_fill_response_h *clone) -{ - rpc_port_autofill_fill_response_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_fill_response_create(&handle); - if (!handle) { - _E("Failed to create autofill_fill_response handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_fill_response_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->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_autofill_fill_response_destroy(handle); - return -1; - } - - 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_groups = g_list_append(handle->response_groups, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_fill_response_set_view_id(rpc_port_autofill_fill_response_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -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_groups) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_response_group_h value = NULL; - - rpc_port_autofill_response_group_clone(response_groups, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->response_groups = g_list_append(h->response_groups, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_fill_response_get_view_id(rpc_port_autofill_fill_response_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -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"); - return -1; - } - - do { - GList *iter; - - iter = h->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_autofill_fill_response_remove_response_groups(rpc_port_autofill_fill_response_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->response_groups, nth); - if (iter == NULL) - return -1; - - 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_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_groups); - - return 0; -} - -struct list_autofill_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_items; -}; - -static void __list_autofill_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_items)); - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_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 __list_autofill_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_item_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_item_h value = NULL; - - rpc_port_autofill_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_items = g_list_append(h->list_autofill_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_item_create(rpc_port_list_autofill_item_h *h) -{ - struct list_autofill_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_item_to; - handle->parcelable.from = __list_autofill_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_item_destroy(rpc_port_list_autofill_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_item_h value = iter->data; - if (value) - rpc_port_autofill_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_item_clone(rpc_port_list_autofill_item_h h, rpc_port_list_autofill_item_h *clone) -{ - rpc_port_list_autofill_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_item_h new_value; - rpc_port_autofill_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_item_destroy(handle); - return -1; - } - - rpc_port_autofill_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_item_destroy(handle); - return -1; - } - - handle->list_autofill_items = g_list_append(handle->list_autofill_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_item_add_list_autofill_items(rpc_port_list_autofill_item_h h, rpc_port_autofill_item_h list_autofill_items) -{ - if (!h || !list_autofill_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_item_h value = NULL; - - rpc_port_autofill_item_clone(list_autofill_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_items = g_list_append(h->list_autofill_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_item_foreach_list_autofill_items(rpc_port_list_autofill_item_h h, - bool (*callback)(rpc_port_autofill_item_h list_autofill_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_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_list_autofill_item_remove_list_autofill_items(rpc_port_list_autofill_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_item_h value = iter->data; - h->list_autofill_items = g_list_remove_link(h->list_autofill_items, iter); - rpc_port_autofill_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_item_get_list_autofill_items_length(rpc_port_list_autofill_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_items); - - 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; -}; - -static void __list_autofill_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_response_items)); - do { - GList *iter; - - iter = h->list_autofill_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 __list_autofill_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_response_item_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->list_autofill_response_items = g_list_append(h->list_autofill_response_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_response_item_create(rpc_port_list_autofill_response_item_h *h) -{ - struct list_autofill_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_response_item_to; - handle->parcelable.from = __list_autofill_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_response_item_destroy(rpc_port_list_autofill_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_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->list_autofill_response_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_response_item_clone(rpc_port_list_autofill_response_item_h h, rpc_port_list_autofill_response_item_h *clone) -{ - rpc_port_list_autofill_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_response_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_response_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_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_list_autofill_response_item_destroy(handle); - return -1; - } - - rpc_port_autofill_response_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_response_item_destroy(handle); - return -1; - } - - handle->list_autofill_response_items = g_list_append(handle->list_autofill_response_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_response_item_add_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, rpc_port_autofill_response_item_h list_autofill_response_items) -{ - if (!h || !list_autofill_response_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_response_item_h value = NULL; - - rpc_port_autofill_response_item_clone(list_autofill_response_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_response_items = g_list_append(h->list_autofill_response_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_response_item_foreach_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, - bool (*callback)(rpc_port_autofill_response_item_h list_autofill_response_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_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_list_autofill_response_item_remove_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_response_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_response_item_h value = iter->data; - h->list_autofill_response_items = g_list_remove_link(h->list_autofill_response_items, iter); - rpc_port_autofill_response_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_response_item_get_list_autofill_response_items_length(rpc_port_list_autofill_response_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_response_items); - - return 0; -} - -struct list_autofill_save_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_save_items; -}; - -static void __list_autofill_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_save_items)); - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_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 __list_autofill_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_save_item_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_save_item_h value = NULL; - - rpc_port_autofill_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h) -{ - struct list_autofill_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_save_item_to; - handle->parcelable.from = __list_autofill_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_item_h value = iter->data; - if (value) - rpc_port_autofill_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_save_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone) -{ - rpc_port_list_autofill_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_save_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_save_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_item_h new_value; - rpc_port_autofill_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_save_item_destroy(handle); - return -1; - } - - rpc_port_autofill_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_save_item_destroy(handle); - return -1; - } - - handle->list_autofill_save_items = g_list_append(handle->list_autofill_save_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items) -{ - if (!h || !list_autofill_save_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_save_item_h value = NULL; - - rpc_port_autofill_save_item_clone(list_autofill_save_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, - bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_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_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_save_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_save_item_h value = iter->data; - h->list_autofill_save_items = g_list_remove_link(h->list_autofill_save_items, iter); - rpc_port_autofill_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_save_items); - - return 0; -} - -enum AutofillAppPort_method_e { - AutofillAppPort_METHOD_Result, - AutofillAppPort_METHOD_Callback, - AutofillAppPort_METHOD_Register, - AutofillAppPort_METHOD_Unregister, - AutofillAppPort_METHOD_request_auth_info, - AutofillAppPort_METHOD_send_fill_request, - AutofillAppPort_METHOD_commit, -}; - -enum AutofillAppPort_delegate_e { - AutofillAppPort_DELEGATE_autofill_auth_info_cb = 1, - AutofillAppPort_DELEGATE_autofill_fill_response_cb = 2, -}; - -struct AutofillAppPort_s { - char *stub_appid; - rpc_port_proxy_h proxy; - rpc_port_h port; - rpc_port_h callback_port; - rpc_port_proxy_AutofillAppPort_callback_s callback; - void *user_data; - GList *delegates; - GRecMutex mutex; -}; - -struct AutofillAppPort_autofill_auth_info_cb_s { - rpc_port_parcelable_t parcelable; - int id; - int seq_id; - AutofillAppPort_autofill_auth_info_cb callback; - bool once; - void *user_data; -}; - -static void __AutofillAppPort_autofill_auth_info_cb_to(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillAppPort_autofill_auth_info_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillAppPort_autofill_auth_info_cb_from(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillAppPort_autofill_auth_info_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -rpc_port_AutofillAppPort_autofill_auth_info_cb_h rpc_port_AutofillAppPort_autofill_auth_info_cb_create(AutofillAppPort_autofill_auth_info_cb callback, bool once, void *user_data) -{ - struct AutofillAppPort_autofill_auth_info_cb_s *handle; - static int seq_num; - - handle = calloc(1, sizeof(struct AutofillAppPort_autofill_auth_info_cb_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->parcelable.to = __AutofillAppPort_autofill_auth_info_cb_to; - handle->parcelable.from= __AutofillAppPort_autofill_auth_info_cb_from; - handle->id = AutofillAppPort_DELEGATE_autofill_auth_info_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->callback = callback; - handle->once = once; - handle->user_data = user_data; - - return handle; -} - -int rpc_port_proxy_AutofillAppPort_autofill_auth_info_cb_destroy(rpc_port_AutofillAppPort_autofill_auth_info_cb_h delegate) -{ - if (!delegate) { - _E("Invalid parameter"); - return -1; - } - - free(delegate); - - return 0; -} - -int rpc_port_proxy_AutofillAppPort_autofill_auth_info_cb_dispose(rpc_port_proxy_AutofillAppPort_h proxy, rpc_port_AutofillAppPort_autofill_auth_info_cb_h delegate) -{ - struct AutofillAppPort_autofill_auth_info_cb_s *handle; - GList *iter; - - if (!proxy || !delegate) { - _E("Invalid handle %p %p", proxy, delegate); - return -1; - } - - iter = proxy->delegates; - while (iter) { - handle = (struct AutofillAppPort_autofill_auth_info_cb_s *)iter->data; - if (handle == delegate) { - proxy->delegates = g_list_remove_link(proxy->delegates, iter); - free(handle); - g_list_free(iter); - return 0; - } - iter = g_list_next(iter); - } - - return -1; -} - -static void __AutofillAppPort_delegate_autofill_auth_info_cb(GList **list, rpc_port_parcel_h parcel, int seq_id, int id) -{ - rpc_port_autofill_auth_info_h auth_info; - - rpc_port_autofill_auth_info_create(&auth_info); - rpc_port_parcel_read(parcel, &auth_info->parcelable, auth_info); - - do { - struct AutofillAppPort_autofill_auth_info_cb_s *handle; - GList *iter; - - iter = *list; - while (iter) { - handle = (struct AutofillAppPort_autofill_auth_info_cb_s *)iter->data; - if (handle->seq_id == seq_id && handle->id == id) { - handle->callback(handle->user_data, auth_info); - - if (handle->once) { - *list = g_list_remove_link(*list, iter); - free(handle); - g_list_free(iter); - } - break; - } - iter = g_list_next(iter); - } - } while (0); - rpc_port_autofill_auth_info_destroy(auth_info); -} - -struct AutofillAppPort_autofill_fill_response_cb_s { - rpc_port_parcelable_t parcelable; - int id; - int seq_id; - AutofillAppPort_autofill_fill_response_cb callback; - bool once; - void *user_data; -}; - -static void __AutofillAppPort_autofill_fill_response_cb_to(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillAppPort_autofill_fill_response_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillAppPort_autofill_fill_response_cb_from(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillAppPort_autofill_fill_response_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -rpc_port_AutofillAppPort_autofill_fill_response_cb_h rpc_port_AutofillAppPort_autofill_fill_response_cb_create(AutofillAppPort_autofill_fill_response_cb callback, bool once, void *user_data) -{ - struct AutofillAppPort_autofill_fill_response_cb_s *handle; - static int seq_num; - - handle = calloc(1, sizeof(struct AutofillAppPort_autofill_fill_response_cb_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->parcelable.to = __AutofillAppPort_autofill_fill_response_cb_to; - handle->parcelable.from= __AutofillAppPort_autofill_fill_response_cb_from; - handle->id = AutofillAppPort_DELEGATE_autofill_fill_response_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->callback = callback; - handle->once = once; - handle->user_data = user_data; - - return handle; -} - -int rpc_port_proxy_AutofillAppPort_autofill_fill_response_cb_destroy(rpc_port_AutofillAppPort_autofill_fill_response_cb_h delegate) -{ - if (!delegate) { - _E("Invalid parameter"); - return -1; - } - - free(delegate); - - return 0; -} - -int rpc_port_proxy_AutofillAppPort_autofill_fill_response_cb_dispose(rpc_port_proxy_AutofillAppPort_h proxy, rpc_port_AutofillAppPort_autofill_fill_response_cb_h delegate) -{ - struct AutofillAppPort_autofill_fill_response_cb_s *handle; - GList *iter; - - if (!proxy || !delegate) { - _E("Invalid handle %p %p", proxy, delegate); - return -1; - } - - iter = proxy->delegates; - while (iter) { - handle = (struct AutofillAppPort_autofill_fill_response_cb_s *)iter->data; - if (handle == delegate) { - proxy->delegates = g_list_remove_link(proxy->delegates, iter); - free(handle); - g_list_free(iter); - return 0; - } - iter = g_list_next(iter); - } - - return -1; -} - -static void __AutofillAppPort_delegate_autofill_fill_response_cb(GList **list, rpc_port_parcel_h parcel, int seq_id, int id) -{ - rpc_port_autofill_fill_response_h response; - - rpc_port_autofill_fill_response_create(&response); - rpc_port_parcel_read(parcel, &response->parcelable, response); - - do { - struct AutofillAppPort_autofill_fill_response_cb_s *handle; - GList *iter; - - iter = *list; - while (iter) { - handle = (struct AutofillAppPort_autofill_fill_response_cb_s *)iter->data; - if (handle->seq_id == seq_id && handle->id == id) { - handle->callback(handle->user_data, response); - - if (handle->once) { - *list = g_list_remove_link(*list, iter); - free(handle); - g_list_free(iter); - } - break; - } - iter = g_list_next(iter); - } - } while (0); - rpc_port_autofill_fill_response_destroy(response); -} - -static proxy_delegate __AutofillAppPort_delegate_table[] = { - [AutofillAppPort_DELEGATE_autofill_auth_info_cb] = __AutofillAppPort_delegate_autofill_auth_info_cb, - [AutofillAppPort_DELEGATE_autofill_fill_response_cb] = __AutofillAppPort_delegate_autofill_fill_response_cb, -}; - -static void __AutofillAppPort_process_received_event(GList **list, rpc_port_parcel_h parcel) -{ - int id; - int seq_id; - bool once; - - rpc_port_parcel_read_int32(parcel, &id); - rpc_port_parcel_read_int32(parcel, &seq_id); - rpc_port_parcel_read_bool(parcel, &once); - - if (id > 0 && id < (sizeof(__AutofillAppPort_delegate_table) / sizeof(__AutofillAppPort_delegate_table[0]))) { - if (__AutofillAppPort_delegate_table[id]) - __AutofillAppPort_delegate_table[id](list, parcel, seq_id, id); - } else { - _W("Unknown id(%d)", id); - } -} - -static rpc_port_parcel_h __AutofillAppPort_consume_command(rpc_port_proxy_AutofillAppPort_h h) -{ - rpc_port_parcel_h parcel = NULL; - int cmd = -1; - - do { - rpc_port_parcel_create_from_port(&parcel, h->port); - if (!parcel) - break; - - rpc_port_parcel_read_int32(parcel, &cmd); - if (cmd == AutofillAppPort_METHOD_Result) - return parcel; - - rpc_port_parcel_destroy(parcel); - parcel = NULL; - } while (true); - - return NULL; -} - -static void __AutofillAppPort_on_connected(const char *endpoint, const char *port_name, rpc_port_h port, void *data) -{ - rpc_port_proxy_AutofillAppPort_h handle = data; - - handle->port = port; - rpc_port_proxy_get_port(handle->proxy, RPC_PORT_PORT_CALLBACK, &handle->callback_port); - if (handle->callback.connected) - handle->callback.connected(handle, handle->user_data); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -static void __AutofillAppPort_on_disconnected(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_AutofillAppPort_h handle = data; - - handle->port = NULL; - if (handle->callback.disconnected) - handle->callback.disconnected(handle, handle->user_data); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -static void __AutofillAppPort_on_rejected(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_AutofillAppPort_h handle = data; - - handle->port = NULL; - if (handle->callback.rejected) - handle->callback.rejected(handle, handle->user_data); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -static void __AutofillAppPort_on_received(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_AutofillAppPort_h handle = data; - rpc_port_parcel_h parcel_received; - int cmd = -1; - - rpc_port_parcel_create_from_port(&parcel_received, handle->callback_port); - rpc_port_parcel_read_int32(parcel_received, &cmd); - if (cmd != AutofillAppPort_METHOD_Callback) { - _E("Invalid protocol"); - rpc_port_parcel_destroy(parcel_received); - return; - } - - __AutofillAppPort_process_received_event(&handle->delegates, parcel_received); - rpc_port_parcel_destroy(parcel_received); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -int rpc_port_proxy_AutofillAppPort_invoke_Register(rpc_port_proxy_AutofillAppPort_h h, rpc_port_AutofillAppPort_autofill_auth_info_cb_h auth_info_cb, rpc_port_AutofillAppPort_autofill_fill_response_cb_h fill_response_cb) -{ - rpc_port_parcel_h parcel; - int r; - int ret = -1; - - if (!h || !auth_info_cb || !fill_response_cb) { - _E("Invalid parameter"); - return ret; - } - - if (!h->port) { - _E("Not connected"); - return ret; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_Register); - - do { - struct AutofillAppPort_autofill_auth_info_cb_s *handle = auth_info_cb; - - rpc_port_parcel_write(parcel, &handle->parcelable, handle); - h->delegates = g_list_append(h->delegates, handle); - } while (0); - - do { - struct AutofillAppPort_autofill_fill_response_cb_s *handle = fill_response_cb; - - rpc_port_parcel_write(parcel, &handle->parcelable, handle); - h->delegates = g_list_append(h->delegates, handle); - } while (0); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - - g_rec_mutex_lock(&h->mutex); - do { - rpc_port_parcel_h parcel_received; - - parcel_received = __AutofillAppPort_consume_command(h); - if (!parcel_received) { - _E("Invalid protocol"); - break; - } - - rpc_port_parcel_read_int32(parcel_received, &ret); - - rpc_port_parcel_destroy(parcel_received); - } while (0); - g_rec_mutex_unlock(&h->mutex); - set_last_result(r); - - return ret; -} - -void rpc_port_proxy_AutofillAppPort_invoke_Unregister(rpc_port_proxy_AutofillAppPort_h h) -{ - rpc_port_parcel_h parcel; - int r; - - if (!h) { - _E("Invalid parameter"); - return; - } - - if (!h->port) { - _E("Not connected"); - return; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_Unregister); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - set_last_result(r); -} - -int rpc_port_proxy_AutofillAppPort_invoke_request_auth_info(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_view_info_h vi) -{ - rpc_port_parcel_h parcel; - int r; - int ret = -1; - - if (!h || !vi) { - _E("Invalid parameter"); - return ret; - } - - if (!h->port) { - _E("Not connected"); - return ret; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_request_auth_info); - rpc_port_parcel_write(parcel, &vi->parcelable, vi); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - - g_rec_mutex_lock(&h->mutex); - do { - rpc_port_parcel_h parcel_received; - - parcel_received = __AutofillAppPort_consume_command(h); - if (!parcel_received) { - _E("Invalid protocol"); - break; - } - - rpc_port_parcel_read_int32(parcel_received, &ret); - - rpc_port_parcel_destroy(parcel_received); - } while (0); - g_rec_mutex_unlock(&h->mutex); - set_last_result(r); - - return ret; -} - -int rpc_port_proxy_AutofillAppPort_invoke_send_fill_request(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_view_info_h vi) -{ - rpc_port_parcel_h parcel; - int r; - int ret = -1; - - if (!h || !vi) { - _E("Invalid parameter"); - return ret; - } - - if (!h->port) { - _E("Not connected"); - return ret; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_send_fill_request); - rpc_port_parcel_write(parcel, &vi->parcelable, vi); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - - g_rec_mutex_lock(&h->mutex); - do { - rpc_port_parcel_h parcel_received; - - parcel_received = __AutofillAppPort_consume_command(h); - if (!parcel_received) { - _E("Invalid protocol"); - break; - } - - rpc_port_parcel_read_int32(parcel_received, &ret); - - rpc_port_parcel_destroy(parcel_received); - } while (0); - g_rec_mutex_unlock(&h->mutex); - set_last_result(r); - - return ret; -} - -int rpc_port_proxy_AutofillAppPort_invoke_commit(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_save_view_info_h vi) -{ - rpc_port_parcel_h parcel; - int r; - int ret = -1; - - if (!h || !vi) { - _E("Invalid parameter"); - return ret; - } - - if (!h->port) { - _E("Not connected"); - return ret; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_commit); - rpc_port_parcel_write(parcel, &vi->parcelable, vi); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - - g_rec_mutex_lock(&h->mutex); - do { - rpc_port_parcel_h parcel_received; - - parcel_received = __AutofillAppPort_consume_command(h); - if (!parcel_received) { - _E("Invalid protocol"); - break; - } - - rpc_port_parcel_read_int32(parcel_received, &ret); - - rpc_port_parcel_destroy(parcel_received); - } while (0); - g_rec_mutex_unlock(&h->mutex); - set_last_result(r); - - return ret; -} - -static struct AutofillAppPort_s *__create_AutofillAppPort(const char *stub_appid, rpc_port_proxy_AutofillAppPort_callback_s *callback, void *user_data) -{ - struct AutofillAppPort_s *handle; - - handle = calloc(1, sizeof(struct AutofillAppPort_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->stub_appid = strdup(stub_appid); - if (!handle->stub_appid) { - _E("Out of memory"); - free(handle); - return NULL; - } - - rpc_port_proxy_create(&handle->proxy); - if (!handle->proxy) { - _E("Failed to create proxy"); - free(handle->stub_appid); - free(handle); - return NULL; - } - - g_rec_mutex_init(&handle->mutex); - - handle->callback = *callback; - handle->user_data = user_data; - - return handle; -} - -static void __destroy_AutofillAppPort(struct AutofillAppPort_s *h) -{ - if (!h) - return; - - g_rec_mutex_clear(&h->mutex); - - if (h->delegates) - g_list_free_full(h->delegates, free); - - if (h->proxy) - rpc_port_proxy_destroy(h->proxy); - - if (h->stub_appid) - free(h->stub_appid); - - free(h); -} - -int rpc_port_proxy_AutofillAppPort_create(const char *stub_appid, rpc_port_proxy_AutofillAppPort_callback_s *callback, void *user_data, rpc_port_proxy_AutofillAppPort_h *h) -{ - struct AutofillAppPort_s *handle; - int r; - - if (!stub_appid || !callback || !h) { - _E("Invalid parameter"); - return -1; - } - - handle = __create_AutofillAppPort(stub_appid, callback, user_data); - if (!handle) - return -1; - - r = rpc_port_proxy_add_connected_event_cb(handle->proxy, __AutofillAppPort_on_connected, handle); - if (r != 0) { - _E("Failed to add connected event cb. err = %d", r); - __destroy_AutofillAppPort(handle); - return r; - } - - r = rpc_port_proxy_add_disconnected_event_cb(handle->proxy, __AutofillAppPort_on_disconnected, handle); - if (r != 0) { - _E("Failed to add disconnected event cb. err = %d", r); - __destroy_AutofillAppPort(handle); - return r; - } - - r = rpc_port_proxy_add_rejected_event_cb(handle->proxy, __AutofillAppPort_on_rejected, handle); - if (r != 0) { - _E("Failed to add rejected event cb. err = %d", r); - __destroy_AutofillAppPort(handle); - return r; - } - - r = rpc_port_proxy_add_received_event_cb(handle->proxy, __AutofillAppPort_on_received, handle); - if (r != 0) { - _E("Failed to add received event cb. err = %d", r); - __destroy_AutofillAppPort(handle); - return r; - } - - *h = handle; - - return 0; -} - -int rpc_port_proxy_AutofillAppPort_connect(rpc_port_proxy_AutofillAppPort_h h) -{ - int r; - - if (!h || !h->proxy) { - _E("Invalid parameter"); - return -1; - } - - r = rpc_port_proxy_connect(h->proxy, h->stub_appid, "AutofillAppPort"); - if (r != 0) { - _E("Failed to connect AutofillAppPort(%s)", h->stub_appid); - return r; - } - - return 0; -} - -int rpc_port_proxy_AutofillAppPort_destroy(rpc_port_proxy_AutofillAppPort_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - __destroy_AutofillAppPort(h); - return 0; -} diff --git a/client/autofill_proxy.h b/client/autofill_proxy.h deleted file mode 100644 index 327f38c..0000000 --- a/client/autofill_proxy.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct autofill_item_s *rpc_port_autofill_item_h; - -int rpc_port_autofill_item_create(rpc_port_autofill_item_h *h); - -int rpc_port_autofill_item_destroy(rpc_port_autofill_item_h h); - -int rpc_port_autofill_item_clone(rpc_port_autofill_item_h h, rpc_port_autofill_item_h *clone); - -int rpc_port_autofill_item_set_id(rpc_port_autofill_item_h h, const char *id); - -int rpc_port_autofill_item_set_label(rpc_port_autofill_item_h h, const char *label); - -int rpc_port_autofill_item_set_value(rpc_port_autofill_item_h h, const char *value); - -int rpc_port_autofill_item_set_autofill_hint(rpc_port_autofill_item_h h, int autofill_hint); - -int rpc_port_autofill_item_set_is_sensitive_data(rpc_port_autofill_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_item_get_id(rpc_port_autofill_item_h h, char **id); - -int rpc_port_autofill_item_get_label(rpc_port_autofill_item_h h, char **label); - -int rpc_port_autofill_item_get_value(rpc_port_autofill_item_h h, char **value); - -int rpc_port_autofill_item_get_autofill_hint(rpc_port_autofill_item_h h, int *autofill_hint); - -int rpc_port_autofill_item_get_is_sensitive_data(rpc_port_autofill_item_h h, bool *is_sensitive_data); - -typedef struct autofill_view_info_s *rpc_port_autofill_view_info_h; - -int rpc_port_autofill_view_info_create(rpc_port_autofill_view_info_h *h); - -int rpc_port_autofill_view_info_destroy(rpc_port_autofill_view_info_h h); - -int rpc_port_autofill_view_info_clone(rpc_port_autofill_view_info_h h, rpc_port_autofill_view_info_h *clone); - -int rpc_port_autofill_view_info_set_view_id(rpc_port_autofill_view_info_h h, const char *view_id); - -int rpc_port_autofill_view_info_add_items(rpc_port_autofill_view_info_h h, rpc_port_autofill_item_h items); - -int rpc_port_autofill_view_info_get_view_id(rpc_port_autofill_view_info_h h, char **view_id); - -int rpc_port_autofill_view_info_foreach_items(rpc_port_autofill_view_info_h h, - bool (*callback)(rpc_port_autofill_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_view_info_remove_items(rpc_port_autofill_view_info_h h, unsigned int nth); - -int rpc_port_autofill_view_info_get_items_length(rpc_port_autofill_view_info_h h, unsigned int *length); - -typedef struct autofill_save_item_s *rpc_port_autofill_save_item_h; - -int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h); - -int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h); - -int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone); - -int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id); - -int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label); - -int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value); - -int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint); - -int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id); - -int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label); - -int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value); - -int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint); - -int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data); - -typedef struct autofill_save_view_info_s *rpc_port_autofill_save_view_info_h; - -int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h); - -int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h); - -int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone); - -int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id); - -int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items); - -int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id); - -int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h, - bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth); - -int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length); - -typedef struct autofill_auth_info_s *rpc_port_autofill_auth_info_h; - -int rpc_port_autofill_auth_info_create(rpc_port_autofill_auth_info_h *h); - -int rpc_port_autofill_auth_info_destroy(rpc_port_autofill_auth_info_h h); - -int rpc_port_autofill_auth_info_clone(rpc_port_autofill_auth_info_h h, rpc_port_autofill_auth_info_h *clone); - -int rpc_port_autofill_auth_info_set_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool exist_autofill_data); - -int rpc_port_autofill_auth_info_set_need_authentication(rpc_port_autofill_auth_info_h h, bool need_authentication); - -int rpc_port_autofill_auth_info_set_service_name(rpc_port_autofill_auth_info_h h, const char *service_name); - -int rpc_port_autofill_auth_info_set_service_logo_image_path(rpc_port_autofill_auth_info_h h, const char *service_logo_image_path); - -int rpc_port_autofill_auth_info_set_service_message(rpc_port_autofill_auth_info_h h, const char *service_message); - -int rpc_port_autofill_auth_info_get_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool *exist_autofill_data); - -int rpc_port_autofill_auth_info_get_need_authentication(rpc_port_autofill_auth_info_h h, bool *need_authentication); - -int rpc_port_autofill_auth_info_get_service_name(rpc_port_autofill_auth_info_h h, char **service_name); - -int rpc_port_autofill_auth_info_get_service_logo_image_path(rpc_port_autofill_auth_info_h h, char **service_logo_image_path); - -int rpc_port_autofill_auth_info_get_service_message(rpc_port_autofill_auth_info_h h, char **service_message); - -typedef struct autofill_response_item_s *rpc_port_autofill_response_item_h; - -int rpc_port_autofill_response_item_create(rpc_port_autofill_response_item_h *h); - -int rpc_port_autofill_response_item_destroy(rpc_port_autofill_response_item_h h); - -int rpc_port_autofill_response_item_clone(rpc_port_autofill_response_item_h h, rpc_port_autofill_response_item_h *clone); - -int rpc_port_autofill_response_item_set_id(rpc_port_autofill_response_item_h h, const char *id); - -int rpc_port_autofill_response_item_set_presentation_text(rpc_port_autofill_response_item_h h, const char *presentation_text); - -int rpc_port_autofill_response_item_set_value(rpc_port_autofill_response_item_h h, const char *value); - -int rpc_port_autofill_response_item_get_id(rpc_port_autofill_response_item_h h, char **id); - -int rpc_port_autofill_response_item_get_presentation_text(rpc_port_autofill_response_item_h h, char **presentation_text); - -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); - -int rpc_port_autofill_fill_response_destroy(rpc_port_autofill_fill_response_h h); - -int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, rpc_port_autofill_fill_response_h *clone); - -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_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_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_groups(rpc_port_autofill_fill_response_h h, unsigned int nth); - -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; - -int rpc_port_list_autofill_item_create(rpc_port_list_autofill_item_h *h); - -int rpc_port_list_autofill_item_destroy(rpc_port_list_autofill_item_h h); - -int rpc_port_list_autofill_item_clone(rpc_port_list_autofill_item_h h, rpc_port_list_autofill_item_h *clone); - -int rpc_port_list_autofill_item_add_list_autofill_items(rpc_port_list_autofill_item_h h, rpc_port_autofill_item_h list_autofill_items); - -int rpc_port_list_autofill_item_foreach_list_autofill_items(rpc_port_list_autofill_item_h h, - bool (*callback)(rpc_port_autofill_item_h list_autofill_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_item_remove_list_autofill_items(rpc_port_list_autofill_item_h h, unsigned int nth); - -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); - -int rpc_port_list_autofill_response_item_destroy(rpc_port_list_autofill_response_item_h h); - -int rpc_port_list_autofill_response_item_clone(rpc_port_list_autofill_response_item_h h, rpc_port_list_autofill_response_item_h *clone); - -int rpc_port_list_autofill_response_item_add_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, rpc_port_autofill_response_item_h list_autofill_response_items); - -int rpc_port_list_autofill_response_item_foreach_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, - bool (*callback)(rpc_port_autofill_response_item_h list_autofill_response_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_response_item_remove_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, unsigned int nth); - -int rpc_port_list_autofill_response_item_get_list_autofill_response_items_length(rpc_port_list_autofill_response_item_h h, unsigned int *length); - -typedef struct list_autofill_save_item_s *rpc_port_list_autofill_save_item_h; - -int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h); - -int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h); - -int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone); - -int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items); - -int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, - bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth); - -int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length); - -typedef struct AutofillAppPort_s *rpc_port_proxy_AutofillAppPort_h; - -typedef struct { - void (*connected)(rpc_port_proxy_AutofillAppPort_h h, void *user_data); - void (*disconnected)(rpc_port_proxy_AutofillAppPort_h h, void *user_data); - void (*rejected)(rpc_port_proxy_AutofillAppPort_h h, void *user_data); -} rpc_port_proxy_AutofillAppPort_callback_s; - -typedef struct AutofillAppPort_autofill_auth_info_cb_s *rpc_port_AutofillAppPort_autofill_auth_info_cb_h; - -typedef void (*AutofillAppPort_autofill_auth_info_cb)(void *user_data, rpc_port_autofill_auth_info_h auth_info); - -rpc_port_AutofillAppPort_autofill_auth_info_cb_h rpc_port_AutofillAppPort_autofill_auth_info_cb_create(AutofillAppPort_autofill_auth_info_cb callback, bool once, void *user_data); - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_destroy(rpc_port_AutofillAppPort_autofill_auth_info_cb_h delegate); - -int rpc_port_proxy_AutofillAppPort_autofill_auth_info_cb_dispose(rpc_port_proxy_AutofillAppPort_h proxy, rpc_port_AutofillAppPort_autofill_auth_info_cb_h delegate); - -typedef struct AutofillAppPort_autofill_fill_response_cb_s *rpc_port_AutofillAppPort_autofill_fill_response_cb_h; - -typedef void (*AutofillAppPort_autofill_fill_response_cb)(void *user_data, rpc_port_autofill_fill_response_h response); - -rpc_port_AutofillAppPort_autofill_fill_response_cb_h rpc_port_AutofillAppPort_autofill_fill_response_cb_create(AutofillAppPort_autofill_fill_response_cb callback, bool once, void *user_data); - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_destroy(rpc_port_AutofillAppPort_autofill_fill_response_cb_h delegate); - -int rpc_port_proxy_AutofillAppPort_autofill_fill_response_cb_dispose(rpc_port_proxy_AutofillAppPort_h proxy, rpc_port_AutofillAppPort_autofill_fill_response_cb_h delegate); - -int rpc_port_proxy_AutofillAppPort_create(const char *stub_appid, - rpc_port_proxy_AutofillAppPort_callback_s *callback, void *user_data, - rpc_port_proxy_AutofillAppPort_h *h); - -int rpc_port_proxy_AutofillAppPort_connect(rpc_port_proxy_AutofillAppPort_h h); - -int rpc_port_proxy_AutofillAppPort_destroy(rpc_port_proxy_AutofillAppPort_h h); - -int rpc_port_proxy_AutofillAppPort_invoke_Register(rpc_port_proxy_AutofillAppPort_h h, rpc_port_AutofillAppPort_autofill_auth_info_cb_h auth_info_cb, rpc_port_AutofillAppPort_autofill_fill_response_cb_h fill_response_cb); - -void rpc_port_proxy_AutofillAppPort_invoke_Unregister(rpc_port_proxy_AutofillAppPort_h h); - -int rpc_port_proxy_AutofillAppPort_invoke_request_auth_info(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_view_info_h vi); - -int rpc_port_proxy_AutofillAppPort_invoke_send_fill_request(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_view_info_h vi); - -int rpc_port_proxy_AutofillAppPort_invoke_commit(rpc_port_proxy_AutofillAppPort_h h, rpc_port_autofill_save_view_info_h vi); - -#ifdef __cplusplus -} -#endif diff --git a/packaging/capi-ui-autofill.spec b/packaging/capi-ui-autofill.spec index 4556326..088d231 100644 --- a/packaging/capi-ui-autofill.spec +++ b/packaging/capi-ui-autofill.spec @@ -6,6 +6,7 @@ Group: Graphics & UI Framework/Input License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake +BuildRequires: tidl BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-appfw-service-application) @@ -99,6 +100,21 @@ Autofill Service application %prep %setup -q +tidlc -p -l C -i tidl/autofill.tidl -o autofill_proxy +mv autofill_proxy.h ./client/ +mv autofill_proxy.c ./client/ + +tidlc -s -l C -i tidl/autofill.tidl -o autofill_stub +mv autofill_stub.h ./server/ +mv autofill_stub.c ./server/ + +tidlc -p -l C -i tidl/autofill_service.tidl -o autofill_service_proxy +mv autofill_service_proxy.h ./server/ +mv autofill_service_proxy.c ./server/ + +tidlc -s -l C -i tidl/autofill_service.tidl -o autofill_service_stub +mv autofill_service_stub.h ./service_lib/ +mv autofill_service_stub.c ./service_lib/ %build diff --git a/prebuild.sh b/prebuild.sh deleted file mode 100755 index 3771c0f..0000000 --- a/prebuild.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -x -tidlc -p -l C -i tidl/autofill.tidl -o autofill_proxy -mv autofill_proxy.h ./client/ -mv autofill_proxy.c ./client/ - -tidlc -s -l C -i tidl/autofill.tidl -o autofill_stub -mv autofill_stub.h ./server/ -mv autofill_stub.c ./server/ - -tidlc -p -l C -i tidl/autofill_service.tidl -o autofill_service_proxy -mv autofill_service_proxy.h ./server/ -mv autofill_service_proxy.c ./server/ - -tidlc -s -l C -i tidl/autofill_service.tidl -o autofill_service_stub -mv autofill_service_stub.h ./service_lib/ -mv autofill_service_stub.c ./service_lib/ diff --git a/server/autofill_service_proxy.c b/server/autofill_service_proxy.c deleted file mode 100644 index bcda662..0000000 --- a/server/autofill_service_proxy.c +++ /dev/null @@ -1,4161 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "autofill_service_proxy.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "RPC_PORT_PROXY" - -#ifdef _E -#undef _E -#endif - -#ifdef _W -#undef _W -#endif - -#ifdef _I -#undef _I -#endif - -#ifdef _D -#undef _D -#endif - -#define _E(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _W(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _I(fmt, ...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _D(fmt, ...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -typedef void (*proxy_delegate)(GList **list, rpc_port_parcel_h parcel, int seq_id, int id); - -struct autofill_svc_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_svc_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_svc_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_svc_item_create(rpc_port_autofill_svc_item_h *h) -{ - struct autofill_svc_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_item_to; - handle->parcelable.from = __autofill_svc_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_item_destroy(rpc_port_autofill_svc_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_item_clone(rpc_port_autofill_svc_item_h h, rpc_port_autofill_svc_item_h *clone) -{ - rpc_port_autofill_svc_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_svc_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_svc_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_svc_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_item_set_id(rpc_port_autofill_svc_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_set_label(rpc_port_autofill_svc_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_set_value(rpc_port_autofill_svc_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_set_autofill_hint(rpc_port_autofill_svc_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_item_set_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_svc_item_get_id(rpc_port_autofill_svc_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_get_label(rpc_port_autofill_svc_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_get_value(rpc_port_autofill_svc_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_get_autofill_hint(rpc_port_autofill_svc_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_item_get_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_svc_view_info_s { - rpc_port_parcelable_t parcelable; - char *app_id; - char *view_id; - GList *items; -}; - -static void __autofill_svc_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - 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->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_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_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->app_id); - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_svc_item_h value = NULL; - - rpc_port_autofill_svc_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_svc_view_info_create(rpc_port_autofill_svc_view_info_h *h) -{ - struct autofill_svc_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_view_info_to; - handle->parcelable.from = __autofill_svc_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_view_info_destroy(rpc_port_autofill_svc_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) - free(h->app_id); - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_view_info_clone(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_view_info_h *clone) -{ - rpc_port_autofill_svc_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_view_info handle"); - return -1; - } - - if (h->app_id) { - handle->app_id = strdup(h->app_id); - if (!handle->app_id) { - _E("Failed to duplicate h->app_id"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_item_h new_value; - rpc_port_autofill_svc_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_view_info_set_app_id(rpc_port_autofill_svc_view_info_h h, const char *app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) { - free(h->app_id); - h->app_id = NULL; - } - - h->app_id = strdup(app_id); - if (!h->app_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_set_view_id(rpc_port_autofill_svc_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_add_items(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_item_h value = NULL; - - rpc_port_autofill_svc_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_svc_view_info_get_app_id(rpc_port_autofill_svc_view_info_h h, char **app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->app_id) { - _E("Invalid parameter: h->app_id is NULL"); - return -1; - } - - *app_id = strdup(h->app_id); - if (*app_id == NULL) { - _E("Failed to duplicate app_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_get_view_id(rpc_port_autofill_svc_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_foreach_items(rpc_port_autofill_svc_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_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_view_info_remove_items(rpc_port_autofill_svc_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_svc_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_svc_view_info_get_items_length(rpc_port_autofill_svc_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_svc_save_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h) -{ - struct autofill_svc_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_save_item_to; - handle->parcelable.from = __autofill_svc_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone) -{ - rpc_port_autofill_svc_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_save_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_save_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_svc_save_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_svc_save_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_svc_save_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_svc_save_view_info_s { - rpc_port_parcelable_t parcelable; - char *view_id; - GList *items; -}; - -static void __autofill_svc_save_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_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_save_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_svc_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h) -{ - struct autofill_svc_save_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_save_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_save_view_info_to; - handle->parcelable.from = __autofill_svc_save_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone) -{ - rpc_port_autofill_svc_save_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_save_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_save_view_info handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_svc_save_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_item_h new_value; - rpc_port_autofill_svc_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_svc_save_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_svc_save_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_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_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_save_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_svc_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_svc_auth_info_s { - rpc_port_parcelable_t parcelable; - char *app_id; - bool exist_autofill_data; - bool need_authentication; - char *service_name; - char *service_logo_image_path; - char *service_message; -}; - -static void __autofill_svc_auth_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->app_id ? h->app_id : ""); - rpc_port_parcel_write_bool(parcel, h->exist_autofill_data); - rpc_port_parcel_write_bool(parcel, h->need_authentication); - rpc_port_parcel_write_string(parcel, h->service_name ? h->service_name : ""); - rpc_port_parcel_write_string(parcel, h->service_logo_image_path ? h->service_logo_image_path : ""); - rpc_port_parcel_write_string(parcel, h->service_message ? h->service_message : ""); -} - -static void __autofill_svc_auth_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->app_id); - rpc_port_parcel_read_bool(parcel, &h->exist_autofill_data); - rpc_port_parcel_read_bool(parcel, &h->need_authentication); - rpc_port_parcel_read_string(parcel, &h->service_name); - rpc_port_parcel_read_string(parcel, &h->service_logo_image_path); - rpc_port_parcel_read_string(parcel, &h->service_message); -} - -int rpc_port_autofill_svc_auth_info_create(rpc_port_autofill_svc_auth_info_h *h) -{ - struct autofill_svc_auth_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_auth_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_auth_info_to; - handle->parcelable.from = __autofill_svc_auth_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_auth_info_destroy(rpc_port_autofill_svc_auth_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) - free(h->app_id); - - if (h->service_name) - free(h->service_name); - - if (h->service_logo_image_path) - free(h->service_logo_image_path); - - if (h->service_message) - free(h->service_message); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_auth_info_clone(rpc_port_autofill_svc_auth_info_h h, rpc_port_autofill_svc_auth_info_h *clone) -{ - rpc_port_autofill_svc_auth_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_auth_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_auth_info handle"); - return -1; - } - - if (h->app_id) { - handle->app_id = strdup(h->app_id); - if (!handle->app_id) { - _E("Failed to duplicate h->app_id"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - handle->exist_autofill_data = h->exist_autofill_data; - handle->need_authentication = h->need_authentication; - if (h->service_name) { - handle->service_name = strdup(h->service_name); - if (!handle->service_name) { - _E("Failed to duplicate h->service_name"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_logo_image_path) { - handle->service_logo_image_path = strdup(h->service_logo_image_path); - if (!handle->service_logo_image_path) { - _E("Failed to duplicate h->service_logo_image_path"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_message) { - handle->service_message = strdup(h->service_message); - if (!handle->service_message) { - _E("Failed to duplicate h->service_message"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_app_id(rpc_port_autofill_svc_auth_info_h h, const char *app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) { - free(h->app_id); - h->app_id = NULL; - } - - h->app_id = strdup(app_id); - if (!h->app_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool exist_autofill_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->exist_autofill_data = exist_autofill_data; - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool need_authentication) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->need_authentication = need_authentication; - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_service_name(rpc_port_autofill_svc_auth_info_h h, const char *service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_name) { - free(h->service_name); - h->service_name = NULL; - } - - h->service_name = strdup(service_name); - if (!h->service_name) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, const char *service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_logo_image_path) { - free(h->service_logo_image_path); - h->service_logo_image_path = NULL; - } - - h->service_logo_image_path = strdup(service_logo_image_path); - if (!h->service_logo_image_path) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_service_message(rpc_port_autofill_svc_auth_info_h h, const char *service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_message) { - free(h->service_message); - h->service_message = NULL; - } - - h->service_message = strdup(service_message); - if (!h->service_message) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_app_id(rpc_port_autofill_svc_auth_info_h h, char **app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->app_id) { - _E("Invalid parameter: h->app_id is NULL"); - return -1; - } - - *app_id = strdup(h->app_id); - if (*app_id == NULL) { - _E("Failed to duplicate app_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool *exist_autofill_data) -{ - if (!h || !exist_autofill_data) { - _E("Invalid parameter"); - return -1; - } - - *exist_autofill_data = h->exist_autofill_data; - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool *need_authentication) -{ - if (!h || !need_authentication) { - _E("Invalid parameter"); - return -1; - } - - *need_authentication = h->need_authentication; - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_service_name(rpc_port_autofill_svc_auth_info_h h, char **service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_name) { - _E("Invalid parameter: h->service_name is NULL"); - return -1; - } - - *service_name = strdup(h->service_name); - if (*service_name == NULL) { - _E("Failed to duplicate service_name"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, char **service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_logo_image_path) { - _E("Invalid parameter: h->service_logo_image_path is NULL"); - return -1; - } - - *service_logo_image_path = strdup(h->service_logo_image_path); - if (*service_logo_image_path == NULL) { - _E("Failed to duplicate service_logo_image_path"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_service_message(rpc_port_autofill_svc_auth_info_h h, char **service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_message) { - _E("Invalid parameter: h->service_message is NULL"); - return -1; - } - - *service_message = strdup(h->service_message); - if (*service_message == NULL) { - _E("Failed to duplicate service_message"); - return -1; - } - - return 0; -} - -struct autofill_svc_response_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *presentation_text; - char *value; -}; - -static void __autofill_svc_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->presentation_text ? h->presentation_text : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); -} - -static void __autofill_svc_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->presentation_text); - rpc_port_parcel_read_string(parcel, &h->value); -} - -int rpc_port_autofill_svc_response_item_create(rpc_port_autofill_svc_response_item_h *h) -{ - struct autofill_svc_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_response_item_to; - handle->parcelable.from = __autofill_svc_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_response_item_destroy(rpc_port_autofill_svc_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->presentation_text) - free(h->presentation_text); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_response_item_clone(rpc_port_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h *clone) -{ - rpc_port_autofill_svc_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_response_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_response_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_svc_response_item_destroy(handle); - return -1; - } - } - - if (h->presentation_text) { - handle->presentation_text = strdup(h->presentation_text); - if (!handle->presentation_text) { - _E("Failed to duplicate h->presentation_text"); - rpc_port_autofill_svc_response_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_svc_response_item_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_response_item_set_id(rpc_port_autofill_svc_response_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_set_presentation_text(rpc_port_autofill_svc_response_item_h h, const char *presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (h->presentation_text) { - free(h->presentation_text); - h->presentation_text = NULL; - } - - h->presentation_text = strdup(presentation_text); - if (!h->presentation_text) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_set_value(rpc_port_autofill_svc_response_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_get_id(rpc_port_autofill_svc_response_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_get_presentation_text(rpc_port_autofill_svc_response_item_h h, char **presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (!h->presentation_text) { - _E("Invalid parameter: h->presentation_text is NULL"); - return -1; - } - - *presentation_text = strdup(h->presentation_text); - if (*presentation_text == NULL) { - _E("Failed to duplicate presentation_text"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_get_value(rpc_port_autofill_svc_response_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - 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_groups; -}; - -static void __autofill_svc_fill_response_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - 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_groups)); - do { - GList *iter; - - iter = h->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 __autofill_svc_fill_response_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->app_id); - rpc_port_parcel_read_string(parcel, &h->view_id); - 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->response_groups = g_list_append(h->response_groups, value); - } - } while (0); -} - -int rpc_port_autofill_svc_fill_response_create(rpc_port_autofill_svc_fill_response_h *h) -{ - struct autofill_svc_fill_response_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_fill_response_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_fill_response_to; - handle->parcelable.from = __autofill_svc_fill_response_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_fill_response_destroy(rpc_port_autofill_svc_fill_response_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) - free(h->app_id); - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->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->response_groups); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_fill_response_h *clone) -{ - rpc_port_autofill_svc_fill_response_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_fill_response_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_fill_response handle"); - return -1; - } - - if (h->app_id) { - handle->app_id = strdup(h->app_id); - if (!handle->app_id) { - _E("Failed to duplicate h->app_id"); - rpc_port_autofill_svc_fill_response_destroy(handle); - return -1; - } - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_svc_fill_response_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->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_autofill_svc_fill_response_destroy(handle); - return -1; - } - - 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_groups = g_list_append(handle->response_groups, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_fill_response_set_app_id(rpc_port_autofill_svc_fill_response_h h, const char *app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) { - free(h->app_id); - h->app_id = NULL; - } - - h->app_id = strdup(app_id); - if (!h->app_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_fill_response_set_view_id(rpc_port_autofill_svc_fill_response_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -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_groups) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_response_group_h value = NULL; - - rpc_port_autofill_svc_response_group_clone(response_groups, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->response_groups = g_list_append(h->response_groups, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_svc_fill_response_get_app_id(rpc_port_autofill_svc_fill_response_h h, char **app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->app_id) { - _E("Invalid parameter: h->app_id is NULL"); - return -1; - } - - *app_id = strdup(h->app_id); - if (*app_id == NULL) { - _E("Failed to duplicate app_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_fill_response_get_view_id(rpc_port_autofill_svc_fill_response_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -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"); - return -1; - } - - do { - GList *iter; - - iter = h->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_autofill_svc_fill_response_remove_response_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->response_groups, nth); - if (iter == NULL) - return -1; - - 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_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_groups); - - return 0; -} - -struct list_autofill_svc_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_svc_items; -}; - -static void __list_autofill_svc_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_items)); - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_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 __list_autofill_svc_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_item_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_item_h value = NULL; - - rpc_port_autofill_svc_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_svc_items = g_list_append(h->list_autofill_svc_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_svc_item_create(rpc_port_list_autofill_svc_item_h *h) -{ - struct list_autofill_svc_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_svc_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_svc_item_to; - handle->parcelable.from = __list_autofill_svc_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_item_destroy(rpc_port_list_autofill_svc_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_svc_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_svc_item_clone(rpc_port_list_autofill_svc_item_h h, rpc_port_list_autofill_svc_item_h *clone) -{ - rpc_port_list_autofill_svc_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_svc_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_svc_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_item_h new_value; - rpc_port_autofill_svc_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_svc_item_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_svc_item_destroy(handle); - return -1; - } - - handle->list_autofill_svc_items = g_list_append(handle->list_autofill_svc_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_item_add_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, rpc_port_autofill_svc_item_h list_autofill_svc_items) -{ - if (!h || !list_autofill_svc_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_item_h value = NULL; - - rpc_port_autofill_svc_item_clone(list_autofill_svc_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_svc_items = g_list_append(h->list_autofill_svc_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_svc_item_foreach_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, - bool (*callback)(rpc_port_autofill_svc_item_h list_autofill_svc_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_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_list_autofill_svc_item_remove_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_svc_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_item_h value = iter->data; - h->list_autofill_svc_items = g_list_remove_link(h->list_autofill_svc_items, iter); - rpc_port_autofill_svc_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_svc_item_get_list_autofill_svc_items_length(rpc_port_list_autofill_svc_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_svc_items); - - 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; -}; - -static void __list_autofill_svc_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_response_item_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_items)); - do { - GList *iter; - - iter = h->list_autofill_svc_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 __list_autofill_svc_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_response_item_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->list_autofill_svc_response_items = g_list_append(h->list_autofill_svc_response_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_svc_response_item_create(rpc_port_list_autofill_svc_response_item_h *h) -{ - struct list_autofill_svc_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_svc_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_svc_response_item_to; - handle->parcelable.from = __list_autofill_svc_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_destroy(rpc_port_list_autofill_svc_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_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->list_autofill_svc_response_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_clone(rpc_port_list_autofill_svc_response_item_h h, rpc_port_list_autofill_svc_response_item_h *clone) -{ - rpc_port_list_autofill_svc_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_svc_response_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_svc_response_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_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_list_autofill_svc_response_item_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_response_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_svc_response_item_destroy(handle); - return -1; - } - - handle->list_autofill_svc_response_items = g_list_append(handle->list_autofill_svc_response_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_add_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items) -{ - if (!h || !list_autofill_svc_response_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_response_item_h value = NULL; - - rpc_port_autofill_svc_response_item_clone(list_autofill_svc_response_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_svc_response_items = g_list_append(h->list_autofill_svc_response_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_foreach_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, - bool (*callback)(rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_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_list_autofill_svc_response_item_remove_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_svc_response_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_response_item_h value = iter->data; - h->list_autofill_svc_response_items = g_list_remove_link(h->list_autofill_svc_response_items, iter); - rpc_port_autofill_svc_response_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_get_list_autofill_svc_response_items_length(rpc_port_list_autofill_svc_response_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_svc_response_items); - - return 0; -} - -struct list_autofill_svc_save_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_svc_save_items; -}; - -static void __list_autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_save_items)); - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_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 __list_autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_save_item_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_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h) -{ - struct list_autofill_svc_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_svc_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_svc_save_item_to; - handle->parcelable.from = __list_autofill_svc_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_svc_save_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone) -{ - rpc_port_list_autofill_svc_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_svc_save_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_svc_save_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_item_h new_value; - rpc_port_autofill_svc_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_svc_save_item_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_svc_save_item_destroy(handle); - return -1; - } - - handle->list_autofill_svc_save_items = g_list_append(handle->list_autofill_svc_save_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items) -{ - if (!h || !list_autofill_svc_save_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_clone(list_autofill_svc_save_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_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_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_svc_save_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_save_item_h value = iter->data; - h->list_autofill_svc_save_items = g_list_remove_link(h->list_autofill_svc_save_items, iter); - rpc_port_autofill_svc_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_svc_save_items); - - return 0; -} - -enum AutofillSvcPort_method_e { - AutofillSvcPort_METHOD_Result, - AutofillSvcPort_METHOD_Callback, - AutofillSvcPort_METHOD_Register, - AutofillSvcPort_METHOD_Unregister, - AutofillSvcPort_METHOD_request_auth_info, - AutofillSvcPort_METHOD_send_fill_request, - AutofillSvcPort_METHOD_commit, -}; - -enum AutofillSvcPort_delegate_e { - AutofillSvcPort_DELEGATE_autofill_svc_auth_info_cb = 1, - AutofillSvcPort_DELEGATE_autofill_svc_fill_response_cb = 2, -}; - -struct AutofillSvcPort_s { - char *stub_appid; - rpc_port_proxy_h proxy; - rpc_port_h port; - rpc_port_h callback_port; - rpc_port_proxy_AutofillSvcPort_callback_s callback; - void *user_data; - GList *delegates; - GRecMutex mutex; -}; - -struct AutofillSvcPort_autofill_svc_auth_info_cb_s { - rpc_port_parcelable_t parcelable; - int id; - int seq_id; - AutofillSvcPort_autofill_svc_auth_info_cb callback; - bool once; - void *user_data; -}; - -static void __AutofillSvcPort_autofill_svc_auth_info_cb_to(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillSvcPort_autofill_svc_auth_info_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillSvcPort_autofill_svc_auth_info_cb_from(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillSvcPort_autofill_svc_auth_info_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(AutofillSvcPort_autofill_svc_auth_info_cb callback, bool once, void *user_data) -{ - struct AutofillSvcPort_autofill_svc_auth_info_cb_s *handle; - static int seq_num; - - handle = calloc(1, sizeof(struct AutofillSvcPort_autofill_svc_auth_info_cb_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->parcelable.to = __AutofillSvcPort_autofill_svc_auth_info_cb_to; - handle->parcelable.from= __AutofillSvcPort_autofill_svc_auth_info_cb_from; - handle->id = AutofillSvcPort_DELEGATE_autofill_svc_auth_info_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->callback = callback; - handle->once = once; - handle->user_data = user_data; - - return handle; -} - -int rpc_port_proxy_AutofillSvcPort_autofill_svc_auth_info_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h delegate) -{ - if (!delegate) { - _E("Invalid parameter"); - return -1; - } - - free(delegate); - - return 0; -} - -int rpc_port_proxy_AutofillSvcPort_autofill_svc_auth_info_cb_dispose(rpc_port_proxy_AutofillSvcPort_h proxy, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h delegate) -{ - struct AutofillSvcPort_autofill_svc_auth_info_cb_s *handle; - GList *iter; - - if (!proxy || !delegate) { - _E("Invalid handle %p %p", proxy, delegate); - return -1; - } - - iter = proxy->delegates; - while (iter) { - handle = (struct AutofillSvcPort_autofill_svc_auth_info_cb_s *)iter->data; - if (handle == delegate) { - proxy->delegates = g_list_remove_link(proxy->delegates, iter); - free(handle); - g_list_free(iter); - return 0; - } - iter = g_list_next(iter); - } - - return -1; -} - -static void __AutofillSvcPort_delegate_autofill_svc_auth_info_cb(GList **list, rpc_port_parcel_h parcel, int seq_id, int id) -{ - rpc_port_autofill_svc_auth_info_h auth_info; - - rpc_port_autofill_svc_auth_info_create(&auth_info); - rpc_port_parcel_read(parcel, &auth_info->parcelable, auth_info); - - do { - struct AutofillSvcPort_autofill_svc_auth_info_cb_s *handle; - GList *iter; - - iter = *list; - while (iter) { - handle = (struct AutofillSvcPort_autofill_svc_auth_info_cb_s *)iter->data; - if (handle->seq_id == seq_id && handle->id == id) { - handle->callback(handle->user_data, auth_info); - - if (handle->once) { - *list = g_list_remove_link(*list, iter); - free(handle); - g_list_free(iter); - } - break; - } - iter = g_list_next(iter); - } - } while (0); - rpc_port_autofill_svc_auth_info_destroy(auth_info); -} - -struct AutofillSvcPort_autofill_svc_fill_response_cb_s { - rpc_port_parcelable_t parcelable; - int id; - int seq_id; - AutofillSvcPort_autofill_svc_fill_response_cb callback; - bool once; - void *user_data; -}; - -static void __AutofillSvcPort_autofill_svc_fill_response_cb_to(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillSvcPort_autofill_svc_fill_response_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillSvcPort_autofill_svc_fill_response_cb_from(rpc_port_parcel_h parcel, void *data) -{ - struct AutofillSvcPort_autofill_svc_fill_response_cb_s *handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(AutofillSvcPort_autofill_svc_fill_response_cb callback, bool once, void *user_data) -{ - struct AutofillSvcPort_autofill_svc_fill_response_cb_s *handle; - static int seq_num; - - handle = calloc(1, sizeof(struct AutofillSvcPort_autofill_svc_fill_response_cb_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->parcelable.to = __AutofillSvcPort_autofill_svc_fill_response_cb_to; - handle->parcelable.from= __AutofillSvcPort_autofill_svc_fill_response_cb_from; - handle->id = AutofillSvcPort_DELEGATE_autofill_svc_fill_response_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->callback = callback; - handle->once = once; - handle->user_data = user_data; - - return handle; -} - -int rpc_port_proxy_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h delegate) -{ - if (!delegate) { - _E("Invalid parameter"); - return -1; - } - - free(delegate); - - return 0; -} - -int rpc_port_proxy_AutofillSvcPort_autofill_svc_fill_response_cb_dispose(rpc_port_proxy_AutofillSvcPort_h proxy, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h delegate) -{ - struct AutofillSvcPort_autofill_svc_fill_response_cb_s *handle; - GList *iter; - - if (!proxy || !delegate) { - _E("Invalid handle %p %p", proxy, delegate); - return -1; - } - - iter = proxy->delegates; - while (iter) { - handle = (struct AutofillSvcPort_autofill_svc_fill_response_cb_s *)iter->data; - if (handle == delegate) { - proxy->delegates = g_list_remove_link(proxy->delegates, iter); - free(handle); - g_list_free(iter); - return 0; - } - iter = g_list_next(iter); - } - - return -1; -} - -static void __AutofillSvcPort_delegate_autofill_svc_fill_response_cb(GList **list, rpc_port_parcel_h parcel, int seq_id, int id) -{ - rpc_port_autofill_svc_fill_response_h response; - - rpc_port_autofill_svc_fill_response_create(&response); - rpc_port_parcel_read(parcel, &response->parcelable, response); - - do { - struct AutofillSvcPort_autofill_svc_fill_response_cb_s *handle; - GList *iter; - - iter = *list; - while (iter) { - handle = (struct AutofillSvcPort_autofill_svc_fill_response_cb_s *)iter->data; - if (handle->seq_id == seq_id && handle->id == id) { - handle->callback(handle->user_data, response); - - if (handle->once) { - *list = g_list_remove_link(*list, iter); - free(handle); - g_list_free(iter); - } - break; - } - iter = g_list_next(iter); - } - } while (0); - rpc_port_autofill_svc_fill_response_destroy(response); -} - -static proxy_delegate __AutofillSvcPort_delegate_table[] = { - [AutofillSvcPort_DELEGATE_autofill_svc_auth_info_cb] = __AutofillSvcPort_delegate_autofill_svc_auth_info_cb, - [AutofillSvcPort_DELEGATE_autofill_svc_fill_response_cb] = __AutofillSvcPort_delegate_autofill_svc_fill_response_cb, -}; - -static void __AutofillSvcPort_process_received_event(GList **list, rpc_port_parcel_h parcel) -{ - int id; - int seq_id; - bool once; - - rpc_port_parcel_read_int32(parcel, &id); - rpc_port_parcel_read_int32(parcel, &seq_id); - rpc_port_parcel_read_bool(parcel, &once); - - if (id > 0 && id < (sizeof(__AutofillSvcPort_delegate_table) / sizeof(__AutofillSvcPort_delegate_table[0]))) { - if (__AutofillSvcPort_delegate_table[id]) - __AutofillSvcPort_delegate_table[id](list, parcel, seq_id, id); - } else { - _W("Unknown id(%d)", id); - } -} - -static rpc_port_parcel_h __AutofillSvcPort_consume_command(rpc_port_proxy_AutofillSvcPort_h h) -{ - rpc_port_parcel_h parcel = NULL; - int cmd = -1; - - do { - rpc_port_parcel_create_from_port(&parcel, h->port); - if (!parcel) - break; - - rpc_port_parcel_read_int32(parcel, &cmd); - if (cmd == AutofillSvcPort_METHOD_Result) - return parcel; - - rpc_port_parcel_destroy(parcel); - parcel = NULL; - } while (true); - - return NULL; -} - -static void __AutofillSvcPort_on_connected(const char *endpoint, const char *port_name, rpc_port_h port, void *data) -{ - rpc_port_proxy_AutofillSvcPort_h handle = data; - - handle->port = port; - rpc_port_proxy_get_port(handle->proxy, RPC_PORT_PORT_CALLBACK, &handle->callback_port); - if (handle->callback.connected) - handle->callback.connected(handle, handle->user_data); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -static void __AutofillSvcPort_on_disconnected(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_AutofillSvcPort_h handle = data; - - handle->port = NULL; - if (handle->callback.disconnected) - handle->callback.disconnected(handle, handle->user_data); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -static void __AutofillSvcPort_on_rejected(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_AutofillSvcPort_h handle = data; - - handle->port = NULL; - if (handle->callback.rejected) - handle->callback.rejected(handle, handle->user_data); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -static void __AutofillSvcPort_on_received(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_AutofillSvcPort_h handle = data; - rpc_port_parcel_h parcel_received; - int cmd = -1; - - rpc_port_parcel_create_from_port(&parcel_received, handle->callback_port); - rpc_port_parcel_read_int32(parcel_received, &cmd); - if (cmd != AutofillSvcPort_METHOD_Callback) { - _E("Invalid protocol"); - rpc_port_parcel_destroy(parcel_received); - return; - } - - __AutofillSvcPort_process_received_event(&handle->delegates, parcel_received); - rpc_port_parcel_destroy(parcel_received); - _I("[__RPC_PORT__] endpoint(%s), port_name(%s)", endpoint, port_name); -} - -int rpc_port_proxy_AutofillSvcPort_invoke_Register(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_cb) -{ - rpc_port_parcel_h parcel; - int r; - int ret = -1; - - if (!h || !auth_info_cb || !fill_response_cb) { - _E("Invalid parameter"); - return ret; - } - - if (!h->port) { - _E("Not connected"); - return ret; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_Register); - - do { - struct AutofillSvcPort_autofill_svc_auth_info_cb_s *handle = auth_info_cb; - - rpc_port_parcel_write(parcel, &handle->parcelable, handle); - h->delegates = g_list_append(h->delegates, handle); - } while (0); - - do { - struct AutofillSvcPort_autofill_svc_fill_response_cb_s *handle = fill_response_cb; - - rpc_port_parcel_write(parcel, &handle->parcelable, handle); - h->delegates = g_list_append(h->delegates, handle); - } while (0); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - - g_rec_mutex_lock(&h->mutex); - do { - rpc_port_parcel_h parcel_received; - - parcel_received = __AutofillSvcPort_consume_command(h); - if (!parcel_received) { - _E("Invalid protocol"); - break; - } - - rpc_port_parcel_read_int32(parcel_received, &ret); - - rpc_port_parcel_destroy(parcel_received); - } while (0); - g_rec_mutex_unlock(&h->mutex); - set_last_result(r); - - return ret; -} - -void rpc_port_proxy_AutofillSvcPort_invoke_Unregister(rpc_port_proxy_AutofillSvcPort_h h) -{ - rpc_port_parcel_h parcel; - int r; - - if (!h) { - _E("Invalid parameter"); - return; - } - - if (!h->port) { - _E("Not connected"); - return; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_Unregister); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - set_last_result(r); -} - -void rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_view_info_h vi) -{ - rpc_port_parcel_h parcel; - int r; - - if (!h || !vi) { - _E("Invalid parameter"); - return; - } - - if (!h->port) { - _E("Not connected"); - return; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_request_auth_info); - rpc_port_parcel_write(parcel, &vi->parcelable, vi); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - set_last_result(r); -} - -void rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_view_info_h vi) -{ - rpc_port_parcel_h parcel; - int r; - - if (!h || !vi) { - _E("Invalid parameter"); - return; - } - - if (!h->port) { - _E("Not connected"); - return; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_send_fill_request); - rpc_port_parcel_write(parcel, &vi->parcelable, vi); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - set_last_result(r); -} - -void rpc_port_proxy_AutofillSvcPort_invoke_commit(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_save_view_info_h si) -{ - rpc_port_parcel_h parcel; - int r; - - if (!h || !si) { - _E("Invalid parameter"); - return; - } - - if (!h->port) { - _E("Not connected"); - return; - } - - rpc_port_parcel_create(&parcel); - rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_commit); - rpc_port_parcel_write(parcel, &si->parcelable, si); - - r = rpc_port_parcel_send(parcel, h->port); - if (r != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. result(%d)", r); - r = RPC_PORT_ERROR_IO_ERROR; - } - - rpc_port_parcel_destroy(parcel); - set_last_result(r); -} - -static struct AutofillSvcPort_s *__create_AutofillSvcPort(const char *stub_appid, rpc_port_proxy_AutofillSvcPort_callback_s *callback, void *user_data) -{ - struct AutofillSvcPort_s *handle; - - handle = calloc(1, sizeof(struct AutofillSvcPort_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->stub_appid = strdup(stub_appid); - if (!handle->stub_appid) { - _E("Out of memory"); - free(handle); - return NULL; - } - - rpc_port_proxy_create(&handle->proxy); - if (!handle->proxy) { - _E("Failed to create proxy"); - free(handle->stub_appid); - free(handle); - return NULL; - } - - g_rec_mutex_init(&handle->mutex); - - handle->callback = *callback; - handle->user_data = user_data; - - return handle; -} - -static void __destroy_AutofillSvcPort(struct AutofillSvcPort_s *h) -{ - if (!h) - return; - - g_rec_mutex_clear(&h->mutex); - - if (h->delegates) - g_list_free_full(h->delegates, free); - - if (h->proxy) - rpc_port_proxy_destroy(h->proxy); - - if (h->stub_appid) - free(h->stub_appid); - - free(h); -} - -int rpc_port_proxy_AutofillSvcPort_create(const char *stub_appid, rpc_port_proxy_AutofillSvcPort_callback_s *callback, void *user_data, rpc_port_proxy_AutofillSvcPort_h *h) -{ - struct AutofillSvcPort_s *handle; - int r; - - if (!stub_appid || !callback || !h) { - _E("Invalid parameter"); - return -1; - } - - handle = __create_AutofillSvcPort(stub_appid, callback, user_data); - if (!handle) - return -1; - - r = rpc_port_proxy_add_connected_event_cb(handle->proxy, __AutofillSvcPort_on_connected, handle); - if (r != 0) { - _E("Failed to add connected event cb. err = %d", r); - __destroy_AutofillSvcPort(handle); - return r; - } - - r = rpc_port_proxy_add_disconnected_event_cb(handle->proxy, __AutofillSvcPort_on_disconnected, handle); - if (r != 0) { - _E("Failed to add disconnected event cb. err = %d", r); - __destroy_AutofillSvcPort(handle); - return r; - } - - r = rpc_port_proxy_add_rejected_event_cb(handle->proxy, __AutofillSvcPort_on_rejected, handle); - if (r != 0) { - _E("Failed to add rejected event cb. err = %d", r); - __destroy_AutofillSvcPort(handle); - return r; - } - - r = rpc_port_proxy_add_received_event_cb(handle->proxy, __AutofillSvcPort_on_received, handle); - if (r != 0) { - _E("Failed to add received event cb. err = %d", r); - __destroy_AutofillSvcPort(handle); - return r; - } - - *h = handle; - - return 0; -} - -int rpc_port_proxy_AutofillSvcPort_connect(rpc_port_proxy_AutofillSvcPort_h h) -{ - int r; - - if (!h || !h->proxy) { - _E("Invalid parameter"); - return -1; - } - - r = rpc_port_proxy_connect(h->proxy, h->stub_appid, "AutofillSvcPort"); - if (r != 0) { - _E("Failed to connect AutofillSvcPort(%s)", h->stub_appid); - return r; - } - - return 0; -} - -int rpc_port_proxy_AutofillSvcPort_destroy(rpc_port_proxy_AutofillSvcPort_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - __destroy_AutofillSvcPort(h); - return 0; -} diff --git a/server/autofill_service_proxy.h b/server/autofill_service_proxy.h deleted file mode 100644 index c01ab22..0000000 --- a/server/autofill_service_proxy.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct autofill_svc_item_s *rpc_port_autofill_svc_item_h; - -int rpc_port_autofill_svc_item_create(rpc_port_autofill_svc_item_h *h); - -int rpc_port_autofill_svc_item_destroy(rpc_port_autofill_svc_item_h h); - -int rpc_port_autofill_svc_item_clone(rpc_port_autofill_svc_item_h h, rpc_port_autofill_svc_item_h *clone); - -int rpc_port_autofill_svc_item_set_id(rpc_port_autofill_svc_item_h h, const char *id); - -int rpc_port_autofill_svc_item_set_label(rpc_port_autofill_svc_item_h h, const char *label); - -int rpc_port_autofill_svc_item_set_value(rpc_port_autofill_svc_item_h h, const char *value); - -int rpc_port_autofill_svc_item_set_autofill_hint(rpc_port_autofill_svc_item_h h, int autofill_hint); - -int rpc_port_autofill_svc_item_set_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_svc_item_get_id(rpc_port_autofill_svc_item_h h, char **id); - -int rpc_port_autofill_svc_item_get_label(rpc_port_autofill_svc_item_h h, char **label); - -int rpc_port_autofill_svc_item_get_value(rpc_port_autofill_svc_item_h h, char **value); - -int rpc_port_autofill_svc_item_get_autofill_hint(rpc_port_autofill_svc_item_h h, int *autofill_hint); - -int rpc_port_autofill_svc_item_get_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool *is_sensitive_data); - -typedef struct autofill_svc_view_info_s *rpc_port_autofill_svc_view_info_h; - -int rpc_port_autofill_svc_view_info_create(rpc_port_autofill_svc_view_info_h *h); - -int rpc_port_autofill_svc_view_info_destroy(rpc_port_autofill_svc_view_info_h h); - -int rpc_port_autofill_svc_view_info_clone(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_view_info_h *clone); - -int rpc_port_autofill_svc_view_info_set_app_id(rpc_port_autofill_svc_view_info_h h, const char *app_id); - -int rpc_port_autofill_svc_view_info_set_view_id(rpc_port_autofill_svc_view_info_h h, const char *view_id); - -int rpc_port_autofill_svc_view_info_add_items(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_item_h items); - -int rpc_port_autofill_svc_view_info_get_app_id(rpc_port_autofill_svc_view_info_h h, char **app_id); - -int rpc_port_autofill_svc_view_info_get_view_id(rpc_port_autofill_svc_view_info_h h, char **view_id); - -int rpc_port_autofill_svc_view_info_foreach_items(rpc_port_autofill_svc_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_svc_view_info_remove_items(rpc_port_autofill_svc_view_info_h h, unsigned int nth); - -int rpc_port_autofill_svc_view_info_get_items_length(rpc_port_autofill_svc_view_info_h h, unsigned int *length); - -typedef struct autofill_svc_save_item_s *rpc_port_autofill_svc_save_item_h; - -int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h); - -int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h); - -int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone); - -int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id); - -int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label); - -int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value); - -int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint); - -int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id); - -int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label); - -int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value); - -int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint); - -int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data); - -typedef struct autofill_svc_save_view_info_s *rpc_port_autofill_svc_save_view_info_h; - -int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h); - -int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h); - -int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone); - -int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id); - -int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items); - -int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id); - -int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_svc_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth); - -int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length); - -typedef struct autofill_svc_auth_info_s *rpc_port_autofill_svc_auth_info_h; - -int rpc_port_autofill_svc_auth_info_create(rpc_port_autofill_svc_auth_info_h *h); - -int rpc_port_autofill_svc_auth_info_destroy(rpc_port_autofill_svc_auth_info_h h); - -int rpc_port_autofill_svc_auth_info_clone(rpc_port_autofill_svc_auth_info_h h, rpc_port_autofill_svc_auth_info_h *clone); - -int rpc_port_autofill_svc_auth_info_set_app_id(rpc_port_autofill_svc_auth_info_h h, const char *app_id); - -int rpc_port_autofill_svc_auth_info_set_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool exist_autofill_data); - -int rpc_port_autofill_svc_auth_info_set_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool need_authentication); - -int rpc_port_autofill_svc_auth_info_set_service_name(rpc_port_autofill_svc_auth_info_h h, const char *service_name); - -int rpc_port_autofill_svc_auth_info_set_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, const char *service_logo_image_path); - -int rpc_port_autofill_svc_auth_info_set_service_message(rpc_port_autofill_svc_auth_info_h h, const char *service_message); - -int rpc_port_autofill_svc_auth_info_get_app_id(rpc_port_autofill_svc_auth_info_h h, char **app_id); - -int rpc_port_autofill_svc_auth_info_get_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool *exist_autofill_data); - -int rpc_port_autofill_svc_auth_info_get_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool *need_authentication); - -int rpc_port_autofill_svc_auth_info_get_service_name(rpc_port_autofill_svc_auth_info_h h, char **service_name); - -int rpc_port_autofill_svc_auth_info_get_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, char **service_logo_image_path); - -int rpc_port_autofill_svc_auth_info_get_service_message(rpc_port_autofill_svc_auth_info_h h, char **service_message); - -typedef struct autofill_svc_response_item_s *rpc_port_autofill_svc_response_item_h; - -int rpc_port_autofill_svc_response_item_create(rpc_port_autofill_svc_response_item_h *h); - -int rpc_port_autofill_svc_response_item_destroy(rpc_port_autofill_svc_response_item_h h); - -int rpc_port_autofill_svc_response_item_clone(rpc_port_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h *clone); - -int rpc_port_autofill_svc_response_item_set_id(rpc_port_autofill_svc_response_item_h h, const char *id); - -int rpc_port_autofill_svc_response_item_set_presentation_text(rpc_port_autofill_svc_response_item_h h, const char *presentation_text); - -int rpc_port_autofill_svc_response_item_set_value(rpc_port_autofill_svc_response_item_h h, const char *value); - -int rpc_port_autofill_svc_response_item_get_id(rpc_port_autofill_svc_response_item_h h, char **id); - -int rpc_port_autofill_svc_response_item_get_presentation_text(rpc_port_autofill_svc_response_item_h h, char **presentation_text); - -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); - -int rpc_port_autofill_svc_fill_response_destroy(rpc_port_autofill_svc_fill_response_h h); - -int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_fill_response_h *clone); - -int rpc_port_autofill_svc_fill_response_set_app_id(rpc_port_autofill_svc_fill_response_h h, const char *app_id); - -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_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_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_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth); - -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; - -int rpc_port_list_autofill_svc_item_create(rpc_port_list_autofill_svc_item_h *h); - -int rpc_port_list_autofill_svc_item_destroy(rpc_port_list_autofill_svc_item_h h); - -int rpc_port_list_autofill_svc_item_clone(rpc_port_list_autofill_svc_item_h h, rpc_port_list_autofill_svc_item_h *clone); - -int rpc_port_list_autofill_svc_item_add_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, rpc_port_autofill_svc_item_h list_autofill_svc_items); - -int rpc_port_list_autofill_svc_item_foreach_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, - bool (*callback)(rpc_port_autofill_svc_item_h list_autofill_svc_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_svc_item_remove_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, unsigned int nth); - -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); - -int rpc_port_list_autofill_svc_response_item_destroy(rpc_port_list_autofill_svc_response_item_h h); - -int rpc_port_list_autofill_svc_response_item_clone(rpc_port_list_autofill_svc_response_item_h h, rpc_port_list_autofill_svc_response_item_h *clone); - -int rpc_port_list_autofill_svc_response_item_add_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items); - -int rpc_port_list_autofill_svc_response_item_foreach_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, - bool (*callback)(rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_svc_response_item_remove_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, unsigned int nth); - -int rpc_port_list_autofill_svc_response_item_get_list_autofill_svc_response_items_length(rpc_port_list_autofill_svc_response_item_h h, unsigned int *length); - -typedef struct list_autofill_svc_save_item_s *rpc_port_list_autofill_svc_save_item_h; - -int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h); - -int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h); - -int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone); - -int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items); - -int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth); - -int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length); - -typedef struct AutofillSvcPort_s *rpc_port_proxy_AutofillSvcPort_h; - -typedef struct { - void (*connected)(rpc_port_proxy_AutofillSvcPort_h h, void *user_data); - void (*disconnected)(rpc_port_proxy_AutofillSvcPort_h h, void *user_data); - void (*rejected)(rpc_port_proxy_AutofillSvcPort_h h, void *user_data); -} rpc_port_proxy_AutofillSvcPort_callback_s; - -typedef struct AutofillSvcPort_autofill_svc_auth_info_cb_s *rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h; - -typedef void (*AutofillSvcPort_autofill_svc_auth_info_cb)(void *user_data, rpc_port_autofill_svc_auth_info_h auth_info); - -rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(AutofillSvcPort_autofill_svc_auth_info_cb callback, bool once, void *user_data); - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h delegate); - -int rpc_port_proxy_AutofillSvcPort_autofill_svc_auth_info_cb_dispose(rpc_port_proxy_AutofillSvcPort_h proxy, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h delegate); - -typedef struct AutofillSvcPort_autofill_svc_fill_response_cb_s *rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h; - -typedef void (*AutofillSvcPort_autofill_svc_fill_response_cb)(void *user_data, rpc_port_autofill_svc_fill_response_h response); - -rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(AutofillSvcPort_autofill_svc_fill_response_cb callback, bool once, void *user_data); - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h delegate); - -int rpc_port_proxy_AutofillSvcPort_autofill_svc_fill_response_cb_dispose(rpc_port_proxy_AutofillSvcPort_h proxy, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h delegate); - -int rpc_port_proxy_AutofillSvcPort_create(const char *stub_appid, - rpc_port_proxy_AutofillSvcPort_callback_s *callback, void *user_data, - rpc_port_proxy_AutofillSvcPort_h *h); - -int rpc_port_proxy_AutofillSvcPort_connect(rpc_port_proxy_AutofillSvcPort_h h); - -int rpc_port_proxy_AutofillSvcPort_destroy(rpc_port_proxy_AutofillSvcPort_h h); - -int rpc_port_proxy_AutofillSvcPort_invoke_Register(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_cb); - -void rpc_port_proxy_AutofillSvcPort_invoke_Unregister(rpc_port_proxy_AutofillSvcPort_h h); - -void rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_view_info_h vi); - -void rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_view_info_h vi); - -void rpc_port_proxy_AutofillSvcPort_invoke_commit(rpc_port_proxy_AutofillSvcPort_h h, rpc_port_autofill_svc_save_view_info_h si); - -#ifdef __cplusplus -} -#endif diff --git a/server/autofill_stub.c b/server/autofill_stub.c deleted file mode 100644 index f4a93a4..0000000 --- a/server/autofill_stub.c +++ /dev/null @@ -1,4079 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "autofill_stub.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "RPC_PORT_STUB" - -#ifdef _E -#undef _E -#endif - -#ifdef _W -#undef _W -#endif - -#ifdef _I -#undef _I -#endif - -#ifdef _D -#undef _D -#endif - -#define _E(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _W(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _I(fmt, ...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _D(fmt, ...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -typedef int (*stub_method)(rpc_port_h, rpc_port_parcel_h, void *data); - -struct autofill_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_item_create(rpc_port_autofill_item_h *h) -{ - struct autofill_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_item_to; - handle->parcelable.from = __autofill_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_item_destroy(rpc_port_autofill_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_item_clone(rpc_port_autofill_item_h h, rpc_port_autofill_item_h *clone) -{ - rpc_port_autofill_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_item_set_id(rpc_port_autofill_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_set_label(rpc_port_autofill_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_set_value(rpc_port_autofill_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_set_autofill_hint(rpc_port_autofill_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_item_set_is_sensitive_data(rpc_port_autofill_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_item_get_id(rpc_port_autofill_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_get_label(rpc_port_autofill_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_get_value(rpc_port_autofill_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_item_get_autofill_hint(rpc_port_autofill_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_item_get_is_sensitive_data(rpc_port_autofill_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_view_info_s { - rpc_port_parcelable_t parcelable; - char *view_id; - GList *items; -}; - -static void __autofill_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_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_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_item_h value = NULL; - - rpc_port_autofill_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_view_info_create(rpc_port_autofill_view_info_h *h) -{ - struct autofill_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_view_info_to; - handle->parcelable.from = __autofill_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_view_info_destroy(rpc_port_autofill_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_item_h value = iter->data; - if (value) - rpc_port_autofill_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_view_info_clone(rpc_port_autofill_view_info_h h, rpc_port_autofill_view_info_h *clone) -{ - rpc_port_autofill_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_view_info handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_item_h new_value; - rpc_port_autofill_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_view_info_set_view_id(rpc_port_autofill_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_view_info_add_items(rpc_port_autofill_view_info_h h, rpc_port_autofill_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_item_h value = NULL; - - rpc_port_autofill_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_view_info_get_view_id(rpc_port_autofill_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_view_info_foreach_items(rpc_port_autofill_view_info_h h, - bool (*callback)(rpc_port_autofill_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_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_view_info_remove_items(rpc_port_autofill_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_view_info_get_items_length(rpc_port_autofill_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_save_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h) -{ - struct autofill_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_save_item_to; - handle->parcelable.from = __autofill_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone) -{ - rpc_port_autofill_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_save_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_save_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_save_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_save_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_save_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_save_view_info_s { - rpc_port_parcelable_t parcelable; - char *view_id; - GList *items; -}; - -static void __autofill_save_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_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_save_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_save_item_h value = NULL; - - rpc_port_autofill_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h) -{ - struct autofill_save_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_save_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_save_view_info_to; - handle->parcelable.from = __autofill_save_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_item_h value = iter->data; - if (value) - rpc_port_autofill_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone) -{ - rpc_port_autofill_save_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_save_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_save_view_info handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_save_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_item_h new_value; - rpc_port_autofill_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_save_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_save_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_save_item_h value = NULL; - - rpc_port_autofill_save_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h, - bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_save_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_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_save_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_auth_info_s { - rpc_port_parcelable_t parcelable; - bool exist_autofill_data; - bool need_authentication; - char *service_name; - char *service_logo_image_path; - char *service_message; -}; - -static void __autofill_auth_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_bool(parcel, h->exist_autofill_data); - rpc_port_parcel_write_bool(parcel, h->need_authentication); - rpc_port_parcel_write_string(parcel, h->service_name ? h->service_name : ""); - rpc_port_parcel_write_string(parcel, h->service_logo_image_path ? h->service_logo_image_path : ""); - rpc_port_parcel_write_string(parcel, h->service_message ? h->service_message : ""); -} - -static void __autofill_auth_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_bool(parcel, &h->exist_autofill_data); - rpc_port_parcel_read_bool(parcel, &h->need_authentication); - rpc_port_parcel_read_string(parcel, &h->service_name); - rpc_port_parcel_read_string(parcel, &h->service_logo_image_path); - rpc_port_parcel_read_string(parcel, &h->service_message); -} - -int rpc_port_autofill_auth_info_create(rpc_port_autofill_auth_info_h *h) -{ - struct autofill_auth_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_auth_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_auth_info_to; - handle->parcelable.from = __autofill_auth_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_auth_info_destroy(rpc_port_autofill_auth_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_name) - free(h->service_name); - - if (h->service_logo_image_path) - free(h->service_logo_image_path); - - if (h->service_message) - free(h->service_message); - - free(h); - - return 0; -} - -int rpc_port_autofill_auth_info_clone(rpc_port_autofill_auth_info_h h, rpc_port_autofill_auth_info_h *clone) -{ - rpc_port_autofill_auth_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_auth_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_auth_info handle"); - return -1; - } - - handle->exist_autofill_data = h->exist_autofill_data; - handle->need_authentication = h->need_authentication; - if (h->service_name) { - handle->service_name = strdup(h->service_name); - if (!handle->service_name) { - _E("Failed to duplicate h->service_name"); - rpc_port_autofill_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_logo_image_path) { - handle->service_logo_image_path = strdup(h->service_logo_image_path); - if (!handle->service_logo_image_path) { - _E("Failed to duplicate h->service_logo_image_path"); - rpc_port_autofill_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_message) { - handle->service_message = strdup(h->service_message); - if (!handle->service_message) { - _E("Failed to duplicate h->service_message"); - rpc_port_autofill_auth_info_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_auth_info_set_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool exist_autofill_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->exist_autofill_data = exist_autofill_data; - return 0; -} - -int rpc_port_autofill_auth_info_set_need_authentication(rpc_port_autofill_auth_info_h h, bool need_authentication) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->need_authentication = need_authentication; - return 0; -} - -int rpc_port_autofill_auth_info_set_service_name(rpc_port_autofill_auth_info_h h, const char *service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_name) { - free(h->service_name); - h->service_name = NULL; - } - - h->service_name = strdup(service_name); - if (!h->service_name) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_set_service_logo_image_path(rpc_port_autofill_auth_info_h h, const char *service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_logo_image_path) { - free(h->service_logo_image_path); - h->service_logo_image_path = NULL; - } - - h->service_logo_image_path = strdup(service_logo_image_path); - if (!h->service_logo_image_path) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_set_service_message(rpc_port_autofill_auth_info_h h, const char *service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_message) { - free(h->service_message); - h->service_message = NULL; - } - - h->service_message = strdup(service_message); - if (!h->service_message) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_get_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool *exist_autofill_data) -{ - if (!h || !exist_autofill_data) { - _E("Invalid parameter"); - return -1; - } - - *exist_autofill_data = h->exist_autofill_data; - return 0; -} - -int rpc_port_autofill_auth_info_get_need_authentication(rpc_port_autofill_auth_info_h h, bool *need_authentication) -{ - if (!h || !need_authentication) { - _E("Invalid parameter"); - return -1; - } - - *need_authentication = h->need_authentication; - return 0; -} - -int rpc_port_autofill_auth_info_get_service_name(rpc_port_autofill_auth_info_h h, char **service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_name) { - _E("Invalid parameter: h->service_name is NULL"); - return -1; - } - - *service_name = strdup(h->service_name); - if (*service_name == NULL) { - _E("Failed to duplicate service_name"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_get_service_logo_image_path(rpc_port_autofill_auth_info_h h, char **service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_logo_image_path) { - _E("Invalid parameter: h->service_logo_image_path is NULL"); - return -1; - } - - *service_logo_image_path = strdup(h->service_logo_image_path); - if (*service_logo_image_path == NULL) { - _E("Failed to duplicate service_logo_image_path"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_auth_info_get_service_message(rpc_port_autofill_auth_info_h h, char **service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_message) { - _E("Invalid parameter: h->service_message is NULL"); - return -1; - } - - *service_message = strdup(h->service_message); - if (*service_message == NULL) { - _E("Failed to duplicate service_message"); - return -1; - } - - return 0; -} - -struct autofill_response_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *presentation_text; - char *value; -}; - -static void __autofill_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->presentation_text ? h->presentation_text : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); -} - -static void __autofill_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->presentation_text); - rpc_port_parcel_read_string(parcel, &h->value); -} - -int rpc_port_autofill_response_item_create(rpc_port_autofill_response_item_h *h) -{ - struct autofill_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_response_item_to; - handle->parcelable.from = __autofill_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_response_item_destroy(rpc_port_autofill_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->presentation_text) - free(h->presentation_text); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_response_item_clone(rpc_port_autofill_response_item_h h, rpc_port_autofill_response_item_h *clone) -{ - rpc_port_autofill_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_response_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_response_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_response_item_destroy(handle); - return -1; - } - } - - if (h->presentation_text) { - handle->presentation_text = strdup(h->presentation_text); - if (!handle->presentation_text) { - _E("Failed to duplicate h->presentation_text"); - rpc_port_autofill_response_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_response_item_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_response_item_set_id(rpc_port_autofill_response_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_set_presentation_text(rpc_port_autofill_response_item_h h, const char *presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (h->presentation_text) { - free(h->presentation_text); - h->presentation_text = NULL; - } - - h->presentation_text = strdup(presentation_text); - if (!h->presentation_text) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_set_value(rpc_port_autofill_response_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_get_id(rpc_port_autofill_response_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_get_presentation_text(rpc_port_autofill_response_item_h h, char **presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (!h->presentation_text) { - _E("Invalid parameter: h->presentation_text is NULL"); - return -1; - } - - *presentation_text = strdup(h->presentation_text); - if (*presentation_text == NULL) { - _E("Failed to duplicate presentation_text"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_response_item_get_value(rpc_port_autofill_response_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - 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_groups; -}; - -static void __autofill_fill_response_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->response_groups)); - do { - GList *iter; - - iter = h->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 __autofill_fill_response_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - 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->response_groups = g_list_append(h->response_groups, value); - } - } while (0); -} - -int rpc_port_autofill_fill_response_create(rpc_port_autofill_fill_response_h *h) -{ - struct autofill_fill_response_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_fill_response_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_fill_response_to; - handle->parcelable.from = __autofill_fill_response_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_fill_response_destroy(rpc_port_autofill_fill_response_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->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->response_groups); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, rpc_port_autofill_fill_response_h *clone) -{ - rpc_port_autofill_fill_response_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_fill_response_create(&handle); - if (!handle) { - _E("Failed to create autofill_fill_response handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_fill_response_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->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_autofill_fill_response_destroy(handle); - return -1; - } - - 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_groups = g_list_append(handle->response_groups, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_fill_response_set_view_id(rpc_port_autofill_fill_response_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -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_groups) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_response_group_h value = NULL; - - rpc_port_autofill_response_group_clone(response_groups, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->response_groups = g_list_append(h->response_groups, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_fill_response_get_view_id(rpc_port_autofill_fill_response_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -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"); - return -1; - } - - do { - GList *iter; - - iter = h->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_autofill_fill_response_remove_response_groups(rpc_port_autofill_fill_response_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->response_groups, nth); - if (iter == NULL) - return -1; - - 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_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_groups); - - return 0; -} - -struct list_autofill_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_items; -}; - -static void __list_autofill_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_items)); - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_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 __list_autofill_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_item_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_item_h value = NULL; - - rpc_port_autofill_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_items = g_list_append(h->list_autofill_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_item_create(rpc_port_list_autofill_item_h *h) -{ - struct list_autofill_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_item_to; - handle->parcelable.from = __list_autofill_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_item_destroy(rpc_port_list_autofill_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_item_h value = iter->data; - if (value) - rpc_port_autofill_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_item_clone(rpc_port_list_autofill_item_h h, rpc_port_list_autofill_item_h *clone) -{ - rpc_port_list_autofill_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_item_h new_value; - rpc_port_autofill_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_item_destroy(handle); - return -1; - } - - rpc_port_autofill_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_item_destroy(handle); - return -1; - } - - handle->list_autofill_items = g_list_append(handle->list_autofill_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_item_add_list_autofill_items(rpc_port_list_autofill_item_h h, rpc_port_autofill_item_h list_autofill_items) -{ - if (!h || !list_autofill_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_item_h value = NULL; - - rpc_port_autofill_item_clone(list_autofill_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_items = g_list_append(h->list_autofill_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_item_foreach_list_autofill_items(rpc_port_list_autofill_item_h h, - bool (*callback)(rpc_port_autofill_item_h list_autofill_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_items; - while (iter) { - rpc_port_autofill_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_list_autofill_item_remove_list_autofill_items(rpc_port_list_autofill_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_item_h value = iter->data; - h->list_autofill_items = g_list_remove_link(h->list_autofill_items, iter); - rpc_port_autofill_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_item_get_list_autofill_items_length(rpc_port_list_autofill_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_items); - - 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; -}; - -static void __list_autofill_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_response_items)); - do { - GList *iter; - - iter = h->list_autofill_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 __list_autofill_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_response_item_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->list_autofill_response_items = g_list_append(h->list_autofill_response_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_response_item_create(rpc_port_list_autofill_response_item_h *h) -{ - struct list_autofill_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_response_item_to; - handle->parcelable.from = __list_autofill_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_response_item_destroy(rpc_port_list_autofill_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_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->list_autofill_response_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_response_item_clone(rpc_port_list_autofill_response_item_h h, rpc_port_list_autofill_response_item_h *clone) -{ - rpc_port_list_autofill_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_response_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_response_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_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_list_autofill_response_item_destroy(handle); - return -1; - } - - rpc_port_autofill_response_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_response_item_destroy(handle); - return -1; - } - - handle->list_autofill_response_items = g_list_append(handle->list_autofill_response_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_response_item_add_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, rpc_port_autofill_response_item_h list_autofill_response_items) -{ - if (!h || !list_autofill_response_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_response_item_h value = NULL; - - rpc_port_autofill_response_item_clone(list_autofill_response_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_response_items = g_list_append(h->list_autofill_response_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_response_item_foreach_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, - bool (*callback)(rpc_port_autofill_response_item_h list_autofill_response_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_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_list_autofill_response_item_remove_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_response_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_response_item_h value = iter->data; - h->list_autofill_response_items = g_list_remove_link(h->list_autofill_response_items, iter); - rpc_port_autofill_response_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_response_item_get_list_autofill_response_items_length(rpc_port_list_autofill_response_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_response_items); - - return 0; -} - -struct list_autofill_save_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_save_items; -}; - -static void __list_autofill_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_save_items)); - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_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 __list_autofill_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_save_item_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_save_item_h value = NULL; - - rpc_port_autofill_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h) -{ - struct list_autofill_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_save_item_to; - handle->parcelable.from = __list_autofill_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_item_h value = iter->data; - if (value) - rpc_port_autofill_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_save_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone) -{ - rpc_port_list_autofill_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_save_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_save_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_item_h new_value; - rpc_port_autofill_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_save_item_destroy(handle); - return -1; - } - - rpc_port_autofill_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_save_item_destroy(handle); - return -1; - } - - handle->list_autofill_save_items = g_list_append(handle->list_autofill_save_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items) -{ - if (!h || !list_autofill_save_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_save_item_h value = NULL; - - rpc_port_autofill_save_item_clone(list_autofill_save_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_save_items = g_list_append(h->list_autofill_save_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, - bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_save_items; - while (iter) { - rpc_port_autofill_save_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_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_save_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_save_item_h value = iter->data; - h->list_autofill_save_items = g_list_remove_link(h->list_autofill_save_items, iter); - rpc_port_autofill_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_save_items); - - return 0; -} - -enum AutofillAppPort_method_e { - AutofillAppPort_METHOD_Result, - AutofillAppPort_METHOD_Callback, - AutofillAppPort_METHOD_Register, - AutofillAppPort_METHOD_Unregister, - AutofillAppPort_METHOD_request_auth_info, - AutofillAppPort_METHOD_send_fill_request, - AutofillAppPort_METHOD_commit, -}; - -enum AutofillAppPort_delegate_e { - AutofillAppPort_DELEGATE_autofill_auth_info_cb = 1, - AutofillAppPort_DELEGATE_autofill_fill_response_cb = 2, -}; - -static rpc_port_stub_h __AutofillAppPort_stub; -static rpc_port_stub_AutofillAppPort_callback_s __AutofillAppPort_callback; -static void *__AutofillAppPort_user_data; -static GList *__AutofillAppPort_contexts; - -struct AutofillAppPort_context_s { - char *sender; - char *instance; - rpc_port_h port; - void *tag; - rpc_port_stub_AutofillAppPort_callback_s callback; - void *user_data; -}; - -static struct AutofillAppPort_context_s *__create_AutofillAppPort_context(const char *sender, const char *instance) -{ - struct AutofillAppPort_context_s *handle; - - handle = calloc(1, sizeof(struct AutofillAppPort_context_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->sender = strdup(sender); - if (!handle->sender) { - _E("Out of memory"); - free(handle); - return NULL; - } - - handle->instance = strdup(instance); - if (!handle->instance) { - _E("Out of memory"); - free(handle->sender); - free(handle); - return NULL; - } - - handle->callback = __AutofillAppPort_callback; - handle->user_data = __AutofillAppPort_user_data; - - return handle; -} - -static void __destroy_AutofillAppPort_context(gpointer data) -{ - struct AutofillAppPort_context_s *handle = data; - - if (!handle) { - _E("Critical error!"); - return; - } - - free(handle->instance); - free(handle->sender); - free(handle); -} - -static struct AutofillAppPort_context_s *__find_AutofillAppPort_context(const char *instance) -{ - struct AutofillAppPort_context_s *handle; - GList *iter; - - iter = __AutofillAppPort_contexts; - while (iter) { - handle = (struct AutofillAppPort_context_s *)iter->data; - if (!strcmp(handle->instance, instance)) - return handle; - iter = g_list_next(iter); - } - - return NULL; -} - -int rpc_port_stub_AutofillAppPort_context_set_tag(rpc_port_stub_AutofillAppPort_context_h ctx, void *tag) -{ - if (!ctx) { - _E("Invalid parameter"); - return -1; - } - - ctx->tag = tag; - - return 0; -} - -int rpc_port_stub_AutofillAppPort_context_get_tag(rpc_port_stub_AutofillAppPort_context_h ctx, void **tag) -{ - if (!ctx || !tag) { - _E("Invalid parameter"); - return -1; - } - - *tag = ctx->tag; - - return 0; -} - -int rpc_port_stub_AutofillAppPort_context_get_sender(rpc_port_stub_AutofillAppPort_context_h ctx, char **sender) -{ - if (!ctx || !sender) { - _E("Invalid parameter"); - return -1; - } - - *sender = strdup(ctx->sender); - if (*sender == NULL) { - _E("Out of memory"); - return -1; - } - - return 0; -} - -struct AutofillAppPort_autofill_auth_info_cb_s { - rpc_port_parcelable_t parcelable; - rpc_port_h port; - int id; - int seq_id; - bool once; - bool valid; -}; - -static void __AutofillAppPort_autofill_auth_info_cb_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillAppPort_autofill_auth_info_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillAppPort_autofill_auth_info_cb_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillAppPort_autofill_auth_info_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_create(rpc_port_AutofillAppPort_autofill_auth_info_cb_h *h) -{ - struct AutofillAppPort_autofill_auth_info_cb_s *handle; - static int seq_num; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillAppPort_autofill_auth_info_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __AutofillAppPort_autofill_auth_info_cb_to; - handle->parcelable.from = __AutofillAppPort_autofill_auth_info_cb_from; - handle->id = AutofillAppPort_DELEGATE_autofill_auth_info_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->once = false; - handle->valid = true; - - *h = handle; - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_destroy(rpc_port_AutofillAppPort_autofill_auth_info_cb_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - free(h); - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_clone(rpc_port_AutofillAppPort_autofill_auth_info_cb_h h, rpc_port_AutofillAppPort_autofill_auth_info_cb_h *clone) -{ - rpc_port_AutofillAppPort_autofill_auth_info_cb_h handle; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillAppPort_autofill_auth_info_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable = h->parcelable; - handle->port = h->port; - handle->id = h->id; - handle->seq_id = h->seq_id; - handle->once = h->once; - handle->valid = h->valid; - - *clone = handle; - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_invoke(rpc_port_AutofillAppPort_autofill_auth_info_cb_h h, rpc_port_autofill_auth_info_h auth_info) -{ - rpc_port_parcel_h parcel = NULL; - - if (!h || !h->port) { - _E("Invalid parameter"); - return -1; - } - - if (h->once && !h->valid) { - _E("Invalid callback"); - return -1; - } - - rpc_port_parcel_create(&parcel); - if (!parcel) { - _E("Failed to create parcel"); - return -1; - } - - rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_Callback); - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_write(parcel, &auth_info->parcelable, auth_info); - - rpc_port_parcel_send(parcel, h->port); - rpc_port_parcel_destroy(parcel); - h->valid = false; - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_set_port(rpc_port_AutofillAppPort_autofill_auth_info_cb_h h, rpc_port_h port) -{ - if (!h || !port) { - _E("Invalid parameter"); - return -1; - } - - h->port = port; - - return 0; -} - -struct AutofillAppPort_autofill_fill_response_cb_s { - rpc_port_parcelable_t parcelable; - rpc_port_h port; - int id; - int seq_id; - bool once; - bool valid; -}; - -static void __AutofillAppPort_autofill_fill_response_cb_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillAppPort_autofill_fill_response_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillAppPort_autofill_fill_response_cb_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillAppPort_autofill_fill_response_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_create(rpc_port_AutofillAppPort_autofill_fill_response_cb_h *h) -{ - struct AutofillAppPort_autofill_fill_response_cb_s *handle; - static int seq_num; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillAppPort_autofill_fill_response_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __AutofillAppPort_autofill_fill_response_cb_to; - handle->parcelable.from = __AutofillAppPort_autofill_fill_response_cb_from; - handle->id = AutofillAppPort_DELEGATE_autofill_fill_response_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->once = false; - handle->valid = true; - - *h = handle; - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_destroy(rpc_port_AutofillAppPort_autofill_fill_response_cb_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - free(h); - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_clone(rpc_port_AutofillAppPort_autofill_fill_response_cb_h h, rpc_port_AutofillAppPort_autofill_fill_response_cb_h *clone) -{ - rpc_port_AutofillAppPort_autofill_fill_response_cb_h handle; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillAppPort_autofill_fill_response_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable = h->parcelable; - handle->port = h->port; - handle->id = h->id; - handle->seq_id = h->seq_id; - handle->once = h->once; - handle->valid = h->valid; - - *clone = handle; - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_invoke(rpc_port_AutofillAppPort_autofill_fill_response_cb_h h, rpc_port_autofill_fill_response_h response) -{ - rpc_port_parcel_h parcel = NULL; - - if (!h || !h->port) { - _E("Invalid parameter"); - return -1; - } - - if (h->once && !h->valid) { - _E("Invalid callback"); - return -1; - } - - rpc_port_parcel_create(&parcel); - if (!parcel) { - _E("Failed to create parcel"); - return -1; - } - - rpc_port_parcel_write_int32(parcel, AutofillAppPort_METHOD_Callback); - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_write(parcel, &response->parcelable, response); - - rpc_port_parcel_send(parcel, h->port); - rpc_port_parcel_destroy(parcel); - h->valid = false; - - return 0; -} - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_set_port(rpc_port_AutofillAppPort_autofill_fill_response_cb_h h, rpc_port_h port) -{ - if (!h || !port) { - _E("Invalid parameter"); - return -1; - } - - h->port = port; - - return 0; -} - -static int __AutofillAppPort_method_Register(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillAppPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_AutofillAppPort_autofill_auth_info_cb_h auth_info_cb = NULL; - rpc_port_AutofillAppPort_autofill_fill_response_cb_h fill_response_cb = NULL; - - rpc_port_AutofillAppPort_autofill_auth_info_cb_create(&auth_info_cb); - - if (!auth_info_cb) { - _E("Failed to create handle"); - return -1; - } - - rpc_port_AutofillAppPort_autofill_auth_info_cb_set_port(auth_info_cb, callback_port); - rpc_port_parcel_read(parcel, &auth_info_cb->parcelable, auth_info_cb); - rpc_port_AutofillAppPort_autofill_fill_response_cb_create(&fill_response_cb); - - if (!fill_response_cb) { - _E("Failed to create handle"); - return -1; - } - - rpc_port_AutofillAppPort_autofill_fill_response_cb_set_port(fill_response_cb, callback_port); - rpc_port_parcel_read(parcel, &fill_response_cb->parcelable, fill_response_cb); - - int ret = context->callback.Register(context, auth_info_cb, fill_response_cb, context->user_data); - do { - rpc_port_parcel_h result; - - rpc_port_parcel_create(&result); - rpc_port_parcel_write_int32(result, AutofillAppPort_METHOD_Result); - rpc_port_parcel_write_int32(result, ret); - rpc_port_parcel_send(result, port); - rpc_port_parcel_destroy(result); - } while (0); - - rpc_port_AutofillAppPort_autofill_auth_info_cb_destroy(auth_info_cb); - rpc_port_AutofillAppPort_autofill_fill_response_cb_destroy(fill_response_cb); - return 0; -} - -static int __AutofillAppPort_method_Unregister(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillAppPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - context->callback.Unregister(context, context->user_data); - - return 0; -} - -static int __AutofillAppPort_method_request_auth_info(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillAppPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_autofill_view_info_h vi = NULL; - - rpc_port_autofill_view_info_create(&vi); - rpc_port_parcel_read(parcel, &vi->parcelable, vi); - - int ret = context->callback.request_auth_info(context, vi, context->user_data); - do { - rpc_port_parcel_h result; - - rpc_port_parcel_create(&result); - rpc_port_parcel_write_int32(result, AutofillAppPort_METHOD_Result); - rpc_port_parcel_write_int32(result, ret); - rpc_port_parcel_send(result, port); - rpc_port_parcel_destroy(result); - } while (0); - - rpc_port_autofill_view_info_destroy(vi); - return 0; -} - -static int __AutofillAppPort_method_send_fill_request(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillAppPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_autofill_view_info_h vi = NULL; - - rpc_port_autofill_view_info_create(&vi); - rpc_port_parcel_read(parcel, &vi->parcelable, vi); - - int ret = context->callback.send_fill_request(context, vi, context->user_data); - do { - rpc_port_parcel_h result; - - rpc_port_parcel_create(&result); - rpc_port_parcel_write_int32(result, AutofillAppPort_METHOD_Result); - rpc_port_parcel_write_int32(result, ret); - rpc_port_parcel_send(result, port); - rpc_port_parcel_destroy(result); - } while (0); - - rpc_port_autofill_view_info_destroy(vi); - return 0; -} - -static int __AutofillAppPort_method_commit(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillAppPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_autofill_save_view_info_h vi = NULL; - - rpc_port_autofill_save_view_info_create(&vi); - rpc_port_parcel_read(parcel, &vi->parcelable, vi); - - int ret = context->callback.commit(context, vi, context->user_data); - do { - rpc_port_parcel_h result; - - rpc_port_parcel_create(&result); - rpc_port_parcel_write_int32(result, AutofillAppPort_METHOD_Result); - rpc_port_parcel_write_int32(result, ret); - rpc_port_parcel_send(result, port); - rpc_port_parcel_destroy(result); - } while (0); - - rpc_port_autofill_save_view_info_destroy(vi); - return 0; -} - -static stub_method __AutofillAppPort_method_table[] = { - [AutofillAppPort_METHOD_Register] = __AutofillAppPort_method_Register, - [AutofillAppPort_METHOD_Unregister] = __AutofillAppPort_method_Unregister, - [AutofillAppPort_METHOD_request_auth_info] = __AutofillAppPort_method_request_auth_info, - [AutofillAppPort_METHOD_send_fill_request] = __AutofillAppPort_method_send_fill_request, - [AutofillAppPort_METHOD_commit] = __AutofillAppPort_method_commit, -}; - -static void __AutofillAppPort_on_connected(const char *sender, const char *instance, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context; - - _I("[__RPC_PORT__] sender(%s), instance(%s)", sender, instance); - context = __create_AutofillAppPort_context(sender, instance); - if (!context) - return; - - if (context->callback.create) - context->callback.create(context, context->user_data); - __AutofillAppPort_contexts = g_list_append(__AutofillAppPort_contexts, context); -} - -static void __AutofillAppPort_on_disconnected(const char *sender, const char *instance, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context; - - _I("[__RPC_PORT__] sender(%s), instance(%s)", sender, instance); - context = __find_AutofillAppPort_context(instance); - if (!context) - return; - - if (context->callback.terminate) - context->callback.terminate(context, context->user_data); - __AutofillAppPort_contexts = g_list_remove(__AutofillAppPort_contexts, context); - __destroy_AutofillAppPort_context(context); -} - -static int __AutofillAppPort_on_received(const char *sender, const char *instance, rpc_port_h port, void *data) -{ - rpc_port_stub_AutofillAppPort_context_h context; - rpc_port_parcel_h parcel; - int cmd = -1; - int r; - - _I("[__RPC_PORT__] sender(%s), instance(%s)", sender, instance); - context = __find_AutofillAppPort_context(instance); - if (!context) { - _E("Failed to find AutofillAppPort context(%s)", instance); - return -1; - } - - context->port = port; - r = rpc_port_parcel_create_from_port(&parcel, port); - if (r != 0) { - _E("Failed to create parcel from port"); - return r; - } - - rpc_port_parcel_read_int32(parcel, &cmd); - if (cmd > 1 && cmd < (sizeof(__AutofillAppPort_method_table) / sizeof(__AutofillAppPort_method_table[0]))) { - if (__AutofillAppPort_method_table[cmd]) - r = __AutofillAppPort_method_table[cmd](port, parcel, context); - } else { - _E("Unknown Command(%d)", cmd); - r = -1; - } - - rpc_port_parcel_destroy(parcel); - - return r; -} - -static int __AutofillAppPort_add_privileges(void) -{ - - return 0; -} - -int rpc_port_stub_AutofillAppPort_register(rpc_port_stub_AutofillAppPort_callback_s *callback, void *user_data) -{ - int r; - - if (__AutofillAppPort_stub) { - _W("Already exists"); - return -1; - } - - if (!callback) { - _E("Invalid parameter"); - return -1; - } - - __AutofillAppPort_callback = *callback; - __AutofillAppPort_user_data = user_data; - r = rpc_port_stub_create(&__AutofillAppPort_stub, "AutofillAppPort"); - if (r != 0) { - _E("Failed to create stub handle"); - return r; - } - - r = rpc_port_stub_add_received_event_cb(__AutofillAppPort_stub, __AutofillAppPort_on_received, NULL); - if (r != 0) { - _E("Failed to add received event callback"); - rpc_port_stub_destroy(__AutofillAppPort_stub); - __AutofillAppPort_stub = NULL; - return r; - } - - r = rpc_port_stub_add_connected_event_cb(__AutofillAppPort_stub, __AutofillAppPort_on_connected, NULL); - if (r != 0) { - _E("Failed to add connected event callback"); - rpc_port_stub_destroy(__AutofillAppPort_stub); - __AutofillAppPort_stub = NULL; - return r; - } - - r = rpc_port_stub_add_disconnected_event_cb(__AutofillAppPort_stub, __AutofillAppPort_on_disconnected, NULL); - if (r != 0) { - _E("Failed to add disconnected event callback"); - rpc_port_stub_destroy(__AutofillAppPort_stub); - __AutofillAppPort_stub = NULL; - return r; - } - - r = __AutofillAppPort_add_privileges(); - if (r != 0) { - _E("Failed to add privileges"); - rpc_port_stub_destroy(__AutofillAppPort_stub); - __AutofillAppPort_stub = NULL; - return r; - } - - r = rpc_port_stub_listen(__AutofillAppPort_stub); - if (r != 0) { - _E("Failed to listen stub"); - rpc_port_stub_destroy(__AutofillAppPort_stub); - __AutofillAppPort_stub = NULL; - return r; - } - - return 0; -} - -int rpc_port_stub_AutofillAppPort_unregister(void) -{ - int r; - - if (!__AutofillAppPort_stub) - return -1; - - if (__AutofillAppPort_contexts) { - g_list_free_full(__AutofillAppPort_contexts, __destroy_AutofillAppPort_context); - __AutofillAppPort_contexts = NULL; - } - - r = rpc_port_stub_destroy(__AutofillAppPort_stub); - __AutofillAppPort_stub = NULL; - - return r; -} - -int rpc_port_stub_AutofillAppPort_get_client_number(unsigned int *n) -{ - if (!n) { - _E("Invalid parameter"); - return -1; - } - - if (!__AutofillAppPort_stub) { - _E("AutofillAppPort Stub is not ready"); - return -1; - } - - *n = g_list_length(__AutofillAppPort_contexts); - - return 0; -} diff --git a/server/autofill_stub.h b/server/autofill_stub.h deleted file mode 100644 index f19b2d9..0000000 --- a/server/autofill_stub.h +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct autofill_item_s *rpc_port_autofill_item_h; - -int rpc_port_autofill_item_create(rpc_port_autofill_item_h *h); - -int rpc_port_autofill_item_destroy(rpc_port_autofill_item_h h); - -int rpc_port_autofill_item_clone(rpc_port_autofill_item_h h, rpc_port_autofill_item_h *clone); - -int rpc_port_autofill_item_set_id(rpc_port_autofill_item_h h, const char *id); - -int rpc_port_autofill_item_set_label(rpc_port_autofill_item_h h, const char *label); - -int rpc_port_autofill_item_set_value(rpc_port_autofill_item_h h, const char *value); - -int rpc_port_autofill_item_set_autofill_hint(rpc_port_autofill_item_h h, int autofill_hint); - -int rpc_port_autofill_item_set_is_sensitive_data(rpc_port_autofill_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_item_get_id(rpc_port_autofill_item_h h, char **id); - -int rpc_port_autofill_item_get_label(rpc_port_autofill_item_h h, char **label); - -int rpc_port_autofill_item_get_value(rpc_port_autofill_item_h h, char **value); - -int rpc_port_autofill_item_get_autofill_hint(rpc_port_autofill_item_h h, int *autofill_hint); - -int rpc_port_autofill_item_get_is_sensitive_data(rpc_port_autofill_item_h h, bool *is_sensitive_data); - -typedef struct autofill_view_info_s *rpc_port_autofill_view_info_h; - -int rpc_port_autofill_view_info_create(rpc_port_autofill_view_info_h *h); - -int rpc_port_autofill_view_info_destroy(rpc_port_autofill_view_info_h h); - -int rpc_port_autofill_view_info_clone(rpc_port_autofill_view_info_h h, rpc_port_autofill_view_info_h *clone); - -int rpc_port_autofill_view_info_set_view_id(rpc_port_autofill_view_info_h h, const char *view_id); - -int rpc_port_autofill_view_info_add_items(rpc_port_autofill_view_info_h h, rpc_port_autofill_item_h items); - -int rpc_port_autofill_view_info_get_view_id(rpc_port_autofill_view_info_h h, char **view_id); - -int rpc_port_autofill_view_info_foreach_items(rpc_port_autofill_view_info_h h, - bool (*callback)(rpc_port_autofill_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_view_info_remove_items(rpc_port_autofill_view_info_h h, unsigned int nth); - -int rpc_port_autofill_view_info_get_items_length(rpc_port_autofill_view_info_h h, unsigned int *length); - -typedef struct autofill_save_item_s *rpc_port_autofill_save_item_h; - -int rpc_port_autofill_save_item_create(rpc_port_autofill_save_item_h *h); - -int rpc_port_autofill_save_item_destroy(rpc_port_autofill_save_item_h h); - -int rpc_port_autofill_save_item_clone(rpc_port_autofill_save_item_h h, rpc_port_autofill_save_item_h *clone); - -int rpc_port_autofill_save_item_set_id(rpc_port_autofill_save_item_h h, const char *id); - -int rpc_port_autofill_save_item_set_label(rpc_port_autofill_save_item_h h, const char *label); - -int rpc_port_autofill_save_item_set_value(rpc_port_autofill_save_item_h h, const char *value); - -int rpc_port_autofill_save_item_set_autofill_hint(rpc_port_autofill_save_item_h h, int autofill_hint); - -int rpc_port_autofill_save_item_set_is_sensitive_data(rpc_port_autofill_save_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_save_item_get_id(rpc_port_autofill_save_item_h h, char **id); - -int rpc_port_autofill_save_item_get_label(rpc_port_autofill_save_item_h h, char **label); - -int rpc_port_autofill_save_item_get_value(rpc_port_autofill_save_item_h h, char **value); - -int rpc_port_autofill_save_item_get_autofill_hint(rpc_port_autofill_save_item_h h, int *autofill_hint); - -int rpc_port_autofill_save_item_get_is_sensitive_data(rpc_port_autofill_save_item_h h, bool *is_sensitive_data); - -typedef struct autofill_save_view_info_s *rpc_port_autofill_save_view_info_h; - -int rpc_port_autofill_save_view_info_create(rpc_port_autofill_save_view_info_h *h); - -int rpc_port_autofill_save_view_info_destroy(rpc_port_autofill_save_view_info_h h); - -int rpc_port_autofill_save_view_info_clone(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_view_info_h *clone); - -int rpc_port_autofill_save_view_info_set_view_id(rpc_port_autofill_save_view_info_h h, const char *view_id); - -int rpc_port_autofill_save_view_info_add_items(rpc_port_autofill_save_view_info_h h, rpc_port_autofill_save_item_h items); - -int rpc_port_autofill_save_view_info_get_view_id(rpc_port_autofill_save_view_info_h h, char **view_id); - -int rpc_port_autofill_save_view_info_foreach_items(rpc_port_autofill_save_view_info_h h, - bool (*callback)(rpc_port_autofill_save_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_save_view_info_remove_items(rpc_port_autofill_save_view_info_h h, unsigned int nth); - -int rpc_port_autofill_save_view_info_get_items_length(rpc_port_autofill_save_view_info_h h, unsigned int *length); - -typedef struct autofill_auth_info_s *rpc_port_autofill_auth_info_h; - -int rpc_port_autofill_auth_info_create(rpc_port_autofill_auth_info_h *h); - -int rpc_port_autofill_auth_info_destroy(rpc_port_autofill_auth_info_h h); - -int rpc_port_autofill_auth_info_clone(rpc_port_autofill_auth_info_h h, rpc_port_autofill_auth_info_h *clone); - -int rpc_port_autofill_auth_info_set_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool exist_autofill_data); - -int rpc_port_autofill_auth_info_set_need_authentication(rpc_port_autofill_auth_info_h h, bool need_authentication); - -int rpc_port_autofill_auth_info_set_service_name(rpc_port_autofill_auth_info_h h, const char *service_name); - -int rpc_port_autofill_auth_info_set_service_logo_image_path(rpc_port_autofill_auth_info_h h, const char *service_logo_image_path); - -int rpc_port_autofill_auth_info_set_service_message(rpc_port_autofill_auth_info_h h, const char *service_message); - -int rpc_port_autofill_auth_info_get_exist_autofill_data(rpc_port_autofill_auth_info_h h, bool *exist_autofill_data); - -int rpc_port_autofill_auth_info_get_need_authentication(rpc_port_autofill_auth_info_h h, bool *need_authentication); - -int rpc_port_autofill_auth_info_get_service_name(rpc_port_autofill_auth_info_h h, char **service_name); - -int rpc_port_autofill_auth_info_get_service_logo_image_path(rpc_port_autofill_auth_info_h h, char **service_logo_image_path); - -int rpc_port_autofill_auth_info_get_service_message(rpc_port_autofill_auth_info_h h, char **service_message); - -typedef struct autofill_response_item_s *rpc_port_autofill_response_item_h; - -int rpc_port_autofill_response_item_create(rpc_port_autofill_response_item_h *h); - -int rpc_port_autofill_response_item_destroy(rpc_port_autofill_response_item_h h); - -int rpc_port_autofill_response_item_clone(rpc_port_autofill_response_item_h h, rpc_port_autofill_response_item_h *clone); - -int rpc_port_autofill_response_item_set_id(rpc_port_autofill_response_item_h h, const char *id); - -int rpc_port_autofill_response_item_set_presentation_text(rpc_port_autofill_response_item_h h, const char *presentation_text); - -int rpc_port_autofill_response_item_set_value(rpc_port_autofill_response_item_h h, const char *value); - -int rpc_port_autofill_response_item_get_id(rpc_port_autofill_response_item_h h, char **id); - -int rpc_port_autofill_response_item_get_presentation_text(rpc_port_autofill_response_item_h h, char **presentation_text); - -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); - -int rpc_port_autofill_fill_response_destroy(rpc_port_autofill_fill_response_h h); - -int rpc_port_autofill_fill_response_clone(rpc_port_autofill_fill_response_h h, rpc_port_autofill_fill_response_h *clone); - -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_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_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_groups(rpc_port_autofill_fill_response_h h, unsigned int nth); - -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; - -int rpc_port_list_autofill_item_create(rpc_port_list_autofill_item_h *h); - -int rpc_port_list_autofill_item_destroy(rpc_port_list_autofill_item_h h); - -int rpc_port_list_autofill_item_clone(rpc_port_list_autofill_item_h h, rpc_port_list_autofill_item_h *clone); - -int rpc_port_list_autofill_item_add_list_autofill_items(rpc_port_list_autofill_item_h h, rpc_port_autofill_item_h list_autofill_items); - -int rpc_port_list_autofill_item_foreach_list_autofill_items(rpc_port_list_autofill_item_h h, - bool (*callback)(rpc_port_autofill_item_h list_autofill_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_item_remove_list_autofill_items(rpc_port_list_autofill_item_h h, unsigned int nth); - -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); - -int rpc_port_list_autofill_response_item_destroy(rpc_port_list_autofill_response_item_h h); - -int rpc_port_list_autofill_response_item_clone(rpc_port_list_autofill_response_item_h h, rpc_port_list_autofill_response_item_h *clone); - -int rpc_port_list_autofill_response_item_add_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, rpc_port_autofill_response_item_h list_autofill_response_items); - -int rpc_port_list_autofill_response_item_foreach_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, - bool (*callback)(rpc_port_autofill_response_item_h list_autofill_response_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_response_item_remove_list_autofill_response_items(rpc_port_list_autofill_response_item_h h, unsigned int nth); - -int rpc_port_list_autofill_response_item_get_list_autofill_response_items_length(rpc_port_list_autofill_response_item_h h, unsigned int *length); - -typedef struct list_autofill_save_item_s *rpc_port_list_autofill_save_item_h; - -int rpc_port_list_autofill_save_item_create(rpc_port_list_autofill_save_item_h *h); - -int rpc_port_list_autofill_save_item_destroy(rpc_port_list_autofill_save_item_h h); - -int rpc_port_list_autofill_save_item_clone(rpc_port_list_autofill_save_item_h h, rpc_port_list_autofill_save_item_h *clone); - -int rpc_port_list_autofill_save_item_add_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, rpc_port_autofill_save_item_h list_autofill_save_items); - -int rpc_port_list_autofill_save_item_foreach_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, - bool (*callback)(rpc_port_autofill_save_item_h list_autofill_save_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_save_item_remove_list_autofill_save_items(rpc_port_list_autofill_save_item_h h, unsigned int nth); - -int rpc_port_list_autofill_save_item_get_list_autofill_save_items_length(rpc_port_list_autofill_save_item_h h, unsigned int *length); - -typedef struct AutofillAppPort_context_s* rpc_port_stub_AutofillAppPort_context_h; - -int rpc_port_stub_AutofillAppPort_context_set_tag(rpc_port_stub_AutofillAppPort_context_h ctx, void *tag); - -int rpc_port_stub_AutofillAppPort_context_get_tag(rpc_port_stub_AutofillAppPort_context_h ctx, void **tag); - -int rpc_port_stub_AutofillAppPort_context_get_sender(rpc_port_stub_AutofillAppPort_context_h ctx, char **sender); - -typedef struct AutofillAppPort_autofill_auth_info_cb_s *rpc_port_AutofillAppPort_autofill_auth_info_cb_h; - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_destroy(rpc_port_AutofillAppPort_autofill_auth_info_cb_h h); - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_clone(rpc_port_AutofillAppPort_autofill_auth_info_cb_h h, rpc_port_AutofillAppPort_autofill_auth_info_cb_h *clone); - -int rpc_port_AutofillAppPort_autofill_auth_info_cb_invoke(rpc_port_AutofillAppPort_autofill_auth_info_cb_h h, rpc_port_autofill_auth_info_h auth_info); - -typedef struct AutofillAppPort_autofill_fill_response_cb_s *rpc_port_AutofillAppPort_autofill_fill_response_cb_h; - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_destroy(rpc_port_AutofillAppPort_autofill_fill_response_cb_h h); - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_clone(rpc_port_AutofillAppPort_autofill_fill_response_cb_h h, rpc_port_AutofillAppPort_autofill_fill_response_cb_h *clone); - -int rpc_port_AutofillAppPort_autofill_fill_response_cb_invoke(rpc_port_AutofillAppPort_autofill_fill_response_cb_h h, rpc_port_autofill_fill_response_h response); - -typedef struct { - void (*create)(rpc_port_stub_AutofillAppPort_context_h context, void *user_data); - void (*terminate)(rpc_port_stub_AutofillAppPort_context_h context, void *user_data); - - int (*Register)(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_AutofillAppPort_autofill_auth_info_cb_h auth_info_cb, rpc_port_AutofillAppPort_autofill_fill_response_cb_h fill_response_cb, void *user_data); - void (*Unregister)(rpc_port_stub_AutofillAppPort_context_h context, void *user_data); - int (*request_auth_info)(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_view_info_h vi, void *user_data); - int (*send_fill_request)(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_view_info_h vi, void *user_data); - int (*commit)(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_save_view_info_h vi, void *user_data); -} rpc_port_stub_AutofillAppPort_callback_s; - -int rpc_port_stub_AutofillAppPort_register(rpc_port_stub_AutofillAppPort_callback_s *callback, void *user_data); - -int rpc_port_stub_AutofillAppPort_unregister(void); - -int rpc_port_stub_AutofillAppPort_get_client_number(unsigned int *n); - -#ifdef __cplusplus -} -#endif diff --git a/service_lib/autofill_service_stub.c b/service_lib/autofill_service_stub.c deleted file mode 100644 index 1d87c3a..0000000 --- a/service_lib/autofill_service_stub.c +++ /dev/null @@ -1,4223 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "autofill_service_stub.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "RPC_PORT_STUB" - -#ifdef _E -#undef _E -#endif - -#ifdef _W -#undef _W -#endif - -#ifdef _I -#undef _I -#endif - -#ifdef _D -#undef _D -#endif - -#define _E(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _W(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _I(fmt, ...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) -#define _D(fmt, ...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -typedef int (*stub_method)(rpc_port_h, rpc_port_parcel_h, void *data); - -struct autofill_svc_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_svc_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_svc_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_svc_item_create(rpc_port_autofill_svc_item_h *h) -{ - struct autofill_svc_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_item_to; - handle->parcelable.from = __autofill_svc_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_item_destroy(rpc_port_autofill_svc_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_item_clone(rpc_port_autofill_svc_item_h h, rpc_port_autofill_svc_item_h *clone) -{ - rpc_port_autofill_svc_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_svc_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_svc_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_svc_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_item_set_id(rpc_port_autofill_svc_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_set_label(rpc_port_autofill_svc_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_set_value(rpc_port_autofill_svc_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_set_autofill_hint(rpc_port_autofill_svc_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_item_set_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_svc_item_get_id(rpc_port_autofill_svc_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_get_label(rpc_port_autofill_svc_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_get_value(rpc_port_autofill_svc_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_item_get_autofill_hint(rpc_port_autofill_svc_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_item_get_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_svc_view_info_s { - rpc_port_parcelable_t parcelable; - char *app_id; - char *view_id; - GList *items; -}; - -static void __autofill_svc_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - 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->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_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_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->app_id); - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_svc_item_h value = NULL; - - rpc_port_autofill_svc_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_svc_view_info_create(rpc_port_autofill_svc_view_info_h *h) -{ - struct autofill_svc_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_view_info_to; - handle->parcelable.from = __autofill_svc_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_view_info_destroy(rpc_port_autofill_svc_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) - free(h->app_id); - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_view_info_clone(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_view_info_h *clone) -{ - rpc_port_autofill_svc_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_view_info handle"); - return -1; - } - - if (h->app_id) { - handle->app_id = strdup(h->app_id); - if (!handle->app_id) { - _E("Failed to duplicate h->app_id"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_item_h new_value; - rpc_port_autofill_svc_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_svc_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_view_info_set_app_id(rpc_port_autofill_svc_view_info_h h, const char *app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) { - free(h->app_id); - h->app_id = NULL; - } - - h->app_id = strdup(app_id); - if (!h->app_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_set_view_id(rpc_port_autofill_svc_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_add_items(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_item_h value = NULL; - - rpc_port_autofill_svc_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_svc_view_info_get_app_id(rpc_port_autofill_svc_view_info_h h, char **app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->app_id) { - _E("Invalid parameter: h->app_id is NULL"); - return -1; - } - - *app_id = strdup(h->app_id); - if (*app_id == NULL) { - _E("Failed to duplicate app_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_get_view_id(rpc_port_autofill_svc_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_view_info_foreach_items(rpc_port_autofill_svc_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_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_view_info_remove_items(rpc_port_autofill_svc_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_svc_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_svc_view_info_get_items_length(rpc_port_autofill_svc_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_svc_save_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *label; - char *value; - int autofill_hint; - bool is_sensitive_data; -}; - -static void __autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->label ? h->label : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); - rpc_port_parcel_write_int32(parcel, h->autofill_hint); - rpc_port_parcel_write_bool(parcel, h->is_sensitive_data); -} - -static void __autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->label); - rpc_port_parcel_read_string(parcel, &h->value); - rpc_port_parcel_read_int32(parcel, &h->autofill_hint); - rpc_port_parcel_read_bool(parcel, &h->is_sensitive_data); -} - -int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h) -{ - struct autofill_svc_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_save_item_to; - handle->parcelable.from = __autofill_svc_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->label) - free(h->label); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone) -{ - rpc_port_autofill_svc_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_save_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_save_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_svc_save_item_destroy(handle); - return -1; - } - } - - if (h->label) { - handle->label = strdup(h->label); - if (!handle->label) { - _E("Failed to duplicate h->label"); - rpc_port_autofill_svc_save_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_svc_save_item_destroy(handle); - return -1; - } - } - - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (h->label) { - free(h->label); - h->label = NULL; - } - - h->label = strdup(label); - if (!h->label) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->autofill_hint = autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->is_sensitive_data = is_sensitive_data; - return 0; -} - -int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label) -{ - if (!h || !label) { - _E("Invalid parameter"); - return -1; - } - - if (!h->label) { - _E("Invalid parameter: h->label is NULL"); - return -1; - } - - *label = strdup(h->label); - if (*label == NULL) { - _E("Failed to duplicate label"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint) -{ - if (!h || !autofill_hint) { - _E("Invalid parameter"); - return -1; - } - - *autofill_hint = h->autofill_hint; - return 0; -} - -int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data) -{ - if (!h || !is_sensitive_data) { - _E("Invalid parameter"); - return -1; - } - - *is_sensitive_data = h->is_sensitive_data; - return 0; -} - -struct autofill_svc_save_view_info_s { - rpc_port_parcelable_t parcelable; - char *view_id; - GList *items; -}; - -static void __autofill_svc_save_view_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->view_id ? h->view_id : ""); - rpc_port_parcel_write_array_count(parcel, g_list_length(h->items)); - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_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_save_view_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_save_view_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->view_id); - do { - int len = 0; - - rpc_port_parcel_read_array_count(parcel, &len); - for (int i = 0; i < len; i++) { - rpc_port_autofill_svc_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->items = g_list_append(h->items, value); - } - } while (0); -} - -int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h) -{ - struct autofill_svc_save_view_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_save_view_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_save_view_info_to; - handle->parcelable.from = __autofill_svc_save_view_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone) -{ - rpc_port_autofill_svc_save_view_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_save_view_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_save_view_info handle"); - return -1; - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_svc_save_view_info_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_item_h new_value; - rpc_port_autofill_svc_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_autofill_svc_save_view_info_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_autofill_svc_save_view_info_destroy(handle); - return -1; - } - - handle->items = g_list_append(handle->items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items) -{ - if (!h || !items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_clone(items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->items = g_list_append(h->items, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->items; - while (iter) { - rpc_port_autofill_svc_save_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_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_save_item_h value = iter->data; - h->items = g_list_remove_link(h->items, iter); - rpc_port_autofill_svc_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->items); - - return 0; -} - -struct autofill_svc_auth_info_s { - rpc_port_parcelable_t parcelable; - char *app_id; - bool exist_autofill_data; - bool need_authentication; - char *service_name; - char *service_logo_image_path; - char *service_message; -}; - -static void __autofill_svc_auth_info_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->app_id ? h->app_id : ""); - rpc_port_parcel_write_bool(parcel, h->exist_autofill_data); - rpc_port_parcel_write_bool(parcel, h->need_authentication); - rpc_port_parcel_write_string(parcel, h->service_name ? h->service_name : ""); - rpc_port_parcel_write_string(parcel, h->service_logo_image_path ? h->service_logo_image_path : ""); - rpc_port_parcel_write_string(parcel, h->service_message ? h->service_message : ""); -} - -static void __autofill_svc_auth_info_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_auth_info_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->app_id); - rpc_port_parcel_read_bool(parcel, &h->exist_autofill_data); - rpc_port_parcel_read_bool(parcel, &h->need_authentication); - rpc_port_parcel_read_string(parcel, &h->service_name); - rpc_port_parcel_read_string(parcel, &h->service_logo_image_path); - rpc_port_parcel_read_string(parcel, &h->service_message); -} - -int rpc_port_autofill_svc_auth_info_create(rpc_port_autofill_svc_auth_info_h *h) -{ - struct autofill_svc_auth_info_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_auth_info_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_auth_info_to; - handle->parcelable.from = __autofill_svc_auth_info_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_auth_info_destroy(rpc_port_autofill_svc_auth_info_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) - free(h->app_id); - - if (h->service_name) - free(h->service_name); - - if (h->service_logo_image_path) - free(h->service_logo_image_path); - - if (h->service_message) - free(h->service_message); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_auth_info_clone(rpc_port_autofill_svc_auth_info_h h, rpc_port_autofill_svc_auth_info_h *clone) -{ - rpc_port_autofill_svc_auth_info_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_auth_info_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_auth_info handle"); - return -1; - } - - if (h->app_id) { - handle->app_id = strdup(h->app_id); - if (!handle->app_id) { - _E("Failed to duplicate h->app_id"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - handle->exist_autofill_data = h->exist_autofill_data; - handle->need_authentication = h->need_authentication; - if (h->service_name) { - handle->service_name = strdup(h->service_name); - if (!handle->service_name) { - _E("Failed to duplicate h->service_name"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_logo_image_path) { - handle->service_logo_image_path = strdup(h->service_logo_image_path); - if (!handle->service_logo_image_path) { - _E("Failed to duplicate h->service_logo_image_path"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - if (h->service_message) { - handle->service_message = strdup(h->service_message); - if (!handle->service_message) { - _E("Failed to duplicate h->service_message"); - rpc_port_autofill_svc_auth_info_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_app_id(rpc_port_autofill_svc_auth_info_h h, const char *app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) { - free(h->app_id); - h->app_id = NULL; - } - - h->app_id = strdup(app_id); - if (!h->app_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool exist_autofill_data) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->exist_autofill_data = exist_autofill_data; - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool need_authentication) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - h->need_authentication = need_authentication; - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_service_name(rpc_port_autofill_svc_auth_info_h h, const char *service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_name) { - free(h->service_name); - h->service_name = NULL; - } - - h->service_name = strdup(service_name); - if (!h->service_name) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, const char *service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_logo_image_path) { - free(h->service_logo_image_path); - h->service_logo_image_path = NULL; - } - - h->service_logo_image_path = strdup(service_logo_image_path); - if (!h->service_logo_image_path) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_set_service_message(rpc_port_autofill_svc_auth_info_h h, const char *service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (h->service_message) { - free(h->service_message); - h->service_message = NULL; - } - - h->service_message = strdup(service_message); - if (!h->service_message) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_app_id(rpc_port_autofill_svc_auth_info_h h, char **app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->app_id) { - _E("Invalid parameter: h->app_id is NULL"); - return -1; - } - - *app_id = strdup(h->app_id); - if (*app_id == NULL) { - _E("Failed to duplicate app_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool *exist_autofill_data) -{ - if (!h || !exist_autofill_data) { - _E("Invalid parameter"); - return -1; - } - - *exist_autofill_data = h->exist_autofill_data; - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool *need_authentication) -{ - if (!h || !need_authentication) { - _E("Invalid parameter"); - return -1; - } - - *need_authentication = h->need_authentication; - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_service_name(rpc_port_autofill_svc_auth_info_h h, char **service_name) -{ - if (!h || !service_name) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_name) { - _E("Invalid parameter: h->service_name is NULL"); - return -1; - } - - *service_name = strdup(h->service_name); - if (*service_name == NULL) { - _E("Failed to duplicate service_name"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, char **service_logo_image_path) -{ - if (!h || !service_logo_image_path) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_logo_image_path) { - _E("Invalid parameter: h->service_logo_image_path is NULL"); - return -1; - } - - *service_logo_image_path = strdup(h->service_logo_image_path); - if (*service_logo_image_path == NULL) { - _E("Failed to duplicate service_logo_image_path"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_auth_info_get_service_message(rpc_port_autofill_svc_auth_info_h h, char **service_message) -{ - if (!h || !service_message) { - _E("Invalid parameter"); - return -1; - } - - if (!h->service_message) { - _E("Invalid parameter: h->service_message is NULL"); - return -1; - } - - *service_message = strdup(h->service_message); - if (*service_message == NULL) { - _E("Failed to duplicate service_message"); - return -1; - } - - return 0; -} - -struct autofill_svc_response_item_s { - rpc_port_parcelable_t parcelable; - char *id; - char *presentation_text; - char *value; -}; - -static void __autofill_svc_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_string(parcel, h->id ? h->id : ""); - rpc_port_parcel_write_string(parcel, h->presentation_text ? h->presentation_text : ""); - rpc_port_parcel_write_string(parcel, h->value ? h->value : ""); -} - -static void __autofill_svc_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_response_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->id); - rpc_port_parcel_read_string(parcel, &h->presentation_text); - rpc_port_parcel_read_string(parcel, &h->value); -} - -int rpc_port_autofill_svc_response_item_create(rpc_port_autofill_svc_response_item_h *h) -{ - struct autofill_svc_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_response_item_to; - handle->parcelable.from = __autofill_svc_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_response_item_destroy(rpc_port_autofill_svc_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) - free(h->id); - - if (h->presentation_text) - free(h->presentation_text); - - if (h->value) - free(h->value); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_response_item_clone(rpc_port_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h *clone) -{ - rpc_port_autofill_svc_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_response_item_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_response_item handle"); - return -1; - } - - if (h->id) { - handle->id = strdup(h->id); - if (!handle->id) { - _E("Failed to duplicate h->id"); - rpc_port_autofill_svc_response_item_destroy(handle); - return -1; - } - } - - if (h->presentation_text) { - handle->presentation_text = strdup(h->presentation_text); - if (!handle->presentation_text) { - _E("Failed to duplicate h->presentation_text"); - rpc_port_autofill_svc_response_item_destroy(handle); - return -1; - } - } - - if (h->value) { - handle->value = strdup(h->value); - if (!handle->value) { - _E("Failed to duplicate h->value"); - rpc_port_autofill_svc_response_item_destroy(handle); - return -1; - } - } - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_response_item_set_id(rpc_port_autofill_svc_response_item_h h, const char *id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (h->id) { - free(h->id); - h->id = NULL; - } - - h->id = strdup(id); - if (!h->id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_set_presentation_text(rpc_port_autofill_svc_response_item_h h, const char *presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (h->presentation_text) { - free(h->presentation_text); - h->presentation_text = NULL; - } - - h->presentation_text = strdup(presentation_text); - if (!h->presentation_text) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_set_value(rpc_port_autofill_svc_response_item_h h, const char *value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (h->value) { - free(h->value); - h->value = NULL; - } - - h->value = strdup(value); - if (!h->value) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_get_id(rpc_port_autofill_svc_response_item_h h, char **id) -{ - if (!h || !id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->id) { - _E("Invalid parameter: h->id is NULL"); - return -1; - } - - *id = strdup(h->id); - if (*id == NULL) { - _E("Failed to duplicate id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_get_presentation_text(rpc_port_autofill_svc_response_item_h h, char **presentation_text) -{ - if (!h || !presentation_text) { - _E("Invalid parameter"); - return -1; - } - - if (!h->presentation_text) { - _E("Invalid parameter: h->presentation_text is NULL"); - return -1; - } - - *presentation_text = strdup(h->presentation_text); - if (*presentation_text == NULL) { - _E("Failed to duplicate presentation_text"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_response_item_get_value(rpc_port_autofill_svc_response_item_h h, char **value) -{ - if (!h || !value) { - _E("Invalid parameter"); - return -1; - } - - if (!h->value) { - _E("Invalid parameter: h->value is NULL"); - return -1; - } - - *value = strdup(h->value); - if (*value == NULL) { - _E("Failed to duplicate value"); - return -1; - } - - 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_groups; -}; - -static void __autofill_svc_fill_response_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - 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_groups)); - do { - GList *iter; - - iter = h->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 __autofill_svc_fill_response_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_autofill_svc_fill_response_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_string(parcel, &h->app_id); - rpc_port_parcel_read_string(parcel, &h->view_id); - 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->response_groups = g_list_append(h->response_groups, value); - } - } while (0); -} - -int rpc_port_autofill_svc_fill_response_create(rpc_port_autofill_svc_fill_response_h *h) -{ - struct autofill_svc_fill_response_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct autofill_svc_fill_response_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __autofill_svc_fill_response_to; - handle->parcelable.from = __autofill_svc_fill_response_from; - - *h = handle; - - return 0; -} - -int rpc_port_autofill_svc_fill_response_destroy(rpc_port_autofill_svc_fill_response_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) - free(h->app_id); - - if (h->view_id) - free(h->view_id); - - do { - GList *iter; - - iter = h->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->response_groups); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_fill_response_h *clone) -{ - rpc_port_autofill_svc_fill_response_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_autofill_svc_fill_response_create(&handle); - if (!handle) { - _E("Failed to create autofill_svc_fill_response handle"); - return -1; - } - - if (h->app_id) { - handle->app_id = strdup(h->app_id); - if (!handle->app_id) { - _E("Failed to duplicate h->app_id"); - rpc_port_autofill_svc_fill_response_destroy(handle); - return -1; - } - } - - if (h->view_id) { - handle->view_id = strdup(h->view_id); - if (!handle->view_id) { - _E("Failed to duplicate h->view_id"); - rpc_port_autofill_svc_fill_response_destroy(handle); - return -1; - } - } - - do { - GList *iter; - - iter = h->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_autofill_svc_fill_response_destroy(handle); - return -1; - } - - 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_groups = g_list_append(handle->response_groups, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_autofill_svc_fill_response_set_app_id(rpc_port_autofill_svc_fill_response_h h, const char *app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->app_id) { - free(h->app_id); - h->app_id = NULL; - } - - h->app_id = strdup(app_id); - if (!h->app_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_fill_response_set_view_id(rpc_port_autofill_svc_fill_response_h h, const char *view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (h->view_id) { - free(h->view_id); - h->view_id = NULL; - } - - h->view_id = strdup(view_id); - if (!h->view_id) { - _E("Failed to duplicate data"); - return -1; - } - - return 0; -} - -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_groups) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_response_group_h value = NULL; - - rpc_port_autofill_svc_response_group_clone(response_groups, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->response_groups = g_list_append(h->response_groups, value); - } while (0); - - return 0; -} - -int rpc_port_autofill_svc_fill_response_get_app_id(rpc_port_autofill_svc_fill_response_h h, char **app_id) -{ - if (!h || !app_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->app_id) { - _E("Invalid parameter: h->app_id is NULL"); - return -1; - } - - *app_id = strdup(h->app_id); - if (*app_id == NULL) { - _E("Failed to duplicate app_id"); - return -1; - } - - return 0; -} - -int rpc_port_autofill_svc_fill_response_get_view_id(rpc_port_autofill_svc_fill_response_h h, char **view_id) -{ - if (!h || !view_id) { - _E("Invalid parameter"); - return -1; - } - - if (!h->view_id) { - _E("Invalid parameter: h->view_id is NULL"); - return -1; - } - - *view_id = strdup(h->view_id); - if (*view_id == NULL) { - _E("Failed to duplicate view_id"); - return -1; - } - - return 0; -} - -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"); - return -1; - } - - do { - GList *iter; - - iter = h->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_autofill_svc_fill_response_remove_response_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->response_groups, nth); - if (iter == NULL) - return -1; - - 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_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_groups); - - return 0; -} - -struct list_autofill_svc_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_svc_items; -}; - -static void __list_autofill_svc_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_items)); - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_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 __list_autofill_svc_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_item_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_item_h value = NULL; - - rpc_port_autofill_svc_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_svc_items = g_list_append(h->list_autofill_svc_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_svc_item_create(rpc_port_list_autofill_svc_item_h *h) -{ - struct list_autofill_svc_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_svc_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_svc_item_to; - handle->parcelable.from = __list_autofill_svc_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_item_destroy(rpc_port_list_autofill_svc_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_svc_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_svc_item_clone(rpc_port_list_autofill_svc_item_h h, rpc_port_list_autofill_svc_item_h *clone) -{ - rpc_port_list_autofill_svc_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_svc_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_svc_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_item_h new_value; - rpc_port_autofill_svc_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_svc_item_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_svc_item_destroy(handle); - return -1; - } - - handle->list_autofill_svc_items = g_list_append(handle->list_autofill_svc_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_item_add_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, rpc_port_autofill_svc_item_h list_autofill_svc_items) -{ - if (!h || !list_autofill_svc_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_item_h value = NULL; - - rpc_port_autofill_svc_item_clone(list_autofill_svc_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_svc_items = g_list_append(h->list_autofill_svc_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_svc_item_foreach_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, - bool (*callback)(rpc_port_autofill_svc_item_h list_autofill_svc_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_items; - while (iter) { - rpc_port_autofill_svc_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_list_autofill_svc_item_remove_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_svc_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_item_h value = iter->data; - h->list_autofill_svc_items = g_list_remove_link(h->list_autofill_svc_items, iter); - rpc_port_autofill_svc_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_svc_item_get_list_autofill_svc_items_length(rpc_port_list_autofill_svc_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_svc_items); - - 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; -}; - -static void __list_autofill_svc_response_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_response_item_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_items)); - do { - GList *iter; - - iter = h->list_autofill_svc_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 __list_autofill_svc_response_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_response_item_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->list_autofill_svc_response_items = g_list_append(h->list_autofill_svc_response_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_svc_response_item_create(rpc_port_list_autofill_svc_response_item_h *h) -{ - struct list_autofill_svc_response_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_svc_response_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_svc_response_item_to; - handle->parcelable.from = __list_autofill_svc_response_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_destroy(rpc_port_list_autofill_svc_response_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_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->list_autofill_svc_response_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_clone(rpc_port_list_autofill_svc_response_item_h h, rpc_port_list_autofill_svc_response_item_h *clone) -{ - rpc_port_list_autofill_svc_response_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_svc_response_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_svc_response_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_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_list_autofill_svc_response_item_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_response_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_svc_response_item_destroy(handle); - return -1; - } - - handle->list_autofill_svc_response_items = g_list_append(handle->list_autofill_svc_response_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_add_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items) -{ - if (!h || !list_autofill_svc_response_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_response_item_h value = NULL; - - rpc_port_autofill_svc_response_item_clone(list_autofill_svc_response_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_svc_response_items = g_list_append(h->list_autofill_svc_response_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_foreach_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, - bool (*callback)(rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_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_list_autofill_svc_response_item_remove_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_svc_response_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_response_item_h value = iter->data; - h->list_autofill_svc_response_items = g_list_remove_link(h->list_autofill_svc_response_items, iter); - rpc_port_autofill_svc_response_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_svc_response_item_get_list_autofill_svc_response_items_length(rpc_port_list_autofill_svc_response_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_svc_response_items); - - return 0; -} - -struct list_autofill_svc_save_item_s { - rpc_port_parcelable_t parcelable; - GList *list_autofill_svc_save_items; -}; - -static void __list_autofill_svc_save_item_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_save_item_h h = data; - - if (!parcel || !h) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, g_list_length(h->list_autofill_svc_save_items)); - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_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 __list_autofill_svc_save_item_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_list_autofill_svc_save_item_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_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_create(&value); - if (!value) { - _E("Failed to create handle"); - return; - } - - rpc_port_parcel_read(parcel, &value->parcelable, value); - h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value); - } - } while (0); -} - -int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h) -{ - struct list_autofill_svc_save_item_s *handle; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct list_autofill_svc_save_item_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __list_autofill_svc_save_item_to; - handle->parcelable.from = __list_autofill_svc_save_item_from; - - *h = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_item_h value = iter->data; - if (value) - rpc_port_autofill_svc_save_item_destroy(value); - - iter = g_list_next(iter); - } - g_list_free(h->list_autofill_svc_save_items); - } while (0); - - free(h); - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone) -{ - rpc_port_list_autofill_svc_save_item_h handle = NULL; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - rpc_port_list_autofill_svc_save_item_create(&handle); - if (!handle) { - _E("Failed to create list_autofill_svc_save_item handle"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_item_h new_value; - rpc_port_autofill_svc_save_item_h value = iter->data; - - if (!value) { - _E("Error: value is NULL"); - rpc_port_list_autofill_svc_save_item_destroy(handle); - return -1; - } - - rpc_port_autofill_svc_save_item_clone(value, &new_value); - if (!new_value) { - _E("Failed to duplicate value"); - rpc_port_list_autofill_svc_save_item_destroy(handle); - return -1; - } - - handle->list_autofill_svc_save_items = g_list_append(handle->list_autofill_svc_save_items, new_value); - iter = g_list_next(iter); - } - } while (0); - - *clone = handle; - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items) -{ - if (!h || !list_autofill_svc_save_items) { - _E("Invalid parameter"); - return -1; - } - - do { - rpc_port_autofill_svc_save_item_h value = NULL; - - rpc_port_autofill_svc_save_item_clone(list_autofill_svc_save_items, &value); - if (!value) { - _E("Out of memory"); - return -1; - } - - h->list_autofill_svc_save_items = g_list_append(h->list_autofill_svc_save_items, value); - } while (0); - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data) -{ - if (!h || !callback) { - _E("Invalid parameter"); - return -1; - } - - do { - GList *iter; - - iter = h->list_autofill_svc_save_items; - while (iter) { - rpc_port_autofill_svc_save_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_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth) -{ - GList *iter; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - iter = g_list_nth(h->list_autofill_svc_save_items, nth); - if (iter == NULL) - return -1; - - rpc_port_autofill_svc_save_item_h value = iter->data; - h->list_autofill_svc_save_items = g_list_remove_link(h->list_autofill_svc_save_items, iter); - rpc_port_autofill_svc_save_item_destroy(value); - g_list_free(iter); - - return 0; -} - -int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length) -{ - if (!h || !length) { - _E("Invalid parameter"); - return -1; - } - - *length = g_list_length(h->list_autofill_svc_save_items); - - return 0; -} - -enum AutofillSvcPort_method_e { - AutofillSvcPort_METHOD_Result, - AutofillSvcPort_METHOD_Callback, - AutofillSvcPort_METHOD_Register, - AutofillSvcPort_METHOD_Unregister, - AutofillSvcPort_METHOD_request_auth_info, - AutofillSvcPort_METHOD_send_fill_request, - AutofillSvcPort_METHOD_commit, -}; - -enum AutofillSvcPort_delegate_e { - AutofillSvcPort_DELEGATE_autofill_svc_auth_info_cb = 1, - AutofillSvcPort_DELEGATE_autofill_svc_fill_response_cb = 2, -}; - -static rpc_port_stub_h __AutofillSvcPort_stub; -static rpc_port_stub_AutofillSvcPort_callback_s __AutofillSvcPort_callback; -static void *__AutofillSvcPort_user_data; -static GList *__AutofillSvcPort_contexts; - -struct AutofillSvcPort_context_s { - char *sender; - char *instance; - rpc_port_h port; - void *tag; - rpc_port_stub_AutofillSvcPort_callback_s callback; - void *user_data; -}; - -static struct AutofillSvcPort_context_s *__create_AutofillSvcPort_context(const char *sender, const char *instance) -{ - struct AutofillSvcPort_context_s *handle; - - handle = calloc(1, sizeof(struct AutofillSvcPort_context_s)); - if (!handle) { - _E("Out of memory"); - return NULL; - } - - handle->sender = strdup(sender); - if (!handle->sender) { - _E("Out of memory"); - free(handle); - return NULL; - } - - handle->instance = strdup(instance); - if (!handle->instance) { - _E("Out of memory"); - free(handle->sender); - free(handle); - return NULL; - } - - handle->callback = __AutofillSvcPort_callback; - handle->user_data = __AutofillSvcPort_user_data; - - return handle; -} - -static void __destroy_AutofillSvcPort_context(gpointer data) -{ - struct AutofillSvcPort_context_s *handle = data; - - if (!handle) { - _E("Critical error!"); - return; - } - - free(handle->instance); - free(handle->sender); - free(handle); -} - -static struct AutofillSvcPort_context_s *__find_AutofillSvcPort_context(const char *instance) -{ - struct AutofillSvcPort_context_s *handle; - GList *iter; - - iter = __AutofillSvcPort_contexts; - while (iter) { - handle = (struct AutofillSvcPort_context_s *)iter->data; - if (!strcmp(handle->instance, instance)) - return handle; - iter = g_list_next(iter); - } - - return NULL; -} - -int rpc_port_stub_AutofillSvcPort_context_set_tag(rpc_port_stub_AutofillSvcPort_context_h ctx, void *tag) -{ - if (!ctx) { - _E("Invalid parameter"); - return -1; - } - - ctx->tag = tag; - - return 0; -} - -int rpc_port_stub_AutofillSvcPort_context_get_tag(rpc_port_stub_AutofillSvcPort_context_h ctx, void **tag) -{ - if (!ctx || !tag) { - _E("Invalid parameter"); - return -1; - } - - *tag = ctx->tag; - - return 0; -} - -int rpc_port_stub_AutofillSvcPort_context_get_sender(rpc_port_stub_AutofillSvcPort_context_h ctx, char **sender) -{ - if (!ctx || !sender) { - _E("Invalid parameter"); - return -1; - } - - *sender = strdup(ctx->sender); - if (*sender == NULL) { - _E("Out of memory"); - return -1; - } - - return 0; -} - -struct AutofillSvcPort_autofill_svc_auth_info_cb_s { - rpc_port_parcelable_t parcelable; - rpc_port_h port; - int id; - int seq_id; - bool once; - bool valid; -}; - -static void __AutofillSvcPort_autofill_svc_auth_info_cb_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillSvcPort_autofill_svc_auth_info_cb_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h *h) -{ - struct AutofillSvcPort_autofill_svc_auth_info_cb_s *handle; - static int seq_num; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillSvcPort_autofill_svc_auth_info_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __AutofillSvcPort_autofill_svc_auth_info_cb_to; - handle->parcelable.from = __AutofillSvcPort_autofill_svc_auth_info_cb_from; - handle->id = AutofillSvcPort_DELEGATE_autofill_svc_auth_info_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->once = false; - handle->valid = true; - - *h = handle; - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - free(h); - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_clone(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h h, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h *clone) -{ - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h handle; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillSvcPort_autofill_svc_auth_info_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable = h->parcelable; - handle->port = h->port; - handle->id = h->id; - handle->seq_id = h->seq_id; - handle->once = h->once; - handle->valid = h->valid; - - *clone = handle; - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_invoke(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h h, rpc_port_autofill_svc_auth_info_h auth_info) -{ - rpc_port_parcel_h parcel = NULL; - - if (!h || !h->port) { - _E("Invalid parameter"); - return -1; - } - - if (h->once && !h->valid) { - _E("Invalid callback"); - return -1; - } - - rpc_port_parcel_create(&parcel); - if (!parcel) { - _E("Failed to create parcel"); - return -1; - } - - rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_Callback); - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_write(parcel, &auth_info->parcelable, auth_info); - - rpc_port_parcel_send(parcel, h->port); - rpc_port_parcel_destroy(parcel); - h->valid = false; - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_set_port(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h h, rpc_port_h port) -{ - if (!h || !port) { - _E("Invalid parameter"); - return -1; - } - - h->port = port; - - return 0; -} - -struct AutofillSvcPort_autofill_svc_fill_response_cb_s { - rpc_port_parcelable_t parcelable; - rpc_port_h port; - int id; - int seq_id; - bool once; - bool valid; -}; - -static void __AutofillSvcPort_autofill_svc_fill_response_cb_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, handle->id); - rpc_port_parcel_write_int32(parcel, handle->seq_id); - rpc_port_parcel_write_bool(parcel, handle->once); -} - -static void __AutofillSvcPort_autofill_svc_fill_response_cb_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h handle = data; - - if (!handle) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_read_int32(parcel, &handle->id); - rpc_port_parcel_read_int32(parcel, &handle->seq_id); - rpc_port_parcel_read_bool(parcel, &handle->once); -} - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h *h) -{ - struct AutofillSvcPort_autofill_svc_fill_response_cb_s *handle; - static int seq_num; - - if (!h) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillSvcPort_autofill_svc_fill_response_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable.to = __AutofillSvcPort_autofill_svc_fill_response_cb_to; - handle->parcelable.from = __AutofillSvcPort_autofill_svc_fill_response_cb_from; - handle->id = AutofillSvcPort_DELEGATE_autofill_svc_fill_response_cb; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->once = false; - handle->valid = true; - - *h = handle; - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h h) -{ - if (!h) { - _E("Invalid parameter"); - return -1; - } - - free(h); - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_clone(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h h, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h *clone) -{ - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h handle; - - if (!h || !clone) { - _E("Invalid parameter"); - return -1; - } - - handle = calloc(1, sizeof(struct AutofillSvcPort_autofill_svc_fill_response_cb_s)); - if (!handle) { - _E("Out of memory"); - return -1; - } - - handle->parcelable = h->parcelable; - handle->port = h->port; - handle->id = h->id; - handle->seq_id = h->seq_id; - handle->once = h->once; - handle->valid = h->valid; - - *clone = handle; - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_invoke(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h h, rpc_port_autofill_svc_fill_response_h response) -{ - rpc_port_parcel_h parcel = NULL; - - if (!h || !h->port) { - _E("Invalid parameter"); - return -1; - } - - if (h->once && !h->valid) { - _E("Invalid callback"); - return -1; - } - - rpc_port_parcel_create(&parcel); - if (!parcel) { - _E("Failed to create parcel"); - return -1; - } - - rpc_port_parcel_write_int32(parcel, AutofillSvcPort_METHOD_Callback); - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_write(parcel, &response->parcelable, response); - - rpc_port_parcel_send(parcel, h->port); - rpc_port_parcel_destroy(parcel); - h->valid = false; - - return 0; -} - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_set_port(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h h, rpc_port_h port) -{ - if (!h || !port) { - _E("Invalid parameter"); - return -1; - } - - h->port = port; - - return 0; -} - -static int __AutofillSvcPort_method_Register(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillSvcPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb = NULL; - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_cb = NULL; - - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(&auth_info_cb); - - if (!auth_info_cb) { - _E("Failed to create handle"); - return -1; - } - - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_set_port(auth_info_cb, callback_port); - rpc_port_parcel_read(parcel, &auth_info_cb->parcelable, auth_info_cb); - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(&fill_response_cb); - - if (!fill_response_cb) { - _E("Failed to create handle"); - return -1; - } - - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_set_port(fill_response_cb, callback_port); - rpc_port_parcel_read(parcel, &fill_response_cb->parcelable, fill_response_cb); - - int ret = context->callback.Register(context, auth_info_cb, fill_response_cb, context->user_data); - do { - rpc_port_parcel_h result; - - rpc_port_parcel_create(&result); - rpc_port_parcel_write_int32(result, AutofillSvcPort_METHOD_Result); - rpc_port_parcel_write_int32(result, ret); - rpc_port_parcel_send(result, port); - rpc_port_parcel_destroy(result); - } while (0); - - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_destroy(auth_info_cb); - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(fill_response_cb); - return 0; -} - -static int __AutofillSvcPort_method_Unregister(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillSvcPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - context->callback.Unregister(context, context->user_data); - - return 0; -} - -static int __AutofillSvcPort_method_request_auth_info(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillSvcPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_autofill_svc_view_info_h vi = NULL; - - rpc_port_autofill_svc_view_info_create(&vi); - rpc_port_parcel_read(parcel, &vi->parcelable, vi); - - context->callback.request_auth_info(context, vi, context->user_data); - - rpc_port_autofill_svc_view_info_destroy(vi); - return 0; -} - -static int __AutofillSvcPort_method_send_fill_request(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillSvcPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_autofill_svc_view_info_h vi = NULL; - - rpc_port_autofill_svc_view_info_create(&vi); - rpc_port_parcel_read(parcel, &vi->parcelable, vi); - - context->callback.send_fill_request(context, vi, context->user_data); - - rpc_port_autofill_svc_view_info_destroy(vi); - return 0; -} - -static int __AutofillSvcPort_method_commit(rpc_port_h port, rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context = data; - rpc_port_h callback_port; - int r; - - r = rpc_port_stub_get_port(__AutofillSvcPort_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) { - _E("Failed to get callback port"); - return -1; - } - - rpc_port_autofill_svc_save_view_info_h si = NULL; - - rpc_port_autofill_svc_save_view_info_create(&si); - rpc_port_parcel_read(parcel, &si->parcelable, si); - - context->callback.commit(context, si, context->user_data); - - rpc_port_autofill_svc_save_view_info_destroy(si); - return 0; -} - -static stub_method __AutofillSvcPort_method_table[] = { - [AutofillSvcPort_METHOD_Register] = __AutofillSvcPort_method_Register, - [AutofillSvcPort_METHOD_Unregister] = __AutofillSvcPort_method_Unregister, - [AutofillSvcPort_METHOD_request_auth_info] = __AutofillSvcPort_method_request_auth_info, - [AutofillSvcPort_METHOD_send_fill_request] = __AutofillSvcPort_method_send_fill_request, - [AutofillSvcPort_METHOD_commit] = __AutofillSvcPort_method_commit, -}; - -static void __AutofillSvcPort_on_connected(const char *sender, const char *instance, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context; - - _I("[__RPC_PORT__] sender(%s), instance(%s)", sender, instance); - context = __create_AutofillSvcPort_context(sender, instance); - if (!context) - return; - - if (context->callback.create) - context->callback.create(context, context->user_data); - __AutofillSvcPort_contexts = g_list_append(__AutofillSvcPort_contexts, context); -} - -static void __AutofillSvcPort_on_disconnected(const char *sender, const char *instance, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context; - - _I("[__RPC_PORT__] sender(%s), instance(%s)", sender, instance); - context = __find_AutofillSvcPort_context(instance); - if (!context) - return; - - if (context->callback.terminate) - context->callback.terminate(context, context->user_data); - __AutofillSvcPort_contexts = g_list_remove(__AutofillSvcPort_contexts, context); - __destroy_AutofillSvcPort_context(context); -} - -static int __AutofillSvcPort_on_received(const char *sender, const char *instance, rpc_port_h port, void *data) -{ - rpc_port_stub_AutofillSvcPort_context_h context; - rpc_port_parcel_h parcel; - int cmd = -1; - int r; - - _I("[__RPC_PORT__] sender(%s), instance(%s)", sender, instance); - context = __find_AutofillSvcPort_context(instance); - if (!context) { - _E("Failed to find AutofillSvcPort context(%s)", instance); - return -1; - } - - context->port = port; - r = rpc_port_parcel_create_from_port(&parcel, port); - if (r != 0) { - _E("Failed to create parcel from port"); - return r; - } - - rpc_port_parcel_read_int32(parcel, &cmd); - if (cmd > 1 && cmd < (sizeof(__AutofillSvcPort_method_table) / sizeof(__AutofillSvcPort_method_table[0]))) { - if (__AutofillSvcPort_method_table[cmd]) - r = __AutofillSvcPort_method_table[cmd](port, parcel, context); - } else { - _E("Unknown Command(%d)", cmd); - r = -1; - } - - rpc_port_parcel_destroy(parcel); - - return r; -} - -static int __AutofillSvcPort_add_privileges(void) -{ - - return 0; -} - -int rpc_port_stub_AutofillSvcPort_register(rpc_port_stub_AutofillSvcPort_callback_s *callback, void *user_data) -{ - int r; - - if (__AutofillSvcPort_stub) { - _W("Already exists"); - return -1; - } - - if (!callback) { - _E("Invalid parameter"); - return -1; - } - - __AutofillSvcPort_callback = *callback; - __AutofillSvcPort_user_data = user_data; - r = rpc_port_stub_create(&__AutofillSvcPort_stub, "AutofillSvcPort"); - if (r != 0) { - _E("Failed to create stub handle"); - return r; - } - - r = rpc_port_stub_add_received_event_cb(__AutofillSvcPort_stub, __AutofillSvcPort_on_received, NULL); - if (r != 0) { - _E("Failed to add received event callback"); - rpc_port_stub_destroy(__AutofillSvcPort_stub); - __AutofillSvcPort_stub = NULL; - return r; - } - - r = rpc_port_stub_add_connected_event_cb(__AutofillSvcPort_stub, __AutofillSvcPort_on_connected, NULL); - if (r != 0) { - _E("Failed to add connected event callback"); - rpc_port_stub_destroy(__AutofillSvcPort_stub); - __AutofillSvcPort_stub = NULL; - return r; - } - - r = rpc_port_stub_add_disconnected_event_cb(__AutofillSvcPort_stub, __AutofillSvcPort_on_disconnected, NULL); - if (r != 0) { - _E("Failed to add disconnected event callback"); - rpc_port_stub_destroy(__AutofillSvcPort_stub); - __AutofillSvcPort_stub = NULL; - return r; - } - - r = __AutofillSvcPort_add_privileges(); - if (r != 0) { - _E("Failed to add privileges"); - rpc_port_stub_destroy(__AutofillSvcPort_stub); - __AutofillSvcPort_stub = NULL; - return r; - } - - r = rpc_port_stub_listen(__AutofillSvcPort_stub); - if (r != 0) { - _E("Failed to listen stub"); - rpc_port_stub_destroy(__AutofillSvcPort_stub); - __AutofillSvcPort_stub = NULL; - return r; - } - - return 0; -} - -int rpc_port_stub_AutofillSvcPort_unregister(void) -{ - int r; - - if (!__AutofillSvcPort_stub) - return -1; - - if (__AutofillSvcPort_contexts) { - g_list_free_full(__AutofillSvcPort_contexts, __destroy_AutofillSvcPort_context); - __AutofillSvcPort_contexts = NULL; - } - - r = rpc_port_stub_destroy(__AutofillSvcPort_stub); - __AutofillSvcPort_stub = NULL; - - return r; -} - -int rpc_port_stub_AutofillSvcPort_get_client_number(unsigned int *n) -{ - if (!n) { - _E("Invalid parameter"); - return -1; - } - - if (!__AutofillSvcPort_stub) { - _E("AutofillSvcPort Stub is not ready"); - return -1; - } - - *n = g_list_length(__AutofillSvcPort_contexts); - - return 0; -} diff --git a/service_lib/autofill_service_stub.h b/service_lib/autofill_service_stub.h deleted file mode 100644 index b4c4619..0000000 --- a/service_lib/autofill_service_stub.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Generated by tidlc 1.3.1. - * - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct autofill_svc_item_s *rpc_port_autofill_svc_item_h; - -int rpc_port_autofill_svc_item_create(rpc_port_autofill_svc_item_h *h); - -int rpc_port_autofill_svc_item_destroy(rpc_port_autofill_svc_item_h h); - -int rpc_port_autofill_svc_item_clone(rpc_port_autofill_svc_item_h h, rpc_port_autofill_svc_item_h *clone); - -int rpc_port_autofill_svc_item_set_id(rpc_port_autofill_svc_item_h h, const char *id); - -int rpc_port_autofill_svc_item_set_label(rpc_port_autofill_svc_item_h h, const char *label); - -int rpc_port_autofill_svc_item_set_value(rpc_port_autofill_svc_item_h h, const char *value); - -int rpc_port_autofill_svc_item_set_autofill_hint(rpc_port_autofill_svc_item_h h, int autofill_hint); - -int rpc_port_autofill_svc_item_set_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_svc_item_get_id(rpc_port_autofill_svc_item_h h, char **id); - -int rpc_port_autofill_svc_item_get_label(rpc_port_autofill_svc_item_h h, char **label); - -int rpc_port_autofill_svc_item_get_value(rpc_port_autofill_svc_item_h h, char **value); - -int rpc_port_autofill_svc_item_get_autofill_hint(rpc_port_autofill_svc_item_h h, int *autofill_hint); - -int rpc_port_autofill_svc_item_get_is_sensitive_data(rpc_port_autofill_svc_item_h h, bool *is_sensitive_data); - -typedef struct autofill_svc_view_info_s *rpc_port_autofill_svc_view_info_h; - -int rpc_port_autofill_svc_view_info_create(rpc_port_autofill_svc_view_info_h *h); - -int rpc_port_autofill_svc_view_info_destroy(rpc_port_autofill_svc_view_info_h h); - -int rpc_port_autofill_svc_view_info_clone(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_view_info_h *clone); - -int rpc_port_autofill_svc_view_info_set_app_id(rpc_port_autofill_svc_view_info_h h, const char *app_id); - -int rpc_port_autofill_svc_view_info_set_view_id(rpc_port_autofill_svc_view_info_h h, const char *view_id); - -int rpc_port_autofill_svc_view_info_add_items(rpc_port_autofill_svc_view_info_h h, rpc_port_autofill_svc_item_h items); - -int rpc_port_autofill_svc_view_info_get_app_id(rpc_port_autofill_svc_view_info_h h, char **app_id); - -int rpc_port_autofill_svc_view_info_get_view_id(rpc_port_autofill_svc_view_info_h h, char **view_id); - -int rpc_port_autofill_svc_view_info_foreach_items(rpc_port_autofill_svc_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_svc_view_info_remove_items(rpc_port_autofill_svc_view_info_h h, unsigned int nth); - -int rpc_port_autofill_svc_view_info_get_items_length(rpc_port_autofill_svc_view_info_h h, unsigned int *length); - -typedef struct autofill_svc_save_item_s *rpc_port_autofill_svc_save_item_h; - -int rpc_port_autofill_svc_save_item_create(rpc_port_autofill_svc_save_item_h *h); - -int rpc_port_autofill_svc_save_item_destroy(rpc_port_autofill_svc_save_item_h h); - -int rpc_port_autofill_svc_save_item_clone(rpc_port_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h *clone); - -int rpc_port_autofill_svc_save_item_set_id(rpc_port_autofill_svc_save_item_h h, const char *id); - -int rpc_port_autofill_svc_save_item_set_label(rpc_port_autofill_svc_save_item_h h, const char *label); - -int rpc_port_autofill_svc_save_item_set_value(rpc_port_autofill_svc_save_item_h h, const char *value); - -int rpc_port_autofill_svc_save_item_set_autofill_hint(rpc_port_autofill_svc_save_item_h h, int autofill_hint); - -int rpc_port_autofill_svc_save_item_set_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool is_sensitive_data); - -int rpc_port_autofill_svc_save_item_get_id(rpc_port_autofill_svc_save_item_h h, char **id); - -int rpc_port_autofill_svc_save_item_get_label(rpc_port_autofill_svc_save_item_h h, char **label); - -int rpc_port_autofill_svc_save_item_get_value(rpc_port_autofill_svc_save_item_h h, char **value); - -int rpc_port_autofill_svc_save_item_get_autofill_hint(rpc_port_autofill_svc_save_item_h h, int *autofill_hint); - -int rpc_port_autofill_svc_save_item_get_is_sensitive_data(rpc_port_autofill_svc_save_item_h h, bool *is_sensitive_data); - -typedef struct autofill_svc_save_view_info_s *rpc_port_autofill_svc_save_view_info_h; - -int rpc_port_autofill_svc_save_view_info_create(rpc_port_autofill_svc_save_view_info_h *h); - -int rpc_port_autofill_svc_save_view_info_destroy(rpc_port_autofill_svc_save_view_info_h h); - -int rpc_port_autofill_svc_save_view_info_clone(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_view_info_h *clone); - -int rpc_port_autofill_svc_save_view_info_set_view_id(rpc_port_autofill_svc_save_view_info_h h, const char *view_id); - -int rpc_port_autofill_svc_save_view_info_add_items(rpc_port_autofill_svc_save_view_info_h h, rpc_port_autofill_svc_save_item_h items); - -int rpc_port_autofill_svc_save_view_info_get_view_id(rpc_port_autofill_svc_save_view_info_h h, char **view_id); - -int rpc_port_autofill_svc_save_view_info_foreach_items(rpc_port_autofill_svc_save_view_info_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h items, void *user_data), void *user_data); - -int rpc_port_autofill_svc_save_view_info_remove_items(rpc_port_autofill_svc_save_view_info_h h, unsigned int nth); - -int rpc_port_autofill_svc_save_view_info_get_items_length(rpc_port_autofill_svc_save_view_info_h h, unsigned int *length); - -typedef struct autofill_svc_auth_info_s *rpc_port_autofill_svc_auth_info_h; - -int rpc_port_autofill_svc_auth_info_create(rpc_port_autofill_svc_auth_info_h *h); - -int rpc_port_autofill_svc_auth_info_destroy(rpc_port_autofill_svc_auth_info_h h); - -int rpc_port_autofill_svc_auth_info_clone(rpc_port_autofill_svc_auth_info_h h, rpc_port_autofill_svc_auth_info_h *clone); - -int rpc_port_autofill_svc_auth_info_set_app_id(rpc_port_autofill_svc_auth_info_h h, const char *app_id); - -int rpc_port_autofill_svc_auth_info_set_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool exist_autofill_data); - -int rpc_port_autofill_svc_auth_info_set_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool need_authentication); - -int rpc_port_autofill_svc_auth_info_set_service_name(rpc_port_autofill_svc_auth_info_h h, const char *service_name); - -int rpc_port_autofill_svc_auth_info_set_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, const char *service_logo_image_path); - -int rpc_port_autofill_svc_auth_info_set_service_message(rpc_port_autofill_svc_auth_info_h h, const char *service_message); - -int rpc_port_autofill_svc_auth_info_get_app_id(rpc_port_autofill_svc_auth_info_h h, char **app_id); - -int rpc_port_autofill_svc_auth_info_get_exist_autofill_data(rpc_port_autofill_svc_auth_info_h h, bool *exist_autofill_data); - -int rpc_port_autofill_svc_auth_info_get_need_authentication(rpc_port_autofill_svc_auth_info_h h, bool *need_authentication); - -int rpc_port_autofill_svc_auth_info_get_service_name(rpc_port_autofill_svc_auth_info_h h, char **service_name); - -int rpc_port_autofill_svc_auth_info_get_service_logo_image_path(rpc_port_autofill_svc_auth_info_h h, char **service_logo_image_path); - -int rpc_port_autofill_svc_auth_info_get_service_message(rpc_port_autofill_svc_auth_info_h h, char **service_message); - -typedef struct autofill_svc_response_item_s *rpc_port_autofill_svc_response_item_h; - -int rpc_port_autofill_svc_response_item_create(rpc_port_autofill_svc_response_item_h *h); - -int rpc_port_autofill_svc_response_item_destroy(rpc_port_autofill_svc_response_item_h h); - -int rpc_port_autofill_svc_response_item_clone(rpc_port_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h *clone); - -int rpc_port_autofill_svc_response_item_set_id(rpc_port_autofill_svc_response_item_h h, const char *id); - -int rpc_port_autofill_svc_response_item_set_presentation_text(rpc_port_autofill_svc_response_item_h h, const char *presentation_text); - -int rpc_port_autofill_svc_response_item_set_value(rpc_port_autofill_svc_response_item_h h, const char *value); - -int rpc_port_autofill_svc_response_item_get_id(rpc_port_autofill_svc_response_item_h h, char **id); - -int rpc_port_autofill_svc_response_item_get_presentation_text(rpc_port_autofill_svc_response_item_h h, char **presentation_text); - -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); - -int rpc_port_autofill_svc_fill_response_destroy(rpc_port_autofill_svc_fill_response_h h); - -int rpc_port_autofill_svc_fill_response_clone(rpc_port_autofill_svc_fill_response_h h, rpc_port_autofill_svc_fill_response_h *clone); - -int rpc_port_autofill_svc_fill_response_set_app_id(rpc_port_autofill_svc_fill_response_h h, const char *app_id); - -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_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_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_groups(rpc_port_autofill_svc_fill_response_h h, unsigned int nth); - -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; - -int rpc_port_list_autofill_svc_item_create(rpc_port_list_autofill_svc_item_h *h); - -int rpc_port_list_autofill_svc_item_destroy(rpc_port_list_autofill_svc_item_h h); - -int rpc_port_list_autofill_svc_item_clone(rpc_port_list_autofill_svc_item_h h, rpc_port_list_autofill_svc_item_h *clone); - -int rpc_port_list_autofill_svc_item_add_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, rpc_port_autofill_svc_item_h list_autofill_svc_items); - -int rpc_port_list_autofill_svc_item_foreach_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, - bool (*callback)(rpc_port_autofill_svc_item_h list_autofill_svc_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_svc_item_remove_list_autofill_svc_items(rpc_port_list_autofill_svc_item_h h, unsigned int nth); - -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); - -int rpc_port_list_autofill_svc_response_item_destroy(rpc_port_list_autofill_svc_response_item_h h); - -int rpc_port_list_autofill_svc_response_item_clone(rpc_port_list_autofill_svc_response_item_h h, rpc_port_list_autofill_svc_response_item_h *clone); - -int rpc_port_list_autofill_svc_response_item_add_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items); - -int rpc_port_list_autofill_svc_response_item_foreach_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, - bool (*callback)(rpc_port_autofill_svc_response_item_h list_autofill_svc_response_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_svc_response_item_remove_list_autofill_svc_response_items(rpc_port_list_autofill_svc_response_item_h h, unsigned int nth); - -int rpc_port_list_autofill_svc_response_item_get_list_autofill_svc_response_items_length(rpc_port_list_autofill_svc_response_item_h h, unsigned int *length); - -typedef struct list_autofill_svc_save_item_s *rpc_port_list_autofill_svc_save_item_h; - -int rpc_port_list_autofill_svc_save_item_create(rpc_port_list_autofill_svc_save_item_h *h); - -int rpc_port_list_autofill_svc_save_item_destroy(rpc_port_list_autofill_svc_save_item_h h); - -int rpc_port_list_autofill_svc_save_item_clone(rpc_port_list_autofill_svc_save_item_h h, rpc_port_list_autofill_svc_save_item_h *clone); - -int rpc_port_list_autofill_svc_save_item_add_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items); - -int rpc_port_list_autofill_svc_save_item_foreach_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, - bool (*callback)(rpc_port_autofill_svc_save_item_h list_autofill_svc_save_items, void *user_data), void *user_data); - -int rpc_port_list_autofill_svc_save_item_remove_list_autofill_svc_save_items(rpc_port_list_autofill_svc_save_item_h h, unsigned int nth); - -int rpc_port_list_autofill_svc_save_item_get_list_autofill_svc_save_items_length(rpc_port_list_autofill_svc_save_item_h h, unsigned int *length); - -typedef struct AutofillSvcPort_context_s* rpc_port_stub_AutofillSvcPort_context_h; - -int rpc_port_stub_AutofillSvcPort_context_set_tag(rpc_port_stub_AutofillSvcPort_context_h ctx, void *tag); - -int rpc_port_stub_AutofillSvcPort_context_get_tag(rpc_port_stub_AutofillSvcPort_context_h ctx, void **tag); - -int rpc_port_stub_AutofillSvcPort_context_get_sender(rpc_port_stub_AutofillSvcPort_context_h ctx, char **sender); - -typedef struct AutofillSvcPort_autofill_svc_auth_info_cb_s *rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h; - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h h); - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_clone(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h h, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h *clone); - -int rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_invoke(rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h h, rpc_port_autofill_svc_auth_info_h auth_info); - -typedef struct AutofillSvcPort_autofill_svc_fill_response_cb_s *rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h; - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h h); - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_clone(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h h, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h *clone); - -int rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_invoke(rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h h, rpc_port_autofill_svc_fill_response_h response); - -typedef struct { - void (*create)(rpc_port_stub_AutofillSvcPort_context_h context, void *user_data); - void (*terminate)(rpc_port_stub_AutofillSvcPort_context_h context, void *user_data); - - int (*Register)(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_cb, void *user_data); - void (*Unregister)(rpc_port_stub_AutofillSvcPort_context_h context, void *user_data); - void (*request_auth_info)(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_view_info_h vi, void *user_data); - void (*send_fill_request)(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_view_info_h vi, void *user_data); - void (*commit)(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_save_view_info_h si, void *user_data); -} rpc_port_stub_AutofillSvcPort_callback_s; - -int rpc_port_stub_AutofillSvcPort_register(rpc_port_stub_AutofillSvcPort_callback_s *callback, void *user_data); - -int rpc_port_stub_AutofillSvcPort_unregister(void); - -int rpc_port_stub_AutofillSvcPort_get_client_number(unsigned int *n); - -#ifdef __cplusplus -} -#endif -- 2.7.4 From e376da10b39cb39ccefb2c74597654ea053f0668 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Oct 2018 21:29:12 +0900 Subject: [PATCH 04/16] Remove unused dependencies Change-Id: Id6bbda4b43994965a9fb80554c04473c86331ca7 Signed-off-by: Jihoon Kim --- client/CMakeLists.txt | 2 +- common/CMakeLists.txt | 2 +- common/autofill_auth_info.c | 1 - common/autofill_save_view_info.c | 1 - common/autofill_view_info.c | 1 - include/autofill.h | 2 -- include/autofill_common.h | 1 - include/autofill_service.h | 1 - service_lib/CMakeLists.txt | 2 +- 9 files changed, 3 insertions(+), 10 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index c275b2b..0f2063d 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -7,7 +7,7 @@ SET(maintainer "Jihoon Kim ") SET(description "Autofill APIs") SET(service "ui") SET(submodule "autofill") -SET(dependents "dlog eina capi-appfw-application glib-2.0 rpc-port") +SET(dependents "dlog eina glib-2.0 rpc-port") SET(LIBDIR ${LIB_INSTALL_DIR}) SET(Services diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 6e33fb6..d9357b5 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -7,7 +7,7 @@ SET(maintainer "Jihoon Kim ") SET(description "Autofill Common APIs") SET(service "ui") SET(submodule "autofill-common") -SET(dependents "dlog eina capi-appfw-application glib-2.0 rpc-port") +SET(dependents "dlog eina glib-2.0 rpc-port") SET(LIBDIR ${LIB_INSTALL_DIR}) SET(Services diff --git a/common/autofill_auth_info.c b/common/autofill_auth_info.c index 66cb1ce..9f60532 100644 --- a/common/autofill_auth_info.c +++ b/common/autofill_auth_info.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "autofill_private.h" #include diff --git a/common/autofill_save_view_info.c b/common/autofill_save_view_info.c index 0d84438..6d71d3f 100644 --- a/common/autofill_save_view_info.c +++ b/common/autofill_save_view_info.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "autofill_private.h" #include diff --git a/common/autofill_view_info.c b/common/autofill_view_info.c index f658b5e..446c0d3 100644 --- a/common/autofill_view_info.c +++ b/common/autofill_view_info.c @@ -18,7 +18,6 @@ #include #include #include -#include #include "autofill_private.h" #include diff --git a/include/autofill.h b/include/autofill.h index 0b514d1..036e86c 100644 --- a/include/autofill.h +++ b/include/autofill.h @@ -22,8 +22,6 @@ * @brief This file contains autofill APIs and related enumeration. */ -#include -#include #include "autofill_enum.h" #include "autofill_common.h" diff --git a/include/autofill_common.h b/include/autofill_common.h index 1482a14..b69a5bf 100644 --- a/include/autofill_common.h +++ b/include/autofill_common.h @@ -22,7 +22,6 @@ * @brief This file contains autofill APIs and related enumeration. */ -#include #include #include "autofill_enum.h" diff --git a/include/autofill_service.h b/include/autofill_service.h index c0de9b8..2a3910f 100644 --- a/include/autofill_service.h +++ b/include/autofill_service.h @@ -22,7 +22,6 @@ * @brief This file contains autofill APIs and related enumeration. */ -#include #include #include "autofill_enum.h" #include "autofill_common.h" diff --git a/service_lib/CMakeLists.txt b/service_lib/CMakeLists.txt index 11604da..e01c999 100644 --- a/service_lib/CMakeLists.txt +++ b/service_lib/CMakeLists.txt @@ -7,7 +7,7 @@ SET(maintainer "Jihoon Kim ") SET(description "Autofill Service APIs") SET(service "ui") SET(submodule "autofill-service") -SET(dependents "dlog eina capi-appfw-application glib-2.0 rpc-port") +SET(dependents "dlog eina glib-2.0 rpc-port") SET(LIBDIR ${LIB_INSTALL_DIR}) SET(Services -- 2.7.4 From 75c62018cbf96862f9c1e38d82a6a50bbd868fab Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Oct 2018 21:30:30 +0900 Subject: [PATCH 05/16] Fix wrong file install issue in devel packages Change-Id: I3c54ffdb662da75380ef91d442d8d8bc90c7aea3 Signed-off-by: Jihoon Kim --- packaging/capi-ui-autofill.spec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packaging/capi-ui-autofill.spec b/packaging/capi-ui-autofill.spec index 088d231..2887795 100644 --- a/packaging/capi-ui-autofill.spec +++ b/packaging/capi-ui-autofill.spec @@ -158,12 +158,13 @@ mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon %files -n capi-ui-autofill-common-devel %{_includedir}/autofill_common*.h -%{_libdir}/pkgconfig/*.pc +%{_includedir}/autofill_enum.h +%{_libdir}/pkgconfig/capi-ui-autofill-common.pc %{_libdir}/libcapi-ui-autofill-common.so %files devel -%{_includedir}/autofill*.h -%{_libdir}/pkgconfig/*.pc +%{_includedir}/autofill.h +%{_libdir}/pkgconfig/capi-ui-autofill.pc %{_libdir}/libcapi-ui-autofill.so %files -n capi-ui-autofill-service @@ -173,7 +174,7 @@ mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon %files -n capi-ui-autofill-service-devel %{_includedir}/autofill_service*.h -%{_libdir}/pkgconfig/*.pc +%{_libdir}/pkgconfig/capi-ui-autofill-service.pc %{_libdir}/libcapi-ui-autofill-service.so %files -n org.tizen.autofill-test -- 2.7.4 From 6dc4b8d8cc177e237c1ddc1472353c211a90e3c7 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Oct 2018 21:31:01 +0900 Subject: [PATCH 06/16] Add autofill-common dependency in pkgconfig Change-Id: I3841e8a41731513975b1e7af44509b6a06712c91 Signed-off-by: Jihoon Kim --- client/capi-ui-autofill.pc.in | 4 ++-- service_lib/capi-ui-autofill-service.pc.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/capi-ui-autofill.pc.in b/client/capi-ui-autofill.pc.in index 7740411..6519a49 100644 --- a/client/capi-ui-autofill.pc.in +++ b/client/capi-ui-autofill.pc.in @@ -8,7 +8,7 @@ includedir=/usr/include Name: @PC_NAME@ Description: @PACKAGE_DESCRIPTION@ Version: @VERSION@ -Requires: @PC_REQUIRED@ -Libs: -L${libdir} @PC_LDFLAGS@ +Requires: @PC_REQUIRED@ capi-ui-autofill-common +Libs: -L${libdir} @PC_LDFLAGS@ -lcapi-ui-autofill-common Cflags: -I${includedir} diff --git a/service_lib/capi-ui-autofill-service.pc.in b/service_lib/capi-ui-autofill-service.pc.in index 7740411..6519a49 100644 --- a/service_lib/capi-ui-autofill-service.pc.in +++ b/service_lib/capi-ui-autofill-service.pc.in @@ -8,7 +8,7 @@ includedir=/usr/include Name: @PC_NAME@ Description: @PACKAGE_DESCRIPTION@ Version: @VERSION@ -Requires: @PC_REQUIRED@ -Libs: -L${libdir} @PC_LDFLAGS@ +Requires: @PC_REQUIRED@ capi-ui-autofill-common +Libs: -L${libdir} @PC_LDFLAGS@ -lcapi-ui-autofill-common Cflags: -I${includedir} -- 2.7.4 From 05f592b7b19bb24d523cd78346829fd6325e58f2 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 19 Oct 2018 11:14:38 +0900 Subject: [PATCH 07/16] Add view id in auth info Change-Id: Iba9b55021bfee4fba3c932b9978b8329a2a63ed0 Signed-off-by: Jihoon Kim --- client/autofill.c | 6 ++++++ common/autofill_auth_info.c | 30 ++++++++++++++++++++++++++++++ include/autofill_common.h | 24 ++++++++++++++++++++++++ server/main.c | 6 ++++++ service/service_main.c | 13 +++++++------ service_lib/autofill_service.c | 6 ++++++ tidl/autofill.tidl | 1 + tidl/autofill_service.tidl | 1 + 8 files changed, 81 insertions(+), 6 deletions(-) diff --git a/client/autofill.c b/client/autofill.c index d166c69..7ddefa4 100644 --- a/client/autofill.c +++ b/client/autofill.c @@ -128,10 +128,12 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_auth_info_h a bool exist_autofill_data; bool need_authentication; + char *view_id = NULL; char *service_name = NULL; char *service_logo_image_path = NULL; char *service_message = NULL; + rpc_port_autofill_auth_info_get_view_id(auth_info_h, &view_id); rpc_port_autofill_auth_info_get_exist_autofill_data(auth_info_h, &exist_autofill_data); rpc_port_autofill_auth_info_get_need_authentication(auth_info_h, &need_authentication); rpc_port_autofill_auth_info_get_service_name(auth_info_h, &service_name); @@ -140,12 +142,16 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_auth_info_h a LOGD("service name : %s", service_name); + autofill_auth_info_set_view_id(ah, view_id); autofill_auth_info_set_exist_autofill_data(ah, exist_autofill_data); autofill_auth_info_set_need_authentication(ah, need_authentication); autofill_auth_info_set_service_name(ah, service_name); autofill_auth_info_set_service_logo_image_path(ah, service_logo_image_path); autofill_auth_info_set_service_message(ah, service_message); + if (view_id) + free(view_id); + if (service_name) free(service_name); diff --git a/common/autofill_auth_info.c b/common/autofill_auth_info.c index 9f60532..74cf38a 100644 --- a/common/autofill_auth_info.c +++ b/common/autofill_auth_info.c @@ -30,6 +30,7 @@ struct autofill_auth_info_s { char *app_id; + char *view_id; bool exist_autofill_data; // autofill data 보유 여부 bool need_authentication; // 인증 필요 여부 @@ -201,7 +202,36 @@ EXPORT_API int autofill_auth_info_get_app_id(autofill_auth_info_h vi, char **app if (!vi) return AUTOFILL_ERROR_INVALID_PARAMETER; + if (!vi->app_id) + return AUTOFILL_ERROR_OPERATION_FAILED; + *app_id = strdup(vi->app_id); return AUTOFILL_ERROR_NONE; } + +EXPORT_API int autofill_auth_info_set_view_id(autofill_auth_info_h vi, const char *view_id) +{ + if (!vi || !view_id) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + if (vi->view_id) + free(vi->view_id); + + vi->view_id = strdup(view_id); + + return AUTOFILL_ERROR_NONE; +} + +EXPORT_API int autofill_auth_info_get_view_id(autofill_auth_info_h vi, char **view_id) +{ + if (!vi) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + if (!vi->view_id) + return AUTOFILL_ERROR_OPERATION_FAILED; + + *view_id = strdup(vi->view_id); + + return AUTOFILL_ERROR_NONE; +} diff --git a/include/autofill_common.h b/include/autofill_common.h index b69a5bf..a8ffd29 100644 --- a/include/autofill_common.h +++ b/include/autofill_common.h @@ -267,6 +267,30 @@ int autofill_auth_info_set_app_id(autofill_auth_info_h vi, const char *app_id); int autofill_auth_info_get_app_id(autofill_auth_info_h vi, char **app_id); /** + * @brief Set view id + * + * @since_tizen 5.5 + * + * @privlevel public + * + * @return 0 on success, otherwise a negative error value + * @retval #AUTOFILL_ERROR_NONE No error + */ +int autofill_auth_info_set_view_id(autofill_auth_info_h vi, const char *view_id); + +/** + * @brief Get view id + * + * @since_tizen 5.5 + * + * @privlevel public + * + * @return 0 on success, otherwise a negative error value + * @retval #AUTOFILL_ERROR_NONE No error + */ +int autofill_auth_info_get_view_id(autofill_auth_info_h vi, char **view_id); + +/** * @brief Set exist autofill data * * @since_tizen 5.5 diff --git a/server/main.c b/server/main.c index c1b5df1..5002159 100644 --- a/server/main.c +++ b/server/main.c @@ -496,8 +496,10 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_svc_auth_info char *service_logo_image_path = NULL; char *service_message = NULL; char *app_id = NULL; + char *view_id = NULL; rpc_port_autofill_svc_auth_info_get_app_id(svc_auth_info_h, &app_id); + rpc_port_autofill_svc_auth_info_get_view_id(svc_auth_info_h, &view_id); rpc_port_autofill_svc_auth_info_get_exist_autofill_data(svc_auth_info_h, &exist_autofill_data); rpc_port_autofill_svc_auth_info_get_need_authentication(svc_auth_info_h, &need_authentication); rpc_port_autofill_svc_auth_info_get_service_name(svc_auth_info_h, &service_name); @@ -509,6 +511,7 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_svc_auth_info /* transfer auth info */ rpc_port_autofill_auth_info_h auth_info_h; rpc_port_autofill_auth_info_create(&auth_info_h); + rpc_port_autofill_auth_info_set_view_id(auth_info_h, view_id); rpc_port_autofill_auth_info_set_exist_autofill_data(auth_info_h, exist_autofill_data); rpc_port_autofill_auth_info_set_need_authentication(auth_info_h, need_authentication); rpc_port_autofill_auth_info_set_service_name(auth_info_h, service_name); @@ -524,6 +527,9 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_svc_auth_info if (app_id) free(app_id); + if (view_id) + free(view_id); + if (service_name) free(service_name); diff --git a/service/service_main.c b/service/service_main.c index 5ce3a55..471d4d4 100644 --- a/service/service_main.c +++ b/service/service_main.c @@ -109,16 +109,11 @@ static void _auth_info_request_cb(autofill_view_info_h vi_h, void *user_data) autofill_view_info_foreach_items(vi_h, __view_info_item_cb, NULL); - if (view_id) - free(view_id); - LOGD("send auth info"); autofill_auth_info_h auth_info; autofill_auth_info_create(&auth_info); autofill_auth_info_set_app_id(auth_info, app_id); - - if (app_id) - free(app_id); + autofill_auth_info_set_view_id(auth_info, view_id); autofill_auth_info_set_exist_autofill_data(auth_info, true); autofill_auth_info_set_need_authentication(auth_info, false); @@ -129,6 +124,12 @@ static void _auth_info_request_cb(autofill_view_info_h vi_h, void *user_data) LOGD("send auth info"); autofill_service_send_auth_info(auth_info); + if (app_id) + free(app_id); + + if (view_id) + free(view_id); + autofill_auth_info_destroy(auth_info); } diff --git a/service_lib/autofill_service.c b/service_lib/autofill_service.c index c935264..7d41a96 100644 --- a/service_lib/autofill_service.c +++ b/service_lib/autofill_service.c @@ -422,6 +422,7 @@ EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) bool exist_autofill_data; bool need_authentication; char *app_id = NULL; + char *view_id = NULL; char *service_name = NULL; char *service_logo_image_path = NULL; char *service_message = NULL; @@ -432,6 +433,7 @@ EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) } autofill_auth_info_get_app_id(h, &app_id); + autofill_auth_info_get_view_id(h, &view_id); autofill_auth_info_get_exist_autofill_data(h, &exist_autofill_data); autofill_auth_info_get_need_authentication(h, &need_authentication); autofill_auth_info_get_service_name(h, &service_name); @@ -444,6 +446,7 @@ EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) rpc_port_autofill_svc_auth_info_h auth_info_h; rpc_port_autofill_svc_auth_info_create(&auth_info_h); rpc_port_autofill_svc_auth_info_set_app_id(auth_info_h, app_id); + rpc_port_autofill_svc_auth_info_set_view_id(auth_info_h, view_id); rpc_port_autofill_svc_auth_info_set_exist_autofill_data(auth_info_h, exist_autofill_data); rpc_port_autofill_svc_auth_info_set_need_authentication(auth_info_h, need_authentication); rpc_port_autofill_svc_auth_info_set_service_name(auth_info_h, service_name); @@ -455,6 +458,9 @@ EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) if (app_id) free(app_id); + if (view_id) + free(view_id); + if (service_name) free(service_name); diff --git a/tidl/autofill.tidl b/tidl/autofill.tidl index a571ba9..201802a 100644 --- a/tidl/autofill.tidl +++ b/tidl/autofill.tidl @@ -25,6 +25,7 @@ struct autofill_save_view_info { } struct autofill_auth_info { + string view_id; bool exist_autofill_data; bool need_authentication; diff --git a/tidl/autofill_service.tidl b/tidl/autofill_service.tidl index 2395354..7b3bd5e 100644 --- a/tidl/autofill_service.tidl +++ b/tidl/autofill_service.tidl @@ -27,6 +27,7 @@ struct autofill_svc_save_view_info { struct autofill_svc_auth_info { string app_id; + string view_id; bool exist_autofill_data; bool need_authentication; -- 2.7.4 From 2970d9b83f6d3cc56debf26f16234c8d63278958 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 19 Oct 2018 12:44:55 +0900 Subject: [PATCH 08/16] Add autofill_connect() API Change-Id: Ib1177c419579b47ee2fafa37f29957b3d8f38000 Signed-off-by: Jihoon Kim --- client/autofill.c | 48 ++++++++++++++++++++++++++++++++++++------------ include/autofill.h | 34 +++++++++++++++++++++++++++++++++- service/service_main.c | 9 ++++----- test/ecore_imf_example.c | 26 ++++++++++++++++++-------- 4 files changed, 91 insertions(+), 26 deletions(-) diff --git a/client/autofill.c b/client/autofill.c index 7ddefa4..34c0be6 100644 --- a/client/autofill.c +++ b/client/autofill.c @@ -201,37 +201,61 @@ static void __on_rejected(rpc_port_proxy_AutofillAppPort_h h, void *user_data) } //LCOV_EXCL_STOP -EXPORT_API int autofill_initialize(autofill_connection_status_changed_cb callback, void *user_data) +EXPORT_API int autofill_initialize() { LOGD("autofill initialize"); int ret; + if (rpc_h) { + LOGI("already initialized\n"); + return AUTOFILL_ERROR_NONE; + } + rpc_port_proxy_AutofillAppPort_callback_s rpc_callback = { .connected = __on_connected, .disconnected = __on_disconnected, .rejected = __on_rejected }; + ret = rpc_port_proxy_AutofillAppPort_create(AUTOFILL_DAEMON_APP_ID, &rpc_callback, NULL, &rpc_h); + if (ret != RPC_PORT_ERROR_NONE) { + LOGW("Failed to create rpc port. err = %d", ret); + return AUTOFILL_ERROR_OUT_OF_MEMORY; + } + + return ret; +} + +EXPORT_API int autofill_deinitialize() +{ + LOGD("autofill deinitialize"); + + connection_callback = NULL; + g_autofill_fill_response_cb = NULL; + g_autofill_auth_info_cb = NULL; + + return autofill_disconnect(); +} + +EXPORT_API int autofill_connect(autofill_connection_status_changed_cb callback, void *user_data) +{ + LOGD("autofill connect"); + + int ret; + if (!callback) { LOGW("parameter is NULL\n"); return AUTOFILL_ERROR_INVALID_PARAMETER; } - if (rpc_h) { - LOGI("already connected\n"); - return AUTOFILL_ERROR_NONE; + if (!rpc_h) { + return AUTOFILL_ERROR_NOT_INITIALIZED; } connection_callback = callback; connection_userdata = user_data; - ret = rpc_port_proxy_AutofillAppPort_create(AUTOFILL_DAEMON_APP_ID, &rpc_callback, NULL, &rpc_h); - if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to create rpc port. err = %d", ret); - return AUTOFILL_ERROR_OUT_OF_MEMORY; - } - ret = rpc_port_proxy_AutofillAppPort_connect(rpc_h); switch (ret) { case RPC_PORT_ERROR_NONE: @@ -255,9 +279,9 @@ EXPORT_API int autofill_initialize(autofill_connection_status_changed_cb callbac return ret; } -EXPORT_API int autofill_deinitialize() +EXPORT_API int autofill_disconnect() { - LOGD("autofill deinitialize"); + LOGD("autofill disconnect"); if (rpc_h) { rpc_port_proxy_AutofillAppPort_destroy(rpc_h); diff --git a/include/autofill.h b/include/autofill.h index 036e86c..1c6695c 100644 --- a/include/autofill.h +++ b/include/autofill.h @@ -73,7 +73,7 @@ typedef void (*Autofill_Auth_Info_Cb)(autofill_auth_info_h auth_info, void *data * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied */ -int autofill_initialize(autofill_connection_status_changed_cb callback, void *user_data); +int autofill_initialize(); /** * @brief Autofill deinitialize @@ -88,6 +88,38 @@ int autofill_initialize(autofill_connection_status_changed_cb callback, void *us */ int autofill_deinitialize(); +/** + * @brief Autofill connect + * + * @since_tizen 5.5 + * + * @privlevel public + * + * @privilege %http://tizen.org/privilege/appmanager.launch \n + * %http://tizen.org/privilege/datasharing + * + * @return 0 on success, otherwise a negative error value + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied + */ +int autofill_connect(autofill_connection_status_changed_cb callback, void *user_data); + +/** + * @brief Autofill disconnect + * + * @since_tizen 5.5 + * + * @privlevel public + * + * @privilege %http://tizen.org/privilege/appmanager.launch \n + * %http://tizen.org/privilege/datasharing + * + * @return 0 on success, otherwise a negative error value + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied + */ +int autofill_disconnect(); + // auth /** * @brief Request of authentication information diff --git a/service/service_main.c b/service/service_main.c index 471d4d4..311627c 100644 --- a/service/service_main.c +++ b/service/service_main.c @@ -18,7 +18,6 @@ #include #include #include -#include #include "autofill_service.h" #ifdef LOG_TAG @@ -116,10 +115,10 @@ static void _auth_info_request_cb(autofill_view_info_h vi_h, void *user_data) autofill_auth_info_set_view_id(auth_info, view_id); autofill_auth_info_set_exist_autofill_data(auth_info, true); - autofill_auth_info_set_need_authentication(auth_info, false); - autofill_auth_info_set_service_name(auth_info, "Samsung Pass444"); - autofill_auth_info_set_service_message(auth_info, "Login with Samsung Pass333"); - autofill_auth_info_set_service_logo_image_path(auth_info, "/usr/apps/com.samsung.samsungpass/shared/samsung_pass.png"); + autofill_auth_info_set_need_authentication(auth_info, false); // Use true in real situation + autofill_auth_info_set_service_name(auth_info, "Samsung Pass"); + autofill_auth_info_set_service_message(auth_info, "Login with Samsung Pass"); + autofill_auth_info_set_service_logo_image_path(auth_info, "/usr/apps/com.samsung.samsungpass/shared/res/samsung_pass.png"); LOGD("send auth info"); autofill_service_send_auth_info(auth_info); diff --git a/test/ecore_imf_example.c b/test/ecore_imf_example.c index a6a65d7..a502c5f 100644 --- a/test/ecore_imf_example.c +++ b/test/ecore_imf_example.c @@ -1,9 +1,5 @@ /** - * Ecore example illustrating how to use ecore imf. - * - * @verbatim - * gcc -o ecore_imf_example ecore_imf_example.c `pkg-config --cflags --libs ecore evas eina ecore-evas ecore-imf ecore-imf-evas` - * @endverbatim + * Example illustrating how to use autofill library. */ #include @@ -13,10 +9,11 @@ #include #include #include -#include #include #include +#include + #define WIDTH 720 #define HEIGHT 1280 @@ -196,7 +193,9 @@ _autofill_auth_info_cb(autofill_auth_info_h auth_info_h, void *data) char *service_name = NULL; char *service_message = NULL; char *service_logo_image_path = NULL; + char *view_id = NULL; + autofill_auth_info_get_view_id(auth_info_h, &view_id); autofill_auth_info_get_exist_autofill_data(auth_info_h, &exist_autofill_data); autofill_auth_info_get_need_authentication(auth_info_h, &need_authentication); @@ -204,7 +203,10 @@ _autofill_auth_info_cb(autofill_auth_info_h auth_info_h, void *data) autofill_auth_info_get_service_message(auth_info_h, &service_message); autofill_auth_info_get_service_logo_image_path(auth_info_h, &service_logo_image_path); - LOGD("exist : %d, need_auth : %d, service name : %s, logo path : %s, message : '%s'", exist_autofill_data, need_authentication, service_name, service_logo_image_path, service_message); + LOGD("view id : %s, exist : %d, need_auth : %d, view_id, service name : %s, logo path : %s, message : '%s'", exist_autofill_data, need_authentication, service_name, service_logo_image_path, service_message); + + if (view_id) + free(view_id); if (service_message) free(service_message); @@ -744,7 +746,7 @@ main(void) ecore_imf_init(); - ret = autofill_initialize(connection_status_changed_cb, NULL); + ret = autofill_initialize(); if (ret == AUTOFILL_ERROR_NONE) LOGD("Succeeded to initialize"); else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) @@ -752,6 +754,14 @@ main(void) else LOGW("Failed to initialize. error : %d", ret); + ret = autofill_connect(connection_status_changed_cb, NULL); + if (ret == AUTOFILL_ERROR_NONE) + LOGD("Succeeded to connect"); + else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) + LOGW("permission denied"); + else + LOGW("Failed to connect. error : %d", ret); + // create a new window, with size=WIDTHxHEIGHT and default engine ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); -- 2.7.4 From 6d6e8b9c939e0696bcf1c4b1608b0d5d07625654 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 19 Oct 2018 17:10:55 +0900 Subject: [PATCH 09/16] Remove unnecessary log Change-Id: Iefa9dc459389600a4fedf46e9aac432884833d7c Signed-off-by: Jihoon Kim --- common/autofill_fill_response_item.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/autofill_fill_response_item.c b/common/autofill_fill_response_item.c index 0a4f809..93ace5d 100644 --- a/common/autofill_fill_response_item.c +++ b/common/autofill_fill_response_item.c @@ -35,8 +35,6 @@ struct autofill_response_item_s { EXPORT_API int autofill_fill_response_item_create(autofill_fill_response_item_h *it) { - LOGD("autofill fill response item create"); - if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; -- 2.7.4 From 6fa588c42f0a8df64c547ff678929f0166ff782f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 19 Oct 2018 17:15:03 +0900 Subject: [PATCH 10/16] Remove autofill-test and autofill-service-test app Those apps will be stored in other repository. Change-Id: I89ef3fe83c593ed09c51534b392e296d8bb6c844 Signed-off-by: Jihoon Kim --- CMakeLists.txt | 6 - packaging/capi-ui-autofill.spec | 33 +- service/CMakeLists.txt | 41 -- service/org.tizen.autofill-service.manifest | 5 - service/org.tizen.autofill-service.xml | 14 - service/service_main.c | 309 ---------- test/CMakeLists.txt | 49 -- test/ecore_imf_example.c | 843 ---------------------------- test/org.tizen.autofill-test.manifest | 5 - test/org.tizen.autofill-test.png | Bin 57662 -> 0 bytes test/org.tizen.autofill-test.xml | 14 - 11 files changed, 1 insertion(+), 1318 deletions(-) delete mode 100644 service/CMakeLists.txt delete mode 100644 service/org.tizen.autofill-service.manifest delete mode 100644 service/org.tizen.autofill-service.xml delete mode 100644 service/service_main.c delete mode 100644 test/CMakeLists.txt delete mode 100644 test/ecore_imf_example.c delete mode 100644 test/org.tizen.autofill-test.manifest delete mode 100644 test/org.tizen.autofill-test.png delete mode 100644 test/org.tizen.autofill-test.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d17f5e..80113db 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,13 +33,7 @@ ADD_SUBDIRECTORY(service_lib) ## Server daemon ## ADD_SUBDIRECTORY(server) -## Autofill Service ## -ADD_SUBDIRECTORY(service) - ## Config ## #INSTALL(FILES ${CMAKE_SOURCE_DIR}/autofill-config.xml DESTINATION ${TZ_SYS_RO_SHARE}/voice/autofill/1.0) #INSTALL(FILES ${CMAKE_SOURCE_DIR}/autofill-server.conf DESTINATION /etc/dbus-1/session.d) - -## Sample application ## -ADD_SUBDIRECTORY(test) diff --git a/packaging/capi-ui-autofill.spec b/packaging/capi-ui-autofill.spec index 2887795..4e6423d 100644 --- a/packaging/capi-ui-autofill.spec +++ b/packaging/capi-ui-autofill.spec @@ -71,15 +71,6 @@ Requires: %{name} = %{version}-%{release} Autofill Service Library (Development) -%package -n org.tizen.autofill-test -Summary: Autofill Test application -Group: Graphics & UI Framework/Input -Requires: %{name} = %{version}-%{release} - -%description -n org.tizen.autofill-test -Autofill Test application - - %package -n org.tizen.autofill-daemon Summary: Autofill Daemon application Group: Graphics & UI Framework/Input @@ -89,14 +80,6 @@ Requires: %{name} = %{version}-%{release} Autofill Daemon application -%package -n org.tizen.autofill-service -Summary: Autofill Service application -Group: Graphics & UI Framework/Input -Requires: %{name} = %{version}-%{release} - -%description -n org.tizen.autofill-service -Autofill Service application - %prep %setup -q @@ -126,7 +109,7 @@ rm -rf CMakeFiles rm -rf CMakeCache.txt MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIB_INSTALL_DIR:PATH=%{_libdir} \ - -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES -DTZ_SYS_RO_ICONS=%TZ_SYS_RO_ICONS + -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES make %{?jobs:-j%jobs} @@ -137,9 +120,6 @@ rm -rf %{buildroot} %post /sbin/ldconfig -%post -n org.tizen.autofill-test -mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-test - %post -n org.tizen.autofill-daemon mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon @@ -177,18 +157,7 @@ mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon %{_libdir}/pkgconfig/capi-ui-autofill-service.pc %{_libdir}/libcapi-ui-autofill-service.so -%files -n org.tizen.autofill-test -%manifest test/org.tizen.autofill-test.manifest -%{TZ_SYS_RO_PACKAGES}/org.tizen.autofill-test.xml -%{TZ_SYS_RO_APP}/org.tizen.autofill-test/* -%{TZ_SYS_RO_ICONS}/default/small/* - %files -n org.tizen.autofill-daemon %manifest server/org.tizen.autofill-daemon.manifest %{TZ_SYS_RO_PACKAGES}/org.tizen.autofill-daemon.xml %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon/* - -%files -n org.tizen.autofill-service -%manifest service/org.tizen.autofill-service.manifest -%{TZ_SYS_RO_PACKAGES}/org.tizen.autofill-service.xml -%{TZ_SYS_RO_APP}/org.tizen.autofill-service/* diff --git a/service/CMakeLists.txt b/service/CMakeLists.txt deleted file mode 100644 index 174d11a..0000000 --- a/service/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(autofill-service C) - -SET(SRCS - service_main.c -# autofill_stub.c -) - -pkg_check_modules(pkgs_service REQUIRED - capi-base-common - dlog - ecore - eina - capi-appfw-service-application - rpc-port - glib-2.0 -) - -INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include) - -FOREACH(flag ${pkgs_service_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") - -FIND_PROGRAM(UNAME NAMES uname) -EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_service_LDFLAGS} capi-ui-autofill-service) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${TZ_SYS_RO_APP}/org.tizen.${PROJECT_NAME}/bin/) -INSTALL(FILES ${CMAKE_BINARY_DIR}/service/org.tizen.${PROJECT_NAME}.xml DESTINATION ${TZ_SYS_RO_PACKAGES}) -#INSTALL(FILES ${CMAKE_BINARY_DIR}/service/autofill-service.manifest DESTINATION ${TZ_SYS_RO_PACKAGES}) diff --git a/service/org.tizen.autofill-service.manifest b/service/org.tizen.autofill-service.manifest deleted file mode 100644 index 017d22d..0000000 --- a/service/org.tizen.autofill-service.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/service/org.tizen.autofill-service.xml b/service/org.tizen.autofill-service.xml deleted file mode 100644 index 70aba8b..0000000 --- a/service/org.tizen.autofill-service.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - Jihoon Kim - autofill-service - - - - - - http://tizen.org/privilege/appmanager.launch - http://tizen.org/privilege/datasharing - - diff --git a/service/service_main.c b/service/service_main.c deleted file mode 100644 index 311627c..0000000 --- a/service/service_main.c +++ /dev/null @@ -1,309 +0,0 @@ - /* - * 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 -#include -#include -#include -#include "autofill_service.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "AUTOFILL_SERVICE_TEST" - -static bool __view_info_item_cb(autofill_item_h items, void *user_data) -{ - char *id = NULL; - char *label = NULL; - char *value = NULL; - autofill_hint_e autofill_hint; - bool sensitive_data; - - autofill_item_get_id(items, &id); - if (id) { - LOGD("id : %s", id); - free(id); - } - - autofill_item_get_label(items, &label); - if (label) { - LOGD("label : %s", label); - free(label); - } - - autofill_item_get_value(items, &value); - if (value) { - LOGD("value : %s", value); - free(value); - } - - autofill_item_get_autofill_hint(items, &autofill_hint); - LOGD("autofill hint : %d", autofill_hint); - - autofill_item_get_sensitive_data(items, &sensitive_data); - LOGD("sensitive data : %d", sensitive_data); - - return true; -} - -static bool __save_item_cb(autofill_save_item_h it_h, void *user_data) -{ - char *id = NULL; - char *label = NULL; - char *value = NULL; - autofill_hint_e autofill_hint; - bool sensitive_data; - - autofill_save_item_get_id(it_h, &id); - if (id) { - LOGD("id : %s", id); - free(id); - } - - autofill_save_item_get_label(it_h, &label); - if (label) { - LOGD("label : %s", label); - free(label); - } - - autofill_save_item_get_value(it_h, &value); - if (value) { - LOGD("value : %s", value); - free(value); - } - - autofill_save_item_get_autofill_hint(it_h, &autofill_hint); - LOGD("autofill hint : %d", autofill_hint); - - autofill_save_item_get_sensitive_data(it_h, &sensitive_data); - LOGD("sensitive data : %d", sensitive_data); - - return true; -} - -static void _auth_info_request_cb(autofill_view_info_h vi_h, void *user_data) -{ - LOGD(""); - - char *view_id = NULL; - char *app_id = NULL; - - autofill_view_info_get_app_id(vi_h, &app_id); - autofill_view_info_get_view_id(vi_h, &view_id); - LOGD("app_id : %s, view id : %s", app_id, view_id); - - autofill_view_info_foreach_items(vi_h, __view_info_item_cb, NULL); - - LOGD("send auth info"); - autofill_auth_info_h auth_info; - autofill_auth_info_create(&auth_info); - autofill_auth_info_set_app_id(auth_info, app_id); - autofill_auth_info_set_view_id(auth_info, view_id); - - autofill_auth_info_set_exist_autofill_data(auth_info, true); - autofill_auth_info_set_need_authentication(auth_info, false); // Use true in real situation - autofill_auth_info_set_service_name(auth_info, "Samsung Pass"); - autofill_auth_info_set_service_message(auth_info, "Login with Samsung Pass"); - autofill_auth_info_set_service_logo_image_path(auth_info, "/usr/apps/com.samsung.samsungpass/shared/res/samsung_pass.png"); - - LOGD("send auth info"); - autofill_service_send_auth_info(auth_info); - - if (app_id) - free(app_id); - - if (view_id) - free(view_id); - - autofill_auth_info_destroy(auth_info); -} - -static void _fill_request_cb(autofill_view_info_h vi_h, void *user_data) -{ - char *app_id = NULL; - char *view_id = NULL; - - autofill_view_info_get_app_id(vi_h, &app_id); - autofill_view_info_get_view_id(vi_h, &view_id); - LOGD("app id : %s, view id : %s", app_id, view_id); - - autofill_fill_response_h fill_response_h; - autofill_fill_response_create(&fill_response_h); - autofill_fill_response_set_app_id(fill_response_h, app_id); - autofill_fill_response_set_view_id(fill_response_h, view_id); - - if (app_id) - free(app_id); - - if (view_id) - free(view_id); - - autofill_fill_response_group_h res_group_h[2]; - autofill_fill_response_item_h res_it_h[2]; - - /* group 1 */ - autofill_fill_response_group_create(&res_group_h[0]); - - /* item 1 */ - autofill_fill_response_item_create(&res_it_h[0]); - autofill_fill_response_item_set_id(res_it_h[0], "id"); - autofill_fill_response_item_set_presentation_text(res_it_h[0], "Input ID"); - autofill_fill_response_item_set_value(res_it_h[0], "tester1"); - - /* Add item 1 in group 1 */ - autofill_fill_response_group_add_item(res_group_h[0], res_it_h[0]); - - /* item 2 */ - autofill_fill_response_item_create(&res_it_h[1]); - autofill_fill_response_item_set_id(res_it_h[1], "password"); - autofill_fill_response_item_set_presentation_text(res_it_h[1], "Input Password"); - autofill_fill_response_item_set_value(res_it_h[1], "testerpw1"); - - /* Add item 2 in group 1 */ - autofill_fill_response_group_add_item(res_group_h[0], res_it_h[1]); - - autofill_fill_response_item_destroy(res_it_h[0]); - autofill_fill_response_item_destroy(res_it_h[1]); - - /* Add group 1 in fill response */ - autofill_fill_response_add_group(fill_response_h, 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(&res_it_h[0]); - autofill_fill_response_item_set_id(res_it_h[0], "id"); - autofill_fill_response_item_set_presentation_text(res_it_h[0], "Input ID"); - autofill_fill_response_item_set_value(res_it_h[0], "tester2"); - - /* Add item 1 in group 2 */ - autofill_fill_response_group_add_item(res_group_h[0], res_it_h[0]); - - /* item 2 */ - autofill_fill_response_item_create(&res_it_h[1]); - autofill_fill_response_item_set_id(res_it_h[1], "password"); - autofill_fill_response_item_set_presentation_text(res_it_h[1], "Input Password"); - autofill_fill_response_item_set_value(res_it_h[1], "testerpw2"); - - /* Add item 2 in group 2 */ - autofill_fill_response_group_add_item(res_group_h[0], res_it_h[1]); - - autofill_fill_response_item_destroy(res_it_h[0]); - autofill_fill_response_item_destroy(res_it_h[1]); - - autofill_fill_response_add_group(fill_response_h, res_group_h[1]); - - autofill_fill_response_group_destroy(res_group_h[1]); - - /* Send fill response */ - autofill_service_send_fill_response(fill_response_h); - - autofill_fill_response_destroy(fill_response_h); -} - -static void _commit_cb(autofill_save_view_info_h vi_h, void *user_data) -{ - char *view_id = NULL; - autofill_save_view_info_get_view_id(vi_h, &view_id); - LOGD("view id : %s", view_id); - - autofill_save_view_info_foreach_items(vi_h, __save_item_cb, NULL); - - if (view_id) - free(view_id); -} - -bool service_app_create(void *data) -{ - // Todo: add your code here. - LOGD(""); - - autofill_service_initialize(); - - autofill_service_set_auth_info_request_cb(_auth_info_request_cb, NULL); - autofill_service_set_fill_request_cb(_fill_request_cb, NULL); - autofill_service_set_commit_cb(_commit_cb, NULL); - - return true; -} - -void service_app_terminate(void *data) -{ - // Todo: add your code here. - LOGD(""); - - autofill_service_deinitialize(); - - return; -} - -void service_app_control(app_control_h app_control, void *data) -{ - // Todo: add your code here. - return; -} - -static void -service_app_lang_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LANGUAGE_CHANGED*/ - return; -} - -static void -service_app_region_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_REGION_FORMAT_CHANGED*/ -} - -static void -service_app_low_battery(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LOW_BATTERY*/ -} - -static void -service_app_low_memory(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LOW_MEMORY*/ -} - -/** - * Entry point for this application. - */ -int main(int argc, char *argv[]) -{ - LOGI("BEGIN"); - - char ad[50] = {0,}; - service_app_lifecycle_callback_s event_callback; - app_event_handler_h handlers[5] = {NULL, }; - - event_callback.create = service_app_create; - event_callback.terminate = service_app_terminate; - event_callback.app_control = service_app_control; - - service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); - - return service_app_main(argc, argv, &event_callback, ad); -} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index b879451..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(autofill-test C) - -SET(ICONDIR "${TZ_SYS_RO_ICONS}/default/small") - -SET(SRCS - ecore_imf_example.c -) - -pkg_check_modules(pkgs_test REQUIRED - capi-base-common - dlog - ecore - ecore-evas - evas - eina - ecore-imf - ecore-imf-evas - capi-appfw-application - efl-extension - elementary -) - -INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include) - -FOREACH(flag ${pkgs_test_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -ADD_DEFINITIONS("-DEXPORTED=__attribute__((visibility(\"default\")))") - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") - -FIND_PROGRAM(UNAME NAMES uname) -EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_test_LDFLAGS} capi-ui-autofill) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${TZ_SYS_RO_APP}/org.tizen.${PROJECT_NAME}/bin) -INSTALL(FILES ${CMAKE_BINARY_DIR}/test/org.tizen.autofill-test.xml DESTINATION ${TZ_SYS_RO_PACKAGES}) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/test/org.tizen.autofill-test.png DESTINATION ${ICONDIR}) -#INSTALL(FILES ${CMAKE_BINARY_DIR}/test/autofill-test.manifest DESTINATION ${TZ_SYS_RO_PACKAGES}) diff --git a/test/ecore_imf_example.c b/test/ecore_imf_example.c deleted file mode 100644 index a502c5f..0000000 --- a/test/ecore_imf_example.c +++ /dev/null @@ -1,843 +0,0 @@ -/** - * Example illustrating how to use autofill library. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define WIDTH 720 -#define HEIGHT 1280 - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "AUTOFILL_TEST" - -typedef struct _Entry Entry; - -struct _Entry -{ - Evas_Object *rect; - Evas_Object *txt_obj; - Evas_Textblock_Style *txt_style; - Evas_Textblock_Cursor *cursor; - Evas_Textblock_Cursor *preedit_start; - Evas_Textblock_Cursor *preedit_end; - Ecore_IMF_Context *imf_context; - autofill_item_h ai_h; - autofill_save_item_h si_h; - Eina_Bool have_preedit : 1; -}; - -static Entry en1, en2; - -static autofill_view_info_h g_vi_h = NULL; - -static void _imf_cursor_info_set(Entry *en); - -static void -_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info) -{ - Entry *en = data; - Evas_Event_Mouse_Down *ev = event_info; - if (!en) return; - - if (en->imf_context) - { - Ecore_IMF_Event_Mouse_Down ecore_ev; - ecore_imf_evas_event_mouse_down_wrap(ev, &ecore_ev); - if (ecore_imf_context_filter_event(en->imf_context, - ECORE_IMF_EVENT_MOUSE_DOWN, - (Ecore_IMF_Event *)&ecore_ev)) - return; - - // ecore_imf_context_reset should be called before calculating new cursor position - ecore_imf_context_reset(en->imf_context); - } - - // calculate new cursor position -} - -static void -_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info) -{ - Entry *en = data; - Evas_Event_Mouse_Up *ev = event_info; - if (!en) return; - - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) - { - _imf_cursor_info_set(en); - return; - } - - if (en->imf_context) - { - Ecore_IMF_Event_Mouse_Up ecore_ev; - ecore_imf_evas_event_mouse_up_wrap(ev, &ecore_ev); - if (ecore_imf_context_filter_event(en->imf_context, - ECORE_IMF_EVENT_MOUSE_UP, - (Ecore_IMF_Event *)&ecore_ev)) - return; - } - - if (en->rect) - { - if (evas_object_focus_get(en->rect)) - { - // notify cursor information - _imf_cursor_info_set(en); - } - else - evas_object_focus_set(en->rect, EINA_TRUE); - } -} - -static bool _fill_response_item_cb(autofill_fill_response_item_h item, void *user_data) -{ - char *id = NULL; - char *value = NULL; - char *presentation_text = NULL; - - char *id1 = NULL, *id2 = NULL; - - autofill_item_get_id(en1.ai_h, &id1); - autofill_item_get_id(en2.ai_h, &id2); - - autofill_fill_response_item_get_id(item, &id); - autofill_fill_response_item_get_presentation_text(item, &presentation_text); - autofill_fill_response_item_get_value(item, &value); - - LOGD("id : %s, value : %s, presentation text : %s", id, value, presentation_text); - - if (id1 && strcmp(id, id1) == 0) { - evas_object_textblock_text_markup_prepend(en1.cursor, value); - } - - if (id2 && strcmp(id, id2) == 0) { - evas_object_textblock_text_markup_prepend(en2.cursor, value); - } - - if (id) { - free(id); - } - - if (value) { - free(value); - } - - if (presentation_text) { - free(presentation_text); - } - - 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) - { - response_item = (autofill_fill_response_item_h)eina_list_data_get(fill_response->autofill_fill_response_item_list); - - if (id1 && strcmp(response_item->id, id1) == 0) { - //ecore_imf_context_event_callback_call(en1.imf_context, ECORE_IMF_CALLBACK_AUTOFILL_DATA_SET, response_item->value); - LOGD("autofill id : %s, value : %s", response_item->id, response_item->value); - evas_object_textblock_text_markup_prepend(en1.cursor, response_item->value); - return; - } - - if (id2 && strcmp(response_item->id, id2) == 0) { - //ecore_imf_context_event_callback_call(en1.imf_context, ECORE_IMF_CALLBACK_AUTOFILL_DATA_SET, response_item->value); - LOGD("autofill id : %s, value : %s", response_item->id, response_item->value); - evas_object_textblock_text_markup_prepend(en2.cursor, response_item->value); - return; - } - - return; - } -#endif - - autofill_fill_response_foreach_groups(fill_response, _fill_response_group_cb, NULL); -} - -static void -_autofill_auth_info_cb(autofill_auth_info_h auth_info_h, void *data) -{ - bool exist_autofill_data; - bool need_authentication; - char *service_name = NULL; - char *service_message = NULL; - char *service_logo_image_path = NULL; - char *view_id = NULL; - - autofill_auth_info_get_view_id(auth_info_h, &view_id); - autofill_auth_info_get_exist_autofill_data(auth_info_h, &exist_autofill_data); - autofill_auth_info_get_need_authentication(auth_info_h, &need_authentication); - - autofill_auth_info_get_service_name(auth_info_h, &service_name); - autofill_auth_info_get_service_message(auth_info_h, &service_message); - autofill_auth_info_get_service_logo_image_path(auth_info_h, &service_logo_image_path); - - LOGD("view id : %s, exist : %d, need_auth : %d, view_id, service name : %s, logo path : %s, message : '%s'", exist_autofill_data, need_authentication, service_name, service_logo_image_path, service_message); - - if (view_id) - free(view_id); - - if (service_message) - free(service_message); - - if (service_name) - free(service_name); - - if (service_logo_image_path) - free(service_logo_image_path); - - if (!exist_autofill_data) - return; - - if (need_authentication) - { - // FILL ME : show service info popup - return; - } - - LOGD("Send fill request"); - - autofill_fill_response_set_callback(_autofill_fill_response_cb, NULL); - int ret = autofill_fill_request(g_vi_h); - if (ret == AUTOFILL_ERROR_NONE) - LOGD("Succeeded to request fill"); - else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) - LOGW("permission denied"); - else - LOGW("Failed to request fill : %d", ret); -} - -static void -_request_autofill_auth_info() -{ - int ret; - autofill_auth_info_set_callback(_autofill_auth_info_cb, NULL); - ret = autofill_auth_info_request(g_vi_h); - if (ret == AUTOFILL_ERROR_NONE) - LOGD("Succeeded to request auth info"); - else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) - LOGW("permission denied"); - else - LOGW("Failed to request auth info. error : %d", ret); -} - -static void -_save_autofill_info() -{ - int ret; - char *app_id; - app_get_id(&app_id); - autofill_save_view_info_h svi_h = NULL; - - const char *str; - str = evas_object_textblock_text_markup_get(en1.txt_obj); - autofill_save_item_set_value(en1.si_h, str ? str : ""); - - str = evas_object_textblock_text_markup_get(en2.txt_obj); - autofill_save_item_set_value(en2.si_h, str ? str : ""); - - // create autofill view info - autofill_save_view_info_create(&svi_h); - autofill_save_view_info_set_app_id(svi_h, app_id); - autofill_save_view_info_set_view_id(svi_h, "login"); - - autofill_save_view_info_add_item(svi_h, en1.si_h); - autofill_save_view_info_add_item(svi_h, en2.si_h); - - if (app_id) - free(app_id); - - ret = autofill_commit(svi_h); - if (ret == AUTOFILL_ERROR_NONE) - LOGD("Succeeded to commit"); - else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) - LOGW("permission denied"); - else - LOGW("Failed to commit. error : %d", ret); - - autofill_save_view_info_destroy(svi_h); -} - -static void -_entry_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Entry *en = data; - if (!en) return; - - if (en->imf_context) - ecore_imf_context_focus_in(en->imf_context); - - // notify the cursor information - _imf_cursor_info_set(en); - - _request_autofill_auth_info(); -} - -static void -_entry_focus_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Entry *en = data; - if (!en) return; - - if (en->imf_context) - { - // ecore_imf_context_reset should be called for flushing the preedit string in focus-out event handler - ecore_imf_context_reset(en->imf_context); - ecore_imf_context_focus_out(en->imf_context); - } - - _save_autofill_info(); -} - -static void -_canvas_focus_in_cb(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED) -{ - Entry *en; - Evas_Object *obj = evas_focus_get(e); - if (!obj) return; - - en = evas_object_data_get(obj, "Entry"); - if (en) - _entry_focus_in_cb(en, NULL, NULL, NULL); -} - -static void -_canvas_focus_out_cb(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED) -{ - Entry *en; - Evas_Object *obj = evas_focus_get(e); - if (!obj) return; - - en = evas_object_data_get(obj, "Entry"); - if (en) - _entry_focus_out_cb(en, NULL, NULL, NULL); -} - -static void -_imf_cursor_info_set(Entry *en) -{ - Evas_Coord x, y, w, h; - Evas_Coord cx, cy, cw, ch; // cursor geometry - int cursor_pos; // cursor position in chars (Not bytes) - Evas_BiDi_Direction dir; - - if (!en) return; - - // get cursor geometry - if (en->txt_obj) - evas_object_geometry_get(en->txt_obj, &x, &y, &w, &h); - - if (en->cursor && en->imf_context) - { - evas_textblock_cursor_geometry_get(en->cursor, &cx, &cy, &cw, &ch, &dir, EVAS_TEXTBLOCK_CURSOR_BEFORE); - - // get cursor position - cursor_pos = evas_textblock_cursor_pos_get(en->cursor); - - ecore_imf_context_cursor_position_set(en->imf_context, cursor_pos); - ecore_imf_context_cursor_location_set(en->imf_context, x + cx, y + cy, cw, ch); - ecore_imf_context_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir); - } -} - -static void -_preedit_del(Entry *en) -{ - if (!en || !en->have_preedit) return; - if (!en->preedit_start || !en->preedit_end) return; - if (!evas_textblock_cursor_compare(en->preedit_start, en->preedit_end)) return; - - // delete the preedit characters - evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end); -} - -static void -_preedit_clear(Entry *en) -{ - if (en->preedit_start) - { - evas_textblock_cursor_free(en->preedit_start); - en->preedit_start = NULL; - } - - if (en->preedit_end) - { - evas_textblock_cursor_free(en->preedit_end); - en->preedit_end = NULL; - } - - en->have_preedit = EINA_FALSE; -} - -static void -_ecore_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info) -{ - Entry *en = data; - char *commit_str = (char *)event_info; - if (!en) return; - - // delete preedit string - _preedit_del(en); - _preedit_clear(en); - - printf("commit string : %s\n", commit_str); - - // insert the commit string in the editor - if (en->cursor && commit_str) - evas_object_textblock_text_markup_prepend(en->cursor, commit_str); - - // notify the cursor information - _imf_cursor_info_set(en); - - return; -} - -static void -_ecore_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *event_info EINA_UNUSED) -{ - // example how to get preedit string - Entry *en = data; - char *preedit_string; - int cursor_pos; - Eina_List *attrs = NULL; - Eina_List *l; - Ecore_IMF_Preedit_Attr *attr; - Ecore_IMF_Context *imf_context = ctx; - int preedit_start_pos, preedit_end_pos; - int i; - Eina_Bool preedit_end_state = EINA_FALSE; - - if (!en || !en->cursor) return; - - // get preedit string and attributes - ecore_imf_context_preedit_string_with_attributes_get(imf_context, &preedit_string, &attrs, &cursor_pos); - printf("preedit string : %s\n", preedit_string); - - if (!strcmp(preedit_string, "")) - preedit_end_state = EINA_TRUE; - - // delete preedit - _preedit_del(en); - - preedit_start_pos = evas_textblock_cursor_pos_get(en->cursor); - - // insert preedit character(s) - if (strlen(preedit_string) > 0) - { - if (attrs) - { - EINA_LIST_FOREACH(attrs, l, attr) - { - if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1) // style type - { - // apply appropriate style such as underline - } - else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2 || attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3) - { - // apply appropriate style such as underline - } - } - - // insert code to display preedit string in your editor - evas_object_textblock_text_markup_prepend(en->cursor, preedit_string); - } - } - - if (!preedit_end_state) - { - // set preedit start cursor - if (!en->preedit_start) - en->preedit_start = evas_object_textblock_cursor_new(en->txt_obj); - evas_textblock_cursor_copy(en->cursor, en->preedit_start); - - // set preedit end cursor - if (!en->preedit_end) - en->preedit_end = evas_object_textblock_cursor_new(en->txt_obj); - evas_textblock_cursor_copy(en->cursor, en->preedit_end); - - preedit_end_pos = evas_textblock_cursor_pos_get(en->cursor); - - for (i = 0; i < (preedit_end_pos - preedit_start_pos); i++) - { - evas_textblock_cursor_char_prev(en->preedit_start); - } - - en->have_preedit = EINA_TRUE; - - // set cursor position - evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos); - } - - // notify the cursor information - _imf_cursor_info_set(en); - - EINA_LIST_FREE(attrs, attr) { - if (attr) - free(attr); - } - - free(preedit_string); -} - -static void -_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info) -{ - Entry *en = data; - Evas_Event_Key_Down *ev = event_info; - if ((!en) || (!ev->key) || (!en->cursor)) return; - - if (en->imf_context) - { - Ecore_IMF_Event_Key_Down ecore_ev; - ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); - if (ecore_imf_context_filter_event(en->imf_context, - ECORE_IMF_EVENT_KEY_DOWN, - (Ecore_IMF_Event *)&ecore_ev)) - return; - } - - if (!strcmp(ev->key, "BackSpace")) - { - if (evas_textblock_cursor_char_prev(en->cursor)) - { - evas_textblock_cursor_char_delete(en->cursor); - // notify the cursor information - _imf_cursor_info_set(en); - } - return; - } - else if (!strcmp(ev->key, "Delete") || - (!strcmp(ev->key, "KP_Delete") && !ev->string)) - { - // FILLME - } - else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter"))) - { - // FILLME - } - else - { - if (ev->string) - { - printf("key down string : %s\n", ev->string); - evas_object_textblock_text_markup_prepend(en->cursor, ev->string); - } - } - - // notify the cursor information - _imf_cursor_info_set(en); -} - -static void -_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info) -{ - Entry *en = data; - Evas_Event_Key_Up *ev = event_info; - - if (!en) return; - - if (en->imf_context) - { - Ecore_IMF_Event_Key_Up ecore_ev; - - ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev); - if (ecore_imf_context_filter_event(en->imf_context, - ECORE_IMF_EVENT_KEY_UP, - (Ecore_IMF_Event *)&ecore_ev)) - return; - } -} - -static void -create_input_field(Evas *evas, Entry *en, const char *id, const char *label, bool sensitive, autofill_hint_e autofill_hint, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) -{ - if (!en) return; - - en->have_preedit = EINA_FALSE; - en->preedit_start = NULL; - en->preedit_end = NULL; - - // create the background for text input field - en->rect = evas_object_rectangle_add(evas); - evas_object_color_set(en->rect, 150, 150, 150, 255); // gray color - evas_object_move(en->rect, x, y); - evas_object_resize(en->rect, w, h); - evas_object_show(en->rect); - evas_object_data_set(en->rect, "Entry", en); - - // create text object for displaying text - en->txt_obj = evas_object_textblock_add(evas); - evas_object_color_set(en->txt_obj, 0, 0, 0, 255); - evas_object_pass_events_set(en->txt_obj, EINA_TRUE); - evas_object_move(en->txt_obj, x, y); - evas_object_resize(en->txt_obj, w, h); - evas_object_show(en->txt_obj); - - // set style on textblock - static const char *style_buf = - "DEFAULT='font=Sans font_size=30 color=#000 text_class=entry'" - "newline='br'" - "b='+ font=Sans:style=bold'"; - en->txt_style = evas_textblock_style_new(); - evas_textblock_style_set(en->txt_style, style_buf); - evas_object_textblock_style_set(en->txt_obj, en->txt_style); - - // create cursor - en->cursor = evas_object_textblock_cursor_new(en->txt_obj); - - // create input context - const char *default_id = ecore_imf_context_default_id_get(); - if (!default_id) - { - fprintf(stderr, "Can't create ecore_imf_context\n"); - return; - } - - autofill_item_create(&en->ai_h); - autofill_item_set_autofill_hint(en->ai_h, autofill_hint); - autofill_item_set_id(en->ai_h, id); - autofill_item_set_label(en->ai_h, label); - autofill_item_set_sensitive_data(en->ai_h, sensitive); - - autofill_save_item_create(&en->si_h); - autofill_save_item_set_autofill_hint(en->si_h, autofill_hint); - autofill_save_item_set_id(en->si_h, id); - autofill_save_item_set_label(en->si_h, label); - autofill_save_item_set_sensitive_data(en->si_h, sensitive); - - en->imf_context = ecore_imf_context_add(default_id); - ecore_imf_context_client_canvas_set(en->imf_context, evas); - - // register key event handler - evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, en); - evas_object_event_callback_add(en->rect, EVAS_CALLBACK_KEY_UP, _key_up_cb, en); - - // register mouse event handler - evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, en); - evas_object_event_callback_add(en->rect, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, en); - - // register focus event handler - evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_IN, _entry_focus_in_cb, en); - evas_object_event_callback_add(en->rect, EVAS_CALLBACK_FOCUS_OUT, _entry_focus_out_cb, en); - - // register commit event callback - ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _ecore_imf_event_commit_cb, en); - - // register preedit changed event handler - ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ecore_imf_event_preedit_changed_cb, en); -} - -static void -delete_input_field(Entry *en) -{ - if (!en) return; - - autofill_item_destroy(en->ai_h); - - if (en->rect) - { - evas_object_del(en->rect); - en->rect = NULL; - } - - if (en->cursor) - { - evas_textblock_cursor_free(en->cursor); - en->cursor = NULL; - } - - if (en->preedit_start) - { - evas_textblock_cursor_free(en->preedit_start); - en->preedit_start = NULL; - } - - if (en->preedit_end) - { - evas_textblock_cursor_free(en->preedit_end); - en->preedit_end = NULL; - } - - if (en->txt_obj) - { - evas_object_del(en->txt_obj); - en->txt_obj = NULL; - } - - if (en->txt_style) - { - evas_textblock_style_free(en->txt_style); - en->txt_style = NULL; - } - - if (en->imf_context) - { - ecore_imf_context_del(en->imf_context); - en->imf_context = NULL; - } -} - -static void connection_status_changed_cb(autofill_connection_status_e status, void *user_data) -{ - switch (status) { - case AUTOFILL_CONNECTION_STATUS_CONNECTED: - LOGD("connected"); - break; - case AUTOFILL_CONNECTION_STATUS_DISCONNECTED: - LOGD("disconnected"); - break; - case AUTOFILL_CONNECTION_STATUS_REJECTED: - LOGD("rejected"); - break; - default: - break; - } -} - -static void __back_cb(void *data, Evas_Object *obj, void *event_info) -{ - LOGD(""); - ecore_main_loop_quit(); -} - -EXPORTED int -main(void) -{ - Ecore_Evas *ee; - Evas *evas; - int ret; - - if (!ecore_evas_init()) - { - fprintf(stderr, "failed to call ecore_evas_init()\n"); - return EXIT_FAILURE; - } - - ecore_imf_init(); - - ret = autofill_initialize(); - if (ret == AUTOFILL_ERROR_NONE) - LOGD("Succeeded to initialize"); - else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) - LOGW("permission denied"); - else - LOGW("Failed to initialize. error : %d", ret); - - ret = autofill_connect(connection_status_changed_cb, NULL); - if (ret == AUTOFILL_ERROR_NONE) - LOGD("Succeeded to connect"); - else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) - LOGW("permission denied"); - else - LOGW("Failed to connect. error : %d", ret); - - // create a new window, with size=WIDTHxHEIGHT and default engine - ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); - - if (!ee) - { - fprintf(stderr, "failed to call ecore_evas_new\n"); - return EXIT_FAILURE; - } - - ecore_evas_show(ee); - - // get the canvas off just-created window - evas = ecore_evas_get(ee); - if (!evas) - { - fprintf(stderr, "failed to call ecore_evas_get\n"); - return EXIT_FAILURE; - } - - // create input field rectangle - Evas_Object *bg = evas_object_rectangle_add(evas); - evas_object_move(bg, 0, 0); - evas_object_resize(bg, WIDTH, HEIGHT); - evas_object_color_set(bg, 255, 255, 255, 255); - evas_object_show(bg); - - eext_object_event_callback_add(bg, EEXT_CALLBACK_BACK, __back_cb, NULL); - - // register canvas focus in/out event handler - evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL); - evas_event_callback_add(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _canvas_focus_out_cb, NULL); - - memset(&en1, 0, sizeof(en1)); - memset(&en2, 0, sizeof(en2)); - - // create input field 1 - create_input_field(evas, &en1, "id", "ID", false, AUTOFILL_HINT_ID, 40, 60, 400, 80); - - // create input field 2 - create_input_field(evas, &en2, "password", "Password", true, AUTOFILL_HINT_EMAIL_ADDRESS, 40, 180, 400, 80); - - char *app_id; - app_get_id(&app_id); - - // create autofill view info - autofill_view_info_create(&g_vi_h); - autofill_view_info_set_app_id(g_vi_h, app_id); - autofill_view_info_set_view_id(g_vi_h, "login"); - autofill_view_info_add_item(g_vi_h, en1.ai_h); - autofill_view_info_add_item(g_vi_h, en2.ai_h); - - if (app_id) - free(app_id); - - // give focus to input field 1 - evas_object_focus_set(en1.rect, EINA_TRUE); - - ecore_main_loop_begin(); // begin mainloop - - delete_input_field(&en1); // delete input field 1 - delete_input_field(&en2); // delete input field 2 - - if (g_vi_h) { - autofill_view_info_destroy(g_vi_h); - g_vi_h = NULL; - } - - evas_event_callback_del_full(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL); - evas_event_callback_del_full(evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _canvas_focus_out_cb, NULL); - - ecore_evas_free(ee); - - autofill_deinitialize(); - - ecore_imf_shutdown(); - ecore_evas_shutdown(); - - return 0; -} diff --git a/test/org.tizen.autofill-test.manifest b/test/org.tizen.autofill-test.manifest deleted file mode 100644 index 017d22d..0000000 --- a/test/org.tizen.autofill-test.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/test/org.tizen.autofill-test.png b/test/org.tizen.autofill-test.png deleted file mode 100644 index 9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3@*X{2^C5O$DP8HE&8W8hI-bfv}r zLm?dqClFOubrXh8^{FoLS^1eJ>rn&qMdJs|Uwo2!1ic#Vf?b-djrddQ~P z@y7aJ0~5V)`)m9EIjE6pUO5nCT29W(%d2Uh+WEa1@I+I(nS~L$K_g`J5D3ZoPeU1s z5cx_Y*XlJ=`63J7wzuLQTfTfbkIwQS&96GmQuqE`sGIVCGoVT#LQ@oQnVOTEHf`F% zHdQ=f(Z}d*jOItM8iUb8Z}}A?4*G$d%7-CwdC7^%U_{O~AjjFw?|;~{!}Bd4Aemyn zzb!scrN07Q`iG)_lb}jLQd`!VcPK4UMIq`6?FY>(F@k_}g5RW$5yke+hYkW}9Kd?XEQzUukRQ0^7NMWv|@x zwG+T&6#DSD0;1`&kBdyQ56LC)MX~>1olS!p$pSkJiQ^PTspwbpG9e!D!m!-zBA%$k kZ}gYfNaCF}xV$|1>H6z0+kD - - - Jihoon Kim - autofill-test - - - org.tizen.autofill-test.png - - - http://tizen.org/privilege/appmanager.launch - http://tizen.org/privilege/datasharing - - -- 2.7.4 From 1a69c29be7dee4795d500254b4e69367a1ec7e70 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 19 Oct 2018 19:00:19 +0900 Subject: [PATCH 11/16] Describe return value in doxygen Change-Id: I08cebfda51a777045242659f0828283aee05c161 Signed-off-by: Jihoon Kim --- common/autofill_fill_response.c | 2 +- common/autofill_fill_response_group.c | 2 +- common/autofill_save_view_info.c | 2 +- common/autofill_view_info.c | 2 +- include/autofill.h | 8 +- include/autofill_common.h | 140 +++++++++++++++++++++++++++++----- include/autofill_service.h | 2 + 7 files changed, 128 insertions(+), 30 deletions(-) diff --git a/common/autofill_fill_response.c b/common/autofill_fill_response.c index 058e196..ba2e626 100644 --- a/common/autofill_fill_response.c +++ b/common/autofill_fill_response.c @@ -146,7 +146,7 @@ EXPORT_API int autofill_fill_response_foreach_groups(autofill_fill_response_h h, break; } - return 0; + return AUTOFILL_ERROR_NONE; } EXPORT_API int autofill_fill_response_get_group_count(autofill_fill_response_h h, int *count) diff --git a/common/autofill_fill_response_group.c b/common/autofill_fill_response_group.c index 34e10ec..924494b 100644 --- a/common/autofill_fill_response_group.c +++ b/common/autofill_fill_response_group.c @@ -129,5 +129,5 @@ EXPORT_API int autofill_fill_response_group_foreach_items(autofill_fill_response break; } - return 0; + return AUTOFILL_ERROR_NONE; } diff --git a/common/autofill_save_view_info.c b/common/autofill_save_view_info.c index 6d71d3f..53fb56c 100644 --- a/common/autofill_save_view_info.c +++ b/common/autofill_save_view_info.c @@ -150,5 +150,5 @@ EXPORT_API int autofill_save_view_info_foreach_items(autofill_save_view_info_h h break; } - return 0; + return AUTOFILL_ERROR_NONE; } diff --git a/common/autofill_view_info.c b/common/autofill_view_info.c index 446c0d3..0da1dc7 100644 --- a/common/autofill_view_info.c +++ b/common/autofill_view_info.c @@ -148,5 +148,5 @@ EXPORT_API int autofill_view_info_foreach_items(autofill_view_info_h h, break; } - return 0; + return AUTOFILL_ERROR_NONE; } diff --git a/include/autofill.h b/include/autofill.h index 1c6695c..b202d47 100644 --- a/include/autofill.h +++ b/include/autofill.h @@ -66,12 +66,8 @@ typedef void (*Autofill_Auth_Info_Cb)(autofill_auth_info_h auth_info, void *data * * @privlevel public * - * @privilege %http://tizen.org/privilege/appmanager.launch \n - * %http://tizen.org/privilege/datasharing - * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error - * @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied */ int autofill_initialize(); @@ -100,6 +96,7 @@ int autofill_deinitialize(); * * @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_PERMISSION_DENIED Permission denied */ int autofill_connect(autofill_connection_status_changed_cb callback, void *user_data); @@ -116,7 +113,7 @@ int autofill_connect(autofill_connection_status_changed_cb callback, void *user_ * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error - * @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied + * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized */ int autofill_disconnect(); @@ -144,6 +141,7 @@ int autofill_auth_info_request(autofill_view_info_h vi); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized */ int autofill_auth_info_set_callback(Autofill_Auth_Info_Cb autofill_auth_info_cb, void *data); diff --git a/include/autofill_common.h b/include/autofill_common.h index a8ffd29..c64e4c1 100644 --- a/include/autofill_common.h +++ b/include/autofill_common.h @@ -69,6 +69,8 @@ typedef struct autofill_save_view_info_s *autofill_save_view_info_h; * * @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_item_create(autofill_item_h *it); @@ -81,6 +83,7 @@ int autofill_item_create(autofill_item_h *it); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_destroy(autofill_item_h it); @@ -93,6 +96,7 @@ int autofill_item_destroy(autofill_item_h it); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_clone(autofill_item_h h, autofill_item_h *clone); @@ -105,6 +109,7 @@ int autofill_item_clone(autofill_item_h h, autofill_item_h *clone); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hints); @@ -117,6 +122,7 @@ int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hints); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hints); @@ -129,6 +135,7 @@ int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hints); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_set_id(autofill_item_h it, const char *id); @@ -141,6 +148,7 @@ int autofill_item_set_id(autofill_item_h it, const char *id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_get_id(autofill_item_h it, char **id); @@ -153,6 +161,7 @@ int autofill_item_get_id(autofill_item_h it, char **id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_set_label(autofill_item_h it, const char *label); @@ -165,6 +174,7 @@ int autofill_item_set_label(autofill_item_h it, const char *label); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_get_label(autofill_item_h it, char **label); @@ -177,6 +187,7 @@ int autofill_item_get_label(autofill_item_h it, char **label); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_set_sensitive_data(autofill_item_h it, bool sensitive); @@ -189,6 +200,7 @@ int autofill_item_set_sensitive_data(autofill_item_h it, bool sensitive); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_get_sensitive_data(autofill_item_h it, bool *sensitive); @@ -201,6 +213,7 @@ int autofill_item_get_sensitive_data(autofill_item_h it, bool *sensitive); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_set_value(autofill_item_h it, const char *value); @@ -213,6 +226,7 @@ int autofill_item_set_value(autofill_item_h it, const char *value); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_item_get_value(autofill_item_h it, char **value); @@ -227,6 +241,8 @@ int autofill_item_get_value(autofill_item_h it, char **value); * * @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_auth_info_create(autofill_auth_info_h *vi); @@ -239,6 +255,7 @@ int autofill_auth_info_create(autofill_auth_info_h *vi); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_destroy(autofill_auth_info_h vi); @@ -251,6 +268,7 @@ int autofill_auth_info_destroy(autofill_auth_info_h vi); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_set_app_id(autofill_auth_info_h vi, const char *app_id); @@ -263,6 +281,7 @@ int autofill_auth_info_set_app_id(autofill_auth_info_h vi, const char *app_id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_get_app_id(autofill_auth_info_h vi, char **app_id); @@ -275,6 +294,7 @@ int autofill_auth_info_get_app_id(autofill_auth_info_h vi, char **app_id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_set_view_id(autofill_auth_info_h vi, const char *view_id); @@ -287,6 +307,7 @@ int autofill_auth_info_set_view_id(autofill_auth_info_h vi, const char *view_id) * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_get_view_id(autofill_auth_info_h vi, char **view_id); @@ -299,6 +320,7 @@ int autofill_auth_info_get_view_id(autofill_auth_info_h vi, char **view_id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_set_exist_autofill_data(autofill_auth_info_h vi, bool exist_autofill_data); @@ -311,6 +333,7 @@ int autofill_auth_info_set_exist_autofill_data(autofill_auth_info_h vi, bool exi * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_get_exist_autofill_data(autofill_auth_info_h vi, bool *exist_autofill_data); @@ -323,6 +346,7 @@ int autofill_auth_info_get_exist_autofill_data(autofill_auth_info_h vi, bool *ex * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_set_need_authentication(autofill_auth_info_h vi, bool need_authentication); @@ -335,6 +359,7 @@ int autofill_auth_info_set_need_authentication(autofill_auth_info_h vi, bool nee * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_get_need_authentication(autofill_auth_info_h vi, bool *need_authentication); @@ -347,6 +372,7 @@ int autofill_auth_info_get_need_authentication(autofill_auth_info_h vi, bool *ne * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_set_service_name(autofill_auth_info_h vi, const char *service_name); @@ -359,6 +385,7 @@ int autofill_auth_info_set_service_name(autofill_auth_info_h vi, const char *ser * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_get_service_name(autofill_auth_info_h vi, char **service_name); @@ -371,6 +398,7 @@ int autofill_auth_info_get_service_name(autofill_auth_info_h vi, char **service_ * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_set_service_message(autofill_auth_info_h vi, const char *service_message); @@ -383,6 +411,7 @@ int autofill_auth_info_set_service_message(autofill_auth_info_h vi, const char * * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_get_service_message(autofill_auth_info_h vi, char **service_message); @@ -395,6 +424,7 @@ int autofill_auth_info_get_service_message(autofill_auth_info_h vi, char **servi * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h vi, const char *service_logo_image_path); @@ -407,6 +437,7 @@ int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h vi, cons * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h vi, char **service_logo_image_path); @@ -420,6 +451,8 @@ int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h vi, char * * @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_view_info_create(autofill_view_info_h *vi); @@ -432,6 +465,7 @@ int autofill_view_info_create(autofill_view_info_h *vi); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_view_info_destroy(autofill_view_info_h vi); @@ -444,6 +478,7 @@ int autofill_view_info_destroy(autofill_view_info_h vi); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_view_info_set_app_id(autofill_view_info_h vi, const char *app_id); @@ -456,6 +491,7 @@ int autofill_view_info_set_app_id(autofill_view_info_h vi, const char *app_id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_view_info_get_app_id(const autofill_view_info_h vi, char **app_id); @@ -468,6 +504,7 @@ int autofill_view_info_get_app_id(const autofill_view_info_h vi, char **app_id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_view_info_set_view_id(autofill_view_info_h vi, const char *view_id); @@ -480,6 +517,7 @@ int autofill_view_info_set_view_id(autofill_view_info_h vi, const char *view_id) * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_view_info_get_view_id(autofill_view_info_h vi, char **view_id); @@ -492,9 +530,21 @@ int autofill_view_info_get_view_id(autofill_view_info_h vi, char **view_id); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_view_info_add_item(const autofill_view_info_h vi, autofill_item_h it); +/** + * @brief Retrieve all items in view info + * + * @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_view_info_foreach_items(autofill_view_info_h h, bool (*callback)(autofill_item_h item, void *user_data), void *user_data); // save view info @@ -506,7 +556,9 @@ int autofill_view_info_foreach_items(autofill_view_info_h h, bool (*callback)(au * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #AUTOFILL_ERROR_OUT_OF_MEMORY Out of memory */ int autofill_save_view_info_create(autofill_save_view_info_h *vi); @@ -518,7 +570,8 @@ int autofill_save_view_info_create(autofill_save_view_info_h *vi); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_view_info_destroy(autofill_save_view_info_h vi); @@ -530,7 +583,8 @@ int autofill_save_view_info_destroy(autofill_save_view_info_h vi); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_view_info_set_app_id(autofill_save_view_info_h vi, const char *app_id); @@ -542,7 +596,8 @@ int autofill_save_view_info_set_app_id(autofill_save_view_info_h vi, const char * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_view_info_get_app_id(const autofill_save_view_info_h vi, char **app_id); @@ -554,7 +609,8 @@ int autofill_save_view_info_get_app_id(const autofill_save_view_info_h vi, char * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, const char *view_id); @@ -566,7 +622,8 @@ int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, const char * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, char **view_id); @@ -578,10 +635,22 @@ int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, char **vie * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_view_info_add_item(const autofill_save_view_info_h vi, autofill_save_item_h it); +/** + * @brief Retrieve all items in save view info + * + * @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_save_view_info_foreach_items(autofill_save_view_info_h h, bool (*callback)(autofill_save_item_h item, void *user_data), void *user_data); // fill response @@ -594,6 +663,7 @@ int autofill_save_view_info_foreach_items(autofill_save_view_info_h h, bool (*ca * * @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_create(autofill_fill_response_h *h); @@ -606,6 +676,7 @@ int autofill_fill_response_create(autofill_fill_response_h *h); * * @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_destroy(autofill_fill_response_h h); @@ -618,6 +689,7 @@ int autofill_fill_response_destroy(autofill_fill_response_h h); * * @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_set_app_id(autofill_fill_response_h h, const char *app_id); @@ -630,6 +702,7 @@ int autofill_fill_response_set_app_id(autofill_fill_response_h h, const char *ap * * @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_app_id(autofill_fill_response_h h, char **app_id); @@ -642,6 +715,7 @@ int autofill_fill_response_get_app_id(autofill_fill_response_h h, char **app_id) * * @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_set_view_id(autofill_fill_response_h h, const char *view_id); @@ -654,6 +728,7 @@ int autofill_fill_response_set_view_id(autofill_fill_response_h h, const char *v * * @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_view_id(autofill_fill_response_h h, char **view_id); @@ -758,8 +833,8 @@ int autofill_fill_response_group_add_item(autofill_fill_response_group_h h, auto * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ 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); @@ -773,6 +848,8 @@ int autofill_fill_response_group_foreach_items(autofill_fill_response_group_h h, * * @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_item_create(autofill_fill_response_item_h *it); @@ -785,6 +862,7 @@ int autofill_fill_response_item_create(autofill_fill_response_item_h *it); * * @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_item_destroy(autofill_fill_response_item_h it); @@ -797,6 +875,7 @@ int autofill_fill_response_item_destroy(autofill_fill_response_item_h it); * * @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_item_clone(autofill_fill_response_item_h h, autofill_fill_response_item_h *clone); @@ -809,6 +888,7 @@ int autofill_fill_response_item_clone(autofill_fill_response_item_h h, autofill_ * * @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_item_set_id(autofill_fill_response_item_h it, const char *id); @@ -821,6 +901,7 @@ int autofill_fill_response_item_set_id(autofill_fill_response_item_h it, const c * * @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_item_get_id(autofill_fill_response_item_h it, char **id); @@ -833,6 +914,7 @@ int autofill_fill_response_item_get_id(autofill_fill_response_item_h it, char ** * * @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_item_set_value(autofill_fill_response_item_h it, const char *value); @@ -845,6 +927,7 @@ int autofill_fill_response_item_set_value(autofill_fill_response_item_h it, cons * * @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_item_get_value(autofill_fill_response_item_h it, char **value); @@ -857,6 +940,7 @@ int autofill_fill_response_item_get_value(autofill_fill_response_item_h it, char * * @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_item_set_presentation_text(autofill_fill_response_item_h it, const char *presentation_text); @@ -869,6 +953,7 @@ int autofill_fill_response_item_set_presentation_text(autofill_fill_response_ite * * @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_item_get_presentation_text(autofill_fill_response_item_h it, char ** presentation_text); @@ -881,7 +966,8 @@ int autofill_fill_response_item_get_presentation_text(autofill_fill_response_ite * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_create(autofill_save_item_h *it); @@ -893,7 +979,8 @@ int autofill_save_item_create(autofill_save_item_h *it); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_destroy(autofill_save_item_h it); @@ -905,7 +992,8 @@ int autofill_save_item_destroy(autofill_save_item_h it); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_clone(autofill_save_item_h h, autofill_save_item_h *clone); @@ -917,7 +1005,8 @@ int autofill_save_item_clone(autofill_save_item_h h, autofill_save_item_h *clone * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_set_autofill_hint(autofill_save_item_h it, autofill_hint_e hint); @@ -929,7 +1018,8 @@ int autofill_save_item_set_autofill_hint(autofill_save_item_h it, autofill_hint_ * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_get_autofill_hint(autofill_save_item_h it, autofill_hint_e *hint); @@ -941,7 +1031,8 @@ int autofill_save_item_get_autofill_hint(autofill_save_item_h it, autofill_hint_ * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_set_id(autofill_save_item_h it, const char *id); @@ -953,7 +1044,8 @@ int autofill_save_item_set_id(autofill_save_item_h it, const char *id); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_get_id(autofill_save_item_h it, char **id); @@ -965,7 +1057,8 @@ int autofill_save_item_get_id(autofill_save_item_h it, char **id); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_set_label(autofill_save_item_h it, const char *label); @@ -977,7 +1070,8 @@ int autofill_save_item_set_label(autofill_save_item_h it, const char *label); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_get_label(autofill_save_item_h it, char **label); @@ -989,7 +1083,8 @@ int autofill_save_item_get_label(autofill_save_item_h it, char **label); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_set_sensitive_data(autofill_save_item_h it, bool sensitive); @@ -1001,7 +1096,8 @@ int autofill_save_item_set_sensitive_data(autofill_save_item_h it, bool sensitiv * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_get_sensitive_data(autofill_save_item_h it, bool *sensitive); @@ -1013,7 +1109,8 @@ int autofill_save_item_get_sensitive_data(autofill_save_item_h it, bool *sensiti * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_set_value(autofill_save_item_h it, const char *value); @@ -1025,7 +1122,8 @@ int autofill_save_item_set_value(autofill_save_item_h it, const char *value); * @privlevel public * * @return 0 on success, otherwise a negative error value - * @retval #IME_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_save_item_get_value(autofill_save_item_h it, char **value); diff --git a/include/autofill_service.h b/include/autofill_service.h index 2a3910f..e5b4979 100644 --- a/include/autofill_service.h +++ b/include/autofill_service.h @@ -100,6 +100,7 @@ int autofill_service_set_auth_info_request_cb(autofill_service_auth_info_request * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_service_send_auth_info(autofill_auth_info_h h); @@ -125,6 +126,7 @@ int autofill_service_set_fill_request_cb(autofill_service_fill_request_cb callba * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ int autofill_service_send_fill_response(autofill_fill_response_h h); -- 2.7.4 From ec14362da5a69985af2f36aeb8d15d6dee4bb90b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 19 Oct 2018 19:45:46 +0900 Subject: [PATCH 12/16] Describe API documentation Change-Id: I68785bfa4bc088ebed415ebb393e4cf3a4dbdd3f Signed-off-by: Jihoon Kim --- common/autofill_auth_info.c | 136 ++++++++++++------------ common/autofill_fill_response_item.c | 22 ++-- common/autofill_item.c | 10 +- common/autofill_save_item.c | 26 ++--- common/autofill_save_view_info.c | 6 +- common/autofill_view_info.c | 6 +- include/autofill.h | 1 - include/autofill_common.h | 193 +++++++++++++++++++++++++++++++---- include/autofill_service.h | 8 ++ 9 files changed, 283 insertions(+), 125 deletions(-) mode change 100644 => 100755 common/autofill_fill_response_item.c mode change 100644 => 100755 common/autofill_save_item.c mode change 100644 => 100755 common/autofill_save_view_info.c mode change 100644 => 100755 common/autofill_view_info.c mode change 100644 => 100755 include/autofill_common.h mode change 100644 => 100755 include/autofill_service.h diff --git a/common/autofill_auth_info.c b/common/autofill_auth_info.c index 74cf38a..80ae5eb 100644 --- a/common/autofill_auth_info.c +++ b/common/autofill_auth_info.c @@ -39,199 +39,199 @@ struct autofill_auth_info_s { char *service_message; // 표기 메시지 (ex> samsung pass로 로그인) }; -EXPORT_API int autofill_auth_info_create(autofill_auth_info_h *vi) +EXPORT_API int autofill_auth_info_create(autofill_auth_info_h *ai) { - if (!vi) + if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; struct autofill_auth_info_s *vs = (autofill_auth_info_h)calloc(1, sizeof(struct autofill_auth_info_s)); if (!vs) return AUTOFILL_ERROR_OUT_OF_MEMORY; - *vi = (autofill_auth_info_h)vs; + *ai = (autofill_auth_info_h)vs; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_destroy(autofill_auth_info_h vi) +EXPORT_API int autofill_auth_info_destroy(autofill_auth_info_h ai) { - if (!vi) + if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->app_id) - free(vi->app_id); + if (ai->app_id) + free(ai->app_id); - if (vi->service_name) - free(vi->service_name); + if (ai->service_name) + free(ai->service_name); - if (vi->service_message) - free(vi->service_message); + if (ai->service_message) + free(ai->service_message); - if (vi->service_logo_image_path) - free(vi->service_logo_image_path); + if (ai->service_logo_image_path) + free(ai->service_logo_image_path); - free(vi); + free(ai); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_exist_autofill_data(autofill_auth_info_h vi, bool exist_autofill_data) +EXPORT_API int autofill_auth_info_set_exist_autofill_data(autofill_auth_info_h ai, bool exist_autofill_data) { - if (!vi) + if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; - vi->exist_autofill_data = exist_autofill_data; + ai->exist_autofill_data = exist_autofill_data; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_get_exist_autofill_data(autofill_auth_info_h vi, bool *exist_autofill_data) +EXPORT_API int autofill_auth_info_get_exist_autofill_data(autofill_auth_info_h ai, bool *exist_autofill_data) { - if (!vi || !exist_autofill_data) + if (!ai || !exist_autofill_data) return AUTOFILL_ERROR_INVALID_PARAMETER; - *exist_autofill_data = vi->exist_autofill_data; + *exist_autofill_data = ai->exist_autofill_data; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_need_authentication(autofill_auth_info_h vi, bool need_authentication) +EXPORT_API int autofill_auth_info_set_need_authentication(autofill_auth_info_h ai, bool need_authentication) { - if (!vi) + if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; - vi->need_authentication = need_authentication; + ai->need_authentication = need_authentication; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_get_need_authentication(autofill_auth_info_h vi, bool *need_authentication) +EXPORT_API int autofill_auth_info_get_need_authentication(autofill_auth_info_h ai, bool *need_authentication) { - if (!vi || !need_authentication) + if (!ai || !need_authentication) return AUTOFILL_ERROR_INVALID_PARAMETER; - *need_authentication = vi->need_authentication; + *need_authentication = ai->need_authentication; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_service_name(autofill_auth_info_h vi, const char *service_name) +EXPORT_API int autofill_auth_info_set_service_name(autofill_auth_info_h ai, const char *service_name) { - if (!vi || !service_name) + if (!ai || !service_name) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->service_name) - free(vi->service_name); + if (ai->service_name) + free(ai->service_name); - vi->service_name = strdup(service_name); + ai->service_name = strdup(service_name); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_get_service_name(autofill_auth_info_h vi, char **service_name) +EXPORT_API int autofill_auth_info_get_service_name(autofill_auth_info_h ai, char **service_name) { - if (!vi || !service_name) + if (!ai || !service_name) return AUTOFILL_ERROR_INVALID_PARAMETER; - *service_name = strdup(vi->service_name); + *service_name = strdup(ai->service_name); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_service_message(autofill_auth_info_h vi, const char *service_message) +EXPORT_API int autofill_auth_info_set_service_message(autofill_auth_info_h ai, const char *service_message) { - if (!vi || !service_message) + if (!ai || !service_message) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->service_message) - free(vi->service_message); + if (ai->service_message) + free(ai->service_message); - vi->service_message = strdup(service_message); + ai->service_message = strdup(service_message); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_get_service_message(autofill_auth_info_h vi, char **service_message) +EXPORT_API int autofill_auth_info_get_service_message(autofill_auth_info_h ai, char **service_message) { - if (!vi || !service_message) + if (!ai || !service_message) return AUTOFILL_ERROR_INVALID_PARAMETER; - *service_message = strdup(vi->service_message); + *service_message = strdup(ai->service_message); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h vi, const char *service_logo_image_path) +EXPORT_API int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h ai, const char *service_logo_image_path) { - if (!vi || !service_logo_image_path) + if (!ai || !service_logo_image_path) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->service_logo_image_path) - free(vi->service_logo_image_path); + if (ai->service_logo_image_path) + free(ai->service_logo_image_path); - vi->service_logo_image_path = strdup(service_logo_image_path); + ai->service_logo_image_path = strdup(service_logo_image_path); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h vi, char **service_logo_image_path) +EXPORT_API int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h ai, char **service_logo_image_path) { - if (!vi || !service_logo_image_path) + if (!ai || !service_logo_image_path) return AUTOFILL_ERROR_INVALID_PARAMETER; - *service_logo_image_path = strdup(vi->service_logo_image_path); + *service_logo_image_path = strdup(ai->service_logo_image_path); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_app_id(autofill_auth_info_h vi, const char *app_id) +EXPORT_API int autofill_auth_info_set_app_id(autofill_auth_info_h ai, const char *app_id) { - if (!vi || !app_id) + if (!ai || !app_id) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->app_id) - free(vi->app_id); + if (ai->app_id) + free(ai->app_id); - vi->app_id = strdup(app_id); + ai->app_id = strdup(app_id); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_get_app_id(autofill_auth_info_h vi, char **app_id) +EXPORT_API int autofill_auth_info_get_app_id(autofill_auth_info_h ai, char **app_id) { - if (!vi) + if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (!vi->app_id) + if (!ai->app_id) return AUTOFILL_ERROR_OPERATION_FAILED; - *app_id = strdup(vi->app_id); + *app_id = strdup(ai->app_id); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_view_id(autofill_auth_info_h vi, const char *view_id) +EXPORT_API int autofill_auth_info_set_view_id(autofill_auth_info_h ai, const char *view_id) { - if (!vi || !view_id) + if (!ai || !view_id) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->view_id) - free(vi->view_id); + if (ai->view_id) + free(ai->view_id); - vi->view_id = strdup(view_id); + ai->view_id = strdup(view_id); return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_get_view_id(autofill_auth_info_h vi, char **view_id) +EXPORT_API int autofill_auth_info_get_view_id(autofill_auth_info_h ai, char **view_id) { - if (!vi) + if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (!vi->view_id) + if (!ai->view_id) return AUTOFILL_ERROR_OPERATION_FAILED; - *view_id = strdup(vi->view_id); + *view_id = strdup(ai->view_id); return AUTOFILL_ERROR_NONE; } diff --git a/common/autofill_fill_response_item.c b/common/autofill_fill_response_item.c old mode 100644 new mode 100755 index 93ace5d..604717a --- a/common/autofill_fill_response_item.c +++ b/common/autofill_fill_response_item.c @@ -66,11 +66,11 @@ EXPORT_API int autofill_fill_response_item_destroy(autofill_fill_response_item_h return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_fill_response_item_clone(autofill_fill_response_item_h h, autofill_fill_response_item_h *clone) +EXPORT_API int autofill_fill_response_item_clone(autofill_fill_response_item_h it, autofill_fill_response_item_h *clone) { autofill_fill_response_item_h handle; - if (!h || !clone) { + if (!it || !clone) { LOGW("Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } @@ -81,28 +81,28 @@ EXPORT_API int autofill_fill_response_item_clone(autofill_fill_response_item_h h return AUTOFILL_ERROR_OPERATION_FAILED; } - if (h->id) { - handle->id = strdup(h->id); + if (it->id) { + handle->id = strdup(it->id); if (!handle->id) { - LOGW("Failed to duplicate h->id"); + LOGW("Failed to duplicate it->id"); autofill_fill_response_item_destroy(handle); return AUTOFILL_ERROR_OUT_OF_MEMORY; } } - if (h->presentation_text) { - handle->presentation_text = strdup(h->presentation_text); + if (it->presentation_text) { + handle->presentation_text = strdup(it->presentation_text); if (!handle->presentation_text) { - LOGW("Failed to duplicate h->presentation_text"); + LOGW("Failed to duplicate it->presentation_text"); autofill_fill_response_item_destroy(handle); return AUTOFILL_ERROR_OUT_OF_MEMORY; } } - if (h->value) { - handle->value = strdup(h->value); + if (it->value) { + handle->value = strdup(it->value); if (!handle->value) { - LOGW("Failed to duplicate h->value"); + LOGW("Failed to duplicate it->value"); autofill_fill_response_item_destroy(handle); return AUTOFILL_ERROR_OUT_OF_MEMORY; } diff --git a/common/autofill_item.c b/common/autofill_item.c index f271d6d..e43c3ae 100644 --- a/common/autofill_item.c +++ b/common/autofill_item.c @@ -121,22 +121,22 @@ EXPORT_API int autofill_item_clone(autofill_item_h h, autofill_item_h *clone) return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hints) +EXPORT_API int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hint) { if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; - it->autofill_hint = hints; + it->autofill_hint = hint; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hints) +EXPORT_API int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hint) { - if (!it || !hints) + if (!it || !hint) return AUTOFILL_ERROR_INVALID_PARAMETER; - *hints = it->autofill_hint; + *hint = it->autofill_hint; return AUTOFILL_ERROR_NONE; } diff --git a/common/autofill_save_item.c b/common/autofill_save_item.c old mode 100644 new mode 100755 index 46b8e14..381421a --- a/common/autofill_save_item.c +++ b/common/autofill_save_item.c @@ -70,11 +70,11 @@ EXPORT_API int autofill_save_item_destroy(autofill_save_item_h it) return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_save_item_clone(autofill_save_item_h h, autofill_save_item_h *clone) +EXPORT_API int autofill_save_item_clone(autofill_save_item_h it, autofill_save_item_h *clone) { autofill_save_item_h handle; - if (!h || !clone) { + if (!it || !clone) { LOGW("Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } @@ -85,35 +85,35 @@ EXPORT_API int autofill_save_item_clone(autofill_save_item_h h, autofill_save_it return AUTOFILL_ERROR_OPERATION_FAILED; } - if (h->id) { - handle->id = strdup(h->id); + if (it->id) { + handle->id = strdup(it->id); if (!handle->id) { - LOGW("Failed to duplicate h->id"); + LOGW("Failed to duplicate it->id"); autofill_save_item_destroy(handle); return AUTOFILL_ERROR_OUT_OF_MEMORY; } } - if (h->label) { - handle->label = strdup(h->label); + if (it->label) { + handle->label = strdup(it->label); if (!handle->label) { - LOGW("Failed to duplicate h->label"); + LOGW("Failed to duplicate it->label"); autofill_save_item_destroy(handle); return AUTOFILL_ERROR_OUT_OF_MEMORY; } } - if (h->value) { - handle->value = strdup(h->value); + if (it->value) { + handle->value = strdup(it->value); if (!handle->value) { - LOGW("Failed to duplicate h->value"); + LOGW("Failed to duplicate it->value"); autofill_save_item_destroy(handle); return AUTOFILL_ERROR_OUT_OF_MEMORY; } } - handle->autofill_hint = h->autofill_hint; - handle->is_sensitive_data = h->is_sensitive_data; + handle->autofill_hint = it->autofill_hint; + handle->is_sensitive_data = it->is_sensitive_data; *clone = handle; diff --git a/common/autofill_save_view_info.c b/common/autofill_save_view_info.c old mode 100644 new mode 100755 index 53fb56c..4be0ff9 --- a/common/autofill_save_view_info.c +++ b/common/autofill_save_view_info.c @@ -134,16 +134,16 @@ EXPORT_API int autofill_save_view_info_add_item(const autofill_save_view_info_h return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_save_view_info_foreach_items(autofill_save_view_info_h h, +EXPORT_API int autofill_save_view_info_foreach_items(autofill_save_view_info_h vi, bool (*callback)(autofill_save_item_h item, void *user_data), void *user_data) { - if (!h || !callback) { + if (!vi || !callback) { return AUTOFILL_ERROR_INVALID_PARAMETER; } Eina_List *l; autofill_save_item_h it; - EINA_LIST_FOREACH(h->autofill_save_item_list, l, it) + EINA_LIST_FOREACH(vi->autofill_save_item_list, l, it) { bool ret = callback(it, user_data); if (!ret) diff --git a/common/autofill_view_info.c b/common/autofill_view_info.c old mode 100644 new mode 100755 index 0da1dc7..cbb1e55 --- a/common/autofill_view_info.c +++ b/common/autofill_view_info.c @@ -132,16 +132,16 @@ EXPORT_API int autofill_view_info_add_item(const autofill_view_info_h vi, autofi return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_view_info_foreach_items(autofill_view_info_h h, +EXPORT_API int autofill_view_info_foreach_items(autofill_view_info_h vi, bool (*callback)(autofill_item_h item, void *user_data), void *user_data) { - if (!h || !callback) { + if (!vi || !callback) { return AUTOFILL_ERROR_INVALID_PARAMETER; } Eina_List *l; autofill_item_h it; - EINA_LIST_FOREACH(h->autofill_item_list, l, it) + EINA_LIST_FOREACH(vi->autofill_item_list, l, it) { bool ret = callback(it, user_data); if (!ret) diff --git a/include/autofill.h b/include/autofill.h index b202d47..3b4647c 100644 --- a/include/autofill.h +++ b/include/autofill.h @@ -141,7 +141,6 @@ int autofill_auth_info_request(autofill_view_info_h vi); * * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error - * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized */ int autofill_auth_info_set_callback(Autofill_Auth_Info_Cb autofill_auth_info_cb, void *data); diff --git a/include/autofill_common.h b/include/autofill_common.h old mode 100644 new mode 100755 index c64e4c1..77b9f2c --- a/include/autofill_common.h +++ b/include/autofill_common.h @@ -67,6 +67,7 @@ typedef struct autofill_save_view_info_s *autofill_save_view_info_h; * * @privlevel public * + * @param[out] it The autofill item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -81,6 +82,7 @@ int autofill_item_create(autofill_item_h *it); * * @privlevel public * + * @param[in] it The autofill item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -94,6 +96,8 @@ int autofill_item_destroy(autofill_item_h it); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[out] clone The autofill item handle to be cloned * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -107,11 +111,13 @@ int autofill_item_clone(autofill_item_h h, autofill_item_h *clone); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[in] hint The autofill hint * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hints); +int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hint); /** * @brief Get autofill hint @@ -120,11 +126,13 @@ int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hints); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[out] hint The autofill hint * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hints); +int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hint); /** * @brief Set autofill ID @@ -133,6 +141,8 @@ int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hints); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[in] id The autofill ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -146,6 +156,8 @@ int autofill_item_set_id(autofill_item_h it, const char *id); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[out] id The autofill ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -159,6 +171,8 @@ int autofill_item_get_id(autofill_item_h it, char **id); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[in] label The autofill label * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -172,6 +186,8 @@ int autofill_item_set_label(autofill_item_h it, const char *label); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[out] label The autofill label * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -185,6 +201,8 @@ int autofill_item_get_label(autofill_item_h it, char **label); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[in] sensitive The sensitive data or not * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -198,6 +216,8 @@ int autofill_item_set_sensitive_data(autofill_item_h it, bool sensitive); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[out] sensitive The sensitive data or not * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -211,6 +231,8 @@ int autofill_item_get_sensitive_data(autofill_item_h it, bool *sensitive); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[in] value The autofill value * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -224,6 +246,8 @@ int autofill_item_set_value(autofill_item_h it, const char *value); * * @privlevel public * + * @param[in] it The autofill item handle + * @param[out] value The autofill value * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -239,12 +263,13 @@ int autofill_item_get_value(autofill_item_h it, char **value); * * @privlevel public * + * @param[out] ai The autofill authentication information handle * @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_auth_info_create(autofill_auth_info_h *vi); +int autofill_auth_info_create(autofill_auth_info_h *ai); /** * @brief Destroy autofill view info @@ -253,11 +278,12 @@ int autofill_auth_info_create(autofill_auth_info_h *vi); * * @privlevel public * + * @param[in] ai The autofill authentication information handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_destroy(autofill_auth_info_h vi); +int autofill_auth_info_destroy(autofill_auth_info_h ai); /** * @brief Set app id @@ -266,11 +292,13 @@ int autofill_auth_info_destroy(autofill_auth_info_h vi); * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_set_app_id(autofill_auth_info_h vi, const char *app_id); +int autofill_auth_info_set_app_id(autofill_auth_info_h ai, const char *app_id); /** * @brief Get app id @@ -279,11 +307,13 @@ int autofill_auth_info_set_app_id(autofill_auth_info_h vi, const char *app_id); * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[out] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_get_app_id(autofill_auth_info_h vi, char **app_id); +int autofill_auth_info_get_app_id(autofill_auth_info_h ai, char **app_id); /** * @brief Set view id @@ -292,11 +322,13 @@ int autofill_auth_info_get_app_id(autofill_auth_info_h vi, char **app_id); * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] view_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_set_view_id(autofill_auth_info_h vi, const char *view_id); +int autofill_auth_info_set_view_id(autofill_auth_info_h ai, const char *view_id); /** * @brief Get view id @@ -305,11 +337,13 @@ int autofill_auth_info_set_view_id(autofill_auth_info_h vi, const char *view_id) * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] view_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_get_view_id(autofill_auth_info_h vi, char **view_id); +int autofill_auth_info_get_view_id(autofill_auth_info_h ai, char **view_id); /** * @brief Set exist autofill data @@ -318,11 +352,13 @@ int autofill_auth_info_get_view_id(autofill_auth_info_h vi, char **view_id); * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] exist_autofill_data The autofill data existence * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_set_exist_autofill_data(autofill_auth_info_h vi, bool exist_autofill_data); +int autofill_auth_info_set_exist_autofill_data(autofill_auth_info_h ai, bool exist_autofill_data); /** * @brief Get exist autofill data @@ -331,11 +367,13 @@ int autofill_auth_info_set_exist_autofill_data(autofill_auth_info_h vi, bool exi * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[out] exist_autofill_data The autofill data existence * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_get_exist_autofill_data(autofill_auth_info_h vi, bool *exist_autofill_data); +int autofill_auth_info_get_exist_autofill_data(autofill_auth_info_h ai, bool *exist_autofill_data); /** * @brief Set need authentication @@ -344,11 +382,13 @@ int autofill_auth_info_get_exist_autofill_data(autofill_auth_info_h vi, bool *ex * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] need_authentication The authentication need * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_set_need_authentication(autofill_auth_info_h vi, bool need_authentication); +int autofill_auth_info_set_need_authentication(autofill_auth_info_h ai, bool need_authentication); /** * @brief Get need authentication @@ -357,11 +397,13 @@ int autofill_auth_info_set_need_authentication(autofill_auth_info_h vi, bool nee * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[out] need_authentication The authentication need * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_get_need_authentication(autofill_auth_info_h vi, bool *need_authentication); +int autofill_auth_info_get_need_authentication(autofill_auth_info_h ai, bool *need_authentication); /** * @brief Set service name @@ -370,11 +412,13 @@ int autofill_auth_info_get_need_authentication(autofill_auth_info_h vi, bool *ne * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] service_name The autofill service name * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_set_service_name(autofill_auth_info_h vi, const char *service_name); +int autofill_auth_info_set_service_name(autofill_auth_info_h ai, const char *service_name); /** * @brief Get service name @@ -383,11 +427,13 @@ int autofill_auth_info_set_service_name(autofill_auth_info_h vi, const char *ser * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[out] service_name The autofill service name * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_get_service_name(autofill_auth_info_h vi, char **service_name); +int autofill_auth_info_get_service_name(autofill_auth_info_h ai, char **service_name); /** * @brief Set service message @@ -396,11 +442,13 @@ int autofill_auth_info_get_service_name(autofill_auth_info_h vi, char **service_ * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] service_name The autofill service message * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_set_service_message(autofill_auth_info_h vi, const char *service_message); +int autofill_auth_info_set_service_message(autofill_auth_info_h ai, const char *service_message); /** * @brief Get service message @@ -409,11 +457,13 @@ int autofill_auth_info_set_service_message(autofill_auth_info_h vi, const char * * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[out] service_name The autofill service message * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_get_service_message(autofill_auth_info_h vi, char **service_message); +int autofill_auth_info_get_service_message(autofill_auth_info_h ai, char **service_message); /** * @brief Set service logo image path @@ -422,11 +472,13 @@ int autofill_auth_info_get_service_message(autofill_auth_info_h vi, char **servi * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[in] service_logo_image_path The autofill service logo image path * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h vi, const char *service_logo_image_path); +int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h ai, const char *service_logo_image_path); /** * @brief Get service logo image path @@ -435,11 +487,13 @@ int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h vi, cons * * @privlevel public * + * @param[in] ai The autofill authentication information handle + * @param[out] service_logo_image_path The autofill service logo image path * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h vi, char **service_logo_image_path); +int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h ai, char **service_logo_image_path); // view info /** @@ -449,6 +503,7 @@ int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h vi, char * * @privlevel public * + * @param[out] vi The autofill view info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -463,6 +518,8 @@ int autofill_view_info_create(autofill_view_info_h *vi); * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -476,6 +533,8 @@ int autofill_view_info_destroy(autofill_view_info_h vi); * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -489,6 +548,8 @@ int autofill_view_info_set_app_id(autofill_view_info_h vi, const char *app_id); * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[out] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -502,6 +563,8 @@ int autofill_view_info_get_app_id(const autofill_view_info_h vi, char **app_id); * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] view_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -515,6 +578,8 @@ int autofill_view_info_set_view_id(autofill_view_info_h vi, const char *view_id) * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[out] view_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -528,6 +593,8 @@ int autofill_view_info_get_view_id(autofill_view_info_h vi, char **view_id); * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] it The autofill item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -541,11 +608,14 @@ int autofill_view_info_add_item(const autofill_view_info_h vi, autofill_item_h i * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_view_info_foreach_items(autofill_view_info_h h, bool (*callback)(autofill_item_h item, void *user_data), void *user_data); +int autofill_view_info_foreach_items(autofill_view_info_h vi, bool (*callback)(autofill_item_h item, void *user_data), void *user_data); // save view info /** @@ -555,6 +625,7 @@ int autofill_view_info_foreach_items(autofill_view_info_h h, bool (*callback)(au * * @privlevel public * + * @param[out] vi The autofill view info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -569,6 +640,7 @@ int autofill_save_view_info_create(autofill_save_view_info_h *vi); * * @privlevel public * + * @param[in] vi The autofill view info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -582,6 +654,8 @@ int autofill_save_view_info_destroy(autofill_save_view_info_h vi); * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -595,6 +669,8 @@ int autofill_save_view_info_set_app_id(autofill_save_view_info_h vi, const char * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[out] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -608,6 +684,8 @@ int autofill_save_view_info_get_app_id(const autofill_save_view_info_h vi, char * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] view_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -621,6 +699,8 @@ int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, const char * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[out] app_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -634,6 +714,8 @@ int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, char **vie * * @privlevel public * + * @param[in] vi The autofill save view info handle + * @param[in] it The autofill save item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -647,11 +729,14 @@ int autofill_save_view_info_add_item(const autofill_save_view_info_h vi, autofil * * @privlevel public * + * @param[in] vi The autofill view info handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_save_view_info_foreach_items(autofill_save_view_info_h h, bool (*callback)(autofill_save_item_h item, void *user_data), void *user_data); +int autofill_save_view_info_foreach_items(autofill_save_view_info_h vi, bool (*callback)(autofill_save_item_h item, void *user_data), void *user_data); // fill response /** @@ -661,6 +746,7 @@ int autofill_save_view_info_foreach_items(autofill_save_view_info_h h, bool (*ca * * @privlevel public * + * @param[out] h The autofill fill response handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -674,6 +760,7 @@ int autofill_fill_response_create(autofill_fill_response_h *h); * * @privlevel public * + * @param[in] h The autofill fill response handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -687,6 +774,8 @@ int autofill_fill_response_destroy(autofill_fill_response_h h); * * @privlevel public * + * @param[in] h The autofill fill response handle + * @param[in] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -700,6 +789,8 @@ int autofill_fill_response_set_app_id(autofill_fill_response_h h, const char *ap * * @privlevel public * + * @param[in] h The autofill fill response handle + * @param[out] app_id The app ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -713,6 +804,8 @@ int autofill_fill_response_get_app_id(autofill_fill_response_h h, char **app_id) * * @privlevel public * + * @param[in] h The autofill fill response handle + * @param[in] view_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -726,6 +819,8 @@ int autofill_fill_response_set_view_id(autofill_fill_response_h h, const char *v * * @privlevel public * + * @param[in] h The autofill fill response handle + * @param[out] view_id The view ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -739,6 +834,8 @@ int autofill_fill_response_get_view_id(autofill_fill_response_h h, char **view_i * * @privlevel public * + * @param[in] h The autofill fill response handle + * @param[in] it The autofill fill response group handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -752,6 +849,9 @@ int autofill_fill_response_add_group(autofill_fill_response_h h, autofill_fill_r * * @privlevel public * + * @param[in] h The autofill fill response handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -765,6 +865,8 @@ int autofill_fill_response_foreach_groups(autofill_fill_response_h h, bool (*cal * * @privlevel public * + * @param[in] h The autofill fill response handle + * @param[out] count The number of group * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -778,6 +880,7 @@ int autofill_fill_response_get_group_count(autofill_fill_response_h h, int *coun * * @privlevel public * + * @param[out] h The autofill fill response group handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -792,6 +895,7 @@ int autofill_fill_response_group_create(autofill_fill_response_group_h *h); * * @privlevel public * + * @param[in] h The autofill fill response group handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -805,6 +909,8 @@ int autofill_fill_response_group_destroy(autofill_fill_response_group_h h); * * @privlevel public * + * @param[in] h The autofill fill response group handle + * @param[in] clone The autofill fill response group handle to be cloned * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -818,6 +924,8 @@ int autofill_fill_response_group_clone(autofill_fill_response_group_h h, autofil * * @privlevel public * + * @param[in] h The autofill fill response group handle + * @param[in] it The autofill fill response item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -832,6 +940,9 @@ int autofill_fill_response_group_add_item(autofill_fill_response_group_h h, auto * * @privlevel public * + * @param[in] h The autofill fill response group handle + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -846,6 +957,7 @@ int autofill_fill_response_group_foreach_items(autofill_fill_response_group_h h, * * @privlevel public * + * @param[out] it The autofill fill response item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -860,6 +972,7 @@ int autofill_fill_response_item_create(autofill_fill_response_item_h *it); * * @privlevel public * + * @param[in] it The autofill fill response item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -873,11 +986,13 @@ int autofill_fill_response_item_destroy(autofill_fill_response_item_h it); * * @privlevel public * + * @param[in] it The autofill fill response item handle + * @param[in] clone The autofill fill response item handle to be cloned * @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_item_clone(autofill_fill_response_item_h h, autofill_fill_response_item_h *clone); +int autofill_fill_response_item_clone(autofill_fill_response_item_h it, autofill_fill_response_item_h *clone); /** * @brief Set autofill ID @@ -886,6 +1001,8 @@ int autofill_fill_response_item_clone(autofill_fill_response_item_h h, autofill_ * * @privlevel public * + * @param[in] it The autofill fill response item handle + * @param[in] id The autofill fill response item ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -899,6 +1016,8 @@ int autofill_fill_response_item_set_id(autofill_fill_response_item_h it, const c * * @privlevel public * + * @param[in] it The autofill fill response item handle + * @param[out] id The autofill fill response item ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -912,6 +1031,8 @@ int autofill_fill_response_item_get_id(autofill_fill_response_item_h it, char ** * * @privlevel public * + * @param[in] it The autofill fill response item handle + * @param[in] value The autofill fill response item value * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -925,6 +1046,8 @@ int autofill_fill_response_item_set_value(autofill_fill_response_item_h it, cons * * @privlevel public * + * @param[in] it The autofill fill response item handle + * @param[out] value The autofill fill response item value * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -938,6 +1061,8 @@ int autofill_fill_response_item_get_value(autofill_fill_response_item_h it, char * * @privlevel public * + * @param[in] it The autofill fill response item handle + * @param[in] presentation_text The presentation text * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -951,6 +1076,8 @@ int autofill_fill_response_item_set_presentation_text(autofill_fill_response_ite * * @privlevel public * + * @param[in] it The autofill fill response item handle + * @param[out] presentation_text The presentation text * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -965,6 +1092,7 @@ int autofill_fill_response_item_get_presentation_text(autofill_fill_response_ite * * @privlevel public * + * @param[out] it The autofill save item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -978,6 +1106,7 @@ int autofill_save_item_create(autofill_save_item_h *it); * * @privlevel public * + * @param[in] it The autofill save item handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -991,6 +1120,8 @@ int autofill_save_item_destroy(autofill_save_item_h it); * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[in] clone The autofill save item handle to be cloned * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1004,6 +1135,8 @@ int autofill_save_item_clone(autofill_save_item_h h, autofill_save_item_h *clone * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[in] hint The autofill hint * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1017,6 +1150,8 @@ int autofill_save_item_set_autofill_hint(autofill_save_item_h it, autofill_hint_ * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[out] hint The autofill hint * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1030,6 +1165,8 @@ int autofill_save_item_get_autofill_hint(autofill_save_item_h it, autofill_hint_ * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[in] id The autofill ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1043,6 +1180,8 @@ int autofill_save_item_set_id(autofill_save_item_h it, const char *id); * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[out] id The autofill ID * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1056,6 +1195,8 @@ int autofill_save_item_get_id(autofill_save_item_h it, char **id); * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[out] label The autofill label * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1069,6 +1210,8 @@ int autofill_save_item_set_label(autofill_save_item_h it, const char *label); * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[out] label The autofill label * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1082,6 +1225,8 @@ int autofill_save_item_get_label(autofill_save_item_h it, char **label); * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[in] sensitive The sensitive data or not * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1095,6 +1240,8 @@ int autofill_save_item_set_sensitive_data(autofill_save_item_h it, bool sensitiv * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[out] sensitive The sensitive data or not * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1108,6 +1255,8 @@ int autofill_save_item_get_sensitive_data(autofill_save_item_h it, bool *sensiti * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[in] value The autofill value * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -1121,6 +1270,8 @@ int autofill_save_item_set_value(autofill_save_item_h it, const char *value); * * @privlevel public * + * @param[in] it The autofill save item handle + * @param[out] value The autofill value * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter diff --git a/include/autofill_service.h b/include/autofill_service.h old mode 100644 new mode 100755 index e5b4979..47d7791 --- a/include/autofill_service.h +++ b/include/autofill_service.h @@ -86,6 +86,8 @@ int autofill_service_deinitialize(); * * @privlevel public * + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error */ @@ -98,6 +100,7 @@ int autofill_service_set_auth_info_request_cb(autofill_service_auth_info_request * * @privlevel public * + * @param[in] h The autofill authentication info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -112,6 +115,8 @@ int autofill_service_send_auth_info(autofill_auth_info_h h); * * @privlevel public * + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error */ @@ -124,6 +129,7 @@ int autofill_service_set_fill_request_cb(autofill_service_fill_request_cb callba * * @privlevel public * + * @param[in] h The autofill fill response handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter @@ -137,6 +143,8 @@ int autofill_service_send_fill_response(autofill_fill_response_h h); * * @privlevel public * + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error */ -- 2.7.4 From ae100dd6d2442d968f6b0f7086012f4d5be374a9 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 31 Oct 2018 13:51:14 +0900 Subject: [PATCH 13/16] Add build dependency Change-Id: Idebdf3d97bb67b1265cc7b021f04597a4b9c9580 Signed-off-by: Jihoon Kim --- common/CMakeLists.txt | 2 +- include/autofill_service.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d9357b5..1ff7f75 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -7,7 +7,7 @@ SET(maintainer "Jihoon Kim ") SET(description "Autofill Common APIs") SET(service "ui") SET(submodule "autofill-common") -SET(dependents "dlog eina glib-2.0 rpc-port") +SET(dependents "capi-base-common dlog eina glib-2.0 rpc-port") SET(LIBDIR ${LIB_INSTALL_DIR}) SET(Services diff --git a/include/autofill_service.h b/include/autofill_service.h index 47d7791..09d1984 100755 --- a/include/autofill_service.h +++ b/include/autofill_service.h @@ -22,7 +22,6 @@ * @brief This file contains autofill APIs and related enumeration. */ -#include #include "autofill_enum.h" #include "autofill_common.h" -- 2.7.4 From 29f0e49bb811dd2c22c31ddfff1d9f51a030a887 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 1 Nov 2018 10:39:44 +0900 Subject: [PATCH 14/16] Update package version to 0.1.1 Change-Id: Iaed69548b14fcc8ac6a5b829fd3e2d04f4848551 Signed-off-by: Jihoon Kim --- packaging/capi-ui-autofill.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/capi-ui-autofill.spec b/packaging/capi-ui-autofill.spec index 4e6423d..8241476 100644 --- a/packaging/capi-ui-autofill.spec +++ b/packaging/capi-ui-autofill.spec @@ -1,6 +1,6 @@ Name: capi-ui-autofill Summary: Autofill Library -Version: 0.1.0 +Version: 0.1.1 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 7e2b12672744a3e019173eaac9106edf88b399a0 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 1 Nov 2018 10:54:41 +0900 Subject: [PATCH 15/16] Add on-boot option to launch in boot Change-Id: Ifbb21b7a2fa2a4325cf9c2bf1e58ed2c6be71b60 Signed-off-by: Jihoon Kim --- server/org.tizen.autofill-daemon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/org.tizen.autofill-daemon.xml b/server/org.tizen.autofill-daemon.xml index fd959f2..36ad5ac 100644 --- a/server/org.tizen.autofill-daemon.xml +++ b/server/org.tizen.autofill-daemon.xml @@ -3,7 +3,7 @@ Jihoon Kim autofill-daemon - + -- 2.7.4 From efc32b87977a6ec07ab8239de9bff61d50bd1652 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 5 Nov 2018 09:45:15 +0900 Subject: [PATCH 16/16] Initialize NULL after dealloc memory Change-Id: I57ecd4257469fe321b1cd3e14d441c683ebfe086 Signed-off-by: Jihoon Kim --- common/autofill_auth_info.c | 16 ++++++++++++---- common/autofill_fill_response.c | 4 +++- common/autofill_fill_response_item.c | 12 +++++++++--- common/autofill_item.c | 12 +++++++++--- common/autofill_save_item.c | 12 +++++++++--- common/autofill_save_view_info.c | 8 ++++++-- common/autofill_view_info.c | 8 ++++++-- include/autofill_common.h | 0 include/autofill_service.h | 0 9 files changed, 54 insertions(+), 18 deletions(-) mode change 100755 => 100644 common/autofill_fill_response_item.c mode change 100755 => 100644 common/autofill_save_item.c mode change 100755 => 100644 common/autofill_save_view_info.c mode change 100755 => 100644 common/autofill_view_info.c mode change 100755 => 100644 include/autofill_common.h mode change 100755 => 100644 include/autofill_service.h diff --git a/common/autofill_auth_info.c b/common/autofill_auth_info.c index 80ae5eb..ccb8cc1 100644 --- a/common/autofill_auth_info.c +++ b/common/autofill_auth_info.c @@ -58,17 +58,25 @@ EXPORT_API int autofill_auth_info_destroy(autofill_auth_info_h ai) if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (ai->app_id) + if (ai->app_id) { free(ai->app_id); + ai->app_id = NULL; + } - if (ai->service_name) + if (ai->service_name) { free(ai->service_name); + ai->service_name = NULL; + } - if (ai->service_message) + if (ai->service_message) { free(ai->service_message); + ai->service_message = NULL; + } - if (ai->service_logo_image_path) + if (ai->service_logo_image_path) { free(ai->service_logo_image_path); + ai->service_logo_image_path = NULL; + } free(ai); diff --git a/common/autofill_fill_response.c b/common/autofill_fill_response.c index ba2e626..8116897 100644 --- a/common/autofill_fill_response.c +++ b/common/autofill_fill_response.c @@ -46,8 +46,10 @@ EXPORT_API int autofill_fill_response_destroy(autofill_fill_response_h h) if (!h) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (h->view_id) + if (h->view_id) { free(h->view_id); + h->view_id = NULL; + } // Release memory autofill fill response item list autofill_fill_response_group_h it_h; diff --git a/common/autofill_fill_response_item.c b/common/autofill_fill_response_item.c old mode 100755 new mode 100644 index 604717a..52d8af8 --- a/common/autofill_fill_response_item.c +++ b/common/autofill_fill_response_item.c @@ -52,14 +52,20 @@ EXPORT_API int autofill_fill_response_item_destroy(autofill_fill_response_item_h if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (it->id) + if (it->id) { free(it->id); + it->id = NULL; + } - if (it->value) + if (it->value) { free(it->value); + it->value = NULL; + } - if (it->presentation_text) + if (it->presentation_text) { free(it->presentation_text); + it->presentation_text = NULL; + } free(it); diff --git a/common/autofill_item.c b/common/autofill_item.c index e43c3ae..450443a 100644 --- a/common/autofill_item.c +++ b/common/autofill_item.c @@ -57,14 +57,20 @@ EXPORT_API int autofill_item_destroy(autofill_item_h it) if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (it->id) + if (it->id) { free(it->id); + it->id = NULL; + } - if (it->label) + if (it->label) { free(it->label); + it->label = NULL; + } - if (it->value) + if (it->value) { free(it->value); + it->value = NULL; + } free(it); diff --git a/common/autofill_save_item.c b/common/autofill_save_item.c old mode 100755 new mode 100644 index 381421a..a0404d3 --- a/common/autofill_save_item.c +++ b/common/autofill_save_item.c @@ -56,14 +56,20 @@ EXPORT_API int autofill_save_item_destroy(autofill_save_item_h it) if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (it->id) + if (it->id) { free(it->id); + it->id = NULL; + } - if (it->label) + if (it->label) { free(it->label); + it->label = NULL; + } - if (it->value) + if (it->value) { free(it->value); + it->value = NULL; + } free(it); diff --git a/common/autofill_save_view_info.c b/common/autofill_save_view_info.c old mode 100755 new mode 100644 index 4be0ff9..90c92cb --- a/common/autofill_save_view_info.c +++ b/common/autofill_save_view_info.c @@ -47,11 +47,15 @@ EXPORT_API int autofill_save_view_info_destroy(autofill_save_view_info_h vi) if (!vi) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->app_id) + if (vi->app_id) { free(vi->app_id); + vi->app_id = NULL; + } - if (vi->view_id) + if (vi->view_id) { free(vi->view_id); + vi->view_id = NULL; + } // release memory autofill item list autofill_save_item_h it_h; diff --git a/common/autofill_view_info.c b/common/autofill_view_info.c old mode 100755 new mode 100644 index cbb1e55..864d5b6 --- a/common/autofill_view_info.c +++ b/common/autofill_view_info.c @@ -46,11 +46,15 @@ EXPORT_API int autofill_view_info_destroy(autofill_view_info_h vi) if (!vi) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->app_id) + if (vi->app_id) { free(vi->app_id); + vi->app_id = NULL; + } - if (vi->view_id) + if (vi->view_id) { free(vi->view_id); + vi->view_id = NULL; + } // release memory autofill item list autofill_item_h it_h; diff --git a/include/autofill_common.h b/include/autofill_common.h old mode 100755 new mode 100644 diff --git a/include/autofill_service.h b/include/autofill_service.h old mode 100755 new mode 100644 -- 2.7.4