Release 4.0.0-preview1-00138 submit/tizen/20170830.233631 submit/tizen_4.0/20170830.234627
authorDotnetBuild <dotnetbuild.tizen@gmail.com>
Wed, 30 Aug 2017 15:00:16 +0000 (00:00 +0900)
committerDotnetBuild <dotnetbuild.tizen@gmail.com>
Wed, 30 Aug 2017 15:00:16 +0000 (00:00 +0900)
26 files changed:
packaging/csapi-tizenfx.spec
pkg/PlatformFileList.txt
pkg/Tizen.NET.Private.sln
pkg/Tizen.NET.nuspec
src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs [changed mode: 0644->0755]
src/Tizen.Account.AccountManager/Interop/Interop.Account.cs
src/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs
src/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs
src/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs
src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs
src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs
src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs
src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs
src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs
src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs
src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/SafeAccountHandle.cs [new file with mode: 0644]
src/Tizen.Account.SyncManager/Interop/Interop.Adapter.cs [new file with mode: 0755]
src/Tizen.Account.SyncManager/Interop/Interop.Libraries.cs [new file with mode: 0755]
src/Tizen.Account.SyncManager/Interop/Interop.Manager.cs [new file with mode: 0755]
src/Tizen.Account.SyncManager/Tizen.Account.SyncManager.csproj [new file with mode: 0644]
src/Tizen.Account.SyncManager/Tizen.Account.SyncManager.sln [new file with mode: 0755]
src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/Enumerations.cs [new file with mode: 0755]
src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/ErrorFactory.cs [new file with mode: 0755]
src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncAdapter.cs [new file with mode: 0755]
src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncClient.cs [new file with mode: 0755]
src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncJobData.cs [new file with mode: 0755]

index fdb85fb..8702ac6 100644 (file)
@@ -10,7 +10,7 @@
 
 Name:       csapi-tizenfx
 Summary:    Assemblies of Tizen .NET
-Version:    4.0.0.134
+Version:    4.0.0.138
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0
index 8d6ac20..d98f125 100644 (file)
@@ -7,6 +7,7 @@ res/maps_marker_sticker_72.png                     #mobile #mobile-emul #tv
 Tizen.Account.AccountManager.dll                   #mobile #mobile-emul #ivi #wearable
 Tizen.Account.FidoClient.dll                       #mobile #mobile-emul #wearable
 Tizen.Account.OAuth2.dll                           #mobile #mobile-emul #ivi #wearable
+Tizen.Account.SyncManager.dll                      #mobile #mobile-emul #wearable
 Tizen.Applications.Alarm.dll                       #common #mobile #mobile-emul #tv #ivi #wearable
 Tizen.Applications.AttachPanel.dll                 #mobile #mobile-emul
 Tizen.Applications.Badge.dll                       #mobile #mobile-emul #ivi
@@ -35,7 +36,7 @@ Tizen.Location.Geofence.dll                        #mobile #mobile-emul
 Tizen.Log.dll                                      #common #mobile #mobile-emul #tv #ivi #wearable
 Tizen.Maps.dll                                     #mobile #mobile-emul #tv #wearable
 Tizen.Messaging.dll                                #mobile #mobile-emul #wearable
-Tizen.Messaging.Push.dll                           #mobile #mobile-emul #tv #ivi
+Tizen.Messaging.Push.dll                           #common #mobile #mobile-emul #tv #ivi #wearable
 Tizen.Multimedia.AudioIO.dll                       #common #mobile #mobile-emul #tv #ivi #wearable
 Tizen.Multimedia.Camera.dll                        #common #mobile #mobile-emul #tv #ivi
 Tizen.Multimedia.dll                               #common #mobile #mobile-emul #tv #ivi #wearable
index c4448d0..8a6f048 100644 (file)
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Account.FidoClient",
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Account.OAuth2", "..\src\Tizen.Account.OAuth2\Tizen.Account.OAuth2.csproj", "{CDBB2633-FE0B-485E-B864-DCA9240E6F7D}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Account.SyncManager", "..\src\Tizen.Account.SyncManager\Tizen.Account.SyncManager.csproj", "{219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.Alarm", "..\src\Tizen.Applications.Alarm\Tizen.Applications.Alarm.csproj", "{6B8722E8-94A4-4739-B0E3-14F1B158BC81}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.AttachPanel", "..\src\Tizen.Applications.AttachPanel\Tizen.Applications.AttachPanel.csproj", "{3BACD1BC-613C-4A68-87F2-789B5937FBF6}"
@@ -240,6 +242,18 @@ Global
                {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|x64.Build.0 = Release|x64
                {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|x86.ActiveCfg = Release|x86
                {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|x86.Build.0 = Release|x86
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Debug|x64.ActiveCfg = Debug|x64
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Debug|x64.Build.0 = Debug|x64
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Debug|x86.ActiveCfg = Debug|x86
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Debug|x86.Build.0 = Debug|x86
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Release|Any CPU.Build.0 = Release|Any CPU
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Release|x64.ActiveCfg = Release|x64
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Release|x64.Build.0 = Release|x64
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Release|x86.ActiveCfg = Release|x86
+               {219B1BF6-E17C-42BC-82A3-7B0C81E23AA6}.Release|x86.Build.0 = Release|x86
                {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|x64.ActiveCfg = Debug|x64
index dcd0a80..a34c60d 100644 (file)
@@ -22,6 +22,9 @@
     <file src="bin\Tizen.Account.AccountManager.dll" target="lib\netstandard1.6" />
     <file src="bin\Tizen.Account.AccountManager.pdb" target="lib\netstandard1.6" />
     <file src="bin\Tizen.Account.AccountManager.xml" target="lib\netstandard1.6" />
+    <file src="bin\Tizen.Account.SyncManager.dll" target="lib\netstandard1.6" />
+    <file src="bin\Tizen.Account.SyncManager.pdb" target="lib\netstandard1.6" />
+    <file src="bin\Tizen.Account.SyncManager.xml" target="lib\netstandard1.6" />
     <file src="bin\Tizen.Account.FidoClient.dll" target="lib\netstandard1.6" />
     <file src="bin\Tizen.Account.FidoClient.pdb" target="lib\netstandard1.6" />
     <file src="bin\Tizen.Account.FidoClient.xml" target="lib\netstandard1.6" />
old mode 100644 (file)
new mode 100755 (executable)
index 8cf026c..5347948
@@ -23,6 +23,9 @@ namespace ElmSharp.Wearable
     /// </summary>
     public class CircleSlider : EvasObject
     {
+        /// <summary>
+        /// Changed will be triggered when the circle slider value changes.
+        /// </summary>
         public event EventHandler Changed;
 
         SmartEvent _changedEvent;
index 9789044..90489bc 100644 (file)
@@ -18,127 +18,128 @@ using System;
 using System.Runtime.InteropServices;
 using Tizen.Account.AccountManager;
 /// <summary>
-/// Interop for Account class APIs
+/// Interop for Account class APIs.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 internal static partial class Interop
 {
     /// <summary>
-    /// Interop for Account class APIs
+    /// Interop for Account class APIs.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     internal static partial class Account
     {
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_create", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int Create(out IntPtr handle);
+        internal static extern int Create(out SafeAccountHandle handle);
+
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_destroy", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int Destroy(IntPtr handle);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_account_id", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountId(IntPtr data, out int accountId);
+        internal static extern int GetAccountId(SafeAccountHandle data, out int accountId);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountUserName(IntPtr data, out string userName);
+        internal static extern int GetAccountUserName(SafeAccountHandle data, out string userName);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountUserName(IntPtr handle, string userName);
+        internal static extern int SetAccountUserName(SafeAccountHandle handle, string userName);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_display_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountDisplayName(IntPtr handle, out string displayName);
+        internal static extern int GetAccountDisplayName(SafeAccountHandle handle, out string displayName);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_display_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountDisplayName(IntPtr handle, string displayName);
+        internal static extern int SetAccountDisplayName(SafeAccountHandle handle, string displayName);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountCapability(IntPtr handle, string capabilityType, out int capabilityValue);
+        internal static extern int GetAccountCapability(SafeAccountHandle handle, string capabilityType, out int capabilityValue);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_capability", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountCapability(IntPtr handle, string capabilityType, int capabilityValue);
+        internal static extern int SetAccountCapability(SafeAccountHandle handle, string capabilityType, int capabilityValue);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_icon_path", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountIconPath(IntPtr handle, out string iconPath);
+        internal static extern int GetAccountIconPath(SafeAccountHandle handle, out string iconPath);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_icon_path", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountIconPath(IntPtr handle, string iconPath);
+        internal static extern int SetAccountIconPath(SafeAccountHandle handle, string iconPath);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_domain_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountDomainName(IntPtr handle, out string domainName);
+        internal static extern int GetAccountDomainName(SafeAccountHandle handle, out string domainName);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_domain_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountDomainName(IntPtr handle, string domainName);
+        internal static extern int SetAccountDomainName(SafeAccountHandle handle, string domainName);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_email_address", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountEmail(IntPtr handle, out string email);
+        internal static extern int GetAccountEmail(SafeAccountHandle handle, out string email);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_email_address", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountEmail(IntPtr handle, string email);
+        internal static extern int SetAccountEmail(SafeAccountHandle handle, string email);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_package_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountPackageName(IntPtr handle, out string name);
+        internal static extern int GetAccountPackageName(SafeAccountHandle handle, out string name);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_package_name", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountPackageName(IntPtr handle, string name);
+        internal static extern int SetAccountPackageName(SafeAccountHandle handle, string name);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_access_token", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountAccessToken(IntPtr handle, out string accessToken);
+        internal static extern int GetAccountAccessToken(SafeAccountHandle handle, out string accessToken);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_access_token", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountAccessToken(IntPtr handle, string accessToken);
+        internal static extern int SetAccountAccessToken(SafeAccountHandle handle, string accessToken);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_text", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountUserText(IntPtr handle, int index, out string userText);
+        internal static extern int GetAccountUserText(SafeAccountHandle handle, int index, out string userText);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_text", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountUserText(IntPtr handle, int index, string userText);
+        internal static extern int SetAccountUserText(SafeAccountHandle handle, int index, string userText);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_int", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountUserInt(IntPtr handle, int index, out int value);
+        internal static extern int GetAccountUserInt(SafeAccountHandle handle, int index, out int value);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_int", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountUserInt(IntPtr handle, int index, int value);
+        internal static extern int SetAccountUserInt(SafeAccountHandle handle, int index, int value);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_auth_type", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountAuthType(IntPtr handle, out int authType);
+        internal static extern int GetAccountAuthType(SafeAccountHandle handle, out int authType);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_auth_type", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountAuthType(IntPtr handle, int authType);
+        internal static extern int SetAccountAuthType(SafeAccountHandle handle, int authType);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_secret", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountSercet(IntPtr handle, out int secretType);
+        internal static extern int GetAccountSercet(SafeAccountHandle handle, out int secretType);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_secret", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountSecret(IntPtr handle, int secretType);
+        internal static extern int SetAccountSecret(SafeAccountHandle handle, int secretType);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_sync_support", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountSyncSupport(IntPtr handle, out int syncType);
+        internal static extern int GetAccountSyncSupport(SafeAccountHandle handle, out int syncType);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_sync_support", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountSyncSupport(IntPtr handle, int syncType);
+        internal static extern int SetAccountSyncSupport(SafeAccountHandle handle, int syncType);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_source", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountSource(IntPtr handle, out string source);
+        internal static extern int GetAccountSource(SafeAccountHandle handle, out string source);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_source", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountSource(IntPtr handle, string source);
+        internal static extern int SetAccountSource(SafeAccountHandle handle, string source);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int GetAccountCustomValue(IntPtr handle, string key, out string value);
+        internal static extern int GetAccountCustomValue(SafeAccountHandle handle, string key, out string value);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_custom", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int SetAccountCustomValue(IntPtr handle, string key, string value);
+        internal static extern int SetAccountCustomValue(SafeAccountHandle handle, string key, string value);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int UpdateAccountSyncStatusById(int accountId, int status);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability_all")]
-        internal static extern int GetAllAccountCapabilities(IntPtr handle, AccountCapabilityCallback callback, IntPtr userData);
+        internal static extern int GetAllAccountCapabilities(SafeAccountHandle handle, AccountCapabilityCallback callback, IntPtr userData);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id")]
         internal static extern int QueryAccountCapabilityById(AccountCapabilityCallback callback, int accountId, IntPtr userData);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom_all")]
-        internal static extern int GetAllAccountCustomValues(IntPtr handle, AccountCustomCallback callback, IntPtr userData);
+        internal static extern int GetAllAccountCustomValues(SafeAccountHandle handle, AccountCustomCallback callback, IntPtr userData);
 
         //Callbacks
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
index f201061..02f6314 100644 (file)
@@ -19,13 +19,13 @@ using System.Runtime.InteropServices;
 using Tizen.Account.AccountManager;
 
 /// <summary>
-/// Interop for AccountProvider class APIs
+/// Interop for AccountProvider class APIs.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 internal static partial class Interop
 {
     /// <summary>
-    /// Interop for AccountProvider class APIs
+    /// Interop for AccountProvider class APIs.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     internal static partial class AccountProvider
index 7bb1275..1995ce0 100644 (file)
 
 using System;
 using System.Runtime.InteropServices;
+using Tizen.Account.AccountManager;
 
 /// <summary>
-/// Interop for Account class APIs
+/// Interop for Account class APIs.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 internal static partial class Interop
 {
     /// <summary>
-    /// Interop for Account class APIs
+    /// Interop for Account class APIs.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     internal static partial class AccountService
     {
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_id", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int UpdateAccountToDBById(IntPtr handle, int id);
+        internal static extern int UpdateAccountToDBById(SafeAccountHandle handle, int id);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_user_name", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int UpdateAccountToDBByUserName(IntPtr handle, string userName, string packageName);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_account_id", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int QueryAccountById(int accountId, out IntPtr handle);
+        internal static extern int QueryAccountById(int accountId, ref SafeAccountHandle handle);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_user_name", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int QueryAccountByUserName(Interop.Account.AccountCallback callback, string userName, IntPtr userData);
@@ -51,7 +52,7 @@ internal static partial class Interop
         internal static extern int UpdateAccountSyncStatusById(int accoutId, int status);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_insert_to_db", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int AddAccount(IntPtr handle, out int accountId);
+        internal static extern int AddAccount(SafeAccountHandle handle, out int accountId);
 
         [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_id", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int DeleteAccountById(int accountId);
index f1530bd..dba2781 100644 (file)
  */
 
 /// <summary>
-/// Interop for Library reference
+/// Interop for the library reference.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 internal static partial class Interop
 {
     /// <summary>
-    /// Interop for Library reference
+    /// Interop for the library reference.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     internal static partial class Libraries
index df10a15..498bb84 100644 (file)
@@ -20,29 +20,31 @@ using System.Collections.Generic;
 namespace Tizen.Account.AccountManager
 {
     /// <summary>
-    /// Represents the Account Information.
+    /// Represents the account information.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     public class Account : IDisposable
     {
-        private IntPtr _handle = IntPtr.Zero;
-        internal Account(IntPtr handle)
+        private readonly SafeAccountHandle _handle;
+
+        public Account(SafeAccountHandle handle)
         {
-            Handle = handle;
+            _handle = handle;
         }
 
         ~Account()
         {
             Dispose(false);
         }
+
         /// <summary>
-        /// Creates a new Account instance.
+        /// Creates a new account instance.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <returns>Account Instance.</returns>
         public static Account CreateAccount()
         {
-            IntPtr handle;
+            SafeAccountHandle handle;
             AccountError err = (AccountError)Interop.Account.Create(out handle);
             if (err != AccountError.None)
             {
@@ -56,7 +58,7 @@ namespace Tizen.Account.AccountManager
         /// Id of the Account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <remarks>Account Id shall be created only when account is added to the database.</remarks>
+        /// <remarks>Account ID shall be created only when the account is added to the database.</remarks>
         public int AccountId
         {
             get
@@ -73,10 +75,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// UserName of the Account.
+        /// UserName of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>User Name of the Account.</value>
+        /// <value>User name of the account.</value>
         public string UserName
         {
             get
@@ -102,10 +104,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Display Name of the Account.
+        /// Display name of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>DisplayName of the  Account.</value>
+        /// <value>Display name of the account.</value>
         public string DisplayName
         {
             get
@@ -131,10 +133,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Icon path of the Account.
+        /// Icon path of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Icon path of the Account.</value>
+        /// <value>Icon path of the account.</value>
         public string IconPath
         {
             get
@@ -160,10 +162,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Domain name of the Account.
+        /// Domain name of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Domain name of the Account.</value>
+        /// <value>Domain name of the account.</value>
         public string DomainName
         {
             get
@@ -189,10 +191,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Email Id of the Account.
+        /// Email ID of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Email Id of the Account.</value>
+        /// <value>Email ID of the account.</value>
         public string EmailId
         {
             get
@@ -218,10 +220,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Package Name of the Account.
+        /// Package name of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Package Name.</value>
+        /// <value>Package name of the account.</value>
         public string PackageName
         {
             get
@@ -247,10 +249,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Access Token of the Account.
+        /// Access token of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Access Token.</value>
+        /// <value>Access token of the account.</value>
         public string AccessToken
         {
             get
@@ -276,10 +278,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Authentication type of the Account.
+        /// Authentication type of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Authentication type.</value>
+        /// <value>Authentication type of the account.</value>
         public AccountAuthType AuthType
         {
             get
@@ -305,10 +307,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Secrecy State of the Account.
+        /// Secrecy state of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Secrecy State.</value>
+        /// <value>Secrecy state of the account.</value>
         public AccountSecrecyState SecrecyState
         {
             get
@@ -334,10 +336,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Sync State of the Account.
+        /// Sync state of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Sync State.</value>
+        /// <value>Sync state of the account.</value>
         public AccountSyncState SyncState
         {
             get
@@ -363,10 +365,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Source of the Account .
+        /// Source of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <value>Account Source.</value>
+        /// <value>Account source.</value>
         public string Source
         {
             get
@@ -391,25 +393,25 @@ namespace Tizen.Account.AccountManager
             }
         }
 
-        internal IntPtr Handle
+               /// <summary>
+        /// Handle of the account.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        /// <value>Account handle.</value>
+        public SafeAccountHandle SafeAccountHandle
         {
             get
             {
                 return _handle;
             }
-
-            set
-            {
-                _handle = value;
-            }
         }
         /// <summary>
         /// Sets the account capability.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="capabilityType"> The Account capability type</param>
-        /// <param name="state">The Account capability state</param>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+        /// <param name="capabilityType"> The account capability type.</param>
+        /// <param name="state">The account capability state.</param>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
         public void SetCapability(string capabilityType, CapabilityState state)
         {
             AccountError ret = (AccountError)Interop.Account.SetAccountCapability(_handle, capabilityType, (int)state);
@@ -419,12 +421,12 @@ namespace Tizen.Account.AccountManager
             }
         }
         /// <summary>
-        /// Gets all the capabilities of an account.
+        /// Gets all the capabilities of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="capabilityType"> The capability type to get the capability value.</param>
-        /// <returns>The capability value (on/off) of the specified CapabilityState .</returns>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+        /// <returns>The capability value (on/off) of the specified CapabilityState.</returns>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
         public CapabilityState GetCapability(string capabilityType)
         {
             int type;
@@ -438,10 +440,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Gets all the capabilities of an account.
+        /// Gets all the capabilities of the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <returns>List of Cpabailities as Dictionary</returns>
+        /// <returns>List of capabilities as dictionary.</returns>
         public Dictionary<string, CapabilityState> GetAllCapabilities()
         {
 
@@ -463,12 +465,12 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Sets the Custom Value to the Account.
+        /// Sets the custom value to the account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="key">key to be added to the Account.</param>
-        /// <param name="value">value to be updated for respective key for the Account.</param>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+        /// <param name="key">Key to be added to the account.</param>
+        /// <param name="value">Value to be updated for respective key for the account.</param>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
         public void SetCustomValue(string key, string value)
         {
             AccountError err = (AccountError)Interop.Account.SetAccountCustomValue(_handle, key, value);
@@ -482,10 +484,10 @@ namespace Tizen.Account.AccountManager
         /// Gets the user specific custom text of an account key.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="key">The key to retrieve custom text .</param>
-        /// <returns>The text of the given key</returns>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
-        /// <exception cref="InvalidOperationException">If there is no given capability type in the account </exception>
+        /// <param name="key">The key to retrieve custom text.</param>
+        /// <returns>The text of the given key.</returns>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
+        /// <exception cref="InvalidOperationException">If there is no given capability type in the account.</exception>
         public string GetCustomValue(string key)
         {
             string result = "";
@@ -499,10 +501,10 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Gets All the custome values.
+        /// Gets all the custom values.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <returns>List of custom key, value pairs as Dictionary.</returns>
+        /// <returns>List of custom key, value pairs as dictionary.</returns>
         public Dictionary<string, string> GetAllCustomValues()
         {
             AccountError res = AccountError.None;
@@ -528,9 +530,9 @@ namespace Tizen.Account.AccountManager
         /// Sets the user text.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="index">The index of the user text (must be in range from 0 to 4) </param>
-        /// <param name="text">The text string to set as the user text</param>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+        /// <param name="index">The index of the user text (must be in range from 0 to 4).</param>
+        /// <param name="text">The text string to set as the user text.</param>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
         public void SetUserText(int index, string text)
         {
             AccountError err = (AccountError)Interop.Account.SetAccountUserText(_handle, index, text);
@@ -544,10 +546,10 @@ namespace Tizen.Account.AccountManager
         /// Gets the user text.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="index">The index of the user text (range: 0 ~ 4)</param>
-        /// <returns>The user text of the given key</returns>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
-        /// <exception cref="OutOfMemoryException">In case of out of memory</exception>
+        /// <param name="index">The index of the user text (must be in range from 0 to 4).</param>
+        /// <returns>The user text of the given key.</returns>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
+        /// <exception cref="OutOfMemoryException">In case of out of memory.</exception>
         public string GetUserText(int index)
         {
             string result = "";
@@ -561,12 +563,12 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Gets the user int value.
+        /// Gets the user integer value.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="index">The index of the user int (range: 0 ~ 4)</param>
-        /// <returns>The user int of the given key</returns>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+        /// <param name="index">The index of the user integer (must be in range from 0 to 4).</param>
+        /// <returns>The user integer of the given key.</returns>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
         public int GetUserInt(int index)
         {
             int result = -1;
@@ -583,9 +585,9 @@ namespace Tizen.Account.AccountManager
         /// Sets the user integer value.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="index">The index of the user integer (must be in range from 0 to 4) </param>
-        /// <param name="value">The integer to set as the user integer</param>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
+        /// <param name="index">The index of the user integer (must be in range from 0 to 4).</param>
+        /// <param name="value">The integer to set as the user integer.</param>
+        /// <exception cref="ArgumentException">In case of an invalid parameter.</exception>
         public void SetUserInt(int index, int value)
         {
             AccountError err = (AccountError)Interop.Account.SetAccountUserInt(_handle, index, value);
@@ -596,7 +598,7 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Overloaded Dispose API for destroying the Account Handle.
+        /// Overloaded Dispose API for destroying the account handle.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public void Dispose()
@@ -609,10 +611,12 @@ namespace Tizen.Account.AccountManager
         {
             if (!disposing)
             {
-                if (_handle != IntPtr.Zero)
-                {
-                    _handle = IntPtr.Zero;
-                }
+                //if (_handle != IntPtr.Zero)
+                //{
+                //    _handle = IntPtr.Zero;
+                //}
+                //_handle.Dispose();
+                GC.SuppressFinalize(this);
             }
         }
     }
index b55a458..68a7a65 100644 (file)
 namespace Tizen.Account.AccountManager
 {
     /// <summary>
-    /// Enumeration for the state of capability
+    /// Enumeration for the state of capability.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     public enum CapabilityState
     {
         /// <summary>
-        /// Account capability is invalid
+        /// Account capability is invalid.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         InvalidState,
 
         /// <summary>
-        /// Account capability is disabled
+        /// Account capability is disabled.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Disabled,
 
         /// <summary>
-        /// Account capability is enabled
+        /// Account capability is enabled.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Enabled
@@ -47,19 +47,19 @@ namespace Tizen.Account.AccountManager
     public enum AccountSecrecyState
     {
         /// <summary>
-        /// Account secrecy is invalid
+        /// Account secrecy is invalid.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         InvalidState,
 
         /// <summary>
-        /// Account is not visible
+        /// Account is not visible.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Invisible,
 
         /// <summary>
-        /// Account is visible
+        /// Account is visible.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Visible
@@ -72,31 +72,31 @@ namespace Tizen.Account.AccountManager
     public enum AccountSyncState
     {
         /// <summary>
-        /// Account sync is invalid
+        /// Account sync is invalid.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         InvalidState,
 
         /// <summary>
-        /// Account sync not supported
+        /// Account sync not supported.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         NotSupported,
 
         /// <summary>
-        /// Account sync supported but all synchronization functionalities are off
+        /// Account sync supported, but all the synchronization functionalities are off.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Off,
 
         /// <summary>
-        /// Account sync support and sync status is idle
+        /// Account sync supported and sync status is idle.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Idle,
 
         /// <summary>
-        /// Account sync support and sync status is running
+        /// Acount sync supported and sync status is running.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Running
@@ -109,36 +109,36 @@ namespace Tizen.Account.AccountManager
     public enum AccountAuthType
     {
         /// <summary>
-        /// Auth type is invalid
+        /// Auth type is invalid.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Invalid,
 
         /// <summary>
-        /// XAuth type
+        /// XAuth type.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         XAuth,
 
         /// <summary>
-        /// OAuth type
+        /// OAuth type.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         OAuth,
 
         /// <summary>
-        /// Client-Login type
+        /// ClientLogin type.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         ClientLogin
     }
 
     /// <summary>
-    /// Account information change notification type
+    /// Account information change notification types.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     /// <remarks>
-    /// When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification.
+    /// When the account database is changed, you can distinguish one event type from the other which are set for subscribing notification.
     /// </remarks>
     public enum AccountNotificationType
     {
index 48f9164..51c31dd 100644 (file)
@@ -20,7 +20,7 @@ using Tizen;
 namespace Tizen.Account.AccountManager
 {
     /// <summary>
-    /// Enum to give the type of error occured, if any.
+    /// Enumeration for the types of error occured, if any.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     public enum AccountError
@@ -42,22 +42,22 @@ namespace Tizen.Account.AccountManager
         /// <since_tizen> 3 </since_tizen>
         OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
         /// <summary>
-        /// Same user name exists in your application
+        /// Same user name exists in your application.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         Duplcated = -0x01000000 | 0x01,
         /// <summary>
-        /// Empty Data
+        /// Empty data.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         NoData = Tizen.Internals.Errors.ErrorCode.NoData,
         /// <summary>
-        /// elated record does not exist
+        /// Elated record does not exist.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         RecordNotFound = -0x01000000 | 0x03,
         /// <summary>
-        /// Invalid Operation.
+        /// Invalid operation.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation,
@@ -72,17 +72,17 @@ namespace Tizen.Account.AccountManager
         /// <since_tizen> 3 </since_tizen>
         DBNotOpened = -0x01000000 | 0x05,
         /// <summary>
-        /// DB query syntax error
+        /// DB query syntax error.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         QuerySyntaxError = -0x01000000 | 0x06,
         /// <summary>
-        /// Iterator has reached the end
+        /// Iterator has reached the end.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         IteratorEnd = -0x01000000 | 0x07,
         /// <summary>
-        /// Notification failed
+        /// Notification failed.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         NotificationFailed = -0x01000000 | 0x08,
@@ -92,12 +92,12 @@ namespace Tizen.Account.AccountManager
         /// <since_tizen> 3 </since_tizen>
         PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
         /// <summary>
-        /// XML parse failed
+        /// XML parse failed.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         XMLParseFailed = -0x01000000 | 0x0a,
         /// <summary>
-        /// XML File not found
+        /// XML file not found.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         XMLFileNotFound = -0x01000000 | 0x0b,
@@ -107,7 +107,7 @@ namespace Tizen.Account.AccountManager
         /// <since_tizen> 3 </since_tizen>
         EventSubscriptionFailed = -0x01000000 | 0x0c,
         /// <summary>
-        /// Account provider is not registered
+        /// Account provider is not registered.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         ProviderNotRegistered = -0x01000000 | 0x0d,
@@ -117,7 +117,7 @@ namespace Tizen.Account.AccountManager
         /// <since_tizen> 3 </since_tizen>
         MultipleNotAllowed = -0x01000000 | 0x0e,
         /// <summary>
-        /// SQLite busy handler expired
+        /// SQLite busy handler expired.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         DBBusy = -0x01000000 | 0x10
index 606a286..ce34491 100644 (file)
@@ -21,7 +21,7 @@ using Tizen.Internals.Errors;
 namespace Tizen.Account.AccountManager
 {
     /// <summary>
-    ///  Account Id.
+    /// The account ID.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     public class AccountProvider : IDisposable
@@ -50,7 +50,7 @@ namespace Tizen.Account.AccountManager
             }
         }
         /// <summary>
-        ///  Account Id.
+        /// The account ID.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public string AppId
@@ -69,7 +69,7 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        ///  Serviceprovider Id of the account provider.
+        /// Serviceprovider ID of the account provider.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public string ServiceProviderId
@@ -88,7 +88,7 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        ///  Icon path of an account provider.
+        /// Icon path of the account provider.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public string IconPath
@@ -107,7 +107,7 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        ///  Small icon path of an account provider.
+        /// Small icon path of the account provider.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public string SmallIconPath
@@ -126,7 +126,7 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        ///  Flag for account provider If supports multiple accounts.
+        /// Flag for the account provider if it supports multiple accounts.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public bool MultipleAccountSupport
@@ -149,11 +149,13 @@ namespace Tizen.Account.AccountManager
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
+        /// <feature>http://tizen.org/feature/account</feature>
         /// <returns>
-        /// list of capability information.
+        /// The list of capability information.
         /// </returns>
-        /// <exception cref="InvalidOperationException">In case of any DB error</exception>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public IEnumerable<string> GetAllCapabilities()
         {
             List<string> capabilities = new List<string>();
@@ -174,17 +176,19 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Gets the specific label information detail of an account provider.
+        /// Gets the specific label information detail of the account provider.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="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.
         /// For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
         /// </param>
-        /// <returns>The label text given for the locale</returns>
+        /// <returns>The label text given for the locale.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given locale</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given locale.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public string GetLabel(string locale)
         {
             string label;
@@ -198,17 +202,19 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Gets the specific label information detail of an account provider.
+        /// Gets the specific label information detail of the account provider.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="appId">
-        /// The application ID to search
+        /// The application ID to search.
         /// </param>
-        /// <returns> All the labels information for the given application Id.</returns>
+        /// <returns> All the labels information for the given application ID.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given appid</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given the application ID.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static Dictionary<string, string> GetLabelsByAppId(string appId)
         {
 
@@ -229,13 +235,15 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Gets the label information detail of an account provider.
+        /// Gets the label information detail of the account provider.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <returns> All the labels information for the given account provider.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public Dictionary<string, string> GetLabels()
         {
 
@@ -262,9 +270,11 @@ namespace Tizen.Account.AccountManager
         /// <param name="appId">The application ID to check.</param>
         /// <returns>returns true If App is supported </returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given appid</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for the given application ID.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public bool IsAppSupported(string appId)
         {
             bool isSupported = false;
@@ -286,16 +296,18 @@ namespace Tizen.Account.AccountManager
         /// Checks whether the given application ID supports the capability.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="appId">The application Id</param>
-        /// <param name="capability">The capability information</param>
+        /// <param name="appId">The application ID.</param>
+        /// <param name="capability">The capability information.</param>
         /// <returns>
         /// TRUE if the application supports the given capability,
         /// otherwise FALSE if the application does not support the given capability
         /// </returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static bool IsFeatureSupportedByApp(string appId, string capability)
         {
             bool supported = Interop.AccountProvider.IsFeatureSupported(appId, capability);
@@ -313,15 +325,17 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        ///     Retrieves capability information with application ID.
+        /// Retrieves capability information with the application ID.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="appId">application Id</param>
+        /// <param name="appId">The application ID.</param>
         /// <returns> Capability information list for the given appId.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given appid</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for the given application ID.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static IEnumerable<string> GetFeaturesByAppId(string appId)
         {
 
index fc7cbd4..d335a8e 100644 (file)
@@ -20,16 +20,16 @@ using System.Collections.Generic;
 namespace Tizen.Account.AccountManager
 {
     /// <summary>
-    /// The AccountManager APIs is separated into two major sections:
+    /// The AccountManager APIs are 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:
     /// <list>
-    /// <item> Create an account or account provider </item>
-    /// <item> Update an account or account provider(Only available for the creator) </item>
-    /// <item> Delete an account or account provider(Only available for the creator) </item>
-    /// <item> Read an account or account provider with some filter </item>
+    /// <item> Create an account or account provider.</item>
+    /// <item> Update an account or account provider (Only available for the creator).</item>
+    /// <item> Delete an account or account provider (Only available for the creator).</item>
+    /// <item> Read an account or account provider with some filter.</item>
     /// </list>
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
@@ -37,74 +37,76 @@ namespace Tizen.Account.AccountManager
     public static class AccountService
     {
         /// <summary>
-        /// This is contact capability string.
+        /// This is the contact capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string ContactCapability = "http://tizen.org/account/capability/contact";
 
         /// <summary>
-        /// This is calendar capability string.
+        /// This is the calendar capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string CalendarCapability = "http://tizen.org/account/capability/calendar";
 
         /// <summary>
-        /// This is email capability string.
+        /// This is the email capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string EmailCapability = "http://tizen.org/account/capability/email";
 
         /// <summary>
-        /// This is photo capability string.
+        /// This is the photo capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string PhotoCapability = "http://tizen.org/account/capability/photo";
 
         /// <summary>
-        /// This is video capability string.
+        /// This is the video capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string VideoCapability = "http://tizen.org/account/capability/video";
 
         /// <summary>
-        /// This is music capability string.
+        /// This is the music capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string MusicCapability = "http://tizen.org/account/capability/music";
 
         /// <summary>
-        /// This is document capability string.
+        /// This is the document capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string DocumentCapability = "http://tizen.org/account/capability/document";
 
         /// <summary>
-        /// This is message capability string.
+        /// This is the message capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string MessageCapability = "http://tizen.org/account/capability/message";
 
         /// <summary>
-        /// This is game capability string.
+        /// This is the game capability string.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public static readonly string GameCapability = "http://tizen.org/account/capability/game";
 
         /// <summary>
-        /// Retrieves all accounts details from the account database.
+        /// Retrieves all the accounts details from the account database.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <returns>List of Accounts</returns>
+        /// <returns>List of accounts.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error. </exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static IEnumerable<Account> GetAccountsAsync()
         {
             List<Account> accounts = new List<Account>();
             List<int> values = new List<int>();
             Interop.Account.AccountCallback accountCallback = (IntPtr data, IntPtr userdata) =>
             {
-                Account account = new Account(data);
+                Account account = new Account(new SafeAccountHandle(data, true));
                 values.Add(account.AccountId);
                 account.Dispose();
                 return true;
@@ -126,37 +128,42 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Retrieve an account with the account ID.
+        /// Retrieves the account with the account ID.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="accountId"> The account Id to be searched.</param>
-        /// <returns>Account instance with reference to the given id.</returns>
+        /// <param name="accountId"> The account ID to be searched.</param>
+        /// <returns>Account instance with reference to the given ID.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account id</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account ID.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static Account GetAccountById(int accountId)
         {
             Account account = Account.CreateAccount();
-            IntPtr handle = account.Handle;
-            AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, out handle);
+            SafeAccountHandle handle = account.SafeAccountHandle;
+
+            AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, ref handle);
             if (res != AccountError.None)
             {
                 throw AccountErrorFactory.CreateException(res, "Failed to get accounts from the database for account id: " + accountId);
             }
-
-            account.Handle = handle;
-            return account;
+            Account ref_account = new Account(handle);
+                       
+            return ref_account;
         }
 
         /// <summary>
-        /// Retrieves all AccountProviders details from the account database.
+        /// Retrieves all the AccountProviders details from the account database.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <returns>List of AccountProviders</returns>
+        /// <returns>List of AccountProviders.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static IEnumerable<AccountProvider> GetAccountProviders()
         {
             List<string> values = new List<string>();
@@ -186,15 +193,17 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Retrieves the account provider information with application Id.
+        /// Retrieves the account provider information with the application ID.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="appId">Application Id.</param>
-        /// <returns>The AccountProvider instance associated with the given application Id.</returns>
+        /// <param name="appId">The application ID.</param>
+        /// <returns>The AccountProvider instance associated with the given application ID.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given appid</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given appid.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static AccountProvider GetAccountProviderByAppId(string appId)
         {
             IntPtr handle;
@@ -214,11 +223,13 @@ namespace Tizen.Account.AccountManager
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="feature">The capability value to search for account providers.</param>
-        /// <returns>Retrieves AccountProviders information with the capability name.</returns>
+        /// <returns>Retrieves the AccountProviders information with the capability name.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given feature</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given feature.</exception>
+        /// <exception cref="ArgumentException"> In case of invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static IEnumerable<AccountProvider> GetAccountProvidersByFeature(string feature)
         {
             List<string> values = new List<string>();
@@ -247,16 +258,18 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Inserts into the Database with the new account Infomration.
+        /// Inserts into the Database with the new account Information.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="account">New Account instance to be added.</param>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
         /// <privilege>http://tizen.org/privilege/account.write </privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
         /// <exception cref="OutOfMemoryException"> In case of OutOfMemory error.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static int AddAccount(Account account)
         {
             if (account == null)
@@ -265,7 +278,7 @@ namespace Tizen.Account.AccountManager
             }
 
             int id = -1;
-            AccountError err = (AccountError)Interop.AccountService.AddAccount(account.Handle, out id);
+            AccountError err = (AccountError)Interop.AccountService.AddAccount(account.SafeAccountHandle, out id);
             if (err != AccountError.None)
             {
                 throw AccountErrorFactory.CreateException(err, "Failed to AddAccount");
@@ -278,13 +291,15 @@ namespace Tizen.Account.AccountManager
         /// Updates the account details to the account database.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="account">account instance to be updated.</param>
+        /// <param name="account">Account instance to be updated.</param>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
         /// <privilege>http://tizen.org/privilege/account.write </privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error </exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
         /// <exception cref="OutOfMemoryException"> In case of OutOfMemory error.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static void UpdateAccount(Account account)
         {
             if (account == null)
@@ -292,7 +307,7 @@ namespace Tizen.Account.AccountManager
                 throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to UpdateAccount");
             }
 
-            AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.Handle, account.AccountId);
+            AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.SafeAccountHandle, account.AccountId);
             if (err != AccountError.None)
             {
                 throw AccountErrorFactory.CreateException(err, "Failed to UpdateAccount");
@@ -300,15 +315,17 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Deletes the account information from the Database.
+        /// Deletes the account information from the database.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="account">Account instance to be deleted from the database.</param>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <privilege>http://tizen.org/privilege/account.write </privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error </exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <privilege>http://tizen.org/privilege/account.write</privilege>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static void DeleteAccount(Account account)
         {
             if (account == null)
@@ -324,16 +341,18 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Deletes an account from the account database by user name.
+        /// Deletes the account from the account database by user name.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="userName">The user name of the account to delete.</param>
         /// <param name="packageName">The package name of the account to delete.</param>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <privilege>http://tizen.org/privilege/account.write </privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <privilege>http://tizen.org/privilege/account.write</privilege>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static void DeleteAccount(string userName, string packageName)
         {
             AccountError err = (AccountError)Interop.AccountService.DeleteAccountByUser(userName, packageName);
@@ -344,15 +363,17 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Deletes an account from the account database by package name.
+        /// Deletes the account from the account database by package name.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="packageName">The package name of the account to delete.</param>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <privilege>http://tizen.org/privilege/account.write </privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <privilege>http://tizen.org/privilege/account.write</privilege>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static void DeleteAccount(string packageName)
         {
             AccountError err = (AccountError)Interop.AccountService.DeleteAccountByPackage(packageName);
@@ -364,22 +385,24 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Retrieves all accounts with the given user name.
+        /// Retrieves all the accounts with the given user name.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="userName">The user name to search .</param>
-        /// <returns>Accounts list matched with the user name</returns>
+        /// <param name="userName">The user name to search.</param>
+        /// <returns>Accounts list matched with the user name.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given username</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given username.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static IEnumerable<Account> GetAccountsByUserName(string userName)
         {
             List<Account> accounts = new List<Account>();
             List<int> values = new List<int>();
             Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) =>
             {
-                Account account = new Account(handle);
+                Account account = new Account(new SafeAccountHandle(handle, true));
                 values.Add(account.AccountId);
                 account.Dispose();
                 return true;
@@ -401,22 +424,24 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Retrieves all accounts with the given package name.
+        /// Retrieves all the accounts with the given package name.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="packageName"> The package name to Search</param>
-        /// <returns>Accounts list matched with the package name</returns>
+        /// <param name="packageName"> The package name to search.</param>
+        /// <returns>Accounts list matched with the package name.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given package name</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given package name.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static IEnumerable<Account> GetAccountsByPackageName(string packageName)
         {
             List<Account> accounts = new List<Account>();
             List<int> values = new List<int>();
             Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) =>
             {
-                Account account = new Account(handle);
+                Account account = new Account(new SafeAccountHandle(handle, true));
                 values.Add(account.AccountId);
                 account.Dispose();
                 return true;
@@ -438,22 +463,24 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Retrieves all accounts with the given cpability type.
+        /// Retrieves all accounts with the given capability type.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="type"> Capability type</param>
-        /// <returns>Accounts list matched with the capability type</returns>
+        /// <param name="type"> Capability type.</param>
+        /// <returns>Accounts list matched with the capability type.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given capability type</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for the given capability type.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static IEnumerable<Account> GetAccountsByCapabilityType(string type)
         {
             List<Account> accounts = new List<Account>();
             List<int> values = new List<int>();
             Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) =>
             {
-                Account account = new Account(handle);
+                Account account = new Account(new SafeAccountHandle(handle, true));
                 values.Add(account.AccountId);
                 account.Dispose();
                 return true;
@@ -475,15 +502,17 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// Retrieves all capabilities with the given account
+        /// Retrieves all the capabilities with the given account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="accountId">account instance</param>
-        /// <returns>Capabilities list as Dictionary of Capability type and State.</returns>
+        /// <param name="accountId">Account instance.</param>
+        /// <returns>Capabilities list as dictionary of the capability type and state.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account id</exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account ID.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static Dictionary<string, CapabilityState> GetCapabilitiesById(int accountId)
         {
             Dictionary<string, CapabilityState> capabilities = new Dictionary<string, CapabilityState>();
@@ -506,10 +535,12 @@ namespace Tizen.Account.AccountManager
         /// Gets the count of accounts in the account database.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <returns>The number of accounts in the database</returns>
+        /// <returns>The number of accounts in the database.</returns>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error </exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static int GetAccountsCount()
         {
             int count = 0;
@@ -526,13 +557,15 @@ namespace Tizen.Account.AccountManager
         /// Updates the sync status of the given account.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <param name="account"> Account for which sync status needs to be updated</param>
+        /// <param name="account"> Account for which the sync status needs to be updated.</param>
         /// <param name="status">Sync State</param>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
         /// <privilege>http://tizen.org/privilege/account.write</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error </exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static void UpdateSyncStatusById(Account account, AccountSyncState status)
         {
             AccountError err = (AccountError)Interop.AccountService.UpdateAccountSyncStatusById(account.AccountId, (int)status);
@@ -557,14 +590,16 @@ namespace Tizen.Account.AccountManager
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <remarks>
-        /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new Inforamtion is Inserted.
+        /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new information is inserted.
         /// </remarks>
         /// <param name="sender"></param>
         /// <param name="e">A ContentUpdatedEventArgs object that contains information about the update operation.</param>
         /// <privilege>http://tizen.org/privilege/account.read</privilege>
-        /// <exception cref="InvalidOperationException">In case of any DB error </exception>
-        /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+        /// <feature>http://tizen.org/feature/account</feature>
+        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
         /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         public static event EventHandler<AccountSubscriberEventArgs> AccountUpdated
         {
             add
index 153c427..2df2399 100644 (file)
@@ -19,7 +19,7 @@ using System;
 namespace Tizen.Account.AccountManager
 {
     /// <summary>
-    /// Event arguments passed when Event is triggered to notify that account is updated/removed from the account database.
+    /// Event arguments passed when the event is triggered to notify that the account is updated/removed from the account database.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     public class AccountSubscriberEventArgs : EventArgs
@@ -51,7 +51,7 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// The account event type
+        /// The account event type.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public AccountNotificationType EventType
@@ -61,7 +61,7 @@ namespace Tizen.Account.AccountManager
         }
 
         /// <summary>
-        /// The account ID to update
+        /// The account ID to update.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public int AccountId
diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/SafeAccountHandle.cs b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/SafeAccountHandle.cs
new file mode 100644 (file)
index 0000000..3da224c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace Tizen.Account.AccountManager
+{
+    /// <summary>
+    /// Represents a wrapper class for a unmanaged Account handle.
+    /// </summary>
+    public sealed class SafeAccountHandle : SafeHandle
+    {
+        /// <summary>
+        /// Initializes a new instance of the SafeAppControlHandle class.
+        /// </summary>
+        public SafeAccountHandle() : base(IntPtr.Zero, true)
+        {
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the SafeAccountHandle class.
+        /// </summary>
+        /// <param name="existingHandle">An IntPtr object that represents the pre-existing handle to use.</param>
+        /// <param name="ownsHandle">true to reliably release the handle during the finalization phase; false to prevent reliable release.</param>
+        public SafeAccountHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle)
+        {
+            SetHandle(existingHandle);
+        }
+
+        /// <summary>
+        /// Gets a value that indicates whether the handle is invalid.
+        /// </summary>
+        public override bool IsInvalid
+        {
+            get { return this.handle == IntPtr.Zero; }
+        }
+
+        /// <summary>
+        /// When overridden in a derived class, executes the code required to free the handle.
+        /// </summary>
+        /// <returns>true if the handle is released successfully</returns>
+        protected override bool ReleaseHandle()
+        {
+            this.SetHandle(IntPtr.Zero);
+            return true;
+        }
+    }
+}
diff --git a/src/Tizen.Account.SyncManager/Interop/Interop.Adapter.cs b/src/Tizen.Account.SyncManager/Interop/Interop.Adapter.cs
new file mode 100755 (executable)
index 0000000..9a05dbc
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+    internal static partial class Adapter
+    {
+        [DllImport(Libraries.SyncManager, EntryPoint = "sync_adapter_set_callbacks")]
+        internal static extern int SetCallbacks(SyncAdapterStartSyncCallback onStartCb, SyncAdapterCancelSyncCallback onCancelCb);
+
+        [DllImport(Libraries.SyncManager, EntryPoint = "sync_adapter_unset_callbacks")]
+        internal static extern int UnsetCallbacks();
+
+        [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
+        internal delegate bool SyncAdapterStartSyncCallback(IntPtr account, string syncJobName, string syncCapability, IntPtr syncJobUserData);
+
+        [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
+        internal delegate void SyncAdapterCancelSyncCallback(IntPtr account, string syncJobName, string syncCapability, IntPtr syncJobUserData);
+    }
+}
diff --git a/src/Tizen.Account.SyncManager/Interop/Interop.Libraries.cs b/src/Tizen.Account.SyncManager/Interop/Interop.Libraries.cs
new file mode 100755 (executable)
index 0000000..837e50b
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+internal static partial class Interop
+{
+    /// <summary>
+    /// Wrapper class for maintaining names of dependent native libraries.
+    /// </summary>
+    internal static partial class Libraries
+    {
+        public const string SyncManager = "libcore-sync-client.so.1";
+        public const string Glib = "libglib-2.0.so.0";
+        public const string Libc = "libc.so.6";
+    }
+}
diff --git a/src/Tizen.Account.SyncManager/Interop/Interop.Manager.cs b/src/Tizen.Account.SyncManager/Interop/Interop.Manager.cs
new file mode 100755 (executable)
index 0000000..c269694
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Applications;
+using Tizen.Account.AccountManager;
+
+internal static partial class Interop
+{
+    internal static partial class Manager
+    {
+        [DllImport(Libraries.SyncManager, EntryPoint = "sync_manager_on_demand_sync_job")]
+        internal static extern int RequestOnDemandSyncJob(SafeAccountHandle account, string syncJobName, int syncOption, SafeBundleHandle syncJobUserData, out int syncJobId);
+
+        [DllImport(Libraries.SyncManager, EntryPoint = "sync_manager_add_periodic_sync_job")]
+        internal static extern int AddPeriodicSyncJob(SafeAccountHandle account, string syncJobName, int syncPeriod, int syncOption, SafeBundleHandle syncJobUserData, out int syncJobId);
+
+        [DllImport(Libraries.SyncManager, EntryPoint = "sync_manager_add_data_change_sync_job")]
+        internal static extern int AddDataChangeSyncJob(SafeAccountHandle account, string syncCapability, int syncOption, SafeBundleHandle syncJobUserData, out int syncJobId);
+
+        [DllImport(Libraries.SyncManager, EntryPoint = "sync_manager_remove_sync_job")]
+        internal static extern int RemoveSyncJob(int syncJobId);
+
+        [DllImport(Libraries.SyncManager, EntryPoint = "sync_manager_foreach_sync_job")]
+        internal static extern int ForeachSyncJob(SyncManagerSyncJobCallback syncJobCb, IntPtr userData);
+
+        [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
+        internal delegate bool SyncManagerSyncJobCallback(IntPtr account, string syncJobName, string syncCapability, int syncJobId, IntPtr syncJobUserData, IntPtr userData);
+    }
+}
diff --git a/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager.csproj b/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager.csproj
new file mode 100644 (file)
index 0000000..a552e3f
--- /dev/null
@@ -0,0 +1,16 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <Import Project="../../build/common.props" />
+
+  <PropertyGroup>
+    <TargetFramework>netstandard1.6</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Tizen\Tizen.csproj" />
+    <ProjectReference Include="..\Tizen.Applications.Common\Tizen.Applications.Common.csproj" />
+    <ProjectReference Include="..\Tizen.Account.AccountManager\Tizen.Account.AccountManager.csproj" />
+    <ProjectReference Include="..\Tizen.Log\Tizen.Log.csproj" />
+  </ItemGroup>
+
+  <Import Project="../../build/common.targets" />
+</Project>
diff --git a/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager.sln b/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager.sln
new file mode 100755 (executable)
index 0000000..14b65a7
--- /dev/null
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Account.SyncManager", "Tizen.Account.SyncManager.csproj", "{16028D3D-9DA0-466A-9CE4-EE8790F450D6}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Any CPU = Debug|Any CPU
+               Release|Any CPU = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {16028D3D-9DA0-466A-9CE4-EE8790F450D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {16028D3D-9DA0-466A-9CE4-EE8790F450D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {16028D3D-9DA0-466A-9CE4-EE8790F450D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {16028D3D-9DA0-466A-9CE4-EE8790F450D6}.Release|Any CPU.Build.0 = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/Enumerations.cs b/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/Enumerations.cs
new file mode 100755 (executable)
index 0000000..4befba6
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+using System;
+
+namespace Tizen.Account.SyncManager
+{
+       /// <summary>
+       /// Enumeration for the Sync option
+       /// </summary>
+    [Flags]
+    public enum SyncOption
+    {
+        /// <summary>
+        /// Sync job will be operated normally
+        /// </summary>
+        None = 0,
+
+        /// <summary>
+        /// Sync job will be operated as soon as possible
+        /// </summary>
+        Expedited = 0X01,
+
+        /// <summary>
+        /// Sync job will not be performed again when it fails
+        /// </summary>
+        NoRetry = 0X02,
+    }
+
+       /// <summary>
+       /// Enumeration for the Sync period
+       /// </summary>
+    public enum SyncPeriod
+    {
+        /// <summary>
+        /// Sync within 30 minutes
+        /// </summary>
+        ThirtyMin = 0,
+
+        /// <summary>
+        /// Sync within 1 hour
+        /// </summary>
+        OneHour,
+
+        /// <summary>
+        /// Sync within 2 hours
+        /// </summary>
+        TwoHours,
+
+        /// <summary>
+        /// Sync within 3 hours
+        /// </summary>
+        ThreeHours,
+
+        /// <summary>
+        /// Sync within 6 hours
+        /// </summary>
+        SixHours,
+
+        /// <summary>
+        /// Sync within 12 hours
+        /// </summary>
+        TwelveHours,
+
+        /// <summary>
+        /// Sync within 1 day
+        /// </summary>
+        OneDay,
+    }
+}
+
diff --git a/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/ErrorFactory.cs b/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/ErrorFactory.cs
new file mode 100755 (executable)
index 0000000..79f1af9
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+using System;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Account.SyncManager
+{
+    internal enum SyncManagerErrorCode
+    {
+        None = ErrorCode.None,
+        NotSupported = ErrorCode.NotSupported,
+        OutOfMemory = ErrorCode.OutOfMemory,
+        InvalidParameter = ErrorCode.InvalidParameter,
+        InvalidOperation = ErrorCode.InvalidOperation,
+        PermissionDenied = ErrorCode.PermissionDenied,
+        IoError = ErrorCode.IoError,
+        AlreadyInProgress = ErrorCode.AlreadyInProgress,
+        QuotaExceeded = ErrorCode.QuotaExceeded,
+        SystemError = -0x01020000 | 0X01,
+        AdapterNotFound = -0x01020000 | 0X02
+    }
+
+    internal class ErrorFactory
+    {
+        internal static string LogTag = "Tizen.Account.SyncManager";
+
+        internal static Exception GetException(int error)
+        {
+            if ((SyncManagerErrorCode)error == SyncManagerErrorCode.NotSupported)
+            {
+                return new NotSupportedException("Not supported (%http://tizen.org/feature/account.sync)");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.OutOfMemory)
+            {
+                return new OutOfMemoryException("Out of memory");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.InvalidParameter)
+            {
+                return new ArgumentException("Invalid parameter");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.InvalidOperation)
+            {
+                return new InvalidOperationException("Invalid operation");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.PermissionDenied)
+            {
+                return new UnauthorizedAccessException("Permission denied (%http://tizen.org/privilege/alarm.set, %http://tizen.org/privilege/calendar.read, %http://tizen.org/privilege/contact.read)");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.IoError)
+            {
+                return new Exception("IO error occured");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.AlreadyInProgress)
+            {
+                return new InvalidOperationException("Sync is already in progress");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.QuotaExceeded)
+            {
+                return new InvalidOperationException("Quota for sync jobs exceeded");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.SystemError)
+            {
+                return new Exception("System error occured");
+            }
+            else if ((SyncManagerErrorCode)error == SyncManagerErrorCode.AdapterNotFound)
+            {
+                return new InvalidOperationException("Sync adapter couldn't be found");
+            }
+            else
+            {
+                return new Exception("Unknown error");
+            }
+        }
+    }
+}
+
diff --git a/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncAdapter.cs b/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncAdapter.cs
new file mode 100755 (executable)
index 0000000..8a59593
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+using System;
+using Tizen.Applications;
+using Tizen.Account.AccountManager;
+
+namespace Tizen.Account.SyncManager
+{
+    /// <summary>
+    /// The class contains the delegates to be called upon scheduling a sync operation
+    /// </summary>
+    public class SyncAdapter
+    {
+        Interop.Adapter.SyncAdapterStartSyncCallback _startSyncCallback;
+        Interop.Adapter.SyncAdapterCancelSyncCallback _cancelSyncCallback;
+
+        /// <summary>
+        /// Callback function for Sync Adapter's start sync request
+        /// </summary>
+        /// <param name="syncParameters"> The sync job parameters corresponding to the sync request. </param>
+        /// <returns> true if sync operation is success, @c false otherwise. </returns>
+        public delegate bool StartSyncCallback(SyncJobData syncParameters);
+
+        /// <summary>
+        /// Callback function for Sync Adapter's cancel sync request.
+        /// </summary>
+        /// <param name="syncParameters"> The sync job parameters corresponding to the sync request. </param>
+        public delegate void CancelSyncCallback(SyncJobData syncParameters);
+
+        /// <summary>
+        /// Sets client (Sync Adapter) callback functions
+        /// </summary>
+        /// <param name="startSyncCb"> A callback function to be called by Sync Manager for performing sync operation. </param>
+        /// <param name="cancelSyncCb"> A callback function to be called by Sync Manager for cancelling sync operation. </param>
+        /// <exception cref="ArgumentNullException"> Thrown when any of the arguments are null. </exception>
+        /// <exception cref="InvalidOperationException"> Thrown when the application calling this API cannot be a sync adapter. </exception>
+        public void SetSyncEventCallbacks(StartSyncCallback startSyncCb, CancelSyncCallback cancelSyncCb)
+        {
+            if (startSyncCb == null || cancelSyncCb == null)
+            {
+                throw new ArgumentNullException();
+            }
+
+            _startSyncCallback = (IntPtr accountHandle, string syncJobName, string syncCapability, IntPtr syncJobUserData) =>
+            {
+                Log.Debug(ErrorFactory.LogTag, "Start sync event received");
+
+                AccountManager.Account account = new AccountManager.Account(new SafeAccountHandle(accountHandle, true));
+                Bundle bundle = new Bundle(new SafeBundleHandle(syncJobUserData, true));
+
+                SyncJobData syncJobData = new SyncJobData()
+                {
+                    Account = account,
+                    SyncJobName = syncJobName,
+                    UserData = bundle
+                };
+
+                return startSyncCb(syncJobData);
+            };
+
+            _cancelSyncCallback = (IntPtr accountHandle, string syncJobName, string syncCapability, IntPtr syncJobUserData) =>
+            {
+                Log.Debug(ErrorFactory.LogTag, "cancel sync event received");
+
+                AccountManager.Account account = new AccountManager.Account(new SafeAccountHandle(accountHandle, true));
+                Bundle bundle = new Bundle(new SafeBundleHandle(syncJobUserData, true));
+
+                SyncJobData syncJobData = new SyncJobData()
+                {
+                    Account = account,
+                    SyncJobName = syncJobName,
+                    UserData = bundle
+                };
+
+                cancelSyncCb(syncJobData);
+            };
+
+            int ret = Interop.Adapter.SetCallbacks(_startSyncCallback, _cancelSyncCallback);
+            if (ret != (int)SyncManagerErrorCode.None)
+            {
+                Log.Error(ErrorFactory.LogTag, "Failed to set callbacks");
+                throw ErrorFactory.GetException(ret);
+            }
+        }
+
+        /// <summary>
+        /// Unsets client (Sync Adapter) callback functions
+        /// </summary>
+        /// <exception cref="System.Exception"> Thrown when sync manager internal error occurs. </exception>
+        public void UnsetSyncEventCallbacks()
+        {
+            int ret = Interop.Adapter.UnsetCallbacks();
+            if (ret != (int)SyncManagerErrorCode.None)
+            {
+                Log.Error(ErrorFactory.LogTag, "Failed to unset callbacks");
+                throw ErrorFactory.GetException(ret);
+            }
+        }
+    }
+}
+
diff --git a/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncClient.cs b/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncClient.cs
new file mode 100755 (executable)
index 0000000..4c82b85
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+using System;
+using System.Collections.Generic;
+using Tizen.Applications;
+using Tizen.Account.AccountManager;
+
+namespace Tizen.Account.SyncManager
+{
+    /// <summary>
+    /// The SyncClient APIs for managing the sync operations. Applications will call these APIs to schedule their sync operations.
+    /// Sync service maintains sync requests from all the applications and invokes their respective callback methods to perform account synchronization operations.
+    /// </summary>
+    public static class SyncClient
+    {
+        /// <summary>
+        /// The constructor
+        /// </summary>
+        static SyncClient()
+        {
+        }
+
+        /// <summary>
+        /// Requests Sync Manager to perform one time sync operation
+        /// </summary>
+        /// <param name="request"> Sync job information of the sync job request. </param>
+        /// <param name="syncOptions"> sync options determine an way to operate sync job and can be used as ORing. </param>
+        /// <exception cref="ArgumentNullException"> Thrown when any of the arugments are null. </exception>
+        /// <exception cref="InvalidOperationException"> Thrown when the application calling this api doesn't have a sync adapter. </exception>
+        /// <returns> A unique value which can manage sync jobs. The number of sync job id is limited as less than a hundred. </returns>
+        public static int RequestOnDemandSyncJob(SyncJobData request, SyncOption syncOptions)
+        {
+            if (request == null || request.SyncJobName == null)
+            {
+                throw new ArgumentNullException();
+            }
+
+            SafeAccountHandle accountHandle = (request.Account != null) ? request.Account.SafeAccountHandle : new SafeAccountHandle();
+            SafeBundleHandle bundleHandle = (request.UserData != null) ? request.UserData.SafeBundleHandle : new SafeBundleHandle();
+
+            int id = 0;
+            int ret = Interop.Manager.RequestOnDemandSyncJob(accountHandle, request.SyncJobName, (int)syncOptions, bundleHandle, out id);
+            if (ret != (int)SyncManagerErrorCode.None)
+            {
+                Log.Error(ErrorFactory.LogTag, "Failed to request on demand sync job");
+                throw ErrorFactory.GetException(ret);
+            }
+            return id;
+        }
+
+        /// <summary>
+        /// Requests Sync Manager to perform periodic sync operations
+        /// </summary>
+        /// <param name="request"> Sync job information of the sync job request. </param>
+        /// <param name="period"> Determines time interval of periodic sync. The periodic sync operation can be triggered in that interval, but it does not guarantee exact time. The minimum value is 30 minutes. </param>
+        /// <param name="syncOptions"> sync options determine an way to operate sync job and can be used as ORing. </param>
+        /// <privilege>http://tizen.org/privilege/alarm.set</privilege>
+        /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined. </exception>
+        /// <exception cref="ArgumentNullException"> Thrown when any of the arguments are null. </exception>
+        /// <exception cref="InvalidOperationException"> Thrown when the application calling this API doesn't have a sync adapter. </exception>
+        /// <returns> A unique value which can manage sync jobs. The number of sync job id is limited as less than a hundred. </returns>
+        public static int AddPeriodicSyncJob(SyncJobData request, SyncPeriod period, SyncOption syncOptions)
+        {
+            if (request == null || request.SyncJobName == null)
+            {
+                throw new ArgumentNullException();
+            }
+
+            SafeAccountHandle accountHandle = (request.Account != null) ? request.Account.SafeAccountHandle : new SafeAccountHandle();
+            SafeBundleHandle bundleHandle = (request.UserData != null) ? request.UserData.SafeBundleHandle : new SafeBundleHandle();
+
+            int id = 0;
+            int ret = Interop.Manager.AddPeriodicSyncJob(accountHandle, request.SyncJobName, (int) period, (int)syncOptions, bundleHandle, out id);
+            if (ret != (int)SyncManagerErrorCode.None)
+            {
+                Log.Error(ErrorFactory.LogTag, "Failed to add periodic sync job");
+                throw ErrorFactory.GetException(ret);
+            }
+            return id;
+        }
+
+        /// <summary>
+        /// Requests Sync Manager to perform sync operations whenever corresponding DB changed
+        /// </summary>
+        /// <param name="request"> Sync job information of the sync job request. </param>
+        /// <param name="syncOptions"> sync options determine an way to operate sync job and can be used as ORing. </param>
+        /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
+        /// <privilege>http://tizen.org/privilege/contact.read</privilege>
+        /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined. </exception>
+        /// <exception cref="ArgumentNullException"> Thrown when any of the arguments are null. </exception>
+        /// <exception cref="InvalidOperationException"> Thrown when the application calling this API doesn't have a sync adapter. </exception>
+        /// <returns> A unique value which can manage sync jobs. The number of sync job id is limited as less than a hundred. </returns>
+        public static int AddDataChangeSyncJob(SyncJobData request, SyncOption syncOptions)
+        {
+            if (request == null || request.SyncJobName == null)
+            {
+                throw new ArgumentNullException();
+            }
+
+            SafeAccountHandle accountHandle = (request.Account != null) ? request.Account.SafeAccountHandle : new SafeAccountHandle();
+            SafeBundleHandle bundleHandle = (request.UserData != null) ? request.UserData.SafeBundleHandle : new SafeBundleHandle();
+
+            int id = 0;
+            int ret = Interop.Manager.AddDataChangeSyncJob(accountHandle, request.SyncJobName, (int)syncOptions, bundleHandle, out id);
+            if (ret != (int)SyncManagerErrorCode.None)
+            {
+                Log.Error(ErrorFactory.LogTag, "Failed to add data change sync job");
+                throw ErrorFactory.GetException(ret);
+            }
+            return id;
+        }
+
+        /// <summary>
+        /// Get all the sync jobs registered with the sync manager
+        /// </summary>
+        /// <returns>
+        /// Returns the list of SyncJobData corresponding to sync requests.
+        /// </returns>
+        public static IEnumerable<KeyValuePair<int, SyncJobData>> GetAllSyncJobs()
+        {
+            IDictionary<int, SyncJobData> syncJobs = new Dictionary<int, SyncJobData>();
+            Interop.Manager.SyncManagerSyncJobCallback cb = (IntPtr accountHandle, string syncJobName, string syncCapability, int syncJobId, IntPtr syncJobUserData, IntPtr userData) =>
+            {
+                AccountManager.Account account = new AccountManager.Account(new SafeAccountHandle(accountHandle, true));
+                Bundle bundle = new Bundle(new SafeBundleHandle(syncJobUserData, true));
+
+                SyncJobData syncJobData = new SyncJobData();
+                syncJobData.Account = account;
+                if (syncJobName != null)
+                    syncJobData.SyncJobName = syncJobName;
+                else
+                    syncJobData.SyncJobName = syncCapability;
+                syncJobData.UserData = bundle;
+
+                syncJobs.Add(syncJobId, syncJobData);
+                return true;
+            };
+
+            int ret = Interop.Manager.ForeachSyncJob(cb, IntPtr.Zero);
+            if (ret != (int)SyncManagerErrorCode.None)
+            {
+                Log.Error(ErrorFactory.LogTag, "Failed to get registered sync job");
+                throw ErrorFactory.GetException(ret);
+            }
+            return syncJobs;
+        }
+
+        /// <summary>
+        /// Requests Sync Manager to remove corresponding sync job job based on id
+        /// </summary>
+        /// <param name="id"> A unique value of each sync job, it can be used to search specific sync job and remove it. </param>
+        /// <exception cref="ArgumentException"> Thrown if the input arugments is invalid. </exception>
+        public static void RemoveSyncJob(int id)
+        {
+            int ret = Interop.Manager.RemoveSyncJob(id);
+            if (ret != (int)SyncManagerErrorCode.None)
+            {
+                Log.Error(ErrorFactory.LogTag, "Failed to remove sync job");
+                throw ErrorFactory.GetException(ret);
+            }
+        }
+    }
+}
+
diff --git a/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncJobData.cs b/src/Tizen.Account.SyncManager/Tizen.Account.SyncManager/SyncJobData.cs
new file mode 100755 (executable)
index 0000000..51c2039
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+using Tizen.Applications;
+using Tizen.Account.AccountManager;
+
+namespace Tizen.Account.SyncManager
+{
+    /// <summary>
+    /// Class represents information about a sync job request
+    /// </summary>
+    public class SyncJobData
+    {
+        /// <summary>
+        /// Represents calendar capability
+        /// </summary>
+        /// <remarks>
+        /// If you want to receive notification about calendar database change, assign it to SyncJobName property of SyncJobData object.
+        /// </remarks>
+        public const string CalendarCapability = "http://tizen.org/sync/capability/calendar";
+
+        /// <summary>
+        /// Represents contact capability
+        /// </summary>
+        /// <remarks>
+        /// If you want to receive notification about contact database change, assign it to SyncJobName property of SyncJobData object.
+        /// </remarks>
+        public const string ContactCapability = "http://tizen.org/sync/capability/contact";
+
+        /// <summary>
+        /// Represents image capability
+        /// </summary>
+        /// <remarks>
+        /// If you want to receive notification about image database change, assign it to SyncJobName property of SyncJobData object.
+        /// </remarks>
+        public const string ImageCapability = "http://tizen.org/sync/capability/image";
+
+        /// <summary>
+        /// Represents video capability
+        /// </summary>
+        /// <remarks>
+        /// If you want to receive notification about video database change, assign it to SyncJobName property of SyncJobData object.
+        /// </remarks>
+        public const string VideoCapability = "http://tizen.org/sync/capability/video";
+
+        /// <summary>
+        /// Represents sound capability
+        /// </summary>
+        /// <remarks>
+        /// If you want to receive notification about sound database change, assign it to SyncJobName property of SyncJobData object.
+        /// </remarks>
+        public const string SoundCapability = "http://tizen.org/sync/capability/sound";
+
+        /// <summary>
+        /// Represents music capability
+        /// </summary>
+        /// <remarks>
+        /// If you want to receive notification about music database change, assign it to SyncJobName property of SyncJobData object.
+        /// </remarks>
+        public const string MusicCapability = "http://tizen.org/sync/capability/music";
+
+        /// <summary>
+        /// The account instance on which sync operation was requested or @c null in the case of accountless sync operation
+        /// </summary>
+        public AccountManager.Account Account { get; set; }
+
+        /// <summary>
+        /// User data which contains additional information related registered sync job
+        /// </summary>
+        public Bundle UserData { get; set; }
+
+        /// <summary>
+        /// A string representing a sync job which has been operated or capability setting to operate data change sync job
+        /// </summary>
+        public string SyncJobName { get; set; }
+    }
+}
+