merged a library of daemonized account from tizen_2.4. 57/37257/2 accepted/tizen/common/20150414.123233 accepted/tizen/mobile/20150324.074556 accepted/tizen/tv/20150325.003250 accepted/tizen/wearable/20150324.074044 submit/tizen_common/20150410.130622 submit/tizen_mobile/20150324.014613 submit/tizen_tv/20150324.014651 submit/tizen_wearable/20150324.014639
authorjiseob.jang <jiseob.jang@samsung.com>
Mon, 23 Mar 2015 12:41:04 +0000 (21:41 +0900)
committerjiseob.jang <jiseob.jang@samsung.com>
Tue, 24 Mar 2015 01:22:50 +0000 (10:22 +0900)
- substitute this package for "libaccounts-svc" package.

Change-Id: I0fd48bdfdae68328d2589ec36141cdeeca1bce84
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
25 files changed:
CMakeLists.txt [new file with mode: 0755]
INSTALL [new file with mode: 0755]
LICENSE [new file with mode: 0755]
TC/utc-accounts-svc.c [new file with mode: 0644]
accounts-svc.pc.in [new file with mode: 0755]
doc/account_doc.h [new file with mode: 0644]
doc/account_manager_doc.h [new file with mode: 0644]
doc_prod/account_manager_doc.h [new file with mode: 0644]
include/account-error.h [new file with mode: 0755]
include/account-types.h [new file with mode: 0755]
include/account.h [new file with mode: 0755]
include/account_PG.h [new file with mode: 0755]
include/account_internal.h [new file with mode: 0644]
include/account_product.h [new file with mode: 0755]
packaging/libaccount-service.spec [new file with mode: 0755]
src/accounts/CMakeLists.txt [new file with mode: 0755]
src/accounts/account_mgr.xml [new file with mode: 0644]
src/accounts/accounts-svc.pc.in [new file with mode: 0755]
src/accounts/client/CMakeLists.txt [new file with mode: 0755]
src/accounts/client/account.c [new file with mode: 0755]
src/accounts/client/accounts-svc.pc.in [new file with mode: 0755]
src/accounts/common/account-private.h [new file with mode: 0755]
src/accounts/common/account_ipc_marshal.c [new file with mode: 0644]
src/accounts/common/account_ipc_marshal.h [new file with mode: 0644]
src/accounts/common/dbg.h [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..b05275c
--- /dev/null
@@ -0,0 +1,11 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(accounts-svc C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+#SET(LIBDIR "\${prefix}/lib")
+#SET(INCLUDEDIR "\${prefix}/include ")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.3.0")
+
+ADD_SUBDIRECTORY(src/accounts)
diff --git a/INSTALL b/INSTALL
new file mode 100755 (executable)
index 0000000..ddf4e78
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,33 @@
+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
new file mode 100755 (executable)
index 0000000..f94008a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
+
+
diff --git a/TC/utc-accounts-svc.c b/TC/utc-accounts-svc.c
new file mode 100644 (file)
index 0000000..0466804
--- /dev/null
@@ -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/accounts-svc.pc.in b/accounts-svc.pc.in
new file mode 100755 (executable)
index 0000000..fead59c
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: accounts-svc
+Description: Account DB library
+Version: @VERSION@
+#Requires: capi-base-common
+Libs: -L${libdir} -laccounts-svc
+Cflags: -I${includedir}
diff --git a/doc/account_doc.h b/doc/account_doc.h
new file mode 100644 (file)
index 0000000..0060e5c
--- /dev/null
@@ -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
new file mode 100644 (file)
index 0000000..9d3540d
--- /dev/null
@@ -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_MANAGER_DOC_H__
+#define __ACCOUNT_MANAGER_DOC_H__
+
+/**
+ * @defgroup  CAPI_ACCOUNT_MANAGER_MODULE Account Manager
+ * @ingroup   CAPI_ACCOUNT_FRAMEWORK
+ * @brief     The account APIs provide CRUD (Create, Read, Update, Delete) account management functionality.
+ *
+ * @section   CAPI_ACCOUNT_MANAGER_HEADER Required Header
+ *  \#include <account.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_MANAGER_DOC_H__  */
diff --git a/doc_prod/account_manager_doc.h b/doc_prod/account_manager_doc.h
new file mode 100644 (file)
index 0000000..8b0cca8
--- /dev/null
@@ -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
new file mode 100755 (executable)
index 0000000..9f703ee
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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_ERROR_H__
+#define __ACCOUNT_ERROR_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @file   account-error.h
+ * @brief  This file contains ACCOUNT error definitions.
+ */
+
+//#define TIZEN_ERROR_ACCOUNT_CLASS SLP_ERROR_ACCOUNT | 0x90
+
+/**
+ *  @brief    Enumerations of error codes for ACCOUNT APIs.
+ *  @since_tizen  2.3
+ */
+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_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_e;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_ERROR_H__*/
diff --git a/include/account-types.h b/include/account-types.h
new file mode 100755 (executable)
index 0000000..ac4e5d0
--- /dev/null
@@ -0,0 +1,315 @@
+/*
+ *
+ * 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_TYPES_H__
+#define __ACCOUNT_TYPES_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/**
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @file     account-types.h
+ * @ingroup  CAPI_ACCOUNT
+ * @brief    This file defines common types and enums of ACCOUNT.
+ */
+
+/**
+ * @brief  Enumeration for the state of capability.
+ * @since_tizen  2.3
+ */
+typedef enum
+{
+    ACCOUNT_CAPABILITY_STATE_INVALID = 0, /**< Account capability is invalid */
+    ACCOUNT_CAPABILITY_DISABLED, /**< Account capability is disabled */
+    ACCOUNT_CAPABILITY_ENABLED, /**< Account capability is enabled */
+    ACCOUNT_CAPABILITY_STATE_MAX
+}
+account_capability_state_e;
+
+/**
+ * @brief  Enumeration for the state of account secrecy.
+ * @since_tizen  2.3
+ */
+typedef enum
+{
+    ACCOUNT_SECRECY_INVALID = 0, /**< Account secrecy is invalid */
+    ACCOUNT_SECRECY_INVISIBLE, /**< Account is not visible */
+    ACCOUNT_SECRECY_VISIBLE, /**< Account is visible */
+    ACCOUNT_SECRECY_MAX
+}
+account_secrecy_state_e;
+
+/**
+ * @brief  Enumeration for the account sync status.
+ * @since_tizen  2.3
+ */
+typedef enum
+{
+    ACCOUNT_SYNC_INVALID = 0, /**< Account sync is invalid */
+    ACCOUNT_SYNC_NOT_SUPPORT,  /**< Account sync not supported */
+    ACCOUNT_SYNC_STATUS_OFF, /**< Account sync supported but all synchronization functionalities are off */
+    ACCOUNT_SYNC_STATUS_IDLE, /**< Account sync support and sync status is idle */
+    ACCOUNT_SYNC_STATUS_RUNNING, /**< Account sync support and sync status is running */
+    ACCOUNT_SUPPORTS_SYNC, /**<  NOT USED, WILL BE REMOVED TO PREVENT BUILD ERROR */
+    ACCOUNT_NOT_SUPPORTS_SYNC, /**<  NOT USED, WILL BE REMOVED TO PREVENT BUILD ERROR */
+    ACCOUNT_SYNC_MAX
+}
+account_sync_state_e;
+
+/**
+ * @brief  Enumeration for the account auth type.
+ * @since_tizen  2.3
+ */
+typedef enum
+{
+    ACCOUNT_AUTH_TYPE_INVALID = 0, /**< Auth type is invalid */
+    ACCOUNT_AUTH_TYPE_XAUTH, /**< XAuth type */
+    ACCOUNT_AUTH_TYPE_OAUTH, /**< OAuth type */
+    ACCOUNT_AUTH_TYPE_CLIENT_LOGIN, /**< Client-Login type */
+    ACCOUNT_AUTH_TYPE_MAX
+}account_auth_type_e;
+
+/**
+ * @brief  Enumeration for the account auth data type.
+ * @since_tizen  2.3
+ */
+typedef enum
+{
+    ACCOUNT_AUTH_DATA_TYPE_BOOLEAN = 0, /**< Auth Data type is boolean, primitive type 'bool' */
+    ACCOUNT_AUTH_DATA_TYPE_BYTE, /**< Auth Data type is byte, primitive type 'unsigned char' */
+    ACCOUNT_AUTH_DATA_TYPE_SHORT, /**< Auth Data type is 16 bit integer, primitive type 'short int' */
+    ACCOUNT_AUTH_DATA_TYPE_USHORT, /**< Auth Data type is 16 bit unsigned integer, primitive type 'unsigned short int' */
+    ACCOUNT_AUTH_DATA_TYPE_LONG, /**< Auth Data type is 32 bit integer, primitive type 'long int' */
+    ACCOUNT_AUTH_DATA_TYPE_ULONG, /**< Auth Data type is 32 bit unsigned integer, primitive type 'unsigned long int' */
+    ACCOUNT_AUTH_DATA_TYPE_LONGLONG, /**< Auth Data type is 64 bit integer, primitive type 'long long int' */
+    ACCOUNT_AUTH_DATA_TYPE_ULONGLONG, /**< Auth Data type is 64 bit unsigned integer, primitive type 'unsigned long long int' */
+    ACCOUNT_AUTH_DATA_TYPE_DOUBLE, /**< Auth Data type is double, primitive type 'double' */
+    ACCOUNT_AUTH_DATA_TYPE_STRING /**< Auth Data type is string, primitive type 'char' */
+}account_auth_data_type_e;
+
+
+/**
+ * @brief  The structure type for the Account handle.
+ * @since_tizen  2.3
+ */
+typedef struct account_s* account_h;
+
+/**
+ * @brief  The structure type for the Account provider handle.
+ * @since_tizen  2.3
+ */
+typedef struct account_type_s* account_type_h;
+
+/**
+ * @brief  The structure type for the Account handle.
+ * @since_tizen  2.3
+ */
+typedef struct label_s* label_h;
+
+/**
+ * @brief  The structure type for the Account subscribe handle.
+ * @since_tizen  2.3
+ */
+typedef struct account_subscribe_s* account_subscribe_h;
+
+/**
+ * @brief        The insert notification type.
+ * @since_tizen  2.3
+ * @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()
+ */
+#define ACCOUNT_NOTI_NAME_INSERT        "insert"
+
+/**
+ * @brief        The update notification type.
+ * @since_tizen  2.3
+ * @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()
+ */
+#define ACCOUNT_NOTI_NAME_UPDATE        "update"
+
+/**
+ * @brief        The delete notification type.
+ * @since_tizen  2.3
+ * @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()
+ */
+#define ACCOUNT_NOTI_NAME_DELETE        "delete"
+
+/**
+ * @brief        The sync_update notification type.
+ * @since_tizen  2.3
+ * @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()
+ */
+#define ACCOUNT_NOTI_NAME_SYNC_UPDATE   "sync_update"
+
+
+/**
+ * @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
+ * @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.
+ */
+#define ACCOUNT_DATA_USERNAME                             "http://tizen.org/account/data/username"
+
+/**
+ * @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
+ * @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.
+ */
+#define ACCOUNT_DATA_ID                                   "http://tizen.org/appcontrol/data/account/id"
+
+/**
+ * @brief        This is an application launch operation name.
+ * @since_tizen  2.3
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @remarks      This capability will be exploited to use game data.
+ */
+#define ACCOUNT_SUPPORTS_CAPABILITY_GAME               "http://tizen.org/account/capability/game"
+
+/**
+ * @brief Authenticator app control must handle this operation ID if it wants to support SSO
+ * @since 2.3
+ * @see account_request_auth_token()
+ */
+#define ACCOUNT_OPERATION_GET_AUTH_TOKEN                  "http://tizen.org/appcontrol/operation/account/get_auth_token"
+
+/**
+ * @brief account_auth_data predefined key. Used by the account provider in account_auth_data_h.
+ * @since 2.3
+ */
+#define ACCOUNT_AUTHENTICATION_RESPONSE_USER_NAME "user_name"
+
+/**
+ * @brief account_auth_data predefined key. Used by the account provider in account_auth_data_h.
+ * @since 2.3
+ */
+#define ACCOUNT_AUTHENTICATION_RESPONSE_SECRET  "secret"
+
+/**
+ * @brief account_auth_data predefined key. Used by the consumer application in account_auth_data_h, to specify which mechanism to use for authentication.
+ * @since 2.3
+ */
+#define ACCOUNT_AUTH_DATA_AUTH_MECHANISM "mechanism"
+
+/**
+ * @brief Predefined app_control_h key for ACCOUNT_OPERATION_GET_AUTH_TOKEN response. Used by the account provider to propagate service provider\n
+ * specific error codes back to the consumer application. For success cases, app_control_h must not have this key
+ * @since 2.3
+ */
+#define ACCOUNT_AUTHENTICATION_ERROR_CODE "error_code"
+
+/**
+ * @brief Predefined app_control_h key for ACCOUNT_OPERATION_GET_AUTH_TOKEN response. Used by the account provider to propagate service provider\n
+ * specific error message back to the consumer application. For success cases, app_control_h must not have this key
+ * @since 2.3
+ */
+#define ACCOUNT_AUTHENTICATION_ERROR_MSG "error_msg"
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_TYPES_H__*/
+
diff --git a/include/account.h b/include/account.h
new file mode 100755 (executable)
index 0000000..959c146
--- /dev/null
@@ -0,0 +1,2140 @@
+/*
+ *
+ * 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
+ *
+ * @see        account_disconnect()
+ */
+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
+ *
+ * @see        account_disconnect()
+ */
+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
+ *
+ * @see        account_connect()
+ * @see        account_connect_readonly()
+ */
+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().
+ *
+ * @see account_connect()
+ * @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().
+ *
+ * @see account_connect()
+ * @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().
+ *
+ * @see account_connect()
+ * @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().
+ *
+ * @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(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().
+ *
+ * @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(account_h account, int account_id);
+
+/**
+ * @brief      Updates the account details to the account database without checking provider's permission.
+ *             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().
+ *
+ * @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_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().
+ *
+ * @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_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().
+ * @post  This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @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().
+ *
+ * @see account_connect()
+ * @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().
+ * @post  This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @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().
+ * @post  This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @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().
+ * @post  This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @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().
+ * @post  This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @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().
+ * @post  This function invokes capability_cb().
+ *
+ * @see account_connect()
+ * @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().
+ *
+ * @see account_connect()
+ */
+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().
+ *
+ * @see account_connect()
+ */
+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().
+ *
+ * @see account_connect()
+ * @see account_disconnect()
+ */
+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().
+ *
+ * @see account_connect()
+ * @see account_disconnect()
+ */
+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().
+ *
+ * @see account_connect()
+ * @see account_disconnect()
+ */
+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().
+ *
+ * @see account_connect()
+ * @see account_type_query_by_app_id()
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_disconnect()
+ */
+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().
+ *
+ * @see account_connect()
+ * @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().
+ *
+ * @see account_connect()
+ * @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().
+ *
+ * @see account_connect()
+ */
+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().
+ *
+ * @see account_connect()
+ */
+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().
+ *
+ * @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);
+
+/**
+ * @internal
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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
+ * @deprecated Deprecated since Tizen 2.4.\n
+ *             Don't use this api in Tizen 2.4.\n
+ *             This API hasn't been operated since Tizen 2.4 and will be removed after tizen 3.0.
+ * @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);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //__ACCOUNT_H_
diff --git a/include/account_PG.h b/include/account_PG.h
new file mode 100755 (executable)
index 0000000..c24c8c5
--- /dev/null
@@ -0,0 +1,1236 @@
+/*
+ * 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.
+ *
+ */
+
+/**
+ *
+ * @ingroup   SLP_PG
+ * @defgroup  Account_PG Account
+
+
+<h1 class="pg">Introduction</h1>
+       <h2 class="pg">Purpose of this document</h2>
+
+The purpose of this document is to describe how applications can use account APIs for handling Account's information. This document gives programming guidelines to application engineers and examples of using Account data.
+
+       <h2 class="pg">Scope</h2>
+
+The scope of this document is limited to Account API usage.
+
+
+<h1 class="pg">Account Architecture</h1>
+       <h2 class="pg"> Overview</h2>
+
+Account is responsible for inserting, deleting, and updating Account data in order to accommodate the needs for application's Account data.
+Users can access Account data without knowing DB schema, SQLite, relations of data
+
+<h1 class="pg">Account Features</h1>
+       - Similar to Sqlite3
+       - Handle information of Account
+
+       <h2 class="pg">Similar to Sqlite3</h2>
+Account API is similar to Sqlite3.
+
+       <h2 class="pg">Handle information of Account</h2>
+Account supports to insert/update/delete/get/set/query information of Account.
+The Information of Account includes user name, package name, email, access token, icon path, source, display name, capability informatio etc.
+
+<h1 class="pg">Account API Description</h1>
+
+you can refer @ref ACCOUNT_SVC
+
+<h1 class="pg">Sample Code</h1>
+
+       <h2 class="pg">Connect to Account Database</h2>
+
+Before using Account information from Account API, caller module should connect to the Account database, and after finishing with the account information, should disconnect from the Account database
+
+@code
+int account_connect(void);
+
+int account_disconnect(void);
+@endcode
+
+       <h2 class="pg">Insert information of account</h2>
+
+@code
+void insert_test(void)
+{
+   int ret = -1;
+   account_h account;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_create(&account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_user_name(account, "tarun.kr");
+
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_display_name(account, "Tarun Kumar");
+
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_domain_name(account, "Samsung electronics");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_email_address(account, "tarun@gmail.com");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_package_name(account, "com.samsung.twiter");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_icon_path(account, "icon-path");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_access_token(account, "ACCESSTOKEN");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%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)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE );
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%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)
+       {
+           SECURE_LOGD("(%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)
+       {
+           SECURE_LOGD("(%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_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)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+       return;
+   }
+
+   ret = account_destroy(account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   return;
+}
+@endcode
+
+       <h2 class="pg">Get account by id</h2>
+
+@code
+bool _capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
+{
+   char* test_type = capability_type;
+   int test_value = capability_value;
+
+   SECURE_LOGD("_capability_get_callback test_type = : %s\n", test_type);
+   SECURE_LOGD("_capability_get_callback test_value = : %d\n", test_value);
+   return TRUE;
+}
+
+static void _account_free_text(char *text)
+{
+       if (text) {
+               free(text);
+               text = NULL;
+       }
+}
+
+void get_account_by_id(int account_id)
+{
+   int ret = - 1;
+   account_h account;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_create(&account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_query_account_by_account_id(account_id, &account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   char *test_text = NULL;
+
+   account_get_user_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_display_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_email_address(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_icon_path(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_source(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_package_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_domain_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_access_token(handle, &test_text);
+   SECURE_LOGD("_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);
+          SECURE_LOGD("_account_get_callback : %s\n", test_text);
+   }
+
+   int test_int  = -1;
+
+   account_auth_type_e auth_type;
+   account_get_auth_type(handle, &auth_type);
+   SECURE_LOGD("account_get_auth_type : %d\n", auth_type);
+
+   account_secrecy_state_e secret;
+   account_get_secret(handle, &secret);
+   SECURE_LOGD("account_get_secret : %d\n", secret);
+
+   account_sync_state_e sync_support;
+   account_get_sync_support(handle, &sync_support);
+   SECURE_LOGD("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);
+          SECURE_LOGD("_account_get_callback : %d\n", test_int);
+   }
+
+   account_get_capability(handle, _capability_get_callback, NULL);
+
+   ret = account_destroy(account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+}
+@endcode
+
+
+       <h2 class="pg">Get account list by user name</h2>
+
+@code
+static void _account_free_text(char *text)
+{
+       if (text) {
+               free(text);
+               text = NULL;
+       }
+}
+
+bool _account_get_callback(account_h handle, void* user_data)
+{
+   SECURE_LOGD("_account_get_callback\n");
+
+   char *test_text = NULL;
+
+   account_get_user_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_display_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_email_address(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_icon_path(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_source(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_package_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_domain_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_access_token(handle, &test_text);
+   SECURE_LOGD("_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);
+       SECURE_LOGD("_account_get_callback : %s\n", test_text);
+   }
+
+   int test_int  = -1;
+
+   account_auth_type_e auth_type;
+   account_get_auth_type(handle, &auth_type);
+   SECURE_LOGD("account_get_auth_type : %d\n", auth_type);
+
+   account_secrecy_state_e secret;
+   account_get_secret(handle, &secret);
+   SECURE_LOGD("account_get_secret : %d\n", secret);
+
+   account_sync_state_e sync_support;
+   account_get_sync_support(handle, &sync_support);
+   SECURE_LOGD("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);
+       SECURE_LOGD("_account_get_callback : %d\n", test_int);
+   }
+
+   account_get_capability(handle, _capability_get_callback, NULL);
+
+   return TRUE;
+}
+
+
+void get_account_list_by_user_name(char * user_name)
+{
+   int ret = - 1;
+   account_h account;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_query_account_by_user_name(_account_get_callback, user_name, NULL);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+}
+@endcode
+
+       <h2 class="pg">Get account list by package name</h2>
+
+@code
+static void _account_free_text(char *text)
+{
+       if (text) {
+               free(text);
+               text = NULL;
+       }
+}
+
+bool _account_get_callback(account_h handle, void* user_data)
+{
+   SECURE_LOGD("_account_get_callback\n");
+
+   char *test_text = NULL;
+
+   account_get_user_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_display_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_email_address(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_icon_path(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_source(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_package_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_domain_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_access_token(handle, &test_text);
+   SECURE_LOGD("_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);
+       SECURE_LOGD("_account_get_callback : %s\n", test_text);
+   }
+
+   int test_int  = -1;
+
+   account_auth_type_e auth_type;
+   account_get_auth_type(handle, &auth_type);
+   SECURE_LOGD("account_get_auth_type : %d\n", auth_type);
+
+   account_secrecy_state_e secret;
+   account_get_secret(handle, &secret);
+   SECURE_LOGD("account_get_secret : %d\n", secret);
+
+   account_sync_state_e sync_support;
+   account_get_sync_support(handle, &sync_support);
+   SECURE_LOGD("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);
+       SECURE_LOGD("_account_get_callback : %d\n", test_int);
+   }
+
+   account_get_capability(handle, _capability_get_callback, NULL);
+
+   return TRUE;
+}
+
+void get_account_list_by_package_name(char * package_name)
+{
+   int ret = - 1;
+   account_h account;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_query_account_by_package_name(_account_get_callback, package_name, NULL);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+}
+@endcode
+
+       <h2 class="pg">Get all account list</h2>
+
+@code
+static void _account_free_text(char *text)
+{
+       if (text) {
+               free(text);
+               text = NULL;
+       }
+}
+
+bool _account_get_callback(account_h handle, void* user_data)
+{
+   SECURE_LOGD("_account_get_callback\n");
+
+   char *test_text = NULL;
+
+   account_get_user_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_display_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_email_address(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_icon_path(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_source(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_package_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_domain_name(handle, &test_text);
+   SECURE_LOGD("_account_get_callback : %s\n", test_text);
+
+   _account_free_text(test_text);
+
+   account_get_access_token(handle, &test_text);
+   SECURE_LOGD("_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);
+       SECURE_LOGD("_account_get_callback : %s\n", test_text);
+   }
+
+   int test_int  = -1;
+
+   account_auth_type_e auth_type;
+   account_get_auth_type(handle, &auth_type);
+   SECURE_LOGD("account_get_auth_type : %d\n", auth_type);
+
+   account_secrecy_state_e secret;
+   account_get_secret(handle, &secret);
+   SECURE_LOGD("account_get_secret : %d\n", secret);
+
+   account_sync_state_e sync_support;
+   account_get_sync_support(handle, &sync_support);
+   SECURE_LOGD("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);
+       SECURE_LOGD("_account_get_callback : %d\n", test_int);
+   }
+
+   account_get_capability(handle, _capability_get_callback, NULL);
+
+   return TRUE;
+}
+
+void get_all_account()
+{
+   int ret = - 1;
+   account_h account;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_foreach_account_from_db(_account_get_callback, NULL);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+}
+@endcode
+
+       <h2 class="pg">Update information of account by account id</h2>
+
+@code
+void update_accont_by_id(int account_id)
+{
+   int ret = -1;
+   account_h account;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_create(&account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_user_name(account, "update-tarun.kr");
+
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_display_name(account, "update-Tarun Kumar");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_domain_name(account, "update-Samsung electronics");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_email_address(account, "update-tarun@gmail.com");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_package_name(account, "update-com.samsung.twiter");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_icon_path(account, "update-icon-path");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_access_token(account, "update-ACCESSTOKEN");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%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)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+   ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE );
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+   ret = account_set_source(account, "update-URUSA inc.");
+
+   int i;
+
+   for(i=0;i<USER_TXT_CNT;i++)
+   {
+       ret = account_set_user_text(account, i, "update-user txt");
+       if(ret != ACCOUNT_ERROR_NONE)
+       {
+           SECURE_LOGD("(%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, 999);
+       if(ret != ACCOUNT_ERROR_NONE)
+       {
+           SECURE_LOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+       }
+   }
+
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_DISABLED);
+
+   ret = account_update_to_db_by_id(account, account_id);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+       return;
+   }
+
+   ret = account_destroy(account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+}
+@endcode
+
+       <h2 class="pg">Update information of account by user name</h2>
+
+@code
+void update_accont_by_user_name(char *user_name, char *package_name)
+{
+   int ret = -1;
+   account_h account;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_create(&account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_user_name(account, "update-tarun.kr");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_display_name(account, "update-Tarun Kumar");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_domain_name(account, "update-Samsung electronics");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_email_address(account, "update-tarun@gmail.com");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_package_name(account, "update-com.samsung.twiter");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_icon_path(account, "update-icon-path");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_access_token(account, "update-ACCESSTOKEN");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%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)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+   ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE );
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_set_source(account, "update-URUSA inc.");
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%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, "update-user txt");
+       if(ret != ACCOUNT_ERROR_NONE)
+       {
+           SECURE_LOGD("(%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, 999);
+       if(ret != ACCOUNT_ERROR_NONE)
+       {
+           SECURE_LOGD("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+       }
+   }
+
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_DISABLED);
+   ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_DISABLED);
+
+   ret = account_update_to_db_by_user_name(account, user_name, package_name);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+       SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+       return;
+   }
+
+   ret = account_destroy(account);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+      SECURE_LOGD("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+   }
+}
+@endcode
+
+       <h2 class="pg">Delete account by id </h2>
+
+@code
+void delete_account_by_id(int account_id)
+{
+   int ret = -1;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_delete(account_id);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+   return;
+}
+@endcode
+
+       <h2 class="pg">Update sync status by id </h2>
+
+@code
+void update_sync_status_by_id(int account_id, const account_sync_state_e sync_status)
+{
+   int ret = -1;
+
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_update_sync_status_by_id(account_id, sync_status);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+   return;
+}
+@endcode
+
+       <h2 class="pg">Delete account by user name </h2>
+
+@code
+void delete_account_by_user_name(char *user_name, char *package_name)
+{
+   int ret = -1;
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_delete_from_db_by_user_name(user_name, package_name);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d \n", __LINE__, ret);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+   return;
+}
+@endcode
+
+       <h2 class="pg">Delete account by package name </h2>
+
+@code
+void delete_account_by_package_name(char *package_name)
+{
+   int ret = -1;
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_delete_from_db_by_package_name(package_name);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d \n", __LINE__, ret);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+   return;
+}
+@endcode
+
+       <h2 class="pg">Get account insert dbus notification </h2>
+
+@code
+void notify_account_insert()
+{
+    DBusMessage* msg;
+    DBusConnection* conn;
+    DBusError err;
+
+    SECURE_LOGD("Listening for signals\n");
+
+    dbus_error_init(&err);
+
+    conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+    if  (dbus_error_is_set(&err)) {
+            dbus_error_free(&err);
+    }
+    if (NULL == conn) {
+            exit(1);
+    }
+
+    dbus_bus_add_match(conn, "type='signal',interface='account.signal.Type'", &err);
+    dbus_connection_flush(conn);
+    if  (dbus_error_is_set(&err)) {
+            exit(1);
+    }
+    SECURE_LOGD("Match rule sent\n");
+
+    while (true) {
+
+            dbus_connection_read_write(conn, 0);
+            msg = dbus_connection_pop_message(conn);
+
+            if  (NULL == msg) {
+                sleep(1);
+                continue;
+            }
+
+            if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_INSERT)) {
+                 SECURE_LOGD("Got Signal with name insert\n");
+            }
+
+            dbus_message_unref(msg);
+    }
+    dbus_connection_close(conn);
+}
+@endcode
+
+       <h2 class="pg">Get account update dbus notification </h2>
+
+@code
+void notify_account_update()
+{
+    DBusMessage* msg;
+    DBusConnection* conn;
+    DBusError err;
+
+    SECURE_LOGD("Listening for signals\n");
+
+
+    dbus_error_init(&err);
+
+    conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+    if  (dbus_error_is_set(&err)) {
+            dbus_error_free(&err);
+    }
+    if (NULL == conn) {
+            exit(1);
+    }
+
+    dbus_bus_add_match(conn, "type='signal',interface='account.signal.Type'", &err);
+    dbus_connection_flush(conn);
+    if  (dbus_error_is_set(&err)) {
+            exit(1);
+    }
+    SECURE_LOGD("Match rule sent\n");
+
+    while (true) {
+
+            dbus_connection_read_write(conn, 0);
+            msg = dbus_connection_pop_message(conn);
+
+            if  (NULL == msg) {
+                sleep(1);
+                continue;
+            }
+
+            if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_UPDATE)) {
+                SECURE_LOGD("Got Signal with name update\n");
+            }
+
+            dbus_message_unref(msg);
+    }
+    dbus_connection_close(conn);
+}
+@endcode
+
+       <h2 class="pg">Get account delete dbus notification </h2>
+
+@code
+void notify_account_delete()
+{
+    DBusMessage* msg;
+    DBusConnection* conn;
+    DBusError err;
+
+    SECURE_LOGD("Listening for signals\n");
+
+
+    dbus_error_init(&err);
+
+    conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+    if  (dbus_error_is_set(&err)) {
+            dbus_error_free(&err);
+    }
+    if (NULL == conn) {
+            exit(1);
+    }
+
+    dbus_bus_add_match(conn, "type='signal',interface='account.signal.Type'", &err);
+    dbus_connection_flush(conn);
+    if  (dbus_error_is_set(&err)) {
+            exit(1);
+    }
+    SECURE_LOGD("Match rule sent\n");
+
+    while (true) {
+
+            dbus_connection_read_write(conn, 0);
+            msg = dbus_connection_pop_message(conn);
+
+            if  (NULL == msg) {
+                sleep(1);
+                continue;
+            }
+
+            if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_DELETE)) {
+                SECURE_LOGD("Got Signal with name delete\n");
+            }
+
+            dbus_message_unref(msg);
+    }
+    dbus_connection_close(conn);
+}
+@endcode
+
+       <h2 class="pg">Get capability by acccount id</h2>
+
+@code
+bool _capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
+{
+   char* test_type = capability_type;
+   int test_value = capability_value;
+
+   SECURE_LOGD("_capability_get_callback test_type = : %s\n", test_type);
+   SECURE_LOGD("_capability_get_callback test_value = : %d\n", test_value);
+   return TRUE;
+}
+
+void capability_by_account_id(int account_id)
+{
+   int ret = -1;
+   ret = account_connect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+
+   ret = account_query_capability_by_account_id(_capability_get_callback, account_id, NULL);
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d \n", __LINE__, ret);
+   }
+
+   ret = account_disconnect();
+   if(ret != ACCOUNT_ERROR_NONE)
+   {
+          SECURE_LOGD("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+   }
+   return;
+}
+@endcode
+ * @}
+ */
+
diff --git a/include/account_internal.h b/include/account_internal.h
new file mode 100644 (file)
index 0000000..7ea09ed
--- /dev/null
@@ -0,0 +1,344 @@
+/*
+ *  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_INTERNAL_H__
+#define __ACCOUNT_INTERNAL_H__
+
+//#include <account.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @file        account_internal.h
+ * @brief       This file contains the Account API for account management.
+ */
+
+/**
+ * @internal
+ * @brief  Deletes an account from the account database by package name without permission check.
+ *
+ * @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
+ *
+ * @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_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_package_name_without_permission(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_internal(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_internal(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_internal(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_internal(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_internal(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_internal(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_internal(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_internal(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_internal(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_internal(const char* app_id);
+
+/**
+* @}
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_INTERNAL_H__ */
diff --git a/include/account_product.h b/include/account_product.h
new file mode 100755 (executable)
index 0000000..6bed522
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ *  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_PRODUCT_H__
+#define __ACCOUNT_PRODUCT_H__
+
+#include <account.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @internal
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Start to subscribe account event through the given callback function
+ *
+ * @param[in]   account_subscribe       The account subscription handle
+ * @param[in]   cb_func When an account is removed from account database. It will be called with event message and account id.
+ * @param[in]   user_data user_data will be delivered to cb_func
+ *
+ * @return      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
+ *
+ * @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);
+
+/**
+ * @brief       Start to subscribe account event through the given callback function
+ *
+ * @param[in]   account_subscribe       The account subscription handle
+ * @param[in]   cb_func When an account is removed from account database. It will be called with event message and account id.
+ * @param[in]   user_data user_data will be delivered to cb_func
+ *
+ * @return      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
+ *
+ * @see account_unsubscribe_notification()
+ * @see account_subscribe_notification()
+ */
+ACCOUNT_API int account_unsubscribe_notification_ex(account_subscribe_h account_subscribe);
+
+/**
+ * @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().
+ *
+ * @see account_connect()
+ */
+ACCOUNT_API int account_get_total_count_from_db_ex(int *count);
+
+/**
+* @}
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_PRODUCT_H__ */
diff --git a/packaging/libaccount-service.spec b/packaging/libaccount-service.spec
new file mode 100755 (executable)
index 0000000..37dc4fa
--- /dev/null
@@ -0,0 +1,74 @@
+
+Name:       libaccount-service
+Summary:    Account DB library
+Version:    0.3.0
+Release:    1
+Group:      Social & Content/API
+License:    Apache-2.0
+Source0:    libaccount-service-%{version}.tar.gz
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(dbus-1)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires: pkgconfig(glib-2.0) >= 2.26
+BuildRequires:  pkgconfig(gio-2.0)
+BuildRequires:  pkgconfig(gio-unix-2.0)
+BuildRequires:  pkgconfig(security-server)
+#BuildRequires:  dbus-python
+BuildRequires:  python-xml
+
+%description
+Account DB libraryXB-Public-Package: no
+
+%package devel
+Summary:    Development files for %{name}
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+%description devel
+Development files for %{name}
+
+%prep
+%setup -q
+
+%post
+/sbin/ldconfig
+/usr/bin/sqlite3
+
+%postun -p /sbin/ldconfig
+
+%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-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="${CFLAGS} -fPIC -fvisibility=hidden"
+#cmake . -DCMAKE_INSTALL_PREFIX=/usr
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}%{_libdir}
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+
+rm -rf %{buildroot}%{_libdir}/accounts-svc
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/*.so.*
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/accounts-svc.pc
+%{_includedir}/*.h
diff --git a/src/accounts/CMakeLists.txt b/src/accounts/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..83ddb83
--- /dev/null
@@ -0,0 +1,4 @@
+ADD_SUBDIRECTORY(client)
+
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/accounts-svc.pc.in ${CMAKE_SOURCE_DIR}/accounts-svc.pc @ONLY)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/accounts-svc.pc DESTINATION ${LIBDIR}/pkgconfig)
diff --git a/src/accounts/account_mgr.xml b/src/accounts/account_mgr.xml
new file mode 100644 (file)
index 0000000..32cf6bf
--- /dev/null
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<node name="/org/tizen/account/manager">
+  <interface name="org.tizen.account.manager">
+    <method name="account_add">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="a{sv}" name="account_data" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="i" name="account_db_id" direction="out" />
+    </method>
+    <method name="account_type_add">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="a{sv}" name="account_type_data" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="i" name="account_type_db_id" direction="out" />
+    </method>
+    <method name="account_query_all">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_data" direction="out" />
+    </method>
+    <method name="account_type_query_all">
+      <arg type="s" name="account_db_path" direction="in" />
+         <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_type_data" direction="out" />
+    </method>
+    <method name="account_delete_from_db_by_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="i" name="account_db_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_delete_from_db_by_user_name">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="user_name" direction="in" />
+      <arg type="s" name="package_name" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_delete_from_db_by_package_name">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="package_name" direction="in" />
+      <arg type="b" name="permission" direction="in" />      
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_update_to_db_by_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="a{sv}" name="account_data" direction="in" />
+      <arg type="i" name="account_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_get_total_count_from_db">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="b" name="include_hidden" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="i" name="count" direction="out" />
+    </method>
+    <method name="account_query_account_by_account_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="i" name="account_db_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="a{sv}" name="account_data" direction="out" />
+    </method>
+    <method name="account_update_to_db_by_user_name">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="a{sv}" name="account_data" direction="in" />
+      <arg type="s" name="user_name" direction="in" />
+      <arg type="s" name="package_name" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_type_query_label_by_locale">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="locale" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="s" name="label_name" direction="out" />
+    </method>
+    <method name="account_type_query_by_provider_feature">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="key" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_type_list_data" direction="out" />
+    </method>
+    <method name="account_query_account_by_user_name">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="user_name" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_list_data" direction="out" />
+    </method>
+    <method name="account_query_account_by_package_name">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="package_name" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_list_data" direction="out" />
+    </method>
+    <method name="account_query_account_by_capability">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="capability_type" direction="in" />
+      <arg type="i" name="capability_value" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_list_data" direction="out" />
+    </method>
+    <method name="account_query_account_by_capability_type">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="capability_type" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_list_data" direction="out" />
+    </method>
+    <method name="account_query_capability_by_account_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="i" name="account_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="aa{sv}" name="account_list_data" direction="out" />
+    </method>
+    <method name="account_update_sync_status_by_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="i" name="account_db_id" direction="in" />
+      <arg type="i" name="sync_status" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_type_query_provider_feature_by_app_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="a(ss)" name="feature_list_data" direction="out" />
+    </method>
+    <method name="account_type_query_supported_feature">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="capability" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="i" name="is_supported" direction="out" />
+    </method>
+    <method name="account_type_update_to_db_by_app_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="a{sv}" name="account_type_variant" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_type_delete_by_app_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_type_query_label_by_app_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="a(sss)" name="label_list_variant" direction="out" />
+    </method>
+    <method name="account_type_query_by_app_id">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+      <arg type="a{sv}" name="account_type_variant" direction="out" />
+    </method>
+    <method name="account_type_query_app_id_exist">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="s" name="app_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+    <method name="account_update_to_db_by_id_ex">
+      <arg type="s" name="account_db_path" direction="in" />
+      <arg type="a{sv}" name="account_variant" direction="in" />
+      <arg type="i" name="account_id" direction="in" />
+      <arg type="s" name="cookie" direction="in" />
+    </method>
+  </interface>
+</node>
diff --git a/src/accounts/accounts-svc.pc.in b/src/accounts/accounts-svc.pc.in
new file mode 100755 (executable)
index 0000000..fead59c
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: accounts-svc
+Description: Account DB library
+Version: @VERSION@
+#Requires: capi-base-common
+Libs: -L${libdir} -laccounts-svc
+Cflags: -I${includedir}
diff --git a/src/accounts/client/CMakeLists.txt b/src/accounts/client/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..430a32c
--- /dev/null
@@ -0,0 +1,73 @@
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+#SET(LIBDIR "\${prefix}/lib")
+#SET(INCLUDEDIR "\${prefix}/include ")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.3.0")
+
+SET(SRCS
+       account.c
+       ../common/account_ipc_marshal.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/accounts/common)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(clientpkgs REQUIRED dbus-1 dlog gobject-2.0 glib-2.0 gio-2.0 gio-unix-2.0 capi-base-common security-server vconf)
+
+FOREACH(flag ${clientpkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF ("${ARCH}" STREQUAL "arm")
+        ADD_DEFINITIONS("-DTARGET_ARM")
+        MESSAGE("[TARGET] Compile")
+ELSE  ("${ARCH}" STREQUAL "arm")
+        ADD_DEFINITIONS("-DTARGET_I386")
+        MESSAGE("[i386] Compile")
+ENDIF ("${ARCH}" STREQUAL "arm")
+
+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")
+
+ADD_CUSTOM_COMMAND(
+       WORKING_DIRECTORY
+       OUTPUT account-mgr-stub.c
+       COMMAND gdbus-codegen --interface-prefix org.tizen.
+       --generate-c-code account-mgr-stub ../account_mgr.xml
+       COMMENT "Generating Account Client GDBus .c/.h")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} account-mgr-stub.c)
+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)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}/accounts-svc)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/account.h DESTINATION include)
+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)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/account_product.h DESTINATION include)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/accounts/client/account-mgr-stub.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/accounts/common/account_ipc_marshal.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/accounts/common/account-private.h DESTINATION include)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/accounts/common/dbg.h DESTINATION include)
diff --git a/src/accounts/client/account.c b/src/accounts/client/account.c
new file mode 100755 (executable)
index 0000000..04fdc58
--- /dev/null
@@ -0,0 +1,2961 @@
+/*
+ *
+ * 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 <gio/gio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <fcntl.h>
+#include <glib/gprintf.h>
+#ifdef G_OS_UNIX
+#include <gio/gunixfdlist.h>
+#include <unistd.h>
+#endif
+#include <vconf.h>
+#include <security-server.h>
+
+#include "account.h"
+#include "account-error.h"
+#include "account-private.h"
+#include "account-types.h"
+#include "account_ipc_marshal.h"
+
+#include "dbg.h"
+#include "account-mgr-stub.h"
+
+#define ACCOUNT_DB_OPEN_READONLY 0
+#define ACCOUNT_DB_OPEN_READWRITE 1
+
+#define VCONF_OK 0
+
+#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;\
+}
+
+static AccountManager *_acc_mgr = NULL;
+
+static char *_account_get_text(const char *text_data);
+static int _account_gslist_free(GSList* list);
+static int _account_glist_free(GList* list);
+
+static int _account_free_capability_items(account_capability_s *data)
+{
+       _ACCOUNT_FREE(data->type);
+       _ACCOUNT_FREE(data->package_name);
+       _ACCOUNT_FREE(data->user_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_custom_item_free(account_custom_s *data)
+{
+       _ACCOUNT_FREE(data->app_id);
+       _ACCOUNT_FREE(data->key);
+       _ACCOUNT_FREE(data->value);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_custom_gslist_free(GSList* list)
+{
+       if(!list){
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       GSList* iter;
+
+       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);
+       }
+
+       g_slist_free(list);
+       list = NULL;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_list_free(GList* list)
+{
+       if(!list){
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       g_list_free_full(list, g_free);
+       list = NULL;
+
+       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);
+       _account_list_free(data->domain_list);
+       _account_list_free(data->mechanism_list);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_gslist_free(GSList* list)
+{
+       if(!list){
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       GSList* iter;
+
+       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);
+       }
+
+       g_slist_free(list);
+       list = NULL;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+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);
+       }
+
+       g_list_free(list);
+       list = NULL;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+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;
+}
+
+//FIXME : add true singleton logic
+AccountManager *
+_account_manager_get_instance ()
+{
+       _INFO("_account_manager_get_instance");
+       if (_acc_mgr != NULL)
+       {
+               _INFO("instance already created.");
+               return _acc_mgr;
+       }
+
+#if !GLIB_CHECK_VERSION(2,35,0)
+       g_type_init();
+#endif
+
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
+
+       connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+
+       _INFO("after g_bus_get_sync");
+
+
+       /* 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);
+       _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);
+
+               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);
+                                               return _account_svc_errors[i].error_code;
+                                       }
+                               }
+                       }
+               }
+               //All undocumented errors mapped to ACCOUNT_ERROR_PERMISSION_DENIED
+               return ACCOUNT_ERROR_PERMISSION_DENIED;
+       }
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_connect(void)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_connect_readonly(void)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_disconnect(void)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+
+ACCOUNT_API int account_insert_to_db(account_h account, int *account_db_id)
+{
+       _INFO("1. account_insert_to_db start");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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"));
+
+       _GET_COOKIE
+
+       account_s *account_data = (account_s*) account;
+       int error_code = ACCOUNT_ERROR_NONE;
+       GError *error = NULL;
+
+       _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.");
+
+       int db_id = -1;
+       GVariant* account_serialized = marshal_account(account_data);
+
+       _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);
+       ACCOUNT_CATCH_ERROR((is_success != false), {}, _account_get_error_code(is_success, error), "Failed to get dbus.");
+
+       *account_db_id = db_id;
+       account_data->id = db_id;
+
+       _INFO("4. account_insert_to_db end, added db id [%d] [%d] [%d]", db_id, *account_db_id, account_data->id);
+
+       return ACCOUNT_ERROR_NONE;
+
+CATCH:
+       //Failed to get dbus.
+       _ERR("account_manager_call_account_add_sync()=[%d]", error_code);
+
+       return error_code;
+}
+
+ACCOUNT_API int account_delete_from_db_by_id(int account_db_id)
+{
+       _INFO("1. account_delete_from_db_by_id starting [%d]", account_db_id);
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID IS LESS THAN ZERO."));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       _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)
+       {
+               _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       _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);
+       if (!is_success)
+       {
+               _ERR("account_manager_call_account_delete_from_db_by_id_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       _INFO("4. Before account_delete_from_db_by_id end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+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;
+
+       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!"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               _ERR("account_query_account_by_user_name error=[%d]", error_code);
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account_list");
+       GSList* account_list = unmarshal_account_list(account_list_variant);
+       _INFO("after unmarshal_account_list");
+       if (account_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       //TODO free account_list, account_list_variant
+
+       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);
+
+       if (!is_success)
+       {
+               _ERR("account_manager_call_account_delete_from_db_by_user_name_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+int _account_delete_from_db_by_package_name(const char *package_name, bool permission)
+{
+       _INFO("_account_delete_from_db_by_package_name starting permission opions = %d", permission);
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       //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);
+
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account_list");
+       GSList* account_list = unmarshal_account_list(account_list_variant);
+       _INFO("after unmarshal_account_list");
+       if (account_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       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);
+
+       if (!is_success)
+       {
+               _ERR("account_manager_call_account_delete_from_db_by_package_name_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name)
+{
+       _INFO("account_delete_from_db_by_package_name starting with permission");
+       return _account_delete_from_db_by_package_name(package_name, true);
+}
+
+ACCOUNT_API int account_delete_from_db_by_package_name_without_permission(const char *package_name)
+{
+       _INFO("account_delete_from_db_by_package_name starting without permission");
+       return _account_delete_from_db_by_package_name(package_name, false);
+}
+
+ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id)
+{
+       //First we will update account db
+       _INFO("1. account_update_to_db_by_id start");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       _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)
+       {
+               _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       _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);
+
+       if (!is_success)
+       {
+               _ERR("account_manager_call_account_update_to_db_by_id_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       _INFO("4. account_update_to_db_by_id end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_update_to_db_by_id_ex(account_h account, int account_id)
+{
+       int ret = -1;
+       ret = account_update_to_db_by_id(account, account_id);
+
+       return ret;
+}
+
+ACCOUNT_API int account_update_to_db_by_id_without_permission(account_h account, int account_id)
+{
+       //First we will update account db
+       //Then we will update gSSO DB, if it fails then we will rollback account db updates
+
+       _INFO("account_update_to_db_by_id_without_permission start");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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)
+       {
+               _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       _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;
+       }
+
+       _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);
+       if (!is_success)
+       {
+               _ERR("account_manager_call_account_update_to_db_by_id_ex_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       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)
+{
+       //First we will update account db
+       _INFO("account_update_to_db_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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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)
+       {
+               _ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       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);
+       if (!is_success)
+       {
+               _ERR("account_manager_call_account_update_to_db_by_user_name_sync failed [%d]", error->code);
+               return _account_get_error_code(is_success, error);
+       }
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_create(account_h *account)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)malloc(sizeof(account_s));
+
+       if (data == NULL) {
+               ACCOUNT_FATAL("Memory Allocation Failed");
+               return ACCOUNT_ERROR_OUT_OF_MEMORY;
+       }
+       ACCOUNT_MEMSET(data, 0, sizeof(account_s));
+
+       /*Setting account as visible by default*/
+       data->secret = ACCOUNT_SECRECY_VISIBLE;
+
+       /*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;
+
+       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;
+}
+
+ACCOUNT_API int account_set_user_name(account_h account, const char *user_name)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!user_name) {
+               ACCOUNT_SLOGE("(%s)-(%d) user_name is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->user_name);
+       data->user_name = _account_get_text(user_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_display_name(account_h account, const char *display_name)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!display_name) {
+               ACCOUNT_SLOGE("(%s)-(%d) display_name is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->display_name);
+       data->display_name = _account_get_text(display_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_email_address(account_h account, const char *email_address)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!email_address) {
+               ACCOUNT_SLOGE("(%s)-(%d) email_address is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->email_address);
+       data->email_address = _account_get_text(email_address);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_icon_path(account_h account, const char *icon_path)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!icon_path) {
+               ACCOUNT_SLOGE("(%s)-(%d) icon_path is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->icon_path);
+       data->icon_path = _account_get_text(icon_path);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_source(account_h account, const char *source)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!source) {
+               ACCOUNT_SLOGE("(%s)-(%d) source is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->source);
+       data->source = _account_get_text(source);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_package_name(account_h account, const char *package_name)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!package_name) {
+               ACCOUNT_SLOGE("(%s)-(%d) package_name is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->package_name);
+       data->package_name = _account_get_text(package_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_domain_name(account_h account, const char *domain_name)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!domain_name) {
+               ACCOUNT_SLOGE("(%s)-(%d) domain_name is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->domain_name);
+       data->domain_name = _account_get_text(domain_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_access_token(account_h account, const char *access_token)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!access_token) {
+               ACCOUNT_SLOGE("(%s)-(%d) access_token is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->access_token);
+       data->access_token = _account_get_text(access_token);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_user_text(account_h account, int idx, const char *user_txt)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!user_txt) {
+               ACCOUNT_SLOGE("(%s)-(%d) user_txt is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       if (idx >= USER_TXT_CNT || idx < 0) {
+               ACCOUNT_SLOGE("(%s)-(%d) idx rage should be between 0-4.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       _ACCOUNT_FREE(data->user_data_txt[idx]);
+       data->user_data_txt[idx] = _account_get_text(user_txt);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_custom(account_h account, const char* key, const char* value)
+{
+       if (!account) {
+               ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!key) {
+               ACCOUNT_SLOGE("(%s)-(%d) key is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!value) {
+               ACCOUNT_SLOGE("(%s)-(%d) value is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       GSList *iter;
+       bool b_is_new = TRUE;
+
+       for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+
+               account_custom_s* custom_data = NULL;
+               custom_data = (account_custom_s*)iter->data;
+               ACCOUNT_SLOGD( "account_custom_s->key = %s, account_custom_s->value = %s \n", custom_data->key, custom_data->value);
+
+               if(!strcmp(custom_data->key, key)) {
+                       _ACCOUNT_FREE(custom_data->value);
+                       custom_data->value = _account_get_text(value);
+                       b_is_new = FALSE;
+               }
+       }
+
+       if(b_is_new) {
+               account_custom_s* custom_data = (account_custom_s*)malloc(sizeof(account_custom_s));
+
+               if (custom_data == NULL) {
+                       return ACCOUNT_ERROR_OUT_OF_MEMORY;
+               }
+               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 ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_auth_type(account_h account, const account_auth_type_e 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_CLIENT_LOGIN)) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       data->auth_type = (int)auth_type;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_secret(account_h account, const account_secrecy_state_e secret)
+{
+       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_VISIBLE)) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       data->secret = (int)secret;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_sync_support(account_h account, const account_sync_state_e sync_support)
+{
+       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_SUPPORTS_SYNC)) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       data->sync_support= (int)sync_support;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_user_int(account_h account, int idx, const int user_int)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (idx >= USER_INT_CNT ||idx < 0) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       data->user_data_int[idx] = user_int;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_value)
+{
+       ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("account handle is null"));
+       ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type is null"));
+
+       if ((capability_value != ACCOUNT_CAPABILITY_DISABLED) && (capability_value != ACCOUNT_CAPABILITY_ENABLED)) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       GSList *iter = NULL;
+       bool b_is_new = TRUE;
+
+       for(iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+               account_capability_s *cap_data = NULL;
+               cap_data = (account_capability_s*)iter->data;
+
+               if(!strcmp(cap_data->type, capability_type)) {
+                       cap_data->value = capability_value;
+                       b_is_new = FALSE;
+                       break;
+               }
+       }
+
+       if(b_is_new) {
+               account_capability_s* cap_data = (account_capability_s*)malloc(sizeof(account_capability_s));
+
+               if (cap_data == NULL)
+                       return ACCOUNT_ERROR_OUT_OF_MEMORY;
+               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 ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_user_name(account_h account, char **user_name)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!user_name) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*user_name) = NULL;
+       *user_name = _account_get_text(data->user_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_display_name(account_h account, char **display_name)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!display_name) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*display_name) = NULL;
+
+       *display_name = _account_get_text(data->display_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_email_address(account_h account,char **email_address)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!email_address) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*email_address) = NULL;
+
+       *email_address = _account_get_text(data->email_address);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int  account_get_icon_path(account_h account, char **icon_path)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!icon_path) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*icon_path) = NULL;
+
+       *icon_path = _account_get_text(data->icon_path);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_source(account_h account, char **source)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!source) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*source) = NULL;
+
+       *source = _account_get_text(data->source);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_package_name(account_h account, char **package_name)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!package_name) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*package_name) = NULL;
+
+       *package_name = _account_get_text(data->package_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_domain_name(account_h account, char **domain_name)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!domain_name) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*domain_name) = NULL;
+
+       *domain_name = _account_get_text(data->domain_name);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_access_token(account_h account, char **access_token)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!access_token) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       (*access_token) = NULL;
+
+       *access_token = _account_get_text(data->access_token);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_user_text(account_h account, int user_text_index, char **text)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!text) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       ACCOUNT_RETURN_VAL((user_text_index >=0 && user_text_index < USER_TXT_CNT ), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
+
+       account_s *data = (account_s*)account;
+
+       (*text) = NULL;
+
+       *text = _account_get_text(data->user_data_txt[user_text_index]);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_auth_type(account_h account, account_auth_type_e *auth_type)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       if (!auth_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s* data = (account_s*)account;
+
+       *auth_type = data->auth_type;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_secret(account_h account, account_secrecy_state_e *secret)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       if (!secret) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s* data = (account_s*)account;
+
+       *secret = data->secret;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_sync_support(account_h account, account_sync_state_e *sync_support)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       if (!sync_support) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s* data = (account_s*)account;
+
+       *sync_support = data->sync_support;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_account_id(account_h account, int *account_id)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       if (!account_id) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       *account_id = data->id;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_user_int(account_h account, int user_int_index, int *integer)
+{
+       if (!account) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       ACCOUNT_RETURN_VAL((user_int_index >=0 && user_int_index < USER_TXT_CNT ), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
+
+       if (!integer) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_s *data = (account_s*)account;
+
+       *integer = data->user_data_int[user_int_index];
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value)
+{
+       ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+       ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type is NULL"));
+       ACCOUNT_RETURN_VAL((capability_value != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_value is NULL"));
+
+       GSList *iter;
+       account_s *data = (account_s*)account;
+
+       _ERR("before for()");
+       for (iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+               account_capability_s *cap_data = NULL;
+
+               cap_data = (account_capability_s*)iter->data;
+
+       _ERR("capability_type = %s, data->type = %s", capability_type, cap_data->type);
+       _ERR("capability_value = %d, data->value= %d", capability_value, cap_data->value);
+               if(!strcmp(capability_type, cap_data->type)) {
+                       *capability_value = cap_data->value;
+                       return ACCOUNT_ERROR_NONE;
+               }
+       }
+       _ERR("after for()");
+
+       return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+}
+
+ACCOUNT_API int account_get_capability_all(account_h account, capability_cb callback, void *user_data)
+{
+       ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+       ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+
+       GSList *iter;
+       account_s *data = (account_s*)account;
+
+       for (iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+               account_capability_s *cap_data = NULL;
+
+               cap_data = (account_capability_s*)iter->data;
+
+               if(callback(cap_data->type, cap_data->value, user_data)!=TRUE){
+                       return ACCOUNT_ERROR_NONE;
+               }
+       }
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_custom(account_h account, const char* key, char** value)
+{
+       ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+       ACCOUNT_RETURN_VAL((key != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO KEY TO REQUEST"));
+       ACCOUNT_RETURN_VAL((value != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("VALUE POINTER IS NULL"));
+
+       GSList *iter;
+       account_s *data = (account_s*)account;
+
+       _ERR("before for()");
+       for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+               account_custom_s *custom_data = NULL;
+
+               custom_data = (account_custom_s*)iter->data;
+
+               _ERR("key = %s, custom_data->key = %s", key, custom_data->key);
+               _ERR("value = %s, custom_data->value = %s", value, custom_data->value);
+
+               if(!strcmp(key, custom_data->key)) {
+                       (*value) = NULL;
+                       *value = _account_get_text(custom_data->value);
+                       return ACCOUNT_ERROR_NONE;
+               }
+       }
+       _ERR("after for()");
+
+       return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+}
+
+ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data)
+{
+       ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+       ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+
+       GSList *iter;
+       account_s *data = (account_s*)account;
+
+       for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+               bool cb_ret = FALSE;
+               account_custom_s *custom_data = NULL;
+
+               custom_data = (account_custom_s*)iter->data;
+
+               cb_ret = callback(custom_data->key, custom_data->value, user_data);
+               if(!cb_ret) {
+                       break;
+               }
+       }
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_data)
+{
+       _INFO("account_type_foreach_account_type_from_db start");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT Callback IS NULL"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account_list");
+       GSList* account_list = unmarshal_account_list(account_list_variant);
+       _INFO("after unmarshal_account_list");
+       GSList* 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;
+               _INFO("Before _account_query_identity_info_by_id");
+
+               _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");
+       }
+       _INFO("account_foreach_account_from_db end");
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h *account)
+{
+       _INFO("account_query_account_by_account_id start [%d]", account_db_id);
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account");
+       account_s* account_data = umarshal_account(account_variant);
+       _INFO("after unmarshal_account");
+
+       if (account_data == NULL)
+       {
+               _ERR("Failed to unmarshal");
+               return ACCOUNT_ERROR_DB_FAILED;
+       }
+
+       *account = (account_h) account_data;
+
+       _INFO("account_query_account_by_account_id end");
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data)
+{
+       _INFO("account_query_account_by_user_name starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account_list");
+       GSList* account_list = unmarshal_account_list(account_list_variant);
+       _INFO("after unmarshal_account_list");
+       if (account_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       GSList* 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;
+               if (callback((account_h)account, user_data) == false)
+               {
+                       _INFO("application callback requested to discontinue.");
+                       break;
+               }
+       }
+       _INFO("account_query_account_by_user_name end");
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data)
+{
+       _INFO("account_query_account_by_package_name starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account_list");
+       GSList* account_list = unmarshal_account_list(account_list_variant);
+       _INFO("after unmarshal_account_list");
+       if (account_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       GSList* 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;
+
+               if (callback((account_h)account, user_data) == false)
+               {
+                       _INFO("application callback requested to discontinue.");
+                       break;
+               }
+       }
+       _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)
+{
+       _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_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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account_list");
+       GSList* account_list = unmarshal_account_list(account_list_variant);
+       _INFO("after unmarshal_account_list");
+       if (account_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       GSList* 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;
+
+               if (callback((account_h)account, user_data) == false)
+               {
+                       _INFO("application callback requested to discontinue.");
+                       break;
+               }
+       }
+       _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)
+{
+       _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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _INFO("before unmarshal_account_list");
+       GSList* account_list = unmarshal_account_list(account_list_variant);
+       _INFO("after unmarshal_account_list");
+       if (account_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       GSList* 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;
+
+               if (callback((account_h)account, user_data) == false)
+               {
+                       _INFO("application callback requested to discontinue.");
+                       break;
+               }
+       }
+       _INFO("account_query_account_by_capability end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, int account_id, void *user_data)
+{
+       _INFO("account_query_capability_by_account_id starting");
+       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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       _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;
+       }
+
+       GSList* iter;
+
+       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;
+               }
+               _INFO("");
+       }
+       _INFO("account_query_capability_by_account_id end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_get_total_count(int *count, bool include_hidden)
+{
+       _INFO("account_get_total_count_from_db starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       if (!count)
+       {
+               ACCOUNT_SLOGE("(%s)-(%d) count is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       GError *error = NULL;
+
+       if (count == NULL)
+       {
+               _INFO("Invalid input");
+               return -1;
+       }
+
+       _GET_COOKIE
+
+       AccountManager* acc_mgr = _account_manager_get_instance();
+       if (acc_mgr == NULL)
+       {
+               _ERR("g_bus_get_sync failed");
+               return ACCOUNT_ERROR_PERMISSION_DENIED;
+       }
+
+       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);
+       int error_code = _account_get_error_code(is_success, error);
+       if (error_code != ACCOUNT_ERROR_NONE)
+       {
+               return error_code;
+       }
+
+       *count = temp_count;
+       _INFO("account_get_total_count_from_db end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_get_total_count_from_db(int *count)
+{
+       _INFO("account_get_total_count_from_db starting");
+
+       return _account_get_total_count(count, true);
+}
+
+ACCOUNT_API int account_get_total_count_from_db_ex(int *count)
+{
+       _INFO("account_get_total_count_from_db_ex starting");
+
+       return _account_get_total_count(count, false);
+}
+
+ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status)
+{
+       _INFO("account_update_sync_status_by_id starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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;
+       }
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+       return _account_get_error_code(is_success, error);
+}
+
+static int _account_type_free_label_items(label_s *data)
+{
+       _ACCOUNT_FREE(data->app_id);
+       _ACCOUNT_FREE(data->label);
+       _ACCOUNT_FREE(data->locale);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_gslist_free(GSList* list)
+{
+       ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist 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);
+       }
+
+       g_slist_free(list);
+       list = NULL;
+
+       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"));
+
+       GList* iter;
+
+       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_FREE(account_type_record);
+       }
+
+       g_list_free(list);
+       list = NULL;
+
+       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)
+{
+       if (!account_type) {
+               ACCOUNT_SLOGE("(%s)-(%d) account type handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)malloc(sizeof(account_type_s));
+
+       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;
+}
+
+ACCOUNT_API int account_type_destroy(account_type_h account_type)
+{
+       _INFO("account_type_destroy");
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       if (data == NULL)
+       {
+               _ERR("Account type handle is null!");
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       _account_type_free_account_type_items(data);
+       _ACCOUNT_FREE(data);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_app_id(account_type_h account_type, const char *app_id)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_app_id_internal(account_type_h account_type, const char *app_id)
+{
+       if (!account_type) {
+               ACCOUNT_SLOGE("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!app_id) {
+               ACCOUNT_SLOGE("(%s)-(%d) app_id is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       _ACCOUNT_FREE(data->app_id);
+       data->app_id = _account_get_text(app_id);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_service_provider_id_internal(account_type_h account_type, const char *service_provider_id)
+{
+       if (!account_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!service_provider_id) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       _ACCOUNT_FREE(data->service_provider_id);
+       data->service_provider_id = _account_get_text(service_provider_id);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_icon_path(account_type_h account_type, const char *icon_path)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_icon_path_internal(account_type_h account_type, const char *icon_path)
+{
+       if (!account_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!icon_path) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       _ACCOUNT_FREE(data->icon_path);
+       data->icon_path = _account_get_text(icon_path);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_small_icon_path_internal(account_type_h account_type, const char *small_icon_path)
+{
+       if (!account_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!small_icon_path) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       _ACCOUNT_FREE(data->small_icon_path);
+       data->small_icon_path = _account_get_text(small_icon_path);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_multiple_account_support_internal(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__));
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       data->multiple_account_support = multiple_account_support;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_label(account_type_h account_type, const char* label, const char* locale)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_label_internal(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__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if(!label || !locale) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+       label_s *label_data = (label_s*)malloc(sizeof(label_s));
+
+       if (label_data == NULL) {
+               return ACCOUNT_ERROR_OUT_OF_MEMORY;
+       }
+       ACCOUNT_MEMSET(label_data, 0, sizeof(label_s));
+
+       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 ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_set_provider_feature_internal(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);
+
+       if (!is_success)
+       {
+               error_code = error->code;
+               _ERR("Account IPC call returned error[%d]", error_code);
+               return error_code;
+       }
+
+       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;
+               }
+       }
+
+       _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);
+
+       if (!is_success)
+       {
+               ret = error->code;
+               _ERR("Account IPC call returned error[%d]", ret);
+               set_last_result(ret);
+               return false;
+       }
+
+       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) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!app_id) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       (*app_id) = NULL;
+       *app_id = _account_get_text(data->app_id);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id)
+{
+       if (!account_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!service_provider_id) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       (*service_provider_id) = NULL;
+       *service_provider_id = _account_get_text(data->service_provider_id);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_get_icon_path(account_type_h account_type, char **icon_path)
+{
+       if (!account_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!icon_path) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       (*icon_path) = NULL;
+       *icon_path = _account_get_text(data->icon_path);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path)
+{
+       if (!account_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!small_icon_path) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       (*small_icon_path) = NULL;
+       *small_icon_path = _account_get_text(data->small_icon_path);
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support)
+{
+       if (!account_type) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+       if (!multiple_account_support) {
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_type_s *data = (account_type_s*)account_type;
+
+       *multiple_account_support = data->multiple_account_support;
+
+       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"));
+       ACCOUNT_RETURN_VAL((label != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID PARAMETER"));
+
+       GSList *iter;
+       account_type_s *data = (account_type_s*)account_type;
+
+       for (iter = data->label_list; iter != NULL; iter = g_slist_next(iter)) {
+               label_s *label_data = NULL;
+
+               label_data = (label_s*)iter->data;
+
+               *label = NULL;
+
+               if(!strcmp(locale, label_data->locale)) {
+                       *label = _account_get_text(label_data->label);
+                       return ACCOUNT_ERROR_NONE;
+               }
+               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) {
+                                       char* converted_locale = g_strdup_printf("%s_%s", tokens[0], upper_token);
+                                       if(!strcmp(converted_locale, label_data->locale)) {
+                                               _ACCOUNT_FREE(converted_locale);
+                                               _ACCOUNT_FREE(upper_token);
+                                               g_strfreev(tokens);
+                                               *label = _account_get_text(label_data->label);
+                                               return ACCOUNT_ERROR_NONE;
+                                       }
+                                       _ACCOUNT_FREE(converted_locale);
+                               }
+                               _ACCOUNT_FREE(upper_token);
+                       }
+               }
+               g_strfreev(tokens);
+       }
+
+       return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+}
+
+ACCOUNT_API int account_type_get_label(account_type_h account_type, account_label_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->label_list; iter != NULL; iter = g_slist_next(iter)) {
+               label_s *label_data = NULL;
+
+               label_data = (label_s*)iter->data;
+
+               if(callback(label_data->app_id, label_data->label, label_data->locale, 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_insert_to_db(account_type_h account_type, int* account_type_id)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_insert_to_db_internal(account_type_h account_type, int* account_type_id)
+{
+       _INFO("account_type_insert_to_db starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       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"));
+
+       _GET_COOKIE
+
+       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 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);
+       int ret = _account_get_error_code(is_success, error);
+       if (ret != ACCOUNT_ERROR_NONE)
+       {
+               return ret;
+       }
+
+       _INFO("account_type_insert_to_db end id=[%d]", db_id);
+
+       *account_type_id = db_id;
+
+       account_type_s* account_type_data = (account_type_s*)account_type;
+       account_type_data->id = db_id;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_update_to_db_by_app_id_internal(const account_type_h account_type, const char* app_id)
+{
+       _INFO("account_type_update_to_db_by_app_id starting");
+       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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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;
+       }
+
+       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);
+       return _account_get_error_code(is_success, error);
+}
+
+ACCOUNT_API int account_type_delete_by_app_id(const char* app_id)
+{
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_delete_by_app_id_internal(const char* app_id)
+{
+       _INFO("account_type_delete_by_app_id starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       bool is_success = account_manager_call_account_type_delete_by_app_id_sync(acc_mgr, account_db_path, app_id, e_cookie, NULL, &error);
+       return _account_get_error_code(is_success, error);
+}
+
+ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data )
+{
+       _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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+       int ret = _account_get_error_code(is_success, error);
+       if (ret != ACCOUNT_ERROR_NONE)
+       {
+               return ret;
+       }
+
+       _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;
+       }
+
+       GSList* iter;
+
+       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("");
+       }
+       _INFO("account_type_query_label_by_app_id end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_query_by_app_id(const char* app_id, account_type_h *account_type)
+{
+       _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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       GVariant* account_type_variant = NULL;
+       account_type_s *in_data = (account_type_s*) (*account_type);
+
+       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);
+       int ret = _account_get_error_code(is_success, error);
+       if (ret != ACCOUNT_ERROR_NONE)
+       {
+               return ret;
+       }
+
+       _INFO("before umarshal_account_type");
+       account_type_s* received_account_type = umarshal_account_type (account_type_variant);
+       _INFO("after umarshal_account_type");
+       ACCOUNT_RETURN_VAL((received_account_type != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("INVALID DATA RECEIVED FROM SVC"));
+
+       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;
+
+       _INFO("account_type_query_by_app_id end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data)
+{
+       _INFO("account_type_foreach_account_type_from_db starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT Callback IS NULL"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+       _INFO("after account_type_query_all_sync()");
+       int ret = _account_get_error_code(is_success, error);
+       if (ret != ACCOUNT_ERROR_NONE)
+       {
+               return ret;
+       }
+
+       _INFO("before unmarshal_account_type_list");
+       GSList* account_type_list = unmarshal_account_type_list(account_type_list_variant);
+       _INFO("after unmarshal_account_type_list");
+       if (account_type_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       GSList* 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;
+
+               if (callback((account_type_h)account_type, user_data) == false)
+               {
+                       _INFO("application callback requested to discontinue.");
+                       break;
+               }
+       }
+       _INFO("account_foreach_account_from_db end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label)
+{
+       _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((locale != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO LOCALE"));
+       ACCOUNT_RETURN_VAL((label != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("label char is null"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+       _INFO("after account_type_query_label_by_locale_sync() : is_success=%d", is_success);
+       int ret = _account_get_error_code(is_success, error);
+       if (ret != ACCOUNT_ERROR_NONE)
+       {
+               return ret;
+       }
+
+       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;
+
+}
+
+ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data)
+{
+       _INFO("account_type_query_by_provider_feature 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"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       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);
+       int ret = _account_get_error_code(is_success, error);
+       if (ret != ACCOUNT_ERROR_NONE)
+       {
+               return ret;
+       }
+
+       _INFO("before unmarshal_account_type_list");
+       GSList* account_type_list = unmarshal_account_type_list(account_type_list_variant);
+       _INFO("after unmarshal_account_type_list");
+       if (account_type_list == NULL)
+       {
+               return ACCOUNT_ERROR_NO_DATA;
+       }
+
+       GSList* iter;
+
+       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;
+               }
+               _INFO("");
+       }
+       _INFO("account_type_query_by_provider_feature end");
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_type_query_app_id_exist(const char* app_id)
+{
+       _INFO("account_type_query_app_id_exist starting");
+       char* account_db_path = ACCOUNT_DB_NAME;
+
+       ACCOUNT_RETURN_VAL((app_id != 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+
+       _GET_COOKIE
+
+       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;
+       }
+
+       bool is_success = account_manager_call_account_type_query_app_id_exist_sync(acc_mgr, account_db_path, app_id, e_cookie, NULL, &error);
+
+       return _account_get_error_code(is_success, error);
+}
+
+
+static void _account_subscribe_vconf_callback(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;
+
+       if(!key) {
+               ACCOUNT_ERROR("No subscribtion msg !!!!!\n");
+               return;
+       }
+
+       if(!tmp) {
+               ACCOUNT_ERROR("user data required\n");
+               return;
+       }
+
+       if(!memcmp(vconf_keynode_get_name(key), 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) {
+               ACCOUNT_SLOGE("account is NULL.\n", __FUNCTION__, __LINE__);
+               return ACCOUNT_ERROR_INVALID_PARAMETER;
+       }
+
+       account_subscribe_s *data = (account_subscribe_s*)calloc(1,sizeof(account_subscribe_s));
+
+       if(!data) {
+               ACCOUNT_FATAL("OUT OF MEMORY\n");
+               return ACCOUNT_ERROR_OUT_OF_MEMORY;
+       }
+
+       *account_subscribe = (account_subscribe_h)data;
+
+       return ACCOUNT_ERROR_NONE;
+}
+
+ACCOUNT_API int account_subscribe_notification(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_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,
+                               (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_API int account_unsubscribe_notification(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) != 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;
+
+       if(!key) {
+               ACCOUNT_ERROR("No subscribtion msg !!!!!\n");
+               return;
+       }
+
+       if(!tmp) {
+               ACCOUNT_ERROR("user data required\n");
+               return;
+       }
+
+       if(!memcmp(vconf_keynode_get_name(key), 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_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;
+}
+
+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_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);
+
+       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;
+}
diff --git a/src/accounts/client/accounts-svc.pc.in b/src/accounts/client/accounts-svc.pc.in
new file mode 100755 (executable)
index 0000000..fead59c
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: accounts-svc
+Description: Account DB library
+Version: @VERSION@
+#Requires: capi-base-common
+Libs: -L${libdir} -laccounts-svc
+Cflags: -I${includedir}
diff --git a/src/accounts/common/account-private.h b/src/accounts/common/account-private.h
new file mode 100755 (executable)
index 0000000..83b5f80
--- /dev/null
@@ -0,0 +1,359 @@
+/*
+ *  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_H__
+#define __ACCOUNT_PRIVATE_H__
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <glib.h>
+#include <dlog.h>
+#include <dbus/dbus.h>
+
+#include "account.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_CATCH_ERROR_P(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_sso_access_list_s
+{
+       GList *acl;
+}account_sso_access_list_s;
+
+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, ...] */
+//     char*           auth_method;
+       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;
+       GList*          domain_list;
+       GList*          mechanism_list;
+//     account_sso_access_list_s *acl;
+}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;
+
+typedef struct _account_auth_data_s
+{
+       GVariant* auth_data;
+}account_auth_data_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_METHOD,
+       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 struct GSList          account_iterator_s;
+
+#define ACCOUNT_SSO_MAX_LIST_COUNT 100
+#define ACCOUNT_SSO_MAX_APP_NAME_LENGTH 128
+
+#define _ACCOUNT_SVC_ERROR_DOMAIN "accounts-svc"
+#define _ACCOUNT_SVC_ERROR_PREFIX "org.tizen.account.manager.Error"
+
+#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"
+
+#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"
+
+#define FACEBOOK_SDK_APPID "com.samsung.facebook-service"
+#define FACEBOOK_APPID "com.samsung.facebook"
+
+//Used by both accounts and gtme. However as of now, gtme does not have any dependency on account, so duplicating the same
+#define MAX_SYS_CONTEXT_SIZE 1024
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_PRIVATE_H__*/
diff --git a/src/accounts/common/account_ipc_marshal.c b/src/accounts/common/account_ipc_marshal.c
new file mode 100644 (file)
index 0000000..ba903f0
--- /dev/null
@@ -0,0 +1,1489 @@
+/*
+ *
+ * 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>     //snprintf
+#include <stdlib.h> //calloc
+#include <string.h>
+#include "account_ipc_marshal.h"
+
+#include "dbg.h"
+
+#define ACCOUNT_DATA_KEY_ID "id"
+#define ACCOUNT_DATA_KEY_USER_NAME "user_name"
+#define ACCOUNT_DATA_KEY_EMAIL "email_address"
+#define ACCOUNT_DATA_KEY_DISPLAY_NAME "display_name"
+#define ACCOUNT_DATA_KEY_ICON_PATH "icon_path"
+#define ACCOUNT_DATA_KEY_SOURCE "source"
+#define ACCOUNT_DATA_KEY_PACKAGE_NAME "package_name"
+#define ACCOUNT_DATA_KEY_ACCESS_TOKEN "access_token"
+#define ACCOUNT_DATA_KEY_DOMAIN_NAME "domain_name"
+#define ACCOUNT_DATA_KEY_AUTH_TYPE "auth_type"
+#define ACCOUNT_DATA_KEY_SECRET "secret"
+#define ACCOUNT_DATA_KEY_SYNC_SUPPORT "sync_support"
+#define ACCOUNT_DATA_KEY_USER_DATA_INT "user_data_int"
+#define ACCOUNT_DATA_KEY_USER_DATA_TXT "user_data_txt"
+#define ACCOUNT_DATA_KEY_CAPABILITY_LIST "capability_list"
+#define ACCOUNT_DATA_KEY_ACCOUNT_LIST "account_list"
+#define ACCOUNT_DATA_KEY_CUSTOM_LIST "custom_list"
+
+#define ACCOUNT_TYPE_DATA_KEY_ID "id"
+#define ACCOUNT_TYPE_DATA_KEY_APP_ID "app_id"
+#define ACCOUNT_TYPE_DATA_KEY_SERVICE_PROVIDER_ID "service_provider_id"
+#define ACCOUNT_TYPE_DATA_KEY_ICON_PATH "icon_path"
+#define ACCOUNT_TYPE_DATA_KEY_SMALL_ICON_PATH "small_icon_path"
+#define ACCOUNT_TYPE_DATA_KEY_MULTI_SUPPORT "multiple_account_support"
+#define ACCOUNT_TYPE_DATA_KEY_LABEL_LIST "label_list"
+#define ACCOUNT_TYPE_DATA_KEY_ACC_TYPE_LIST "account_type_list"
+#define ACCOUNT_TYPE_DATA_KEY_PROVIDER_FEATURE_LIST "provider_feature_list"
+
+#define ACCOUNT_CAPABILITY_DATA_KEY_ID "id"
+#define ACCOUNT_CAPABILITY_DATA_KEY_TYPE "type"
+#define ACCOUNT_CAPABILITY_DATA_KEY_VALUE "value"
+#define ACCOUNT_CAPABILITY_DATA_KEY_PACKAGE_NAME "package_name"
+#define ACCOUNT_CAPABILITY_DATA_KEY_USER_NAME "user_name"
+#define ACCOUNT_CAPABILITY_DATA_KEY_ACC_ID "account_id"
+
+#define ACCOUNT_CUSTOM_DATA_KEY_ACC_ID "account_id"
+#define ACCOUNT_CUSTOM_DATA_KEY_APP_ID "app_id"
+#define ACCOUNT_CUSTOM_DATA_KEY_KEY "key"
+#define ACCOUNT_CUSTOM_DATA_KEY_VALUE "value"
+
+static label_s*
+_variant_to_label(GVariant *variant)
+{
+       gchar *app_id = NULL;
+       gchar *label = NULL;
+       gchar *locale = NULL;
+
+       g_return_val_if_fail (variant != NULL, NULL);
+
+       g_variant_get (variant, "(sss)", &app_id, &label, &locale);
+
+       label_s* label_data = (label_s*) calloc(1, sizeof(label_s));
+       label_data->app_id = g_strdup(app_id);
+       label_data->label = g_strdup(label);
+       label_data->locale = g_strdup(locale);
+
+       g_free (app_id);
+       g_free (label);
+       g_free (locale);
+
+       return label_data;
+}
+
+GSList*
+variant_to_label_list(GVariant *variant)
+{
+       GSList *list = NULL;
+       GVariantIter iter;
+       GVariant *value;
+
+       g_return_val_if_fail (variant != NULL, NULL);
+
+       g_variant_iter_init (&iter, variant);
+       while ((value = g_variant_iter_next_value (&iter))) {
+               list = g_slist_append (list,
+                                                         _variant_to_label(value));
+               g_variant_unref (value);
+       }
+
+       return list;
+}
+
+
+static GVariant *
+_label_to_variant (label_s *label_data)
+{
+       GVariant *variant;
+
+       g_return_val_if_fail (label_data != NULL, NULL);
+
+       variant = g_variant_new ("(sss)",
+                                                        label_data->app_id ? label_data->app_id : "",
+                                                        label_data->label ? label_data->label : "",
+                                                        label_data->locale ? label_data->locale : "");
+
+       return variant;
+}
+
+GVariant *
+label_list_to_variant (GSList *list)
+{
+       GVariantBuilder builder;
+       GVariant *variant;
+       label_s *label_data;
+
+       GSList* iter;
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+       for (iter = list ; iter != NULL; iter = g_slist_next (iter))
+       {
+               label_data = (label_s*) (iter->data);
+               g_variant_builder_add_value (
+                                                                       &builder,
+                                                                       _label_to_variant(label_data));
+       }
+       variant = g_variant_builder_end (&builder);
+
+       return variant;
+}
+
+
+static provider_feature_s*
+_variant_to_provider_feature(GVariant *variant)
+{
+       gchar *key = NULL;
+       gchar *app_id = NULL;
+
+       g_return_val_if_fail (variant != NULL, NULL);
+
+       g_variant_get (variant, "(ss)", &key, &app_id);
+
+       provider_feature_s* provider_feature_data = (provider_feature_s*) calloc(1, sizeof(provider_feature_s));
+       provider_feature_data->key = g_strdup(key);
+       provider_feature_data->app_id = g_strdup(app_id);
+
+       g_free (key);
+       g_free (app_id);
+
+       return provider_feature_data;
+}
+
+GSList*
+variant_to_provider_feature_list(GVariant *variant)
+{
+       GSList *list = NULL;
+       GVariantIter iter;
+       GVariant *value;
+
+       g_return_val_if_fail (variant != NULL, NULL);
+
+       g_variant_iter_init (&iter, variant);
+       while ((value = g_variant_iter_next_value (&iter))) {
+               list = g_slist_append (list,
+                                                         _variant_to_provider_feature(value));
+               g_variant_unref (value);
+       }
+
+       return list;
+}
+
+static GVariant *
+_provider_feature_to_variant (const provider_feature_s *pro_feature_data)
+{
+       GVariant *variant;
+
+       g_return_val_if_fail (pro_feature_data != NULL, NULL);
+
+       variant = g_variant_new ("(ss)",
+                                                        pro_feature_data->key ? pro_feature_data->key : "",
+                                                        pro_feature_data->app_id ? pro_feature_data->app_id : "");
+
+       return variant;
+}
+
+GVariant *
+provider_feature_list_to_variant (GSList *list)
+{
+       GVariantBuilder builder;
+       GVariant *variant;
+       provider_feature_s *provider_feature_data;
+
+       GSList* iter;
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+       for (iter = list ; iter != NULL; iter = g_slist_next (iter)) {
+               provider_feature_data = (provider_feature_s *) (iter->data);
+               g_variant_builder_add_value (
+                                                                       &builder,
+                                                                       _provider_feature_to_variant(provider_feature_data));
+       }
+       variant = g_variant_builder_end (&builder);
+
+       return variant;
+}
+
+GVariant *
+marshal_account(const account_s* account)
+{
+       _INFO("_marshal_account start");
+
+       const account_s* in_data = account;
+       GVariantBuilder builder;
+       int i;
+
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
+
+       g_variant_builder_add (&builder, "{sv}",
+                                                  ACCOUNT_DATA_KEY_ID,
+                                                  g_variant_new_int32 (in_data->id));
+
+       _INFO("in_data->id=[%d]", in_data->id);
+
+       if (in_data->user_name != NULL)
+       {
+               _INFO("user name");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_USER_NAME,
+                                                          g_variant_new_string (in_data->user_name));
+       }
+       if (in_data->email_address != NULL)
+       {
+               _INFO("email");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_EMAIL,
+                                                          g_variant_new_string (in_data->email_address));
+       }
+       if (in_data->display_name != NULL)
+       {
+               _INFO("user display name");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_DISPLAY_NAME,
+                                                          g_variant_new_string (in_data->display_name));
+       }
+       if (in_data->icon_path != NULL)
+       {
+               _INFO("icon path");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_ICON_PATH,
+                                                          g_variant_new_string (in_data->icon_path));
+       }
+       if (in_data->source != NULL)
+       {
+               _INFO("source");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_SOURCE,
+                                                          g_variant_new_string (in_data->source));
+       }
+       if (in_data->package_name != NULL)
+       {
+               _INFO("pkg name");
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_PACKAGE_NAME,
+                                                          g_variant_new_string (in_data->package_name));
+       }
+       if (in_data->access_token != NULL)
+       {
+               _INFO("acc token");
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_ACCESS_TOKEN,
+                                                          g_variant_new_string (in_data->access_token));
+       }
+       if (in_data->domain_name != NULL)
+       {
+               _INFO("domain");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_DOMAIN_NAME,
+                                                          g_variant_new_string (in_data->domain_name));
+       }
+
+       _INFO("auth_type = %d", in_data->auth_type);
+       g_variant_builder_add (&builder, "{sv}", ACCOUNT_DATA_KEY_AUTH_TYPE, g_variant_new_int32 (in_data->auth_type));
+
+       _INFO("secret = %d", in_data->secret);
+       g_variant_builder_add (&builder, "{sv}", ACCOUNT_DATA_KEY_SECRET, g_variant_new_int32 (in_data->secret));
+
+       _INFO("sync_support = %d", in_data->sync_support);
+       g_variant_builder_add (&builder, "{sv}", ACCOUNT_DATA_KEY_SYNC_SUPPORT, g_variant_new_int32 (in_data->sync_support));
+
+       _INFO("user_data_int");
+       for(i=0; i<USER_INT_CNT; i++)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                               ACCOUNT_DATA_KEY_USER_DATA_INT,
+                               marshal_user_int_array((const int*) in_data->user_data_int));
+       }
+
+       _INFO("user_data_txt");
+       for(i=0; i<USER_TXT_CNT; i++)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                               ACCOUNT_DATA_KEY_USER_DATA_TXT,
+                               marshal_user_txt_array((char* const*)in_data->user_data_txt));
+       }
+
+       if (in_data->capablity_list != NULL)
+       {
+               _INFO("capablity_list");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_CAPABILITY_LIST,
+                                                          marshal_capability_list (in_data->capablity_list));
+       }
+
+       if (in_data->custom_list != NULL)
+       {
+               _INFO("custom_list");
+
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_DATA_KEY_CUSTOM_LIST,
+                                                          marshal_custom_list (in_data->custom_list));
+       }
+
+       //TODO: add support for rest
+
+       _INFO("__marshal_account end");
+
+       return g_variant_builder_end (&builder);
+}
+
+account_s* umarshal_account(GVariant* in_data)
+{
+       _INFO("");
+
+       if (in_data == NULL)
+       {
+               _ERR("Null input");
+               return NULL;
+       }
+
+       GVariant* temp_var = in_data;
+       gchar* print_type = NULL;
+       print_type = g_variant_print(temp_var, TRUE);
+       if (print_type == NULL)
+       {
+               _ERR("Invalid input");
+               return NULL;
+       }
+       _INFO("input=%s", print_type);
+
+       account_s* account = (account_s*)calloc(1, sizeof(account_s));
+       if (account == NULL)
+       {
+               _ERR("Out of memory");
+               return NULL;
+       }
+
+       _INFO("");
+
+       GVariantIter iter;
+       gchar *key = NULL;
+       GVariant *value = NULL;
+
+       _INFO("");
+       g_variant_iter_init (&iter, in_data);
+       _INFO("");
+       while (g_variant_iter_next (&iter, "{sv}", &key, &value))
+       {
+               _INFO("[%s]", key);
+
+               if (!strcmp(key, ACCOUNT_DATA_KEY_ID))
+               {
+                       _INFO("");
+
+                       account->id = g_variant_get_int32 (value);
+                       _INFO("id = %d", account->id);
+               }
+
+               if (!strcmp(key, ACCOUNT_DATA_KEY_USER_NAME))
+               {
+                       _INFO("");
+                       account->user_name = g_strdup(g_variant_get_string (value, NULL));
+                       _INFO("unmarshaled user name=[%s]", account->user_name);
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_EMAIL))
+               {
+                       _INFO("");
+                       account->email_address = g_strdup(g_variant_get_string (value, NULL));
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_DISPLAY_NAME))
+               {
+                       _INFO("");
+
+                       account->display_name = g_strdup(g_variant_get_string (value, NULL));
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_ICON_PATH))
+               {
+                       _INFO("");
+
+                       account->icon_path = g_strdup(g_variant_get_string (value, NULL));
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_SOURCE))
+               {
+                       _INFO("");
+
+                       account->source = g_strdup(g_variant_get_string (value, NULL));
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_PACKAGE_NAME))
+               {
+                       _INFO("");
+
+                       account->package_name = g_strdup(g_variant_get_string (value, NULL));
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_ACCESS_TOKEN))
+               {
+                       _INFO("");
+
+                       account->access_token = g_strdup(g_variant_get_string (value, NULL));
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_DOMAIN_NAME))
+               {
+                       _INFO("");
+
+                       account->domain_name = g_strdup(g_variant_get_string (value, NULL));
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_AUTH_TYPE))
+               {
+                       _INFO("");
+
+                       account->auth_type = g_variant_get_int32 (value);
+                       _INFO("auth_type = %d", account->auth_type);
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_SECRET))
+               {
+                       _INFO("");
+
+                       account->secret = g_variant_get_int32 (value);
+                       _INFO("secret = %d", account->secret);
+               }
+
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_SYNC_SUPPORT))
+               {
+                       account->sync_support = g_variant_get_int32 (value);
+                       _INFO("sync_support = %d", account->sync_support);
+               }
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_USER_DATA_INT))
+               {
+                       int i;
+                       int* tmp_user_ints = unmarshal_user_int_array(value);
+                       for(i=0; i<USER_INT_CNT; i++)
+                       {
+                               account->user_data_int[i] = tmp_user_ints[i];
+                       }
+                       _ACCOUNT_FREE(tmp_user_ints);
+               }
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_USER_DATA_TXT))
+               {
+                       int i;
+                       char** tmp_user_txts = unmarshal_user_txt_array(value);
+                       for(i=0; i<USER_TXT_CNT; i++)
+                       {
+                               account->user_data_txt[i] = strdup(tmp_user_txts[i]);
+                               _ACCOUNT_FREE(tmp_user_txts[i]);
+                       }
+                       _ACCOUNT_FREE(tmp_user_txts);
+               }
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_CAPABILITY_LIST))
+               {
+                       account->capablity_list = unmarshal_capability_list (value);
+                       _INFO("unmarshalled capablity_list");
+               }
+               else if (!strcmp(key, ACCOUNT_DATA_KEY_CUSTOM_LIST))
+               {
+                       account->custom_list = unmarshal_custom_list (value);
+                       _INFO("unmarshalled custom_list");
+               }
+               //TODO: support for rest
+       }
+
+       return account;
+}
+
+GVariant* marshal_account_list_double(GList* account_list)
+{
+       _INFO("marshal_account_list start");
+       if (account_list == NULL)
+       {
+               _ERR("input NULL.");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+       account_s *account_data;
+
+       GList* iter;
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+       for (iter = account_list ; iter != NULL; iter = g_list_next (iter))
+       {
+               _INFO("iterating account_list");
+               account_data = (account_s *) (iter->data);
+               g_variant_builder_add_value(&builder, marshal_account(account_data));
+               _INFO("end one iteration of account_list");
+       }
+       _INFO("marshal_account_list end");
+       return g_variant_builder_end (&builder);
+}
+
+GVariant* marshal_account_list(GSList* account_list)
+{
+       _INFO("marshal_account_list start");
+       if (account_list == NULL)
+       {
+               _ERR("input NULL.");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+       account_s *account_data;
+
+       GSList* iter;
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+       for (iter = account_list ; iter != NULL; iter = g_slist_next (iter))
+       {
+               _INFO("iterating account_list");
+               account_data = (account_s *) (iter->data);
+               g_variant_builder_add_value(&builder, marshal_account(account_data));
+               _INFO("end one iteration of account_list");
+       }
+       _INFO("marshal_account_list end");
+       return g_variant_builder_end (&builder);
+}
+
+GSList* unmarshal_account_list(GVariant* variant)
+{
+       _INFO("");
+       GSList *list = NULL;
+       GVariantIter iter;
+       GVariantIter* iter_row = NULL;
+       const gchar *key = NULL;
+       GVariant *value = NULL;
+
+       if (variant == NULL)
+       {
+               _ERR("input NULL");
+               return NULL;
+       }
+
+       _INFO ("type %s", g_variant_get_type_string (variant));
+       gchar* var_type = g_variant_print (variant, TRUE);
+       _INFO("var_type = %s", var_type);
+
+       _INFO("before iter");
+       g_variant_iter_init (&iter, variant);
+       _INFO("after iter");
+
+       _INFO("g_variant_iter_n_children=%d", g_variant_iter_n_children (&iter));
+
+       while (g_variant_iter_next (&iter, "a{sv}", &iter_row))
+       {
+               _INFO("");
+               account_s* account = (account_s*)calloc(1, sizeof(account_s));
+
+               while (g_variant_iter_loop(iter_row, "{sv}", &key, &value))
+               {
+                       if (!g_strcmp0(key, ACCOUNT_DATA_KEY_ID))
+                       {
+                               _INFO("");
+
+                               account->id = g_variant_get_int32 (value);
+                               _INFO("id = %d", account->id);
+                       }
+
+                       if (!g_strcmp0(key, ACCOUNT_DATA_KEY_USER_NAME))
+                       {
+                               account->user_name = g_strdup(g_variant_get_string(value, NULL));
+                               _INFO("[%s]", account->user_name);
+                       }
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_EMAIL))
+                       {
+                               _INFO("");
+                               account->email_address = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_DISPLAY_NAME))
+                       {
+                               _INFO("");
+
+                               account->display_name = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_ICON_PATH))
+                       {
+                               _INFO("");
+
+                               account->icon_path = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_SOURCE))
+                       {
+                               _INFO("");
+
+                               account->source = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_PACKAGE_NAME))
+                       {
+                               _INFO("");
+
+                               account->package_name = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_ACCESS_TOKEN))
+                       {
+                               _INFO("");
+
+                               account->access_token = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_DOMAIN_NAME))
+                       {
+                               _INFO("");
+
+                               account->domain_name = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_AUTH_TYPE))
+                       {
+                               _INFO("");
+
+                               account->auth_type = g_variant_get_int32 (value);
+                               _INFO("auth_type = %d", account->auth_type);
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_SECRET))
+                       {
+                               _INFO("");
+
+                               account->secret = g_variant_get_int32 (value);
+                               _INFO("secret = %d", account->secret);
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_DATA_KEY_SYNC_SUPPORT))
+                       {
+                               account->sync_support = g_variant_get_int32 (value);
+                               _INFO("sync_support = %d", account->sync_support);
+                       }
+                       else if (!strcmp(key, ACCOUNT_DATA_KEY_USER_DATA_INT))
+                       {
+                               int i;
+                               int* tmp_user_ints = unmarshal_user_int_array(value);
+                               for(i=0; i<USER_INT_CNT; i++)
+                               {
+                                       account->user_data_int[i] = tmp_user_ints[i];
+                               }
+                               _ACCOUNT_FREE(tmp_user_ints);
+                       }
+                       else if (!strcmp(key, ACCOUNT_DATA_KEY_USER_DATA_TXT))
+                       {
+                               int i;
+                               char** tmp_user_txts = unmarshal_user_txt_array(value);
+                               for(i=0; i<USER_TXT_CNT; i++)
+                               {
+                                       account->user_data_txt[i] = strdup(tmp_user_txts[i]);
+                                       _ACCOUNT_FREE(tmp_user_txts[i]);
+                               }
+                               _ACCOUNT_FREE(tmp_user_txts);
+                       }
+                       else if (!strcmp(key, ACCOUNT_DATA_KEY_CAPABILITY_LIST))
+                       {
+                               account->capablity_list = unmarshal_capability_list (value);
+                               _INFO("unmarshalled capablity_list");
+                       }
+                       else if (!strcmp(key, ACCOUNT_DATA_KEY_CUSTOM_LIST))
+                       {
+                               account->custom_list = unmarshal_custom_list (value);
+                               _INFO("unmarshalled custom_list");
+                       }
+               }
+               list = g_slist_append (list, account);
+               _INFO("");
+
+       }
+
+       _INFO("");
+       return list;
+}
+
+GVariant* marshal_account_type_list(GSList* account_type_list)
+{
+       _INFO("marshal_account_type_list start");
+       if (account_type_list == NULL)
+       {
+               _ERR("input NULL.");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+       account_type_s *account_type_data = NULL;
+
+       GSList* iter;
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+       for (iter = account_type_list ; iter != NULL; iter = g_slist_next (iter))
+       {
+               _INFO("iterating account_type_list");
+               account_type_data = (account_type_s *) (iter->data);
+               g_variant_builder_add_value(&builder, marshal_account_type((account_type_s*)account_type_data));
+               _INFO("end one iteration of account_type_list");
+       }
+       _INFO("marshal_account_type_list end");
+       return g_variant_builder_end (&builder);
+}
+
+account_s* create_empty_account_instance(void)
+{
+       account_s *data = (account_s*)malloc(sizeof(account_s));
+
+       if (data == NULL)
+       {
+               ACCOUNT_ERROR("Memory Allocation Failed");
+               return NULL;
+       }
+
+       ACCOUNT_MEMSET(data, 0, sizeof(account_s));
+
+       data->id = -1;
+       data->user_name = NULL;
+       data->email_address = NULL;
+       data->display_name = NULL;
+       data->icon_path = NULL;
+       data->source = NULL;
+       data->package_name = NULL;
+       data->access_token = NULL;
+       data->domain_name = NULL;
+       data->auth_type = 0;
+       data->secret = 0;
+       data->sync_support = false;
+       data->capablity_list = NULL;
+       data->account_list = false;
+       data->custom_list = false;
+
+       return data;
+}
+
+account_type_s* create_empty_account_type_instance(void)
+{
+       account_type_s *data = (account_type_s*)malloc(sizeof(account_type_s));
+
+       if (data == NULL)
+       {
+               ACCOUNT_ERROR("Memory Allocation Failed");
+               return NULL;
+       }
+
+       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;
+
+       return data;
+}
+
+GSList* unmarshal_account_type_list(GVariant* variant)
+{
+       _INFO("");
+       GSList *list = NULL;
+       GVariantIter iter;
+       GVariantIter* iter_row = NULL;
+       const gchar *key = NULL;
+       GVariant *value = NULL;
+
+       if (variant == NULL)
+       {
+               _ERR("input NULL");
+               return NULL;
+       }
+
+       _INFO ("type %s", g_variant_get_type_string (variant));
+       gchar* var_type = g_variant_print (variant, TRUE);
+       _INFO("var_type = %s", var_type);
+
+       _INFO("before iter");
+       g_variant_iter_init (&iter, variant);
+       _INFO("after iter");
+
+       _INFO("g_variant_iter_n_children=%d", g_variant_iter_n_children (&iter));
+
+       while (g_variant_iter_next (&iter, "a{sv}", &iter_row))
+       {
+               _INFO("");
+               account_type_s* account_type = create_empty_account_type_instance();
+
+               while (g_variant_iter_loop(iter_row, "{sv}", &key, &value))
+               {
+                       if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_ID))
+                       {
+                               account_type->id = g_variant_get_int32(value);
+                       }
+                       else if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_APP_ID))
+                       {
+                               _INFO("");
+                               account_type->app_id = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_SERVICE_PROVIDER_ID))
+                       {
+                               _INFO("");
+                               account_type->service_provider_id = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_ICON_PATH))
+                       {
+                               _INFO("");
+                               account_type->icon_path = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_SMALL_ICON_PATH))
+                       {
+                               _INFO("");
+                               account_type->small_icon_path = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_MULTI_SUPPORT))
+                       {
+                               _INFO("");
+                               account_type->multiple_account_support = g_variant_get_int32 (value);
+                       }
+                       else if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_LABEL_LIST))
+                       {
+                               _INFO("");
+                               account_type->label_list = variant_to_label_list(value);
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_TYPE_DATA_KEY_PROVIDER_FEATURE_LIST))
+                       {
+                               _INFO("");
+                               account_type->provider_feature_list = variant_to_provider_feature_list(value);
+                       }
+
+               }
+               list = g_slist_append (list, account_type);
+               _INFO("");
+
+       }
+
+       _INFO("");
+       return list;
+}
+
+GVariant* marshal_account_type(const account_type_s* account_type)
+{
+       _INFO("marshal_account_type start");
+       if (account_type == NULL)
+       {
+               _ERR("NULL input");
+               return NULL;
+       }
+
+       const account_type_s* in_data = account_type;
+       GVariantBuilder builder;
+
+
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
+
+
+       if (in_data->app_id != NULL)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_TYPE_DATA_KEY_APP_ID,
+                                                          g_variant_new_string (in_data->app_id));
+       }
+
+       if (in_data->service_provider_id != NULL)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_TYPE_DATA_KEY_SERVICE_PROVIDER_ID,
+                                                          g_variant_new_string (in_data->service_provider_id));
+       }
+
+       if (in_data->icon_path != NULL)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_TYPE_DATA_KEY_ICON_PATH,
+                                                          g_variant_new_string (in_data->icon_path));
+       }
+
+       if (in_data->small_icon_path != NULL)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_TYPE_DATA_KEY_SMALL_ICON_PATH,
+                                                          g_variant_new_string (in_data->small_icon_path));
+       }
+
+       if (in_data->multiple_account_support == false)
+       {
+               _INFO("Multi account support false");
+               g_variant_builder_add (&builder, "{sv}", ACCOUNT_TYPE_DATA_KEY_MULTI_SUPPORT,
+                                                  g_variant_new_int32 (0));
+       }
+       else
+       {
+               _INFO("Multi account support true");
+               g_variant_builder_add (&builder, "{sv}", ACCOUNT_TYPE_DATA_KEY_MULTI_SUPPORT,
+                                                  g_variant_new_int32 (1));
+       }
+
+       if (in_data->label_list != NULL)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_TYPE_DATA_KEY_LABEL_LIST,
+                                                          label_list_to_variant(in_data->label_list));
+       }
+
+       if (in_data->provider_feature_list != NULL)
+       {
+               g_variant_builder_add (&builder, "{sv}",
+                                                          ACCOUNT_TYPE_DATA_KEY_PROVIDER_FEATURE_LIST,
+                                                          provider_feature_list_to_variant(in_data->provider_feature_list));
+       }
+
+
+       _INFO("__marshal_account_type end");
+
+       return g_variant_builder_end (&builder);
+}
+
+account_type_s* umarshal_account_type(GVariant* in_data)
+{
+       if (in_data == NULL)
+       {
+               _ERR("Null input");
+               return NULL;
+       }
+
+       account_type_s* account_type = (account_type_s*)calloc(1, sizeof(account_type_s));
+       if (account_type == NULL)
+       {
+               _ERR("Out of memory");
+               return NULL;
+       }
+
+       GVariantIter iter;
+       gchar *key = NULL;
+       GVariant *value = NULL;
+
+       g_variant_iter_init (&iter, in_data);
+       while (g_variant_iter_next (&iter, "{sv}", &key, &value))
+       {
+               _INFO("[%s]", key);
+
+               if (!strcmp(key, ACCOUNT_TYPE_DATA_KEY_APP_ID))
+               {
+                       _INFO("");
+                       account_type->app_id = g_strdup(g_variant_get_string (value, NULL));
+
+               }
+
+               else if (!strcmp(key, ACCOUNT_TYPE_DATA_KEY_SERVICE_PROVIDER_ID))
+               {
+                       _INFO("");
+                       account_type->service_provider_id = g_strdup(g_variant_get_string (value, NULL));
+
+               }
+
+               else if (!strcmp(key, ACCOUNT_TYPE_DATA_KEY_ICON_PATH))
+               {
+                       _INFO("");
+
+                       account_type->icon_path = g_strdup(g_variant_get_string (value, NULL));
+
+               }
+
+               else if (!strcmp(key, ACCOUNT_TYPE_DATA_KEY_SMALL_ICON_PATH))
+               {
+                       _INFO("");
+
+                       account_type->small_icon_path = g_strdup(g_variant_get_string (value, NULL));
+
+               }
+
+               else if (!strcmp(key, ACCOUNT_TYPE_DATA_KEY_MULTI_SUPPORT))
+               {
+                       _INFO("");
+
+                       account_type->multiple_account_support = g_variant_get_int32 (value);
+
+               }
+
+               else if (!strcmp(key, ACCOUNT_TYPE_DATA_KEY_LABEL_LIST))
+               {
+                       _INFO("");
+
+                       account_type->label_list = variant_to_label_list(value);
+
+               }
+
+               else if (!strcmp(key, ACCOUNT_TYPE_DATA_KEY_PROVIDER_FEATURE_LIST))
+               {
+                       _INFO("");
+
+                       account_type->provider_feature_list = variant_to_provider_feature_list(value);
+
+               }
+
+       }
+       //TODO: support for collections
+
+       return account_type;
+}
+
+GVariant* marshal_account_capability(account_capability_s* capability)
+{
+       _INFO("marshal_account_capability start");
+
+       if (capability == NULL)
+       {
+               _ERR("Null input");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+       g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
+
+       g_variant_builder_add(&builder, "{sv}",
+                                                 ACCOUNT_CAPABILITY_DATA_KEY_ID, g_variant_new_int32(capability->id));
+
+       if (capability->type != NULL)
+       {
+               _INFO("capability->type = %s", capability->type);
+               g_variant_builder_add(&builder, "{sv}",
+                                                         ACCOUNT_CAPABILITY_DATA_KEY_TYPE, g_variant_new_string(capability->type));
+
+       }
+
+       _INFO("capability->value = %d", capability->value);
+       g_variant_builder_add(&builder, "{sv}",
+                                                 ACCOUNT_CAPABILITY_DATA_KEY_VALUE, g_variant_new_int32(capability->value));
+
+       if (capability->package_name != NULL)
+       {
+               g_variant_builder_add(&builder, "{sv}",
+                                                         ACCOUNT_CAPABILITY_DATA_KEY_PACKAGE_NAME, g_variant_new_string(capability->package_name));
+
+       }
+
+       if (capability->user_name != NULL)
+       {
+               g_variant_builder_add(&builder, "{sv}",
+                                                         ACCOUNT_CAPABILITY_DATA_KEY_USER_NAME, g_variant_new_string(capability->user_name));
+
+       }
+
+       g_variant_builder_add(&builder, "{sv}",
+                                                 ACCOUNT_CAPABILITY_DATA_KEY_ACC_ID, g_variant_new_int32(capability->account_id));
+
+       _INFO("marshal_account_capability end");
+
+       return g_variant_builder_end(&builder);
+}
+
+GVariant* marshal_capability_list(GSList* capability_list)
+{
+       _INFO("marshal_capability_list start");
+       if (capability_list == NULL)
+       {
+               _ERR("input NULL.");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+       account_capability_s *account_capability_data = NULL;
+
+       GSList* iter;
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+       for (iter = capability_list ; iter != NULL; iter = g_slist_next (iter))
+       {
+               _INFO("iterating capability_list");
+               account_capability_data = (account_capability_s *) (iter->data);
+               g_variant_builder_add_value(&builder, marshal_account_capability(account_capability_data));
+               _INFO("end one iteration of capability_list");
+       }
+       _INFO("marshal_capability_list end");
+       return g_variant_builder_end (&builder);
+}
+
+GVariant* marshal_account_custom(account_custom_s* custom)
+{
+       _INFO("marshal_account_custom start");
+
+       if (custom == NULL)
+       {
+               _ERR("Null input");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+       g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
+
+       g_variant_builder_add(&builder, "{sv}",
+                                                 ACCOUNT_CUSTOM_DATA_KEY_ACC_ID, g_variant_new_int32(custom->account_id));
+
+       if (custom->app_id != NULL)
+       {
+               g_variant_builder_add(&builder, "{sv}",
+                                                         ACCOUNT_CUSTOM_DATA_KEY_APP_ID, g_variant_new_string(custom->app_id));
+
+       }
+
+       if (custom->key != NULL)
+       {
+               _INFO("custom->key = %s", custom->key);
+               g_variant_builder_add(&builder, "{sv}",
+                                                         ACCOUNT_CUSTOM_DATA_KEY_KEY, g_variant_new_string(custom->key));
+
+       }
+
+       if (custom->value != NULL)
+       {
+               _INFO("custom->value = %s", custom->value);
+               g_variant_builder_add(&builder, "{sv}",
+                                                         ACCOUNT_CUSTOM_DATA_KEY_VALUE, g_variant_new_string(custom->value));
+
+       }
+
+       _INFO("marshal_account_custom end");
+
+       return g_variant_builder_end(&builder);
+}
+
+GVariant* marshal_custom_list(GSList* custom_list)
+{
+       _INFO("marshal_custom_list start");
+       if (custom_list == NULL)
+       {
+               _ERR("input NULL.");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+       account_custom_s *account_custom_data = NULL;
+
+       GSList* iter;
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+       for (iter = custom_list ; iter != NULL; iter = g_slist_next (iter))
+       {
+               _INFO("iterating custom_list");
+               account_custom_data = (account_custom_s *) (iter->data);
+               g_variant_builder_add_value(&builder, marshal_account_custom(account_custom_data));
+               _INFO("end one iteration of custom_list");
+       }
+       _INFO("marshal_custom_list end");
+       return g_variant_builder_end (&builder);
+}
+
+GSList* unmarshal_capability_list(GVariant* variant)
+{
+       _INFO("unmarshal_capability_list start");
+       GSList *list = NULL;
+       GVariantIter iter;
+       GVariantIter* iter_row = NULL;
+       const gchar *key = NULL;
+       GVariant *value = NULL;
+
+       if (variant == NULL)
+       {
+               _ERR("input NULL");
+               return NULL;
+       }
+
+       gchar* var_type = g_variant_print (variant, TRUE);
+       _INFO("var_type = %s", var_type);
+
+       _INFO("before iter");
+       g_variant_iter_init (&iter, variant);
+       _INFO("after iter");
+
+       _INFO("g_variant_iter_n_children=%d", g_variant_iter_n_children (&iter));
+
+       while (g_variant_iter_next (&iter, "a{sv}", &iter_row))
+       {
+               _INFO("");
+               account_capability_s* account_capability = (account_capability_s*)calloc(1, sizeof(account_capability_s));
+
+               while (g_variant_iter_loop(iter_row, "{sv}", &key, &value))
+               {
+                       if (!g_strcmp0(key, ACCOUNT_CAPABILITY_DATA_KEY_ID))
+                       {
+                               account_capability->id = g_variant_get_int32(value);
+                               _INFO("[%d]", account_capability->id);
+                       }
+                       else if (!g_strcmp0(key, ACCOUNT_CAPABILITY_DATA_KEY_TYPE))
+                       {
+                               _INFO("account_capability->type = %s", value);
+                               account_capability->type = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_CAPABILITY_DATA_KEY_VALUE))
+                       {
+                               _INFO("account_capability->value = %s", value);
+
+                               account_capability->value = g_variant_get_int32(value);
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_CAPABILITY_DATA_KEY_PACKAGE_NAME))
+                       {
+                               _INFO("");
+
+                               account_capability->package_name = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_CAPABILITY_DATA_KEY_USER_NAME))
+                       {
+                               _INFO("");
+
+                               account_capability->user_name = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_CAPABILITY_DATA_KEY_ACC_ID))
+                       {
+                               _INFO("");
+
+                               account_capability->account_id = g_variant_get_int32(value);
+                       }
+
+               }
+               list = g_slist_append (list, account_capability);
+               _INFO("");
+
+       }
+
+       _INFO("unmarshal_capability_list end");
+       return list;
+}
+
+GSList* unmarshal_custom_list(GVariant* variant)
+{
+       _INFO("unmarshal_custom_list start");
+       GSList *list = NULL;
+       GVariantIter iter;
+       GVariantIter* iter_row = NULL;
+       const gchar *key = NULL;
+       GVariant *value = NULL;
+
+       if (variant == NULL)
+       {
+               _ERR("input NULL");
+               return NULL;
+       }
+
+       gchar* var_type = g_variant_print (variant, TRUE);
+       _INFO("var_type = %s", var_type);
+
+       _INFO("before iter");
+       g_variant_iter_init (&iter, variant);
+       _INFO("after iter");
+
+       _INFO("g_variant_iter_n_children=%d", g_variant_iter_n_children (&iter));
+
+       while (g_variant_iter_next (&iter, "a{sv}", &iter_row))
+       {
+               _INFO("");
+               account_custom_s* account_custom = (account_custom_s*)calloc(1, sizeof(account_custom_s));
+
+               while (g_variant_iter_loop(iter_row, "{sv}", &key, &value))
+               {
+                       if (!g_strcmp0(key, ACCOUNT_CUSTOM_DATA_KEY_ACC_ID))
+                       {
+                               account_custom->account_id = g_variant_get_int32(value);
+                               _INFO("[%d]", account_custom->account_id);
+                       }
+                       else if (!g_strcmp0(key, ACCOUNT_CUSTOM_DATA_KEY_APP_ID))
+                       {
+                               _INFO("");
+                               account_custom->app_id = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_CUSTOM_DATA_KEY_KEY))
+                       {
+                               _INFO("account_custom->key = %s", value);
+
+                               account_custom->key = g_strdup(g_variant_get_string (value, NULL));
+                       }
+
+                       else if (!g_strcmp0(key, ACCOUNT_CUSTOM_DATA_KEY_VALUE))
+                       {
+                               _INFO("account_custom->value = %s", value);
+
+                               account_custom->value = g_strdup(g_variant_get_string (value, NULL));
+                       }
+               }
+               list = g_slist_append (list, account_custom);
+               _INFO("");
+
+       }
+
+       _INFO("unmarshal_custom_list end");
+       return list;
+}
+
+GVariant* marshal_user_int_array(const int* user_data_int_array)
+{
+       int i;
+
+       _INFO("marshal_user_data_int_list start");
+       if (user_data_int_array == NULL)
+       {
+               _ERR("input NULL.");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+       for(i = 0; i < USER_INT_CNT; i++)
+       {
+               char key[256];
+               ACCOUNT_SNPRINTF(key, strlen(ACCOUNT_DATA_KEY_USER_DATA_INT)+3, "%s%d", ACCOUNT_DATA_KEY_USER_DATA_INT, i);
+               _INFO("iterating user_data_int[%d]", i);
+               g_variant_builder_add(&builder, "{sv}",
+                               key,
+                               g_variant_new_int32(user_data_int_array[i]));
+               _INFO("marshal user_data_int[%d]=%d, key=%s", i, user_data_int_array[i], key);
+               _INFO("end one iteration of user_data_int");
+       }
+
+       _INFO("marshal_user_data_int_list end");
+       return g_variant_builder_end (&builder);
+}
+
+GVariant* marshal_user_txt_array(char* const* user_data_txt_array)
+{
+       int i;
+
+       _INFO("marshal_user_data_int_list start");
+       if (user_data_txt_array == NULL)
+       {
+               _ERR("input NULL.");
+               return NULL;
+       }
+
+       GVariantBuilder builder;
+
+       g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+       for(i = 0; i < USER_TXT_CNT; i++)
+       {
+               _INFO("iterating user_data_txt[%s]", user_data_txt_array[i]);
+               char key[256];
+               ACCOUNT_SNPRINTF(key, strlen(ACCOUNT_DATA_KEY_USER_DATA_TXT)+3, "%s%d", ACCOUNT_DATA_KEY_USER_DATA_TXT, i);
+               g_variant_builder_add(&builder, "{sv}",
+                               key,
+                               g_variant_new_string(user_data_txt_array[i]));
+               _INFO("end one iteration of user_data_txt");
+       }
+
+       _INFO("marshal_user_data_int_list end");
+       return g_variant_builder_end (&builder);
+}
+
+int* unmarshal_user_int_array(GVariant* variant)
+{
+       _INFO("unmarshal_user_int_array start");
+       GVariantIter iter;
+       const gchar *key = NULL;
+       char compare_key[USER_INT_CNT][256];
+       GVariant *value = NULL;
+       int* user_data_int;
+       int i;
+
+       if (variant == NULL)
+       {
+               _ERR("input NULL");
+               return NULL;
+       }
+
+       gchar* var_type = g_variant_print (variant, TRUE);
+       _INFO("var_type = %s", var_type);
+
+       _INFO("before iter");
+       g_variant_iter_init (&iter, variant);
+       _INFO("after iter");
+
+       user_data_int = (int*)calloc(USER_INT_CNT, sizeof(int));
+
+       for(i=0; i<USER_INT_CNT; i++)
+       {
+               ACCOUNT_SNPRINTF(compare_key[i], strlen(ACCOUNT_DATA_KEY_USER_DATA_INT)+3, "%s%d", ACCOUNT_DATA_KEY_USER_DATA_INT, i);
+       }
+
+       while (g_variant_iter_next (&iter, "{sv}", &key, &value))
+       {
+               for(i=0; i<USER_INT_CNT; i++)
+               {
+                       if (!g_strcmp0(key, compare_key[i]))
+                       {
+                               user_data_int[i] = g_variant_get_int32(value);
+                               _INFO("unmarshal user_data_int[%d]=%d, key=%s, compare=%s", i, user_data_int[i],key, compare_key[i]);
+                       }
+               }
+       }
+
+       _INFO("unmarshal_user_int_array end");
+       return user_data_int;
+}
+
+char** unmarshal_user_txt_array(GVariant* variant)
+{
+       _INFO("unmarshal_user_txt_array start");
+       GVariantIter iter;
+       const gchar *key = NULL;
+       char compare_key[USER_TXT_CNT][256];
+       GVariant *value = NULL;
+       char** user_data_txts;
+       int i;
+
+       if (variant == NULL)
+       {
+               _ERR("input NULL");
+               return NULL;
+       }
+
+       gchar* var_type = g_variant_print (variant, TRUE);
+       _INFO("var_type = %s", var_type);
+
+       _INFO("before iter");
+       g_variant_iter_init (&iter, variant);
+       _INFO("after iter");
+
+       user_data_txts = (char**)calloc(USER_TXT_CNT, sizeof(char*));
+
+       for(i=0; i<USER_TXT_CNT; i++)
+       {
+               ACCOUNT_SNPRINTF(compare_key[i], strlen(ACCOUNT_DATA_KEY_USER_DATA_TXT)+3, "%s%d", ACCOUNT_DATA_KEY_USER_DATA_TXT, i);
+       }
+
+       while (g_variant_iter_next (&iter, "{sv}", &key, &value))
+       {
+               for(i=0; i<USER_TXT_CNT; i++)
+               {
+                       if (!g_strcmp0(key, compare_key[i]))
+                       {
+                               user_data_txts[i] = g_strdup(g_variant_get_string (value, NULL));
+                               _INFO("[%s]", user_data_txts[i]);
+                       }
+               }
+       }
+
+       _INFO("unmarshal_user_txt_array end");
+       return user_data_txts;
+}
diff --git a/src/accounts/common/account_ipc_marshal.h b/src/accounts/common/account_ipc_marshal.h
new file mode 100644 (file)
index 0000000..39e8405
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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 __ACC_IPC_MARSHAL_H__
+#define __ACC_IPC_MARSHAL_H__
+
+#include "account-private.h"
+
+ACCOUNT_API GVariant* marshal_account(const account_s* account);
+ACCOUNT_API account_s* umarshal_account(GVariant* in_data);
+
+ACCOUNT_API GVariant* marshal_account_type(const account_type_s* account_type);
+ACCOUNT_API account_type_s* umarshal_account_type(GVariant* in_data);
+
+ACCOUNT_API GVariant* marshal_account_list_double(GList* account_list);
+ACCOUNT_API GVariant* marshal_account_list(GSList* account_list);
+ACCOUNT_API GSList* unmarshal_account_list(GVariant* variant);
+
+ACCOUNT_API GVariant* marshal_account_type_list(GSList* account_type_list);
+ACCOUNT_API GSList* unmarshal_account_type_list(GVariant* variant);
+
+ACCOUNT_API GVariant* marshal_capability_list(GSList* capability_list);
+ACCOUNT_API GSList* unmarshal_capability_list(GVariant* variant);
+
+ACCOUNT_API GVariant* marshal_custom_list(GSList* capability_list);
+ACCOUNT_API GSList* unmarshal_custom_list(GVariant* variant);
+
+ACCOUNT_API GVariant* marshal_user_int_array(const int* user_data_int_array);
+ACCOUNT_API GVariant* marshal_user_txt_array(char* const* user_txt_array);
+
+ACCOUNT_API int* unmarshal_user_int_array(GVariant* variant);
+ACCOUNT_API char** unmarshal_user_txt_array(GVariant* variant);
+
+ACCOUNT_API account_s* create_empty_account_instance(void);
+
+ACCOUNT_API GVariant * provider_feature_list_to_variant (GSList *list);
+ACCOUNT_API GSList* variant_to_provider_feature_list(GVariant *variant);
+
+ACCOUNT_API GVariant *label_list_to_variant (GSList *list);
+ACCOUNT_API GSList *variant_to_label_list (GVariant *variant);
+
+ACCOUNT_API account_type_s* create_empty_account_type_instance(void);
+
+#endif
diff --git a/src/accounts/common/dbg.h b/src/accounts/common/dbg.h
new file mode 100644 (file)
index 0000000..14e9978
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 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 __DBG_H__
+
+#include <dlog.h>
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "org.tizen.accountServer"
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+
+#endif /* __DBG_H__ */