summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2015-10-24 16:21:15 +0900
committerjk7744.park <jk7744.park@samsung.com>2015-10-24 16:21:15 +0900
commit000a4e65c7aba9ba0d7ea651781098e8d8fa5644 (patch)
treece8d75df723e36f6d1f023d03e595aec29c32dc2
parentb3f05b473791106b358b509929807a630bf4a42b (diff)
downloadlibaccounts-svc-tizen_2.4_mobile_release.tar.gz
libaccounts-svc-tizen_2.4_mobile_release.tar.bz2
libaccounts-svc-tizen_2.4_mobile_release.zip
-rwxr-xr-xAUTHORS2
-rw-r--r--[-rwxr-xr-x]CMakeLists.txt41
-rwxr-xr-xINSTALL33
-rw-r--r--[-rwxr-xr-x]LICENSE.APLv2 (renamed from LICENSE)1
-rwxr-xr-xNOTICE3
-rw-r--r--TC/utc-accounts-svc.c4776
-rw-r--r--doc/account_doc.h33
-rw-r--r--doc/account_manager_doc.h8
-rw-r--r--doc_prod/account_manager_doc.h44
-rw-r--r--[-rwxr-xr-x]include/account-error.h40
-rwxr-xr-xinclude/account-private.h383
-rw-r--r--[-rwxr-xr-x]include/account-types.h53
-rw-r--r--[-rwxr-xr-x]include/account.h691
-rw-r--r--[-rwxr-xr-x]include/account_PG.h0
-rw-r--r--include/account_internal.h331
-rw-r--r--include/mobile/account.h1857
-rw-r--r--include/wearable/account.h1746
-rw-r--r--[-rwxr-xr-x]libaccounts-svc.manifest9
-rw-r--r--[-rwxr-xr-x]packaging/libaccounts-svc.spec86
-rw-r--r--src/CMakeLists.txt59
-rw-r--r--[-rwxr-xr-x]src/account.c6848
-rw-r--r--src/account_offline.c1404
-rw-r--r--src/account_private_client.h49
-rw-r--r--[-rwxr-xr-x]src/accounts-svc.pc.in (renamed from accounts-svc.pc.in)2
-rwxr-xr-xsrc/utc-account.c8276
25 files changed, 11931 insertions, 14844 deletions
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100755
index 910b427..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,2 +0,0 @@
-Wonyoung Lee <wy1115.lee@samsung.com>
-Sungchan Kim <sungchan81.kim@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80e0958..2d3381d 100755..100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,43 +6,6 @@ SET(EXEC_PREFIX "\${prefix}")
SET(LIBDIR "\${prefix}/lib")
SET(INCLUDEDIR "\${prefix}/include ")
SET(VERSION_MAJOR 0)
-SET(VERSION "${VERSION_MAJOR}.2.97")
+SET(VERSION "${VERSION_MAJOR}.3.5")
-SET(SRCS
-src/account.c
-)
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED sqlite3 dlog db-util glib-2.0 capi-base-common vconf pkgmgr-info aul libsmack)
-
-FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
-SET(CMAKE_LDFLAGS "-Wl,-zdefs")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
-ADD_DEFINITIONS("-DSLP_DEBUG")
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib/accounts-svc)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account.h DESTINATION include)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-error.h DESTINATION include)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-types.h DESTINATION include)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account_internal.h DESTINATION include)
-
-#ADD_SUBDIRECTORY(test)
+ADD_SUBDIRECTORY(src)
diff --git a/INSTALL b/INSTALL
deleted file mode 100755
index ddf4e78..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,33 +0,0 @@
-1. make the build directory
-
- ex)
-
- $ mkdir build
-
-
-2. change the working directory to the build directory
-
- ex)
-
- $ cd build
-
-
-3. run 'cmake'
-
- $ cmake ${SOURCE_DIR} -DCMAKE_INSTALL_PREFIX=/usr
-
- ex)
-
- $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
-
- or
-
- $ cmake ..
-
-
-4. make & make install
-
- ex)
-
- $ make -j 2 && make install
-
diff --git a/LICENSE b/LICENSE.APLv2
index f94008a..8aa906c 100755..100644
--- a/LICENSE
+++ b/LICENSE.APLv2
@@ -1,4 +1,3 @@
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
Apache License
Version 2.0, January 2004
diff --git a/NOTICE b/NOTICE
new file mode 100755
index 0000000..0e0f016
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
diff --git a/TC/utc-accounts-svc.c b/TC/utc-accounts-svc.c
new file mode 100644
index 0000000..0466804
--- /dev/null
+++ b/TC/utc-accounts-svc.c
@@ -0,0 +1,4776 @@
+#include "assert.h"
+#include <account.h>
+#include <account_internal.h>
+#include <account-types.h>
+#include <account-error.h>
+#include <string.h>
+#include <glib.h>
+
+#define TEST_PACKAGE_NAME "core-accounts-svc-tests" // app_id
+#define USER_NAME "user_name"
+#define ICON_PATH "/usr/share/icons/default/small/com.samsung.phone.png"
+
+#define check_fail(exp) \
+ if (!(exp)) { \
+ _is_fail = true; \
+ FILE *fp = fopen(ERR_LOG,"w"); \
+ fprintf(fp, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(fp, \
+ "Following expression is not true:\n" \
+ "%s\n", #exp); \
+ fclose(fp); \
+ return false; \
+ }
+
+#define check_fail_eq(var, ref) \
+ if (var != ref) { \
+ FILE *fp = fopen(ERR_LOG,"w"); \
+ fprintf(fp, \
+ "Assert fail in %s:%d\n", __FILE__, __LINE__); \
+ fprintf(fp, \
+ "Values \"%s\" and \"%s\" are not equal:\n" \
+ "%s == %d, %s == %d\n", \
+ #var, #ref, #var, (int)var, #ref, (int)ref); \
+ fclose(fp); \
+ return false; \
+ }
+
+
+#define is_callback_fail() \
+ if (_is_fail == true) \
+ return 1;
+
+//& set: AccountsSvc
+static bool connected = false;
+static bool created = false;
+static account_h account = NULL;
+static GMainLoop* mainloop = NULL;
+static int _is_fail = true;
+static const char* package_name = TEST_PACKAGE_NAME;
+static const char* icon_path = ICON_PATH;
+static const char* label_default = "AccountTest";
+static const char* label_en_gb = "Application en-gb Test";
+static const char* contact_capability = ACCOUNT_SUPPORTS_CAPABILITY_CONTACT;
+static const char* calendar_capability = ACCOUNT_SUPPORTS_CAPABILITY_CALENDAR;
+static const char* user_name = USER_NAME;
+static const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+
+static gboolean timeout_cb(gpointer data) {
+ printf("timeout!\n");
+ _is_fail = true;
+ g_main_loop_quit((GMainLoop*)data);
+ return FALSE;
+}
+
+void utc_account_startup(void)
+{
+ account_type_h account_type = NULL;
+ int account_type_id = -1;
+ int ret1 = ACCOUNT_ERROR_NONE, ret2 = ACCOUNT_ERROR_NONE;
+ ret1 = account_connect();
+ if (ACCOUNT_ERROR_NONE == ret1) {
+ connected = true;
+ ret2 = account_create(&account);
+ if (ACCOUNT_ERROR_NONE == ret2) {
+ created = true;
+ }
+ }
+
+ if(account_type_query_app_id_exist(package_name) == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ ret1 = account_type_create(&account_type);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_app_id_internal(account_type, package_name);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_service_provider_id_internal(account_type, "http://www.samsung.com/");
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_multiple_account_support_internal(account_type, true);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_label_internal(account_type, label_default, NULL);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_label_internal(account_type, label_en_gb, "en_GB");
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_icon_path_internal(account_type, icon_path);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_small_icon_path_internal(account_type, icon_path);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_provider_feature_internal(account_type, contact_capability);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_set_provider_feature_internal(account_type, calendar_capability);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+
+ ret1 = account_type_destroy(account_type);
+ assert_eq(ret1, ACCOUNT_ERROR_NONE);
+ }
+}
+
+void utc_account_cleanup(void)
+{
+ int ret1 = ACCOUNT_ERROR_NONE, ret2 = ACCOUNT_ERROR_NONE;
+ ret1 = account_destroy(account);
+ if (ACCOUNT_ERROR_NONE == ret1) {
+ created = false;
+ ret2 = account_disconnect();
+ if (ACCOUNT_ERROR_NONE == ret2) {
+ connected = false;
+ }
+ }
+}
+
+static void _account_free_text(char *text)
+{
+ if (text != NULL) {
+ free(text);
+ text = NULL;
+ }
+}
+
+int utc_account_connect_p(void)
+{
+ assert(connected);
+
+ return 0;
+}
+
+
+int utc_account_connect_n(void)
+{
+ /*
+ There is no way to test account_connect_n().
+ */
+ return 0;
+}
+
+int utc_account_connect_readonly_p(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ if(connected)
+ {
+ ret = account_disconnect();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ ret = account_connect_readonly();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_connect_readonly_n(void)
+{
+ /*
+ There is no way to test account_connect_readonly_n().
+ */
+ return 0;
+}
+
+int utc_account_disconnect_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_disconnect();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_connect();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_disconnect_n(void)
+{
+ /*
+ There is no way to test account_disconnect_n().
+ */
+ return 0;
+}
+
+int utc_account_destroy_p(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ account_h account_data = NULL;
+ assert(connected);
+
+ ret = account_create(&account_data);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_destroy(account_data);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_destroy_n(void)
+{
+ assert(connected);
+ assert(created);
+ utc_account_cleanup();
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = rename("/opt/usr/dbspace/.account.db", "/opt/usr/dbspace/.account-tmp.db");
+
+ ret = rename("/opt/usr/dbspace/.account.db-journal", "/opt/usr/dbspace/.account-tmp.db-journal");
+
+ ret = account_destroy(NULL);
+
+ assert_neq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = rename("/opt/usr/dbspace/.account-tmp.db", "/opt/usr/dbspace/.account.db");
+ ret = rename("/opt/usr/dbspace/.account-tmp.db-journal", "/opt/usr/dbspace/.account.db-journal");
+
+ utc_account_startup();
+
+ return 0;
+}
+
+
+int utc_account_create_p(void)
+{
+ assert(connected);
+ assert(created);
+
+ return 0;
+}
+
+int utc_account_create_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_create(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_insert_to_db_p(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_user_name = NULL;
+ char* ret_package_name = NULL;
+ const char* display_name = "display_name";
+ char* ret_display_name = NULL;
+ const char* icon_path = "icon_path";
+ char* ret_icon_path = NULL;
+ const char* domain_name = "domain_name";
+ char* ret_domain_name = NULL;
+ const char* email_address = "email_address";
+ char* ret_email_address = NULL;
+ const char* source = "source";
+ char* ret_source = NULL;
+ const char* key = "key";
+ const char* value = "value";
+ char* ret_value = NULL;
+ const char* user_text = "user_text";
+ char* ret_user_text = NULL;
+ const char* access_token = "access_token";
+ char* ret_access_token = NULL;
+ const account_auth_type_e auth_type = ACCOUNT_AUTH_TYPE_OAUTH;
+ const account_auth_type_e ret_auth_type = 0;
+ const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+ const account_capability_state_e ret_capability_state = 0;
+ const account_secrecy_state_e secrecy_state = ACCOUNT_SECRECY_VISIBLE;
+ const account_secrecy_state_e ret_secrecy_state = 0;
+ const account_sync_state_e sync_state = ACCOUNT_SYNC_STATUS_OFF;
+ const account_sync_state_e ret_sync_state = 0;
+ account_h ret_account = NULL;
+ int i = -1;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_display_name(account, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_icon_path(account, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_domain_name(account, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_email_address(account, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_source(account, source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_access_token(account, access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(account, i, i*10);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ ret = account_set_auth_type(account, auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_secret(account, secrecy_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_sync_support(account, sync_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_destroy(account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_create(&ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_user_name(ret_account, &ret_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_name, user_name), 0);
+ _account_free_text(ret_user_name);
+
+ ret = account_get_package_name(ret_account, &ret_package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_package_name, package_name), 0);
+ _account_free_text(ret_package_name);
+
+ ret = account_get_display_name(ret_account, &ret_display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_display_name, display_name), 0);
+ _account_free_text(ret_display_name);
+
+ ret = account_get_icon_path(ret_account, &ret_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_icon_path, icon_path), 0);
+ _account_free_text(ret_icon_path);
+
+ ret = account_get_domain_name(ret_account, &ret_domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_domain_name, domain_name), 0);
+ _account_free_text(ret_domain_name);
+
+ ret = account_get_email_address(ret_account, &ret_email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_email_address, email_address), 0);
+ _account_free_text(ret_email_address);
+
+ ret = account_get_source(ret_account, &ret_source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_source, source), 0);
+ _account_free_text(ret_source);
+
+ ret = account_get_custom(ret_account, key, &ret_value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_value, value), 0);
+ _account_free_text(ret_value);
+
+ ret = account_get_capability(ret_account, contact_capability, &ret_capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_capability_state, capability_state);
+
+ ret = account_get_access_token(ret_account, &ret_access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_access_token, access_token), 0);
+ _account_free_text(ret_access_token);
+
+ for (i = 0; i < 5; i++){
+ ret = account_get_user_text(ret_account, i, &ret_user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_text, user_text), 0);
+ _account_free_text(ret_user_text);
+ }
+
+ for (i = 0; i < 5; i++){
+ int ret_user_int = -1;
+ ret = account_get_user_int(ret_account, i, &ret_user_int);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_user_int, i*10);
+ }
+
+ ret = account_get_auth_type(ret_account, &ret_auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_auth_type, auth_type);
+
+ ret = account_get_secret(ret_account, &ret_secrecy_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_secrecy_state, secrecy_state);
+
+ ret = account_get_sync_support(ret_account, &ret_sync_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_sync_state, sync_state);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_insert_to_db_n(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_insert_to_db(NULL, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_insert_to_db(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_display_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* display_name = "display_name";
+
+ ret = account_set_display_name(account, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_display_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* display_name = "display_name";
+
+ ret = account_set_display_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_display_name(NULL, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_user_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_user_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_user_name(NULL, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_icon_path_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* icon_path = "icon_path";
+
+ ret = account_set_icon_path(account, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_icon_path_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* icon_path = "icon_path";
+
+ ret = account_set_icon_path(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_icon_path(NULL, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_domain_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* domain_name = "domain_name";
+
+ ret = account_set_domain_name(account, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_domain_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* domain_name = "domain_name";
+
+ ret = account_set_domain_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_domain_name(NULL, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_email_address_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* email_address = "email_address";
+
+ ret = account_set_email_address(account, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_email_address_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* email_address = "email_address";
+
+ ret = account_set_email_address(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_email_address(NULL, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_source_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* source = "source";
+
+ ret = account_set_source(account, source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_source_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* source = "source";
+
+ ret = account_set_source(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_source(NULL, source);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_custom_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* key = "key";
+ const char* value = "value";
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_custom_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* key = "key";
+ const char* value = "value";
+
+ ret = account_set_custom(account, NULL, value);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_custom(account, key, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_custom(NULL, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_custom_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* key = "key";
+ const char* value = "value";
+ char* ret_value = NULL;
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_custom(account, key, &ret_value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_value, value), 0);
+ _account_free_text(ret_value);
+
+ return 0;
+}
+
+int utc_account_get_custom_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ char* returned_val = NULL;
+
+ ret = account_get_custom(account, NULL, &returned_val);
+ free(returned_val);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool account_custom_cb_func (char* key, char* value, void *user_data) {
+ const char* original_value = (const char*)user_data;
+ if(strcmp(value, original_value) == 0) {
+ _is_fail = false;
+ }
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+
+ return true;
+}
+
+int utc_account_get_custom_all_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* key = "key";
+ const char* value = "value";
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+ ret = account_get_custom_all(account, account_custom_cb_func, value);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ return 0;
+}
+
+int utc_account_get_custom_all_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_custom_all(account, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_custom_all(NULL, account_custom_cb_func, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_package_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_package_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_package_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_package_name(NULL, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_access_token_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* access_token = "access_token";
+
+ ret = account_set_access_token(account, access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_access_token_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_access_token(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_auth_type_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_auth_type(account, ACCOUNT_AUTH_TYPE_OAUTH);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_auth_type_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_auth_type(account, -999);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_auth_type(NULL, ACCOUNT_AUTH_TYPE_OAUTH);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_secret_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_secret(account, ACCOUNT_SECRECY_INVISIBLE);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_secret_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_secret(account, -999);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_secret(NULL, ACCOUNT_SECRECY_INVISIBLE);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_sync_support_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_sync_support(account, ACCOUNT_SYNC_STATUS_IDLE);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_set_sync_support_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_sync_support(account, -999);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_sync_support(NULL, ACCOUNT_SYNC_STATUS_IDLE);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_user_text_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* user_text = "user_text";
+
+ int i;
+ for ( i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ return 0;
+}
+
+int utc_account_set_user_text_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* user_text = "user_text";
+
+ int i;
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+ }
+ ret = account_set_user_text(account, 100, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_user_text(NULL, 1, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_user_int_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ int i;
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(account, i, 999);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ return 0;
+}
+
+int utc_account_set_user_int_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ int i;
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(NULL, i, 999);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+ }
+ ret = account_set_user_int(account, 100, 999);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_set_capability_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_capability(account, contact_capability, ACCOUNT_CAPABILITY_ENABLED);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_set_capability_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_capability(NULL, contact_capability, ACCOUNT_CAPABILITY_ENABLED);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_capability(account, NULL, ACCOUNT_CAPABILITY_ENABLED);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_set_capability(account, contact_capability, -1);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool capability_cb_func (const char* capability_type, account_capability_state_e capability_state, void *user_data) {
+ account_capability_state_e* _capability_state = (account_capability_state_e*)user_data;
+ if(capability_state == *_capability_state)
+ _is_fail = false;
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+
+ return true;
+}
+
+int utc_account_get_capability_all_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+ ret = account_get_capability_all(account, capability_cb_func, &capability_state);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ return 0;
+}
+
+int utc_account_get_capability_all_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_capability_all(NULL, capability_cb_func, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_capability_all(account, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_display_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ const char* display_name = "display_name";
+ char * ret_display_name = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_display_name(account, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_display_name(account, &ret_display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_display_name, display_name), 0);
+ _account_free_text(ret_display_name);
+
+ return 0;
+}
+
+int utc_account_get_display_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ char * display_name;
+
+ ret = account_get_display_name(NULL, &display_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_display_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_account_id_p(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret_account_id = -2;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_account_id(account, &ret_account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(account_id, ret_account_id);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_get_account_id_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+
+ ret = account_get_account_id(NULL, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_account_id(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_user_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_user_name;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_user_name(account, &ret_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_name, user_name), 0);
+ _account_free_text(ret_user_name);
+
+ return 0;
+}
+
+int utc_account_get_user_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ char *get_user_name;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_user_name(NULL, &get_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_user_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_icon_path_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_icon_path = NULL;
+ const char* icon_path = "icon_path";
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_icon_path(account, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_icon_path(account, &ret_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_icon_path, icon_path), 0);
+ _account_free_text(ret_icon_path);
+
+ return 0;
+}
+
+int utc_account_get_icon_path_n(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_icon_path;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_icon_path(NULL, &ret_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_icon_path(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_domain_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_domain_name;
+ const char* domain_name = "domain_name";
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_domain_name(account, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_domain_name(account, &ret_domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_domain_name, domain_name), 0);
+ _account_free_text(ret_domain_name);
+
+ return 0;
+}
+
+int utc_account_get_domain_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ char *domain_name;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_domain_name(NULL, &domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_domain_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_email_address_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_email_address;
+ const char* email_address = "email_address";
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_email_address(account, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_email_address(account, &ret_email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_email_address, email_address), 0);
+ _account_free_text(ret_email_address);
+
+ return 0;
+}
+
+int utc_account_get_email_address_n(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_email_address;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_email_address(NULL, &ret_email_address);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_email_address(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_source_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_source = NULL;
+ const char* source = "source";
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_source(account, source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_source(account, &ret_source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_source, source), 0);
+ _account_free_text(ret_source);
+
+ return 0;
+}
+
+int utc_account_get_source_n(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_source = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_source(NULL, &ret_source);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_source(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_package_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_package_name = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_package_name(account, &ret_package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_package_name, package_name), 0);
+ _account_free_text(ret_package_name);
+
+ return 0;
+}
+
+int utc_account_get_package_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_package_name = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_package_name(NULL, &ret_package_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_package_name(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_access_token_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_access_token = NULL;
+ const char* access_token = "access_token";
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_access_token(account, access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_access_token(account, &ret_access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(access_token, ret_access_token), 0);
+ _account_free_text(ret_access_token);
+
+ return 0;
+}
+
+int utc_account_get_access_token_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ char *ret_access_token = NULL;
+
+ ret = account_get_access_token(NULL, &ret_access_token);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_access_token(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_auth_type_p(void)
+{
+ assert(connected);
+ assert(created);
+ account_auth_type_e auth_type;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_auth_type(account, ACCOUNT_AUTH_TYPE_XAUTH);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_auth_type(account, &auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(auth_type, ACCOUNT_AUTH_TYPE_XAUTH);
+
+ return 0;
+}
+
+int utc_account_get_auth_type_n(void)
+{
+ assert(connected);
+ assert(created);
+ account_auth_type_e auth_type;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_auth_type(NULL, &auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_auth_type(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_secret_p(void)
+{
+ assert(connected);
+ assert(created);
+ account_secrecy_state_e secret;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_secret(account, ACCOUNT_SECRECY_INVISIBLE);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_secret(account, &secret);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(secret, ACCOUNT_SECRECY_INVISIBLE);
+
+ return 0;
+}
+
+int utc_account_get_sync_support_p(void)
+{
+ assert(connected);
+ assert(created);
+ account_sync_state_e sync_support;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_sync_support(account, ACCOUNT_SYNC_STATUS_IDLE);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_sync_support(account, &sync_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(sync_support, ACCOUNT_SYNC_STATUS_IDLE);
+
+ return 0;
+}
+
+int utc_account_get_secret_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ account_secrecy_state_e secret;
+
+ ret = account_get_secret(NULL, &secret);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_secret(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_sync_support_n(void)
+{
+ assert(connected);
+ assert(created);
+ account_sync_state_e sync_support;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_sync_support(NULL, &sync_support);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_sync_support(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_user_text_p(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_user_text = NULL;
+ const char* user_text = "user_text";
+ int ret = ACCOUNT_ERROR_NONE;
+
+ int i;
+ for ( i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+ for ( i = 0; i < 5; i++){
+ ret = account_get_user_text(account, i, &ret_user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_text, user_text), 0);
+ _account_free_text(ret_user_text);
+ }
+
+ return 0;
+}
+
+int utc_account_get_user_text_n(void)
+{
+ assert(connected);
+ assert(created);
+ char *ret_user_text = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_user_text(NULL, 0, &ret_user_text);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_user_text(account, 100, &ret_user_text);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_user_text(account, 0, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_user_int_p(void)
+{
+ assert(connected);
+ assert(created);
+ int user_int;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ int i;
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(account, i, i*10);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ for (i = 0; i < 5; i++){
+ ret = account_get_user_int(account, i, &user_int);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(user_int, i*10);
+ }
+
+ return 0;
+}
+
+int utc_account_get_user_int_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_user_int(NULL, 0, 100);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_user_int(account, 100, 100);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_user_int(account, 0, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool capability_call_back(const char* capability_type, account_capability_state_e capability_state, void *user_data)
+{
+ char* str = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ check_fail(user_data!=NULL);
+ check_fail(capability_type!=NULL);
+ account_capability_state_e _capability_state = ACCOUNT_CAPABILITY_ENABLED;
+ account_h account_data = *((account_h*)user_data);
+ const char* capability = contact_capability;
+
+ ret = account_get_package_name(account_data, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, package_name)==0);
+
+ ret = account_get_user_name(account_data, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, user_name)==0);
+
+ check_fail(strcmp(capability_type, capability)==0);
+ ret = account_get_capability(account_data, capability, &_capability_state);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(_capability_state == capability_state);
+
+ _is_fail = false;
+
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+
+ return 0;
+}
+
+int utc_account_get_capability_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ account_capability_state_e value;
+
+ ret = account_set_capability(account, contact_capability, ACCOUNT_CAPABILITY_ENABLED);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_capability(account, contact_capability, &value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(value, ACCOUNT_CAPABILITY_ENABLED);
+
+ return 0;
+}
+
+int utc_account_get_capability_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ account_capability_state_e value;
+
+ ret = account_get_capability(NULL, contact_capability, &value);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_capability(account, NULL, &value);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_get_capability(account, contact_capability, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool account_call_back(account_h account, void *user_data)
+{
+ const char* key = "key";
+ char* str = NULL;
+ char* comparison_str = NULL;
+ int value = -1;
+ int comparison_value = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ int i = -1;
+ check_fail(user_data!=NULL);
+ account_h _account = *((account_h*)user_data);
+
+ ret = account_get_package_name(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_package_name(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_user_name(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_user_name(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_display_name(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_display_name(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_icon_path(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_icon_path(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_domain_name(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_domain_name(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_email_address(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_email_address(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_email_address(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_email_address(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_source(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_source(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_custom(_account, key, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_custom(account, key, &comparison_str);
+ check_fail_eq(ret, ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_capability(_account, contact_capability, &value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_capability(account, contact_capability, &comparison_value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(value == comparison_value);
+
+ ret = account_get_access_token(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_access_token(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ for (i = 0; i < 5; i++){
+ ret = account_get_user_text(_account, i, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_user_text(account, i, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+ }
+
+ for (i = 0; i < 5; i++){
+ ret = account_get_user_int(_account, i, &value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_user_int(account, i, &comparison_value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(value == comparison_value);
+ }
+
+ ret = account_get_auth_type(_account, &value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_auth_type(account, &comparison_value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(value == comparison_value);
+
+ ret = account_get_secret(_account, &value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_secret(account, &comparison_value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(value == comparison_value);
+
+ ret = account_get_sync_support(_account, &value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_sync_support(account, &comparison_value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(value == comparison_value);
+
+ _is_fail = false;
+
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+
+ return true;
+}
+
+int utc_account_foreach_account_from_db_p(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+ char* ret_user_name = NULL;
+ const char* display_name = "display_name";
+ const char* icon_path = "icon_path";
+ const char* domain_name = "domain_name";
+ const char* email_address = "email_address";
+ const char* source = "source";
+ const char* key = "key";
+ const char* value = "value";
+ const char* user_text = "user_text";
+ const char* access_token = "access_token";
+ const account_auth_type_e auth_type = ACCOUNT_AUTH_TYPE_OAUTH;
+ const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+ const account_secrecy_state_e secrecy_state = ACCOUNT_SECRECY_VISIBLE;
+ const account_sync_state_e sync_state = ACCOUNT_SYNC_STATUS_OFF;
+ int i = -1;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_display_name(account, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_icon_path(account, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_domain_name(account, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_email_address(account, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_source(account, source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_access_token(account, access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(account, i, i*10);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ ret = account_set_auth_type(account, auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_secret(account, secrecy_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_sync_support(account, sync_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_foreach_account_from_db(account_call_back, &account);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ return 0;
+}
+
+int utc_account_foreach_account_from_db_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_foreach_account_from_db(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_query_account_by_account_id_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+ account_h ret_account = NULL;
+ char* ret_user_name = NULL;
+ char* ret_package_name = NULL;
+ account_capability_state_e ret_capability_type = 0;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, ACCOUNT_CAPABILITY_ENABLED);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_create(&ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ ret = account_get_user_name(ret_account, &ret_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ ret = account_get_package_name(ret_account, &ret_package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ ret = account_get_capability(ret_account, contact_capability, &ret_capability_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_name, user_name), 0);
+ assert_eq(strcmp(ret_package_name, package_name), 0);
+ assert_eq(ret_capability_type, ACCOUNT_CAPABILITY_ENABLED);
+ _account_free_text(ret_user_name);
+ _account_free_text(ret_package_name);
+ ret = account_destroy(ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_query_account_by_account_id_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_query_account_by_account_id(-999, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_query_account_by_user_name_p(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+ char* ret_user_name = NULL;
+ const char* display_name = "display_name";
+ const char* icon_path = "icon_path";
+ const char* domain_name = "domain_name";
+ const char* email_address = "email_address";
+ const char* source = "source";
+ const char* key = "key";
+ const char* value = "value";
+ const char* user_text = "user_text";
+ const char* access_token = "access_token";
+ const account_auth_type_e auth_type = ACCOUNT_AUTH_TYPE_OAUTH;
+ const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+ const account_secrecy_state_e secrecy_state = ACCOUNT_SECRECY_VISIBLE;
+ const account_sync_state_e sync_state = ACCOUNT_SYNC_STATUS_OFF;
+ int i = -1;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_display_name(account, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_icon_path(account, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_domain_name(account, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_email_address(account, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_source(account, source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_access_token(account, access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(account, i, i*10);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ ret = account_set_auth_type(account, auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_secret(account, secrecy_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_sync_support(account, sync_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_query_account_by_user_name(account_call_back, user_name, &account);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_query_account_by_user_name_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_query_account_by_user_name(account_call_back, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_query_account_by_user_name(NULL, user_name, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_query_account_by_package_name_p(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+ char* ret_user_name = NULL;
+ const char* display_name = "display_name";
+ const char* icon_path = "icon_path";
+ const char* domain_name = "domain_name";
+ const char* email_address = "email_address";
+ const char* source = "source";
+ const char* key = "key";
+ const char* value = "value";
+ const char* user_text = "user_text";
+ const char* access_token = "access_token";
+ const account_auth_type_e auth_type = ACCOUNT_AUTH_TYPE_OAUTH;
+ const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+ const account_secrecy_state_e secrecy_state = ACCOUNT_SECRECY_VISIBLE;
+ const account_sync_state_e sync_state = ACCOUNT_SYNC_STATUS_OFF;
+ int i = -1;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_display_name(account, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_icon_path(account, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_domain_name(account, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_email_address(account, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_source(account, source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_access_token(account, access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(account, i, i*10);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ ret = account_set_auth_type(account, auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_secret(account, secrecy_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_sync_support(account, sync_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_query_account_by_package_name(account_call_back, package_name, &account);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_query_account_by_package_name_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_query_account_by_package_name(account_call_back, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_query_account_by_package_name(NULL, package_name, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_query_account_by_capability_p(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+ char* ret_user_name = NULL;
+ const char* display_name = "display_name";
+ const char* icon_path = "icon_path";
+ const char* domain_name = "domain_name";
+ const char* email_address = "email_address";
+ const char* source = "source";
+ const char* key = "key";
+ const char* value = "value";
+ const char* user_text = "user_text";
+ const char* access_token = "access_token";
+ const account_auth_type_e auth_type = ACCOUNT_AUTH_TYPE_OAUTH;
+ const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+ const account_secrecy_state_e secrecy_state = ACCOUNT_SECRECY_VISIBLE;
+ const account_sync_state_e sync_state = ACCOUNT_SYNC_STATUS_OFF;
+ int i = -1;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_display_name(account, display_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_icon_path(account, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_domain_name(account, domain_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_email_address(account, email_address);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_source(account, source);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_custom(account, key, value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_access_token(account, access_token);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_text(account, i, user_text);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ for (i = 0; i < 5; i++){
+ ret = account_set_user_int(account, i, i*10);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ }
+
+ ret = account_set_auth_type(account, auth_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_secret(account, secrecy_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_sync_support(account, sync_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_query_account_by_capability(account_call_back, contact_capability, capability_state, &account);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_query_account_by_capability_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_query_account_by_capability(NULL, contact_capability, ACCOUNT_CAPABILITY_ENABLED, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_query_account_by_capability(account_call_back, NULL, ACCOUNT_CAPABILITY_ENABLED, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_query_account_by_capability(account_call_back, contact_capability, -1, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool account_cb_func(account_h account, void *user_data) {
+ char* str = NULL;
+ char* comparison_str = NULL;
+ int value = -1;
+ int comparison_value = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ check_fail(user_data!=NULL);
+ account_h _account = *((account_h*)user_data);
+
+ ret = account_get_package_name(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_package_name(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_user_name(_account, &str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_user_name(account, &comparison_str);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(str, comparison_str)==0);
+ _account_free_text(str);
+ _account_free_text(comparison_str);
+
+ ret = account_get_capability(_account, contact_capability, &value);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_get_capability(account, contact_capability, &comparison_value);
+ check_fail_eq(ret, ACCOUNT_ERROR_NONE);
+ check_fail(value == comparison_value);
+
+ _is_fail = false;
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+
+ return true;
+}
+
+int utc_account_query_account_by_capability_type_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, ACCOUNT_CAPABILITY_ENABLED);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_query_account_by_capability_type(account_cb_func, contact_capability, &account);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_query_account_by_capability_type_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* type = "type";
+
+ ret = account_query_account_by_capability_type(NULL, type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_query_account_by_capability_type(account_cb_func, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_query_capability_by_account_id_p(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+ account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_query_capability_by_account_id(capability_call_back, account_id, &account);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_query_capability_by_account_id_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_query_capability_by_account_id(capability_call_back, -1, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_query_capability_by_account_id(NULL, 1, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_get_total_count_from_db_p(void)
+{
+ assert(connected);
+ int count = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_total_count_from_db(&count);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_get_total_count_from_db_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_get_total_count_from_db(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_update_sync_status_by_id_p(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = -1;
+ account_h ret_account = NULL;
+ account_sync_state_e sync_state = -1;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_update_sync_status_by_id(account_id, ACCOUNT_SYNC_STATUS_IDLE);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_create(&ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_sync_support(ret_account, &sync_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(sync_state, ACCOUNT_SYNC_STATUS_IDLE);
+
+ ret = account_destroy(ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_update_sync_status_by_id_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_update_sync_status_by_id(-1, ACCOUNT_SYNC_STATUS_IDLE);
+ assert_neq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_id_p(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_id_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_delete_from_db_by_id(-1);
+ assert_neq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_user_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_user_name(user_name, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_user_name_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_delete_from_db_by_user_name(NULL, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_package_name_p(void)
+{
+ assert(connected);
+ assert(created);
+
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_package_name(package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_package_name_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_delete_from_db_by_package_name(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_package_name_without_permission_p(void)
+{
+ assert(connected);
+ assert(created);
+
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_package_name_without_permission(package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_delete_from_db_by_package_name_without_permission_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_delete_from_db_by_package_name_without_permission(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_id_p(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* update_user_name = "update_user_name";
+ char* ret_user_name = NULL;
+ account_h ret_account = NULL;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_user_name(account, update_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_update_to_db_by_id(account, account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_create(&ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_user_name(account, &ret_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_name, update_user_name), 0);
+
+ _account_free_text(ret_user_name);
+ ret = account_destroy(ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_id_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_update_to_db_by_id(account, -1);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_user_name_p(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ int value = -1;
+ char* ret_user_name = NULL;
+ account_h ret_account = NULL;
+ account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_capability(account, contact_capability, capability_state);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_update_to_db_by_user_name(account, user_name, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_create(&ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_user_name(account, &ret_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_name, user_name), 0);
+ _account_free_text(ret_user_name);
+
+ ret = account_get_capability(account, contact_capability, &value);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(value, ACCOUNT_CAPABILITY_ENABLED);
+
+ ret = account_destroy(ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_user_name_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_update_to_db_by_user_name(account, NULL, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+
+
+int utc_account_subscribe_create_p(void)
+{
+ assert(connected);
+ account_subscribe_h account_subscribe;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_subscribe_create(&account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_subscribe_notification(account_subscribe, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_unsubscribe_notification(account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_subscribe_create_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_subscribe_create(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+
+int utc_account_subscribe_notification_p(void)
+{
+ assert(connected);
+ account_subscribe_h account_subscribe;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_subscribe_create(&account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_subscribe_notification(account_subscribe, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_unsubscribe_notification(account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_subscribe_notification_n(void)
+{
+ assert(connected);
+ account_subscribe_h account_subscribe;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_subscribe_create(&account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_subscribe_notification(NULL, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_subscribe_notification(account_subscribe, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_unsubscribe_notification(account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_unsubscribe_notification_p(void)
+{
+ assert(connected);
+ account_subscribe_h account_subscribe;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_subscribe_create(&account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_subscribe_notification(account_subscribe, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_unsubscribe_notification(account_subscribe);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_unsubscribe_notification_n(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_unsubscribe_notification(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_create_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_create_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_create(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_destroy_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_destroy_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_destroy(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_set_app_id_p(void)
+{
+ int ret = account_type_set_app_id(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_app_id_n(void)
+{
+ int ret = account_type_set_app_id(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_app_id_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "application_id";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_app_id_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "application_id";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(NULL, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_set_app_id_internal(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_app_id_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "application_id";
+ char* ret_app_id = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_app_id(account_type, &ret_app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_app_id, app_id), 0);
+ _account_free_text(ret_app_id);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_app_id_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_app_id = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_app_id(NULL, &ret_app_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_app_id(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_icon_path_p(void)
+{
+ int ret = account_type_set_icon_path(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_icon_path_n(void)
+{
+ int ret = account_type_set_icon_path(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_icon_path_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* icon_path = "icon_path";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(account_type, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_icon_path_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* icon_path = "icon_path";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(NULL, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_set_icon_path_internal(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_icon_path_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_icon_path = NULL;
+ const char* icon_path = "icon_path";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(account_type, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_icon_path(account_type, &ret_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_icon_path, icon_path), 0);
+ _account_free_text(ret_icon_path);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_icon_path_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_icon_path = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_icon_path(NULL, &ret_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_icon_path(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_label_p(void)
+{
+ int ret = account_type_set_label(NULL, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_label_n(void)
+{
+ int ret = account_type_set_label(NULL, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_label_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* label = "label";
+ const char* locale = "locale";
+ char* ret_label = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_label_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* label = "label";
+ const char* locale = "locale";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(NULL, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_set_label_internal(account_type, NULL, locale);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_set_label_internal(account_type, label, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_label_by_locale_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* label = "label";
+ const char* locale = "locale";
+ char* ret_label = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_label_by_locale(account_type, locale, &ret_label);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_label, label), 0);
+ _account_free_text(ret_label);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_label_by_locale_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_label = NULL;
+ const char* locale = "locale";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_label_by_locale(NULL, locale, &ret_label);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_label_by_locale(account_type, locale, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+static bool account_label_cb_func(char* app_id, char* label, char* locale, void *user_data) {
+ //this callback function checks that query function implements normally through confirmming whether same labels or not.
+ if(user_data != NULL)
+ {
+ const char* _label = (const char*)user_data;
+ if(strcmp(label, _label)==0)
+ _is_fail = false;
+ }
+
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+ return TRUE;
+}
+
+int utc_account_type_get_label_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* label = "label";
+ const char* locale = "locale";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_type_get_label(account_type, account_label_cb_func, (void*)label);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_label_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_label(NULL, account_label_cb_func, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_label(account_type, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_multiple_account_support_p(void)
+{
+ int ret = account_type_set_multiple_account_support(NULL, true);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_multiple_account_support_n(void)
+{
+ int ret = account_type_set_multiple_account_support(NULL, true);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_multiple_account_support_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ int ret_val = -1;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_multiple_account_support_internal(account_type, true);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_multiple_account_support_internal_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_set_multiple_account_support_internal(NULL, true);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_get_multiple_account_support_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ int ret_val = 0;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_multiple_account_support_internal(account_type, true);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_multiple_account_support(account_type, &ret_val);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_val, true);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_multiple_account_support_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ bool ret_val = true;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_multiple_account_support(NULL, &ret_val);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_multiple_account_support(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+static bool provider_feature_cb_func(char* app_id, char* key, void* user_data) {
+ //this callback function checks that query function implements normally through confirmming whether same provider feature or not.
+ if(user_data != NULL)
+ {
+ const char* _capability = (const char*)user_data;
+ check_fail(strcmp(key, _capability)==0)
+ }
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+ _is_fail = false;
+
+ return TRUE;
+}
+
+int utc_account_type_set_provider_feature_p(void)
+{
+ int ret = account_type_set_provider_feature(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return TRUE;
+}
+
+int utc_account_type_set_provider_feature_n(void)
+{
+ int ret = account_type_set_provider_feature(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return TRUE;
+}
+
+int utc_account_type_set_provider_feature_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* provider_feature = "provider_feature";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, provider_feature);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_provider_feature_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* provider_feature = "provider_feature";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(NULL, provider_feature);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_set_provider_feature_internal(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_provider_feature_all_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* provider_feature = "provider_feature";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, provider_feature);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+// mainloop = g_main_loop_new(NULL, FALSE);
+// assert(mainloop);
+
+ ret = account_type_get_provider_feature_all(account_type, provider_feature_cb_func, (void *)provider_feature);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+// int timeout_id = g_timeout_add(3000, timeout_cb, mainloop);
+// g_main_loop_run(mainloop);
+// g_source_remove(timeout_id);
+ _is_fail = true;
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_provider_feature_all_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_provider_feature_all(NULL, provider_feature_cb_func, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_provider_feature_all(account_type, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_service_provider_id_p(void)
+{
+ int ret = account_type_set_service_provider_id(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_service_provider_id_n(void)
+{
+ int ret = account_type_set_service_provider_id(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_service_provider_id_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* service_provider_id = "service_provider_id";
+ char* ret_service_provider_id = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_service_provider_id_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* service_provider_id = "service_provider_id";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(NULL, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_set_service_provider_id_internal(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_service_provider_id_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* service_provider_id = "service_provider_id";
+ char* ret_service_provider_id = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_service_provider_id(account_type, &ret_service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_service_provider_id, service_provider_id), 0);
+ _account_free_text(ret_service_provider_id);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_service_provider_id_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_service_provider_id = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_service_provider_id(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_service_provider_id(NULL, &ret_service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_small_icon_path_p(void)
+{
+ int ret = account_type_set_small_icon_path(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_small_icon_path_n(void)
+{
+ int ret = account_type_set_small_icon_path(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_small_icon_path_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* small_icon_path = "small_icon_path";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(account_type, small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_set_small_icon_path_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* small_icon_path = "small_icon_path";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(NULL, small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_set_small_icon_path_internal(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_small_icon_path_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_small_icon_path = NULL;
+ const char* small_icon_path = "small_icon_path";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(account_type, small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_small_icon_path(account_type, &ret_small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_small_icon_path, small_icon_path), 0);
+ _account_free_text(ret_small_icon_path);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_get_small_icon_path_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* ret_small_icon_path = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_small_icon_path(NULL, &ret_small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_small_icon_path(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_insert_to_db_p(void)
+{
+ int ret = account_type_insert_to_db(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_insert_to_db_n(void)
+{
+ int ret = account_type_insert_to_db(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_insert_to_db_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ account_type_h ret_account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_type_id = -1;
+ const char* app_id = "app_id_insert_test";
+ char* ret_app_id = NULL;
+ const char* service_provider_id = TEST_PACKAGE_NAME;
+ char* ret_service_provider_id = NULL;
+ const char* icon_path = "icon_path";
+ char* ret_icon_path = NULL;
+ const char* small_icon_path = "small_icon_path";
+ char* ret_small_icon_path = NULL;
+ const bool multi_account_support = true;
+ bool ret_multi_account_support = false;
+ const char* label = "label";
+ char* ret_label = NULL;
+ const char* locale = "locale";
+ char* ret_capability = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(account_type, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(account_type, small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_multiple_account_support_internal(account_type, multi_account_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, contact_capability);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_create(&ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_by_app_id(app_id, &ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_app_id(ret_account_type, &ret_app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_app_id, app_id), 0);
+ _account_free_text(ret_app_id);
+
+ ret = account_type_get_service_provider_id(ret_account_type, &ret_service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_service_provider_id, service_provider_id), 0);
+ _account_free_text(ret_service_provider_id);
+
+ ret = account_type_get_icon_path(ret_account_type, &ret_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_icon_path, icon_path), 0);
+ _account_free_text(ret_icon_path);
+
+ ret = account_type_get_small_icon_path(account_type, &small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_small_icon_path, small_icon_path), 0);
+ _account_free_text(ret_small_icon_path);
+
+ ret = account_type_get_multiple_account_support(account_type, &ret_multi_account_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_multi_account_support, multi_account_support);
+
+ ret = account_type_get_label_by_locale(account_type, locale, &ret_label);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_label, label), 0);
+ _account_free_text(ret_label);
+
+ ret = account_type_get_provider_feature_all(account_type, provider_feature_cb_func, (void *)contact_capability);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ _is_fail = true;
+
+ ret = account_type_destroy(ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_insert_to_db_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_type_id = 0;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(NULL, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_insert_to_db_internal(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_update_to_db_by_app_id_p(void)
+{
+ int ret = account_type_update_to_db_by_app_id(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_update_to_db_by_app_id_n(void)
+{
+ int ret = account_type_update_to_db_by_app_id(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_update_to_db_by_app_id_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ account_type_h ret_account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_type_id = 0;
+ const char* app_id = "account_type_update_by_app_id";
+ char* ret_app_id = NULL;
+ const char* service_provider_id = TEST_PACKAGE_NAME;
+ char* ret_service_provider_id = NULL;
+ const char* icon_path = "icon_path";
+ const char* update_icon_path = "update_icon_path";
+ char* ret_icon_path = NULL;
+ const char* small_icon_path = "small_icon_path";
+ const char* update_small_icon_path = "update_small_icon_path";
+ char* ret_small_icon_path = NULL;
+ const bool multi_account_support = true;
+ const bool update_multi_account_support = false;
+ bool ret_multi_account_support = true;
+ const char* label = "label";
+ const char* update_label = "update_label";
+ char* ret_label = NULL;
+ const char* locale = "locale";
+ char* ret_capability = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_create(&ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(account_type, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(account_type, small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_multiple_account_support_internal(account_type, multi_account_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, contact_capability);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_by_app_id(app_id, &account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(account_type, update_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(account_type, update_small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_multiple_account_support_internal(account_type, update_multi_account_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, update_label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, calendar_capability);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_update_to_db_by_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_by_app_id(app_id, &ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_app_id(ret_account_type, &ret_app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_app_id, app_id), 0);
+ _account_free_text(ret_app_id);
+
+ ret = account_type_get_service_provider_id(ret_account_type, &ret_service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_service_provider_id, service_provider_id), 0);
+ _account_free_text(ret_service_provider_id);
+
+ ret = account_type_get_icon_path(ret_account_type, &ret_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_icon_path, update_icon_path), 0);
+ _account_free_text(ret_icon_path);
+
+ ret = account_type_get_small_icon_path(ret_account_type, &ret_small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_small_icon_path, update_small_icon_path), 0);
+ _account_free_text(ret_small_icon_path);
+
+ ret = account_type_get_multiple_account_support(ret_account_type, &ret_multi_account_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(ret_multi_account_support, update_multi_account_support);
+
+ ret = account_type_get_label_by_locale(account_type, locale, &ret_label);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_label, update_label), 0);
+ _account_free_text(ret_label);
+
+ ret = account_type_get_provider_feature_all(ret_account_type, provider_feature_cb_func, (void *)calendar_capability);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ _is_fail = true;
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_update_to_db_by_app_id_internal_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "small_icon_path";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_update_to_db_by_app_id_internal(NULL, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_update_to_db_by_app_id_internal(account_type, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_query_by_app_id_p(void)
+{
+ account_type_h account_type = NULL;
+ account_type_h ret_account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "account_type_query_by_app_id";
+ char* ret_app_id = NULL;
+ const char* service_provider_id = TEST_PACKAGE_NAME;
+ char* ret_service_provider_id = NULL;
+ int account_type_id = 0;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_create(&ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_by_app_id(app_id, &ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_get_app_id(ret_account_type, &ret_app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_app_id, app_id), 0);
+ _account_free_text(ret_app_id);
+
+ ret = account_type_get_service_provider_id(ret_account_type, &ret_service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_service_provider_id, service_provider_id), 0);
+ _account_free_text(ret_service_provider_id);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(ret_account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_type_query_by_app_id_n(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "account_type_query_by_app_id";
+
+ ret = account_type_query_by_app_id(app_id, &account_type);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_by_app_id(NULL, &account_type);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_query_by_app_id(app_id, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_type_query_app_id_exist_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "account_type_query_app_id_exist";
+ int a_type_id = -1;
+
+ ret = account_type_query_app_id_exist(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_RECORD_NOT_FOUND);
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &a_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_app_id_exist(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_query_app_id_exist_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_query_app_id_exist(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool account_type_for_query_by_provider_cb(account_type_h account_type, void *user_data)
+{
+ //this callback function checks that query function implements normally through confirmming whether same app_id or not.
+ int ret = ACCOUNT_ERROR_NONE;
+ account_type_h ret_account_type = NULL;
+ char* app_id = NULL;
+ char* ret_app_id = NULL;
+ char* service_provider_id = NULL;
+ char* ret_service_provider_id = NULL;
+ char* icon_path = NULL;
+ char* ret_icon_path = NULL;
+ char* small_icon_path = NULL;
+ char* ret_small_icon_path = NULL;
+ bool multi_account_support = true;
+ char* label = NULL;
+ char* ret_label = NULL;
+ const char* locale = "locale";
+ char* capability = "capability";
+ bool ret_multi_account_support = false;
+
+ check_fail(account_type != NULL && user_data != NULL && user_data != NULL);
+
+ ret_account_type = *((account_type_h*)user_data);
+
+ ret = account_type_get_app_id(account_type, &app_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_app_id(ret_account_type, &ret_app_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_app_id, app_id)==0);
+ _account_free_text(app_id);
+ _account_free_text(ret_app_id);
+
+ ret = account_type_get_service_provider_id(account_type, &service_provider_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_service_provider_id(ret_account_type, &ret_service_provider_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_service_provider_id, service_provider_id)==0);
+ _account_free_text(service_provider_id);
+ _account_free_text(ret_service_provider_id);
+
+ ret = account_type_get_icon_path(account_type, &icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_icon_path(ret_account_type, &ret_icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_icon_path, icon_path)==0);
+ _account_free_text(icon_path);
+ _account_free_text(ret_icon_path);
+
+ ret = account_type_get_small_icon_path(account_type, &small_icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_small_icon_path(ret_account_type, &ret_small_icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_small_icon_path, small_icon_path)==0);
+ _account_free_text(small_icon_path);
+ _account_free_text(ret_small_icon_path);
+
+ ret = account_type_get_multiple_account_support(account_type, &multi_account_support);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_multiple_account_support(ret_account_type, &ret_multi_account_support);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(ret_multi_account_support == multi_account_support);
+
+ ret = account_type_get_label_by_locale(account_type, locale, &label);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_label_by_locale(account_type, locale, &ret_label);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_label, label) == 0);
+ _account_free_text(label);
+ _account_free_text(ret_label);
+
+ _is_fail = true;
+ ret = account_type_get_provider_feature_all(account_type, provider_feature_cb_func, capability);
+ check_fail(_is_fail == false);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+
+ _is_fail = true;
+ ret = account_type_get_provider_feature_all(ret_account_type, provider_feature_cb_func, capability);
+ check_fail(_is_fail == false);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+
+ _is_fail = false;
+
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+
+ return true;
+}
+
+
+int utc_account_type_query_by_provider_feature_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "account_type_query_by_provider_feature";
+ const char* service_provider_id = TEST_PACKAGE_NAME;
+ const char* icon_path = "icon_path";
+ const char* small_icon_path = "small_icon_path";
+ const char* capability = "capability";
+ const bool multi_account_support = true;
+ const char* label = "label";
+ const char* locale = "locale";
+
+ int a_type_id = -1;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(account_type, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(account_type, small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_multiple_account_support_internal(account_type, multi_account_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, capability);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &a_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_by_provider_feature(account_type_for_query_by_provider_cb, capability, &account_type);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ _is_fail = true;
+
+ account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+
+int utc_account_type_query_by_provider_feature_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* key = contact_capability;
+
+ ret = account_type_query_by_provider_feature(account_type_for_query_by_provider_cb, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_query_by_provider_feature(NULL, key, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool account_type_for_query_by_app_id_cb(char* app_id, char* label, char* locale, void *user_data)
+{
+ //this callback function checks that query function implements normally through confirmming whether same label or not.
+ int ret = ACCOUNT_ERROR_NONE;
+ account_type_h account_type = NULL;
+ char* ret_label = NULL;
+
+ check_fail( app_id!=NULL && label!=NULL && locale!=NULL && user_data!=NULL );
+ account_type = *((account_type_h*)user_data);
+
+ ret = account_type_get_label_by_locale(account_type, locale, &ret_label);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_label, label) == 0);
+ _account_free_text(ret_label);
+
+ _is_fail = false;
+
+ return TRUE;
+}
+
+int utc_account_type_query_label_by_app_id_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ int a_type_id = -1;
+
+ const char* label_t = "label_test";
+ const char* locale_t = "locale_test";
+ const char* app_id = "account_type_query_label_by_app_id";
+ const char* service_provider_id = TEST_PACKAGE_NAME;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label_t, locale_t);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &a_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_label_by_app_id(account_type_for_query_by_app_id_cb, app_id, &account_type);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ _is_fail = true;
+
+ account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_query_label_by_app_id_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "account_type_query_label_by_app_id";
+
+ ret = account_type_query_label_by_app_id(NULL, app_id, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_query_label_by_app_id(account_type_for_query_by_app_id_cb, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_query_label_by_locale_p(void)
+{
+ account_type_h account_type = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* label = "label";
+ const char* locale = "locale";
+ const char* app_id = "account_type_query_label_by_locale";
+ char* ret_label = NULL;
+ int a_type_id = -1;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &a_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_label_by_locale(app_id, locale, &ret_label);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_label, label), 0);
+ _account_free_text(ret_label);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_query_label_by_locale_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "account_type_query_label_by_locale";
+ const char* locale = "locale";
+ char* ret_label = NULL;
+
+ ret = account_type_get_label_by_locale(NULL, locale, &ret_label);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_get_label_by_locale(app_id, locale, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_query_provider_feature_by_app_id_p(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ account_type_h account_type = NULL;
+ const char* app_id = "application_id";
+ const char* provider_feature = "provider_feature";
+ int account_type_id = -1;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, provider_feature);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_provider_feature_by_app_id(provider_feature_cb_func, app_id, (void *)provider_feature);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ _is_fail = true;
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_query_provider_feature_by_app_id_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* app_id = "application_id";
+
+ ret = account_type_query_provider_feature_by_app_id(NULL, app_id, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_query_provider_feature_by_app_id(provider_feature_cb_func, NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_query_supported_feature_p(void)
+{
+ account_type_h account_type = NULL;
+ bool ret = true;
+ int account_type_id = -1;
+ const char* app_id = "application_id";
+ const char* capability = "capability";
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, capability);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_supported_feature(app_id, capability);
+ assert_eq(ret, true);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_query_supported_feature_n(void)
+{
+ bool ret = true;
+ const char* app_id = "application_id";
+ const char* capability = "capability";
+
+ ret = account_type_query_supported_feature(NULL, capability);
+ assert_eq(ret, FALSE);
+ assert_eq(get_last_result(), ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_type_query_supported_feature(app_id, NULL);
+ assert_eq(ret, FALSE);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_id_ex_p(void)
+{
+ assert(connected);
+ assert(created);
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ char* update_user_name = "update_user_name";
+ char* ret_user_name = NULL;
+ account_h ret_account = NULL;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_user_name(account, update_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_update_to_db_by_id_ex(account, account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_create(&ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_user_name(account, &ret_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_name, update_user_name), 0);
+
+ _account_free_text(ret_user_name);
+ ret = account_destroy(ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_id_ex_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_update_to_db_by_id_ex(account, -1);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_id_without_permission_p(void)
+{
+ assert(connected);
+ assert(created);
+ account_h ret_account = NULL;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ const char* update_user_name = "update_user_name";
+ char* ret_user_name = NULL;
+
+ ret = account_set_user_name(account, user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_insert_to_db(account, &account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_user_name(account, update_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_set_package_name(account, package_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_update_to_db_by_id_without_permission(account, account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_create(&ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_query_account_by_account_id(account_id, &ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_get_user_name(ret_account, &ret_user_name);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+ assert_eq(strcmp(ret_user_name, update_user_name), 0);
+ _account_free_text(ret_user_name);
+
+ ret = account_destroy(ret_account);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_delete_from_db_by_id(account_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_update_to_db_by_id_without_permission_n(void)
+{
+ assert(connected);
+ assert(created);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_id = 2;
+
+ ret = account_update_to_db_by_id_without_permission(NULL, account_id);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ ret = account_update_to_db_by_id_without_permission(account, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+int utc_account_type_delete_by_app_id_p(void)
+{
+ int ret = account_type_delete_by_app_id(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_delete_by_app_id_n(void)
+{
+ int ret = account_type_delete_by_app_id(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_delete_by_app_id_internal_p(void)
+{
+ account_type_h account_type = NULL;
+ const char* app_id = "app_id_delete_test";
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_type_id = -1;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_app_id_exist(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_query_app_id_exist(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_RECORD_NOT_FOUND);
+
+ return 0;
+}
+
+int utc_account_type_delete_by_app_id_internal_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_delete_by_app_id_internal(NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+static bool account_type_cb_func(account_type_h account_type, void *user_data) {
+ //this callback function checks that query function implements normally through confirmming whether same app_id or not.
+ int ret = ACCOUNT_ERROR_NONE;
+ account_type_h ret_account_type = NULL;
+ char* app_id = NULL;
+ char* ret_app_id = NULL;
+ char* service_provider_id = NULL;
+ char* ret_service_provider_id = NULL;
+ char* icon_path = NULL;
+ char* ret_icon_path = NULL;
+ char* small_icon_path = NULL;
+ char* ret_small_icon_path = NULL;
+ bool multi_account_support = true;
+ char* label = NULL;
+ char* ret_label = NULL;
+ const char* locale = "locale";
+ char* capability = NULL;
+ char* ret_capability = NULL;
+ bool ret_multi_account_support = false;
+
+ check_fail(account_type != NULL && user_data != NULL && user_data != NULL);
+
+ ret_account_type = *((account_type_h*)user_data);
+
+ ret = account_type_get_app_id(account_type, &app_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ if( strcmp(app_id, TEST_PACKAGE_NAME)==0 )
+ {
+ _is_fail=false;
+ return true;
+ }
+ ret = account_type_get_app_id(ret_account_type, &ret_app_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_app_id, app_id)==0);
+ _account_free_text(app_id);
+ _account_free_text(ret_app_id);
+
+ ret = account_type_get_service_provider_id(account_type, &service_provider_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_service_provider_id(ret_account_type, &ret_service_provider_id);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_service_provider_id, service_provider_id)==0);
+ _account_free_text(service_provider_id);
+ _account_free_text(ret_service_provider_id);
+
+ ret = account_type_get_icon_path(account_type, &icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_icon_path(ret_account_type, &ret_icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_icon_path, icon_path)==0);
+ _account_free_text(icon_path);
+ _account_free_text(ret_icon_path);
+
+ ret = account_type_get_small_icon_path(account_type, &small_icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_small_icon_path(ret_account_type, &ret_small_icon_path);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_small_icon_path, small_icon_path)==0);
+ _account_free_text(small_icon_path);
+ _account_free_text(ret_small_icon_path);
+
+ ret = account_type_get_multiple_account_support(account_type, &multi_account_support);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_multiple_account_support(ret_account_type, &ret_multi_account_support);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(ret_multi_account_support == multi_account_support);
+
+ ret = account_type_get_label_by_locale(account_type, locale, &label);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ ret = account_type_get_label_by_locale(account_type, locale, &ret_label);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(strcmp(ret_label, label) == 0);
+ _account_free_text(label);
+ _account_free_text(ret_label);
+
+ _is_fail = true;
+ ret = account_type_get_provider_feature_all(account_type, provider_feature_cb_func, (void *)contact_capability);
+
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(_is_fail == false);
+
+ _is_fail = true;
+ ret = account_type_get_provider_feature_all(account_type, provider_feature_cb_func, (void *)contact_capability);
+ check_fail(ret == ACCOUNT_ERROR_NONE);
+ check_fail(_is_fail == false);
+
+ _is_fail = false;
+
+// g_main_loop_quit(mainloop);
+// mainloop = NULL;
+
+ return true;
+}
+
+int utc_account_type_foreach_account_type_from_db_p(void)
+{
+ assert(connected);
+ int ret = ACCOUNT_ERROR_NONE;
+ int account_type_id = -1;
+ account_type_h account_type = NULL;
+ const char* app_id = "account_type_foreach_account_type_from_db";
+ char* ret_app_id = NULL;
+ const char* service_provider_id = TEST_PACKAGE_NAME;
+ char* ret_service_provider_id = NULL;
+ const char* icon_path = "icon_path";
+ char* ret_icon_path = NULL;
+ const char* small_icon_path = "small_icon_path";
+ char* ret_small_icon_path = NULL;
+ const bool multi_account_support = true;
+ bool ret_multi_account_support = true;
+ const char* label = "label";
+ char* ret_label = NULL;
+ const char* locale = "locale";
+ char* ret_capability = NULL;
+
+ ret = account_type_create(&account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_app_id_internal(account_type, app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_service_provider_id_internal(account_type, service_provider_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_icon_path_internal(account_type, icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_small_icon_path_internal(account_type, small_icon_path);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_multiple_account_support_internal(account_type, multi_account_support);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_label_internal(account_type, label, locale);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_set_provider_feature_internal(account_type, contact_capability);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ ret = account_type_insert_to_db_internal(account_type, &account_type_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ _is_fail = true;
+
+ ret = account_type_foreach_account_type_from_db(account_type_cb_func, &account_type);
+// assert_eq(_is_fail, false);
+ is_callback_fail();
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ _is_fail = true;
+
+ ret = account_type_destroy(account_type);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ account_type_delete_by_app_id_internal(app_id);
+ assert_eq(ret, ACCOUNT_ERROR_NONE);
+
+ return 0;
+}
+
+int utc_account_type_foreach_account_type_from_db_n(void)
+{
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_type_foreach_account_type_from_db(NULL, NULL);
+ assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
diff --git a/doc/account_doc.h b/doc/account_doc.h
new file mode 100644
index 0000000..0060e5c
--- /dev/null
+++ b/doc/account_doc.h
@@ -0,0 +1,33 @@
+/*
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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 __ACCOUNT_DOC_H__
+#define __ACCOUNT_DOC_H__
+
+/**
+ * @defgroup CAPI_ACCOUNT_FRAMEWORK Account
+ * @brief The Account.
+ *
+ * @section CAPI_ACCOUNT_MODULE_OVERVIEW Overview
+ * The account.
+ *
+*/
+
+#endif /* __ACCOUNT_DOC_H__ */
diff --git a/doc/account_manager_doc.h b/doc/account_manager_doc.h
index 68d9ce3..9d3540d 100644
--- a/doc/account_manager_doc.h
+++ b/doc/account_manager_doc.h
@@ -18,12 +18,12 @@
*
*/
-#ifndef __ACCOUNT_H__
-#define __ACCOUNT_H__
+#ifndef __ACCOUNT_MANAGER_DOC_H__
+#define __ACCOUNT_MANAGER_DOC_H__
/**
* @defgroup CAPI_ACCOUNT_MANAGER_MODULE Account Manager
- * @ingroup CAPI_SOCIAL_FRAMEWORK
+ * @ingroup CAPI_ACCOUNT_FRAMEWORK
* @brief The account APIs provide CRUD (Create, Read, Update, Delete) account management functionality.
*
* @section CAPI_ACCOUNT_MANAGER_HEADER Required Header
@@ -41,4 +41,4 @@
* - Read an account or account provider with some filter
*/
-#endif /* __ACCOUNT_H__ */
+#endif /* __ACCOUNT_MANAGER_DOC_H__ */
diff --git a/doc_prod/account_manager_doc.h b/doc_prod/account_manager_doc.h
new file mode 100644
index 0000000..8b0cca8
--- /dev/null
+++ b/doc_prod/account_manager_doc.h
@@ -0,0 +1,44 @@
+/*
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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 __ACCOUNT_PRODUCT_H__
+#define __ACCOUNT_PRODUCT_H__
+
+/**
+ * @defgroup CAPI_ACCOUNT_MANAGER_MODULE Account Manager
+ * @ingroup CAPI_SOCIAL_FRAMEWORK
+ * @brief The account APIs provide CRUD (Create, Read, Update, Delete) account management functionality.
+ *
+ * @section CAPI_ACCOUNT_MANAGER_HEADER Required Header
+ * \#include <account_product.h>
+ *
+ * @section CAPI_ACCOUNT_MANAGER_MODULE_OVERVIEW Overview
+ * The account APIs is separated into two major sections:
+ * 1. Registering an account provider while an application is installed. This information will be used for the Add account screen.
+ * 2. Adding an account information when an application signs in successfully to share the account information to the Tizen system. This information will be shown in the Tizen settings account menu.
+
+ * The APIs of both of the sections consist of the following functionality:
+ * - Create an account or account provider
+ * - Update an account or account provider(Only available for the creator)
+ * - Delete an account or account provider(Only available for the creator)
+ * - Read an account or account provider with some filter
+*/
+
+#endif /* __ACCOUNT_PRODUCT_H__ */
diff --git a/include/account-error.h b/include/account-error.h
index 592b214..c61e298 100755..100644
--- a/include/account-error.h
+++ b/include/account-error.h
@@ -2,8 +2,6 @@
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
- *
* 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
@@ -42,30 +40,30 @@ extern "C"
/**
* @brief Enumerations of error codes for ACCOUNT APIs.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef enum
{
- ACCOUNT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- ACCOUNT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- ACCOUNT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ ACCOUNT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ ACCOUNT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ ACCOUNT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- ACCOUNT_ERROR_DUPLICATED = TIZEN_ERROR_ACCOUNT | 0x01, /**< Same user name exists in your application */
- ACCOUNT_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< Empty data */
+ ACCOUNT_ERROR_DUPLICATED = TIZEN_ERROR_ACCOUNT | 0x01, /**< Same user name exists in your application */
+ ACCOUNT_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< Empty data */
- ACCOUNT_ERROR_RECORD_NOT_FOUND = TIZEN_ERROR_ACCOUNT | 0x03, /**< Related record does not exist */
- ACCOUNT_ERROR_DB_FAILED = TIZEN_ERROR_ACCOUNT | 0x04, /**< DB operation failed */
- ACCOUNT_ERROR_DB_NOT_OPENED = TIZEN_ERROR_ACCOUNT | 0x05, /**< DB is not connected */
- ACCOUNT_ERROR_QUERY_SYNTAX_ERROR = TIZEN_ERROR_ACCOUNT | 0x06, /**< DB query syntax error */
- ACCOUNT_ERROR_ITERATOR_END = TIZEN_ERROR_ACCOUNT | 0x07, /**< Iterator has reached the end */
- ACCOUNT_ERROR_NOTI_FAILED = TIZEN_ERROR_ACCOUNT | 0x08, /**< Notification failed */
- ACCOUNT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
- ACCOUNT_ERROR_XML_PARSE_FAILED = TIZEN_ERROR_ACCOUNT | 0x0a, /**< XML parse failed */
- ACCOUNT_ERROR_XML_FILE_NOT_FOUND = TIZEN_ERROR_ACCOUNT | 0x0b, /**< XML file does not exist */
- ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL = TIZEN_ERROR_ACCOUNT | 0x0c, /**< Subscription failed */
- ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER = TIZEN_ERROR_ACCOUNT | 0x0d, /**< Account provider is not registered */
- ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE = TIZEN_ERROR_ACCOUNT | 0x0e, /**< Multiple accounts are not supported */
- ACCOUNT_ERROR_DATABASE_BUSY = TIZEN_ERROR_ACCOUNT | 0x10, /**< SQLite busy handler expired */
+ ACCOUNT_ERROR_RECORD_NOT_FOUND = TIZEN_ERROR_ACCOUNT | 0x03, /**< Related record does not exist */
+ ACCOUNT_ERROR_DB_FAILED = TIZEN_ERROR_ACCOUNT | 0x04, /**< DB operation failed */
+ ACCOUNT_ERROR_DB_NOT_OPENED = TIZEN_ERROR_ACCOUNT | 0x05, /**< DB is not connected */
+ ACCOUNT_ERROR_QUERY_SYNTAX_ERROR = TIZEN_ERROR_ACCOUNT | 0x06, /**< DB query syntax error */
+ ACCOUNT_ERROR_ITERATOR_END = TIZEN_ERROR_ACCOUNT | 0x07, /**< Iterator has reached the end */
+ ACCOUNT_ERROR_NOTI_FAILED = TIZEN_ERROR_ACCOUNT | 0x08, /**< Notification failed */
+ ACCOUNT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ ACCOUNT_ERROR_XML_PARSE_FAILED = TIZEN_ERROR_ACCOUNT | 0x0a, /**< XML parse failed */
+ ACCOUNT_ERROR_XML_FILE_NOT_FOUND = TIZEN_ERROR_ACCOUNT | 0x0b, /**< XML file does not exist */
+ ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL = TIZEN_ERROR_ACCOUNT | 0x0c, /**< Subscription failed */
+ ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER = TIZEN_ERROR_ACCOUNT | 0x0d, /**< Account provider is not registered */
+ ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE = TIZEN_ERROR_ACCOUNT | 0x0e, /**< Multiple accounts are not supported */
+ ACCOUNT_ERROR_DATABASE_BUSY = TIZEN_ERROR_ACCOUNT | 0x10, /**< SQLite busy handler expired */
} account_error_e;
/**
diff --git a/include/account-private.h b/include/account-private.h
deleted file mode 100755
index 766faef..0000000
--- a/include/account-private.h
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * account
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
- *
- * 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 __ACCOUNT_PRIVATE_TYPES_H__
-#define __ACCOUNT_PRIVATE_TYPES_H__
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include <glib.h>
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "ACCOUNT"
-
-#define ACCOUNT_VERBOSE(fmt, arg...) \
- LOGD(": " fmt "\n", ##arg);
-#define ACCOUNT_DEBUG(fmt, arg...) \
- LOGD(": " fmt "\n", ##arg);
-#define ACCOUNT_ERROR(fmt, arg...) \
- LOGE(": " fmt "\n", ##arg);
-#define ACCOUNT_FATAL(fmt, arg...) \
- LOGF(": " fmt "\n", ##arg);
-#define ACCOUNT_SLOGD(fmt, arg...) \
- SECURE_LOGD(": " fmt "\n", ##arg);
-#define ACCOUNT_SLOGI(fmt, arg...) \
- SECURE_LOGI(": " fmt "\n", ##arg);
-#define ACCOUNT_SLOGE(fmt, arg...) \
- SECURE_LOGE(": " fmt "\n", ##arg);
-
-#define ACCOUNT_RETURN_VAL(eval, expr, ret_val, X)\
- if (!(eval)) \
-{\
- expr; \
- return ret_val;\
-} else {;}
-
-#define ACCOUNT_SNPRINTF(dest,size,format,arg...) \
- do { \
- snprintf(dest,size-1,format,##arg); \
- }while(0)
- /* If the same pointer is passed to free twice, known as a double free. To avoid this, set pointers to
-NULL after passing them to free: free(NULL) is safe (it does nothing).
- */
-
-#define ACCOUNT_MEMSET(dest,value,size) \
- do { \
- memset(dest,value,size); \
- }while(0)
-
-#define ACCOUNT_CATCH_ERROR(eval, expr, error_val, X) \
- if (!(eval)) \
-{\
- expr; \
- error_code = (error_val);\
- goto CATCH;\
-} else {;}
-
-#define _ACCOUNT_FREE(ptr) \
- if (ptr != NULL) { \
- free(ptr); \
- ptr = NULL; \
- } \
-
-
-#define _ACCOUNT_GFREE(ptr) \
- if (ptr != NULL) { \
- g_free(ptr); \
- ptr = NULL; \
- } \
-
-#define ACCOUNT_DB_NAME "/opt/usr/dbspace/.account.db"
-#define ACCOUNT_TABLE "account"
-#define CAPABILITY_TABLE "capability"
-#define ACCOUNT_CUSTOM_TABLE "account_custom"
-#define ACCOUNT_TYPE_TABLE "account_type"
-#define LABEL_TABLE "label"
-#define PROVIDER_FEATURE_TABLE "provider_feature"
-#define ACCOUNT_SQLITE_SEQ "sqlite_sequence"
-#define ACCOUNT_SQL_LEN_MAX 1024
-#define ACCOUNT_TABLE_TOTAL_COUNT 6
-
-#define FACEBOOK_PKG_NAME "com.samsung.facebook"
-#define EMAIL_PKG_NAME "email-setting-efl"
-#define EXCHANGE_PKG_NAME "activesync-ui"
-#define IMS_SERVICE_PKG_NAME "ims-service"
-#define SAMSUNGACCOUNTFRONT_PKG_NAME "com.samsung.samsung-account-front"
-//#define SAMSUNGACCOUNT_PKG_NAME "gr47by21a5.SamsungAccount"
-#define SAMSUNGACCOUNT_PKG_NAME "com.samsung.samsungaccount"
-#define CHATON_PKG_NAME "xnq5eh9vop.ChatON"
-#define DROPBOX_PKG_NAME "com.samsung.dropbox"
-#define SYNCHRONISE_PKG_NAME "setting-synchronise-efl"
-
-#define USER_TXT_CNT 5
-#define USER_INT_CNT 5
-
-
-/* account uri list */
-#define ACCOUNT_DATA_SERVICE_PROVIDER "http://tizen.org/account/data/service_provider"
-#define ACCOUNT_OPERATION_SIGNIN_OLD "http://tizen.org/account/operation/signin"
-
-// private account operation type
-#define ACCOUNT_OPERATION_FMM "http://tizen.org/account/operation/fmm"
-#define ACCOUNT_OPERATION_MYACCOUNT "http://tizen.org/account/operation/signin_from_myaccount"
-// End of private account operation type
-
-#define ACCOUNT_SUPPORTS_CAPABILITY_POST "http://tizen.org/account/capability/post"
-#define ACCOUNT_SUPPORTS_CAPABILITY_VOIP "http://tizen.org/account/capability/voip"
-#define ACCOUNT_SUPPORTS_CAPABILITY_SAMSUNG_APPS "http://tizen.org/account/capability/samsungapps"
-#define ACCOUNT_SUPPORTS_CAPABILITY_TASK "http://tizen.org/account/capability/task"
-#define ACCOUNT_SUPPORTS_CAPABILITY_MOBILE_TRACKER "http://tizen.org/account/capability/mobiletracker"
-#define ACCOUNT_SUPPORTS_CAPABILITY_S_NOTE "http://tizen.org/account/capability/snote"
-#define ACCOUNT_SUPPORTS_CAPABILITY_GALLERY "http://tizen.org/account/capability/gallery"
-#define ACCOUNT_SUPPORTS_CAPABILITY_MEMO "http://tizen.org/account/capability/memo"
-#define ACCOUNT_SUPPORTS_CAPABILITY_CHAT "http://tizen.org/account/capability/chat"
-#define ACCOUNT_SUPPORTS_CAPABILITY_BOOKMARK "http://tizen.org/account/capability/bookmark"
-#define ACCOUNT_SUPPORTS_CAPABILITY_SYNCHRONISE "http://tizen.org/account/capability/synchronise"
-#define ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL "http://tizen.org/account/capability/tizen_email"
-#define ACCOUNT_SUPPORTS_CAPABILITY_INTERNET "http://tizen.org/account/capability/internet"
-#define ACCOUNT_SUPPORTS_CAPABILITY_DOCOMO_SCHEDULE_MEMO "http://tizen.org/account/capability/docomo"
-/* end of account uri list */
-
-typedef struct _account_s
-{
- int id;
- char* user_name;
- char* email_address;
- char* display_name;
- char* icon_path;
- char* source;
- char* package_name;
- char* access_token;
- char* domain_name; /*< domain name [Ex: google, facebook, twitter, samsung, ...] */
- int auth_type;
- int secret;
- int sync_support;
- int user_data_int[USER_INT_CNT];
- char* user_data_txt[USER_TXT_CNT];
- GSList* capablity_list;
- GList* account_list;
- GSList* custom_list;
-}account_s;
-
-typedef struct _capability_s
-{
- int id;
- char* type;
- int value;
- char* package_name;
- char* user_name;
- int account_id;
-}account_capability_s;
-
-
-typedef struct _account_custom_s
-{
- int account_id;
- char* app_id;
- char* key;
- char* value;
-}account_custom_s;
-
-typedef struct _account_type_s
-{
- int id;
- char* app_id;
- char* service_provider_id;
- char* icon_path;
- char* small_icon_path;
- bool multiple_account_support;
- GSList* label_list;
- GList* account_type_list;
- GSList* provider_feature_list;
-}account_type_s;
-
-
-typedef struct _label_s
-{
- char* app_id;
- char* label;
- char* locale;
-}label_s;
-
-typedef struct _provider_feature_s
-{
- char* key;
- char* app_id;
-}provider_feature_s;
-
-typedef struct _account_subscribe_s
-{
- account_event_cb account_subscription_callback;
- void* user_data;
-}account_subscribe_s;
-
-/**
- * @brief Enumarations for account handle fields.
- */
-
-typedef enum {
- ACCOUNT_FIELD_NONE = -1,
- ACCOUNT_FIELD_ID,
- ACCOUNT_FIELD_USER_NAME,
- ACCOUNT_FIELD_EMAIL_ADDRESS,
- ACCOUNT_FIELD_DISPLAY_NAME,
- ACCOUNT_FIELD_ICON_PATH,
- ACCOUNT_FIELD_SOURCE,
- ACCOUNT_FIELD_PACKAGE_NAME,
- ACCOUNT_FIELD_ACCESS_TOKEN,
- ACCOUNT_FIELD_DOMAIN_NAME,
- ACCOUNT_FIELD_AUTH_TYPE,
- ACCOUNT_FIELD_SECRET,
- ACCOUNT_FIELD_SYNC_SUPPORT,
- ACCOUNT_FIELD_USER_TEXT_0,
- ACCOUNT_FIELD_USER_TEXT_1,
- ACCOUNT_FIELD_USER_TEXT_2,
- ACCOUNT_FIELD_USER_TEXT_3,
- ACCOUNT_FIELD_USER_TEXT_4,
- ACCOUNT_FIELD_USER_INT_0,
- ACCOUNT_FIELD_USER_INT_1,
- ACCOUNT_FIELD_USER_INT_2,
- ACCOUNT_FIELD_USER_INT_3,
- ACCOUNT_FIELD_USER_INT_4,
- ACCOUNT_DB_FIELD_END,
-} ACCOUNT_DB_IDX;
-
-/**
- * @brief Enumarations for capability fields.
- */
-
-typedef enum {
- CAPABILITY_FIELD_NONE = -1,
- CAPABILITY_FIELD_ID,
- CAPABILITY_FIELD_KEY,
- CAPABILITY_FIELD_VALUE,
- CAPABILITY_FIELD_PACKAGE_NAME,
- CAPABILITY_FIELD_USER_NAME,
- CAPABILITY_FIELD_ACCOUNT_ID,
- CAPABILITY_FIELD_END,
-}CAPABILITY_DB_IDX;
-
-
-typedef enum {
- ACCOUNT_CUSTOM_FIELD_NONE = -1,
- ACCOUNT_CUSTOM_FIELD_ACCOUNT_ID,
- ACCOUNT_CUSTOM_FIELD_APP_ID,
- ACCOUNT_CUSTOM_FIELD_KEY,
- ACCOUNT_CUSTOM_FIELD_VALUE,
- ACCOUNT_CUSTOM_FIELD_END,
-}ACCOUNT_CUSTOM_DB_IDX;
-
-typedef enum {
- ACCOUNT_TYPE_FIELD_NONE = -1,
- ACCOUNT_TYPE_FIELD_ID,
- ACCOUNT_TYPE_FIELD_APP_ID,
- ACCOUNT_TYPE_FIELD_SERVICE_PROVIDER_ID,
- ACCOUNT_TYPE_FIELD_ICON_PATH,
- ACCOUNT_TYPE_FIELD_SMALL_ICON_PATH,
- ACCOUNT_TYPE_FIELD_MULTIPLE_ACCOUNT_SUPPORT,
- ACCOUNT_TYPE_FIELD_END,
-}ACCOUNT_TYPE_DB_IDX;
-
-typedef enum {
- LABEL_FIELD_NONE = -1,
- LABEL_FIELD_APP_ID,
- LABEL_FIELD_LABEL,
- LABEL_FIELD_LOCALE,
- LABEL_FIELD_END,
-}LABEL_DB_IDX;
-
-typedef enum {
- PROVIDER_FEATURE_FIELD_NONE = -1,
- PROVIDER_FEATURE_FIELD_APP_ID,
- PROVIDER_FEATURE_FIELD_KEY,
- PROVIDER_FEATURE_FIELD_END,
-}PROVIDER_FEATURE_DB_IDX;
-
-typedef sqlite3_stmt* account_stmt;
-
-//ACCOUNT_TABLE
-#define ACCOUNT_SCHEMA "create table account \n"\
- "(\n"\
-"_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
-"user_name TEXT, "\
-"email_address TEXT, "\
-"display_name TEXT, "\
-"icon_path TEXT, "\
-"source TEXT, "\
-"package_name TEXT, "\
-"access_token TEXT, "\
-"domain_name TEXT, "\
-"auth_type INTEGER, "\
-"secret INTEGER, "\
-"sync_support INTEGER, "\
-"txt_custom0 TEXT, "\
-"txt_custom1 TEXT, "\
-"txt_custom2 TEXT, "\
-"txt_custom3 TEXT, "\
-"txt_custom4 TEXT, "\
-"int_custom0 INTEGER, "\
-"int_custom1 INTEGER, "\
-"int_custom2 INTEGER, "\
-"int_custom3 INTEGER, "\
-"int_custom4 INTEGER "\
-");"
-
-//CAPABILITY_TABLE
-#define CAPABILITY_SCHEMA "create table capability \n"\
- "(\n"\
-"_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
-"key TEXT, "\
-"value INTEGER, "\
-"package_name TEXT, "\
-"user_name TEXT, "\
-"account_id INTEGER "\
-");"
-
-//ACCOUNT_CUSTOM_TABLE
-#define ACCOUNT_CUSTOM_SCHEMA "create table account_custom \n"\
- "(\n"\
-"AccountId INTEGER, "\
-"AppId TEXT, "\
-"Key TEXT, "\
-"Value TEXT "\
-");"
-
-//ACCOUNT_TYPE_TABLE
-#define ACCOUNT_TYPE_SCHEMA "create table account_type \n"\
- "(\n"\
-"_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
-"AppId TEXT, "\
-"ServiceProviderId TEXT, "\
-"IconPath TEXT, "\
-"SmallIconPath TEXT, "\
-"MultipleAccountSupport INTEGER "\
-");"
-
-//LABEL_TABLE
-#define LABEL_SCHEMA "create table label \n"\
- "(\n"\
-"AppId TEXT, "\
-"Label TEXT, "\
-"Locale TEXT"\
-");"
-
-//PROVIDER_FEATURE_TABLE
-#define PROVIDER_FEATURE_SCHEMA "create table provider_feature \n"\
- "(\n"\
-"app_id TEXT, "\
-"key TEXT "\
-");"
-
-typedef struct GSList account_iterator_s;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SLP_ACCOUNT_PRIVATE_TYPES_H__*/
diff --git a/include/account-types.h b/include/account-types.h
index 5eb582f..9b92667 100755..100644
--- a/include/account-types.h
+++ b/include/account-types.h
@@ -2,8 +2,6 @@
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
- *
* 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
@@ -40,7 +38,7 @@ extern "C"
/**
* @brief Enumeration for the state of capability.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef enum
{
@@ -53,7 +51,7 @@ account_capability_state_e;
/**
* @brief Enumeration for the state of account secrecy.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef enum
{
@@ -66,7 +64,7 @@ account_secrecy_state_e;
/**
* @brief Enumeration for the account sync status.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef enum
{
@@ -83,7 +81,7 @@ account_sync_state_e;
/**
* @brief Enumeration for the account auth type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef enum
{
@@ -96,32 +94,31 @@ typedef enum
/**
* @brief The structure type for the Account handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef struct account_s* account_h;
/**
* @brief The structure type for the Account provider handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef struct account_type_s* account_type_h;
/**
* @brief The structure type for the Account handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef struct label_s* label_h;
-
/**
* @brief The structure type for the Account subscribe handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*/
typedef struct account_subscribe_s* account_subscribe_h;
/**
* @brief The insert notification type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification.
*
* @see account_subscribe_notification()
@@ -130,7 +127,7 @@ typedef struct account_subscribe_s* account_subscribe_h;
/**
* @brief The update notification type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification.
*
* @see account_subscribe_notification()
@@ -139,7 +136,7 @@ typedef struct account_subscribe_s* account_subscribe_h;
/**
* @brief The delete notification type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification.
*
* @see account_subscribe_notification()
@@ -148,7 +145,7 @@ typedef struct account_subscribe_s* account_subscribe_h;
/**
* @brief The sync_update notification type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification.
*
* @see account_subscribe_notification()
@@ -158,7 +155,7 @@ typedef struct account_subscribe_s* account_subscribe_h;
/**
* @brief This is a key of app_control_h’s extra data. The value of the key is a user account name.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You can retrieve the value like this, app_control_get_extra_data(app_control, ACCOUNT_DATA_USERNAME, &username).\n
This value will be sent with ACCOUNT_OPERATION_VIEW.
*/
@@ -166,7 +163,7 @@ typedef struct account_subscribe_s* account_subscribe_h;
/**
* @brief This is a key of app_control_h’s extra data. The value of the key is account DB ID of the user’s account information.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You can retrieve the value like this, app_control_get_extra_data(app_control, ACCOUNT_DATA_ID, &id).\n
This value will be sent with ACCOUNT_OPERATION_VIEW.
*/
@@ -174,77 +171,77 @@ typedef struct account_subscribe_s* account_subscribe_h;
/**
* @brief This is an application launch operation name.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks This operation will be sent when a user selects your account in add account view.
*/
#define ACCOUNT_OPERATION_SIGNIN "http://tizen.org/appcontrol/operation/account/add"
/**
* @brief This is an application launch operation name.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks This operation will be sent when a user selects your account in account list view.
*/
#define ACCOUNT_OPERATION_VIEW "http://tizen.org/appcontrol/operation/account/configure"
/**
* @brief This is contact capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks If your provider service has contact information and contact information is provided another application, register this capability through manifest file.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_CONTACT "http://tizen.org/account/capability/contact"
/**
* @brief This is calendar capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks If your provider service has calendar information and calendar information is provided another application, register this capability through manifest file.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_CALENDAR "http://tizen.org/account/capability/calendar"
/**
* @brief This is email capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks If your provider service have email service and email is provided another application, register this capability through manifest file.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_EMAIL "http://tizen.org/account/capability/email"
/**
* @brief This is photo capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks If your provider service has photo and photo is provided another application, register this capability through manifest file.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_PHOTO "http://tizen.org/account/capability/photo"
/**
* @brief This is video capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks If your provider service has video and video is provided another application, register this capability through manifest file.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_VIDEO "http://tizen.org/account/capability/video"
/**
* @brief This is music capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks If your provider service has music and music is provided another application, register this capability through manifest file.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_MUSIC "http://tizen.org/account/capability/music"
/**
* @brief This is document capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks If your provider service has document and document is provided another application, register this capability through manifest file.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_DOCUMENT "http://tizen.org/account/capability/document"
/**
* @brief This is message capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks This capability will be exploited to use SMS, MMS.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_MESSAGE "http://tizen.org/account/capability/message"
/**
* @brief This is game capability string.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks This capability will be exploited to use game data.
*/
#define ACCOUNT_SUPPORTS_CAPABILITY_GAME "http://tizen.org/account/capability/game"
diff --git a/include/account.h b/include/account.h
index fefd4fe..edbedc5 100755..100644
--- a/include/account.h
+++ b/include/account.h
@@ -2,8 +2,6 @@
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
- *
* 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
@@ -46,7 +44,7 @@ extern "C"
/**
* @brief Called once for each account from the database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] user_data The user data passed from the foreach function
*
@@ -65,7 +63,7 @@ typedef bool (*account_cb)(account_h account, void *user_data);
/**
* @brief Called once for each capability of an account in the database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] capability_type The capability type
* @param[in] capability_state The capability state
* @param[in] user_data The user data passed from the foreach function
@@ -82,7 +80,7 @@ typedef bool (*capability_cb)(const char* capability_type, account_capability_st
/**
* @brief Called once for each custom data of an account in the database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] key The user custom key
* @param[in] value The user custom value of the specific key
* @param[in] user_data The user data passed
@@ -100,7 +98,7 @@ typedef bool (*account_custom_cb)(char* key, char* value, void *user_data);
/**
* @brief Called once for each account provider in the database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account_type The account provider handle
* @param[in] user_data The user data passed
*
@@ -118,7 +116,7 @@ typedef bool (*account_type_cb)(account_type_h account_type, void *user_data);
/**
* @brief Called once for each account label.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] app_id The application ID
* @param[in] label The name of the account depends on the specified locale
* @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
@@ -139,7 +137,7 @@ typedef bool (*account_label_cb)(char* app_id, char* label, char* locale, void *
/**
* @brief Called once for each capability of an account provider in the database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] app_id The application ID
* @param[in] key The user custom key
* @param[in] user_data The user data passed
@@ -158,7 +156,7 @@ typedef bool (*provider_feature_cb)(char* app_id, char* key, void* user_data);
/**
* @brief Called once when an event occurs.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] event_type The account event type
* @param[in] account_id The account ID to update
* @param[in] user_data The user data passed
@@ -174,62 +172,65 @@ typedef bool (*account_event_cb)(const char* event_type, int account_id, void* u
/**
- * @brief Connects to the account database by readwrite mode.
+ * @deprecated Deprecated since Tizen 2.4.\n
+ * This API is not necessary to use since Tizen 2.4.
+ * @brief Connects to the account database by readwrite mode.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
- * %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * %http://tizen.org/privilege/account.wirte
+ * @remarks This API need both privileges
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
*
- * @see account_disconnect()
+ * @see account_disconnect()
*/
-ACCOUNT_API int account_connect(void);
+int account_connect(void);
/**
- * @brief Connects to the account database by readonly mode.
+ * @deprecated Deprecated since Tizen 2.4.\n
+ * This API is not necessary to use since Tizen 2.4.
+ * @brief Connects to the account database by readonly mode.
*
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/account.read
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
*
- * @see account_disconnect()
+ * @see account_disconnect()
*/
-ACCOUNT_API int account_connect_readonly(void);
+int account_connect_readonly(void);
/**
- * @brief Disconnects from the account database.
+ * @deprecated Deprecated since Tizen 2.4.\n
+ * This API is not necessary to use since Tizen 2.4.
+ * @brief Disconnects from the account database.
*
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/account.read
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
- * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite busy handler expired
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite busy handler exprired
*
- * @see account_connect()
+ * @see account_connect()
+ * @see account_connect_readonly()
*/
-ACCOUNT_API int account_disconnect(void);
+int account_disconnect(void);
/**
* @brief Creates a handle to the account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks Release @a account using account_destroy().
* @remarks The created handle is not added to the account database until account_insert_to_db() is called.
*
@@ -243,13 +244,13 @@ ACCOUNT_API int account_disconnect(void);
*
* @see account_destroy()
*/
-ACCOUNT_API int account_create(account_h *account);
+int account_create(account_h *account);
/**
* @brief Destroys the account handle and releases all its resources.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
*
* @return @c 0 on success,
@@ -259,17 +260,17 @@ ACCOUNT_API int account_create(account_h *account);
*
* @see account_create()
*/
-ACCOUNT_API int account_destroy(account_h account);
+int account_destroy(account_h account);
/**
* @brief Inserts the account details to the account database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges
* @param[in] account The account handle
* @param[out] account_db_id The account ID to be assigned to an account
*
@@ -277,10 +278,14 @@ ACCOUNT_API int account_destroy(account_h account);
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_DUPLICATED Same user name exists in your application
* @retval #ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE Tried to add an account in spite of multiple false accounts
- * @retval #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER Tried to add an account though you did not register the account provider in manifest
+ * @retval #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER Tried to add an account though you did not register the account type in manifest
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -291,25 +296,29 @@ ACCOUNT_API int account_destroy(account_h account);
* @see account_update_to_db_by_id()
* @see account_update_to_db_by_user_name()
*/
-ACCOUNT_API int account_insert_to_db(account_h account, int *account_db_id);
+int account_insert_to_db(account_h account, int *account_db_id);
/**
* @brief Deletes an account from the account database by account DB ID.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges \n
+ * Only can delete an account which was added by same package applications
* @param[in] account_db_id The account ID to delete
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED The account owner is different from the caller or DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -320,26 +329,30 @@ ACCOUNT_API int account_insert_to_db(account_h account, int *account_db_id);
* @see account_update_to_db_by_id()
* @see account_update_to_db_by_user_name()
*/
-ACCOUNT_API int account_delete_from_db_by_id(int account_db_id);
+int account_delete_from_db_by_id(int account_db_id);
/**
* @brief Deletes an account from the account database by user name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges \n
+ * Only can delete accounts which were added by same package applications
* @param[in] user_name The user name of the account to delete
* @param[in] package_name The package name of the account to delete
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -350,17 +363,18 @@ ACCOUNT_API int account_delete_from_db_by_id(int account_db_id);
* @see account_update_to_db_by_id()
* @see account_update_to_db_by_user_name()
*/
-ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *package_name);
+int account_delete_from_db_by_user_name(char *user_name, char *package_name);
/**
* @brief Deletes an account from the account database by package name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges \n
+ * Only can delete accounts which was added by same package applications
* @param[in] package_name The package name of account(s) to delete
*
* @return @c 0 on success,
@@ -369,6 +383,8 @@ ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *packa
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -379,17 +395,17 @@ ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *packa
* @see account_update_to_db_by_id()
* @see account_update_to_db_by_user_name()
*/
-ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name);
-
+int account_delete_from_db_by_package_name(const char *package_name);
/**
* @brief Updates the account details to the account database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
* @param[in] account The account handle
* @param[in] account_id The account ID to update
*
@@ -400,6 +416,8 @@ ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name)
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -410,27 +428,31 @@ ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name)
* @see account_delete_from_db_by_package_name()
* @see account_update_to_db_by_user_name()
*/
-ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id);
-
+int account_update_to_db_by_id(account_h account, int account_id);
/**
- * @brief Updates the account details to the account database without checking provider's permission.
+ * @brief Updates the account details to the account database.
+ * The provider permission check has been added since tizen 2.4.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
* @param[in] account The account handle
* @param[in] account_id The account ID to update
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -441,16 +463,17 @@ ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id);
* @see account_delete_from_db_by_package_name()
* @see account_update_to_db_by_user_name()
*/
-ACCOUNT_API int account_update_to_db_by_id_ex(account_h account, int account_id);
+int account_update_to_db_by_id_ex(account_h account, int account_id);
/**
* @brief Updates the account details to the account database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges \n
+ * Only can update accounts which were added by same package applications
* @param[in] account The account handle
* @param[in] user_name The user name of the account to update
* @param[in] package_name The package name for the user name
@@ -462,6 +485,8 @@ ACCOUNT_API int account_update_to_db_by_id_ex(account_h account, int account_id)
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -473,12 +498,12 @@ ACCOUNT_API int account_update_to_db_by_id_ex(account_h account, int account_id)
* @see account_update_to_db_by_id()
*
*/
-ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
+int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
/**
* @brief Gets the ID of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[out] account_id The account ID
*
@@ -488,12 +513,12 @@ ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
*
*/
-ACCOUNT_API int account_get_account_id(account_h account, int *account_id);
+int account_get_account_id(account_h account, int *account_id);
/**
* @brief Gets the user name of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a user_name using free().
*
* @param[in] account The account handle
@@ -507,13 +532,13 @@ ACCOUNT_API int account_get_account_id(account_h account, int *account_id);
*
* @see account_set_user_name()
*/
-ACCOUNT_API int account_get_user_name(account_h account, char **user_name);
+int account_get_user_name(account_h account, char **user_name);
/**
* @brief Sets the user name of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] user_name The string to set as user name
*
@@ -524,13 +549,13 @@ ACCOUNT_API int account_get_user_name(account_h account, char **user_name);
*
* @see account_get_user_name()
*/
-ACCOUNT_API int account_set_user_name(account_h account, const char *user_name);
+int account_set_user_name(account_h account, const char *user_name);
/**
* @brief Gets the display name of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a display_name using free().
*
* @param[in] account The account handle
@@ -544,13 +569,13 @@ ACCOUNT_API int account_set_user_name(account_h account, const char *user_name);
*
* @see account_get_display_name()
*/
-ACCOUNT_API int account_get_display_name(account_h account, char **display_name);
+int account_get_display_name(account_h account, char **display_name);
/**
* @brief Sets the display name of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] display_name The text string to set as the display name
*
@@ -561,12 +586,12 @@ ACCOUNT_API int account_get_display_name(account_h account, char **display_name)
*
* @see account_get_display_name()
*/
-ACCOUNT_API int account_set_display_name(account_h account, const char *display_name);
+int account_set_display_name(account_h account, const char *display_name);
/**
* @brief Gets the capability detail of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] capability_type The capability type to get the capability value
* @param[out] capability_value The capability value (on/off) of the specified capability_type
@@ -579,12 +604,12 @@ ACCOUNT_API int account_set_display_name(account_h account, const char *display_
*
* @see account_set_capability()
*/
-ACCOUNT_API int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value);
+int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value);
/**
* @brief Gets all the capabilities of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] callback The callback function
* @param[in] user_data The user data to be passed to the callback function
@@ -596,12 +621,12 @@ ACCOUNT_API int account_get_capability(account_h account, const char* capability
*
* @see account_set_capability()
*/
-ACCOUNT_API int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
+int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
/**
* @brief Sets the capability.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] capability_type The capability type
* @param[in] capability_state The capability state
@@ -613,13 +638,13 @@ ACCOUNT_API int account_get_capability_all(account_h account, capability_cb call
*
* @see account_get_capability()
*/
-ACCOUNT_API int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_state);
+int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_state);
/**
* @brief Gets the icon path.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a icon_path using free().
*
* @param[in] account The account handle
@@ -633,13 +658,13 @@ ACCOUNT_API int account_set_capability(account_h account, const char* capability
*
* @see account_set_icon_path()
*/
-ACCOUNT_API int account_get_icon_path(account_h account, char **icon_path);
+int account_get_icon_path(account_h account, char **icon_path);
/**
* @brief Sets the icon path.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] icon_path The text string to set as the icon path
*
@@ -650,13 +675,13 @@ ACCOUNT_API int account_get_icon_path(account_h account, char **icon_path);
*
* @see account_get_icon_path()
*/
-ACCOUNT_API int account_set_icon_path(account_h account, const char *icon_path);
+int account_set_icon_path(account_h account, const char *icon_path);
/**
* @brief Gets the domain name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a domain_name using free().
*
* @param[in] account The account handle
@@ -670,13 +695,13 @@ ACCOUNT_API int account_set_icon_path(account_h account, const char *icon_path);
*
* @see account_set_domain_name()
*/
-ACCOUNT_API int account_get_domain_name(account_h account, char **domain_name);
+int account_get_domain_name(account_h account, char **domain_name);
/**
* @brief Sets the domain name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] domain_name The text string to set as the domain name
*
@@ -687,13 +712,13 @@ ACCOUNT_API int account_get_domain_name(account_h account, char **domain_name);
*
* @see account_get_domain_name()
*/
-ACCOUNT_API int account_set_domain_name(account_h account, const char *domain_name);
+int account_set_domain_name(account_h account, const char *domain_name);
/**
* @brief Gets the email address.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a email_address using free().
*
* @param[in] account The account handle
@@ -707,13 +732,13 @@ ACCOUNT_API int account_set_domain_name(account_h account, const char *domain_na
*
* @see account_set_email_address()
*/
-ACCOUNT_API int account_get_email_address(account_h account, char **email_address);
+int account_get_email_address(account_h account, char **email_address);
/**
* @brief Sets the email address.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] email_address The text string to set as the email address
*
@@ -724,13 +749,13 @@ ACCOUNT_API int account_get_email_address(account_h account, char **email_addres
*
* @see account_get_email_address()
*/
-ACCOUNT_API int account_set_email_address(account_h account, const char *email_address);
+int account_set_email_address(account_h account, const char *email_address);
/**
* @brief Gets the package name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a package_name using free().
*
* @param[in] account The account handle
@@ -744,13 +769,13 @@ ACCOUNT_API int account_set_email_address(account_h account, const char *email_a
*
* @see account_set_package_name()
*/
-ACCOUNT_API int account_get_package_name(account_h account, char **package_name);
+int account_get_package_name(account_h account, char **package_name);
/**
* @brief Sets the package name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] package_name The text string to set as the package name
*
@@ -761,13 +786,13 @@ ACCOUNT_API int account_get_package_name(account_h account, char **package_name)
*
* @see account_get_email_address()
*/
-ACCOUNT_API int account_set_package_name(account_h account, const char *package_name);
+int account_set_package_name(account_h account, const char *package_name);
/**
- * @brief Gets the access token.
+ * @brief Gets the access token. Access token field is used to store account secrets (such as password or master token).
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a access_token using free().
*
* @param[in] account The account handle
@@ -779,15 +804,17 @@ ACCOUNT_API int account_set_package_name(account_h account, const char *package_
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
*
+ * @remarks Access token field is used for storing account secret (password / master token etc)
+ * Only account owner application can retrieve account password / access_token. For others this field will be null.
* @see account_set_access_token()
*/
-ACCOUNT_API int account_get_access_token(account_h account, char **access_token);
+int account_get_access_token(account_h account, char **access_token);
/**
- * @brief Sets the access token.
+ * @brief Sets the access token. Access token field is used to store account secrets (such as password or master token).
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] access_token The text string to set as the access token
*
@@ -795,16 +822,16 @@ ACCOUNT_API int account_get_access_token(account_h account, char **access_token)
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- *
+ * @remarks Only account owner application can retrieve account password / access_token. For others this field will be null.
* @see account_get_access_token()
*/
-ACCOUNT_API int account_set_access_token(account_h account, const char *access_token);
+int account_set_access_token(account_h account, const char *access_token);
/**
* @brief Gets the user text.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a user_text using free().
*
* @param[in] account The account handle
@@ -819,13 +846,13 @@ ACCOUNT_API int account_set_access_token(account_h account, const char *access_t
*
* @see account_set_user_text()
*/
-ACCOUNT_API int account_get_user_text(account_h account, int user_text_index, char **user_text);
+int account_get_user_text(account_h account, int user_text_index, char **user_text);
/**
* @brief Sets the user text.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] user_text_index The index of the user text (must be in range from @c 0 to @c 4)
* @param[in] user_text The text string to set as the user text
@@ -837,13 +864,13 @@ ACCOUNT_API int account_get_user_text(account_h account, int user_text_index, ch
*
* @see account_get_user_text()
*/
-ACCOUNT_API int account_set_user_text(account_h account, int user_text_index, const char *user_text);
+int account_set_user_text(account_h account, int user_text_index, const char *user_text);
/**
* @brief Gets the user integer.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
* @param[out] user_integer The user integer
@@ -855,13 +882,13 @@ ACCOUNT_API int account_set_user_text(account_h account, int user_text_index, co
*
* @see account_set_user_int()
*/
-ACCOUNT_API int account_get_user_int(account_h account, int user_int_index, int *user_integer);
+int account_get_user_int(account_h account, int user_int_index, int *user_integer);
/**
* @brief Sets the user integer.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
* @param[in] user_integer The integer to set as the user integer
@@ -873,13 +900,13 @@ ACCOUNT_API int account_get_user_int(account_h account, int user_int_index, int
*
* @see account_get_user_int()
*/
-ACCOUNT_API int account_set_user_int(account_h account, int user_int_index, int user_integer);
+int account_set_user_int(account_h account, int user_int_index, int user_integer);
/**
* @brief Gets the auth type.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[out] auth_type The auth type
*
@@ -890,14 +917,14 @@ ACCOUNT_API int account_set_user_int(account_h account, int user_int_index, int
*
* @see account_set_auth_type()
*/
-ACCOUNT_API int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
+int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
/**
* @brief Sets the auth type.
*
- * @since_tizen 2.3
- * @param[in] account The account handle
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
+ * @param[in] account The account handle
* @param[in] auth_type The integer to be set as the auth type
*
* @return @c 0 on success,
@@ -907,13 +934,13 @@ ACCOUNT_API int account_get_auth_type(account_h account, account_auth_type_e *au
*
* @see account_get_auth_type()
*/
-ACCOUNT_API int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
+int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
/**
* @brief Gets the secret.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[out] secret The secret
*
@@ -924,13 +951,13 @@ ACCOUNT_API int account_set_auth_type(account_h account, const account_auth_type
*
* @see account_set_secret()
*/
-ACCOUNT_API int account_get_secret(account_h account, account_secrecy_state_e *secret);
+int account_get_secret(account_h account, account_secrecy_state_e *secret);
/**
* @brief Sets the secret.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] secret The secrecy to be set
*
@@ -941,12 +968,12 @@ ACCOUNT_API int account_get_secret(account_h account, account_secrecy_state_e *s
*
* @see account_get_secret()
*/
-ACCOUNT_API int account_set_secret(account_h account, const account_secrecy_state_e secret);
+int account_set_secret(account_h account, const account_secrecy_state_e secret);
/**
* @brief Gets the sync support.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[out] sync_support The sync support
*
@@ -957,13 +984,13 @@ ACCOUNT_API int account_set_secret(account_h account, const account_secrecy_stat
*
* @see account_set_sync_support()
*/
-ACCOUNT_API int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
+int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
/**
* @brief Sets the sync support.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] sync_support The sync state to be set
*
@@ -974,13 +1001,13 @@ ACCOUNT_API int account_get_sync_support(account_h account, account_sync_state_e
*
* @see account_get_sync_support()
*/
-ACCOUNT_API int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
+int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
/**
* @brief Gets the source.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a user_text using free().
*
* @param[in] account The account handle
@@ -994,13 +1021,13 @@ ACCOUNT_API int account_set_sync_support(account_h account, const account_sync_s
*
* @see account_set_source()
*/
-ACCOUNT_API int account_get_source(account_h account, char **source);
+int account_get_source(account_h account, char **source);
/**
* @brief Sets the source.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] source The text string to set as the source
*
@@ -1011,12 +1038,12 @@ ACCOUNT_API int account_get_source(account_h account, char **source);
*
* @see account_get_source()
*/
-ACCOUNT_API int account_set_source(account_h account, const char *source);
+int account_set_source(account_h account, const char *source);
/**
* @brief Sets the custom.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] key The user custom key for the specific value
* @param[in] value The user custom value about the given key
@@ -1028,17 +1055,17 @@ ACCOUNT_API int account_set_source(account_h account, const char *source);
*
* @see account_get_custom()
*/
-ACCOUNT_API int account_set_custom(account_h account, const char* key, const char* value);
+int account_set_custom(account_h account, const char* key, const char* value);
/**
* @brief Gets the user specific custom text of an account key.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] key The key to retrieve custom text
* @param[out] value The text of the given key
*
- * @return @c 0 on success,
+ * @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
@@ -1046,13 +1073,13 @@ ACCOUNT_API int account_set_custom(account_h account, const char* key, const cha
*
* @see account_set_custom()
*/
-ACCOUNT_API int account_get_custom(account_h account, const char* key, char** value);
+int account_get_custom(account_h account, const char* key, char** value);
/**
* @brief Gets all the user custom texts of an account.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account The account handle
* @param[in] callback The callback function to retrieve all custom text \n
* The callback function gives the key and value.
@@ -1065,12 +1092,12 @@ ACCOUNT_API int account_get_custom(account_h account, const char* key, char** va
*
* @see account_set_custom()
*/
-ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data);
+int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data);
/**
* @brief Retrieves all accounts details by invoking the given callback function iteratively.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function to invoke
@@ -1083,6 +1110,8 @@ ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb call
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
* @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
* @post This function invokes account_cb().
@@ -1093,13 +1122,13 @@ ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb call
* @see account_query_account_by_package_name()
* @see account_query_account_by_capability()
*/
-ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_data);
+int account_foreach_account_from_db(account_cb callback, void *user_data);
/**
* @brief Retrieve an account with the account ID.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] account_db_id The account database ID to search
@@ -1109,9 +1138,12 @@ ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -1120,12 +1152,12 @@ ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_
* @see account_query_account_by_package_name()
* @see account_query_account_by_capability()
*/
-ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h *account);
+int account_query_account_by_account_id(int account_db_id, account_h *account);
/**
* @brief Retrieves all accounts with the user name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function to invoke
@@ -1135,9 +1167,12 @@ ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
* @post This function invokes account_cb().
@@ -1149,12 +1184,12 @@ ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h
* @see account_query_account_by_capability()
*
*/
-ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
+int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
/**
* @brief Retrieves all accounts with the package name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function to invoke
@@ -1164,9 +1199,12 @@ ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const ch
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
* @post This function invokes account_cb().
@@ -1177,12 +1215,12 @@ ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const ch
* @see account_query_account_by_user_name()
* @see account_query_account_by_capability()
*/
-ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
+int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
/**
* @brief Retrieves all accounts with the capability type and capability value.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function to invoke
@@ -1193,9 +1231,12 @@ ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
* @post This function invokes account_cb().
@@ -1206,12 +1247,12 @@ ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const
* @see account_query_account_by_user_name()
* @see account_query_account_by_package_name()
*/
-ACCOUNT_API int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data);
+int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data);
/**
* @brief Retrieves all accounts with the capability type.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function to invoke
@@ -1221,9 +1262,12 @@ ACCOUNT_API int account_query_account_by_capability(account_cb callback, const c
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
* @post This function invokes account_cb().
@@ -1234,12 +1278,12 @@ ACCOUNT_API int account_query_account_by_capability(account_cb callback, const c
* @see account_query_account_by_user_name()
* @see account_query_account_by_package_name()
*/
-ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data);
+int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data);
/**
* @brief Retrieves all capabilities with the account database ID.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function to invoke
@@ -1249,9 +1293,12 @@ ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, co
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
* @post This function invokes capability_cb().
@@ -1260,13 +1307,13 @@ ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, co
* @see account_get_capability()
* @see account_set_capability()
*/
-ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
+int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
/**
* @brief Gets the count of accounts in the account database.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[out] count The out parameter for count of all accounts
@@ -1276,36 +1323,42 @@ ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, i
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
* @see account_connect()
*/
-ACCOUNT_API int account_get_total_count_from_db(int *count);
+int account_get_total_count_from_db(int *count);
/**
* @brief Updates the sync status of an account with the given account ID.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read \n
* %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
* @param[in] account_db_id The account ID for which sync status needs to be changed
* @param[in] sync_status The new sync status
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
* @see account_connect()
*/
-ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
+int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
/* Account type API */
@@ -1314,7 +1367,7 @@ ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const accoun
/**
* @brief Creates a handle to the account provider.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a account_type handle using account_type_destroy().\n
*
* @param[in] account_type The account provider handle
@@ -1327,12 +1380,12 @@ ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const accoun
*
* @see account_type_destroy()
*/
-ACCOUNT_API int account_type_create(account_type_h *account_type);
+int account_type_create(account_type_h *account_type);
/**
* @brief Destroys the account provider handle and releases all its resources.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
*
* @remarks When you get @a account_type_h using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak.
*
@@ -1345,162 +1398,12 @@ ACCOUNT_API int account_type_create(account_type_h *account_type);
*
* @see account_type_create()
*/
-ACCOUNT_API int account_type_destroy(account_type_h account_type);
-
-/**
- * @internal
- * @brief Sets the app ID.
- * It should be filled with your application ID. For example, com.tizen.testapp.
- *
- * @since_tizen 2.3
- * @remarks @a app_id is a mandatory field and does not allow duplicate app ID in the account provider database.
- *
- * @param[in] account_type The account provider handle \n
- * It should be assigned by account_type_create().
- * @param[in] app_id The application ID
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see account_type_get_app_id()
- */
-ACCOUNT_API int account_type_set_app_id(account_type_h account_type, const char *app_id);
-
-/**
- * @internal
- * @brief Sets the service provider ID.
- * It should be filled with your service provider ID.
- *
- * @since_tizen 2.3
- * @remarks @a service_provider_id is a mandatory field.
- *
- * @param[in] account_type The account provider handle \n
- * It should be assigned by account_type_create().
- * @param[in] service_provider_id The service provider ID
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see account_type_get_service_provider_id()
- */
-ACCOUNT_API int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id);
-
-/**
- * @internal
- * @brief Sets icon path.
- * It represents your service provider or an application.
- *
- * @since_tizen 2.3
- * @remarks @a icon_path is not a mandatory field. But when it is set, you can display this icon in the Add Account screen.
- *
- * @param[in] account_type The account provider handle\n
- * It should be assigned by account_type_create().
- * @param[in] icon_path The icon path of the application
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see account_type_get_icon_path()
- */
-ACCOUNT_API int account_type_set_icon_path(account_type_h account_type, const char *icon_path);
-
-/**
- * @internal
- * @brief Sets small icon path.
- * It also represents your service provider or an application.
- *
- * @since_tizen 2.3
- * @remarks @a small_icon_path is not a mandatory field.
- *
- * @param[in] account_type The account provider handle \n
- * It should be assigned by account_type_create().
- * @param[in] small_icon_path The scaled icon of your application
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see account_type_get_small_icon_path()
- */
-ACCOUNT_API int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path);
-
-/**
- * @internal
- * @brief Sets support for multiple accounts.
- * It represents whether your application supports multiple accounts.
- *
- * @since_tizen 2.3
- * @remarks The default value of multiple account support is @c FALSE.
- *
- * @param[in] account_type The account provider handle \n
- * It should be assigned by account_type_create().
- * @param[in] multiple_account_support Set @c TRUE if your application can support two or more accounts, \n
- * otherwise @c FALSE if your application can support only one account
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see account_type_get_multiple_account_support()
- */
-ACCOUNT_API int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support);
-
-/**
- * @internal
- * @brief Sets label and locale.
- * Label represents the name of an account provider.
- *
- * @since_tizen 2.3
- * @param[in] account_type The account provider handle \n
- * It should be assigned by account_type_create().
- * @param[in] label The name of account depends on the specified locale
- * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
- * For example, "ko_KR" for Korean, "en_US" for American English.
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see account_type_get_label()
- */
-ACCOUNT_API int account_type_set_label(account_type_h account_type, const char* label, const char* locale);
-
-/**
- * @internal
- * @brief Sets the capability.
- *
- * @since_tizen 2.3
- * @param[in] account_type The account provider handle
- * @param[in] provider_feature Th capability key of the account
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @see account_set_capability()
- */
-ACCOUNT_API int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature);
+int account_type_destroy(account_type_h account_type);
/**
* @brief Retrieves capability information with your application ID.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function carries the capability name of an app ID
@@ -1514,18 +1417,20 @@ ACCOUNT_API int account_type_set_provider_feature(account_type_h account_type, c
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
* @see account_connect()
* @see account_disconnect()
*/
-ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data );
+int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data );
/**
* @brief Checks whether the given application ID supports the capability.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
@@ -1540,19 +1445,22 @@ ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_c
* @exception #ACCOUNT_ERROR_NONE Successful
* @exception #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
+ * @excaption #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @exception #ACCOUNT_ERROR_PERMISSION_DENIED DB access fail by permission
+ * @excaption #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @excaption #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
* @see account_connect()
* @see account_disconnect()
*/
-ACCOUNT_API bool account_type_query_supported_feature(const char* app_id, const char* capability);
+bool account_type_query_supported_feature(const char* app_id, const char* capability);
/**
* @brief Gets the application ID of an account provider.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a app_id using free().
*
* @param[in] account_type The account provider handle \n
@@ -1568,12 +1476,12 @@ ACCOUNT_API bool account_type_query_supported_feature(const char* app_id, const
* @see account_type_foreach_account_type_from_db()
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_get_app_id(account_type_h account_type, char **app_id);
+int account_type_get_app_id(account_type_h account_type, char **app_id);
/**
* @brief Gets the service provider ID of an account provider.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a service_provider_id using free().
*
* @param[in] account_type The account provider handle \n
@@ -1589,12 +1497,12 @@ ACCOUNT_API int account_type_get_app_id(account_type_h account_type, char **app_
* @see account_type_foreach_account_type_from_db()
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
+int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
/**
* @brief Gets the icon path of an account provider.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a icon_path using free().
*
* @param[in] account_type The account provider handle \n
@@ -1610,12 +1518,12 @@ ACCOUNT_API int account_type_get_service_provider_id(account_type_h account_type
* @see account_type_foreach_account_type_from_db()
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_get_icon_path(account_type_h account_type, char **icon_path);
+int account_type_get_icon_path(account_type_h account_type, char **icon_path);
/**
* @brief Gets the small icon path of an account provider.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a small_icon_path using free().
*
* @param[in] account_type The account provider handle\n
@@ -1631,12 +1539,12 @@ ACCOUNT_API int account_type_get_icon_path(account_type_h account_type, char **i
* @see account_type_foreach_account_type_from_db()
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
+int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
/**
* @brief Checks whether the given account provider supports multiple accounts.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account_type The account provider handle \n
* It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db.
* @param[out] multiple_account_support The flag indicating support for multiple accounts accounts\n
@@ -1651,12 +1559,12 @@ ACCOUNT_API int account_type_get_small_icon_path(account_type_h account_type, ch
* @see account_type_foreach_account_type_from_db()
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
+int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
/**
* @brief Gets capability information with the given account provider handle.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account_type The account provider handle\n
* It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
* @param[in] callback The callback function that carries the capability name of the app ID
@@ -1674,12 +1582,12 @@ ACCOUNT_API int account_type_get_multiple_account_support(account_type_h account
* @see account_connect()
* @see account_disconnect()
*/
-ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data);
+int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data);
/**
* @brief Gets the specific label information detail of an account provider.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account_type The account provider handle\n
* It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
* @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
@@ -1696,12 +1604,12 @@ ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_typ
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label);
+int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label);
/**
* @brief Gets the label information detail of an account provider.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @param[in] account_type The account provider handle\n
* It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
* @param[in] callback The callback function carrying the label information
@@ -1715,91 +1623,12 @@ ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, co
* @see account_type_foreach_account_type_from_db()
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
-
-/**
- * @internal
- * @brief Inserts the account provider details to the database.
- *
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/account.read \n
- * %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
- * @param[in] account_type The account handle which is created by account_type_create() \n
- * @param[out] account_type_id The account provider ID to be assigned after inserting the account provider handle
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
- * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
- *
- * @pre This function requires an open connection to an account service by account_connect().
- * @post account_disconnect() is recommended after insertion.
- *
- * @see account_connect()
- * @see account_disconnect()
- */
-ACCOUNT_API int account_type_insert_to_db(account_type_h account_type, int* account_type_id);
-
-/**
- * @internal
- * @brief Updates the account details to the account database.
- *
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/account.read \n
- * %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
- * @param[in] account_type The account handle which is created by account_type_create() \n
- * @param[in] app_id The application ID of the account provider
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
- * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
- *
- * @pre This function requires an open connection to an account service by account_connect().
- * @post account_disconnect() is recommended after update.
- *
- * @see account_connect()
- * @see account_disconnect()
- */
-ACCOUNT_API int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id);
-
-/**
- * @internal
- * @brief Deletes the account provider from the account database by application ID.
- *
- * @since_tizen 2.3
- * @privlevel public
- * @privilege %http://tizen.org/privilege/account.read \n
- * %http://tizen.org/privilege/account.write
- * @remarks this API need both privileges
- * @param[in] app_id The application ID of account provider to be deleted
- *
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #ACCOUNT_ERROR_NONE Successful
- * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
- * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
- *
- * @pre This function requires an open connection to an account service by account_connect().
- *
- * @see account_connect()
- * @see account_disconnect()
- */
-ACCOUNT_API int account_type_delete_by_app_id(const char* app_id);
+int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
/**
* @brief Retrieves the label information with your application ID.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function that carries label_h for label information \n
@@ -1814,6 +1643,8 @@ ACCOUNT_API int account_type_delete_by_app_id(const char* app_id);
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -1822,12 +1653,12 @@ ACCOUNT_API int account_type_delete_by_app_id(const char* app_id);
* @see account_type_foreach_account_type_from_db()
* @see account_disconnect()
*/
-ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data );
+int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data );
/**
* @brief Retrieves the account provider information with your application ID.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] app_id The application ID to search
@@ -1840,6 +1671,8 @@ ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, co
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Queried data does not exist
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -1853,12 +1686,12 @@ ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, co
* @see account_type_get_label()
* @see account_type_destroy()
*/
-ACCOUNT_API int account_type_query_by_app_id(const char* app_id, account_type_h *account_type);
+int account_type_query_by_app_id(const char* app_id, account_type_h *account_type);
/**
* @brief Retrieves all account priovider information.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The account provider information \n
@@ -1872,6 +1705,8 @@ ACCOUNT_API int account_type_query_by_app_id(const char* app_id, account_type_h
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
@@ -1885,12 +1720,12 @@ ACCOUNT_API int account_type_query_by_app_id(const char* app_id, account_type_h
* @see account_type_get_label()
* @see account_type_destroy()
*/
-ACCOUNT_API int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
+int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
/**
* @brief Retrieves the label information with the given application ID and locale.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] app_id The application ID
@@ -1905,17 +1740,19 @@ ACCOUNT_API int account_type_foreach_account_type_from_db(account_type_cb callba
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
* @see account_connect()
*/
-ACCOUNT_API int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label);
+int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label);
/**
* @brief Retrieves account provider information with the capability name.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] callback The callback function to retrieve account provider information
@@ -1929,18 +1766,20 @@ ACCOUNT_API int account_type_query_label_by_locale(const char* app_id, const cha
* @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
- * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
* @see account_connect()
*/
-ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data);
+int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data);
/**
* @brief Checks whether the given app_id exists in the account provider DB.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/account.read
* @param[in] app_id The application ID to check
@@ -1950,13 +1789,16 @@ ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback,
* @retval #ACCOUNT_ERROR_NONE Successful
* @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
* @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid app ID
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
* @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
*
* @pre This function requires an open connection to an account service by account_connect().
*
* @see account_type_query_by_app_id()
*/
-ACCOUNT_API int account_type_query_app_id_exist(const char* app_id);
+int account_type_query_app_id_exist(const char* app_id);
@@ -1965,7 +1807,7 @@ ACCOUNT_API int account_type_query_app_id_exist(const char* app_id);
/**
* @brief Creates a handle for the account event subscription.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @remarks You must release @a account_subscribe handle using account_unsubscribe_notification().
*
* @param[in] account_subscribe The account subscription handle
@@ -1979,14 +1821,14 @@ ACCOUNT_API int account_type_query_app_id_exist(const char* app_id);
* @see account_unsubscribe_notification()
* @see account_subscribe_notification()
*/
-ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe);
+int account_subscribe_create(account_subscribe_h* account_subscribe);
/**
* @brief Starts to subscribe account event through the given callback function.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/account.read
+ * @privilege %http://tizen.org/privilege/account.read \n
* @param[in] account_subscribe The account subscription handle
* @param[in] callback The callback function that is called when an account is removed and a data of account is updated from the account database \n
* It will be called with event message and account ID.
@@ -2003,14 +1845,14 @@ ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe)
* @see account_unsubscribe_notification()
* @see account_subscribe_notification()
*/
-ACCOUNT_API int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data);
+int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data);
/**
* @brief Destroys the account subscribe handle and releases all its resources.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
* @privlevel public
- * @privilege %http://tizen.org/privilege/account.read
+ * @privilege %http://tizen.org/privilege/account.read \n
* @remarks You must call @a account_unsubscribe_notification when you do not need to subscribe account event.
*
* @param[in] account_subscribe The account subscription handle
@@ -2023,14 +1865,11 @@ ACCOUNT_API int account_subscribe_notification(account_subscribe_h account_subsc
*
* @see account_create()
*/
-ACCOUNT_API int account_unsubscribe_notification(account_subscribe_h account_subscribe);
-/**
-* @}
-*/
-
+int account_unsubscribe_notification(account_subscribe_h account_subscribe);
#ifdef __cplusplus
}
#endif
-#endif /* __ACCOUNT_H__ */
+
+#endif //__ACCOUNT_H_
diff --git a/include/account_PG.h b/include/account_PG.h
index c24c8c5..c24c8c5 100755..100644
--- a/include/account_PG.h
+++ b/include/account_PG.h
diff --git a/include/account_internal.h b/include/account_internal.h
index 7b77e47..1fc0524 100644
--- a/include/account_internal.h
+++ b/include/account_internal.h
@@ -3,6 +3,8 @@
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
* 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
@@ -20,6 +22,9 @@
#ifndef __ACCOUNT_INTERNAL_H__
#define __ACCOUNT_INTERNAL_H__
+#include "account-types.h"
+#include "account.h"
+
#ifdef __cplusplus
extern "C"
{
@@ -36,6 +41,303 @@ extern "C"
/**
* @internal
+ * @brief Deletes an account from the account database by package name.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges
+ * @param[in] package_name The package name of account(s) to delete
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_connect()
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_package_name_offline(const char *package_name);
+
+/**
+ * @internal
+ * @brief Updates the account details to the account database without checking provider's permission.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges
+ * @param[in] account The account handle
+ * @param[in] account_id The account ID to update
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect().
+ *
+ * @see account_connect()
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_update_to_db_by_id_without_permission(account_h account, int account_id);
+
+/**
+ * @internal
+ * @brief Sets the app ID.
+ * It should be filled with your application ID. For example, com.tizen.testapp.
+ *
+ * @since_tizen 2.3
+ * @remarks @a app_id is a mandatory field and does not allow duplicate app ID in the account provider database.
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be assigned by account_type_create().
+ * @param[in] app_id The application ID
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_app_id()
+ */
+int account_type_set_app_id(account_type_h account_type, const char *app_id);
+
+/**
+ * @internal
+ * @brief Sets the service provider ID.
+ * It should be filled with your service provider ID.
+ *
+ * @since_tizen 2.3
+ * @remarks @a service_provider_id is a mandatory field.
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be assigned by account_type_create().
+ * @param[in] service_provider_id The service provider ID
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_service_provider_id()
+ */
+int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id);
+
+/**
+ * @internal
+ * @brief Sets icon path.
+ * It represents your service provider or an application.
+ *
+ * @since_tizen 2.3
+ * @remarks @a icon_path is not a mandatory field. But when it is set, you can display this icon in the Add Account screen.
+ *
+ * @param[in] account_type The account provider handle\n
+ * It should be assigned by account_type_create().
+ * @param[in] icon_path The icon path of the application
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_icon_path()
+ */
+int account_type_set_icon_path(account_type_h account_type, const char *icon_path);
+
+/**
+ * @internal
+ * @brief Sets small icon path.
+ * It also represents your service provider or an application.
+ *
+ * @since_tizen 2.3
+ * @remarks @a small_icon_path is not a mandatory field.
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be assigned by account_type_create().
+ * @param[in] small_icon_path The scaled icon of your application
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_small_icon_path()
+ */
+int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path);
+
+/**
+ * @internal
+ * @brief Sets support for multiple accounts.
+ * It represents whether your application supports multiple accounts.
+ *
+ * @since_tizen 2.3
+ * @remarks The default value of multiple account support is @c FALSE.
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be assigned by account_type_create().
+ * @param[in] multiple_account_support Set @c TRUE if your application can support two or more accounts, \n
+ * otherwise @c FALSE if your application can support only one account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_multiple_account_support()
+ */
+int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support);
+
+/**
+ * @internal
+ * @brief Sets label and locale.
+ * Label represents the name of an account provider.
+ *
+ * @since_tizen 2.3
+ * @param[in] account_type The account provider handle \n
+ * It should be assigned by account_type_create().
+ * @param[in] label The name of account depends on the specified locale
+ * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
+ * For example, "ko_KR" for Korean, "en_US" for American English.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_label()
+ */
+int account_type_set_label(account_type_h account_type, const char* label, const char* locale);
+
+/**
+ * @internal
+ * @brief Sets the capability.
+ *
+ * @since_tizen 2.3
+ * @param[in] account_type The account provider handle
+ * @param[in] provider_feature Th capability key of the account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_capability()
+ */
+int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature);
+
+/**
+ * @internal
+ * @brief Inserts the account provider details to the database.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks this API need both privileges
+ * @param[in] account_type The account handle which is created by account_type_create() \n
+ * @param[out] account_type_id The account provider ID to be assigned after inserting the account provider handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect().
+ * @post account_disconnect() is recommended after insertion.
+ *
+ * @see account_connect()
+ * @see account_disconnect()
+ */
+int account_type_insert_to_db(account_type_h account_type, int* account_type_id);
+
+/**
+ * @internal
+ * @brief Updates the account details to the account database.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks this API need both privileges
+ * @param[in] account_type The account handle which is created by account_type_create() \n
+ * @param[in] app_id The application ID of the account provider
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ *
+ * @pre This function requires an open connection to an account service by account_connect().
+ * @post account_disconnect() is recommended after update.
+ *
+ * @see account_connect()
+ * @see account_disconnect()
+ */
+int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id);
+
+/**
+ * @internal
+ * @brief Deletes the account provider from the account database by application ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks this API need both privileges
+ * @param[in] app_id The application ID of account provider to be deleted
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect().
+ *
+ * @see account_connect()
+ * @see account_disconnect()
+ */
+int account_type_delete_by_app_id(const char* app_id);
+
+/**
+ * @internal
* @brief Start to subscribe account event through the given callback function
*
* @param[in] account_subscribe The account subscription handle
@@ -50,7 +352,7 @@ extern "C"
* @see account_unsubscribe_notification()
* @see account_subscribe_notification()
*/
-ACCOUNT_API int account_subscribe_notification_ex(account_subscribe_h account_subscribe, account_event_cb cb_func, void* user_data);
+int account_subscribe_notification_ex(account_subscribe_h account_subscribe, account_event_cb cb_func, void* user_data);
/**
* @internal
@@ -68,7 +370,32 @@ ACCOUNT_API int account_subscribe_notification_ex(account_subscribe_h account_su
* @see account_unsubscribe_notification()
* @see account_subscribe_notification()
*/
-ACCOUNT_API int account_unsubscribe_notification_ex(account_subscribe_h account_subscribe);
+int account_unsubscribe_notification_ex(account_subscribe_h account_subscribe);
+
+/**
+ * @internal
+ * @brief Gets the count of accounts whose secrect state is visible in the account database.
+ * @since_tizen 2.3
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[out] count The out parameter for count of all accounts
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_ACCESS_DENIED DB Access fail by permission
+ *
+ * @pre This function requires an open connection to an account service by account_connect().
+ *
+ */
+int account_get_total_count_from_db_ex(int *count);
+
+/*offline apis*/
+int account_type_insert_to_db_offline(account_type_h account_type, int* account_type_id);
+
+int account_type_delete_by_app_id_offline(const char* app_id);
/**
* @}
diff --git a/include/mobile/account.h b/include/mobile/account.h
new file mode 100644
index 0000000..b60c511
--- /dev/null
+++ b/include/mobile/account.h
@@ -0,0 +1,1857 @@
+/*
+ *
+ * Copyright (c) 2012 - 2013 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 __ACCOUNT_H__
+#define __ACCOUNT_H__
+
+#include <account-types.h>
+#include <account-error.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef ACCOUNT_API
+#define ACCOUNT_API __attribute__ ((visibility("default")))
+#endif
+
+/**
+ * @file account.h
+ * @brief This file contains the Account API for account management.
+ */
+
+/**
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called once for each account from the database.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_foreach_account_from_db(), account_query_account_by_account_id(), account_query_account_by_user_name() or account_query_account_by_package_name() must be called.
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+typedef bool (*account_cb)(account_h account, void *user_data);
+
+/**
+ * @brief Called once for each capability of an account in the database.
+ *
+ * @since_tizen 2.3
+ * @param[in] capability_type The capability type
+ * @param[in] capability_state The capability state
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_query_capability_by_account_id() must be called.
+ *
+ * @see account_query_capability_by_account_id()
+ */
+typedef bool (*capability_cb)(const char* capability_type, account_capability_state_e capability_state, void *user_data);
+
+/**
+ * @brief Called once for each custom data of an account in the database.
+ *
+ * @since_tizen 2.3
+ * @param[in] key The user custom key
+ * @param[in] value The user custom value of the specific key
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_query_capability_by_account_id() must be called.
+ *
+ * @see account_query_capability_by_account_id()
+ */
+typedef bool (*account_custom_cb)(char* key, char* value, void *user_data);
+
+
+/**
+ * @brief Called once for each account provider in the database.
+ *
+ * @since_tizen 2.3
+ * @param[in] account_type The account provider handle
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_type_foreach_account_type_from_db(), account_type_query_by_provider_feature() must be called.
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_provider_feature()
+ */
+typedef bool (*account_type_cb)(account_type_h account_type, void *user_data);
+
+
+/**
+ * @brief Called once for each account label.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_id The application ID
+ * @param[in] label The name of the account depends on the specified locale
+ * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
+ * For example, "ko_KR" for Korean, "en_US" for American English.
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_type_get_label(), account_type_query_label_by_app_id() must be called.
+ *
+ * @see account_type_get_label()
+ * @see account_type_query_label_by_app_id()
+ */
+typedef bool (*account_label_cb)(char* app_id, char* label, char* locale, void *user_data);
+
+
+/**
+ * @brief Called once for each capability of an account provider in the database.
+ *
+ * @since_tizen 2.3
+ * @param[in] app_id The application ID
+ * @param[in] key The user custom key
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_type_query_provider_feature_by_app_id(), account_type_get_provider_feature_all() must be called.
+ *
+ * @see account_type_query_provider_feature_by_app_id()
+ * @see account_type_get_provider_feature_all()
+ */
+typedef bool (*provider_feature_cb)(char* app_id, char* key, void* user_data);
+
+
+/**
+ * @brief Called once when an event occurs.
+ *
+ * @since_tizen 2.3
+ * @param[in] event_type The account event type
+ * @param[in] account_id The account ID to update
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_subscribe_notification() must be called.
+ *
+ * @see account_subscribe_notification()
+ */
+typedef bool (*account_event_cb)(const char* event_type, int account_id, void* user_data);
+
+
+/**
+ * @deprecated Deprecated since Tizen 2.4.\n
+ * This API is not necessary to use since Tizen 2.4.
+ * @brief Connects to the account database by readwrite mode.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.wirte
+ * @remarks This API need both privileges
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ */
+int account_connect(void);
+
+
+/**
+ * @deprecated Deprecated since Tizen 2.4.\n
+ * This API is not necessary to use since Tizen 2.4.
+ * @brief Connects to the account database by readonly mode.
+ *
+ * @since_tizen 2.3
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ */
+int account_connect_readonly(void);
+
+
+/**
+ * @deprecated Deprecated since Tizen 2.4.\n
+ * This API is not necessary to use since Tizen 2.4.
+ * @brief Disconnects from the account database.
+ *
+ * @since_tizen 2.3
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite busy handler exprired
+ */
+int account_disconnect(void);
+
+/**
+ * @brief Creates a handle to the account.
+ *
+ * @since_tizen 2.3
+ * @remarks Release @a account using account_destroy().
+ * @remarks The created handle is not added to the account database until account_insert_to_db() is called.
+ *
+ * @param[in] account The account handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_destroy()
+ */
+int account_create(account_h *account);
+
+
+/**
+ * @brief Destroys the account handle and releases all its resources.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_create()
+ */
+int account_destroy(account_h account);
+
+
+/**
+ * @brief Inserts the account details to the account database.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges
+ * @param[in] account The account handle
+ * @param[out] account_db_id The account ID to be assigned to an account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_DUPLICATED Same user name exists in your application
+ * @retval #ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE Tried to add an account in spite of multiple false accounts
+ * @retval #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER Tried to add an account though you did not register the account type in manifest
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_insert_to_db(account_h account, int *account_db_id);
+
+
+/**
+ * @brief Deletes an account from the account database by account DB ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can delete an account which was added by same package applications
+ * @param[in] account_db_id The account ID to delete
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED The account owner is different from the caller or DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_id(int account_db_id);
+
+
+/**
+ * @brief Deletes an account from the account database by user name.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can delete accounts which were added by same package applications
+ * @param[in] user_name The user name of the account to delete
+ * @param[in] package_name The package name of the account to delete
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_user_name(char *user_name, char *package_name);
+
+
+/**
+ * @brief Deletes an account from the account database by package name.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can delete accounts which was added by same package applications
+ * @param[in] package_name The package name of account(s) to delete
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_package_name(const char *package_name);
+
+/**
+ * @brief Updates the account details to the account database.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
+ * @param[in] account The account handle
+ * @param[in] account_id The account ID to update
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_update_to_db_by_id(account_h account, int account_id);
+
+/**
+ * @brief Updates the account details to the account database.
+ * The provider permission check has been added since tizen 2.4.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
+ * @param[in] account The account handle
+ * @param[in] account_id The account ID to update
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_update_to_db_by_id_ex(account_h account, int account_id);
+
+/**
+ * @brief Updates the account details to the account database.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update accounts which were added by same package applications
+ * @param[in] account The account handle
+ * @param[in] user_name The user name of the account to update
+ * @param[in] package_name The package name for the user name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ *
+ */
+int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
+
+/**
+ * @brief Gets the ID of an account.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[out] account_id The account ID
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int account_get_account_id(account_h account, int *account_id);
+
+/**
+ * @brief Gets the user name of an account.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a user_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] user_name The user name of the account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_user_name()
+ */
+int account_get_user_name(account_h account, char **user_name);
+
+
+/**
+ * @brief Sets the user name of an account.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] user_name The string to set as user name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_name()
+ */
+int account_set_user_name(account_h account, const char *user_name);
+
+
+/**
+ * @brief Gets the display name of an account.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a display_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] display_name The display name of the account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_get_display_name()
+ */
+int account_get_display_name(account_h account, char **display_name);
+
+
+/**
+ * @brief Sets the display name of an account.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] display_name The text string to set as the display name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_display_name()
+ */
+int account_set_display_name(account_h account, const char *display_name);
+
+/**
+ * @brief Gets the capability detail of an account.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] capability_type The capability type to get the capability value
+ * @param[out] capability_value The capability value (on/off) of the specified capability_type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability_type in the account
+ *
+ * @see account_set_capability()
+ */
+int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value);
+
+/**
+ * @brief Gets all the capabilities of an account.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] callback The callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_capability()
+ */
+int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
+
+/**
+ * @brief Sets the capability.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] capability_type The capability type
+ * @param[in] capability_state The capability state
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_capability()
+ */
+int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_state);
+
+
+/**
+ * @brief Gets the icon path.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a icon_path using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] icon_path The icon path
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_icon_path()
+ */
+int account_get_icon_path(account_h account, char **icon_path);
+
+
+/**
+ * @brief Sets the icon path.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] icon_path The text string to set as the icon path
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_icon_path()
+ */
+int account_set_icon_path(account_h account, const char *icon_path);
+
+
+/**
+ * @brief Gets the domain name.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a domain_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] domain_name The domain name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_domain_name()
+ */
+int account_get_domain_name(account_h account, char **domain_name);
+
+
+/**
+ * @brief Sets the domain name.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] domain_name The text string to set as the domain name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_domain_name()
+ */
+int account_set_domain_name(account_h account, const char *domain_name);
+
+
+/**
+ * @brief Gets the email address.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a email_address using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] email_address The email address
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_email_address()
+ */
+int account_get_email_address(account_h account, char **email_address);
+
+
+/**
+ * @brief Sets the email address.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] email_address The text string to set as the email address
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_email_address()
+ */
+int account_set_email_address(account_h account, const char *email_address);
+
+
+/**
+ * @brief Gets the package name.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a package_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] package_name The package name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_package_name()
+ */
+int account_get_package_name(account_h account, char **package_name);
+
+
+/**
+ * @brief Sets the package name.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] package_name The text string to set as the package name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_email_address()
+ */
+int account_set_package_name(account_h account, const char *package_name);
+
+
+/**
+ * @brief Gets the access token. Access token field is used to store account secrets (such as password or master token).
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a access_token using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] access_token The access token
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @remarks Access token field is used for storing account secret (password / master token etc)
+ * Only account owner application can retrieve account password / access_token. For others this field will be null.
+ * @see account_set_access_token()
+ */
+int account_get_access_token(account_h account, char **access_token);
+
+
+/**
+ * @brief Sets the access token. Access token field is used to store account secrets (such as password or master token).
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] access_token The text string to set as the access token
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @remarks Only account owner application can retrieve account password / access_token. For others this field will be null.
+ * @see account_get_access_token()
+ */
+int account_set_access_token(account_h account, const char *access_token);
+
+
+/**
+ * @brief Gets the user text.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a user_text using free().
+ *
+ * @param[in] account The account handle
+ * @param[in] user_text_index The index of the user text (range: 0 ~ 4)
+ * @param[out] user_text The user text
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_user_text()
+ */
+int account_get_user_text(account_h account, int user_text_index, char **user_text);
+
+
+/**
+ * @brief Sets the user text.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] user_text_index The index of the user text (must be in range from @c 0 to @c 4)
+ * @param[in] user_text The text string to set as the user text
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_text()
+ */
+int account_set_user_text(account_h account, int user_text_index, const char *user_text);
+
+
+/**
+ * @brief Gets the user integer.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
+ * @param[out] user_integer The user integer
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_user_int()
+ */
+int account_get_user_int(account_h account, int user_int_index, int *user_integer);
+
+
+/**
+ * @brief Sets the user integer.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
+ * @param[in] user_integer The integer to set as the user integer
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_int()
+ */
+int account_set_user_int(account_h account, int user_int_index, int user_integer);
+
+
+/**
+ * @brief Gets the auth type.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[out] auth_type The auth type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_auth_type()
+ */
+int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
+
+
+/**
+ * @brief Sets the auth type.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] auth_type The integer to be set as the auth type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_auth_type()
+ */
+int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
+
+
+/**
+ * @brief Gets the secret.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[out] secret The secret
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_secret()
+ */
+int account_get_secret(account_h account, account_secrecy_state_e *secret);
+
+
+/**
+ * @brief Sets the secret.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] secret The secrecy to be set
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_secret()
+ */
+int account_set_secret(account_h account, const account_secrecy_state_e secret);
+
+/**
+ * @brief Gets the sync support.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[out] sync_support The sync support
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_sync_support()
+ */
+int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
+
+
+/**
+ * @brief Sets the sync support.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] sync_support The sync state to be set
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_sync_support()
+ */
+int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
+
+
+/**
+ * @brief Gets the source.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a user_text using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] source The source
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_source()
+ */
+int account_get_source(account_h account, char **source);
+
+
+/**
+ * @brief Sets the source.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] source The text string to set as the source
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_source()
+ */
+int account_set_source(account_h account, const char *source);
+
+/**
+ * @brief Sets the custom.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] key The user custom key for the specific value
+ * @param[in] value The user custom value about the given key
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_custom()
+ */
+int account_set_custom(account_h account, const char* key, const char* value);
+
+/**
+ * @brief Gets the user specific custom text of an account key.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] key The key to retrieve custom text
+ * @param[out] value The text of the given key
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability type in the account
+ *
+ * @see account_set_custom()
+ */
+int account_get_custom(account_h account, const char* key, char** value);
+
+
+/**
+ * @brief Gets all the user custom texts of an account.
+ *
+ * @since_tizen 2.3
+ * @param[in] account The account handle
+ * @param[in] callback The callback function to retrieve all custom text \n
+ * The callback function gives the key and value.
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_custom()
+ */
+int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data);
+
+/**
+ * @brief Retrieves all accounts details by invoking the given callback function iteratively.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ * @post This function invokes account_cb().
+ *
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ */
+int account_foreach_account_from_db(account_cb callback, void *user_data);
+
+
+/**
+ * @brief Retrieve an account with the account ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] account_db_id The account database ID to search
+ * @param[out] account The account handle \n
+ * Must be allocated by account_create() and freed after using by account_destroy().
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ */
+int account_query_account_by_account_id(int account_db_id, account_h *account);
+
+/**
+ * @brief Retrieves all accounts with the user name.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_name The user name to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ *
+ */
+int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
+
+/**
+ * @brief Retrieves all accounts with the package name.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] package_name The package name to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_capability()
+ */
+int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
+
+/**
+ * @brief Retrieves all accounts with the capability type and capability value.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] capability_type The capability type to search
+ * @param[in] capability_value The capability value to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data);
+
+/**
+ * @brief Retrieves all accounts with the capability type.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] capability_type The capability type to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data);
+
+/**
+ * @brief Retrieves all capabilities with the account database ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] account_db_id The account database ID to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ * @post This function invokes capability_cb().
+ *
+ * @see account_get_capability()
+ * @see account_set_capability()
+ */
+int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
+
+
+/**
+ * @brief Gets the count of accounts in the account database.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[out] count The out parameter for count of all accounts
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ */
+int account_get_total_count_from_db(int *count);
+
+/**
+ * @brief Updates the sync status of an account with the given account ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
+ * @param[in] account_db_id The account ID for which sync status needs to be changed
+ * @param[in] sync_status The new sync status
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ */
+int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
+
+
+/* Account type API */
+
+
+/**
+ * @brief Creates a handle to the account provider.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a account_type handle using account_type_destroy().\n
+ *
+ * @param[in] account_type The account provider handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_destroy()
+ */
+int account_type_create(account_type_h *account_type);
+
+/**
+ * @brief Destroys the account provider handle and releases all its resources.
+ *
+ * @since_tizen 2.3
+ *
+ * @remarks When you get @a account_type_h using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak.
+ *
+ * @param[in] account_type The account provider handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_create()
+ */
+int account_type_destroy(account_type_h account_type);
+
+/**
+ * @brief Retrieves capability information with your application ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function carries the capability name of an app ID
+ * @param[in] app_id The application ID to search
+ * @param[in] user_data The user data \n
+ * If you have your private data to carry into callback function, then you can use it.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ */
+int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data );
+
+/**
+ * @brief Checks whether the given application ID supports the capability.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] app_id The application ID
+ * @param[in] capability The capability \n
+ * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
+ *
+ * @return @c TRUE if the application supports the given capability, \n
+ * otherwise @c FALSE if the application does not support the given capability
+ * @retval @c TRUE means the application supports the given capability
+ * @retval @c FALSE means the application does not support the given capability
+ * @exception #ACCOUNT_ERROR_NONE Successful
+ * @exception #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
+ * @excaption #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @exception #ACCOUNT_ERROR_PERMISSION_DENIED DB access fail by permission
+ * @excaption #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @excaption #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ */
+bool account_type_query_supported_feature(const char* app_id, const char* capability);
+
+/**
+ * @brief Gets the application ID of an account provider.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a app_id using free().
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] app_id The application ID of an account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_app_id(account_type_h account_type, char **app_id);
+
+/**
+ * @brief Gets the service provider ID of an account provider.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a service_provider_id using free().
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] service_provider_id The service provider text ID of an account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
+
+/**
+ * @brief Gets the icon path of an account provider.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a icon_path using free().
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] icon_path The icon path of the account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_icon_path(account_type_h account_type, char **icon_path);
+
+/**
+ * @brief Gets the small icon path of an account provider.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a small_icon_path using free().
+ *
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] small_icon_path The small icon path of the account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
+
+/**
+ * @brief Checks whether the given account provider supports multiple accounts.
+ *
+ * @since_tizen 2.3
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db.
+ * @param[out] multiple_account_support The flag indicating support for multiple accounts accounts\n
+ * TRUE or FALSE.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
+
+/**
+ * @brief Gets capability information with the given account provider handle.
+ *
+ * @since_tizen 2.3
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[in] callback The callback function that carries the capability name of the app ID
+ * @param[in] user_data The user data \n
+ * If you have your private data to carry into callback function, then you can use it.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ */
+int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data);
+
+/**
+ * @brief Gets the specific label information detail of an account provider.
+ *
+ * @since_tizen 2.3
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
+ * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
+ * @param[out] label The label text given for the locale
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND No label for the given locale
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+
+int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label);
+
+/**
+ * @brief Gets the label information detail of an account provider.
+ *
+ * @since_tizen 2.3
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[in] callback The callback function carrying the label information
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves the label information with your application ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function that carries label_h for label information \n
+ * label_h contains label info as parameter.
+ * @param[in] app_id The application ID to search
+ * @param[in] user_data The user data \n
+ * If you have your private data to carry into callback function, then you can use it.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_type_query_by_app_id()
+ * @see account_type_foreach_account_type_from_db()
+ */
+int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data );
+
+/**
+ * @brief Retrieves the account provider information with your application ID.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] app_id The application ID to search
+ * @param[out] account_type The account handle which is created by account_type_create()
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Queried data does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_type_create()
+ * @see account_type_get_app_id()
+ * @see account_type_get_service_provider_id()
+ * @see account_type_get_icon_path()
+ * @see account_type_get_small_icon_path()
+ * @see account_type_get_multiple_account_support()
+ * @see account_type_get_label()
+ * @see account_type_destroy()
+ */
+int account_type_query_by_app_id(const char* app_id, account_type_h *account_type);
+
+/**
+ * @brief Retrieves all account priovider information.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The account provider information \n
+ * You can get the account information through account_type_get_* with the carried account_type_handle.
+ * @param[in] user_data The user data \n
+ * It will be carried through your callback function.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_type_create()
+ * @see account_type_get_app_id()
+ * @see account_type_get_service_provider_id()
+ * @see account_type_get_icon_path()
+ * @see account_type_get_small_icon_path()
+ * @see account_type_get_multiple_account_support()
+ * @see account_type_get_label()
+ * @see account_type_destroy()
+ */
+int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves the label information with the given application ID and locale.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] app_id The application ID
+ * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
+ * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
+ * @param[out] label The label text corresponding app_id and locale \n
+ * It must be free text.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ */
+int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label);
+
+/**
+ * @brief Retrieves account provider information with the capability name.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to retrieve account provider information
+ * @param[in] key The capability value to search account provider \n
+ * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
+ * @param[in] user_data If you have your private data to carry into callback function, then you can use it
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ */
+int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data);
+
+/**
+ * @brief Checks whether the given app_id exists in the account provider DB.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] app_id The application ID to check
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid app ID
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
+ * But the account_connect() is not required to use this function since tizen 2.4.
+ *
+ * @see account_type_query_by_app_id()
+ */
+int account_type_query_app_id_exist(const char* app_id);
+
+
+
+/* End of account provider API */
+
+/**
+ * @brief Creates a handle for the account event subscription.
+ *
+ * @since_tizen 2.3
+ * @remarks You must release @a account_subscribe handle using account_unsubscribe_notification().
+ *
+ * @param[in] account_subscribe The account subscription handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_unsubscribe_notification()
+ * @see account_subscribe_notification()
+ */
+int account_subscribe_create(account_subscribe_h* account_subscribe);
+
+/**
+ * @brief Starts to subscribe account event through the given callback function.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * @param[in] account_subscribe The account subscription handle
+ * @param[in] callback The callback function that is called when an account is removed and a data of account is updated from the account database \n
+ * It will be called with event message and account ID.
+ * @param[in] user_data The user_data that is delivered to callback
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Subscription fail
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre account_subscribe_create()
+ *
+ * @see account_unsubscribe_notification()
+ * @see account_subscribe_notification()
+ */
+int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data);
+
+/**
+ * @brief Destroys the account subscribe handle and releases all its resources.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * @remarks You must call @a account_unsubscribe_notification when you do not need to subscribe account event.
+ *
+ * @param[in] account_subscribe The account subscription handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Unsubscription failed
+ *
+ * @see account_create()
+ */
+int account_unsubscribe_notification(account_subscribe_h account_subscribe);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //__ACCOUNT_H_
diff --git a/include/wearable/account.h b/include/wearable/account.h
new file mode 100644
index 0000000..cb92acc
--- /dev/null
+++ b/include/wearable/account.h
@@ -0,0 +1,1746 @@
+/*
+ *
+ * Copyright (c) 2012 - 2013 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 __ACCOUNT_H__
+#define __ACCOUNT_H__
+
+#include <account-types.h>
+#include <account-error.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef ACCOUNT_API
+#define ACCOUNT_API __attribute__ ((visibility("default")))
+#endif
+
+/**
+ * @file account.h
+ * @brief This file contains the Account API for account management.
+ */
+
+/**
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called once for each account from the database.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_foreach_account_from_db(), account_query_account_by_account_id(), account_query_account_by_user_name() or account_query_account_by_package_name() must be called.
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+typedef bool (*account_cb)(account_h account, void *user_data);
+
+/**
+ * @brief Called once for each capability of an account in the database.
+ *
+ * @since_tizen 2.4
+ * @param[in] capability_type The capability type
+ * @param[in] capability_state The capability state
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_query_capability_by_account_id() must be called.
+ *
+ * @see account_query_capability_by_account_id()
+ */
+typedef bool (*capability_cb)(const char* capability_type, account_capability_state_e capability_state, void *user_data);
+
+/**
+ * @brief Called once for each custom data of an account in the database.
+ *
+ * @since_tizen 2.4
+ * @param[in] key The user custom key
+ * @param[in] value The user custom value of the specific key
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_query_capability_by_account_id() must be called.
+ *
+ * @see account_query_capability_by_account_id()
+ */
+typedef bool (*account_custom_cb)(char* key, char* value, void *user_data);
+
+
+/**
+ * @brief Called once for each account provider in the database.
+ *
+ * @since_tizen 2.4
+ * @param[in] account_type The account provider handle
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_type_foreach_account_type_from_db(), account_type_query_by_provider_feature() must be called.
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_provider_feature()
+ */
+typedef bool (*account_type_cb)(account_type_h account_type, void *user_data);
+
+
+/**
+ * @brief Called once for each account label.
+ *
+ * @since_tizen 2.4
+ * @param[in] app_id The application ID
+ * @param[in] label The name of the account depends on the specified locale
+ * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
+ * For example, "ko_KR" for Korean, "en_US" for American English.
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_type_get_label(), account_type_query_label_by_app_id() must be called.
+ *
+ * @see account_type_get_label()
+ * @see account_type_query_label_by_app_id()
+ */
+typedef bool (*account_label_cb)(char* app_id, char* label, char* locale, void *user_data);
+
+
+/**
+ * @brief Called once for each capability of an account provider in the database.
+ *
+ * @since_tizen 2.4
+ * @param[in] app_id The application ID
+ * @param[in] key The user custom key
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_type_query_provider_feature_by_app_id(), account_type_get_provider_feature_all() must be called.
+ *
+ * @see account_type_query_provider_feature_by_app_id()
+ * @see account_type_get_provider_feature_all()
+ */
+typedef bool (*provider_feature_cb)(char* app_id, char* key, void* user_data);
+
+
+/**
+ * @brief Called once when an event occurs.
+ *
+ * @since_tizen 2.4
+ * @param[in] event_type The account event type
+ * @param[in] account_id The account ID to update
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * otherwise @c false to break out of the loop
+ *
+ * @pre account_subscribe_notification() must be called.
+ *
+ * @see account_subscribe_notification()
+ */
+typedef bool (*account_event_cb)(const char* event_type, int account_id, void* user_data);
+
+/**
+ * @brief Creates a handle to the account.
+ *
+ * @since_tizen 2.4
+ * @remarks Release @a account using account_destroy().
+ * @remarks The created handle is not added to the account database until account_insert_to_db() is called.
+ *
+ * @param[in] account The account handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_destroy()
+ */
+int account_create(account_h *account);
+
+
+/**
+ * @brief Destroys the account handle and releases all its resources.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_create()
+ */
+int account_destroy(account_h account);
+
+
+/**
+ * @brief Inserts the account details to the account database.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges
+ * @param[in] account The account handle
+ * @param[out] account_db_id The account ID to be assigned to an account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_DUPLICATED Same user name exists in your application
+ * @retval #ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE Tried to add an account in spite of multiple false accounts
+ * @retval #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER Tried to add an account though you did not register the account type in manifest
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_insert_to_db(account_h account, int *account_db_id);
+
+
+/**
+ * @brief Deletes an account from the account database by account DB ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can delete an account which was added by same package applications
+ * @param[in] account_db_id The account ID to delete
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED The account owner is different from the caller or DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_id(int account_db_id);
+
+
+/**
+ * @brief Deletes an account from the account database by user name.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can delete accounts which were added by same package applications
+ * @param[in] user_name The user name of the account to delete
+ * @param[in] package_name The package name of the account to delete
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_user_name(char *user_name, char *package_name);
+
+
+/**
+ * @brief Deletes an account from the account database by package name.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can delete accounts which was added by same package applications
+ * @param[in] package_name The package name of account(s) to delete
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_package_name(const char *package_name);
+
+/**
+ * @brief Updates the account details to the account database.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
+ * @param[in] account The account handle
+ * @param[in] account_id The account ID to update
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_update_to_db_by_id(account_h account, int account_id);
+
+/**
+ * @brief Updates the account details to the account database.
+ * The provider permission check has been added since tizen 2.4.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
+ * @param[in] account The account handle
+ * @param[in] account_id The account ID to update
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_update_to_db_by_id_ex(account_h account, int account_id);
+
+/**
+ * @brief Updates the account details to the account database.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update accounts which were added by same package applications
+ * @param[in] account The account handle
+ * @param[in] user_name The user name of the account to update
+ * @param[in] package_name The package name for the user name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ *
+ */
+int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
+
+/**
+ * @brief Gets the ID of an account.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[out] account_id The account ID
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int account_get_account_id(account_h account, int *account_id);
+
+/**
+ * @brief Gets the user name of an account.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a user_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] user_name The user name of the account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_user_name()
+ */
+int account_get_user_name(account_h account, char **user_name);
+
+
+/**
+ * @brief Sets the user name of an account.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] user_name The string to set as user name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_name()
+ */
+int account_set_user_name(account_h account, const char *user_name);
+
+
+/**
+ * @brief Gets the display name of an account.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a display_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] display_name The display name of the account
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_get_display_name()
+ */
+int account_get_display_name(account_h account, char **display_name);
+
+
+/**
+ * @brief Sets the display name of an account.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] display_name The text string to set as the display name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_display_name()
+ */
+int account_set_display_name(account_h account, const char *display_name);
+
+/**
+ * @brief Gets the capability detail of an account.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] capability_type The capability type to get the capability value
+ * @param[out] capability_value The capability value (on/off) of the specified capability_type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability_type in the account
+ *
+ * @see account_set_capability()
+ */
+int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value);
+
+/**
+ * @brief Gets all the capabilities of an account.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] callback The callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_capability()
+ */
+int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
+
+/**
+ * @brief Sets the capability.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] capability_type The capability type
+ * @param[in] capability_state The capability state
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_capability()
+ */
+int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_state);
+
+
+/**
+ * @brief Gets the icon path.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a icon_path using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] icon_path The icon path
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_icon_path()
+ */
+int account_get_icon_path(account_h account, char **icon_path);
+
+
+/**
+ * @brief Sets the icon path.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] icon_path The text string to set as the icon path
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_icon_path()
+ */
+int account_set_icon_path(account_h account, const char *icon_path);
+
+
+/**
+ * @brief Gets the domain name.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a domain_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] domain_name The domain name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_domain_name()
+ */
+int account_get_domain_name(account_h account, char **domain_name);
+
+
+/**
+ * @brief Sets the domain name.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] domain_name The text string to set as the domain name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_domain_name()
+ */
+int account_set_domain_name(account_h account, const char *domain_name);
+
+
+/**
+ * @brief Gets the email address.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a email_address using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] email_address The email address
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_email_address()
+ */
+int account_get_email_address(account_h account, char **email_address);
+
+
+/**
+ * @brief Sets the email address.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] email_address The text string to set as the email address
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_email_address()
+ */
+int account_set_email_address(account_h account, const char *email_address);
+
+
+/**
+ * @brief Gets the package name.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a package_name using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] package_name The package name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_package_name()
+ */
+int account_get_package_name(account_h account, char **package_name);
+
+
+/**
+ * @brief Sets the package name.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] package_name The text string to set as the package name
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_email_address()
+ */
+int account_set_package_name(account_h account, const char *package_name);
+
+
+/**
+ * @brief Gets the access token. Access token field is used to store account secrets (such as password or master token).
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a access_token using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] access_token The access token
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @remarks Access token field is used for storing account secret (password / master token etc)
+ * Only account owner application can retrieve account password / access_token. For others this field will be null.
+ * @see account_set_access_token()
+ */
+int account_get_access_token(account_h account, char **access_token);
+
+
+/**
+ * @brief Sets the access token. Access token field is used to store account secrets (such as password or master token).
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] access_token The text string to set as the access token
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @remarks Only account owner application can retrieve account password / access_token. For others this field will be null.
+ * @see account_get_access_token()
+ */
+int account_set_access_token(account_h account, const char *access_token);
+
+
+/**
+ * @brief Gets the user text.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a user_text using free().
+ *
+ * @param[in] account The account handle
+ * @param[in] user_text_index The index of the user text (range: 0 ~ 4)
+ * @param[out] user_text The user text
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_user_text()
+ */
+int account_get_user_text(account_h account, int user_text_index, char **user_text);
+
+
+/**
+ * @brief Sets the user text.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] user_text_index The index of the user text (must be in range from @c 0 to @c 4)
+ * @param[in] user_text The text string to set as the user text
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_text()
+ */
+int account_set_user_text(account_h account, int user_text_index, const char *user_text);
+
+
+/**
+ * @brief Gets the user integer.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
+ * @param[out] user_integer The user integer
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_user_int()
+ */
+int account_get_user_int(account_h account, int user_int_index, int *user_integer);
+
+
+/**
+ * @brief Sets the user integer.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
+ * @param[in] user_integer The integer to set as the user integer
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_int()
+ */
+int account_set_user_int(account_h account, int user_int_index, int user_integer);
+
+
+/**
+ * @brief Gets the auth type.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[out] auth_type The auth type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_auth_type()
+ */
+int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
+
+
+/**
+ * @brief Sets the auth type.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] auth_type The integer to be set as the auth type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_auth_type()
+ */
+int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
+
+
+/**
+ * @brief Gets the secret.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[out] secret The secret
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_secret()
+ */
+int account_get_secret(account_h account, account_secrecy_state_e *secret);
+
+
+/**
+ * @brief Sets the secret.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] secret The secrecy to be set
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_secret()
+ */
+int account_set_secret(account_h account, const account_secrecy_state_e secret);
+
+/**
+ * @brief Gets the sync support.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[out] sync_support The sync support
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_sync_support()
+ */
+int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
+
+
+/**
+ * @brief Sets the sync support.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] sync_support The sync state to be set
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_sync_support()
+ */
+int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
+
+
+/**
+ * @brief Gets the source.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a user_text using free().
+ *
+ * @param[in] account The account handle
+ * @param[out] source The source
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_source()
+ */
+int account_get_source(account_h account, char **source);
+
+
+/**
+ * @brief Sets the source.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] source The text string to set as the source
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_source()
+ */
+int account_set_source(account_h account, const char *source);
+
+/**
+ * @brief Sets the custom.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] key The user custom key for the specific value
+ * @param[in] value The user custom value about the given key
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_custom()
+ */
+int account_set_custom(account_h account, const char* key, const char* value);
+
+/**
+ * @brief Gets the user specific custom text of an account key.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] key The key to retrieve custom text
+ * @param[out] value The text of the given key
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability type in the account
+ *
+ * @see account_set_custom()
+ */
+int account_get_custom(account_h account, const char* key, char** value);
+
+
+/**
+ * @brief Gets all the user custom texts of an account.
+ *
+ * @since_tizen 2.4
+ * @param[in] account The account handle
+ * @param[in] callback The callback function to retrieve all custom text \n
+ * The callback function gives the key and value.
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_custom()
+ */
+int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data);
+
+/**
+ * @brief Retrieves all accounts details by invoking the given callback function iteratively.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @post This function invokes account_cb().
+ *
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ */
+int account_foreach_account_from_db(account_cb callback, void *user_data);
+
+
+/**
+ * @brief Retrieve an account with the account ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] account_db_id The account database ID to search
+ * @param[out] account The account handle \n
+ * Must be allocated by account_create() and freed after using by account_destroy().
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ */
+int account_query_account_by_account_id(int account_db_id, account_h *account);
+
+/**
+ * @brief Retrieves all accounts with the user name.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_name The user name to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ *
+ */
+int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
+
+/**
+ * @brief Retrieves all accounts with the package name.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] package_name The package name to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_capability()
+ */
+int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
+
+/**
+ * @brief Retrieves all accounts with the capability type and capability value.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] capability_type The capability type to search
+ * @param[in] capability_value The capability value to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data);
+
+/**
+ * @brief Retrieves all accounts with the capability type.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] capability_type The capability type to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @post This function invokes account_cb().
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data);
+
+/**
+ * @brief Retrieves all capabilities with the account database ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to invoke
+ * @param[in] account_db_id The account database ID to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @post This function invokes capability_cb().
+ *
+ * @see account_get_capability()
+ * @see account_set_capability()
+ */
+int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
+
+
+/**
+ * @brief Gets the count of accounts in the account database.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[out] count The out parameter for count of all accounts
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ */
+int account_get_total_count_from_db(int *count);
+
+/**
+ * @brief Updates the sync status of an account with the given account ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * %http://tizen.org/privilege/account.write
+ * @remarks This API need both privileges \n
+ * Only can update an account which was added by same package applications
+ * @param[in] account_db_id The account ID for which sync status needs to be changed
+ * @param[in] sync_status The new sync status
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ */
+int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
+
+
+/* Account type API */
+
+
+/**
+ * @brief Creates a handle to the account provider.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a account_type handle using account_type_destroy().\n
+ *
+ * @param[in] account_type The account provider handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_destroy()
+ */
+int account_type_create(account_type_h *account_type);
+
+/**
+ * @brief Destroys the account provider handle and releases all its resources.
+ *
+ * @since_tizen 2.4
+ *
+ * @remarks When you get @a account_type_h using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak.
+ *
+ * @param[in] account_type The account provider handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_create()
+ */
+int account_type_destroy(account_type_h account_type);
+
+/**
+ * @brief Retrieves capability information with your application ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function carries the capability name of an app ID
+ * @param[in] app_id The application ID to search
+ * @param[in] user_data The user data \n
+ * If you have your private data to carry into callback function, then you can use it.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ */
+int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data );
+
+/**
+ * @brief Checks whether the given application ID supports the capability.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] app_id The application ID
+ * @param[in] capability The capability \n
+ * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
+ *
+ * @return @c TRUE if the application supports the given capability, \n
+ * otherwise @c FALSE if the application does not support the given capability
+ * @retval @c TRUE means the application supports the given capability
+ * @retval @c FALSE means the application does not support the given capability
+ * @exception #ACCOUNT_ERROR_NONE Successful
+ * @exception #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
+ * @excaption #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @exception #ACCOUNT_ERROR_PERMISSION_DENIED DB access fail by permission
+ * @excaption #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @excaption #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ */
+bool account_type_query_supported_feature(const char* app_id, const char* capability);
+
+/**
+ * @brief Gets the application ID of an account provider.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a app_id using free().
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] app_id The application ID of an account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_app_id(account_type_h account_type, char **app_id);
+
+/**
+ * @brief Gets the service provider ID of an account provider.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a service_provider_id using free().
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] service_provider_id The service provider text ID of an account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
+
+/**
+ * @brief Gets the icon path of an account provider.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a icon_path using free().
+ *
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] icon_path The icon path of the account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_icon_path(account_type_h account_type, char **icon_path);
+
+/**
+ * @brief Gets the small icon path of an account provider.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a small_icon_path using free().
+ *
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[out] small_icon_path The small icon path of the account provider item
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
+
+/**
+ * @brief Checks whether the given account provider supports multiple accounts.
+ *
+ * @since_tizen 2.4
+ * @param[in] account_type The account provider handle \n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db.
+ * @param[out] multiple_account_support The flag indicating support for multiple accounts accounts\n
+ * TRUE or FALSE.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
+
+/**
+ * @brief Gets capability information with the given account provider handle.
+ *
+ * @since_tizen 2.4
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[in] callback The callback function that carries the capability name of the app ID
+ * @param[in] user_data The user data \n
+ * If you have your private data to carry into callback function, then you can use it.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ */
+int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data);
+
+/**
+ * @brief Gets the specific label information detail of an account provider.
+ *
+ * @since_tizen 2.4
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
+ * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
+ * @param[out] label The label text given for the locale
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND No label for the given locale
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+
+int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label);
+
+/**
+ * @brief Gets the label information detail of an account provider.
+ *
+ * @since_tizen 2.4
+ * @param[in] account_type The account provider handle\n
+ * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
+ * @param[in] callback The callback function carrying the label information
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ */
+int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves the label information with your application ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function that carries label_h for label information \n
+ * label_h contains label info as parameter.
+ * @param[in] app_id The application ID to search
+ * @param[in] user_data The user data \n
+ * If you have your private data to carry into callback function, then you can use it.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_type_query_by_app_id()
+ * @see account_type_foreach_account_type_from_db()
+ */
+int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data );
+
+/**
+ * @brief Retrieves the account provider information with your application ID.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] app_id The application ID to search
+ * @param[out] account_type The account handle which is created by account_type_create()
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Queried data does not exist
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_type_create()
+ * @see account_type_get_app_id()
+ * @see account_type_get_service_provider_id()
+ * @see account_type_get_icon_path()
+ * @see account_type_get_small_icon_path()
+ * @see account_type_get_multiple_account_support()
+ * @see account_type_get_label()
+ * @see account_type_destroy()
+ */
+int account_type_query_by_app_id(const char* app_id, account_type_h *account_type);
+
+/**
+ * @brief Retrieves all account priovider information.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The account provider information \n
+ * You can get the account information through account_type_get_* with the carried account_type_handle.
+ * @param[in] user_data The user data \n
+ * It will be carried through your callback function.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_type_create()
+ * @see account_type_get_app_id()
+ * @see account_type_get_service_provider_id()
+ * @see account_type_get_icon_path()
+ * @see account_type_get_small_icon_path()
+ * @see account_type_get_multiple_account_support()
+ * @see account_type_get_label()
+ * @see account_type_destroy()
+ */
+int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves the label information with the given application ID and locale.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] app_id The application ID
+ * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
+ * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
+ * @param[out] label The label text corresponding app_id and locale \n
+ * It must be free text.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ */
+int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label);
+
+/**
+ * @brief Retrieves account provider information with the capability name.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] callback The callback function to retrieve account provider information
+ * @param[in] key The capability value to search account provider \n
+ * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
+ * @param[in] user_data If you have your private data to carry into callback function, then you can use it
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ */
+int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data);
+
+/**
+ * @brief Checks whether the given app_id exists in the account provider DB.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read
+ * @param[in] app_id The application ID to check
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid app ID
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
+ * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
+ * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
+ *
+ * @see account_type_query_by_app_id()
+ */
+int account_type_query_app_id_exist(const char* app_id);
+
+
+
+/* End of account provider API */
+
+/**
+ * @brief Creates a handle for the account event subscription.
+ *
+ * @since_tizen 2.4
+ * @remarks You must release @a account_subscribe handle using account_unsubscribe_notification().
+ *
+ * @param[in] account_subscribe The account subscription handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_unsubscribe_notification()
+ * @see account_subscribe_notification()
+ */
+int account_subscribe_create(account_subscribe_h* account_subscribe);
+
+/**
+ * @brief Starts to subscribe account event through the given callback function.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * @param[in] account_subscribe The account subscription handle
+ * @param[in] callback The callback function that is called when an account is removed and a data of account is updated from the account database \n
+ * It will be called with event message and account ID.
+ * @param[in] user_data The user_data that is delivered to callback
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Subscription fail
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre account_subscribe_create()
+ *
+ * @see account_unsubscribe_notification()
+ * @see account_subscribe_notification()
+ */
+int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data);
+
+/**
+ * @brief Destroys the account subscribe handle and releases all its resources.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/account.read \n
+ * @remarks You must call @a account_unsubscribe_notification when you do not need to subscribe account event.
+ *
+ * @param[in] account_subscribe The account subscription handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Unsubscription failed
+ *
+ * @see account_create()
+ */
+int account_unsubscribe_notification(account_subscribe_h account_subscribe);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //__ACCOUNT_H_
diff --git a/libaccounts-svc.manifest b/libaccounts-svc.manifest
index d3b333c..530621b 100755..100644
--- a/libaccounts-svc.manifest
+++ b/libaccounts-svc.manifest
@@ -1,19 +1,16 @@
<manifest>
<define>
- <domain name="libaccounts-svc"/>
+ <domain name="libaccounts-svc" />
<provide>
<label name="libaccounts-svc::db"/>
<label name="libaccounts-svc::check_read"/>
</provide>
- <request>
- <smack request="libaccounts-svc::db" type="rw" />
- </request>
</define>
<request>
<domain name="libaccounts-svc"/>
</request>
<assign>
- <filesystem path="/usr/lib/libaccounts-svc.so.0" label="_" />
- <filesystem path="/usr/lib/libaccounts-svc.so.0.2.97" label="_" />
+ <filesystem path="/usr/lib/libaccounts-svc.so.*" label="_" exec_label="_" />
</assign>
</manifest>
+
diff --git a/packaging/libaccounts-svc.spec b/packaging/libaccounts-svc.spec
index 2deac97..cac7fa0 100755..100644
--- a/packaging/libaccounts-svc.spec
+++ b/packaging/libaccounts-svc.spec
@@ -1,22 +1,22 @@
Name: libaccounts-svc
Summary: Account DB library
-Version: 0.2.113
+Version: 0.3.5
Release: 1
Group: TO_BE/FILLED_IN
License: Apache-2.0
Source0: libaccounts-svc-%{version}.tar.gz
BuildRequires: cmake
-BuildRequires: pkgconfig(sqlite3)
-BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(libsmack)
+BuildRequires: pkgconfig(glib-2.0) >= 2.26
+BuildRequires: pkgconfig(gio-unix-2.0)
+BuildRequires: pkgconfig(security-server)
+BuildRequires: pkgconfig(account-common)
+BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(vasum)
Requires(post): /sbin/ldconfig
Requires(post): /usr/bin/sqlite3
@@ -36,77 +36,39 @@ Development files for %{name}
%setup -q
%build
-export CFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default"
-export CXXFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default -Wnon-virtual-dtor -Wno-c++0x-compat"
-#export CFLAGS+=" -Wno-array-bounds -Wno-ignored-qualifiers"
-export CFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
-export CXXFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
+#export CFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default"
+#export CXXFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default -Wnon-virtual-dtor -Wno-c++0x-compat"
+#export CFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
+#export CXXFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
-export CFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow -fno-common"
-export CXXFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow"
+#export CFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow -fno-common"
+#export CXXFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow"
export CFLAGS="${CFLAGS} -fPIC -fvisibility=hidden"
-cmake . -DCMAKE_INSTALL_PREFIX=/usr
+cmake . -DCMAKE_INSTALL_PREFIX=/usr \
+%if "%{?tizen_profile_name}" == "mobile"
+ -DFEATURE_PROFILE_MOBILE:BOOL=ON
+%else
+ -DFEATURE_PROFILE_MOBILE:BOOL=OFF
+%endif
make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
%make_install
-rm -rf %{buildroot}/usr/lib/accounts-svc
-
-%post
-/sbin/ldconfig
-if [ ! -d /opt/usr/dbspace ]
-then
- mkdir -p /opt/usr/dbspace
-fi
-if [ ! -f /opt/usr/dbspace/.account.db ]
-#rm -rf /opt/usr/dbspace/.account.db*
-then
- sqlite3 /opt/usr/dbspace/.account.db 'PRAGMA journal_mode = PERSIST;
- CREATE TABLE if not exists label (AppId TEXT, Label TEXT, Locale TEXT);
- CREATE TABLE if not exists account_type (_id INTEGER PRIMARY KEY AUTOINCREMENT, AppId TEXT,
- ServiceProviderId TEXT, IconPath TEXT, SmallIconPath TEXT, MultipleAccountSupport INT);
- CREATE TABLE if not exists account_custom (AccountId INTEGER, AppId TEXT, Key TEXT, Value TEXT);
- CREATE TABLE if not exists account (_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, display_name TEXT, icon_path TEXT,
- source TEXT, package_name TEXT, access_token TEXT, domain_name TEXT, auth_type INTEGER, secret INTEGER, sync_support INTEGER,
- txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT,
- int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER);
- CREATE TABLE if not exists capability (_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, value INTEGER,
- package_name TEXT, user_name TEXT, account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(_id));
- CREATE TABLE if not exists provider_feature (app_id TEXT, key TEXT);
-'
-fi
-
-mkdir -p /opt/usr/share/account
-chown 0:5000 /opt/usr/dbspace/.account.db
-chown 0:5000 /opt/usr/dbspace/.account.db-journal
-
-chmod 664 /opt/usr/dbspace/.account.db
-chmod 664 /opt/usr/dbspace/.account.db-journal
-
-#set message key value to NULL
-#vconftool set -t string db/account/msg '' -g 6514
-vconftool set -t string db/account/msg '' -s libaccounts-svc -g 6514
-
-#smack labeling
-if [ -f /usr/lib/rpm-plugins/msm.so ]
-then
- chsmack -a 'libaccounts-svc::db' /opt/usr/dbspace/.account.db-journal
- chsmack -a 'libaccounts-svc::db' /opt/usr/dbspace/.account.db
-fi
-
-
-%postun -p /sbin/ldconfig
-
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+rm -rf %{buildroot}/usr/lib/accounts-svc
%files
%manifest libaccounts-svc.manifest
%defattr(-,root,root,-)
%{_libdir}/*.so.*
+/usr/share/license/%{name}
%files devel
%defattr(-,root,root,-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..6acf08e
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,59 @@
+
+SET(SRCS
+ account.c
+ account_offline.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(clientpkgs REQUIRED
+ dlog
+ glib-2.0
+ gio-unix-2.0
+ capi-base-common
+ security-server
+ vconf
+ account-common
+ db-util
+ vasum
+)
+
+FOREACH(flag ${clientpkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+IF(FEATURE_PROFILE_MOBILE)
+ ADD_DEFINITIONS("-DTIZEN_PROFILE_MOBILE")
+ENDIF(FEATURE_PROFILE_MOBILE)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${clientpkgs_LDFLAGS})
+
+#CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib/accounts-svc)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
+#INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+
+IF(FEATURE_PROFILE_MOBILE)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/mobile/account.h DESTINATION include)
+ELSE(FEATURE_PROFILE_MOBILE)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/wearable/account.h DESTINATION include)
+ENDIF(FEATURE_PROFILE_MOBILE)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/account-error.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/account-types.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/account_internal.h DESTINATION include)
+
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}.pc.in ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}.pc @ONLY)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
diff --git a/src/account.c b/src/account.c
index 3aa01c5..6a5ca47 100755..100644
--- a/src/account.c
+++ b/src/account.c
@@ -1,10 +1,7 @@
/*
- * account
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
- *
* 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
@@ -19,1942 +16,604 @@
*
*/
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <account.h>
#include <glib.h>
-#include <db-util.h>
-#include <pthread.h>
-#include <account-private.h>
-#include <vconf.h>
-#include "account_internal.h"
-
-#define SAMSUNG_ACCOUNT_MANAGER
-
-#include <pkgmgr-info.h>
-#include <aul.h>
+#include <fcntl.h>
+#include <glib/gprintf.h>
+#ifdef G_OS_UNIX
+#include <gio/gunixfdlist.h>
#include <unistd.h>
-#include <sys/types.h>
-#include <sys/smack.h>
-
-#define EAS_CMDLINE "/usr/bin/eas-engine"
-#define EMAIL_SERVICE_CMDLINE "/usr/bin/email-service"
-#define IMS_ENGINE_CMDLINE "/usr/bin/ims-srv"
-#define IMS_AGENT_CMDLINE "/usr/bin/ims-agent"
-#define MDM_SERVER_CMDLINE "/usr/bin/mdm-server"
+#endif
+#include <vconf.h>
+#include <security-server.h>
-#define RCS_APPID "com.samsung.rcs-im"
-#define IMS_SERVICE_APPID "ims-service"
-#define ACTIVESYNC_APPID "activesync-ui"
-#define EMAIL_APPID "email-setting-efl"
-#define SYNCHRONISE_APPID "setting-synchronise-efl"
-#define DS_AGENT_CMDLINE "/usr/bin/oma-ds-agent"
+#include <dbg.h>
+#include <account-private.h>
+#include <account_free.h>
+#include <account_ipc_marshal.h>
+#include <account-mgr-stub.h>
+
+#ifdef TIZEN_PROFILE_MOBILE
+#include "mobile/account.h"
+#else
+#include "wearable/account.h"
+#endif
-#define FACEBOOK_SDK_APPID "com.samsung.facebook-service"
-#define FACEBOOK_APPID "com.samsung.facebook"
+#include "account-error.h"
+#include "account-types.h"
+#include "account_internal.h"
+#include "account_private_client.h"
#define ACCOUNT_DB_OPEN_READONLY 0
#define ACCOUNT_DB_OPEN_READWRITE 1
-static sqlite3* g_hAccountDB = NULL;
-static int g_refCntDB = 0;
-pthread_mutex_t account_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static char *_account_get_text(const char *text_data);
-static int _account_gslist_free(GSList* list);
-static int _account_glist_free(GList* list);
-static const char *_account_query_table_column_text(account_stmt pStmt, int pos);
-static int _account_insert_custom(account_s *account, int account_id);
-static int _account_update_custom(account_s *account, int account_id);
-static int _account_query_custom_by_account_id(account_custom_cb callback, int account_id, void *user_data );
-static int _account_type_update_provider_feature(account_type_s *account_type, const char* app_id);
+#define _GET_COOKIE int ret_code = 0;\
+char *e_cookie = NULL;\
+char cookie[256] = {0,};\
+int size = 0;\
+\
+size = security_server_get_cookie_size();\
+ret_code = security_server_request_cookie(cookie, size);\
+if (ret_code < 0) {\
+ _ERR("security_server_request_cookie() is failed.");\
+ return ACCOUNT_ERROR_PERMISSION_DENIED;\
+}\
+\
+e_cookie = g_base64_encode((const guchar *)cookie, size);\
+if (e_cookie == NULL) {\
+ _ERR("g_base64_encode() is failed.");\
+ return ACCOUNT_ERROR_PERMISSION_DENIED;\
+}
+
+#define _DESTROY_COOKIE \
+if (e_cookie) \
+ g_free((gchar*)e_cookie);
+
+static AccountManager *_acc_mgr = NULL;
-int _account_get_current_appid_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
+static char *_account_get_text(const char *text_data)
{
- char* appid = NULL;
- char* item = NULL;
- GSList** appid_list = (GSList**)user_data;
- int pkgmgr_ret = -1;
-
- pkgmgr_ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ char *text_value = NULL;
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_appid(%d)", pkgmgr_ret);
+ if (text_data != NULL) {
+ text_value = strdup(text_data);
}
-
- item = _account_get_text(appid);
- *appid_list = g_slist_append(*appid_list, item);
-
- return 0;
+ return text_value;
}
-static inline int __read_proc(const char *path, char *buf, int size)
+//FIXME : add true singleton logic
+AccountManager *
+_account_manager_get_instance ()
{
- int fd = 0, ret = 0;
-
- if (buf == NULL || path == NULL) {
- ACCOUNT_ERROR("path and buffer is mandatory\n");
- return -1;
- }
-
- fd = open(path, O_RDONLY);
- if (fd < 0) {
- ACCOUNT_ERROR("fd open error(%d)\n", fd);
- return -1;
+ _INFO("_account_manager_get_instance");
+ if (_acc_mgr != NULL)
+ {
+ _INFO("instance already created.");
+ return _acc_mgr;
}
- ret = read(fd, buf, size - 1);
- if (ret <= 0) {
- ACCOUNT_ERROR("fd read error(%d)\n", fd);
- close(fd);
- return -1;
- } else
- buf[ret] = 0;
+#if !GLIB_CHECK_VERSION(2,35,0)
+ g_type_init();
+#endif
- close(fd);
+ GDBusConnection *connection = NULL;
+ GError *error = NULL;
- return ret;
-}
+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
-char *_account_get_proc_cmdline_bypid(int pid)
-{
- char buf[128];
- int ret = 0;
+ _INFO("after g_bus_get_sync");
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "/proc/%d/cmdline", pid);
- ret = __read_proc(buf, buf, sizeof(buf));
- if (ret <= 0) {
- ACCOUNT_DEBUG("No proc directory (%d)\n", pid);
+ if (!connection) {
+ if (error) {
+ _ERR("Unable to connect to gdbus: %s", error->message);
+ g_clear_error(&error);
+ }
return NULL;
}
- return strdup(buf);
-}
+ g_clear_error(&error);
+ /* Create the object */
+ _acc_mgr =
+ account_manager_proxy_new_sync(connection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.account.manager",
+ "/org/tizen/account/manager",
+ NULL,
+ &error);
-static char* _account_get_current_appid()
-{
- int ret=0, pid=0;
- char appid[128]={0,};
- char* appid_ret = NULL;
-
- pid = getpid();
- ret = aul_app_get_appid_bypid(pid, appid, sizeof(appid));
-
- if(ret < 0){
- ACCOUNT_ERROR("fail to get current appid\n");
- }
-
- /* SLP platform core exception */
- if(strlen(appid) == 0){
- char* cmdline = NULL;
- cmdline = _account_get_proc_cmdline_bypid(pid);
- ACCOUNT_SLOGD("cmdline (%s)!!!!!!\n", cmdline);
- if(!g_strcmp0(cmdline, EAS_CMDLINE)) {
- appid_ret = _account_get_text(ACTIVESYNC_APPID);
- _ACCOUNT_FREE(cmdline);
- return appid_ret;
- } else if (!g_strcmp0(cmdline, EMAIL_SERVICE_CMDLINE) || !g_strcmp0(cmdline, MDM_SERVER_CMDLINE)) {
- appid_ret = _account_get_text(EMAIL_APPID);
- _ACCOUNT_FREE(cmdline);
- return appid_ret;
- } else if (!g_strcmp0(cmdline, IMS_ENGINE_CMDLINE) || !g_strcmp0(cmdline, IMS_AGENT_CMDLINE)) {
- if(account_type_query_app_id_exist(RCS_APPID)==ACCOUNT_ERROR_NONE){
- appid_ret = _account_get_text(RCS_APPID);
- } else if(account_type_query_app_id_exist(IMS_SERVICE_APPID)==ACCOUNT_ERROR_NONE){
- appid_ret = _account_get_text(IMS_SERVICE_APPID);
- } else {
- appid_ret = _account_get_text(RCS_APPID);
- }
- _ACCOUNT_FREE(cmdline);
- return appid_ret;
- } else if (!g_strcmp0(cmdline, DS_AGENT_CMDLINE)) {
- appid_ret = _account_get_text(SYNCHRONISE_APPID);
- _ACCOUNT_FREE(cmdline);
- return appid_ret;
- } else {
- ACCOUNT_DEBUG("No app id\n");
- _ACCOUNT_FREE(cmdline);
- return NULL;
+ if (!_acc_mgr) {
+ if (error) {
+ _ERR("Unable account_manager_proxy_new_sync: %s", error->message);
+ g_clear_error(&error);
}
+ if(connection)
+ g_object_unref(connection);
+ return NULL;
}
- /* temporary exception */
- if(!g_strcmp0(appid, "com.samsung.gallery")){
- appid_ret = _account_get_text("com.samsung.facebook");
- } else if(!g_strcmp0(appid, FACEBOOK_SDK_APPID)){
- appid_ret = _account_get_text(FACEBOOK_APPID);
- } else {
- appid_ret = _account_get_text(appid);
- }
-
- return appid_ret;
-}
-
-static int _account_check_account_type_with_appid_group(const char* appid, char** verified_appid)
-{
- int error_code = ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER;
- pkgmgrinfo_appinfo_h ahandle=NULL;
- pkgmgrinfo_pkginfo_h phandle=NULL;
- char* package_id = NULL;
- GSList* appid_list = NULL;
- GSList* iter = NULL;
-
- if(!appid){
- ACCOUNT_ERROR("input param is null\n");
- return ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER;
- }
-
- if(!verified_appid){
- ACCOUNT_ERROR("output param is null\n");
- return ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER;
- }
-
- if(!strcmp(appid, "com.samsung.setting")){
- ACCOUNT_DEBUG("Setting exception\n");
- *verified_appid = _account_get_text("com.samsung.setting");
- return ACCOUNT_ERROR_NONE;
- }
-
- if(!strcmp(appid, "com.samsung.samsung-account-front")){
- ACCOUNT_DEBUG("Setting exception\n");
- *verified_appid = _account_get_text("com.samsung.samsung-account-front");
- return ACCOUNT_ERROR_NONE;
- }
-
- if(!strcmp(appid, IMS_SERVICE_APPID) || !strcmp(appid, RCS_APPID)){
- ACCOUNT_DEBUG("ims service exception\n");
- *verified_appid = _account_get_text(appid);
- return ACCOUNT_ERROR_NONE;
- }
-
- /* Get app id family which is stored in account database */
- int pkgmgr_ret = -1;
- pkgmgr_ret = pkgmgrinfo_appinfo_get_appinfo(appid, &ahandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_appinfo(%d)", pkgmgr_ret);
- }
- pkgmgr_ret = pkgmgrinfo_appinfo_get_pkgid(ahandle, &package_id);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_pkgid(%d)", pkgmgr_ret);
- }
- pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkginfo(package_id, &phandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_pkginfo_get_pkginfo(%d)", pkgmgr_ret);
- }
- pkgmgr_ret = pkgmgrinfo_appinfo_get_list(phandle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&appid_list);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_list(%d)", pkgmgr_ret);
- }
+ g_clear_error(&error);
+ _INFO("_account_manager_get_instance end");
+ return _acc_mgr;
+}
+
+GDBusErrorEntry _account_svc_errors[] =
+{
+ {ACCOUNT_ERROR_NONE, _ACCOUNT_SVC_ERROR_PREFIX".NoError"},
+ {ACCOUNT_ERROR_OUT_OF_MEMORY, _ACCOUNT_SVC_ERROR_PREFIX".OutOfMemory"},
+ {ACCOUNT_ERROR_INVALID_PARAMETER, _ACCOUNT_SVC_ERROR_PREFIX".InvalidParameter"},
+ {ACCOUNT_ERROR_DUPLICATED, _ACCOUNT_SVC_ERROR_PREFIX".Duplicated"},
+ {ACCOUNT_ERROR_NO_DATA, _ACCOUNT_SVC_ERROR_PREFIX".NoData"},
+ {ACCOUNT_ERROR_RECORD_NOT_FOUND, _ACCOUNT_SVC_ERROR_PREFIX".RecordNotFound"},
+ {ACCOUNT_ERROR_DB_FAILED, _ACCOUNT_SVC_ERROR_PREFIX".DBFailed"},
+ {ACCOUNT_ERROR_DB_NOT_OPENED, _ACCOUNT_SVC_ERROR_PREFIX".DBNotOpened"},
+ {ACCOUNT_ERROR_QUERY_SYNTAX_ERROR, _ACCOUNT_SVC_ERROR_PREFIX".QuerySynTaxError"},
+ {ACCOUNT_ERROR_ITERATOR_END, _ACCOUNT_SVC_ERROR_PREFIX".IteratorEnd"},
+ {ACCOUNT_ERROR_NOTI_FAILED, _ACCOUNT_SVC_ERROR_PREFIX".NotiFalied"},
+ {ACCOUNT_ERROR_PERMISSION_DENIED, _ACCOUNT_SVC_ERROR_PREFIX".PermissionDenied"},
+ {ACCOUNT_ERROR_XML_PARSE_FAILED, _ACCOUNT_SVC_ERROR_PREFIX".XMLParseFailed"},
+ {ACCOUNT_ERROR_XML_FILE_NOT_FOUND, _ACCOUNT_SVC_ERROR_PREFIX".FileNotFound"},
+ {ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL, _ACCOUNT_SVC_ERROR_PREFIX".SubscriptionFailed"},
+ {ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER, _ACCOUNT_SVC_ERROR_PREFIX".NotRegisteredProvider"},
+ {ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE, _ACCOUNT_SVC_ERROR_PREFIX".NotAllowMultiple"},
+ {ACCOUNT_ERROR_DATABASE_BUSY, _ACCOUNT_SVC_ERROR_PREFIX".database_busy"},
+};
+
+static int _account_get_error_code(bool is_success, GError *error)
+{
+ if (!is_success)
+ {
+ _INFO("Received error Domain[%d] Message[%s] Code[%d]", error->domain, error->message, error->code);
- /* Compare current app id with the stored app id family */
- for(iter=appid_list;iter!=NULL;iter=g_slist_next(iter)){
- char* tmp = (char*)iter->data;
- if(tmp) {
- if(account_type_query_app_id_exist(tmp) == ACCOUNT_ERROR_NONE) {
- *verified_appid = _account_get_text(tmp);
- error_code = ACCOUNT_ERROR_NONE;
- _ACCOUNT_FREE(tmp);
- if( *verified_appid == NULL ) {
- ACCOUNT_ERROR("Memory Allocation Failed");
- error_code = ACCOUNT_ERROR_OUT_OF_MEMORY;
+ if (g_dbus_error_is_remote_error(error))
+ {
+ gchar *remote_error = g_dbus_error_get_remote_error(error);
+ if (remote_error)
+ {
+ _INFO("Remote error[%s]", remote_error);
+
+ //FIXME: Temp fix, error->code sent from daemon is not the same as the one received.
+ //However error->message matches, so doing reverse lookup
+ int error_enum_count = G_N_ELEMENTS(_account_svc_errors);
+ int i = 0;
+ for (i = 0; i < error_enum_count; i++)
+ {
+ if (g_strcmp0(_account_svc_errors[i].dbus_error_name, remote_error) == 0)
+ {
+ _INFO("Remote error code matched[%d]", _account_svc_errors[i].error_code);
+ g_free(remote_error);
+ return _account_svc_errors[i].error_code;
+ }
}
- break;
- } else {
- ACCOUNT_SLOGD("not matched owner group app id(%s), current appid(%s)\n", tmp, appid);
+ g_free(remote_error);
}
}
- _ACCOUNT_FREE(tmp);
- }
-
- g_slist_free(appid_list);
- pkgmgr_ret = pkgmgrinfo_pkginfo_destroy_pkginfo(phandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_pkginfo_destroy_pkginfo(%d)", pkgmgr_ret);
- }
-
- pkgmgr_ret = pkgmgrinfo_appinfo_destroy_appinfo(ahandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_destroy_appinfo(%d)", pkgmgr_ret);
+ //All undocumented errors mapped to ACCOUNT_ERROR_PERMISSION_DENIED
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
}
-
- return error_code;
+ return ACCOUNT_ERROR_NONE;
}
-static int _account_check_appid_group_with_package_name(const char* appid, char* package_name)
+#ifdef TIZEN_PROFILE_MOBILE
+ACCOUNT_API int account_connect(void)
{
- int error_code = ACCOUNT_ERROR_PERMISSION_DENIED;
- pkgmgrinfo_appinfo_h ahandle=NULL;
- pkgmgrinfo_pkginfo_h phandle=NULL;
- char* package_id = NULL;
- GSList* appid_list = NULL;
- GSList* iter = NULL;
-
- if(!appid){
- ACCOUNT_ERROR("input param -appid is null\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- if(!package_name){
- ACCOUNT_ERROR("input param - package name is null\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- /* ims-service Exception */
- if ( strcmp(appid, "ims-service") == 0 && strcmp(package_name, "ims-service") == 0 ) {
- ACCOUNT_DEBUG("ims exception."); // TODO: NEED TO REMOVE, debug log.
- return ACCOUNT_ERROR_NONE;
- }
-
- /* Get app id family which is stored in account database */
- int pkgmgr_ret = -1;
- pkgmgr_ret = pkgmgrinfo_appinfo_get_appinfo(appid, &ahandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_appinfo(%d)", pkgmgr_ret);
- }
- pkgmgr_ret = pkgmgrinfo_appinfo_get_pkgid(ahandle, &package_id);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_pkgid(%d)", pkgmgr_ret);
- }
- pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkginfo(package_id, &phandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_pkginfo_get_pkginfo(%d)", pkgmgr_ret);
- }
- pkgmgr_ret = pkgmgrinfo_appinfo_get_list(phandle, PMINFO_ALL_APP, _account_get_current_appid_cb, (void *)&appid_list);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_get_list(%d)", pkgmgr_ret);
- }
-
- /* Compare current app id with the stored app id family */
- for(iter=appid_list;iter!=NULL;iter=g_slist_next(iter)){
- char* tmp = (char*)iter->data;
- if(tmp) {
- //ACCOUNT_ERROR("tmp(%s)package_name(%s)\n\n", tmp, package_name); // TODO: NEED TO REMOVE, debug log.
- if( strcmp(tmp, package_name) == 0) {
- error_code = ACCOUNT_ERROR_NONE;
- _ACCOUNT_FREE(tmp);
- break;
- } else if ( strcmp(tmp, SAMSUNGACCOUNTFRONT_PKG_NAME) == 0 &&
- strcmp(package_name, SAMSUNGACCOUNT_PKG_NAME) == 0 ) {
- /* Samung Account Exception */
- error_code = ACCOUNT_ERROR_NONE;
- _ACCOUNT_FREE(tmp);
- break;
- } else {
- ACCOUNT_SLOGD("not matched owner group app id(%s), current appid(%s)\n", tmp, appid);
- }
- }
- _ACCOUNT_FREE(tmp);
- }
-
- g_slist_free(appid_list);
- pkgmgr_ret = pkgmgrinfo_pkginfo_destroy_pkginfo(phandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_pkginfo_destroy_pkginfo(%d)", pkgmgr_ret);
- }
-
- pkgmgr_ret = pkgmgrinfo_appinfo_destroy_appinfo(ahandle);
- if( pkgmgr_ret != PMINFO_R_OK ){
- ACCOUNT_DEBUG("pkgmgrinfo_appinfo_destroy_appinfo(%d)", pkgmgr_ret);
- }
-
- return error_code;
+ return ACCOUNT_ERROR_NONE;
}
-static const char *_account_db_err_msg()
+ACCOUNT_API int account_connect_readonly(void)
{
- return sqlite3_errmsg(g_hAccountDB);
+ return ACCOUNT_ERROR_NONE;
}
-static int _account_db_err_code()
+ACCOUNT_API int account_disconnect(void)
{
- return sqlite3_errcode(g_hAccountDB);
+ return ACCOUNT_ERROR_NONE;
}
+#endif
-static void _account_insert_delete_update_notification_send(char *noti_name)
-{
- if (!noti_name) {
- ACCOUNT_ERROR("Noti Name is NULL!!!!!!\n");
- return;
- }
-
- ACCOUNT_DEBUG("noti_type = %s", noti_name);
-
- if (vconf_set_str(VCONFKEY_ACCOUNT_MSG_STR, noti_name) != 0) {
- ACCOUNT_ERROR("Vconf MSG Str set FAILED !!!!!!\n");;
- }
-}
-static int _account_get_record_count(char* query)
+ACCOUNT_API int account_insert_to_db(account_h account, int *account_db_id)
{
- int rc = -1;
- int ncount = 0;
- account_stmt pStmt = NULL;
+ _INFO("1. account_insert_to_db start");
+ char* account_db_path = ACCOUNT_DB_NAME;
- if(!query){
- ACCOUNT_ERROR("NULL query\n");
- return ACCOUNT_ERROR_QUERY_SYNTAX_ERROR;
- }
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((account_db_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID POINTER IS NULL"));
- if(!g_hAccountDB){
- ACCOUNT_ERROR("DB is not opened\n");
- return ACCOUNT_ERROR_DB_NOT_OPENED;
- }
+ _GET_COOKIE
- rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
+ account_s *account_data = (account_s*) account;
+ int error_code = ACCOUNT_ERROR_NONE;
+ GError *error = NULL;
- if (SQLITE_BUSY == rc){
- ACCOUNT_ERROR("sqlite3_prepare_v2() failed(%d, %s).", rc, _account_db_err_msg());
- sqlite3_finalize(pStmt);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- } else if (SQLITE_OK != rc) {
- ACCOUNT_ERROR("sqlite3_prepare_v2() failed(%d, %s).", rc, _account_db_err_msg());
- sqlite3_finalize(pStmt);
- return ACCOUNT_ERROR_DB_FAILED;
- }
+ _INFO("2. Before _account_manager_get_instance()");
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ ACCOUNT_CATCH_ERROR((acc_mgr != NULL), {}, ACCOUNT_ERROR_PERMISSION_DENIED, "Failed to get dbus.");
- rc = sqlite3_step(pStmt);
- if (SQLITE_BUSY == rc) {
- ACCOUNT_ERROR("sqlite3_step() failed(%d, %s).", rc, _account_db_err_msg());
- sqlite3_finalize(pStmt);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- } else if (SQLITE_ROW != rc) {
- ACCOUNT_ERROR("sqlite3_step() failed(%d, %s).", rc, _account_db_err_msg());
- sqlite3_finalize(pStmt);
- return ACCOUNT_ERROR_DB_FAILED;
- }
+ int db_id = -1;
+ GVariant* account_serialized = marshal_account(account_data);
- ncount = sqlite3_column_int(pStmt, 0);
+ _INFO("3. Before account_manager_call_account_add_sync");
+ bool is_success = account_manager_call_account_add_sync(acc_mgr, account_db_path, account_serialized, e_cookie, &db_id, NULL, &error);
- sqlite3_finalize(pStmt);
+ _DESTROY_COOKIE
- return ncount;
-}
+ ACCOUNT_CATCH_ERROR((is_success != false), {}, _account_get_error_code(is_success, error), "Failed to get dbus.");
+ g_clear_error(&error);
-static int _account_execute_query(const char *query)
-{
- int rc = -1;
- char* pszErrorMsg = NULL;
+ *account_db_id = db_id;
+ account_data->id = db_id;
- if(!query){
- ACCOUNT_ERROR("NULL query\n");
- return ACCOUNT_ERROR_QUERY_SYNTAX_ERROR;
- }
+ _INFO("4. account_insert_to_db end, added db id [%d] [%d] [%d]", db_id, *account_db_id, account_data->id);
- if(!g_hAccountDB){
- ACCOUNT_ERROR("DB is not opened\n");
- return ACCOUNT_ERROR_DB_NOT_OPENED;
- }
+ return ACCOUNT_ERROR_NONE;
- rc = sqlite3_exec(g_hAccountDB, query, NULL, NULL, &pszErrorMsg);
- if (SQLITE_OK != rc) {
- ACCOUNT_ERROR("sqlite3_exec rc(%d) query(%s) failed(%s).", rc, query, pszErrorMsg);
- sqlite3_free(pszErrorMsg);
- }
+CATCH:
+ g_clear_error(&error);
+ //Failed to get dbus.
+ _ERR("account_manager_call_account_add_sync()=[%d]", error_code);
- return rc;
+ return error_code;
}
-static int _account_begin_transaction(void)
+ACCOUNT_API int account_delete_from_db_by_id(int account_db_id)
{
- int ret = -1;
-
- ret = _account_execute_query("BEGIN IMMEDIATE TRANSACTION");
-
- if (ret == SQLITE_BUSY){
- ACCOUNT_ERROR(" sqlite3 busy = %d", ret);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- } else if(ret != SQLITE_OK) {
- ACCOUNT_ERROR("_account_svc_begin_transaction fail :: %d", ret);
- return ACCOUNT_ERROR_DB_FAILED;
- }
+ _INFO("1. account_delete_from_db_by_id starting [%d]", account_db_id);
+ char* account_db_path = ACCOUNT_DB_NAME;
+ int error_code = ACCOUNT_ERROR_NONE;
- return ACCOUNT_ERROR_NONE;
-}
+ ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID IS LESS THAN ZERO."));
-static int _account_end_transaction(bool is_success)
-{
- int ret = -1;
+ _GET_COOKIE
- if (is_success == true) {
- ret = _account_execute_query("COMMIT TRANSACTION");
- } else {
- ret = _account_execute_query("ROLLBACK TRANSACTION");
- }
+ GError *error = NULL;
- if(ret == SQLITE_PERM){
- ACCOUNT_ERROR("Account permission denied :: %d", ret);
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if (ret == SQLITE_BUSY){
- ACCOUNT_DEBUG(" sqlite3 busy = %d", ret);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
-
- if (ret != SQLITE_OK) {
- ACCOUNT_ERROR("_account_svc_end_transaction fail :: %d", ret);
- return ACCOUNT_ERROR_DB_FAILED;
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static bool _account_check_add_more_account(const char* app_id)
-{
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- ACCOUNT_RETURN_VAL((app_id != 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId = '%s' and MultipleAccountSupport = 1", ACCOUNT_TYPE_TABLE, app_id);
- rc = _account_get_record_count(query);
-
- /* multiple account support case */
- if(rc > 0) {
- ACCOUNT_SLOGD("app id (%s) supports multiple account. rc(%d)\n", app_id, rc);
- return TRUE;
- }
-
- /* multiple account not support case */
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE package_name = '%s'", ACCOUNT_TABLE, app_id);
- rc = _account_get_record_count(query);
-
- if(rc <= 0) {
- ACCOUNT_SLOGD("app id (%s) supports single account. and there is no account of the app id\n", app_id);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int _account_create_all_tables(void)
-{
- int rc = -1;
- int error_code = ACCOUNT_ERROR_NONE;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
-
- ACCOUNT_DEBUG("create all table - BEGIN");
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- /*Create the account table*/
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", ACCOUNT_TABLE);
- rc = _account_get_record_count(query);
- if (rc <= 0) {
- rc = _account_execute_query(ACCOUNT_SCHEMA);
- if(rc == SQLITE_BUSY) return ACCOUNT_ERROR_DATABASE_BUSY;
- ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", ACCOUNT_SCHEMA, rc, _account_db_err_msg()));
- }
-
- /*Create capability table*/
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", CAPABILITY_TABLE);
- rc = _account_get_record_count(query);
- if (rc <= 0) {
- rc = _account_execute_query(CAPABILITY_SCHEMA);
- if(rc == SQLITE_BUSY) return ACCOUNT_ERROR_DATABASE_BUSY;
- ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", CAPABILITY_SCHEMA, rc, _account_db_err_msg()));
- }
-
- /* Create account custom table */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", ACCOUNT_CUSTOM_TABLE);
- rc = _account_get_record_count(query);
- if (rc <= 0) {
- rc = _account_execute_query(ACCOUNT_CUSTOM_SCHEMA);
- if(rc == SQLITE_BUSY) return ACCOUNT_ERROR_DATABASE_BUSY;
- ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", query, rc, _account_db_err_msg()));
- }
-
- /* Create account type table */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", ACCOUNT_TYPE_TABLE);
- rc = _account_get_record_count(query);
- if (rc <= 0) {
- rc = _account_execute_query(ACCOUNT_TYPE_SCHEMA);
- if(rc == SQLITE_BUSY) return ACCOUNT_ERROR_DATABASE_BUSY;
- ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", ACCOUNT_TYPE_SCHEMA, rc, _account_db_err_msg()));
- }
-
- /* Create label table */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", LABEL_TABLE);
- rc = _account_get_record_count(query);
- if (rc <= 0) {
- rc = _account_execute_query(LABEL_SCHEMA);
- if(rc == SQLITE_BUSY) return ACCOUNT_ERROR_DATABASE_BUSY;
- ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", LABEL_SCHEMA, rc, _account_db_err_msg()));
- }
-
- /* Create account feature table */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", PROVIDER_FEATURE_TABLE);
- rc = _account_get_record_count(query);
- if (rc <= 0) {
- rc = _account_execute_query(PROVIDER_FEATURE_SCHEMA);
- if(rc == SQLITE_BUSY) return ACCOUNT_ERROR_DATABASE_BUSY;
- ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", PROVIDER_FEATURE_SCHEMA, rc, _account_db_err_msg()));
- }
-
- ACCOUNT_DEBUG("create all table - END");
- return error_code;
-}
-
-static int _account_check_is_all_table_exists()
-{
- int rc = 0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0,};
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s', '%s', '%s', '%s', '%s', '%s')",
- ACCOUNT_TABLE, CAPABILITY_TABLE, ACCOUNT_CUSTOM_TABLE, ACCOUNT_TYPE_TABLE, LABEL_TABLE, PROVIDER_FEATURE_TABLE);
- rc = _account_get_record_count(query);
+ _INFO("2. Before account_manager_call_account_query_account_by_account_id_sync");
+ GVariant *account_serialized_old = NULL;
+ bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_path, account_db_id, e_cookie, &account_serialized_old, NULL, &error);
+ if (!is_success)
+ {
+ _DESTROY_COOKIE
- if (rc != ACCOUNT_TABLE_TOTAL_COUNT) {
- ACCOUNT_ERROR("Table count is not matched rc=%d\n", rc);
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
+ return error_code;
}
+ g_clear_error(&error);
- return rc;
-}
+ _INFO("3. Before account_manager_call_account_delete_from_db_by_id_sync");
+ is_success = account_manager_call_account_delete_from_db_by_id_sync(acc_mgr, account_db_path, account_db_id, e_cookie, NULL, &error);
-static int _account_db_open(int mode)
-{
- int rc = 0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- if (!g_hAccountDB) {
- if(mode == ACCOUNT_DB_OPEN_READWRITE)
- rc = db_util_open(ACCOUNT_DB_NAME, &g_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD);
- else if(mode == ACCOUNT_DB_OPEN_READONLY)
- rc = db_util_open_with_options(ACCOUNT_DB_NAME, &g_hAccountDB, SQLITE_OPEN_READONLY, NULL);
- else
- return ACCOUNT_ERROR_DB_NOT_OPENED;
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ _DESTROY_COOKIE
- ACCOUNT_RETURN_VAL((rc != SQLITE_PERM), {}, ACCOUNT_ERROR_PERMISSION_DENIED, ("Account permission denied rc : %d", rc));
- ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected. rc : %d", rc));
- g_refCntDB++;
- } else {
- g_refCntDB++;
+ if (!is_success)
+ {
+ error_code = _account_get_error_code(is_success, error);
+ _ERR("account_manager_call_account_delete_from_db_by_id_sync failed [%d]", error_code);
+ g_clear_error(&error);
+ return error_code;
}
+ g_clear_error(&error);
- ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("busy handler fail. rc : %d", rc));
-
+ _INFO("4. Before account_delete_from_db_by_id end");
return ACCOUNT_ERROR_NONE;
}
-static int _account_db_close(void)
-{
- int rc = 0;
- int ret = -1;
-
- if (g_hAccountDB) {
- if (g_refCntDB > 0) {
- g_refCntDB--;
- }
- if (g_refCntDB == 0) {
- rc = db_util_close(g_hAccountDB);
- if( rc == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(SQLITE_PERM)");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if ( rc == SQLITE_BUSY ){
- ACCOUNT_ERROR( "database busy");
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
- ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_FAILED, ("The database isn't connected. rc : %d", rc));
- g_hAccountDB = NULL;
- }
- ret = ACCOUNT_ERROR_NONE;
- } else {
- ACCOUNT_ERROR( "_account_svc_db_close: No handle(). refcnt=%d ", g_refCntDB);
- ret = ACCOUNT_ERROR_DB_FAILED;
- }
-
- return ret;
-}
-
-static int _account_connect(int mode)
+ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *package_name)
{
+ _INFO("account_delete_from_db_by_user_name start");
+ char* account_db_path = ACCOUNT_DB_NAME;
int error_code = ACCOUNT_ERROR_NONE;
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
+ ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is null!"));
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ _GET_COOKIE
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ GError *error = NULL;
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- pthread_mutex_lock(&account_mutex);
+ GVariant* account_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, account_db_path, user_name, e_cookie, &account_list_variant, NULL, &error);
- error_code = _account_db_open(mode);
- if (ACCOUNT_ERROR_NONE != error_code) {
- ACCOUNT_ERROR("The database isn't connected.\n");
- pthread_mutex_unlock(&account_mutex);
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ _DESTROY_COOKIE
- if(error_code == ACCOUNT_ERROR_PERMISSION_DENIED)
- return error_code;
- else
- return ACCOUNT_ERROR_DB_NOT_OPENED;
+ _ERR("account_query_account_by_user_name error=[%d]", error_code);
+ return error_code;
}
- int rc = _account_check_is_all_table_exists();
+ GSList* account_list = unmarshal_account_list(account_list_variant);
+ g_variant_unref(account_list_variant);
- if ( rc < 0 ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR("rc(%d)", rc);
- return rc;
- } else if (rc == ACCOUNT_TABLE_TOTAL_COUNT){
- // do nothing
- ACCOUNT_DEBUG("Tables OK");
- } else {
- error_code = _account_create_all_tables();
+ if (account_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_NONE;
-}
+ //TODO free account_list, account_list_variant
-ACCOUNT_API int account_connect (void)
-{
- return _account_connect(ACCOUNT_DB_OPEN_READWRITE);
-}
+ is_success = account_manager_call_account_delete_from_db_by_user_name_sync(acc_mgr, account_db_path, user_name, package_name, e_cookie, NULL, &error);
-ACCOUNT_API int account_connect_readonly (void)
-{
- return _account_connect(ACCOUNT_DB_OPEN_READONLY);
-}
+ _DESTROY_COOKIE
-static int _account_disconnect(void)
-{
- int error_code = ACCOUNT_ERROR_NONE;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
+ if (!is_success)
+ {
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_delete_from_db_by_user_name_sync failed [%d]", error_code);
+ _account_gslist_account_free(account_list);
+ return error_code;
}
+ g_clear_error(&error);
- pthread_mutex_lock(&account_mutex);
-
- error_code = _account_db_close();
- pthread_mutex_unlock(&account_mutex);
-
- return error_code;
-}
-
-ACCOUNT_API int account_disconnect (void)
-{
- return _account_disconnect();
-}
-
-static int _account_free_capability_items(account_capability_s *data)
-{
- _ACCOUNT_FREE(data->type);
- _ACCOUNT_FREE(data->package_name);
- _ACCOUNT_FREE(data->user_name);
-
+ _account_gslist_account_free(account_list);
return ACCOUNT_ERROR_NONE;
}
-static int _account_custom_item_free(account_custom_s *data)
+int _account_delete_from_db_by_package_name(const char *package_name, bool permission)
{
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->key);
- _ACCOUNT_FREE(data->value);
+ _INFO("_account_delete_from_db_by_package_name starting permission opions = %d", permission);
+ char* account_db_path = ACCOUNT_DB_NAME;
+ int error_code = ACCOUNT_ERROR_NONE;
- return ACCOUNT_ERROR_NONE;
-}
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
-static int _account_custom_gslist_free(GSList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
+ _GET_COOKIE
- GSList* iter;
+ GError *error = NULL;
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_custom_s *custom_data = (account_custom_s*)iter->data;
- _account_custom_item_free(custom_data);
- _ACCOUNT_FREE(custom_data);
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- g_slist_free(list);
- list = NULL;
+ //First get account list of user_name, used for gSSO DB deletion
+ GVariant* account_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, account_db_path, package_name, e_cookie, &account_list_variant, NULL, &error);
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_free_account_items(account_s *data)
-{
- _ACCOUNT_FREE(data->user_name);
- _ACCOUNT_FREE(data->email_address);
- _ACCOUNT_FREE(data->display_name);
- _ACCOUNT_FREE(data->icon_path);
- _ACCOUNT_FREE(data->source);
- _ACCOUNT_FREE(data->package_name);
- _ACCOUNT_FREE(data->domain_name);
- _ACCOUNT_FREE(data->access_token);
-
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- _ACCOUNT_FREE(data->user_data_txt[i]);
-
- _account_gslist_free(data->capablity_list);
- _account_glist_free(data->account_list);
- _account_custom_gslist_free(data->custom_list);
-
- return ACCOUNT_ERROR_NONE;
-}
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ _DESTROY_COOKIE
-static int _account_gslist_free(GSList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
+ return error_code;
}
- GSList* iter;
+ GSList* account_list = unmarshal_account_list(account_list_variant);
+ g_variant_unref(account_list_variant);
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_capability_s *cap_data = (account_capability_s*)iter->data;
- _account_free_capability_items(cap_data);
- _ACCOUNT_FREE(cap_data);
+ if (account_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- g_slist_free(list);
- list = NULL;
+ is_success = account_manager_call_account_delete_from_db_by_package_name_sync(acc_mgr, account_db_path, package_name, permission, e_cookie, NULL, &error);
- return ACCOUNT_ERROR_NONE;
-}
+ _DESTROY_COOKIE
-static int _account_glist_free(GList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GList* iter;
-
- for (iter = list; iter != NULL; iter = g_list_next(iter)) {
- account_s *account_record = (account_s*)iter->data;
- _account_free_account_items(account_record);
- _ACCOUNT_FREE(account_record);
+ if (!is_success)
+ {
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_delete_from_db_by_package_name_sync failed [%d]", error_code);
+ _account_gslist_account_free(account_list);
+ return error_code;
}
+ g_clear_error(&error);
- g_list_free(list);
- list = NULL;
-
+ _account_gslist_account_free(account_list);
return ACCOUNT_ERROR_NONE;
}
-static gboolean _account_check_duplicated(account_s *data)
-{
-#if 0
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int count = 0;
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s where user_name='%s' and package_name='%s'"
- , ACCOUNT_TABLE, data->user_name, data->package_name);
-
- count = _account_get_record_count(query);
- if (count > 0) {
- ACCOUNT_SLOGI("_account_check_duplicated : duplicated %d account(s) exist!, user_name=%s, domain_name=%s\n",
- count, data->user_name, data->domain_name );
- return TRUE;
- }
-#endif
- return FALSE;
-
-}
-
-static int _account_get_next_sequence(const char *pszName)
+ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name)
{
- int rc = 0;
- account_stmt pStmt = NULL;
- int max_seq = 0;
- char szQuery[ACCOUNT_SQL_LEN_MAX] = {0,};
-
- ACCOUNT_MEMSET(szQuery, 0x00, sizeof(szQuery));
- ACCOUNT_SNPRINTF(szQuery, sizeof(szQuery), "SELECT max(seq) FROM %s where name = '%s' ", ACCOUNT_SQLITE_SEQ, pszName);
- rc = sqlite3_prepare_v2(g_hAccountDB, szQuery, strlen(szQuery), &pStmt, NULL);
- if (SQLITE_OK != rc) {
- ACCOUNT_SLOGE("sqlite3_prepare_v2() failed(%d, %s).", rc, _account_db_err_msg());
- sqlite3_finalize(pStmt);
- return ACCOUNT_ERROR_DB_FAILED;
- }
-
- rc = sqlite3_step(pStmt);
- max_seq = sqlite3_column_int(pStmt, 0);
- max_seq++;
-
- /*Finalize Statement*/
- rc = sqlite3_finalize(pStmt);
- pStmt = NULL;
-
- return max_seq;
+ _INFO("account_delete_from_db_by_package_name starting with permission");
+ return _account_delete_from_db_by_package_name(package_name, true);
}
-static account_stmt _account_prepare_query(char *query)
+ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id)
{
- int rc = -1;
- account_stmt pStmt = NULL;
-
- ACCOUNT_RETURN_VAL((query != NULL), {}, NULL, ("query is NULL"));
-
- rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
+ //First we will update account db
+ _INFO("1. account_update_to_db_by_id start");
+ char* account_db_path = ACCOUNT_DB_NAME;
+ int error_code = ACCOUNT_ERROR_NONE;
- ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, NULL, ("sqlite3_prepare_v2(%s) failed(%s).", query, _account_db_err_msg()));
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
+ ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account id is not valid"));
- return pStmt;
-}
+ _GET_COOKIE
-static int _account_query_bind_int(account_stmt pStmt, int pos, int num)
-{
- if(!pStmt){
- ACCOUNT_ERROR("statement is null");
- return -1;
- }
+ GError *error = NULL;
- if(pos < 0){
- ACCOUNT_ERROR("invalid pos");
- return -1;
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- return sqlite3_bind_int(pStmt, pos, num);
-}
+ _INFO("2. Before account_manager_call_account_query_account_by_account_id_sync");
+ GVariant *account_serialized_old = NULL;
+ bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_path, account_id, e_cookie, &account_serialized_old, NULL, &error);
+ if (!is_success)
+ {
+ _DESTROY_COOKIE
-static int _account_query_bind_text(account_stmt pStmt, int pos, const char *str)
-{
- if(!pStmt){
- ACCOUNT_ERROR("statement is null");
- return -1;
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
+ return error_code;
}
+ g_clear_error(&error);
- if(str)
- return sqlite3_bind_text(pStmt, pos, (const char*)str, strlen(str), SQLITE_STATIC);
- else
- return sqlite3_bind_null(pStmt, pos);
-}
-
-static int _account_convert_account_to_sql(account_s *account, account_stmt hstmt, char *sql_value)
-{
- int count = 1;
-
- /*Caution : Keep insert query orders.*/
+ _INFO("3. Before account_manager_call_account_update_to_db_by_id_sync");
+ GVariant* account_serialized = marshal_account((account_s*) account);
+ is_success = account_manager_call_account_update_to_db_by_id_sync(acc_mgr, account_db_path, account_serialized, account_id, e_cookie, NULL, &error);
- /* 1. user name*/
- _account_query_bind_text(hstmt, count++, (char*)account->user_name);
+ _DESTROY_COOKIE
- /* 2. email address*/
- _account_query_bind_text(hstmt, count++, (char*)account->email_address);
-
- /* 3. display name*/
- _account_query_bind_text(hstmt, count++, (char*)account->display_name);
-
- /* 4. icon path*/
- _account_query_bind_text(hstmt, count++, (char*)account->icon_path);
-
- /* 5. source*/
- _account_query_bind_text(hstmt, count++, (char*)account->source);
-
- /* 6. package name*/
- _account_query_bind_text(hstmt, count++, (char*)account->package_name);
-
- /* 7. access token*/
- _account_query_bind_text(hstmt, count++, (char*)account->access_token);
-
- /* 8. domain name*/
- _account_query_bind_text(hstmt, count++, (char*)account->domain_name);
-
- /* 9. auth type*/
- _account_query_bind_int(hstmt, count++, account->auth_type);
-
- /* 10. secret */
- _account_query_bind_int(hstmt, count++, account->secret);
-
- /* 11. sync_support */
- _account_query_bind_int(hstmt, count++, account->sync_support);
-
- int i;
-
- /* 12. user text*/
- for(i=0; i< USER_TXT_CNT; i++)
- _account_query_bind_text(hstmt, count++, (char*)account->user_data_txt[i]);
-
- /* 13. user integer */
- for(i=0; i< USER_INT_CNT; i++)
- _account_query_bind_int(hstmt, count++, account->user_data_int[i]);
-
- return count;
-}
-
-static int _account_query_finalize(account_stmt pStmt)
-{
- int rc = -1;
-
- if (!pStmt) {
- ACCOUNT_ERROR( "pStmt is NULL");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- rc = sqlite3_finalize(pStmt);
- if (rc == SQLITE_BUSY){
- ACCOUNT_ERROR(" sqlite3 busy = %d", rc);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- } else if (rc != SQLITE_OK) {
- ACCOUNT_ERROR( "sqlite3_finalize fail, rc : %d, db_error : %s\n", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_DB_FAILED;
+ if (!is_success)
+ {
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_update_to_db_by_id_sync failed [%d]", error_code);
+ return error_code;
}
+ g_clear_error(&error);
+ _INFO("4. account_update_to_db_by_id end");
return ACCOUNT_ERROR_NONE;
}
-static int _account_query_step(account_stmt pStmt)
-{
- if(!pStmt){
- ACCOUNT_ERROR( "pStmt is NULL");
- return -1;
- }
-
- return sqlite3_step(pStmt);
-}
-
-static int _account_execute_insert_query(account_s *account)
+ACCOUNT_API int account_update_to_db_by_id_ex(account_h account, int account_id)
{
- int rc = 0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
-
- /* check whether app id exist in account type db */
-
- if (!account->user_name && !account->display_name && !account->email_address) {
- ACCOUNT_ERROR("Mandetory fields is NULL. At least one field is required among username, display name, email address\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s( user_name, email_address , display_name , icon_path , source , package_name , "
- "access_token , domain_name , auth_type , secret , sync_support , txt_custom0, txt_custom1, txt_custom2, txt_custom3, txt_custom4, "
- "int_custom0, int_custom1, int_custom2, int_custom3, int_custom4, txt_custom0 ) values " // to do urusa
- "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? , ?, ?)", ACCOUNT_TABLE);
-
- hstmt = _account_prepare_query(query);
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- _account_convert_account_to_sql(account, hstmt, query);
-
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
-
- if( _account_db_err_code() == SQLITE_PERM )
- error_code = ACCOUNT_ERROR_PERMISSION_DENIED;
- else
- error_code = ACCOUNT_ERROR_DB_FAILED;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
+ int ret = -1;
+ ret = account_update_to_db_by_id(account, account_id);
- return error_code;
+ return ret;
}
-static int _account_insert_capability(account_s *account, int account_id)
+ACCOUNT_INTERNAL_API int account_update_to_db_by_id_without_permission(account_h account, int account_id)
{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
+ //First we will update account db
+ //Then we will update gSSO DB, if it fails then we will rollback account db updates
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ _INFO("account_update_to_db_by_id_without_permission start");
+ char* account_db_path = ACCOUNT_DB_NAME;
+ int error_code = ACCOUNT_ERROR_NONE;
- if (g_slist_length( account->capablity_list)==0) {
- ACCOUNT_DEBUG( "_account_insert_capability, no capability\n");
- return ACCOUNT_ERROR_NONE;
- }
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
+ ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account id is not valid"));
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
+ _GET_COOKIE
- rc = _account_get_record_count(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if (rc <= 0) {
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- /* insert query*/
-
- GSList *iter;
-
- for (iter = account->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
-
- account_capability_s* cap_data = NULL;
- cap_data = (account_capability_s*)iter->data;
-
- ACCOUNT_SLOGD("cap_data->type = %s, cap_data->value = %d \n", cap_data->type, cap_data->value);
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(key, value, package_name, user_name, account_id) VALUES "
- "(?, ?, ?, ?, ?) ", CAPABILITY_TABLE);
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- ret = _account_query_bind_text(hstmt, count++, cap_data->type);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_int(hstmt, count++, cap_data->value);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)account->user_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_int(hstmt, count++, (int)account_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_update_capability(account_s *account, int account_id)
-{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
-
- if (g_slist_length( account->capablity_list)==0) {
- ACCOUNT_ERROR( "_account_update_capability, no capability\n");
- return ACCOUNT_ERROR_NONE;
- }
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
- rc = _account_get_record_count(query);
-
- if (rc <= 0) {
- ACCOUNT_SLOGI( "_account_update_capability : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE account_id=? ", CAPABILITY_TABLE);
- hstmt = _account_prepare_query(query);
- count = 1;
- _account_query_bind_int(hstmt, count++, (int)account_id);
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_DB_FAILED;
- }
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GSList *iter;
-
- for (iter = account->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(key, value, package_name, user_name, account_id) VALUES "
- "(?, ?, ?, ?, ?) ", CAPABILITY_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- account_capability_s* cap_data = NULL;
- cap_data = (account_capability_s*)iter->data;
-
- ret = _account_query_bind_text(hstmt, count++, cap_data->type);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_int(hstmt, count++, cap_data->value);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)account->user_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_int(hstmt, count++, (int)account_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_update_capability_by_user_name(account_s *account, const char *user_name, const char *package_name )
-{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
-
- if (g_slist_length( account->capablity_list)==0) {
- ACCOUNT_ERROR( "_account_update_capability_by_user_name, no capability\n");
- return ACCOUNT_ERROR_NONE;
- }
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where package_name= '%s' and user_name='%s'", ACCOUNT_TABLE, package_name, user_name);
-
- rc = _account_get_record_count(query);
+ GVariant *account_serialized_old = NULL;
+ _INFO("before query() account_id[%d]", account_id);
+ bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_path, account_id, e_cookie, &account_serialized_old, NULL, &error);
+ if (!is_success)
+ {
+ _DESTROY_COOKIE
- if (rc <= 0) {
- ACCOUNT_SLOGI( "_account_update_capability_by_user_name : related account item is not existed rc=%d , %s ", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
+ return error_code;
}
+ g_clear_error(&error);
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name=? and user_name=? ", CAPABILITY_TABLE);
- hstmt = _account_prepare_query(query);
- count = 1;
- _account_query_bind_text(hstmt, count++, (char*)account->package_name);
- _account_query_bind_text(hstmt, count++, (char*)account->user_name);
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_DB_FAILED;
+ _INFO("before marshal() : account_id[%d], user_name=%s", account_id, ((account_s*)account)->user_name);
+ GVariant* account_serialized = marshal_account((account_s*) account);
+ _INFO("after marshal() : account_id[%d]", account_id);
+ if (account_serialized == NULL)
+ {
+ _ERR("Invalid input");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GSList* iter;
-
- for (iter = account->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(key, value, package_name, user_name, account_id) VALUES "
- "(?, ?, ?, ?, ?) ", CAPABILITY_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- account_capability_s* cap_data = NULL;
- cap_data = (account_capability_s*)iter->data;
+ _INFO("before call update() : account_id[%d]", account_id);
+ is_success = account_manager_call_account_update_to_db_by_id_ex_sync(acc_mgr, account_db_path, account_serialized, account_id, e_cookie, NULL, &error);
+ _INFO("after call update() : is_success=%d", is_success);
- ret = _account_query_bind_text(hstmt, count++, cap_data->type);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_int(hstmt, count++, cap_data->value);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)account->user_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_int(hstmt, count++, (int)account->id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
+ _DESTROY_COOKIE
+ if (!is_success)
+ {
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_update_to_db_by_id_ex_sync failed [%d]", error_code);
+ return error_code;
}
+ g_clear_error(&error);
return ACCOUNT_ERROR_NONE;
}
-static int _account_query_table_column_int(account_stmt pStmt, int pos)
-{
- if(!pStmt){
- ACCOUNT_ERROR("statement is null");
- return -1;
- }
-
- if(pos < 0){
- ACCOUNT_ERROR("invalid pos");
- return -1;
- }
-
- return sqlite3_column_int(pStmt, pos);
-}
-
-static const char *_account_query_table_column_text(account_stmt pStmt, int pos)
-{
- if(!pStmt){
- ACCOUNT_ERROR("statement is null");
- return NULL;
- }
-
- if(pos < 0){
- ACCOUNT_ERROR("invalid pos");
- return NULL;
- }
-
- return (const char *)sqlite3_column_text(pStmt, pos);
-}
-
-static void _account_db_data_to_text(const char *textbuf, char **output)
-{
- if (textbuf && strlen(textbuf)>0) {
- if (*output) {
- free(*output);
- *output = NULL;
- }
- *output = strdup(textbuf);
- }
-}
-
-static void _account_convert_column_to_account(account_stmt hstmt, account_s *account_record)
-{
- const char *textbuf = NULL;
-
- account_record->id = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_ID);
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_NAME);
- _account_db_data_to_text(textbuf, &(account_record->user_name));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_EMAIL_ADDRESS);
- _account_db_data_to_text(textbuf, &(account_record->email_address));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_DISPLAY_NAME);
- _account_db_data_to_text(textbuf, &(account_record->display_name));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_ICON_PATH);
- _account_db_data_to_text(textbuf, &(account_record->icon_path));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_SOURCE);
- _account_db_data_to_text(textbuf, &(account_record->source));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_PACKAGE_NAME);
- _account_db_data_to_text(textbuf, &(account_record->package_name));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_ACCESS_TOKEN);
- _account_db_data_to_text(textbuf, &(account_record->access_token));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_DOMAIN_NAME);
- _account_db_data_to_text(textbuf, &(account_record->domain_name));
-
- account_record->auth_type = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_AUTH_TYPE);
-
- account_record->secret = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_SECRET);
-
- account_record->sync_support = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_SYNC_SUPPORT);
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_0);
- _account_db_data_to_text(textbuf, &(account_record->user_data_txt[0]));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_1);
- _account_db_data_to_text(textbuf, &(account_record->user_data_txt[1]));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_2);
- _account_db_data_to_text(textbuf, &(account_record->user_data_txt[2]));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_3);
- _account_db_data_to_text(textbuf, &(account_record->user_data_txt[3]));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_4);
- _account_db_data_to_text(textbuf, &(account_record->user_data_txt[4]));
-
- account_record->user_data_int[0] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_0);
- account_record->user_data_int[1] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_1);
- account_record->user_data_int[2] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_2);
- account_record->user_data_int[3] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_3);
- account_record->user_data_int[4] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_4);
-}
-
-static void _account_convert_column_to_capability(account_stmt hstmt, account_capability_s *capability_record)
-{
- const char *textbuf = NULL;
-
- capability_record->id = _account_query_table_column_int(hstmt, CAPABILITY_FIELD_ID);
-
- textbuf = _account_query_table_column_text(hstmt, CAPABILITY_FIELD_KEY);
- _account_db_data_to_text(textbuf, &(capability_record->type));
-
- capability_record->value = _account_query_table_column_int(hstmt, CAPABILITY_FIELD_VALUE);
-
- textbuf = _account_query_table_column_text(hstmt, CAPABILITY_FIELD_PACKAGE_NAME);
- _account_db_data_to_text(textbuf, &(capability_record->package_name));
-
- textbuf = _account_query_table_column_text(hstmt, CAPABILITY_FIELD_USER_NAME);
- _account_db_data_to_text(textbuf, &(capability_record->user_name));
-
- capability_record->account_id = _account_query_table_column_int(hstmt, CAPABILITY_FIELD_ACCOUNT_ID);
-}
-
-static void _account_convert_column_to_custom(account_stmt hstmt, account_custom_s *custom_record)
-{
- const char *textbuf = NULL;
-
- custom_record->account_id = _account_query_table_column_int(hstmt, ACCOUNT_CUSTOM_FIELD_ACCOUNT_ID);
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_CUSTOM_FIELD_APP_ID);
- _account_db_data_to_text(textbuf, &(custom_record->app_id));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_CUSTOM_FIELD_KEY);
- _account_db_data_to_text(textbuf, &(custom_record->key));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_CUSTOM_FIELD_VALUE);
- _account_db_data_to_text(textbuf, &(custom_record->value));
-}
-
-bool _account_get_capability_text_cb(const char* capability_type, account_capability_state_e capability_value, void *user_data)
-{
- account_s *data = (account_s*)user_data;
-
- account_capability_s *cap_data = (account_capability_s*)malloc(sizeof(account_capability_s));
-
- if (cap_data == NULL)
- return FALSE;
- ACCOUNT_MEMSET(cap_data, 0, sizeof(account_capability_s));
-
- cap_data->type = _account_get_text(capability_type);
- cap_data->value = capability_value;
-
- data->capablity_list = g_slist_append(data->capablity_list, (gpointer)cap_data);
-
- return TRUE;
-}
-
-
-bool _account_get_custom_text_cb(char* key, char* value, void *user_data)
-{
- account_s *data = (account_s*)user_data;
-
- account_custom_s *custom_data = (account_custom_s*)malloc(sizeof(account_custom_s));
-
- if (custom_data == NULL) {
- ACCOUNT_DEBUG("_account_get_custom_text_cb :: malloc fail\n");
- return FALSE;
- }
- ACCOUNT_MEMSET(custom_data, 0, sizeof(account_custom_s));
-
- custom_data->account_id = data->id;
- custom_data->app_id = _account_get_text(data->package_name);
- custom_data->key = _account_get_text(key);
- custom_data->value = _account_get_text(value);
-
- data->custom_list = g_slist_append(data->custom_list, (gpointer)custom_data);
-
- return TRUE;
-}
-
-
-static char *_account_get_text(const char *text_data)
-{
- char *text_value = NULL;
-
- if (text_data != NULL) {
- text_value = strdup(text_data);
- }
- return text_value;
-}
-
-static int _account_compare_old_record_by_user_name(account_s *new_account, const char* user_name, const char* package_name)
+ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- account_s *old_account = NULL;
+ //First we will update account db
+ _INFO("account_update_to_db_by_user_name starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
+ int error_code = ACCOUNT_ERROR_NONE;
- ACCOUNT_RETURN_VAL((new_account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL"));
ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- old_account = (account_s*)calloc(1, sizeof(account_s));
- if(!old_account) {
- ACCOUNT_FATAL("Memory alloc fail\n");
- return ACCOUNT_ERROR_OUT_OF_MEMORY;
- }
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = '%s' and package_name='%s'", ACCOUNT_TABLE, user_name, package_name);
- hstmt = _account_prepare_query(query);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- while (rc == SQLITE_ROW) {
- _account_convert_column_to_account(hstmt, old_account);
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- // get capability
- error_code = account_query_capability_by_account_id(_account_get_capability_text_cb, old_account->id, (void*)old_account);
- ACCOUNT_CATCH_ERROR((error_code == ACCOUNT_ERROR_NONE), {}, error_code, ("account_query_capability_by_account_id error"));
-
- // get custom text
- error_code = _account_query_custom_by_account_id(_account_get_custom_text_cb, old_account->id, (void*)old_account);
- ACCOUNT_CATCH_ERROR((error_code == ACCOUNT_ERROR_NONE), {}, error_code, ("_account_query_custom_by_account_id error"));
-
- // compare
- new_account->id = old_account->id;
-
- //user name
- if(!new_account->user_name) {
- if(old_account->user_name)
- new_account->user_name = _account_get_text(old_account->user_name);
- }
+ GError *error = NULL;
- // display name
- if(!new_account->display_name) {
- if(old_account->display_name)
- new_account->display_name = _account_get_text(old_account->display_name);
- }
-
- // email address
- if(!new_account->email_address) {
- if(old_account->email_address)
- new_account->email_address = _account_get_text(old_account->email_address);
- }
-
- // domain name
- if(!new_account->domain_name) {
- if(old_account->domain_name)
- new_account->domain_name = _account_get_text(old_account->domain_name);
- }
-
- // icon path
- if(!new_account->icon_path) {
- if(old_account->icon_path)
- new_account->icon_path = _account_get_text(old_account->icon_path);
- }
-
- // source
- if(!new_account->source) {
- if(old_account->source)
- new_account->source = _account_get_text(old_account->source);
- }
-
- _ACCOUNT_FREE(new_account->package_name);
- new_account->package_name = _account_get_text(old_account->package_name);
-
- // access token
- if(!new_account->access_token) {
- if(old_account->access_token)
- new_account->access_token = _account_get_text(old_account->access_token);
- }
-
- // user text
- int i;
- for(i=0;i<USER_TXT_CNT;i++) {
- if(!new_account->user_data_txt[i]) {
- if(old_account->user_data_txt[i])
- new_account->user_data_txt[i] = _account_get_text(old_account->user_data_txt[i]);
- }
- }
-
- // auth type
- if(new_account->auth_type == ACCOUNT_AUTH_TYPE_INVALID) {
- new_account->auth_type = old_account->auth_type;
- }
-
- //secret
- if(new_account->secret== ACCOUNT_SECRECY_INVALID) {
- new_account->secret = old_account->secret;
- }
-
- // sync support
- if(new_account->sync_support == ACCOUNT_SYNC_INVALID) {
- new_account->sync_support = old_account->sync_support;
- }
-
- // user int
- for(i=0;i<USER_INT_CNT;i++) {
- if(new_account->user_data_int[i] == 0) {
- new_account->user_data_int[i] = old_account->user_data_int[i];
- }
- }
-
- // capability
-
- // user custom table
-
-
-
- CATCH:
- if (old_account) {
- _account_free_account_items(old_account);
- _ACCOUNT_FREE(old_account);
- }
-
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-
-
-static int _account_update_account_by_user_name(account_s *account, const char *user_name, const char *package_name)
-{
- int rc = 0, binding_count = 0, count = 0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is NULL.\n"));
- ACCOUNT_RETURN_VAL((package_name!= NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is NULL.\n"));
-
- char* current_appid = NULL;
- char* verified_appid = NULL;
-
- current_appid = _account_get_current_appid();
- error_code = _account_check_account_type_with_appid_group(current_appid, &verified_appid);
-
- _ACCOUNT_FREE(current_appid);
- _ACCOUNT_FREE(verified_appid);
-
- if(error_code != ACCOUNT_ERROR_NONE){
- ACCOUNT_ERROR("No permission to update\n");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- _account_compare_old_record_by_user_name(account, user_name, package_name);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (!account->package_name) {
- ACCOUNT_ERROR("Package name is mandetory field, it can not be NULL!!!!\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- if (!account->user_name && !account->display_name && !account->email_address) {
- ACCOUNT_ERROR("One field should be set among user name, display name, email address\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE user_name='%s' and package_name='%s'"
- , ACCOUNT_TABLE, user_name, package_name);
-
- count = _account_get_record_count(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (count <= 0) {
- ACCOUNT_SLOGI("_account_update_account_by_user_name : The account not exist!, count = %d, user_name=%s, package_name=%s\n",
- count, user_name, package_name);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET user_name=?, email_address =?, display_name =?, "
- "icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?, sync_support =?,"
- "txt_custom0=?, txt_custom1=?, txt_custom2=?, txt_custom3=?, txt_custom4=?, "
- "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE user_name=? and package_name=? ", ACCOUNT_TABLE);
-
- hstmt = _account_prepare_query(query);
- if( _account_db_err_code() == SQLITE_PERM ){
- _account_end_transaction(FALSE);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s).\n", _account_db_err_msg()));
-
- binding_count = _account_convert_account_to_sql(account, hstmt, query);
-
- _account_query_bind_text(hstmt, binding_count++, user_name);
- _account_query_bind_text(hstmt, binding_count++, package_name);
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- }
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /*update capability*/
- error_code = _account_update_capability_by_user_name(account, user_name, package_name);
-
- /* update custom */
- error_code = _account_update_custom(account, account->id);
-
- return error_code;
-}
-
-ACCOUNT_API int account_insert_to_db(account_h account, int *account_id)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- int ret_transaction = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- ACCOUNT_RETURN_VAL((account_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID POINTER IS NULL"));
-
- account_s *data = (account_s*)account;
- ACCOUNT_SLOGD("(%s)-(%d) account_insert_to_db: begin_transaction.\n", __FUNCTION__, __LINE__);
-
- pthread_mutex_lock(&account_mutex);
-
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
+ GVariant *account_serialized_old = NULL;
+ account_s *account_data = (account_s*) account;
+ bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_path, account_data->id, e_cookie, &account_serialized_old, NULL, &error);
+ if (!is_success)
+ {
+ _DESTROY_COOKIE
- if(_account_db_err_code() == SQLITE_PERM){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
+ return error_code;
}
+ g_clear_error(&error);
- if (ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY) {
- ACCOUNT_ERROR("account insert:_account_begin_transaction fail %d\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }else if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account insert:_account_begin_transaction fail %d\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ret_transaction;
- }
-
- if (_account_check_duplicated(data)) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_DEBUG("Duplicated, rollback insert query(%x)!!!!\n", ret_transaction);
- *account_id = -1;
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DUPLICATED;
- } else {
- *account_id = _account_get_next_sequence(ACCOUNT_TABLE);
-
- char* appid = NULL;
- appid = _account_get_current_appid();
-
- if(!appid){
- // API caller cannot be recognized
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("App id is not registered in account type DB, transaction ret (%x)!!!!\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER;
- }
+ GVariant* account_serialized = marshal_account(account_data);
+ is_success = account_manager_call_account_update_to_db_by_user_name_sync(acc_mgr, account_db_path, account_serialized, user_name, package_name, e_cookie, NULL, &error);
- char* verified_appid = NULL;
- error_code = _account_check_account_type_with_appid_group(appid, &verified_appid);
- if(error_code != ACCOUNT_ERROR_NONE){
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("App id is not registered in account type DB, transaction ret (%x)!!!!\n", ret_transaction);
- _ACCOUNT_FREE(verified_appid);
- _ACCOUNT_FREE(appid);
- pthread_mutex_unlock(&account_mutex);
- return error_code;
- }
-
- _ACCOUNT_FREE(appid);
-
- if(verified_appid){
- if(!_account_check_add_more_account(verified_appid)) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("No more account cannot be added, transaction ret (%x)!!!!\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- _ACCOUNT_FREE(verified_appid);
- return ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE;
- }
-
- _ACCOUNT_FREE(data->package_name);
- data->package_name = _account_get_text(verified_appid);
- _ACCOUNT_FREE(verified_appid);
- if(!data->package_name) {
- ACCOUNT_ERROR("Memory Allocation Failed");
- return ACCOUNT_ERROR_OUT_OF_MEMORY;
- }
- }
-
-#ifdef SAMSUNG_ACCOUNT_MANAGER
- if(!strcmp(data->package_name,SAMSUNGACCOUNT_PKG_NAME)){
- //temporary feature for samsung account domain
- int ret = -1;
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE) {
- ACCOUNT_DEBUG("set_domain error(%x)!!!!\n", ret);
- }
- }
-#endif
-
- if(!_account_check_add_more_account(data->package_name)) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("No more account cannot be added, transaction ret (%x)!!!!\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE;
- }
-
- error_code = _account_execute_insert_query(data);
-
- if (error_code != ACCOUNT_ERROR_NONE) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("INSERT account fail, rollback insert query(%x)!!!!\n", ret_transaction);
- *account_id = -1;
- pthread_mutex_unlock(&account_mutex);
- return error_code;
- }
- }
-
- error_code = _account_insert_capability(data, *account_id);
- if (error_code != ACCOUNT_ERROR_NONE) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("INSERT capability fail, rollback insert capability query(%x)!!!!\n", ret_transaction);
- *account_id = -1;
- pthread_mutex_unlock(&account_mutex);
- return error_code;
- }
+ _DESTROY_COOKIE
- error_code = _account_insert_custom(data, *account_id);
- if (error_code != ACCOUNT_ERROR_NONE) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("INSERT custom fail, rollback insert capability query(%x)!!!!\n", ret_transaction);
- *account_id = -1;
- pthread_mutex_unlock(&account_mutex);
+ if (!is_success)
+ {
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("account_manager_call_account_update_to_db_by_user_name_sync failed [%d]", error_code);
return error_code;
}
-
- pthread_mutex_unlock(&account_mutex);
- _account_end_transaction(TRUE);
- ACCOUNT_SLOGD("(%s)-(%d) account _end_transaction.\n", __FUNCTION__, __LINE__);
-
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_INSERT, *account_id);
- _account_insert_delete_update_notification_send(buf);
- ACCOUNT_SLOGD("(%s)-(%d) account _notification_send.\n", __FUNCTION__, __LINE__);
+ g_clear_error(&error);
return ACCOUNT_ERROR_NONE;
-
}
ACCOUNT_API int account_create(account_h *account)
{
+ _INFO("account_create start");
if (!account) {
ACCOUNT_SLOGE("(%s)-(%d) account is NULL.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
@@ -1974,8 +633,30 @@ ACCOUNT_API int account_create(account_h *account)
/*Setting account as not supporting sync by default*/
data->sync_support = ACCOUNT_SYNC_NOT_SUPPORT;
+ data->auth_type = ACCOUNT_AUTH_TYPE_INVALID;
+
+// data->account_list = NULL;
+ data->capablity_list = NULL;
+ data->custom_list = NULL;
+// data->domain_list = NULL;
+// data->mechanism_list = NULL;
+
*account = (account_h)data;
+ _INFO("account_create end");
+ return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_destroy(account_h account)
+{
+ _INFO("account_destroy start");
+ account_s *data = (account_s*)account;
+
+ ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account handle is null!"));
+
+ _account_free_account_with_items(data);
+
+ _INFO("account_destroy end");
return ACCOUNT_ERROR_NONE;
}
@@ -2149,7 +830,7 @@ ACCOUNT_API int account_set_user_text(account_h account, int idx, const char *us
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
if (idx >= USER_TXT_CNT || idx < 0) {
- ACCOUNT_SLOGE("(%s)-(%d) index rage should be between 0-4.\n", __FUNCTION__, __LINE__);
+ ACCOUNT_SLOGE("(%s)-(%d) idx rage should be between 0-4.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
@@ -2217,7 +898,7 @@ ACCOUNT_API int account_set_auth_type(account_h account, const account_auth_type
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
- if ( ((int)auth_type < 0) || (auth_type > ACCOUNT_AUTH_TYPE_MAX) ) {
+ if ( ((int)auth_type < 0) || (auth_type > ACCOUNT_AUTH_TYPE_CLIENT_LOGIN)) {
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
@@ -2232,7 +913,7 @@ ACCOUNT_API int account_set_secret(account_h account, const account_secrecy_stat
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
- if ( ((int)secret < 0) || (secret > ACCOUNT_SECRECY_MAX)) {
+ if ( ((int)secret < 0) || (secret > ACCOUNT_SECRECY_VISIBLE)) {
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
@@ -2247,7 +928,7 @@ ACCOUNT_API int account_set_sync_support(account_h account, const account_sync_s
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
- if ( ((int)sync_support < 0) || (sync_support > ACCOUNT_SYNC_MAX)) {
+ if ( ((int)sync_support < 0) || (sync_support > ACCOUNT_SUPPORTS_SYNC)) {
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
@@ -2660,2240 +1341,599 @@ ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb call
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, int account_id, void *user_data )
+ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_data)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ _INFO("account_foreach_account_from_db start");
+ char* account_db_path = ACCOUNT_DB_NAME;
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT Callback IS NULL"));
- ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE account_id = %d", CAPABILITY_TABLE, account_id);
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ GVariant* account_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_all_sync(acc_mgr, account_db_path, e_cookie, &account_list_variant, NULL, &error);
- account_capability_s* capability_record = NULL;
+ _DESTROY_COOKIE
- while (rc == SQLITE_ROW) {
- bool cb_ret = FALSE;
- capability_record = (account_capability_s*) malloc(sizeof(account_capability_s));
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
- if (capability_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
-
- ACCOUNT_MEMSET(capability_record, 0x00, sizeof(account_capability_s));
-
- _account_convert_column_to_capability(hstmt, capability_record);
-
- cb_ret = callback(capability_record->type, capability_record->value, user_data);
-
- _account_free_capability_items(capability_record);
- _ACCOUNT_FREE(capability_record);
-
- ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
-
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
-}
-
-static int _account_compare_old_record(account_s *new_account, int account_id)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- account_s *old_account = NULL;
-
- ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
- ACCOUNT_RETURN_VAL((new_account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- old_account = (account_s*)calloc(1, sizeof(account_s));
- ACCOUNT_RETURN_VAL((old_account != NULL), {}, ACCOUNT_ERROR_OUT_OF_MEMORY,("Memory Allocation Failed"));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
- hstmt = _account_prepare_query(query);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- while (rc == SQLITE_ROW) {
- _account_convert_column_to_account(hstmt, old_account);
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- // get capability
- error_code = account_query_capability_by_account_id(_account_get_capability_text_cb, old_account->id, (void*)old_account);
- ACCOUNT_CATCH_ERROR((error_code == ACCOUNT_ERROR_NONE), {}, error_code, ("account_query_capability_by_account_id error"));
-
- // get custom text
- error_code = _account_query_custom_by_account_id(_account_get_custom_text_cb, old_account->id, (void*)old_account);
- ACCOUNT_CATCH_ERROR((error_code == ACCOUNT_ERROR_NONE), {}, error_code, ("_account_query_custom_by_account_id error"));
-
- // compare
-
- new_account->id = old_account->id;
-
- //user name
- if(!new_account->user_name) {
- if(old_account->user_name)
- new_account->user_name = _account_get_text(old_account->user_name);
- }
-
- // display name
- if(!new_account->display_name) {
- if(old_account->display_name)
- new_account->display_name = _account_get_text(old_account->display_name);
- }
-
- // email address
- if(!new_account->email_address) {
- if(old_account->email_address)
- new_account->email_address = _account_get_text(old_account->email_address);
- }
-
- // domain name
- if(!new_account->domain_name) {
- if(old_account->domain_name)
- new_account->domain_name = _account_get_text(old_account->domain_name);
- }
-
- // icon path
- if(!new_account->icon_path) {
- if(old_account->icon_path)
- new_account->icon_path = _account_get_text(old_account->icon_path);
- }
-
- // source
- if(!new_account->source) {
- if(old_account->source)
- new_account->source = _account_get_text(old_account->source);
- }
-
- _ACCOUNT_FREE(new_account->package_name);
- new_account->package_name = _account_get_text(old_account->package_name);
-
- // access token
- if(!new_account->access_token) {
- if(old_account->access_token)
- new_account->access_token = _account_get_text(old_account->access_token);
- }
-
- // user text
- int i;
- for(i=0;i<USER_TXT_CNT;i++) {
- if(!new_account->user_data_txt[i]) {
- if(old_account->user_data_txt[i])
- new_account->user_data_txt[i] = _account_get_text(old_account->user_data_txt[i]);
- }
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ return error_code;
}
- // auth type
- if(new_account->auth_type == ACCOUNT_AUTH_TYPE_INVALID) {
- new_account->auth_type = old_account->auth_type;
- }
+ GSList* account_list = unmarshal_account_list(account_list_variant);
+ g_variant_unref(account_list_variant);
- //secret
- if(new_account->secret== ACCOUNT_SECRECY_INVALID) {
- new_account->secret = old_account->secret;
- }
+ GSList* iter;
- // sync support
- if(new_account->sync_support == ACCOUNT_SYNC_INVALID) {
- new_account->sync_support = old_account->sync_support;
- }
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
+ account_s *account = NULL;
+ account = (account_s*)iter->data;
+ _INFO("Before _account_query_identity_info_by_id");
- // user int
- for(i=0;i<USER_INT_CNT;i++) {
- if(new_account->user_data_int[i] == 0) {
- new_account->user_data_int[i] = old_account->user_data_int[i];
+ _INFO("account->id=%d", account->id);
+ if (callback((account_h)account, user_data) == false)
+ {
+ _INFO("application callback requested to discontinue.");
+ break;
}
+ _INFO("After one iteration callback");
}
+ _account_gslist_account_free(account_list);
- // capability
-
- // user custom table
-
-
-
- CATCH:
- if (old_account) {
- _account_free_account_items(old_account);
- _ACCOUNT_FREE(old_account);
- }
-
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
+ _INFO("account_foreach_account_from_db end");
return ACCOUNT_ERROR_NONE;
}
-static int _account_get_package_name_from_account_id(int account_id, char **package_name)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- account_s *old_account = NULL;
-
- ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- old_account = (account_s*)calloc(1, sizeof(account_s));
- ACCOUNT_RETURN_VAL((old_account != NULL), {}, ACCOUNT_ERROR_OUT_OF_MEMORY,("Memory Allocation Failed"));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
- hstmt = _account_prepare_query(query);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- while (rc == SQLITE_ROW) {
- _account_convert_column_to_account(hstmt, old_account);
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- // get package name.
- *package_name = _account_get_text(old_account->package_name);
-
-
- CATCH:
- if (old_account) {
- _account_free_account_items(old_account);
- _ACCOUNT_FREE(old_account);
- }
-
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- return error_code;
-
-}
-
-static int _account_update_account(account_s *account, int account_id)
-{
- int rc = 0, binding_count =0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = ACCOUNT_ERROR_NONE, count=0, ret_transaction = 0;
- account_stmt hstmt = NULL;
-
- if (!account->package_name) {
- ACCOUNT_ERROR("Package name is mandetory field, it can not be NULL!!!!\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- /* Check permission of requested appid */
- char* current_appid = NULL;
- char *package_name = NULL;
-
- current_appid = _account_get_current_appid();
- error_code = _account_get_package_name_from_account_id(account_id, &package_name);
-
- if(error_code != ACCOUNT_ERROR_NONE || package_name == NULL){
- ACCOUNT_ERROR("No package name with account_id\n");
- _ACCOUNT_FREE(current_appid);
- _ACCOUNT_FREE(package_name);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- error_code = _account_check_appid_group_with_package_name(current_appid, package_name);
- ACCOUNT_DEBUG( "UPDATE:account_id[%d],current_appid[%s]package_name[%s]", account_id, current_appid, package_name); // TODO: remove the log later.
-
- _ACCOUNT_FREE(current_appid);
- _ACCOUNT_FREE(package_name);
-
- if(error_code != ACCOUNT_ERROR_NONE){
- ACCOUNT_ERROR("No permission to update\n");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- _account_compare_old_record(account, account_id);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if( _account_db_err_code() == SQLITE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
-
- if (!account->user_name && !account->display_name && !account->email_address) {
- ACCOUNT_ERROR("One field should be set among user name, display name, email address\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id = %d ", ACCOUNT_TABLE, account_id);
-
- count = _account_get_record_count(query);
- if (count <= 0) {
- ACCOUNT_DEBUG(" Account record not found, count = %d\n", count);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
- if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET user_name=?, email_address =?, display_name =?, "
- "icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?, sync_support =?,"
- "txt_custom0=?, txt_custom1=?, txt_custom2=?, txt_custom3=?, txt_custom4=?, "
- "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE _id=? ", ACCOUNT_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s)(%x).\n", _account_db_err_msg(), _account_end_transaction(FALSE)));
-
- binding_count = _account_convert_account_to_sql(account, hstmt, query);
- _account_query_bind_int(hstmt, binding_count++, account_id);
-
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_SLOGE( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /*update capability*/
- error_code = _account_update_capability(account, account_id);
- if(error_code != ACCOUNT_ERROR_NONE && error_code!= ACCOUNT_ERROR_RECORD_NOT_FOUND){
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
- return error_code;
- }
-
- /* update custom */
- error_code = _account_update_custom(account, account_id);
- if(error_code != ACCOUNT_ERROR_NONE && error_code!= ACCOUNT_ERROR_RECORD_NOT_FOUND){
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
- return error_code;
- }
-
- ret_transaction = _account_end_transaction(TRUE);
-
- return error_code;
-}
-
-
-static int _account_update_account_ex(account_s *account, int account_id)
+ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h *account)
{
- int rc = 0, binding_count =0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = ACCOUNT_ERROR_NONE, count=0, ret_transaction = 0;
- account_stmt hstmt = NULL;
-
- if (!account->package_name) {
- ACCOUNT_ERROR("Package name is mandetory field, it can not be NULL!!!!\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- _account_compare_old_record(account, account_id);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (!account->user_name && !account->display_name && !account->email_address) {
- ACCOUNT_ERROR("One field should be set among user name, display name, email address\n");
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
+ _INFO("account_query_account_by_account_id start [%d]", account_db_id);
+ char* account_db_path = ACCOUNT_DB_NAME;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id = %d ", ACCOUNT_TABLE, account_id);
-
- count = _account_get_record_count(query);
- if (count <= 0) {
- ACCOUNT_DEBUG(" Account record not found, count = %d\n", count);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
- if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
+ ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT POINTER IS NULL"));
+ ACCOUNT_RETURN_VAL((*account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET user_name=?, email_address =?, display_name =?, "
- "icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?, sync_support =?,"
- "txt_custom0=?, txt_custom1=?, txt_custom2=?, txt_custom3=?, txt_custom4=?, "
- "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE _id=? ", ACCOUNT_TABLE);
+ _GET_COOKIE
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s)(%x).\n", _account_db_err_msg(), _account_end_transaction(FALSE)));
+ GVariant* account_variant = NULL;
+ bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_path, account_db_id, e_cookie, &account_variant, NULL, &error);
- binding_count = _account_convert_account_to_sql(account, hstmt, query);
- _account_query_bind_int(hstmt, binding_count++, account_id);
-
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_SLOGE( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /*update capability*/
- error_code = _account_update_capability(account, account_id);
- if(error_code != ACCOUNT_ERROR_NONE && error_code!= ACCOUNT_ERROR_RECORD_NOT_FOUND){
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
- return error_code;
- }
+ _DESTROY_COOKIE
- /* update custom */
- error_code = _account_update_custom(account, account_id);
- if(error_code != ACCOUNT_ERROR_NONE && error_code!= ACCOUNT_ERROR_RECORD_NOT_FOUND){
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("update capability Failed, trying to roll back(%x) !!!\n", ret_transaction);
- return error_code;
- }
-
- ret_transaction = _account_end_transaction(TRUE);
-
- return error_code;
-}
-
-
-ACCOUNT_API int account_update_to_db_by_id(const account_h account, int account_id)
-{
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
- ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account id is not valid"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- int error_code = ACCOUNT_ERROR_NONE;
- account_s* data = (account_s*)account;
-
- pthread_mutex_lock(&account_mutex);
-
- error_code = _account_update_account(data, account_id);
-
- if(error_code != ACCOUNT_ERROR_NONE) {
- pthread_mutex_unlock(&account_mutex);
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
return error_code;
}
- pthread_mutex_unlock(&account_mutex);
-
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_UPDATE, account_id);
- _account_insert_delete_update_notification_send(buf);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-ACCOUNT_API int account_update_to_db_by_id_ex(const account_h account, int account_id)
-{
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ _INFO("before unmarshal_account");
+ account_s* account_data = umarshal_account(account_variant);
+ _INFO("after unmarshal_account");
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
+ if (account_data == NULL)
+ {
+ _ERR("Failed to unmarshal");
+ return ACCOUNT_ERROR_DB_FAILED;
}
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
- ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account id is not valid"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- int error_code = ACCOUNT_ERROR_NONE;
- account_s* data = (account_s*)account;
-
- pthread_mutex_lock(&account_mutex);
-
- error_code = _account_update_account_ex(data, account_id);
+ account_s **input = (account_s **)account;
- if(error_code != ACCOUNT_ERROR_NONE) {
- pthread_mutex_unlock(&account_mutex);
- return error_code;
- }
+ _account_free_account_with_items(*input);
- pthread_mutex_unlock(&account_mutex);
+ *input = account_data;
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_UPDATE, account_id);
- _account_insert_delete_update_notification_send(buf);
+ _INFO("account_query_account_by_account_id end");
return ACCOUNT_ERROR_NONE;
}
-
-ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name)
+ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data)
{
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_query_account_by_user_name starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL"));
- ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- int error_code = ACCOUNT_ERROR_NONE;
- account_s *data = (account_s*)account;
-
- pthread_mutex_lock(&account_mutex);
-
- error_code = _account_update_account_by_user_name(data, user_name, package_name);
-
- pthread_mutex_unlock(&account_mutex);
-
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_UPDATE, data->id);
- _account_insert_delete_update_notification_send(buf);
-
- return error_code;
-}
-
-ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_data)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- GList *account_list = NULL;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INFO IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s ", ACCOUNT_TABLE);
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- rc = _account_query_step(hstmt);
+ GVariant* account_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, account_db_path, user_name, e_cookie, &account_list_variant, NULL, &error);
- account_s *account_record = NULL;
+ _DESTROY_COOKIE
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- int k=0;
- while(rc == SQLITE_ROW) {
- account_record = (account_s*) malloc(sizeof(account_s));
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ return error_code;
+ }
- if (account_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
+ GSList* account_list = unmarshal_account_list(account_list_variant);
+ g_variant_unref(account_list_variant);
- ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
- _account_convert_column_to_account(hstmt, account_record);
- account_list = g_list_append(account_list, account_record);
- rc = _account_query_step(hstmt);
- k++;
+ if (account_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {_account_glist_free(account_list);}, rc, ("finalize error"));
- hstmt = NULL;
+ GSList* iter;
- GList* iter;
- k = 0;
- for (iter = account_list; iter != NULL; iter = g_list_next(iter)) {
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
account_s *account = NULL;
account = (account_s*)iter->data;
- account_query_capability_by_account_id(_account_get_capability_text_cb, account->id, (void*)account);
- _account_query_custom_by_account_id(_account_get_custom_text_cb, account->id, (void*)account);
- callback((account_h)account, user_data);
- k++;
- }
-
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
- if (account_list) {
- _account_glist_free(account_list);
- account_list = NULL;
- }
-
- return error_code;
-}
-
-ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- int count =1;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
+ if (callback((account_h)account, user_data) == false)
{
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
+ _INFO("application callback requested to discontinue.");
+ break;
}
- close(fd);
}
+ _INFO("account_query_account_by_user_name end");
- ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- if ( ((int)sync_status < 0) || (sync_status > ACCOUNT_SYNC_MAX) ) {
- ACCOUNT_SLOGE("(%s)-(%d) sync_status is less than 0 or more than enum max.\n", __FUNCTION__, __LINE__);
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- pthread_mutex_lock(&account_mutex);
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_db_id);
-
- rc = _account_get_record_count(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (rc <= 0) {
- ACCOUNT_SLOGE( "account_update_sync_status_by_id : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET sync_support=? WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
- hstmt = _account_prepare_query(query);
-
- _account_query_bind_int(hstmt, count, (int)sync_status);
-
- rc = _account_query_step(hstmt);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_DB_FAILED,
- ("account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg()));
-
- rc = _account_query_finalize(hstmt);
- if (rc != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("_account_query_finalize error");
- pthread_mutex_unlock(&account_mutex);
- return rc;
- }
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_SYNC_UPDATE, account_db_id);
- _account_insert_delete_update_notification_send(buf);
-
- hstmt = NULL;
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
+ _account_gslist_account_free(account_list);
+ return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h *account)
+ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ _INFO("account_query_account_by_package_name starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
- ACCOUNT_RETURN_VAL((*account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ GVariant* account_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, account_db_path, package_name, e_cookie, &account_list_variant, NULL, &error);
- account_s *account_record = (account_s *)(*account);
+ _DESTROY_COOKIE
- while (rc == SQLITE_ROW) {
- _account_convert_column_to_account(hstmt, account_record);
- rc = _account_query_step(hstmt);
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ return error_code;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ GSList* account_list = unmarshal_account_list(account_list_variant);
+ g_variant_unref(account_list_variant);
- account_query_capability_by_account_id(_account_get_capability_text_cb, account_record->id, (void*)account_record);
- _account_query_custom_by_account_id(_account_get_custom_text_cb, account_record->id, (void*)account_record);
-
- hstmt = NULL;
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
+ if (account_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- pthread_mutex_unlock(&account_mutex);
- return error_code;
-}
+ GSList* iter;
-ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const char *user_name, void *user_data)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
+ account_s *account = NULL;
+ account = (account_s*)iter->data;
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
+ if (callback((account_h)account, user_data) == false)
{
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = ?", ACCOUNT_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- int binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, user_name);
-
- rc = _account_query_step(hstmt);
-
- account_s *account_head = NULL;
-
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- int tmp = 0;
-
- account_head = (account_s*) malloc(sizeof(account_s));
- if (account_head == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
- return ACCOUNT_ERROR_OUT_OF_MEMORY;
- }
- ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
-
- while (rc == SQLITE_ROW) {
- account_s* account_record = NULL;
-
- account_record = (account_s*) malloc(sizeof(account_s));
-
- if (account_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
+ _INFO("application callback requested to discontinue.");
break;
}
- ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
-
- _account_convert_column_to_account(hstmt, account_record);
-
- account_head->account_list = g_list_append(account_head->account_list, account_record);
-
- rc = _account_query_step(hstmt);
- tmp++;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GList *iter;
-
-
- tmp = g_list_length(account_head->account_list);
-
- for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
- account_h account;
- account = (account_h)iter->data;
-
- account_s *testaccount = (account_s*)account;
-
- account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
- _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
-
- ACCOUNT_CATCH_ERROR(callback(account, user_data) == TRUE, {}, ACCOUNT_ERROR_NONE, ("callback returns false, it is stopped.\n"));
- }
-
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (account_head) {
- if (account_head->account_list) {
- _account_glist_free(account_head->account_list);
- account_head->account_list = NULL;
- _account_free_account_items(account_head);
- }
- _ACCOUNT_FREE(account_head);
}
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
+ _account_gslist_account_free(account_list);
+ _INFO("account_query_account_by_package_name end");
+ return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void* user_data)
+ACCOUNT_API int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_query_account_by_capability starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type IS NULL"));
- if (((int)capability_value < 0) || (capability_value > ACCOUNT_CAPABILITY_STATE_MAX)) {
+ if (((int)capability_value < 0) || (capability_value > ACCOUNT_CAPABILITY_ENABLED)) {
ACCOUNT_SLOGE("(%s)-(%d) capability_value is not equal to 0 or 1.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id IN (SELECT account_id from %s WHERE key=? AND value=?)", ACCOUNT_TABLE, CAPABILITY_TABLE);
+ GError *error = NULL;
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- int binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, capability_type);
- _account_query_bind_int(hstmt, binding_count++, (int)capability_value);
-
- rc = _account_query_step(hstmt);
-
- account_s* account_head = NULL;
-
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- int tmp = 0;
-
- account_head = (account_s*) malloc(sizeof(account_s));
- if (account_head == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
- return ACCOUNT_ERROR_OUT_OF_MEMORY;
- }
- ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
-
- while (rc == SQLITE_ROW) {
- account_s* account_record = NULL;
-
- account_record = (account_s*) malloc(sizeof(account_s));
-
- if (account_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
- ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
-
- _account_convert_column_to_account(hstmt, account_record);
+ GVariant* account_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_account_by_capability_sync(acc_mgr, account_db_path, capability_type, capability_value, e_cookie, &account_list_variant, NULL, &error);
- account_head->account_list = g_list_append(account_head->account_list, account_record);
+ _DESTROY_COOKIE
- rc = _account_query_step(hstmt);
- tmp++;
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ return error_code;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GList *iter;
+ GSList* account_list = unmarshal_account_list(account_list_variant);
+ g_variant_unref(account_list_variant);
-
- tmp = g_list_length(account_head->account_list);
-
- for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
- account_h account = NULL;
- account = (account_h)iter->data;
- account_s* testaccount = (account_s*)account;
-
- account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
- _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
-
- ACCOUNT_CATCH_ERROR(callback(account, user_data) == TRUE, {}, ACCOUNT_ERROR_NONE, ("callback returns false, it is stopped.\n"));
+ if (account_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
+ GSList* iter;
- error_code = ACCOUNT_ERROR_NONE;
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
+ account_s *account = NULL;
+ account = (account_s*)iter->data;
-CATCH:
- if (account_head) {
- if (account_head->account_list) {
- _account_glist_free(account_head->account_list);
- account_head->account_list = NULL;
- _account_free_account_items(account_head);
+ if (callback((account_h)account, user_data) == false)
+ {
+ _INFO("application callback requested to discontinue.");
+ break;
}
- _ACCOUNT_FREE(account_head);
}
-
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
+ _account_gslist_account_free(account_list);
+ _INFO("account_query_account_by_capability end");
+ return ACCOUNT_ERROR_NONE;
}
ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_query_account_by_capability_type starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type IS NULL"));
ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id IN (SELECT account_id from %s WHERE key=?)", ACCOUNT_TABLE, CAPABILITY_TABLE);
+ _GET_COOKIE
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- int binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, capability_type);
-
- rc = _account_query_step(hstmt);
-
- account_s* account_head = NULL;
+ GVariant* account_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_account_by_capability_type_sync(acc_mgr, account_db_path, capability_type, e_cookie, &account_list_variant, NULL, &error);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ _DESTROY_COOKIE
- int tmp = 0;
-
- account_head = (account_s*) malloc(sizeof(account_s));
- if (account_head == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
- return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ return error_code;
}
- ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
- while (rc == SQLITE_ROW) {
- account_s* account_record = NULL;
+ GSList* account_list = unmarshal_account_list(account_list_variant);
+ g_variant_unref(account_list_variant);
- account_record = (account_s*) malloc(sizeof(account_s));
-
- if (account_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
- ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
-
- _account_convert_column_to_account(hstmt, account_record);
-
- account_head->account_list = g_list_append(account_head->account_list, account_record);
-
- rc = _account_query_step(hstmt);
- tmp++;
+ if (account_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GList *iter;
-
-
- tmp = g_list_length(account_head->account_list);
-
- for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
- account_h account = NULL;
- account = (account_h)iter->data;
- account_s* testaccount = (account_s*)account;
-
- account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
- _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
-
- ACCOUNT_CATCH_ERROR(callback(account, user_data) == TRUE, {}, ACCOUNT_ERROR_NONE, ("The record isn't found.\n"));
-
- }
+ GSList* iter;
- error_code = ACCOUNT_ERROR_NONE;
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
+ account_s *account = NULL;
+ account = (account_s*)iter->data;
-CATCH:
- if (account_head) {
- if (account_head->account_list) {
- _account_glist_free(account_head->account_list);
- account_head->account_list = NULL;
- _account_free_account_items(account_head);
+ if (callback((account_h)account, user_data) == false)
+ {
+ _INFO("application callback requested to discontinue.");
+ break;
}
- _ACCOUNT_FREE(account_head);
- }
-
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
}
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
+ _account_gslist_account_free(account_list);
+ _INFO("account_query_account_by_capability end");
+ return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const char* package_name, void* user_data)
+ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, int account_id, void *user_data)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ _INFO("account_query_capability_by_account_id starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE package_name=?", ACCOUNT_TABLE);
+ ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
- hstmt = _account_prepare_query(query);
+ _GET_COOKIE
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ GError *error = NULL;
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- int binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, package_name);
-
- rc = _account_query_step(hstmt);
-
- account_s* account_head = NULL;
-
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.(%s)\n", package_name));
-
- int tmp = 0;
-
- account_head = (account_s*) malloc(sizeof(account_s));
- if (account_head == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
- return ACCOUNT_ERROR_OUT_OF_MEMORY;
- }
- ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
-
- while (rc == SQLITE_ROW) {
- account_s* account_record = NULL;
-
- account_record = (account_s*) malloc(sizeof(account_s));
+ GVariant* capability_list_variant = NULL;
+ bool is_success = account_manager_call_account_query_capability_by_account_id_sync(acc_mgr, account_db_path, account_id, e_cookie, &capability_list_variant, NULL, &error);
- if (account_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
- ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
-
- _account_convert_column_to_account(hstmt, account_record);
+ _DESTROY_COOKIE
- account_head->account_list = g_list_append(account_head->account_list, account_record);
-
- rc = _account_query_step(hstmt);
- tmp++;
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ return error_code;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GList *iter;
-
- tmp = g_list_length(account_head->account_list);
-
- for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
- account_h account = NULL;
- account = (account_h)iter->data;
-
- account_s* testaccount = (account_s*)account;
-
- account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
- _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
-
- ACCOUNT_CATCH_ERROR(callback(account, user_data) == TRUE, {}, ACCOUNT_ERROR_NONE, ("The record isn't found.\n"));
-
+ _INFO("before unmarshal_capability_list");
+ GSList* capability_list = unmarshal_capability_list(capability_list_variant);
+ _INFO("after unmarshal_capability_list");
+ if (capability_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- error_code = ACCOUNT_ERROR_NONE;
+ GSList* iter;
-CATCH:
- if (account_head) {
- if (account_head->account_list) {
- _account_glist_free(account_head->account_list);
- account_head->account_list = NULL;
- _account_free_account_items(account_head);
+ for (iter = capability_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
+ account_capability_s *capability = NULL;
+ capability = (account_capability_s*)iter->data;
+ _INFO("");
+ if (callback(capability->type, capability->value, user_data) == false)
+ {
+ _INFO("application callback requested to discontinue.");
+ break;
}
- _ACCOUNT_FREE(account_head);
+ _INFO("");
}
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
+ _account_gslist_capability_free(capability_list);
+ _INFO("account_query_capability_by_account_id end");
+ return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_delete(int account_id)
+static int _account_get_total_count(int *count, bool include_hidden)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- int ret_transaction = 0;
- bool is_success = FALSE;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- int count = -1;
- /* Check requested ID to delete */
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id=%d", ACCOUNT_TABLE, account_id);
+ _INFO("account_get_total_count_from_db starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
- count = _account_get_record_count(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (count <= 0) {
- ACCOUNT_ERROR("account id(%d) is not exist. count(%d)\n", account_id, count);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- /* Check permission of requested appid */
- char* current_appid = NULL;
- char *package_name = NULL;
-
- current_appid = _account_get_current_appid();
-
- error_code = _account_get_package_name_from_account_id(account_id, &package_name);
-
- if(error_code != ACCOUNT_ERROR_NONE){
- ACCOUNT_ERROR("No package name with account_id\n");
- _ACCOUNT_FREE(current_appid);
- _ACCOUNT_FREE(package_name);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
- ACCOUNT_DEBUG( "DELETE:account_id[%d],current_appid[%s]package_name[%s]", account_id, current_appid, package_name);
-
- error_code = _account_check_appid_group_with_package_name(current_appid, package_name);
-
- _ACCOUNT_FREE(current_appid);
- _ACCOUNT_FREE(package_name);
-
- if(error_code != ACCOUNT_ERROR_NONE){
- ACCOUNT_ERROR("No permission to delete\n");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
-
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
+ if (!count)
+ {
+ ACCOUNT_SLOGE("(%s)-(%d) count is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
+ GError *error = NULL;
- if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ret_transaction;
+ if (count == NULL)
+ {
+ _INFO("Invalid input");
+ return -1;
}
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE account_id = %d", CAPABILITY_TABLE, account_id);
+ _GET_COOKIE
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- rc = _account_query_finalize(hstmt);
-
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
-
- hstmt = _account_prepare_query(query);
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. id=%d, rc=%d\n", account_id, rc));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /* delete custom data */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AccountId = %d", ACCOUNT_CUSTOM_TABLE, account_id);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. id=%d, rc=%d\n", account_id, rc));
+ int temp_count = -1;
+ bool is_success = account_manager_call_account_get_total_count_from_db_sync(acc_mgr, account_db_path, include_hidden, e_cookie, &temp_count, NULL, &error);
- rc = _account_query_finalize(hstmt);
- ACCOUNT_CATCH_ERROR(rc == ACCOUNT_ERROR_NONE, {}, rc, ("finalize error", account_id, rc));
- hstmt = NULL;
+ _DESTROY_COOKIE
- is_success = TRUE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- if(rc != ACCOUNT_ERROR_NONE ){
- ACCOUNT_ERROR("rc (%d)", rc);
- is_success = FALSE;
- }
-
- hstmt = NULL;
- }
-
- ret_transaction = _account_end_transaction(is_success);
-
- if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_delete:_account_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
- } else {
- if (is_success == true) {
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_DELETE, account_id);
- _account_insert_delete_update_notification_send(buf);
- }
+ int error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ if (error_code != ACCOUNT_ERROR_NONE)
+ {
+ return error_code;
}
- pthread_mutex_unlock(&account_mutex);
-
- return error_code;
-
+ *count = temp_count;
+ _INFO("account_get_total_count_from_db end");
+ return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_delete_from_db_by_id(int account_db_id)
+ACCOUNT_API int account_get_total_count_from_db(int *count)
{
- ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID IS LESS THAN ZERO."));
+ _INFO("account_get_total_count_from_db starting");
- return account_delete(account_db_id);
+ return _account_get_total_count(count, true);
}
-static int _account_query_account_by_username_and_package(const char* username, const char* package_name, account_h *account)
+ACCOUNT_INTERNAL_API int account_get_total_count_from_db_ex(int *count)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- int binding_count = 1;
-
- ACCOUNT_RETURN_VAL((username != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("username IS NULL"));
- ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name IS NULL"));
- ACCOUNT_RETURN_VAL((*account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _INFO("account_get_total_count_from_db_ex starting");
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = ? and package_name = ?", ACCOUNT_TABLE);
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- _account_query_bind_text(hstmt, binding_count++, username);
- _account_query_bind_text(hstmt, binding_count++, package_name);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- account_s *account_record = (account_s *)(*account);
-
- while (rc == SQLITE_ROW) {
- _account_convert_column_to_account(hstmt, account_record);
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- account_query_capability_by_account_id(_account_get_capability_text_cb, account_record->id, (void*)account_record);
- _account_query_custom_by_account_id(_account_get_custom_text_cb, account_record->id, (void*)account_record);
-
- hstmt = NULL;
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
+ return _account_get_total_count(count, false);
}
-ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *package_name)
+ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- int ret_transaction = 0;
- bool is_success = FALSE;
- account_h account = NULL;
- int binding_count = 1;
- int account_id = -1;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is null!"));
- ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- rc = account_create(&account);
- rc = _account_query_account_by_username_and_package(user_name, package_name, &account);
-
-
- if( _account_db_err_code() == SQLITE_PERM ){
- account_destroy(account);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- rc = account_get_account_id(account, &account_id);
-
- rc = account_destroy(account);
-
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ _INFO("account_update_sync_status_by_id starting");
+ int error_code = ACCOUNT_ERROR_NONE;
+ char* account_db_path = ACCOUNT_DB_NAME;
- if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }else if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ret_transaction;
+ ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
+ if ( ((int)sync_status < 0) || (sync_status > ACCOUNT_SYNC_STATUS_RUNNING)) {
+ ACCOUNT_SLOGE("(%s)-(%d) sync_status is less than 0 or more than enum max.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- /* delete custom data */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AccountId = ?", ACCOUNT_CUSTOM_TABLE);
+ _GET_COOKIE
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- _account_end_transaction(FALSE);
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- _account_query_bind_int(hstmt, binding_count++, account_id);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /* delete capability */
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE user_name = ? and package_name = ?", CAPABILITY_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, user_name);
- _account_query_bind_text(hstmt, binding_count++, package_name);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE user_name = ? and package_name = ?", ACCOUNT_TABLE);
-
- hstmt = _account_prepare_query(query);
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, user_name);
- _account_query_bind_text(hstmt, binding_count++, package_name);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. user_name=%s, package_name=%s, rc=%d\n", user_name, package_name, rc));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- is_success = TRUE;
-
- hstmt = NULL;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- ret_transaction = _account_end_transaction(is_success);
+ bool is_success = account_manager_call_account_update_sync_status_by_id_sync(acc_mgr, account_db_path, account_db_id, sync_status, e_cookie, NULL, &error);
- if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
- } else {
- if (is_success == true) {
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%d", ACCOUNT_NOTI_NAME_DELETE, account_id);
- _account_insert_delete_update_notification_send(buf);
- }
- }
+ _DESTROY_COOKIE
- pthread_mutex_unlock(&account_mutex);
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
return error_code;
}
-static bool _account_delete_from_db_by_package_name_cb(account_h account, void *user_data)
-{
- GSList **account_id_list = (GSList**)user_data;
- int account_id = 0;
- char id_buf[10] ={0,};
- char* tmp_ptr = NULL;
-
- account_get_account_id(account, &account_id);
- ACCOUNT_SNPRINTF(id_buf, sizeof(id_buf), "%d", account_id);
-
- tmp_ptr = strdup(id_buf);
-
- ACCOUNT_SLOGD("id = %s", id_buf);
-
- *account_id_list = g_slist_append(*account_id_list, tmp_ptr);
-
- return TRUE;
-}
-
-ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name)
+/*
+static int _account_type_free_label_items(label_s *data)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- int ret_transaction = 0;
- bool is_success = FALSE;
- int binding_count = 1;
- GSList *account_id_list = NULL;
- int ret = -1;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ret = account_query_account_by_package_name(_account_delete_from_db_by_package_name_cb, package_name, (void*)&account_id_list);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if(ret != ACCOUNT_ERROR_NONE){
- return ret;
- }
-
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
-
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }else if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ret_transaction;
- }
-
- /* delete custom table */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ?", ACCOUNT_CUSTOM_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- _account_end_transaction(FALSE);
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
+ if(!data) {
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, package_name);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /* delete capability table */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name = ?", CAPABILITY_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, package_name);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /* delete account table */
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name = ?", ACCOUNT_TABLE);
-
- hstmt = _account_prepare_query(query);
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+ _ACCOUNT_FREE(data->app_id);
+ _ACCOUNT_FREE(data->label);
+ _ACCOUNT_FREE(data->locale);
- binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, package_name);
+ return ACCOUNT_ERROR_NONE;
+}
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. package_name=%s, rc=%d\n", package_name, rc));
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- is_success = TRUE;
+static int _account_type_label_gslist_free(GSList* list)
+{
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
- hstmt = NULL;
+ GSList* iter;
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- ret_transaction = _account_end_transaction(is_success);
-
- if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_delete:_account_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
- } else {
- if (is_success == true) {
- GSList* iter;
- for (iter = account_id_list; iter != NULL; iter = g_slist_next(iter)) {
- char* p_tmpid = NULL;
- p_tmpid = (char*)iter->data;
- char buf[64]={0,};
- ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%s", ACCOUNT_NOTI_NAME_DELETE, p_tmpid);
- ACCOUNT_SLOGD("%s", buf);
- _account_insert_delete_update_notification_send(buf);
- _ACCOUNT_FREE(p_tmpid);
- }
- g_slist_free(account_id_list);
- }
+ for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
+ label_s *label_data = (label_s*)iter->data;
+ _account_type_free_label_items(label_data);
+ _ACCOUNT_FREE(label_data);
}
- pthread_mutex_unlock(&account_mutex);
+ g_slist_free(list);
+ list = NULL;
- return error_code;
+ return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_get_total_count_from_db(int *count)
-{
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- if (!count) {
- ACCOUNT_SLOGE("(%s)-(%d) count is NULL.\n", __FUNCTION__, __LINE__);
+static int _account_type_free_provider_feature_items(provider_feature_s *data)
+{
+ if(!data) {
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- if(!g_hAccountDB){
- ACCOUNT_ERROR("DB is not opened\n");
- return ACCOUNT_ERROR_DB_NOT_OPENED;
- }
-
- char query[1024] = {0, };
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s", ACCOUNT_TABLE);
+ _ACCOUNT_FREE(data->key);
+ _ACCOUNT_FREE(data->app_id);
- *count = _account_get_record_count(query);
+ return ACCOUNT_ERROR_NONE;
+}
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- int rc = -1;
- int ncount = 0;
- account_stmt pStmt = NULL;
+static int _account_type_provider_feature_gslist_free(GSList* list)
+{
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
- rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
- if (SQLITE_OK != rc) {
- ACCOUNT_SLOGE("sqlite3_prepare_v2() failed(%d, %s).", rc, _account_db_err_msg());
- sqlite3_finalize(pStmt);
- return ACCOUNT_ERROR_DB_FAILED;
- }
+ GSList* iter;
- rc = sqlite3_step(pStmt);
- if (SQLITE_ROW != rc) {
- ACCOUNT_ERROR("[ERROR] sqlite3_step() failed\n");
- sqlite3_finalize(pStmt);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
+ provider_feature_s *feature_data = (provider_feature_s*)iter->data;
+ _account_type_free_provider_feature_items(feature_data);
+ _ACCOUNT_FREE(feature_data);
}
- ncount = sqlite3_column_int(pStmt, 0);
-
- *count = ncount;
-
- sqlite3_finalize(pStmt);
-
- if (ncount < 0) {
- ACCOUNT_ERROR("[ERROR] Number of account : %d, End", ncount);
- return ACCOUNT_ERROR_DB_FAILED;
- }
+ g_slist_free(list);
+ list = NULL;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_destroy(account_h account)
-{
- account_s *data = (account_s*)account;
-
- ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account handle is null!"));
- _account_free_account_items(data);
- _ACCOUNT_FREE(data);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_free_label_items(label_s *data)
+static int _account_type_free_account_type_items(account_type_s *data)
{
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->label);
- _ACCOUNT_FREE(data->locale);
-
- return ACCOUNT_ERROR_NONE;
-}
+ if(!data) {
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
-static int _account_type_free_feature_items(provider_feature_s *data)
-{
_ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->key);
+ _ACCOUNT_FREE(data->service_provider_id);
+ _ACCOUNT_FREE(data->icon_path);
+ _ACCOUNT_FREE(data->small_icon_path);
+
+ _account_type_label_gslist_free(data->label_list);
+ _account_type_provider_feature_gslist_free(data->provider_feature_list);
+// _account_type_glist_free(data->account_type_list);
return ACCOUNT_ERROR_NONE;
}
static int _account_type_gslist_free(GSList* list)
{
- ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Glist is NULL"));
GSList* iter;
for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- label_s *label_data = (label_s*)iter->data;
- _account_type_free_label_items(label_data);
- _ACCOUNT_FREE(label_data);
+ account_type_s *account_type_record = (account_type_s*)iter->data;
+ _account_type_free_account_type_items(account_type_record);
+ _ACCOUNT_FREE(account_type_record);
}
g_slist_free(list);
@@ -4901,17 +1941,9 @@ static int _account_type_gslist_free(GSList* list)
return ACCOUNT_ERROR_NONE;
}
+*/
-static int _account_type_item_free(account_type_s *data)
-{
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->service_provider_id);
- _ACCOUNT_FREE(data->icon_path);
- _ACCOUNT_FREE(data->small_icon_path);
-
- return ACCOUNT_ERROR_NONE;
-}
-
+/*
static int _account_type_glist_free(GList* list)
{
ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Glist is NULL"));
@@ -4920,7 +1952,7 @@ static int _account_type_glist_free(GList* list)
for (iter = list; iter != NULL; iter = g_list_next(iter)) {
account_type_s *account_type_record = (account_type_s*)iter->data;
- _account_type_item_free(account_type_record);
+ _account_type_free_account_type_items(account_type_record);
_ACCOUNT_FREE(account_type_record);
}
@@ -4929,16 +1961,7 @@ static int _account_type_glist_free(GList* list)
return ACCOUNT_ERROR_NONE;
}
-
-static int _account_type_free_account_type_items(account_type_s *data)
-{
- _account_type_item_free(data);
-
- _account_type_gslist_free(data->label_list);
- _account_type_glist_free(data->account_type_list);
-
- return ACCOUNT_ERROR_NONE;
-}
+*/
ACCOUNT_API int account_type_create(account_type_h *account_type)
{
@@ -4949,13 +1972,24 @@ ACCOUNT_API int account_type_create(account_type_h *account_type)
account_type_s *data = (account_type_s*)malloc(sizeof(account_type_s));
- if (data == NULL) {
+ if (data == NULL)
+ {
ACCOUNT_ERROR("Memory Allocation Failed");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
}
ACCOUNT_MEMSET(data, 0, sizeof(account_type_s));
+ data->id = -1;
+ data->app_id = NULL;
+ data->service_provider_id = NULL;
+ data->icon_path = NULL;
+ data->small_icon_path = NULL;
+ data->multiple_account_support = false;
+ data->label_list = NULL;
+// data->account_type_list = NULL;
+ data->provider_feature_list = NULL;
+
*account_type = (account_type_h)data;
return ACCOUNT_ERROR_NONE;
@@ -4963,18 +1997,22 @@ ACCOUNT_API int account_type_create(account_type_h *account_type)
ACCOUNT_API int account_type_destroy(account_type_h account_type)
{
+ _INFO("account_type_destroy");
+
account_type_s *data = (account_type_s*)account_type;
- ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account type handle is null!"));
+ if (data == NULL)
+ {
+ _ERR("Account type handle is null!");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
- _account_type_free_account_type_items(data);
- _ACCOUNT_FREE(data);
+ _account_type_free_account_type_with_items(data);
return ACCOUNT_ERROR_NONE;
}
-//app_id mandatory field
-ACCOUNT_API int account_type_set_app_id(account_type_h account_type, const char *app_id)
+ACCOUNT_INTERNAL_API int account_type_set_app_id(account_type_h account_type, const char *app_id)
{
if (!account_type) {
ACCOUNT_SLOGE("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
@@ -4994,8 +2032,7 @@ ACCOUNT_API int account_type_set_app_id(account_type_h account_type, const char
return ACCOUNT_ERROR_NONE;
}
-//service_provider_id mandatory field
-ACCOUNT_API int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id)
+ACCOUNT_INTERNAL_API int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id)
{
if (!account_type) {
return ACCOUNT_ERROR_INVALID_PARAMETER;
@@ -5013,7 +2050,7 @@ ACCOUNT_API int account_type_set_service_provider_id(account_type_h account_type
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_set_icon_path(account_type_h account_type, const char *icon_path)
+ACCOUNT_INTERNAL_API int account_type_set_icon_path(account_type_h account_type, const char *icon_path)
{
if (!account_type) {
return ACCOUNT_ERROR_INVALID_PARAMETER;
@@ -5031,7 +2068,7 @@ ACCOUNT_API int account_type_set_icon_path(account_type_h account_type, const ch
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path)
+ACCOUNT_INTERNAL_API int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path)
{
if (!account_type) {
return ACCOUNT_ERROR_INVALID_PARAMETER;
@@ -5049,7 +2086,7 @@ ACCOUNT_API int account_type_set_small_icon_path(account_type_h account_type, co
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support)
+ACCOUNT_INTERNAL_API int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support)
{
ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
@@ -5060,8 +2097,7 @@ ACCOUNT_API int account_type_set_multiple_account_support(account_type_h account
return ACCOUNT_ERROR_NONE;
}
-// unset?
-ACCOUNT_API int account_type_set_label(account_type_h account_type, const char* label, const char* locale)
+ACCOUNT_INTERNAL_API int account_type_set_label(account_type_h account_type, const char* label, const char* locale)
{
if (!account_type) {
ACCOUNT_SLOGE("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
@@ -5088,6 +2124,145 @@ ACCOUNT_API int account_type_set_label(account_type_h account_type, const char*
return ACCOUNT_ERROR_NONE;
}
+ACCOUNT_INTERNAL_API int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature)
+{
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("account type handle is null"));
+ ACCOUNT_RETURN_VAL((provider_feature != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("provider_feature is null"));
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ GSList *iter = NULL;
+ bool b_is_new = TRUE;
+
+ for(iter = data->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
+ provider_feature_s *feature_data = NULL;
+ feature_data = (provider_feature_s*)iter->data;
+
+ if(!strcmp(feature_data->key, provider_feature)) {
+ b_is_new = FALSE;
+ break;
+ }
+ }
+
+ if(b_is_new) {
+ provider_feature_s* feature_data = (provider_feature_s*)malloc(sizeof(provider_feature_s));
+
+ if (feature_data == NULL)
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ ACCOUNT_MEMSET(feature_data, 0, sizeof(provider_feature_s));
+
+ feature_data->key = _account_get_text(provider_feature);
+ data->provider_feature_list = g_slist_append(data->provider_feature_list, (gpointer)feature_data);
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data )
+{
+ _INFO("account_type_query_provider_feature_by_app_id start");
+ char* account_db_path = ACCOUNT_DB_NAME;
+
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+
+ _GET_COOKIE
+
+ GError *error = NULL;
+ gint error_code = ACCOUNT_ERROR_NONE;
+
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ GVariant* feature_list_variant = NULL;
+ bool is_success = account_manager_call_account_type_query_provider_feature_by_app_id_sync(acc_mgr, account_db_path, app_id, e_cookie, &feature_list_variant, NULL, &error);
+ _INFO("account_manager_call_account_type_query_provider_feature_by_app_id_sync end=[%d]", is_success);
+
+ _DESTROY_COOKIE
+
+ if (!is_success)
+ {
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("Account IPC call returned error[%d]", error_code);
+ return error_code;
+ }
+ g_clear_error(&error);
+
+ GSList* provider_feature_list = variant_to_provider_feature_list(feature_list_variant);
+ if (provider_feature_list == NULL)
+ {
+ error_code = ACCOUNT_ERROR_NO_DATA;
+ _ERR("[%d]", error_code);
+ return error_code;
+ }
+
+ GSList *iter;
+ for (iter = provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
+ provider_feature_s *feature_data = NULL;
+
+ feature_data = (provider_feature_s*)iter->data;
+
+ if(callback(feature_data->app_id, feature_data->key, user_data)!=TRUE) {
+ ACCOUNT_DEBUG("Callback func returs FALSE, its iteration is stopped!!!!\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+ }
+
+ _account_type_gslist_feature_free(provider_feature_list);
+ _INFO("account_type_query_provider_feature_by_app_id end");
+ return error_code;
+}
+
+ACCOUNT_API bool account_type_query_supported_feature(const char* app_id, const char* capability)
+{
+ _INFO("account_type_query_supported_feature start");
+ char* account_db_path = ACCOUNT_DB_NAME;
+
+ if (app_id == NULL || capability == NULL)
+ {
+ set_last_result(ACCOUNT_ERROR_INVALID_PARAMETER);
+ return false;
+ }
+
+ _GET_COOKIE
+
+ int is_supported = 0;
+ GError *error = NULL;
+ gint ret = ACCOUNT_ERROR_NONE;
+
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
+ set_last_result(ACCOUNT_ERROR_PERMISSION_DENIED);
+ return false;
+ }
+
+ bool is_success = account_manager_call_account_type_query_supported_feature_sync(acc_mgr, account_db_path, app_id, capability, e_cookie, &is_supported, NULL, &error);
+ _INFO("account_manager_call_account_type_query_supported_feature_sync end=[%d]", is_success);
+
+ _DESTROY_COOKIE
+
+ if (!is_success)
+ {
+ ret = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
+ _ERR("Account IPC call returned error[%d]", ret);
+ set_last_result(ret);
+ return false;
+ }
+ g_clear_error(&error);
+
+ set_last_result(ACCOUNT_ERROR_NONE);
+ _INFO("account_type_query_supported_feature end");
+ return is_supported;
+}
+
ACCOUNT_API int account_type_get_app_id(account_type_h account_type, char **app_id)
{
if (!account_type) {
@@ -5176,6 +2351,28 @@ ACCOUNT_API int account_type_get_multiple_account_support(account_type_h account
return ACCOUNT_ERROR_NONE;
}
+ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data)
+{
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+
+ GSList *iter;
+ account_type_s *data = (account_type_s*)account_type;
+
+ for (iter = data->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
+ provider_feature_s *feature_data = NULL;
+
+ feature_data = (provider_feature_s*)iter->data;
+
+ if(callback(feature_data->app_id, feature_data->key, user_data)!=TRUE) {
+ ACCOUNT_DEBUG("Callback func returs FALSE, its iteration is stopped!!!!\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label)
{
ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
@@ -5197,9 +2394,9 @@ ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, co
}
gchar** tokens = g_strsplit(locale, "-", 2);
if(tokens != NULL) {
- if((char*)(tokens[1]) != NULL) {
- char* upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
- if(upper_token != NULL) {
+ if((char*)(tokens[1]) != NULL) {
+ char* upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
+ if(upper_token != NULL) {
char* converted_locale = g_strdup_printf("%s_%s", tokens[0], upper_token);
if(!strcmp(converted_locale, label_data->locale)) {
_ACCOUNT_FREE(converted_locale);
@@ -5241,1847 +2438,427 @@ ACCOUNT_API int account_type_get_label(account_type_h account_type, account_labe
return ACCOUNT_ERROR_NONE;
}
-static gboolean _account_type_check_duplicated(account_type_s *data)
-{
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int count = 0;
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId='%s'"
- , ACCOUNT_TYPE_TABLE, data->app_id);
-
- count = _account_get_record_count(query);
- if (count > 0) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int _account_type_convert_account_to_sql(account_type_s *account_type, account_stmt hstmt, char *sql_value)
-{
- int count = 1;
-
- /*Caution : Keep insert query orders.*/
-
- /* 1. app id*/
- _account_query_bind_text(hstmt, count++, (char*)account_type->app_id);
-
- /* 2. service provider id*/
- _account_query_bind_text(hstmt, count++, (char*)account_type->service_provider_id);
-
- /* 3. icon path*/
- _account_query_bind_text(hstmt, count++, (char*)account_type->icon_path);
-
- /* 4. small icon path*/
- _account_query_bind_text(hstmt, count++, (char*)account_type->small_icon_path);
-
- /* 5. multiple accont support*/
- _account_query_bind_int(hstmt, count++, account_type->multiple_account_support);
-
- return count;
-}
-
-
-static int _account_type_execute_insert_query(account_type_s *account_type)
-{
- int rc = 0;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
-
- /* check mandatory field */
- // app id & service provider id
- if (!account_type->app_id) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s( AppId, ServiceProviderId , IconPath , SmallIconPath , MultipleAccountSupport ) values "
- "(?, ?, ?, ?, ?)", ACCOUNT_TYPE_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if( _account_db_err_code() == SQLITE_BUSY ){
- ACCOUNT_ERROR( "Database Busy(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- _account_type_convert_account_to_sql(account_type, hstmt, query);
-
- rc = _account_query_step(hstmt);
- if (rc == SQLITE_BUSY) {
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- error_code = ACCOUNT_ERROR_DATABASE_BUSY;
- } else if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- error_code = ACCOUNT_ERROR_DB_FAILED;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- return error_code;
-}
-
-static int _account_type_insert_label(account_type_s *account_type)
-{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
-
- if (g_slist_length( account_type->label_list)==0) {
- ACCOUNT_ERROR( "_account_type_insert_label, no label\n");
- return ACCOUNT_ERROR_NONE;
- }
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where AppId = '%s'", ACCOUNT_TYPE_TABLE, account_type->app_id);
-
- rc = _account_get_record_count(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (rc <= 0) {
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- /* insert query*/
- GSList *iter;
-
- for (iter = account_type->label_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(AppId, Label, Locale) VALUES "
- "(?, ?, ?) ", LABEL_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- label_s* label_data = NULL;
- label_data = (label_s*)iter->data;
-
- ret = _account_query_bind_text(hstmt, count++, account_type->app_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, label_data->label);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)label_data->locale);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static void _account_type_convert_column_to_provider_feature(account_stmt hstmt, provider_feature_s *feature_record)
-{
- const char *textbuf = NULL;
-
- textbuf = _account_query_table_column_text(hstmt, PROVIDER_FEATURE_FIELD_APP_ID);
- _account_db_data_to_text(textbuf, &(feature_record->app_id));
-
- textbuf = _account_query_table_column_text(hstmt, PROVIDER_FEATURE_FIELD_KEY);
- _account_db_data_to_text(textbuf, &(feature_record->key));
-
-}
-
-ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data )
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE app_id = ?", PROVIDER_FEATURE_TABLE);
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- _account_query_bind_text(hstmt, binding_count++, app_id);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- provider_feature_s* feature_record = NULL;
-
- while (rc == SQLITE_ROW) {
- bool cb_ret = FALSE;
- feature_record = (provider_feature_s*) malloc(sizeof(provider_feature_s));
-
- if (feature_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
-
- ACCOUNT_MEMSET(feature_record, 0x00, sizeof(provider_feature_s));
-
- _account_type_convert_column_to_provider_feature(hstmt, feature_record);
-
- cb_ret = callback(feature_record->app_id, feature_record->key, user_data);
-
- _account_type_free_feature_items(feature_record);
- _ACCOUNT_FREE(feature_record);
-
- ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
-
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
-}
-
-ACCOUNT_API bool account_type_query_supported_feature(const char* app_id, const char* capability)
-{
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int record_count = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- set_last_result(ACCOUNT_ERROR_PERMISSION_DENIED);
- return false;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- set_last_result(ACCOUNT_ERROR_PERMISSION_DENIED);
- return false;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- set_last_result(ACCOUNT_ERROR_PERMISSION_DENIED);
- return false;
- }
- close(fd);
- }
-
- if (app_id == NULL || capability == NULL) {
- set_last_result(ACCOUNT_ERROR_INVALID_PARAMETER);
- return false;
- }
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s where app_id='%s' and key='%s'", PROVIDER_FEATURE_TABLE, app_id, capability);
-
- record_count = _account_get_record_count(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- set_last_result(ACCOUNT_ERROR_PERMISSION_DENIED);
- return false;
- }
-
- if (record_count <= 0) {
- set_last_result(ACCOUNT_ERROR_RECORD_NOT_FOUND);
- return false;
- }
-
- set_last_result(ACCOUNT_ERROR_NONE);
- return true;
-
-}
-
-
-ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data)
-{
- ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
-
- GSList *iter;
- account_type_s *data = (account_type_s*)account_type;
-
- for (iter = data->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
- provider_feature_s *feature_data = NULL;
-
- feature_data = (provider_feature_s*)iter->data;
-
- if(callback(feature_data->app_id, feature_data->key, user_data)!=TRUE) {
- ACCOUNT_DEBUG("Callback func returs FALSE, its iteration is stopped!!!!\n");
- return ACCOUNT_ERROR_NONE;
- }
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-ACCOUNT_API int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature)
-{
- ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("account type handle is null"));
- ACCOUNT_RETURN_VAL((provider_feature != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("provider_feature is null"));
-
- account_type_s *data = (account_type_s*)account_type;
-
- GSList *iter = NULL;
- bool b_is_new = TRUE;
-
- for(iter = data->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
- provider_feature_s *feature_data = NULL;
- feature_data = (provider_feature_s*)iter->data;
-
- if(!strcmp(feature_data->key, provider_feature)) {
- b_is_new = FALSE;
- break;
- }
- }
-
- if(b_is_new) {
- provider_feature_s* feature_data = (provider_feature_s*)malloc(sizeof(provider_feature_s));
-
- if (feature_data == NULL)
- return ACCOUNT_ERROR_OUT_OF_MEMORY;
- ACCOUNT_MEMSET(feature_data, 0, sizeof(provider_feature_s));
-
- feature_data->key = _account_get_text(provider_feature);
- data->provider_feature_list = g_slist_append(data->provider_feature_list, (gpointer)feature_data);
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_insert_provider_feature(account_type_s *account_type, const char* app_id)
+ACCOUNT_INTERNAL_API int account_type_insert_to_db(account_type_h account_type, int* account_type_id)
{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
- ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
-
- if (g_slist_length( account_type->provider_feature_list)==0) {
- ACCOUNT_ERROR( "no capability\n");
- return ACCOUNT_ERROR_NONE;
- }
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where AppId='%s'", ACCOUNT_TYPE_TABLE, app_id);
-
- rc = _account_get_record_count(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (rc <= 0) {
- ACCOUNT_SLOGI( "related account type item is not existed rc=%d , %s", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- /* insert query*/
-
- GSList *iter;
-
- for (iter = account_type->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(app_id, key) VALUES "
- "(?, ?) ", PROVIDER_FEATURE_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- provider_feature_s* feature_data = NULL;
- feature_data = (provider_feature_s*)iter->data;
-
- ret = _account_query_bind_text(hstmt, count++, app_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, feature_data->key);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- }
+ _INFO("account_type_insert_to_db starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
- return ACCOUNT_ERROR_NONE;
-}
-
-ACCOUNT_API int account_type_insert_to_db(account_type_h account_type, int* account_type_id)
-{
- int error_code = ACCOUNT_ERROR_NONE, ret_transaction = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE HANDLE IS NULL"));
ACCOUNT_RETURN_VAL((account_type_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE ID POINTER IS NULL"));
- account_type_s *data = (account_type_s*)account_type;
-
- pthread_mutex_lock(&account_mutex);
-
+ _GET_COOKIE
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- pthread_mutex_unlock(&account_mutex);
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- } else if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("_account_begin_transaction fail %d\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ret_transaction;
- }
-
- if (_account_type_check_duplicated(data)) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("Duplicated, rollback insert query(%x)!!!!\n", ret_transaction);
- *account_type_id = -1;
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DUPLICATED;
- } else {
- *account_type_id = _account_get_next_sequence(ACCOUNT_TYPE_TABLE);
-
- error_code = _account_type_execute_insert_query(data);
-
- if (error_code != ACCOUNT_ERROR_NONE){
- error_code = ACCOUNT_ERROR_DUPLICATED;
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("Insert fail, rollback insert query(%x)!!!!\n", ret_transaction);
- *account_type_id = -1;
- pthread_mutex_unlock(&account_mutex);
- return error_code;
- }
- }
-
- error_code = _account_type_insert_provider_feature(data, data->app_id);
- if(error_code != ACCOUNT_ERROR_NONE) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("Insert provider feature fail(%x), rollback insert query(%x)!!!!\n", error_code, ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return error_code;
- }
- error_code = _account_type_insert_label(data);
- if(error_code != ACCOUNT_ERROR_NONE) {
- ret_transaction = _account_end_transaction(FALSE);
- ACCOUNT_ERROR("Insert label fail(%x), rollback insert query(%x)!!!!\n", error_code, ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return error_code;
- }
+ int db_id = -1;
+ GVariant* account_type_serialized = marshal_account_type((account_type_s*) account_type);
+ bool is_success = account_manager_call_account_type_add_sync(acc_mgr, account_db_path, account_type_serialized, e_cookie, &db_id, NULL, &error);
- ret_transaction = _account_end_transaction(TRUE);
+ _DESTROY_COOKIE
- pthread_mutex_unlock(&account_mutex);
+ int ret = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_update_provider_feature(account_type_s *account_type, const char* app_id)
-{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
-
- if (g_slist_length( account_type->provider_feature_list)==0) {
- ACCOUNT_ERROR( "no feature\n");
- return ACCOUNT_ERROR_NONE;
- }
-
- ACCOUNT_DEBUG( "app id", app_id);
-
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE app_id=? ", PROVIDER_FEATURE_TABLE);
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- count = 1;
- _account_query_bind_text(hstmt, count++, app_id);
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_DB_FAILED;
+ if (ret != ACCOUNT_ERROR_NONE)
+ {
+ return ret;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GSList *iter;
- for (iter = account_type->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(app_id, key) VALUES "
- "(?, ?) ", PROVIDER_FEATURE_TABLE);
+ _INFO("account_type_insert_to_db end id=[%d]", db_id);
- hstmt = _account_prepare_query(query);
+ *account_type_id = db_id;
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- provider_feature_s* feature_data = NULL;
- feature_data = (provider_feature_s*)iter->data;
-
- ret = _account_query_bind_text(hstmt, count++, account_type->app_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, feature_data->key);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
+ account_type_s* account_type_data = (account_type_s*)account_type;
+ account_type_data->id = db_id;
return ACCOUNT_ERROR_NONE;
}
-static int _account_type_update_label(account_type_s *account_type, const char* app_id)
+ACCOUNT_INTERNAL_API int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id)
{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ _INFO("account_type_update_to_db_by_app_id starting");
+ int error_code = ACCOUNT_ERROR_NONE;
+ char* account_db_path = ACCOUNT_DB_NAME;
- if (g_slist_length( account_type->label_list)==0) {
- return ACCOUNT_ERROR_NONE;
- }
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId=? ", LABEL_TABLE);
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- count = 1;
- _account_query_bind_text(hstmt, count++, app_id);
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_DB_FAILED;
- }
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GSList *iter;
-
- for (iter = account_type->label_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(AppId, Label, Locale) VALUES "
- "(?, ?, ?) ", LABEL_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- label_s* label_data = NULL;
- label_data = (label_s*)iter->data;
-
- ret = _account_query_bind_text(hstmt, count++, account_type->app_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, label_data->label);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, label_data->locale);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- return ACCOUNT_ERROR_NONE;
-}
-
-
-static int _account_type_update_account(account_type_s *account_type, const char* app_id)
-{
- int rc = 0, binding_count =1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
-
- if (!account_type->app_id) {
- ACCOUNT_ERROR("app id is mandetory field, it can not be NULL!!!!\n");
+ GVariant* account_type_variant = marshal_account_type((account_type_s*) account_type);
+ if (account_type_variant == NULL)
+ {
+ _ERR("Failed to serialize");
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET AppId=?, ServiceProviderId=?, IconPath=?, "
- "SmallIconPath=?, MultipleAccountSupport=? WHERE AppId=? ", ACCOUNT_TYPE_TABLE);
+ bool is_success = account_manager_call_account_type_update_to_db_by_app_id_sync(acc_mgr, account_db_path, account_type_variant, app_id, e_cookie, NULL, &error);
- hstmt = _account_prepare_query(query);
+ _DESTROY_COOKIE
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if (_account_db_err_code() == SQLITE_BUSY){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s).\n", _account_db_err_msg()));
-
- binding_count = _account_type_convert_account_to_sql(account_type, hstmt, query);
- _account_query_bind_text(hstmt, binding_count++, app_id);
-
- rc = _account_query_step(hstmt);
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- /*update label*/
- error_code = _account_type_update_label(account_type, app_id);
- /* update provider feature */
- error_code = _account_type_update_provider_feature(account_type, app_id);
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
return error_code;
}
-ACCOUNT_API int account_type_update_to_db_by_app_id(account_type_h account_type, const char* app_id)
+ACCOUNT_INTERNAL_API int account_type_delete_by_app_id(const char* app_id)
{
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_type_delete_by_app_id starting");
+ int error_code = ACCOUNT_ERROR_NONE;
+ char* account_db_path = ACCOUNT_DB_NAME;
- ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- int error_code = ACCOUNT_ERROR_NONE;
- account_type_s* data = (account_type_s*)account_type;
-
- pthread_mutex_lock(&account_mutex);
-
- error_code = _account_type_update_account(data, app_id);
-
- pthread_mutex_unlock(&account_mutex);
-
- return error_code;
-}
-
-ACCOUNT_API int account_type_delete_by_app_id(const char* app_id)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, count = -1;
- int ret_transaction = 0;
- int binding_count = 1;
- bool is_success = FALSE;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("The database isn't connected."));
- /* Check requested ID to delete */
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId = '%s'", ACCOUNT_TYPE_TABLE, app_id);
+ _GET_COOKIE
- count = _account_get_record_count(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (count <= 0) {
- ACCOUNT_SLOGE("app id(%s) is not exist. count(%d)\n", app_id, count);
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
-
- /* transaction control required*/
- ret_transaction = _account_begin_transaction();
-
- if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
- }else if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
- pthread_mutex_unlock(&account_mutex);
- return ret_transaction;
- }
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ?", LABEL_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- _account_query_bind_text(hstmt, binding_count++, app_id);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- binding_count = 1;
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE app_id = ? ", PROVIDER_FEATURE_TABLE);
-
- hstmt = _account_prepare_query(query);
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- _account_query_bind_text(hstmt, binding_count++, app_id);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. AppId=%s, rc=%d\n", app_id, rc));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- is_success = TRUE;
-
- hstmt = NULL;
-
- binding_count = 1;
- ACCOUNT_MEMSET(query, 0, sizeof(query));
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ? ", ACCOUNT_TYPE_TABLE);
-
- hstmt = _account_prepare_query(query);
- ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
- ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
-
- _account_query_bind_text(hstmt, binding_count++, app_id);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. AppId=%s, rc=%d\n", app_id, rc));
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- is_success = TRUE;
-
- hstmt = NULL;
-
- CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- ret_transaction = _account_end_transaction(is_success);
+ bool is_success = account_manager_call_account_type_delete_by_app_id_sync(acc_mgr, account_db_path, app_id, e_cookie, NULL, &error);
- if (ret_transaction != ACCOUNT_ERROR_NONE) {
- ACCOUNT_ERROR("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
- }
+ _DESTROY_COOKIE
- pthread_mutex_unlock(&account_mutex);
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
return error_code;
}
-static void _account_type_convert_column_to_account_type(account_stmt hstmt, account_type_s *account_type_record)
-{
- const char *textbuf = NULL;
-
- account_type_record->id = _account_query_table_column_int(hstmt, ACCOUNT_TYPE_FIELD_ID);
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_APP_ID);
- _account_db_data_to_text(textbuf, &(account_type_record->app_id));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_SERVICE_PROVIDER_ID);
- _account_db_data_to_text(textbuf, &(account_type_record->service_provider_id));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_ICON_PATH);
- _account_db_data_to_text(textbuf, &(account_type_record->icon_path));
-
- textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_SMALL_ICON_PATH);
- _account_db_data_to_text(textbuf, &(account_type_record->small_icon_path));
-
- account_type_record->multiple_account_support = _account_query_table_column_int(hstmt, ACCOUNT_TYPE_FIELD_MULTIPLE_ACCOUNT_SUPPORT);
-
-}
-
-static void _account_type_convert_column_to_label(account_stmt hstmt, label_s *label_record)
-{
- const char *textbuf = NULL;
-
- textbuf = _account_query_table_column_text(hstmt, LABEL_FIELD_APP_ID);
- _account_db_data_to_text(textbuf, &(label_record->app_id));
-
- textbuf = _account_query_table_column_text(hstmt, LABEL_FIELD_LABEL);
- _account_db_data_to_text(textbuf, &(label_record->label));
-
- textbuf = _account_query_table_column_text(hstmt, LABEL_FIELD_LOCALE);
- _account_db_data_to_text(textbuf, &(label_record->locale));
-
-}
-
ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data )
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_type_query_label_by_app_id starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT Callback IS NULL"));
ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", LABEL_TABLE);
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- _account_query_bind_text(hstmt, binding_count++, app_id);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- label_s* label_record = NULL;
-
- while (rc == SQLITE_ROW) {
- bool cb_ret = FALSE;
- label_record = (label_s*) malloc(sizeof(label_s));
-
- if (label_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
-
- ACCOUNT_MEMSET(label_record, 0x00, sizeof(label_s));
-
- _account_type_convert_column_to_label(hstmt, label_record);
-
- cb_ret = callback(label_record->app_id, label_record->label , label_record->locale, user_data);
+ GVariant* label_list_variant = NULL;
+ bool is_success = account_manager_call_account_type_query_label_by_app_id_sync(acc_mgr, account_db_path, app_id, e_cookie, &label_list_variant, NULL, &error);
- _account_type_free_label_items(label_record);
- _ACCOUNT_FREE(label_record);
+ _DESTROY_COOKIE
- ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
+ int ret = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
- rc = _account_query_step(hstmt);
+ if (ret != ACCOUNT_ERROR_NONE)
+ {
+ return ret;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
+ _INFO("before variant_to_label_list");
+ GSList* label_list = variant_to_label_list (label_list_variant);
+ _INFO("after variant_to_label_list");
+ if (label_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- pthread_mutex_unlock(&account_mutex);
- return error_code;
-}
-
-int _account_type_label_get_app_id(label_h label, char **app_id)
-{
- if (!label) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
+ GSList* iter;
- if (!app_id) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
+ for (iter = label_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
+ label_s *label_record = NULL;
+ label_record = (label_s*)iter->data;
+ _INFO("");
+ if (callback(label_record->app_id, label_record->label, label_record->locale, user_data) == false)
+ {
+ _INFO("application callback requested to discontinue.");
+ break;
+ }
+ _INFO("");
}
- label_s *data = (label_s*)label;
-
- (*app_id) = NULL;
-
- *app_id = _account_get_text(data->app_id);
-
+ _account_type_gslist_label_free(label_list);
+ _INFO("account_type_query_label_by_app_id end");
return ACCOUNT_ERROR_NONE;
}
-bool _account_get_label_text_cb(char* app_id, char* label, char* locale, void *user_data)
-{
- account_type_s *data = (account_type_s*)user_data;
-
- label_s *label_data = (label_s*)malloc(sizeof(label_s));
-
- if (label_data == NULL) {
- ACCOUNT_FATAL("_account_get_label_text_cb : MALLOC FAIL\n");
- return FALSE;
- }
- ACCOUNT_MEMSET(label_data, 0, sizeof(label_s));
-
- label_data->app_id = _account_get_text(app_id);
- label_data->label = _account_get_text(label);
- label_data->locale = _account_get_text(locale);
-
- data->label_list = g_slist_append(data->label_list, (gpointer)label_data);
-
- return TRUE;
-}
-
-bool _account_get_provider_feature_cb(char* app_id, char* key, void* user_data)
-{
- account_type_s *data = (account_type_s*)user_data;
-
- provider_feature_s *feature_data = (provider_feature_s*)malloc(sizeof(provider_feature_s));
-
- if (feature_data == NULL) {
- ACCOUNT_FATAL("_account_get_provider_feature_cb : MALLOC FAIL\n");
- return FALSE;
- }
- ACCOUNT_MEMSET(feature_data, 0, sizeof(provider_feature_s));
-
- feature_data->app_id = _account_get_text(app_id);
- feature_data->key = _account_get_text(key);
-
- data->provider_feature_list = g_slist_append(data->provider_feature_list, (gpointer)feature_data);
-
- return TRUE;
-}
-
ACCOUNT_API int account_type_query_by_app_id(const char* app_id, account_type_h *account_type)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_type_query_by_app_id starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
ACCOUNT_RETURN_VAL((app_id != 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE'S POINTER IS NULL"));
ACCOUNT_RETURN_VAL((*account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", ACCOUNT_TYPE_TABLE);
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- _account_query_bind_text(hstmt, binding_count++, app_id);
+ GVariant* account_type_variant = NULL;
+ account_type_s *in_data = (account_type_s*) (*account_type);
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ bool is_success = account_manager_call_account_type_query_by_app_id_sync(acc_mgr, account_db_path, app_id, e_cookie, &account_type_variant, NULL, &error);
- account_type_s *account_type_record = (account_type_s *)(*account_type);
+ _DESTROY_COOKIE
- while (rc == SQLITE_ROW) {
- _account_type_convert_column_to_account_type(hstmt, account_type_record);
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- account_type_query_label_by_app_id(_account_get_label_text_cb, app_id, (void*)account_type_record);
- account_type_query_provider_feature_by_app_id(_account_get_provider_feature_cb, app_id,(void*)account_type_record);
-
- hstmt = NULL;
- error_code = ACCOUNT_ERROR_NONE;
-
- CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
+ int ret = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
- pthread_mutex_unlock(&account_mutex);
- return error_code;
-}
-
-ACCOUNT_API int account_type_query_app_id_exist(const char* app_id)
-{
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
+ if (ret != ACCOUNT_ERROR_NONE)
+ {
+ return ret;
}
- ACCOUNT_RETURN_VAL((app_id != 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId = '%s'", ACCOUNT_TYPE_TABLE, app_id);
- rc = _account_get_record_count(query);
+ account_type_s* received_account_type = umarshal_account_type (account_type_variant);
+ ACCOUNT_RETURN_VAL((received_account_type != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("INVALID DATA RECEIVED FROM SVC"));
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (rc <= 0) {
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
+ in_data->id = received_account_type->id;
+ in_data->app_id = received_account_type->app_id;
+ in_data->service_provider_id = received_account_type->service_provider_id;
+ in_data->icon_path = received_account_type->icon_path;
+ in_data->small_icon_path = received_account_type->small_icon_path;
+ in_data->multiple_account_support = received_account_type->multiple_account_support;
+ in_data->label_list = received_account_type->label_list;
+// in_data->account_type_list = received_account_type->account_type_list;
+ in_data->provider_feature_list = received_account_type->provider_feature_list;
+ _ACCOUNT_FREE(received_account_type);
+ _INFO("account_type_query_by_app_id end");
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data)
+ACCOUNT_API int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- GList *account_type_list = NULL;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_type_foreach_account_type_from_db starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
- ACCOUNT_RETURN_VAL((key != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type IS NULL"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT Callback IS NULL"));
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId IN (SELECT app_id from %s WHERE key=?)", ACCOUNT_TYPE_TABLE, PROVIDER_FEATURE_TABLE);
+ _GET_COOKIE
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- int binding_count = 1;
- _account_query_bind_text(hstmt, binding_count++, key);
-
- rc = _account_query_step(hstmt);
+ GVariant* account_type_list_variant = NULL;
+ _INFO("before account_type_query_all_sync()");
+ bool is_success = account_manager_call_account_type_query_all_sync(acc_mgr, account_db_path, e_cookie, &account_type_list_variant, NULL, &error);
- account_type_s *account_type_record = NULL;
+ _DESTROY_COOKIE
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+ _INFO("after account_type_query_all_sync()");
+ int ret = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
- int k=0;
- while(rc == SQLITE_ROW) {
- account_type_record = (account_type_s*) malloc(sizeof(account_type_s));
+ if (ret != ACCOUNT_ERROR_NONE)
+ {
+ return ret;
+ }
- if (account_type_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
+ GSList* account_type_list = unmarshal_account_type_list(account_type_list_variant);
+ g_variant_unref(account_type_list_variant);
- ACCOUNT_MEMSET(account_type_record, 0x00, sizeof(account_type_s));
- _account_type_convert_column_to_account_type(hstmt, account_type_record);
- account_type_list = g_list_append(account_type_list, account_type_record);
- rc = _account_query_step(hstmt);
- k++;
+ if (account_type_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {_account_type_glist_free(account_type_list);}, rc, ("finalize error"));
- hstmt = NULL;
+ GSList* iter;
- GList* iter;
- k = 0;
- for (iter = account_type_list; iter != NULL; iter = g_list_next(iter)) {
+ for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_list");
account_type_s *account_type = NULL;
account_type = (account_type_s*)iter->data;
- account_type_query_label_by_app_id(_account_get_label_text_cb,account_type->app_id,(void*)account_type);
- account_type_query_provider_feature_by_app_id(_account_get_provider_feature_cb, account_type->app_id,(void*)account_type);
- //cb_func((account_type_h)account_type, user_data);
- ACCOUNT_CATCH_ERROR(callback((account_type_h)account_type, user_data) == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
- k++;
- }
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
- if (account_type_list) {
- _account_type_glist_free(account_type_list);
- account_type_list = NULL;
- }
-
- return error_code;
-}
-
-
-ACCOUNT_API int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data)
-{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
- GList *account_type_list = NULL;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
+ if (callback((account_type_h)account_type, user_data) == false)
{
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INFO IS NULL"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
-
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s ", ACCOUNT_TYPE_TABLE);
- hstmt = _account_prepare_query(query);
-
- rc = _account_query_step(hstmt);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- account_type_s *account_type_record = NULL;
-
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- int k=0;
- while(rc == SQLITE_ROW) {
- account_type_record = (account_type_s*) malloc(sizeof(account_type_s));
-
- if (account_type_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
+ _INFO("application callback requested to discontinue.");
break;
}
-
- ACCOUNT_MEMSET(account_type_record, 0x00, sizeof(account_type_s));
- _account_type_convert_column_to_account_type(hstmt, account_type_record);
- account_type_list = g_list_append(account_type_list, account_type_record);
- rc = _account_query_step(hstmt);
- k++;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {_account_type_glist_free(account_type_list);}, rc, ("finalize error"));
- hstmt = NULL;
-
- GList* iter;
- k = 0;
- for (iter = account_type_list; iter != NULL; iter = g_list_next(iter)) {
- account_type_s *account_type = NULL;
- account_type = (account_type_s*)iter->data;
- account_type_query_label_by_app_id(_account_get_label_text_cb,account_type->app_id,(void*)account_type);
- account_type_query_provider_feature_by_app_id(_account_get_provider_feature_cb, account_type->app_id,(void*)account_type);
- callback((account_type_h)account_type, user_data);
- k++;
- }
-
- error_code = ACCOUNT_ERROR_NONE;
-
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
- if (account_type_list) {
- _account_type_glist_free(account_type_list);
- account_type_list = NULL;
- }
-
- return error_code;
+ _account_type_gslist_account_type_free(account_type_list);
+ _INFO("account_type_foreach_account_type_from_db end");
+ return ACCOUNT_ERROR_NONE;
}
-// output parameter label must be free
ACCOUNT_API int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0, binding_count = 1;
-
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
- char* converted_locale = NULL;
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
+ _INFO("account_type_query_label_by_locale starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO APP ID"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((locale != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO LOCALE"));
ACCOUNT_RETURN_VAL((label != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("label char is null"));
- ACCOUNT_RETURN_VAL((locale != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("locale char is null"));
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- converted_locale = _account_get_text(locale);
- gchar** tokens = g_strsplit(converted_locale, "-", 2);
+ GError *error = NULL;
- if(tokens != NULL) {
- if((char*)(tokens[1]) != NULL) {
- char* upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
- if(upper_token != NULL) {
- _ACCOUNT_FREE(converted_locale);
- converted_locale = g_strdup_printf("%s_%s", tokens[0], upper_token);
- }
- _ACCOUNT_FREE(upper_token);
- }
- }
- g_strfreev(tokens);
-
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ? AND Locale = '%s' ", LABEL_TABLE, converted_locale);
- _ACCOUNT_FREE(converted_locale);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- _account_query_bind_text(hstmt, binding_count++, app_id);
-
- rc = _account_query_step(hstmt);
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- label_s* label_record = NULL;
-
- while (rc == SQLITE_ROW) {
- label_record = (label_s*) malloc(sizeof(label_s));
-
- if (label_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
-
- ACCOUNT_MEMSET(label_record, 0x00, sizeof(label_s));
-
- _account_type_convert_column_to_label(hstmt,label_record);
-
- _ACCOUNT_FREE(*label);
- *label = _account_get_text(label_record->label);
-
- _account_type_free_label_items(label_record);
- _ACCOUNT_FREE(label_record);
-
- rc = _account_query_step(hstmt);
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
+ char* label_temp = NULL;
+ _INFO("before account_type_query_label_by_locale_sync()");
+ bool is_success = account_manager_call_account_type_query_label_by_locale_sync(acc_mgr, account_db_path, app_id, locale, e_cookie, &label_temp, NULL, &error);
- error_code = ACCOUNT_ERROR_NONE;
+ _DESTROY_COOKIE
- CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
- return error_code;
-}
-
-static int _account_insert_custom(account_s *account, int account_id)
-{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
-
- if (g_slist_length( account->custom_list)==0) {
- ACCOUNT_DEBUG( "_account_insert_custom, no custom data\n");
- return ACCOUNT_ERROR_NONE;
- }
+ _INFO("after account_type_query_label_by_locale_sync() : is_success=%d", is_success);
+ int ret = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
-
- rc = _account_get_record_count(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%d, %s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- if (rc <= 0) {
- ACCOUNT_SLOGE( "_account_insert_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ if (ret != ACCOUNT_ERROR_NONE)
+ {
+ return ret;
}
- /* insert query*/
-
- GSList *iter;
-
- for (iter = account->custom_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s (AccountId, AppId, Key, Value) VALUES "
- "(?, ?, ?, ?) ", ACCOUNT_CUSTOM_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- account_custom_s* custom_data = NULL;
- custom_data = (account_custom_s*)iter->data;
-
- ret = _account_query_bind_int(hstmt, count++, account_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Int binding fail"));
- ret = _account_query_bind_text(hstmt, count++, account->package_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->key);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->value);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
-
- rc = _account_query_step(hstmt);
-
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- break;
- }
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
+ if (label_temp == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
}
+ *label = _account_get_text(label_temp);
+ _INFO("account_type_query_label_by_locale end");
return ACCOUNT_ERROR_NONE;
+
}
-static int _account_update_custom(account_s *account, int account_id)
+ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data)
{
- int rc, count = 1;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- account_stmt hstmt = NULL;
-
- ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ _INFO("account_type_query_by_provider_feature starting");
+ char* account_db_path = ACCOUNT_DB_NAME;
- if (g_slist_length( account->custom_list)==0) {
- ACCOUNT_DEBUG( "_account_update_custom, no custom data\n");
- return ACCOUNT_ERROR_NONE;
- }
+ ACCOUNT_RETURN_VAL((key != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type IS NULL"));
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
+ _GET_COOKIE
- rc = _account_get_record_count(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
- } else if( _account_db_err_code() == SQLITE_BUSY ){
- ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
- pthread_mutex_unlock(&account_mutex);
- return ACCOUNT_ERROR_DATABASE_BUSY;
}
- if (rc <= 0) {
- ACCOUNT_SLOGE( "_account_update_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_RECORD_NOT_FOUND;
- }
+ GVariant* account_type_list_variant = NULL;
+ bool is_success = account_manager_call_account_type_query_by_provider_feature_sync(acc_mgr, account_db_path, key, e_cookie, &account_type_list_variant, NULL, &error);
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ _DESTROY_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AccountId=? ", ACCOUNT_CUSTOM_TABLE);
- hstmt = _account_prepare_query(query);
- count = 1;
- _account_query_bind_int(hstmt, count++, (int)account_id);
- rc = _account_query_step(hstmt);
+ int ret = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
- if (rc == SQLITE_BUSY) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_DATABASE_BUSY;
- } else if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
- return ACCOUNT_ERROR_DB_FAILED;
+ if (ret != ACCOUNT_ERROR_NONE)
+ {
+ return ret;
}
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
- GSList *iter;
-
- for (iter = account->custom_list; iter != NULL; iter = g_slist_next(iter)) {
- int ret;
- count = 1;
- ACCOUNT_MEMSET(query, 0x00, sizeof(query));
- ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(AccountId, AppId, Key, Value) VALUES "
- "(?, ?, ?, ?) ", ACCOUNT_CUSTOM_TABLE);
-
- hstmt = _account_prepare_query(query);
-
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ GSList* account_type_list = unmarshal_account_type_list(account_type_list_variant);
+ g_variant_unref(account_type_list_variant);
- ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
-
- account_custom_s* custom_data = NULL;
- custom_data = (account_custom_s*)iter->data;
-
- ret = _account_query_bind_int(hstmt, count++, (int)account_id);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Int binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->key);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
- ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->value);
- ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ if (account_type_list == NULL)
+ {
+ return ACCOUNT_ERROR_NO_DATA;
+ }
- rc = _account_query_step(hstmt);
+ GSList* iter;
- if (rc != SQLITE_DONE) {
- ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter))
+ {
+ _INFO("iterating received account_type_list");
+ account_type_s *account_type = NULL;
+ account_type = (account_type_s*)iter->data;
+ _INFO("");
+ if (callback((account_type_h)account_type, user_data) == false)
+ {
+ _INFO("Application callback requested not to continue");
break;
}
-
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
-
+ _INFO("");
}
+ _account_type_gslist_account_type_free(account_type_list);
+ _INFO("account_type_query_by_provider_feature end");
return ACCOUNT_ERROR_NONE;
}
-static int _account_query_custom_by_account_id(account_custom_cb callback, int account_id, void *user_data )
+ACCOUNT_API int account_type_query_app_id_exist(const char* app_id)
{
- int error_code = ACCOUNT_ERROR_NONE;
- account_stmt hstmt = NULL;
- char query[ACCOUNT_SQL_LEN_MAX] = {0, };
- int rc = 0;
+ _INFO("account_type_query_app_id_exist starting");
+ int error_code = ACCOUNT_ERROR_NONE;
+ char* account_db_path = ACCOUNT_DB_NAME;
- ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
- ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
- ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((app_id != 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
- ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+ _GET_COOKIE
- ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AccountId = %d", ACCOUNT_CUSTOM_TABLE, account_id);
- hstmt = _account_prepare_query(query);
+ GError *error = NULL;
- if( _account_db_err_code() == SQLITE_PERM ){
- ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ AccountManager* acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL)
+ {
+ _ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- rc = _account_query_step(hstmt);
-
- ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
-
- account_custom_s* custom_record = NULL;
-
- while (rc == SQLITE_ROW) {
- bool cb_ret = FALSE;
- custom_record = (account_custom_s*) malloc(sizeof(account_custom_s));
-
- if (custom_record == NULL) {
- ACCOUNT_FATAL("malloc Failed");
- break;
- }
-
- ACCOUNT_MEMSET(custom_record, 0x00, sizeof(account_custom_s));
-
- _account_convert_column_to_custom(hstmt, custom_record);
-
- cb_ret = callback(custom_record->key, custom_record->value, user_data);
-
- _account_custom_item_free(custom_record);
- _ACCOUNT_FREE(custom_record);
-
- ACCOUNT_CATCH_ERROR(cb_ret == TRUE, {}, ACCOUNT_ERROR_NONE, ("Callback func returs FALSE, its iteration is stopped!!!!\n"));
-
- rc = _account_query_step(hstmt);
- }
+ bool is_success = account_manager_call_account_type_query_app_id_exist_sync(acc_mgr, account_db_path, app_id, e_cookie, NULL, &error);
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
+ _DESTROY_COOKIE
- error_code = ACCOUNT_ERROR_NONE;
+ error_code = _account_get_error_code(is_success, error);
+ g_clear_error(&error);
-CATCH:
- if (hstmt != NULL) {
- rc = _account_query_finalize(hstmt);
- ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
- hstmt = NULL;
- }
-
- pthread_mutex_unlock(&account_mutex);
return error_code;
}
+
static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data)
{
account_subscribe_s* tmp = (account_subscribe_s*)user_data;
@@ -7101,7 +2878,8 @@ static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data)
}
key_name = vconf_keynode_get_name(key);
- if( key_name == NULL ) {
+
+ if ( key_name == NULL ) {
ACCOUNT_ERROR("vconf_keynode_get_name(key) fail\n");
return;
}
@@ -7137,57 +2915,6 @@ static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data)
}
-static void _account_subscribe_vconf_callback_ex(keynode_t *key, void *user_data)
-{
- account_subscribe_s* tmp = (account_subscribe_s*)user_data;
- char *msg = NULL, *vconf_key = NULL;
- char *key_name = NULL;
- char event_msg[256] ={0, };
- int account_id = -1;
-
- if(!key) {
- ACCOUNT_ERROR("No subscribtion msg !!!!!\n");
- return;
- }
-
- if(!tmp) {
- ACCOUNT_ERROR("user data required\n");
- return;
- }
-
- key_name = vconf_keynode_get_name(key);
- if( key_name == NULL ) {
- ACCOUNT_ERROR("vconf_keynode_get_name(key) fail\n");
- return;
- }
-
- if(!memcmp(key_name, VCONFKEY_ACCOUNT_MSG_STR, strlen(VCONFKEY_ACCOUNT_MSG_STR)))
- {
- vconf_key = vconf_keynode_get_str(key);
-
- if( vconf_key == NULL){
- ACCOUNT_ERROR("vconf key is NULL.\n");
- return;
- }
- msg = strdup(vconf_key);
-
- char* event_type = NULL;
- char* id = NULL;
- char* ptr = NULL;
- event_type = strtok_r(msg, ":", &ptr);
- id = strtok_r(NULL, ":", &ptr);
- ACCOUNT_SLOGD("msg(%s), event_type(%s), id(%s)", msg, event_type, id);
-
- ACCOUNT_SNPRINTF(event_msg,sizeof(event_msg),"%s", event_type);
- account_id = atoi(id);
-
- if(tmp->account_subscription_callback)
- tmp->account_subscription_callback(event_msg, account_id, tmp->user_data);
- }
-
- _ACCOUNT_FREE(msg);
-}
-
ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe)
{
if (!account_subscribe) {
@@ -7209,35 +2936,6 @@ ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe)
ACCOUNT_API int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data)
{
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
-
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
-
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
- close(fd);
- }
-
ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
@@ -7262,35 +2960,79 @@ ACCOUNT_API int account_subscribe_notification(account_subscribe_h account_subsc
ACCOUNT_API int account_unsubscribe_notification(account_subscribe_h account_subscribe)
{
- int res;
- int process_uid = getuid();
- char subject_label[SMACK_LABEL_LEN + 1] = {0,};
+ ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
- if(process_uid != 0) {
- int fd = open("/proc/self/attr/current", O_RDONLY);
- if(fd < 0)
- {
- ACCOUNT_ERROR("file open fail :: /proc/self/attr/current");
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
- res = read(fd, subject_label, SMACK_LABEL_LEN);
- if(res < 0)
- {
- ACCOUNT_ERROR("file read fail :: /proc/self/attr/current");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
- }
+ _ACCOUNT_FREE(tmp);
+
+ if (vconf_ignore_key_changed(VCONFKEY_ACCOUNT_MSG_STR,
+ (vconf_callback_fn)_account_subscribe_vconf_callback) != 0) {
+ ACCOUNT_ERROR("Vconf Subscription Failed !!!!!\n");
+ return ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL;
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static void _account_subscribe_vconf_callback_ex(keynode_t *key, void *user_data)
+{
+ account_subscribe_s* tmp = (account_subscribe_s*)user_data;
+ char *msg = NULL, *vconf_key = NULL;
+ char event_msg[256] ={0, };
+ int account_id = -1;
+ char *key_name = NULL;
+
+ if(!key) {
+ ACCOUNT_ERROR("No subscribtion msg !!!!!\n");
+ return;
+ }
+
+ if(!tmp) {
+ ACCOUNT_ERROR("user data required\n");
+ return;
+ }
+
+ key_name = vconf_keynode_get_name(key);
+
+ if ( key_name == NULL ) {
+ ACCOUNT_ERROR("vconf_keynode_get_name(key) fail\n");
+ return;
+ }
- res = smack_have_access(subject_label, "libaccounts-svc::check_read", "r");
- if(res != 1) {
- ACCOUNT_ERROR("Account permission denied :: This API can not be used without account.read privilege");
- close(fd);
- return ACCOUNT_ERROR_PERMISSION_DENIED;
+ if(!memcmp(key_name, VCONFKEY_ACCOUNT_MSG_STR, strlen(VCONFKEY_ACCOUNT_MSG_STR)))
+ {
+ vconf_key = vconf_keynode_get_str(key);
+
+ if( vconf_key == NULL){
+ ACCOUNT_ERROR("vconf key is NULL.\n");
+ return;
}
- close(fd);
+ msg = strdup(vconf_key);
+
+ char* event_type = NULL;
+ char* id = NULL;
+ char* ptr = NULL;
+
+ event_type = strtok_r(msg, ":", &ptr);
+ id = strtok_r(NULL, ":", &ptr);
+
+ ACCOUNT_SLOGD("msg(%s), event_type(%s), id(%s)", msg, event_type, id);
+
+ ACCOUNT_SNPRINTF(event_msg,sizeof(event_msg),"%s", event_type);
+
+ account_id = atoi(id);
+
+ if(tmp->account_subscription_callback)
+ tmp->account_subscription_callback(event_msg, account_id, tmp->user_data);
}
+ _ACCOUNT_FREE(msg);
+
+}
+
+ACCOUNT_API int account_unsubscribe_notification_ex(account_subscribe_h account_subscribe)
+{
ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
@@ -7298,7 +3040,7 @@ ACCOUNT_API int account_unsubscribe_notification(account_subscribe_h account_sub
_ACCOUNT_FREE(tmp);
if (vconf_ignore_key_changed(VCONFKEY_ACCOUNT_MSG_STR,
- (vconf_callback_fn)_account_subscribe_vconf_callback) != 0) {
+ (vconf_callback_fn)_account_subscribe_vconf_callback_ex) != 0) {
ACCOUNT_ERROR("Vconf Subscription Failed !!!!!\n");
return ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL;
}
@@ -7306,40 +3048,26 @@ ACCOUNT_API int account_unsubscribe_notification(account_subscribe_h account_sub
return ACCOUNT_ERROR_NONE;
}
-
-ACCOUNT_INTERNAL_API int account_subscribe_notification_ex(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data)
+ACCOUNT_API int account_subscribe_notification_ex(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data)
{
- ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
+ ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
+
tmp->account_subscription_callback = callback;
tmp->user_data = user_data;
int ret = -1;
ret = vconf_notify_key_changed(VCONFKEY_ACCOUNT_MSG_STR,
- (vconf_callback_fn)_account_subscribe_vconf_callback_ex,
- (void*)tmp);
+ (vconf_callback_fn)_account_subscribe_vconf_callback_ex,
+ (void*)tmp);
+
ACCOUNT_SLOGI("vconf_notify_key_changed ret = %d", ret);
if(ret != VCONF_OK) {
ACCOUNT_ERROR("Vconf Subscription Failed ret = %d", ret);
return ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL;
}
- return ACCOUNT_ERROR_NONE;
-}
-
-ACCOUNT_INTERNAL_API int account_unsubscribe_notification_ex(account_subscribe_h account_subscribe)
-{
- ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
- account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
-
- _ACCOUNT_FREE(tmp);
-
- if (vconf_ignore_key_changed(VCONFKEY_ACCOUNT_MSG_STR,
- (vconf_callback_fn)_account_subscribe_vconf_callback_ex) != 0) {
- ACCOUNT_ERROR("Vconf Subscription Failed !!!!!\n");
- return ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL;
- }
return ACCOUNT_ERROR_NONE;
}
diff --git a/src/account_offline.c b/src/account_offline.c
new file mode 100644
index 0000000..9308c88
--- /dev/null
+++ b/src/account_offline.c
@@ -0,0 +1,1404 @@
+/*
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <db-util.h>
+#include <pthread.h>
+#include <vasum.h>
+#include <vconf.h>
+
+#include <account-private.h>
+#include <account_free.h>
+#include <dbg.h>
+#include "account_private_client.h"
+#include "account_internal.h"
+
+#ifdef TIZEN_PROFILE_MOBILE
+#include "mobile/account.h"
+#else
+#include "wearable/account.h"
+#endif
+
+#define ACCOUNT_DB_OPEN_READONLY 0
+#define ACCOUNT_DB_OPEN_READWRITE 1
+
+typedef sqlite3_stmt* account_stmt;
+
+static sqlite3* g_hAccountDB = NULL;
+static int g_refCntDB = 0;
+pthread_mutex_t account_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static const char *_account_db_err_msg()
+{
+ return sqlite3_errmsg(g_hAccountDB);
+}
+
+static int _account_db_err_code()
+{
+ return sqlite3_errcode(g_hAccountDB);
+}
+
+static int _account_db_open(int mode)
+{
+ int rc = 0;
+ int ret = -1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+
+ char *client_db_path = NULL;
+
+ _INFO( "start to get DB path");
+
+ ret = vsm_canonicalize_path("/opt/usr/dbspace/.account.db", &client_db_path);
+ if (ret <= 0){
+ _ERR( "vsm_canonicalize_path fail ret = %d", ret);
+ _ACCOUNT_FREE(client_db_path);
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ _INFO( "account_db_path canonicalized = %s", client_db_path);
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ if (!g_hAccountDB) {
+ if(mode == ACCOUNT_DB_OPEN_READWRITE)
+ rc = db_util_open(client_db_path, &g_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD);
+ else if(mode == ACCOUNT_DB_OPEN_READONLY)
+ rc = db_util_open_with_options(client_db_path, &g_hAccountDB, SQLITE_OPEN_READONLY, NULL);
+ else {
+ _ACCOUNT_FREE(client_db_path);
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+ _ACCOUNT_FREE(client_db_path);
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ ACCOUNT_RETURN_VAL((rc != SQLITE_PERM), {}, ACCOUNT_ERROR_PERMISSION_DENIED, ("Account permission denied rc : %d", rc));
+ ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected. rc : %d", rc));
+ g_refCntDB++;
+ } else {
+ g_refCntDB++;
+ _ACCOUNT_FREE(client_db_path);
+ }
+
+ ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("busy handler fail. rc : %d", rc));
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_db_close(void)
+{
+ int rc = 0;
+ int ret = -1;
+
+ if (g_hAccountDB) {
+ if (g_refCntDB > 0) {
+ g_refCntDB--;
+ }
+ if (g_refCntDB == 0) {
+ rc = db_util_close(g_hAccountDB);
+ if( rc == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(SQLITE_PERM)");
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ } else if ( rc == SQLITE_BUSY ){
+ ACCOUNT_ERROR( "database busy");
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ }
+ ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_FAILED, ("The database isn't connected. rc : %d", rc));
+ g_hAccountDB = NULL;
+ }
+ ret = ACCOUNT_ERROR_NONE;
+ } else {
+ ACCOUNT_ERROR( "_account_svc_db_close: No handle(). refcnt=%d ", g_refCntDB);
+ ret = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return ret;
+}
+
+static int _account_execute_query(const char *query)
+{
+ int rc = -1;
+ char* pszErrorMsg = NULL;
+
+ if(!query){
+ ACCOUNT_ERROR("NULL query\n");
+ return ACCOUNT_ERROR_QUERY_SYNTAX_ERROR;
+ }
+
+ if(!g_hAccountDB){
+ ACCOUNT_ERROR("DB is not opened\n");
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+
+ rc = sqlite3_exec(g_hAccountDB, query, NULL, NULL, &pszErrorMsg);
+ if (SQLITE_OK != rc) {
+ ACCOUNT_ERROR("sqlite3_exec rc(%d) query(%s) failed(%s).", rc, query, pszErrorMsg);
+ sqlite3_free(pszErrorMsg);
+ }
+
+ return rc;
+}
+
+static int _account_begin_transaction(void)
+{
+ ACCOUNT_DEBUG("_account_begin_transaction start");
+ int ret = -1;
+
+ ret = _account_execute_query("BEGIN IMMEDIATE TRANSACTION");
+
+ if (ret == SQLITE_BUSY){
+ ACCOUNT_ERROR(" sqlite3 busy = %d", ret);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ } else if(ret != SQLITE_OK) {
+ ACCOUNT_ERROR("_account_svc_begin_transaction fail :: %d", ret);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ ACCOUNT_DEBUG("_account_begin_transaction end");
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_end_transaction(bool is_success)
+{
+ ACCOUNT_DEBUG("_account_end_transaction start");
+
+ int ret = -1;
+
+ if (is_success == true) {
+ ret = _account_execute_query("COMMIT TRANSACTION");
+ ACCOUNT_DEBUG("_account_end_transaction COMMIT");
+ } else {
+ ret = _account_execute_query("ROLLBACK TRANSACTION");
+ ACCOUNT_DEBUG("_account_end_transaction ROLLBACK");
+ }
+
+ if(ret == SQLITE_PERM){
+ ACCOUNT_ERROR("Account permission denied :: %d", ret);
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ if (ret == SQLITE_BUSY){
+ ACCOUNT_DEBUG(" sqlite3 busy = %d", ret);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ }
+
+ if (ret != SQLITE_OK) {
+ ACCOUNT_ERROR("_account_svc_end_transaction fail :: %d", ret);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ ACCOUNT_DEBUG("_account_end_transaction end");
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_get_record_count(char* query)
+{
+ _INFO("_account_get_record_count");
+
+ int rc = -1;
+ int ncount = 0;
+ account_stmt pStmt = NULL;
+
+ if(!query){
+ _ERR("NULL query\n");
+ return ACCOUNT_ERROR_QUERY_SYNTAX_ERROR;
+ }
+
+ if(!g_hAccountDB){
+ _ERR("DB is not opened\n");
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+
+ rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
+
+ if (SQLITE_BUSY == rc){
+ _ERR("sqlite3_prepare_v2() failed(%d, %s).", rc, _account_db_err_msg());
+ sqlite3_finalize(pStmt);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ } else if (SQLITE_OK != rc) {
+ _ERR("sqlite3_prepare_v2() failed(%d, %s).", rc, _account_db_err_msg());
+ sqlite3_finalize(pStmt);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ rc = sqlite3_step(pStmt);
+ if (SQLITE_BUSY == rc) {
+ _ERR("sqlite3_step() failed(%d, %s).", rc, _account_db_err_msg());
+ sqlite3_finalize(pStmt);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ } else if (SQLITE_ROW != rc) {
+ _ERR("sqlite3_step() failed(%d, %s).", rc, _account_db_err_msg());
+ sqlite3_finalize(pStmt);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ ncount = sqlite3_column_int(pStmt, 0);
+
+ _INFO("account record count [%d]", ncount);
+ sqlite3_finalize(pStmt);
+
+ return ncount;
+}
+
+static int _account_query_bind_int(account_stmt pStmt, int pos, int num)
+{
+ if(!pStmt){
+ ACCOUNT_ERROR("statement is null");
+ return -1;
+ }
+
+ if(pos < 0){
+ ACCOUNT_ERROR("invalid pos");
+ return -1;
+ }
+
+ return sqlite3_bind_int(pStmt, pos, num);
+}
+
+static int _account_query_bind_text(account_stmt pStmt, int pos, const char *str)
+{
+ _INFO("_account_query_bind_text");
+
+ if(!pStmt)
+ {
+ _ERR("statement is null");
+ return -1;
+ }
+
+ if(str)
+ {
+ _INFO("sqlite3_bind_text");
+ return sqlite3_bind_text(pStmt, pos, (const char*)str, strlen(str), SQLITE_STATIC);
+ }
+ else
+ {
+ _INFO("sqlite3_bind_null");
+ return sqlite3_bind_null(pStmt, pos);
+ }
+}
+
+static int _account_type_convert_account_to_sql(account_type_s *account_type, account_stmt hstmt, char *sql_value)
+{
+ _INFO("");
+
+ int count = 1;
+
+ /*Caution : Keep insert query orders.*/
+
+ /* 1. app id*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->app_id);
+
+ /* 2. service provider id*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->service_provider_id);
+
+ /* 3. icon path*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->icon_path);
+
+ /* 4. small icon path*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->small_icon_path);
+
+ /* 5. multiple accont support*/
+ _account_query_bind_int(hstmt, count++, account_type->multiple_account_support);
+
+ _INFO("");
+
+ return count;
+}
+
+static gboolean _account_type_check_duplicated(account_type_s *data)
+{
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int count = 0;
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId='%s'"
+ , ACCOUNT_TYPE_TABLE, data->app_id);
+
+ count = _account_get_record_count(query);
+ if (count > 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static int _account_query_finalize(account_stmt pStmt)
+{
+ int rc = -1;
+
+ if (!pStmt) {
+ ACCOUNT_ERROR( "pStmt is NULL");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ rc = sqlite3_finalize(pStmt);
+ if (rc == SQLITE_BUSY){
+ ACCOUNT_ERROR(" sqlite3 busy = %d", rc);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ } else if (rc != SQLITE_OK) {
+ ACCOUNT_ERROR( "sqlite3_finalize fail, rc : %d, db_error : %s\n", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_query_step(account_stmt pStmt)
+{
+ if(!pStmt){
+ ACCOUNT_ERROR( "pStmt is NULL");
+ return -1;
+ }
+
+ return sqlite3_step(pStmt);
+}
+
+static account_stmt _account_prepare_query(char *query)
+{
+ int rc = -1;
+ account_stmt pStmt = NULL;
+
+ ACCOUNT_RETURN_VAL((query != NULL), {}, NULL, ("query is NULL"));
+
+ rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
+
+ ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, NULL, ("sqlite3_prepare_v2(%s) failed(%s).", query, _account_db_err_msg()));
+
+ return pStmt;
+}
+
+static int _account_get_next_sequence(const char *pszName)
+{
+ int rc = 0;
+ account_stmt pStmt = NULL;
+ int max_seq = 0;
+ char szQuery[ACCOUNT_SQL_LEN_MAX] = {0,};
+
+ ACCOUNT_MEMSET(szQuery, 0x00, sizeof(szQuery));
+ ACCOUNT_SNPRINTF(szQuery, sizeof(szQuery), "SELECT max(seq) FROM %s where name = '%s' ", ACCOUNT_SQLITE_SEQ, pszName);
+ rc = sqlite3_prepare_v2(g_hAccountDB, szQuery, strlen(szQuery), &pStmt, NULL);
+ if (SQLITE_OK != rc) {
+ ACCOUNT_SLOGE("sqlite3_prepare_v2() failed(%d, %s).", rc, _account_db_err_msg());
+ sqlite3_finalize(pStmt);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ rc = sqlite3_step(pStmt);
+ max_seq = sqlite3_column_int(pStmt, 0);
+ max_seq++;
+
+ /*Finalize Statement*/
+ rc = sqlite3_finalize(pStmt);
+ pStmt = NULL;
+
+ return max_seq;
+}
+
+static int _account_type_insert_provider_feature(account_type_s *account_type, const char* app_id)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+
+ if (g_slist_length( account_type->provider_feature_list)==0) {
+ ACCOUNT_ERROR( "no capability\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where AppId='%s'", ACCOUNT_TYPE_TABLE, app_id);
+
+ rc = _account_get_record_count(query);
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ if (rc <= 0) {
+ ACCOUNT_SLOGI( "related account type item is not existed rc=%d , %s", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* insert query*/
+
+ GSList *iter;
+
+ for (iter = account_type->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
+ int ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(app_id, key) VALUES "
+ "(?, ?) ", PROVIDER_FEATURE_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
+
+ provider_feature_s* feature_data = NULL;
+ feature_data = (provider_feature_s*)iter->data;
+
+ ret = _account_query_bind_text(hstmt, count++, app_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, feature_data->key);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_insert_label(account_type_s *account_type)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account_type->label_list)==0) {
+ ACCOUNT_ERROR( "_account_type_insert_label, no label\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where AppId = '%s'", ACCOUNT_TYPE_TABLE, account_type->app_id);
+
+ rc = _account_get_record_count(query);
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ if (rc <= 0) {
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* insert query*/
+ GSList *iter;
+
+ for (iter = account_type->label_list; iter != NULL; iter = g_slist_next(iter)) {
+ int ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(AppId, Label, Locale) VALUES "
+ "(?, ?, ?) ", LABEL_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
+
+ label_s* label_data = NULL;
+ label_data = (label_s*)iter->data;
+
+ ret = _account_query_bind_text(hstmt, count++, account_type->app_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, label_data->label);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)label_data->locale);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_ERROR( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_execute_insert_query(account_type_s *account_type)
+{
+ _INFO("");
+
+ int rc = 0;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+
+ /* check mandatory field */
+ // app id & service provider id
+ if (!account_type->app_id) {
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s( AppId, ServiceProviderId , IconPath , SmallIconPath , MultipleAccountSupport ) values "
+ "(?, ?, ?, ?, ?)", ACCOUNT_TYPE_TABLE);
+
+ _INFO("");
+ hstmt = _account_prepare_query(query);
+ _INFO("");
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ } else if( _account_db_err_code() == SQLITE_BUSY ){
+ ACCOUNT_ERROR( "Database Busy(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ }
+
+ ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
+
+ _INFO("");
+ _account_type_convert_account_to_sql(account_type, hstmt, query);
+ _INFO("");
+
+ rc = _account_query_step(hstmt);
+ if (rc == SQLITE_BUSY) {
+ ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ error_code = ACCOUNT_ERROR_DATABASE_BUSY;
+ } else if (rc != SQLITE_DONE) {
+ ACCOUNT_ERROR( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ error_code = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ _INFO("");
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+
+ _INFO("");
+ return error_code;
+}
+
+int _account_type_insert_to_db(account_type_s* account_type, int* account_type_id)
+{
+ _INFO("");
+
+ int error_code = ACCOUNT_ERROR_NONE, ret_transaction = 0;
+
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((account_type_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE ID POINTER IS NULL"));
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ pthread_mutex_lock(&account_mutex);
+
+
+ /* transaction control required*/
+ ret_transaction = _account_begin_transaction();
+
+ _INFO("");
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ pthread_mutex_unlock(&account_mutex);
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ _INFO("");
+ if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
+ ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ } else if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("_account_begin_transaction fail %d\n", ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return ret_transaction;
+ }
+
+ _INFO("");
+ if (_account_type_check_duplicated(data)) {
+ _INFO("");
+ ret_transaction = _account_end_transaction(FALSE);
+ ACCOUNT_ERROR("Duplicated, rollback insert query(%x)!!!!\n", ret_transaction);
+ *account_type_id = -1;
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_DUPLICATED;
+ } else {
+ _INFO("");
+ *account_type_id = _account_get_next_sequence(ACCOUNT_TYPE_TABLE);
+
+ error_code = _account_type_execute_insert_query(data);
+
+ if (error_code != ACCOUNT_ERROR_NONE){
+ error_code = ACCOUNT_ERROR_DUPLICATED;
+ ret_transaction = _account_end_transaction(FALSE);
+ ACCOUNT_ERROR("Insert fail, rollback insert query(%x)!!!!\n", ret_transaction);
+ *account_type_id = -1;
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+ }
+ }
+
+ _INFO("");
+ error_code = _account_type_insert_provider_feature(data, data->app_id);
+ if(error_code != ACCOUNT_ERROR_NONE) {
+ _INFO("");
+ ret_transaction = _account_end_transaction(FALSE);
+ ACCOUNT_ERROR("Insert provider feature fail(%x), rollback insert query(%x)!!!!\n", error_code, ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+ }
+ _INFO("");
+ error_code = _account_type_insert_label(data);
+ if(error_code != ACCOUNT_ERROR_NONE) {
+ _INFO("");
+ ret_transaction = _account_end_transaction(FALSE);
+ ACCOUNT_ERROR("Insert label fail(%x), rollback insert query(%x)!!!!\n", error_code, ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+ }
+
+ ret_transaction = _account_end_transaction(TRUE);
+ _INFO("");
+ pthread_mutex_unlock(&account_mutex);
+
+ _INFO("");
+ return ACCOUNT_ERROR_NONE;
+}
+
+int _account_type_delete_by_app_id(const char* app_id)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0, count = -1;
+ int ret_transaction = 0;
+ int binding_count = 1;
+ bool is_success = FALSE;
+
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("The database isn't connected."));
+
+ /* Check requested ID to delete */
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId = '%s'", ACCOUNT_TYPE_TABLE, app_id);
+
+ count = _account_get_record_count(query);
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ if (count <= 0) {
+ ACCOUNT_SLOGE("app id(%s) is not exist. count(%d)\n", app_id, count);
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* transaction control required*/
+ ret_transaction = _account_begin_transaction();
+
+ if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
+ ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ }else if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return ret_transaction;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ?", LABEL_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+
+ binding_count = 1;
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE app_id = ? ", PROVIDER_FEATURE_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. AppId=%s, rc=%d\n", app_id, rc));
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ is_success = TRUE;
+
+ hstmt = NULL;
+
+ binding_count = 1;
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ? ", ACCOUNT_TYPE_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. AppId=%s, rc=%d\n", app_id, rc));
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ is_success = TRUE;
+
+ hstmt = NULL;
+
+ CATCH:
+ if (hstmt != NULL) {
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+ }
+
+ ret_transaction = _account_end_transaction(is_success);
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+
+ return error_code;
+}
+
+ACCOUNT_INTERNAL_API int account_type_insert_to_db_offline(account_type_h account_type, int* account_type_id)
+{
+ _INFO("account_type_insert_to_db starting");
+
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((account_type_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE ID POINTER IS NULL"));
+
+ int db_id = -1;
+
+ _INFO("account_manager_account_type_add start");
+
+ guint pid = getpid();
+ _INFO("client Id = [%u]", pid);
+
+ int return_code = _account_db_open(1);
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ _ERR("_account_db_open() error, ret = %d", return_code);
+
+ goto RETURN;
+ }
+
+ int uid = getuid();
+ if (uid != 0)
+ {
+ _ERR("current daemon is not root user, uid=%d", uid);
+ goto RETURN;
+ }
+
+ _INFO("before _account_type_insert_to_db");
+ return_code = _account_type_insert_to_db((account_type_s*)account_type, &db_id);
+ _INFO("after _account_type_insert_to_db");
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ _ERR("_account_type_insert_to_db error");
+ goto RETURN;
+ }
+
+ *account_type_id = db_id;
+
+ account_type_s* account_type_data = (account_type_s*)account_type;
+ account_type_data->id = db_id;
+
+RETURN:
+ _INFO("account_manager_account_type_add end");
+
+ if( g_hAccountDB == NULL )
+ return return_code;
+
+ return_code = _account_db_close();
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
+ return_code = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return return_code;
+}
+
+ACCOUNT_INTERNAL_API int account_type_delete_by_app_id_offline(const char* app_id)
+{
+ _INFO("account_type_delete_by_app_id starting");
+
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+
+ guint pid = getpid();
+
+ _INFO("client Id = [%u]", pid);
+
+ int return_code = _account_db_open(1);
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ _ERR("_account_db_open() error, ret = %d", return_code);
+
+ goto RETURN;
+ }
+
+ int uid = getuid();
+ if (uid != 0)
+ {
+ _ERR("current daemon is not root user, uid=%d", uid);
+ goto RETURN;
+ }
+
+ _INFO("before _account_type_delete_by_app_id");
+ return_code = _account_type_delete_by_app_id(app_id);
+ _INFO("after _account_type_delete_by_app_id=[%d]", return_code);
+
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ _ERR("_account_type_delete_by_app_id error");
+ goto RETURN;
+ }
+
+RETURN:
+ _INFO("account_type_delete_by_app_id_offline end");
+
+ if( g_hAccountDB == NULL )
+ return return_code;
+
+ return_code = _account_db_close();
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
+ return_code = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return return_code;
+}
+
+static void _account_db_data_to_text(const char *textbuf, char **output)
+{
+ if (textbuf && strlen(textbuf)>0) {
+ if (*output) {
+ free(*output);
+ *output = NULL;
+ }
+ *output = strdup(textbuf);
+ }
+}
+static int _account_query_table_column_int(account_stmt pStmt, int pos)
+{
+ if(!pStmt){
+ ACCOUNT_ERROR("statement is null");
+ return -1;
+ }
+
+ if(pos < 0){
+ ACCOUNT_ERROR("invalid pos");
+ return -1;
+ }
+
+ return sqlite3_column_int(pStmt, pos);
+}
+
+static const char *_account_query_table_column_text(account_stmt pStmt, int pos)
+{
+ if(!pStmt){
+ ACCOUNT_ERROR("statement is null");
+ return NULL;
+ }
+
+ if(pos < 0){
+ ACCOUNT_ERROR("invalid pos");
+ return NULL;
+ }
+
+ return (const char*)sqlite3_column_text(pStmt, pos);
+}
+
+static void _account_convert_column_to_account(account_stmt hstmt, account_s *account_record)
+{
+ const char *textbuf = NULL;
+
+ account_record->id = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_ID);
+ ACCOUNT_DEBUG("account_record->id =[%d]", account_record->id);
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->user_name));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_EMAIL_ADDRESS);
+ _account_db_data_to_text(textbuf, &(account_record->email_address));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_DISPLAY_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->display_name));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_ICON_PATH);
+ _account_db_data_to_text(textbuf, &(account_record->icon_path));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_SOURCE);
+ _account_db_data_to_text(textbuf, &(account_record->source));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_PACKAGE_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->package_name));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_ACCESS_TOKEN);
+ _account_db_data_to_text(textbuf, &(account_record->access_token));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_DOMAIN_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->domain_name));
+
+ account_record->auth_type = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_AUTH_TYPE);
+
+ account_record->secret = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_SECRET);
+
+ account_record->sync_support = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_SYNC_SUPPORT);
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_0);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[0]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_1);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[1]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_2);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[2]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_3);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[3]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_4);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[4]));
+
+ account_record->user_data_int[0] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_0);
+ account_record->user_data_int[1] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_1);
+ account_record->user_data_int[2] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_2);
+ account_record->user_data_int[3] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_3);
+ account_record->user_data_int[4] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_4);
+}
+
+GList* _account_query_account_by_package_name(const char* package_name, int *error_code)
+{
+ _INFO("_account_query_account_by_package_name");
+
+ *error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+
+ ACCOUNT_RETURN_VAL((package_name != NULL), {*error_code = ACCOUNT_ERROR_INVALID_PARAMETER;}, NULL, ("PACKAGE NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {*error_code = ACCOUNT_ERROR_DB_NOT_OPENED;}, NULL, ("The database isn't connected."));
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE package_name=?", ACCOUNT_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ *error_code = ACCOUNT_ERROR_PERMISSION_DENIED;
+ return NULL;
+ }
+
+ int binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+
+ account_s* account_head = NULL;
+
+ ACCOUNT_CATCH_ERROR_P(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.(%s)\n", package_name));
+
+ int tmp = 0;
+
+ account_head = (account_s*) malloc(sizeof(account_s));
+ if (account_head == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ if (hstmt != NULL) {
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {*error_code = rc;}, NULL, ("finalize error"));
+ hstmt = NULL;
+ }
+ *error_code = ACCOUNT_ERROR_OUT_OF_MEMORY;
+ return NULL;
+ }
+ ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
+
+ while (rc == SQLITE_ROW) {
+ account_s* account_record = NULL;
+
+ account_record = (account_s*) malloc(sizeof(account_s));
+
+ if (account_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+ ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
+
+ _account_convert_column_to_account(hstmt, account_record);
+
+ _INFO("Adding account_list");
+ account_head->account_list = g_list_append(account_head->account_list, account_record);
+
+ rc = _account_query_step(hstmt);
+ tmp++;
+ }
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_CATCH_ERROR_P((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+/*
+ GList *iter;
+
+ tmp = g_list_length(account_head->account_list);
+
+ for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
+ account_s* testaccount = (account_s*)iter->data;
+
+ _account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
+ _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
+ }
+*/
+ *error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL)
+ {
+ rc = _account_query_finalize(hstmt);
+ if (rc != ACCOUNT_ERROR_NONE) {
+ *error_code = rc;
+ _ERR("finalize error");
+ }
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+
+ if( (*error_code != ACCOUNT_ERROR_NONE) && account_head ) {
+ _account_glist_account_free(account_head->account_list);
+ _ACCOUNT_FREE(account_head);
+ account_head = NULL;
+ }
+
+ if ((*error_code == ACCOUNT_ERROR_NONE) && account_head != NULL)
+ {
+ _INFO("Returning account_list");
+// _remove_sensitive_info_from_non_owning_account_list(getpid(), account_head->account_list);
+ GList* result = account_head->account_list;
+ _ACCOUNT_FREE(account_head);
+ return result;
+ }
+ return NULL;
+}
+
+static void _account_insert_delete_update_notification_send(char *noti_name, int pid)
+{
+ vsm_context_h ctx;
+ vsm_zone_h effective_zone, real_zone;
+
+ if (!noti_name) {
+ _ERR("Noti Name is NULL!!!!!!\n");
+ return;
+ }
+
+ //Tizen zone [[
+ ctx = vsm_create_context();
+
+ if(ctx == NULL) {
+ _ERR( "Failed to initialize domain control vsm context.");
+ return;
+ }
+
+ effective_zone = vsm_lookup_zone_by_pid(ctx, pid);
+ if(effective_zone == NULL) {
+ _ERR( "Failed vsm_lookup_zone_by_pid.");
+ return;
+ }
+
+ _INFO( "before set vsm_join_zone()");
+ real_zone = vsm_join_zone(effective_zone);
+ _INFO( "after set vsm_join_zone()");
+ //]]
+
+ _INFO("noti_type = %s", noti_name);
+
+ if (vconf_set_str(VCONFKEY_ACCOUNT_MSG_STR, noti_name) != 0) {
+ _ERR("Vconf MSG Str set FAILED !!!!!!\n");;
+ }
+
+ _INFO( "before recover vsm_join_zone()");
+ vsm_join_zone(real_zone);
+ _INFO( "after recover vsm_join_zone()");
+
+ _INFO( "before vsm_cleanup_context()");
+ vsm_cleanup_context(ctx);
+ _INFO( "after vsm_cleanup_context()");
+}
+
+int _account_delete_from_db_by_package_name_offline(const char *package_name)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret_transaction = 0;
+ bool is_success = FALSE;
+ int binding_count = 1;
+ GSList *account_id_list = NULL;
+ int ret = -1;
+
+ // It only needs list of ids, does not need to query sensitive info. So sending 0
+ GList* account_list_temp = _account_query_account_by_package_name(package_name, &ret);
+ if (account_list_temp == NULL)
+ {
+ _ERR("_account_query_account_by_package_name returned NULL");
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ _account_glist_account_free(account_list_temp);
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ if(ret != ACCOUNT_ERROR_NONE){
+ _account_glist_account_free(account_list_temp);
+ return ret;
+ }
+
+ account_list_temp = g_list_first(account_list_temp);
+ _INFO("account_list_temp length=[%d]",g_list_length(account_list_temp));
+
+ GList* iter = NULL;
+ for (iter = account_list_temp; iter != NULL; iter = g_list_next(iter))
+ {
+ _INFO("iterating account_list_temp");
+ account_s *account = NULL;
+ _INFO("Before iter->data");
+ account = (account_s*)iter->data;
+ _INFO("After iter->data");
+ if (account != NULL)
+ {
+ char id[256] = {0, };
+
+ ACCOUNT_MEMSET(id, 0, 256);
+
+ ACCOUNT_SNPRINTF(id, 256, "%d", account->id);
+
+ _INFO("Adding account id [%s]", id);
+ account_id_list = g_slist_append(account_id_list, g_strdup(id));
+ }
+ }
+
+ _account_glist_account_free(account_list_temp);
+ /* transaction control required*/
+ ret_transaction = _account_begin_transaction();
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ pthread_mutex_unlock(&account_mutex);
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ if( ret_transaction == ACCOUNT_ERROR_DATABASE_BUSY ){
+ ACCOUNT_ERROR( "database busy(%s)", _account_db_err_msg());
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_DATABASE_BUSY;
+ }else if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return ret_transaction;
+ }
+
+ /* delete custom table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ?", ACCOUNT_CUSTOM_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ if( _account_db_err_code() == SQLITE_PERM ){
+ _account_end_transaction(FALSE);
+ pthread_mutex_unlock(&account_mutex);
+ ACCOUNT_ERROR( "Access failed(%s)", _account_db_err_msg());
+ return ACCOUNT_ERROR_PERMISSION_DENIED;
+ }
+
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+
+ /* delete capability table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name = ?", CAPABILITY_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+
+ /* delete account table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name = ?", ACCOUNT_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. package_name=%s, rc=%d\n", package_name, rc));
+
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ is_success = TRUE;
+
+ hstmt = NULL;
+
+CATCH:
+ if (hstmt != NULL) {
+ rc = _account_query_finalize(hstmt);
+ ACCOUNT_RETURN_VAL((rc == ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+ hstmt = NULL;
+ }
+
+ ret_transaction = _account_end_transaction(is_success);
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("account_delete:_account_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
+ } else {
+ if (is_success == true) {
+ GSList* gs_iter = NULL;
+ for (gs_iter = account_id_list; gs_iter != NULL; gs_iter = g_slist_next(gs_iter)) {
+ char* p_tmpid = NULL;
+ p_tmpid = (char*)gs_iter->data;
+ char buf[64]={0,};
+ ACCOUNT_SNPRINTF(buf, sizeof(buf), "%s:%s", ACCOUNT_NOTI_NAME_DELETE, p_tmpid);
+ ACCOUNT_SLOGD("%s", buf);
+ _account_insert_delete_update_notification_send(buf, getpid());
+ _ACCOUNT_FREE(p_tmpid);
+ }
+ g_slist_free(account_id_list);
+ }
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+
+ _INFO("_account_delete_from_db_by_package_name_offline end");
+ return error_code;
+}
+
+ACCOUNT_INTERNAL_API int account_delete_from_db_by_package_name_offline(const char *package_name)
+{
+ _INFO("_account_delete_from_db_by_package_name_offline");
+
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
+
+ int return_code = _account_db_open(1);
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ _ERR("_account_db_open() error, ret = %d", return_code);
+
+ goto RETURN;
+ }
+
+ int uid = getuid();
+ if (uid != 0)
+ {
+ _ERR("current process user is not root, uid=%d", uid);
+ return_code = ACCOUNT_ERROR_PERMISSION_DENIED;
+ goto RETURN;
+ }
+
+ _INFO("before _account_delete_from_db_by_package_name_offline");
+ return_code = _account_delete_from_db_by_package_name_offline(package_name);
+ _INFO("after _account_delete_from_db_by_package_name_offline=[%d]", return_code);
+
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ _ERR("_account_delete_from_db_by_package_name_offline error");
+ goto RETURN;
+ }
+
+RETURN:
+ _INFO("account_delete_from_db_by_package_name_offline end");
+
+ if( g_hAccountDB == NULL )
+ return return_code;
+
+ return_code = _account_db_close();
+ if (return_code != ACCOUNT_ERROR_NONE)
+ {
+ ACCOUNT_DEBUG("_account_db_close() fail[%d]", return_code);
+ return_code = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return return_code;
+}
diff --git a/src/account_private_client.h b/src/account_private_client.h
new file mode 100644
index 0000000..ad48a28
--- /dev/null
+++ b/src/account_private_client.h
@@ -0,0 +1,49 @@
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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 __ACCOUNT_PRIVATE_CLIENT_H__
+#define __ACCOUNT_PRIVATE_CLIENT_H__
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "account-types.h"
+
+#ifdef TIZEN_PROFILE_MOBILE
+#include "mobile/account.h"
+#else
+#include "wearable/account.h"
+#endif
+
+typedef struct _account_subscribe_s
+{
+ account_event_cb account_subscription_callback;
+ void* user_data;
+}account_subscribe_s;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_PRIVATE_CLIENT_H__*/
diff --git a/accounts-svc.pc.in b/src/accounts-svc.pc.in
index 969d7bb..fead59c 100755..100644
--- a/accounts-svc.pc.in
+++ b/src/accounts-svc.pc.in
@@ -8,6 +8,6 @@ includedir=@INCLUDEDIR@
Name: accounts-svc
Description: Account DB library
Version: @VERSION@
-Requires: capi-base-common
+#Requires: capi-base-common
Libs: -L${libdir} -laccounts-svc
Cflags: -I${includedir}
diff --git a/src/utc-account.c b/src/utc-account.c
deleted file mode 100755
index 85de29c..0000000
--- a/src/utc-account.c
+++ /dev/null
@@ -1,8276 +0,0 @@
-/*
- * utc-account
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdio.h>
-#include "account.h"
-#include "account-private.h"
-#include <string.h>
-//#include <dbus/dbus.h>
-
-int account_id = 0;
-
-static void _account_free_text(char *text)
-{
- if (text) {
- free(text);
- text = NULL;
- }
-}
-
-bool _capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
-{
- char* test_type = (char*)capability_type;
- int test_value = capability_value;
-
- ACCOUNT_SLOGD("_capability_get_callback test_type = : %s\n", test_type);
- ACCOUNT_SLOGD("_capability_get_callback test_value = : %d\n", test_value);
- return TRUE;
-}
-
-int _account_get_account_info(account_h handle)
-{
- ACCOUNT_SLOGD("_account_get_callback\n");
-
- char *test_text = NULL;
-
- account_get_user_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_display_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_email_address(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_icon_path(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_source(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_package_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_domain_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_access_token(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- _account_free_text(test_text);
-
- account_get_user_text(handle, i, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
- }
-
- int test_int = -1;
-
- account_auth_type_e auth_type;
- account_get_auth_type(handle, &auth_type);
- ACCOUNT_SLOGD("account_get_auth_type : %d\n", auth_type);
-
- account_secrecy_state_e secret;
- account_get_secret(handle, &secret);
- ACCOUNT_SLOGD("account_get_secret : %d\n", secret);
-
- account_sync_state_e sync_support;
- account_get_sync_support(handle, &sync_support);
- ACCOUNT_SLOGD("account_get_sync_support : %d\n", sync_support);
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- test_int = -1;
- account_get_user_int(handle, i, &test_int);
- ACCOUNT_SLOGD("_account_get_callback : %d\n", test_int);
- }
-
- account_get_capability_all(handle, _capability_get_callback, NULL);
-
- return 0;
-}
-
-
-bool _account_get_callback(account_h handle, void* user_data)
-{
- ACCOUNT_SLOGD("_account_get_callback\n");
-
- char *test_text = NULL;
-
- account_get_user_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_display_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_email_address(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_icon_path(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_source(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_package_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_domain_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_access_token(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- _account_free_text(test_text);
-
- account_get_user_text(handle, i, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
- }
-
- int test_int = -1;
-
- account_auth_type_e auth_type;
- account_get_auth_type(handle, &auth_type);
- ACCOUNT_SLOGD("account_get_auth_type : %d\n", auth_type);
-
- account_secrecy_state_e secret;
- account_get_secret(handle, &secret);
- ACCOUNT_SLOGD("account_get_secret : %d\n", secret);
-
- account_sync_state_e sync_support;
- account_get_sync_support(handle, &sync_support);
- ACCOUNT_SLOGD("account_get_sync_support : %d\n", sync_support);
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- test_int = -1;
- account_get_user_int(handle, i, &test_int);
- ACCOUNT_SLOGD("_account_get_callback : %d\n", test_int);
- }
-
- account_get_capability_all(handle, _capability_get_callback, NULL);
-
- return TRUE;
-}
-
-static int _account_insert_test_new(void)
-{
- int ret = -1;
-
- account_h account = NULL;
- int temp_int = -1;
-
- ret = account_connect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- char temp[128];
- memset(temp, 0x00, sizeof(temp));
-
- ret = account_create(&account);
- ACCOUNT_SLOGD("account_set_user_name: Enter User Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_user_name(account, temp);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_display_name: Enter display Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_display_name(account, temp);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_domain_name: Enter domain Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_domain_name(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_email_address: Enter email Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_email_address(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_package_name: Enter package Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_package_name(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_icon_path: Enter icon path to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_icon_path(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_access_token: Enter access token to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_access_token(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_auth_type: Enter auth type to be set \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_auth_type( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_secret: Enter secret to be set \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_secret( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_sync_support: Enter sync support state \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_sync_support( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_source: Enter source to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_source(account, temp);
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_user_text [%d]: Enter user text to be set \n", i);
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_user_text(account, i, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_user_int [%d]: Enter user int to be set \n", i);
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_user_int(account, i, temp_int);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- int cap_key = -1;
- int cap_value = -1;
- int want_to_enter_more_cap = 1;
- while (want_to_enter_more_cap){
- ACCOUNT_SLOGD("account_set_capability: Enter capability key to set \n");
- if (scanf("%d", &cap_key) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- ACCOUNT_SLOGD("account_set_capability: Enter capability value to set \n");
- if (scanf("%d", &cap_value) != 1 ) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL, cap_value);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ACCOUNT_SLOGD("account_set_capability: Want to set more capabilitiy key value then enter 1 else 0 \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- if (temp_int == 1)
- want_to_enter_more_cap = 1;
- else
- want_to_enter_more_cap = 0;
- }
- int account_id = -1;
- ret = account_insert_to_db(account, &account_id);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return -1;
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return account_id;
-}
-
-#if 0
-static int _account_insert_test(void)
-{
- int ret = -1;
-
- account_h account = NULL;
-
- ACCOUNT_SLOGD("account_connect returns %d\n", ret);
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p\n", account);
-
- ret = account_set_user_name(account, "wy1115.lee");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "Wonyoung Lee");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung electronics");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "URUSA inc.");
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 888);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_ENABLED);
- //ret = account_set_capability(account, ACCOUNT_CAPABILITY_IM, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_ENABLED);
-
- int account_id = -1;
- ret = account_insert_to_db(account, &account_id);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- return -1;
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account=NULL;
-
- ACCOUNT_SLOGD("account_connect returns %d\n", ret);
-
- ret = account_create(&account);
-
- account_query_account_by_account_id(account_id, &account);
- _account_get_account_info(account);
-
- account_query_capability_by_account_id(_capability_get_callback, account_id, NULL);
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
-
- account=NULL;
-
- ACCOUNT_SLOGD("account_connect returns %d\n", ret);
-
- ret = account_create(&account);
-
- account_query_account_by_user_name(_account_get_callback, "usernamed-wy1115", NULL);
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- return account_id;
-}
-#endif
-
-static int _account_update_test_new_by_user_name(char *user_name, char *package_name)
-{
- int ret = -1;
-
- account_h account = NULL;
- int temp_int = -1;
-
- char temp[128];
- memset(temp, 0x00, sizeof(temp));
- ret = account_connect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_create(&account);
- ACCOUNT_SLOGD("account_set_user_name: Enter User Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_user_name(account, temp);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_display_name: Enter display Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_display_name(account, temp);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_domain_name: Enter domain Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_domain_name(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_email_address: Enter email Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_email_address(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_package_name: Enter package Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_package_name(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_icon_path: Enter icon path to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_icon_path(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_access_token: Enter access token to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_access_token(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_auth_type: Enter auth type to be set \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_auth_type( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_secret: Enter secret to be set \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_secret( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_sync_support: Enter sync support state \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_sync_support( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_source: Enter source to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_source(account, temp);
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_user_text [%d]: Enter user text to be set \n", i);
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_user_text(account, i, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_user_int [%d]: Enter user int to be set \n", i);
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_user_int(account, i, temp_int);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- int cap_key = -1;
- int cap_value = -1;
- int want_to_enter_more_cap = 1;
- while (want_to_enter_more_cap){
- ACCOUNT_SLOGD("account_set_capability: Enter capability key to set \n");
- if (scanf("%d", &cap_key) != 1 ) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- ACCOUNT_SLOGD("account_set_capability: Enter capability value to set \n");
- if (scanf("%d", &cap_value) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL, cap_value);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ACCOUNT_SLOGD("account_set_capability: Want to set more capabilitiy key value then enter 1 else 0 \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- if (temp_int == 1)
- want_to_enter_more_cap = 1;
- else
- want_to_enter_more_cap = 0;
- }
-
-
- ret = account_update_to_db_by_user_name(account, user_name, package_name);
-
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- return ret;
-
-}
-
-
-static int _account_update_test_new(int account_id)
-{
-
- int ret = -1;
-
- account_h account = NULL;
- int temp_int = -1;
-
- char temp[128];
- memset(temp, 0x00, sizeof(temp));
- ret = account_connect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
-
- ret = account_create(&account);
- ACCOUNT_SLOGD("account_set_user_name: Enter User Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_user_name(account, temp);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_display_name: Enter display Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_display_name(account, temp);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_domain_name: Enter domain Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_domain_name(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- memset(temp, 0x00, sizeof(temp));
- ACCOUNT_SLOGD("account_set_email_address: Enter email Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_email_address(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_package_name: Enter package Name to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_package_name(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_icon_path: Enter icon path to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_icon_path(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_access_token: Enter access token to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_access_token(account, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_auth_type: Enter auth type to be set \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_auth_type( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_secret: Enter secret to be set \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_secret( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_sync_support: Enter sync support state \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
-
- ret = account_set_sync_support( account, temp_int );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_source: Enter source to be set \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_source(account, temp);
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("account_set_user_text [%d]: Enter user text to be set \n", i);
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_user_text(account, i, temp);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- temp_int = -1;
- ACCOUNT_SLOGD("account_set_user_int [%d]: Enter user int to be set \n", i);
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- ret = account_set_user_int(account, i, temp_int);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- int cap_key = -1;
- int cap_value = -1;
- int want_to_enter_more_cap = 1;
- while (want_to_enter_more_cap){
- ACCOUNT_SLOGD("account_set_capability: Enter capability key to set \n");
- if (scanf("%d", &cap_key) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- ACCOUNT_SLOGD("account_set_capability: Enter capability value to set \n");
- if (scanf("%d", &cap_value) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL, cap_value);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ACCOUNT_SLOGD("account_set_capability: Want to set more capabilitiy key value then enter 1 else 0 \n");
- if (scanf("%d", &temp_int) != 1) {
- ACCOUNT_SLOGD("scanf Failed !!!! \n");
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- return ret;
- }
- if (temp_int == 1)
- want_to_enter_more_cap = 1;
- else
- want_to_enter_more_cap = 0;
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- return ret;
-}
-
-#if 0
-static int _account_update_test(int account_id)
-{
- int ret = - 1;
-
- account_h account = NULL;
-
- ret = account_create(&account);
-
- ret = account_set_user_name(account, "updated-wy1115");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "updated-Wonyoung Lee");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "updated-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 111);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
-
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_ENABLED);
-
- ret = account_update_to_db_by_id(account, account_id);
-
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- return ret;
-
-}
-
-static int _account_update_test_by_username()
-{
- int ret = - 1;
-
- account_h account = NULL;
-
- ret = account_create(&account);
-
- ret = account_set_user_name(account, "usernamed-wy1115");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "usernamed-Wonyoung Lee");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "usernamed-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "usernamed-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "usernamed-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "usernamed-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "usernamed-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
-
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "usernamed-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 111);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
-
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_ENABLED);
-
- ret = account_update_to_db_by_user_name(account, "updated-wy1115", "updated-com.samsung.account");
-
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- return ret;
-
-}
-
-static int _account_test_capability()
-{
- GSList* list = NULL;
- GSList* iter = NULL;
- int glist_len = 0;
-
- list = g_slist_append(list, strdup("test 1"));
- list = g_slist_append(list, strdup("test 2"));
- list = g_slist_append(list, strdup("test 3"));
- list = g_slist_append(list, strdup("test 4"));
- list = g_slist_append(list, strdup("test 5"));
- list = g_slist_append(list, strdup("test 6"));
-
- glist_len = g_slist_length( list );
-
- int capability_count = g_slist_length( list );
-
- int binding_bufsize = 2+2*(capability_count*2)+1;
-
- int binding_buf_index = 0;
- char* binding_buf = (char*)malloc(sizeof(char)*binding_bufsize);
-
- memset(binding_buf, 0, sizeof(char)*binding_bufsize);
-
- binding_buf[binding_buf_index++]='(';
-
- ACCOUNT_SLOGD("(%d)Binding buf = %s\n", __LINE__,binding_buf);
-
- int i;
-
- for(i=0;i<capability_count;i++)
- {
- /*snprintf(binding_buf+binding_buf_index, strlen(binding_buf)+2, "%s?,", binding_buf);*/
- binding_buf[binding_buf_index++]='?';
- if(i != capability_count -1)
- binding_buf[binding_buf_index++]=',';
- ACCOUNT_SLOGD("(%d)Binding buf = %s\n", __LINE__,binding_buf);
- }
-
- binding_buf[binding_buf_index]=')';
-
- ACCOUNT_SLOGD("(%d)Binding buf = %s\n", __LINE__,binding_buf);
-
- ACCOUNT_SLOGD("Length %d\n", glist_len);
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter))
- {
- char* capa;
- capa = (char *)iter->data;
- ACCOUNT_SLOGD("%s\n", (char *)iter->data);
- g_free(capa);
- }
-
-
- g_slist_free(list);
- g_free(binding_buf);
- return 0;
-}
-#endif
-
-static int utc1_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc2_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-
-
-
-static int utc3_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "11111111111111111111111111111111111 \
- 2222222222222222222222222222222222222222222222222 \
- 3333333333333333333333333333333333333333333333333\
- 4444444444444444444444444444444444444444444444444\
- 5555555555555555555555555555555555555555555555555\
- 666666666666666666666666666666666666666666666666\
- 777777777777777777777777777777777777777777777777\
- 888888888888888888888888888888888888888888888888\
- 99999999999999999999999999999999999999999999999\
- 111111111111111111111111111111111111111111111111\
- 22222222222222222222222222222222222222222222222\
- 333333333333333333333333333333333333333333333\
- 444444444444444444444444444444444444444444\
- 444444444444444444444444444444444444444444444444\
- 555555555555555555555555555555555555555555555555 \
- 66666666666666666666666666666666666666666666666666\
- 777777777777777777777777777777777777777777777777779999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\
- 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc4_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc5_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc6_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc7_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc8_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc9_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc10_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc11_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc12_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc13_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
-
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc14_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
-
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc15_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc16_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc17_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_source(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc18_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_source(account, "URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc19_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_source(account, "URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- int i;
-
- for(i=0; i<USER_TXT_CNT; i++)
- {
- ret = account_set_user_text(account, i, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc20_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_source(account, "URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- int i;
-
- for(i=0; i<USER_TXT_CNT; i++)
- {
- ret = account_set_user_text(account, i, "user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc21_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_source(account, "URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- int i;
-
- for(i=0; i<USER_TXT_CNT; i++)
- {
- ret = account_set_user_text(account, i, "user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 000);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc22_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_source(account, "URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- int i;
-
- for(i=0; i<USER_TXT_CNT; i++)
- {
- ret = account_set_user_text(account, i, "user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 888);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return account_id;
-}
-
-static int utc23_account_insert()
-{
-
- int ret = -1;
- account_h account = NULL;
- int account_id = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- ACCOUNT_SLOGD("account = %p, ret = %d \n", account, ret);
-
- ret = account_set_user_name(account, "tarun.kr");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_display_name(account, "tarun kumar");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_domain_name(account, "Samsung");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_email_address(account, "tarun.kr@samsung.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_package_name(account, "com.samsung.accounts");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_icon_path(account, "/test/test.jpg");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_set_source(account, "URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- int i;
-
- for(i=0; i<USER_TXT_CNT; i++)
- {
- ret = account_set_user_text(account, i, "user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 888);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_ENABLED);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_POST, ACCOUNT_CAPABILITY_ENABLED);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_insert_to_db(account, &account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return account_id;
-}
-
-static int utc1_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, 0);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc2_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, -999);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc3_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, 555);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc4_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc5_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc6_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc7_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc8_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-static int utc9_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc10_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc11_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc12_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc13_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc14_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc15_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc16_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc17_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc18_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH );
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc19_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc20_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc21_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- int i;
-
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, NULL);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc22_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "updated-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc23_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "updated-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, -111);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc24_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "updated-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 0);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc25_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "updated-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 111);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc26_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "updated-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 111);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc27_account_update()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- account_set_user_name(account, "updated-tarun.kr");
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_display_name(account, "updated-tarun kumar");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_domain_name(account, "updated-Samsung Facebook");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_email_address(account, "updated-urusa77@gmail.com");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_package_name(account, "updated-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_icon_path(account, "updated-icon-path");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_access_token(account, "updated-ACCESSTOKEN");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_set_source(account, "updated-URUSA inc.");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- {
- ret = account_set_user_text(account, i, "updated-user txt");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
-
- }
- for(i=0;i<USER_INT_CNT;i++)
- {
- ret = account_set_user_int(account, i, 111);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
- }
- }
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_POST, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
- ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_ENABLED);
-
- ret = account_update_to_db_by_id(account, account_id);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-bool _utc1_account_get_callback(account_h handle, void* user_data)
-{
- ACCOUNT_SLOGD("_account_get_callback handle = %s , user_data = %s \n", (char *)handle, (char *)user_data);
-
- char *test_text = NULL;
-
- account_get_user_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_display_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_email_address(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_icon_path(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_source(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_package_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_domain_name(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
-
- _account_free_text(test_text);
-
- account_get_access_token(handle, &test_text);
- ACCOUNT_SLOGD("_account_get_callback : %s\n", test_text);
- _account_free_text(test_text);
-
- int i=0, test_int=0;
-
- account_auth_type_e auth_type;
- account_get_auth_type(handle, &auth_type);
- ACCOUNT_SLOGD("account_get_auth_type : %d\n", auth_type);
-
- account_secrecy_state_e secret;
- account_get_secret(handle, &secret);
- ACCOUNT_SLOGD("account_get_secret : %d\n", secret);
-
- account_sync_state_e sync_support;
- account_get_sync_support(handle, &sync_support);
- ACCOUNT_SLOGD("account_get_sync_support : %d\n", sync_support);
-
- for(i=0;i<USER_INT_CNT;i++)
- {
- account_get_user_int(handle, i, &test_int);
- ACCOUNT_SLOGD("_account_get_callback : %d\n", test_int);
- }
-
- account_get_capability_all(handle, _capability_get_callback, NULL);
-
- return TRUE;
-}
-
-
-static int utc1_get_account_by_id()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_query_account_by_account_id(account_id, &account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- _account_get_account_info(account);
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc2_get_account_by_id()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_create(&account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_query_account_by_account_id(account_id, &account);
-
- _account_get_account_info(account);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_destroy(account);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc1_get_account_by_user_name()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_account_by_user_name(_account_get_callback, "usernamed-wy1115", NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc2_get_account_by_user_name()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- char *user_data = "test user_data";
-
- ret = account_query_account_by_user_name(_account_get_callback, "usernamed-wy1115", (void *)user_data);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc1_get_account_by_capability()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc2_get_account_by_capability()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc3_get_account_by_capability()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, -1, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc4_get_account_by_capability()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc5_get_account_by_capability()
-{
- int ret = - 1;
-
- account_h account = NULL;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, -1, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc1_get_all_accounts()
-{
- int ret = - 1;
-
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_foreach_account_from_db(_account_get_callback, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-static int utc2_get_all_accounts()
-{
- int ret = - 1;
-
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- char *user_data = "test user_data";
-
- ret = account_foreach_account_from_db(_account_get_callback, (void *)user_data);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d \n", __LINE__, ret);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d \n", __LINE__, ret);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- return 1;
-}
-
-bool _utc_capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
-{
- char* test_type = (char*)capability_type;
- int test_value = capability_value;
-
- ACCOUNT_SLOGD("_capability_get_callback test_type = : %s\n", test_type);
- ACCOUNT_SLOGD("_capability_get_callback test_value = : %d\n", test_value);
- return TRUE;
-
-}
-
-static int utc1_account_get_capability_by_account_id()
-{
- int ret = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_capability_by_account_id(_utc_capability_get_callback, account_id, NULL);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d,\n", __LINE__, ret);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return 1;
-}
-
-static int utc2_account_get_capability_by_account_id()
-{
- int ret = -1;
-
- char *user_data = "test user_data";
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_query_capability_by_account_id(_utc_capability_get_callback, account_id, (void *)user_data);
-
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return 1;
-}
-
-static int utc_account_delete_by_id()
-{
- int ret = -1;
-
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_delete_from_db_by_id(account_id);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return 1;
-}
-
-static int utc_account_delete_by_user_name()
-{
- int ret = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_delete_from_db_by_user_name("usernamed-wy1115", "usernamed-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d \n", __LINE__, ret);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d \n", __LINE__, ret);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return 1;
-}
-
-static int utc_account_delete_by_package_name()
-{
- int ret = -1;
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_delete_from_db_by_package_name("usernamed-com.samsung.account");
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d\n", __LINE__, ret);
- }
- else
- {
- ACCOUNT_SLOGD("(%d)-[Account-else loop] ret = %d\n", __LINE__, ret);
- }
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return 1;
-}
-
-static int utc_account_update_sync_status_by_id()
-{
- int ret = -1;
-
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_update_sync_status_by_id(account_id, ACCOUNT_SYNC_STATUS_IDLE);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return ret;
-}
-
-static int utc_account_get_application_capability_support()
-{
- int ret = -1;
- bool test = false;
-
- ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_get_application_capability_support("com.samsung.facebook", ACCOUNT_SUPPORTS_CAPABILITY_CONTACT, &test);
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- return ret;
-}
-
-static int utc_account_get_and_update()
-{
- int ret = -1;
- account_h account = NULL;
-
- ret = account_connect();
- ACCOUNT_SLOGD("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
-
- ret = account_create(&account);
- ACCOUNT_SLOGD("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
-
- ret = account_query_account_by_account_id( 2, &account);
- ACCOUNT_SLOGD("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
-
- ret = account_set_access_token(account, "ACCESSSSSSSSSSSSSSSSSSSFASFASDGDSFFASDFASFDSDGAASDFASDGDFDFGAFASDFASFASDFASASGSGASDFASFSADDSGASGASGGASDFASDFASGSAASDFAAAG");
- ACCOUNT_SLOGD("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
-
- ret = account_update_to_db_by_id( account, 2);
- ACCOUNT_SLOGD("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
-
- ret = account_destroy(account);
- ACCOUNT_SLOGD("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
-
- ret = account_disconnect();
- ACCOUNT_SLOGD("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
-
- return 1;
-}
-
-int main(int argc, char** argv)
-{
-#if 0
- utc_notify_account_insert_update_delete();
-#else
- int account_id = -1;
- int cap_key = -1;
- int cap_value = -1;
- int user_resp = 0;
- char temp[128];
- memset(temp, 0x00, sizeof(temp));
-
- ACCOUNT_SLOGD("\n\n**************************** Account Unit Test case Execution Suite ************************************ \n\n");
- ACCOUNT_SLOGD("1. Press 1 for account insert test \n");
- ACCOUNT_SLOGD("2. Press 2 for account update test \n");
- ACCOUNT_SLOGD("3. Press 3 for account delete test \n");
- ACCOUNT_SLOGD("4. Press 4 for query account test \n");
- if (scanf("%d", &user_resp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
-
- if (user_resp == 1) {
- ACCOUNT_SLOGD("In Account Insert Test Mode \n");
- account_id = _account_insert_test_new();
- if(account_id > 0)
- {
- ACCOUNT_SLOGD("(%d)-[Account] account insert test Success!! account id = %d\n", __LINE__, account_id);
- }
- utc_account_get_and_update();
- } else if (user_resp == 2) {
- ACCOUNT_SLOGD("In Account Update Test Mode \n");
- ACCOUNT_SLOGD("1. Press 1 to upadte account by id test \n");
- ACCOUNT_SLOGD("2. Press 2 for update account by user name test \n");
- if (scanf("%d", &user_resp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- if (user_resp == 1) {
- ACCOUNT_SLOGD("Enter Account Id to be Updated \n");
- if (scanf("%d", &account_id) != 1){
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- if (_account_update_test_new(account_id) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account update Success \n");
- else
- ACCOUNT_SLOGD("Account update Failed \n");
- } else if (user_resp == 2) {
- ACCOUNT_SLOGD("Enter Account user name to be Updated \n");
- memset(temp, 0x00, sizeof(temp));
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- char temp2[128];
- memset(temp2, 0x00, sizeof(temp2));
- ACCOUNT_SLOGD("Enter Account package name to be Updated \n");
- if (scanf("%s", temp2) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- if (_account_update_test_new_by_user_name(temp, temp2) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account update Success \n");
- else
- ACCOUNT_SLOGD("Account update Failed \n");
- } else {
- ACCOUNT_SLOGD("Wrong info entered \n");
- exit(0);
- }
- } else if (user_resp == 3) {
- ACCOUNT_SLOGD("In Account Delete Test Mode \n");
- ACCOUNT_SLOGD("1. Press 1 to delete account by id test \n");
- ACCOUNT_SLOGD("2. Press 2 to delete account by user name test \n");
- ACCOUNT_SLOGD("3. Press 3 to delete account by package name test \n");
- if (scanf("%d", &user_resp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- if (user_resp == 1) {
- ACCOUNT_SLOGD("Enter Account Id to be Deleted \n");
- if (scanf("%d", &account_id) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- int ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- if (account_delete_from_db_by_id(account_id) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account delete Success \n");
- else
- ACCOUNT_SLOGD("Account delete Failed \n");
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- } else if (user_resp == 2) {
- ACCOUNT_SLOGD("Enter Account user name to be Deleted \n");
- memset(temp, 0x00, sizeof(temp));
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- char temp2[128];
- memset(temp2, 0x00, sizeof(temp2));
- ACCOUNT_SLOGD("Enter Account package name to be Deleted \n");
- if (scanf("%s", temp2) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- int ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- if (account_delete_from_db_by_user_name(temp, temp2) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account delete Success \n");
- else
- ACCOUNT_SLOGD("Account delete Failed \n");
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- } else if (user_resp == 3) {
- ACCOUNT_SLOGD("Enter Account package name to be Deleted \n");
- memset(temp, 0x00, sizeof(temp));
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- int ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- if (account_delete_from_db_by_package_name(temp) == ACCOUNT_ERROR_NONE )
- ACCOUNT_SLOGD("Account delete Success \n");
- else
- ACCOUNT_SLOGD("Account delete Failed \n");
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
-
- } else {
- ACCOUNT_SLOGD("Wrong info entered \n");
- exit(0);
- }
-
- } else if (user_resp == 4) {
- ACCOUNT_SLOGD("In Account Query Test Mode \n");
- ACCOUNT_SLOGD("1. Press 1 to Query account by id test \n");
- ACCOUNT_SLOGD("2. Press 2 to Query account by user name test \n");
- ACCOUNT_SLOGD("3. Press 3 to Query account by package name test \n");
- ACCOUNT_SLOGD("4. Press 4 to Query account by capability test \n");
- if (scanf("%d", &user_resp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- if (user_resp == 1) {
- ACCOUNT_SLOGD("Enter Account Id to be Queried \n");
- if (scanf("%d", &account_id) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- account_h account = NULL;
- account_connect();
- account_create(&account);
- if (account_query_account_by_account_id(account_id, &account) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account Queried Successfully \n");
- else
- ACCOUNT_SLOGD("Account Queried failed \n");
- account_destroy(account);
- account_disconnect();
- } else if (user_resp == 2) {
- ACCOUNT_SLOGD("Enter Account user name to be Queried \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- int ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- if (account_query_account_by_user_name(_account_get_callback, temp, NULL) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account Queried Successfully \n");
- else
- ACCOUNT_SLOGD("Account Queried failed \n");
-
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- } else if (user_resp == 3) {
- ACCOUNT_SLOGD("Enter Account package name to be Queried \n");
- if (scanf("%s", temp) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- int ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d\n", __LINE__, ret);
- }
- if (account_query_account_by_package_name(_account_get_callback, temp, NULL) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account Queried Successfully \n");
- else
- ACCOUNT_SLOGD("Account Queried failed \n");
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- } else if (user_resp == 4) {
- ACCOUNT_SLOGD("Enter Account capability key to be Queried \n");
- if (scanf("%d", &cap_key) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- ACCOUNT_SLOGD("Enter Account capability key's value to be Queried \n");
- if (scanf("%d", &cap_value) != 1) {
- ACCOUNT_SLOGD("Scanf Failed!!!\n");
- exit(0);
- }
- int ret = account_connect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d\n", __LINE__, ret);
- }
- if (account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, cap_value, NULL) == ACCOUNT_ERROR_NONE)
- ACCOUNT_SLOGD("Account Queried Successfully \n");
- else
- ACCOUNT_SLOGD("Account Queried failed \n");
- ret = account_disconnect();
- if(ret != ACCOUNT_ERROR_NONE)
- {
- ACCOUNT_SLOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
- }
- } else {
- ACCOUNT_SLOGD("Wrong info entered \n");
- exit(0);
- }
-
- } else {
- ACCOUNT_SLOGD("Wrong info entered \n");
- exit(0);
- }
-
- //utc calls
-#if 1
- //utc insert
- utc1_account_insert();
- utc2_account_insert();
- utc3_account_insert();
- utc4_account_insert();
- utc5_account_insert();
- utc6_account_insert();
- utc7_account_insert();
- utc8_account_insert();
- utc9_account_insert();
- utc10_account_insert();
- utc11_account_insert();
- utc12_account_insert();
- utc13_account_insert();
- utc14_account_insert();
- utc15_account_insert();
- utc16_account_insert();
- utc17_account_insert();
- utc18_account_insert();
- utc19_account_insert();
- utc20_account_insert();
- utc21_account_insert();
- utc22_account_insert();
- utc23_account_insert();
-#endif
-
- //utc update
-#if 1
- utc1_account_update();
- utc2_account_update();
- utc3_account_update();
- utc4_account_update();
- utc5_account_update();
- utc6_account_update();
- utc7_account_update();
- utc8_account_update();
- utc9_account_update();
- utc10_account_update();
- utc11_account_update();
- utc12_account_update();
- utc13_account_update();
- utc14_account_update();
- utc15_account_update();
- utc16_account_update();
- utc17_account_update();
- utc18_account_update();
- utc19_account_update();
- utc20_account_update();
- utc21_account_update();
- utc22_account_update();
- utc23_account_update();
- utc24_account_update();
- utc25_account_update();
- utc26_account_update();
- utc27_account_update();
-#endif
-
- //utc get account by id
-#if 1
- utc1_get_account_by_id();
- utc2_get_account_by_id();
-#endif
-
- //utc get account by user name
-#if 1
- utc1_get_account_by_user_name();
- utc2_get_account_by_user_name();
-#endif
-
- //utc get account by capability
-#if 1
- utc1_get_account_by_capability();
- utc2_get_account_by_capability();
- utc3_get_account_by_capability();
- utc4_get_account_by_capability();
- utc5_get_account_by_capability();
-#endif
-
- //utc get all accounts
-#if 1
- utc1_get_all_accounts();
- utc2_get_all_accounts();
-#endif
-
- //utc get capability by account id
-#if 1
- utc1_account_get_capability_by_account_id();
- utc2_account_get_capability_by_account_id();
-#endif
-
- //utc update sync status by id
-#if 1
- utc_account_update_sync_status_by_id();
-#endif
-
- //utc get application capability support
-#if 1
- utc_account_get_application_capability_support();
-#endif
-
-#if 1
- utc_account_delete_by_id();
- utc_account_delete_by_user_name();
- utc_account_delete_by_package_name();
-#endif
-
-#endif
-
- return 0;
-}
-