From 74f43c5732f17020a6bda8804af712a51de4b1d5 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 19 Nov 2018 15:58:45 +0900 Subject: [PATCH] Remove org.tizen.autofill-daemon org.tizen.autofill-daemon is replaced by org.tizen.autofilld. org.tizen.autofilld is located in other git repository for ABS build. Change-Id: I8302b5572ab2435dd875a91cd165d06fc49b5a83 --- CMakeLists.txt | 8 - packaging/capi-ui-autofill.spec | 29 +- server/CMakeLists.txt | 43 -- server/autofill_config.c | 111 ---- server/autofill_config.h | 39 -- server/main.c | 868 ------------------------------ server/org.tizen.autofill-daemon.manifest | 5 - server/org.tizen.autofill-daemon.xml | 14 - 8 files changed, 1 insertion(+), 1116 deletions(-) delete mode 100644 server/CMakeLists.txt delete mode 100644 server/autofill_config.c delete mode 100644 server/autofill_config.h delete mode 100644 server/main.c delete mode 100644 server/org.tizen.autofill-daemon.manifest delete mode 100644 server/org.tizen.autofill-daemon.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index ce0756d..71a1b45 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,11 +32,3 @@ ADD_SUBDIRECTORY(service_lib) ## Manager library ## ADD_SUBDIRECTORY(manager) - -## Server daemon ## -ADD_SUBDIRECTORY(server) - -## 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) diff --git a/packaging/capi-ui-autofill.spec b/packaging/capi-ui-autofill.spec index 2e58553..aad7931 100644 --- a/packaging/capi-ui-autofill.spec +++ b/packaging/capi-ui-autofill.spec @@ -87,15 +87,6 @@ Requires: %{name} = %{version}-%{release} Autofill Manager Library (Development) -%package -n org.tizen.autofill-daemon -Summary: Autofill Daemon application -Group: Graphics & UI Framework/Input -Requires: %{name} = %{version}-%{release} - -%description -n org.tizen.autofill-daemon -Autofill Daemon application - - %prep %setup -q @@ -103,14 +94,6 @@ 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/ @@ -133,9 +116,7 @@ export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden" rm -rf CMakeFiles rm -rf CMakeCache.txt MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ - -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES - +%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} make %{?jobs:-j%jobs} %install @@ -145,9 +126,6 @@ rm -rf %{buildroot} %post /sbin/ldconfig -%post -n org.tizen.autofill-daemon -mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon - %postun -p /sbin/ldconfig @@ -192,8 +170,3 @@ mkdir -p %{TZ_SYS_RO_APP}/org.tizen.autofill-daemon %{_includedir}/autofill_manager*.h %{_libdir}/pkgconfig/capi-ui-autofill-manager.pc %{_libdir}/libcapi-ui-autofill-manager.so - -%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/* diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt deleted file mode 100644 index aba710e..0000000 --- a/server/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(autofill-daemon C) - -SET(SRCS - main.c - autofill_config.c - autofill_stub.c - autofill_manager_stub.c - autofill_service_proxy.c -) - -pkg_check_modules(pkgs_daemon REQUIRED - dlog - capi-appfw-service-application - rpc-port - glib-2.0 - capi-appfw-app-manager - capi-appfw-preference - eina -) - -INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include) - -FOREACH(flag ${pkgs_daemon_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_daemon_LDFLAGS}) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${TZ_SYS_RO_APP}/org.tizen.${PROJECT_NAME}/bin/) -INSTALL(FILES ${CMAKE_BINARY_DIR}/server/org.tizen.${PROJECT_NAME}.xml DESTINATION ${TZ_SYS_RO_PACKAGES}) diff --git a/server/autofill_config.c b/server/autofill_config.c deleted file mode 100644 index c891f2b..0000000 --- a/server/autofill_config.c +++ /dev/null @@ -1,111 +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 -#include - -#include "autofill_config.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "AUTOFILL_DAEMON" - -#define SETTING_ACTIVE_AUTOFILL_SERVICE "ActiveAutofillService" -#define AUTOFILL_SYSTEM_CONFIG_FILE "/etc/autofill/config" - -bool autofill_config_get_autofill_service_app_id(char **app_id) -{ - char *active_autofill_service_id = NULL; - FILE *pFile = NULL; - Eina_Strbuf *sb_key = NULL, *sb_value = NULL; - const char *key_str = NULL; - const char *value_str = NULL; - bool ret = false; - char strTemp[1024]; - - if (preference_get_string(SETTING_ACTIVE_AUTOFILL_SERVICE, &active_autofill_service_id) == PREFERENCE_ERROR_NONE) { - LOGD("preference active autofill service : %s", active_autofill_service_id); - *app_id = active_autofill_service_id; - return true; - } - - LOGD("Read from config"); - - pFile = fopen(AUTOFILL_SYSTEM_CONFIG_FILE, "r"); - if (pFile == NULL) - return false; - - while (fgets(strTemp, sizeof(strTemp), pFile) != NULL) - { - char **result_arr = eina_str_split(strTemp, "=", 0); - if (!result_arr) - continue; - - if (!result_arr[0]) { - free(result_arr); - continue; - } - - sb_key = eina_strbuf_new(); - eina_strbuf_append(sb_key, result_arr[0]); - eina_strbuf_trim(sb_key); - - key_str = eina_strbuf_string_get(sb_key); - if (key_str) { - if (strcmp(key_str, SETTING_ACTIVE_AUTOFILL_SERVICE) == 0) { - if (result_arr[1]) { - sb_value = eina_strbuf_new(); - eina_strbuf_append(sb_value, result_arr[1]); - eina_strbuf_trim(sb_value); - value_str = eina_strbuf_string_get(sb_value); - - if (app_id && value_str) { - *app_id = strdup(value_str); - ret = true; - } - - eina_strbuf_free(sb_value); - } - } - eina_strbuf_free(sb_key); - } - - /* Free the memory */ - free(result_arr[0]); - free(result_arr); - - if (ret) - break; - } /* end of while */ - - fclose(pFile); - - return ret; -} - -bool autofill_config_set_autofill_service_app_id(const char *app_id) -{ - if (preference_set_string(SETTING_ACTIVE_AUTOFILL_SERVICE, app_id) == PREFERENCE_ERROR_NONE) - return true; - - return false; -} - diff --git a/server/autofill_config.h b/server/autofill_config.h deleted file mode 100644 index 57eb00e..0000000 --- a/server/autofill_config.h +++ /dev/null @@ -1,39 +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. - */ - -#ifndef __AUTOFILL_CONFIG_H__ -#define __AUTOFILL_CONFIG_H__ - -#include - -#define AUTOFILL_SERVICE_APP_ID "org.tizen.autofill-service" - -#ifdef __cplusplus -extern "C" { -#endif - -bool autofill_config_get_autofill_service_app_id(char **app_id); -bool autofill_config_set_autofill_service_app_id(const char *app_id); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __AUTOFILL_CONFIG_H__ */ diff --git a/server/main.c b/server/main.c deleted file mode 100644 index d1ac10a..0000000 --- a/server/main.c +++ /dev/null @@ -1,868 +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 -#include -#include - -#include "autofill_stub.h" -#include "autofill_service_proxy.h" -#include "autofill_manager_stub.h" -#include "autofill_config.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "AUTOFILL_DAEMON" - - -static rpc_port_proxy_AutofillSvcPort_h svc_rpc_h = NULL; - -static int connect_service(); - -typedef struct { - char *app_id; - int context_id; - - rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_cb; - rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb; -} autofill_client_s; - -static GList *__client_list = NULL; - -static autofill_client_s * -get_autofill_client(const char *app_id, int context_id) -{ - GList *iter; - autofill_client_s *client; - - iter = __client_list; - while (iter) { - client = iter->data; - - iter = g_list_next(iter); - - if (!client) { - LOGW("Warning: value is NULL"); - continue; - } - - if ((client->context_id == context_id) && - client->app_id && strcmp(client->app_id, app_id) == 0) { - return client; - } - } - - return NULL; -} - -static autofill_client_s *__create_client(const char *app_id, int context_id, - rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_cb, - rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb) -{ - LOGD(""); - autofill_client_s *handle; - - handle = calloc(1, sizeof(autofill_client_s)); - if (!handle) { - LOGE("Out of memory"); - return NULL; - } - - handle->app_id = strdup(app_id); - if (!handle->app_id) { - LOGE("Out of memory"); - free(handle); - return NULL; - } - - handle->context_id = context_id; - - rpc_port_AutofillAppPort_autofill_auth_info_received_cb_clone(auth_info_cb, &handle->auth_info_cb); - if (!handle->auth_info_cb) { - LOGE("Out of memory"); - free(handle->app_id); - free(handle); - return NULL; - } - - rpc_port_AutofillAppPort_autofill_fill_response_received_cb_clone(fill_response_received_cb, &handle->fill_response_received_cb); - - if (!handle->fill_response_received_cb) { - LOGE("Out of memory"); - free(handle->app_id); - rpc_port_AutofillAppPort_autofill_auth_info_received_cb_destroy(handle->auth_info_cb); - free(handle); - return NULL; - } - - return handle; -} - -static void __destroy_client(gpointer data) -{ - LOGD(""); - autofill_client_s *handle = data; - - if (!handle) - return; - - if (handle->auth_info_cb) { - rpc_port_AutofillAppPort_autofill_auth_info_received_cb_destroy(handle->auth_info_cb); - handle->auth_info_cb = NULL; - } - - if (handle->fill_response_received_cb) { - rpc_port_AutofillAppPort_autofill_fill_response_received_cb_destroy(handle->fill_response_received_cb); - handle->fill_response_received_cb = NULL; - } - - if (handle->app_id) { - free(handle->app_id); - handle->app_id = NULL; - } - - free(handle); -} - -static void __remove_client(rpc_port_stub_AutofillAppPort_context_h context) -{ - autofill_client_s *client = NULL; - rpc_port_stub_AutofillAppPort_context_get_tag(context, (void *)&client); - if (!client) - return; - - rpc_port_stub_AutofillAppPort_context_set_tag(context, NULL); - - LOGI("name(%s)", client->app_id); - - __client_list = g_list_remove(__client_list, client); - __destroy_client(client); -} - -static void __message_create(rpc_port_stub_AutofillAppPort_context_h context, - void *user_data) -{ - LOGD(""); - char *sender = NULL; - - rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender); - if (!sender) - return; - - LOGD("sender(%s)", sender); - free(sender); -} - -static void __message_terminate(rpc_port_stub_AutofillAppPort_context_h context, - void *user_data) -{ - LOGD(""); - char *sender = NULL; - - rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender); - if (!sender) - return; - - LOGD("[__RPC_PORT__] sender(%s)", sender); - free(sender); - - __remove_client(context); -} - -static int __message_register(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_cb, rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb, void *user_data) -{ - LOGD(""); - char *sender = NULL; - autofill_client_s *client = NULL; - - rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender); - if (!sender) - return -1; - - LOGD("sender(%s)", sender); - - client = __create_client(sender, context_id, auth_info_cb, fill_response_received_cb); - free(sender); - - if (!client) - return -1; - - __client_list = g_list_append(__client_list, client); - - rpc_port_stub_AutofillAppPort_context_set_tag(context, client); - - return 0; -} - -static void __message_unregister(rpc_port_stub_AutofillAppPort_context_h context, int context_id, void *user_data) -{ - __remove_client(context); -} - -static void __manager_create(rpc_port_stub_AutofillManagerPort_context_h context, - void *user_data) -{ - LOGD(""); -} - -static void __manager_terminate(rpc_port_stub_AutofillManagerPort_context_h context, - void *user_data) -{ - LOGD(""); -} - -bool __view_info_item_cb(rpc_port_autofill_item_h items, void *user_data) -{ - char *id = NULL; - char *label = NULL; - char *value = NULL; - int autofill_hint; - bool sensitive_data; - - rpc_port_autofill_svc_view_info_h svi = (rpc_port_autofill_svc_view_info_h)user_data; - - rpc_port_autofill_svc_item_h svc_item; - - rpc_port_autofill_svc_item_create(&svc_item); - - rpc_port_autofill_item_get_id(items, &id); - rpc_port_autofill_svc_item_set_id(svc_item, id); - if (id) { - LOGD("id : %s", id); - free(id); - } - - rpc_port_autofill_item_get_label(items, &label); - rpc_port_autofill_svc_item_set_label(svc_item, label); - if (label) { - LOGD("label : %s", label); - free(label); - } - - rpc_port_autofill_item_get_value(items, &value); - rpc_port_autofill_svc_item_set_value(svc_item, value); - if (value) { - LOGD("value : %s", value); - free(value); - } - - rpc_port_autofill_item_get_autofill_hint(items, &autofill_hint); - rpc_port_autofill_svc_item_set_autofill_hint(svc_item, autofill_hint); - LOGD("autofill hint : %d", autofill_hint); - - rpc_port_autofill_item_get_is_sensitive_data(items, &sensitive_data); - rpc_port_autofill_svc_item_set_is_sensitive_data(svc_item, sensitive_data); - LOGD("sensitive data : %d", sensitive_data); - - rpc_port_autofill_svc_view_info_add_items(svi, svc_item); - - rpc_port_autofill_svc_item_destroy(svc_item); - - return true; -} - -bool __save_item_cb(rpc_port_autofill_save_item_h items, void *user_data) -{ - char *id = NULL; - char *label = NULL; - char *value = NULL; - int autofill_hint; - bool sensitive_data; - - rpc_port_autofill_svc_save_view_info_h svi = (rpc_port_autofill_svc_save_view_info_h)user_data; - - rpc_port_autofill_svc_save_item_h svc_save_item; - - rpc_port_autofill_svc_save_item_create(&svc_save_item); - - rpc_port_autofill_save_item_get_id(items, &id); - rpc_port_autofill_svc_save_item_set_id(svc_save_item, id); - if (id) { - LOGD("id : %s", id); - free(id); - } - - rpc_port_autofill_save_item_get_label(items, &label); - rpc_port_autofill_svc_save_item_set_label(svc_save_item, label); - if (label) { - LOGD("label : %s", label); - free(label); - } - - rpc_port_autofill_save_item_get_value(items, &value); - rpc_port_autofill_svc_save_item_set_value(svc_save_item, value); - if (value) { - LOGD("value : %s", value); - free(value); - } - - rpc_port_autofill_save_item_get_autofill_hint(items, &autofill_hint); - rpc_port_autofill_svc_save_item_set_autofill_hint(svc_save_item, autofill_hint); - LOGD("autofill hint : %d", autofill_hint); - - rpc_port_autofill_save_item_get_is_sensitive_data(items, &sensitive_data); - rpc_port_autofill_svc_save_item_set_is_sensitive_data(svc_save_item, sensitive_data); - LOGD("sensitive data : %d", sensitive_data); - - rpc_port_autofill_svc_save_view_info_add_items(svi, svc_save_item); - - rpc_port_autofill_svc_save_item_destroy(svc_save_item); - - return true; -} - -static int __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_autofill_view_info_h vi, void *user_data) -{ - char *sender = NULL; - autofill_client_s *sender_client; - - if (!svc_rpc_h) { - LOGW("Not initialized"); - return 0; - } - - rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender); - char *view_id = NULL; - - rpc_port_autofill_view_info_get_view_id(vi, &view_id); - LOGD("app id : %s, view id : %s", sender, view_id); - - rpc_port_stub_AutofillAppPort_context_get_tag(context, (void *)&sender_client); - - /* create view info */ - rpc_port_autofill_svc_view_info_h svi; - rpc_port_autofill_svc_view_info_create(&svi); - rpc_port_autofill_svc_view_info_set_app_id(svi, sender); - rpc_port_autofill_svc_view_info_set_view_id(svi, view_id); - - rpc_port_autofill_view_info_foreach_items(vi, __view_info_item_cb, svi); - - rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(svc_rpc_h, context_id, svi); - - if (sender) { - free(sender); - } - - if (view_id) { - free(view_id); - } - - rpc_port_autofill_svc_view_info_destroy(svi); - - return 0; -} - -static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_autofill_view_info_h vi, void *user_data) -{ - char *sender = NULL; - char *view_id = NULL; - - if (!svc_rpc_h) { - LOGW("Not initialized"); - return 0; - } - - rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender); - rpc_port_autofill_view_info_get_view_id(vi, &view_id); - - LOGD("app id : %s, view id : %s, context id : %d", sender, view_id, context_id); - - rpc_port_autofill_svc_view_info_h svi; - rpc_port_autofill_svc_view_info_create(&svi); - rpc_port_autofill_svc_view_info_set_app_id(svi, sender); - rpc_port_autofill_svc_view_info_set_view_id(svi, view_id); - - rpc_port_autofill_view_info_foreach_items(vi, __view_info_item_cb, svi); - - rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(svc_rpc_h, context_id, svi); - - if (sender) - free(sender); - - if (view_id) - free(view_id); - - rpc_port_autofill_svc_view_info_destroy(svi); - - return 0; -} - -static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_autofill_save_view_info_h vi, void *user_data) -{ - char *sender = NULL; - autofill_client_s *sender_client; - - if (!svc_rpc_h) { - LOGW("Not initialized"); - return 0; - } - - rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender); - if (sender) { - LOGD("sender(%s)", sender); - free(sender); - } - - char *view_id = NULL; - rpc_port_autofill_save_view_info_get_view_id(vi, &view_id); - if (view_id) { - LOGD("view id : %s", view_id); - } - - rpc_port_autofill_svc_save_view_info_h svi; - rpc_port_autofill_svc_save_view_info_create(&svi); - rpc_port_autofill_svc_save_view_info_set_view_id(svi, view_id); - - rpc_port_stub_AutofillAppPort_context_get_tag(context, (void *)&sender_client); - rpc_port_autofill_save_view_info_foreach_items(vi, __save_item_cb, svi); - - rpc_port_proxy_AutofillSvcPort_invoke_commit(svc_rpc_h, context_id, svi); - - if (view_id) - free(view_id); - - rpc_port_autofill_svc_save_view_info_destroy(svi); - - return 0; -} - -bool fill_response_item_cb(rpc_port_autofill_svc_response_item_h response_items, void *user_data) -{ - rpc_port_autofill_response_group_h res_group = (rpc_port_autofill_response_group_h)user_data; - - char *id = NULL; - char *presentation_text = NULL; - char *value = NULL; - - rpc_port_autofill_response_item_h res_item; - - rpc_port_autofill_response_item_create(&res_item); - - rpc_port_autofill_svc_response_item_get_id(response_items, &id); - rpc_port_autofill_response_item_set_id(res_item, id); - - rpc_port_autofill_svc_response_item_get_presentation_text(response_items, &presentation_text); - rpc_port_autofill_response_item_set_presentation_text(res_item, presentation_text); - - rpc_port_autofill_svc_response_item_get_value(response_items, &value); - rpc_port_autofill_response_item_set_value(res_item, value); - - LOGD("id : %s, presentation text : %s, value : %s", id, presentation_text, value); - - rpc_port_autofill_response_group_add_response_items(res_group, res_item); - - if (id) - free(id); - - if (presentation_text) - free(presentation_text); - - if (value) - free(value); - - rpc_port_autofill_response_item_destroy(res_item); - - return true; -} - -bool fill_response_group_cb(rpc_port_autofill_svc_response_group_h response_groups, void *user_data) -{ - rpc_port_autofill_fill_response_h fr_h = (rpc_port_autofill_fill_response_h)user_data; - - rpc_port_autofill_response_group_h res_group; - rpc_port_autofill_response_group_create(&res_group); - - rpc_port_autofill_svc_response_group_foreach_response_items(response_groups, fill_response_item_cb, res_group); - - rpc_port_autofill_fill_response_add_response_groups(fr_h, res_group); - - rpc_port_autofill_response_group_destroy(res_group); - - return true; -} - -static void __fill_response_recv_cb(void *user_data, int context_id, rpc_port_autofill_svc_fill_response_h response_h) -{ - // recv fill response from service - char *view_id = NULL; - char *app_id = NULL; - - rpc_port_autofill_svc_fill_response_get_app_id(response_h, &app_id); - rpc_port_autofill_svc_fill_response_get_view_id(response_h, &view_id); - LOGD("app id : %s, view id : %s", app_id, view_id); - - /* create autofill response */ - rpc_port_autofill_fill_response_h fill_response_h; - rpc_port_autofill_fill_response_create(&fill_response_h); - rpc_port_autofill_fill_response_set_view_id(fill_response_h, view_id); - - rpc_port_autofill_svc_fill_response_foreach_response_groups(response_h, fill_response_group_cb, fill_response_h); - - autofill_client_s *sender_client = get_autofill_client(app_id, context_id); - if (sender_client) - rpc_port_AutofillAppPort_autofill_fill_response_received_cb_invoke(sender_client->fill_response_received_cb, fill_response_h); - - rpc_port_autofill_fill_response_destroy(fill_response_h); - - if (app_id) - free(app_id); - - if (view_id) - free(view_id); -} - -static void __auth_info_recv_cb(void *user_data, int context_id, rpc_port_autofill_svc_auth_info_h svc_auth_info_h) -{ - bool exist_autofill_data; - bool need_authentication; - char *service_name = NULL; - 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); - rpc_port_autofill_svc_auth_info_get_service_logo_image_path(svc_auth_info_h, &service_logo_image_path); - rpc_port_autofill_svc_auth_info_get_service_message(svc_auth_info_h, &service_message); - - LOGD("app id : %s, service name : %s, message : %s, logo path : %s", app_id, service_name, service_message, service_logo_image_path); - - /* 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); - rpc_port_autofill_auth_info_set_service_message(auth_info_h, service_message); - rpc_port_autofill_auth_info_set_service_logo_image_path(auth_info_h, service_logo_image_path); - - autofill_client_s *sender_client = get_autofill_client(app_id, context_id); - if (sender_client) - rpc_port_AutofillAppPort_autofill_auth_info_received_cb_invoke(sender_client->auth_info_cb, auth_info_h); - - rpc_port_autofill_auth_info_destroy(auth_info_h); - - if (app_id) - free(app_id); - - if (view_id) - free(view_id); - - if (service_name) - free(service_name); - - if (service_logo_image_path) - free(service_logo_image_path); - - if (service_message) - free(service_message); -} - -static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) -{ - LOGI("[__RPC_PORT__] connected"); - - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb_h = rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(__fill_response_recv_cb, false, NULL); - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb_h = rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(__auth_info_recv_cb, false, NULL); - - int r = rpc_port_proxy_AutofillSvcPort_invoke_Register(h, auth_info_cb_h, fill_response_received_cb_h); - if (r != 0) - LOGD("Failed to invoke Register"); -} - -//LCOV_EXCL_START -static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) -{ - LOGD("disconnected"); - - svc_rpc_h = NULL; -} - -static void __on_rejected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) -{ - LOGD("rejected"); -} -//LCOV_EXCL_STOP - -static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_context_h context, const char *app_id, void *user_data) -{ - LOGD("app id : %s", app_id); - - if (app_id) - autofill_config_set_autofill_service_app_id(app_id); - - if (svc_rpc_h) { - LOGD("send terminate"); - // terminate service - rpc_port_proxy_AutofillSvcPort_invoke_request_terminate(svc_rpc_h); - - int ret = rpc_port_proxy_AutofillSvcPort_destroy(svc_rpc_h); - LOGD("ret : %d", ret); - } - - svc_rpc_h = NULL; - - connect_service(); - - return true; -} - -static char * __manager_get_autofill_service_cb(rpc_port_stub_AutofillManagerPort_context_h context, void *user_data) -{ - if (!svc_rpc_h) { - LOGW("Not initialized"); - return false; - } - - char *app_id; - autofill_config_get_autofill_service_app_id(&app_id); - - LOGD("app id : %s", app_id); - - return app_id; -} - -bool add_autofill_service_cb(app_info_h app_info, void *user_data) -{ - char *app_id = NULL; - rpc_port_list_string_h service_info_list = (rpc_port_list_string_h)user_data; - - int ret = app_info_get_app_id(app_info, &app_id); - if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_get_app_id failed (%d)", ret); - return true; - } - - LOGD("Find autofill service : %s", app_id); - - rpc_port_list_string_add_list_strings(service_info_list, app_id); - - if (app_id) { - free(app_id); - } - - return true; -} - -static bool __manager_get_autofill_service_list_cb(rpc_port_stub_AutofillManagerPort_context_h context, rpc_port_list_string_h *service_info_list, void *user_data) -{ - int ret; - app_info_metadata_filter_h handle = NULL; - - // Get the Autofill service list - ret = app_info_metadata_filter_create(&handle); - if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_metadata_filter_create failed (%d)", ret); - app_info_metadata_filter_destroy(handle); - return false; - } - - ret = app_info_metadata_filter_add(handle, "autofill-service", "true"); - if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_metadata_filter_add failed (%d)", ret); - app_info_metadata_filter_destroy(handle); - return false; - } - - rpc_port_list_string_h app_id_list_h; - rpc_port_list_string_create(&app_id_list_h); - - ret = app_info_metadata_filter_foreach(handle, add_autofill_service_cb, app_id_list_h); - if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_metadata_filter_foreach failed (%d)", ret); - } - - *service_info_list = app_id_list_h; - - app_info_metadata_filter_destroy(handle); - - return true; -} - -static int connect_service() -{ - int ret; - size_t service_id_len; - - rpc_port_proxy_AutofillSvcPort_callback_s rpc_callback = { - .connected = __on_connected, - .disconnected = __on_disconnected, - .rejected = __on_rejected - }; - - if (svc_rpc_h) { - LOGI("already connected\n"); - return RPC_PORT_ERROR_NONE; - } - - char *active_autofill_service_id = NULL; - autofill_config_get_autofill_service_app_id(&active_autofill_service_id); - LOGD("autofill service : '%s'", active_autofill_service_id); - - if (!active_autofill_service_id) { - active_autofill_service_id = strdup(AUTOFILL_SERVICE_APP_ID); - } - - if (active_autofill_service_id) { - autofill_config_set_autofill_service_app_id(active_autofill_service_id); - service_id_len = strlen(active_autofill_service_id); - - if (service_id_len > 0) { - ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &svc_rpc_h); - } - free(active_autofill_service_id); - - if (service_id_len == 0) { - LOGD("No Autofill service to connect"); - return false; - } - - if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to create rpc port. err = %d", ret); - return false; - } - } - - ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h); - if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to connect. err = %d", ret); - return false; - } - - return ret; -} - -bool service_app_create(void *data) -{ - // Todo: add your code here. - LOGD(""); - - int ret; - // register app port - rpc_port_stub_AutofillAppPort_callback_s callback = { - __message_create, - __message_terminate, - __message_register, - __message_unregister, - __auth_info_request_cb, - __autofill_fill_request_cb, - __commit_cb, - }; - - ret = rpc_port_stub_AutofillAppPort_register(&callback, NULL); - if (ret != 0) - LOGI("Failed to register app port"); - else - LOGI("Succeeded to register app port"); - - // register manager port - rpc_port_stub_AutofillManagerPort_callback_s manager_callback = { - __manager_create, - __manager_terminate, - __manager_set_autofill_service_cb, - __manager_get_autofill_service_cb, - __manager_get_autofill_service_list_cb, - }; - - ret = rpc_port_stub_AutofillManagerPort_register(&manager_callback, NULL); - if (ret != 0) - LOGI("Failed to register manager port"); - else - LOGI("Succeeded to register manager port"); - - connect_service(); - - return true; -} - -void service_app_terminate(void *data) -{ - // Todo: add your code here. - LOGD(""); - - if (__client_list) { - g_list_free_full(__client_list, __destroy_client); - __client_list = NULL; - } - - rpc_port_stub_AutofillAppPort_unregister(); - - 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/server/org.tizen.autofill-daemon.manifest b/server/org.tizen.autofill-daemon.manifest deleted file mode 100644 index 017d22d..0000000 --- a/server/org.tizen.autofill-daemon.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/server/org.tizen.autofill-daemon.xml b/server/org.tizen.autofill-daemon.xml deleted file mode 100644 index fd959f2..0000000 --- a/server/org.tizen.autofill-daemon.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - Jihoon Kim - autofill-daemon - - - - - - http://tizen.org/privilege/appmanager.launch - http://tizen.org/privilege/datasharing - - -- 2.7.4