added contact capability for data change sync job on wearable profile 27/76127/2 accepted/tizen/common/20160623.154339 accepted/tizen/mobile/20160623.124028 accepted/tizen/wearable/20160623.124049 submit/tizen/20160623.045004
authorIckhee Woo <ickhee.woo@samsung.com>
Thu, 23 Jun 2016 02:21:20 +0000 (11:21 +0900)
committerIckhee Woo <ickhee.woo@samsung.com>
Thu, 23 Jun 2016 04:40:11 +0000 (13:40 +0900)
Change-Id: Iccef654d715a3fb24336afa9122a606629090ac7
Signed-off-by: Ickhee Woo <ickhee.woo@samsung.com>
13 files changed:
TC/utc-sync-manager.c
include/mobile/sync_manager.h
include/sync-error.h
include/sync_adapter.h
include/wearable/sync_manager.h
packaging/sync-manager.spec
src/sync-client/CMakeLists.txt
src/sync-client/sync_manager.c
src/sync-service/CMakeLists.txt
src/sync-service/SyncManager_DataChangeSyncScheduler.cpp
src/sync-service/SyncManager_PeriodicSyncScheduler.cpp
src/sync-service/SyncManager_SyncDefines.h
src/sync-service/SyncManager_SyncService.cpp

index 54c9babd84961db34d561c35c3433dd80900cd1f..f552952723bd5ebba522f0fdb62dca9ad57cfcb8 100755 (executable)
@@ -31,8 +31,8 @@
 
 #ifdef MOBILE
 const char *capability_calendar = SYNC_SUPPORTS_CAPABILITY_CALENDAR;
-const char *capability_contact = SYNC_SUPPORTS_CAPABILITY_CONTACT;
 #endif
+const char *capability_contact = SYNC_SUPPORTS_CAPABILITY_CONTACT;
 const char *capability_image = SYNC_SUPPORTS_CAPABILITY_IMAGE;
 const char *capability_video = SYNC_SUPPORTS_CAPABILITY_VIDEO;
 const char *capability_sound = SYNC_SUPPORTS_CAPABILITY_SOUND;
@@ -841,13 +841,13 @@ int utc_sync_manager_add_data_change_sync_job_p(void)
 
        ret = sync_manager_remove_sync_job(sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
+#endif
 
        ret = sync_manager_add_data_change_sync_job(account, capability_contact, SYNC_OPTION_NO_RETRY, user_data, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
 
        ret = sync_manager_remove_sync_job(sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
-#endif
 
        ret = sync_manager_add_data_change_sync_job(account, capability_sound, SYNC_OPTION_NONE, user_data, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
@@ -940,10 +940,10 @@ int utc_sync_manager_add_data_change_sync_job_n2(void)
 #ifdef MOBILE
        ret = sync_manager_add_data_change_sync_job(account, capability_calendar, -1, user_data, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_INVALID_PARAMETER);
+#endif
 
        ret = sync_manager_add_data_change_sync_job(NULL, capability_contact, -1, user_data, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_INVALID_PARAMETER);
-#endif
 
        ret = sync_manager_add_data_change_sync_job(account, capability_image, -1, NULL, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_INVALID_PARAMETER);
@@ -983,13 +983,13 @@ int utc_sync_manager_add_data_change_sync_job_p2(void)
 
        ret = sync_manager_remove_sync_job(sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
+#endif
 
        ret = sync_manager_add_data_change_sync_job(account, capability_contact, SYNC_OPTION_NONE, NULL, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
 
        ret = sync_manager_remove_sync_job(sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
-#endif
 
        ret = sync_manager_add_data_change_sync_job(NULL, capability_image, SYNC_OPTION_NONE, NULL, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
@@ -1036,10 +1036,10 @@ int utc_sync_manager_add_data_change_sync_job_n3(void)
 #ifdef MOBILE
        ret = sync_manager_add_data_change_sync_job(account, capability_calendar, SYNC_OPTION_EXPEDITED, NULL, NULL);
        assert_eq(ret, SYNC_ERROR_INVALID_PARAMETER);
+#endif
 
        ret = sync_manager_add_data_change_sync_job(NULL, capability_contact, (SYNC_OPTION_NO_RETRY | SYNC_OPTION_EXPEDITED), NULL, NULL);
        assert_eq(ret, SYNC_ERROR_INVALID_PARAMETER);
-#endif
 
        bundle_free(user_data);
 
@@ -1070,10 +1070,10 @@ int utc_sync_manager_add_data_change_sync_job_n4(void)
 #ifdef MOBILE
        ret = sync_manager_add_data_change_sync_job(NULL, capability_calendar, SYNC_OPTION_EXPEDITED, user_data, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND);
+#endif
 
        ret = sync_manager_add_data_change_sync_job(account, capability_contact, (SYNC_OPTION_NO_RETRY | SYNC_OPTION_EXPEDITED), NULL, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND);
-#endif
 
        ret = sync_manager_add_data_change_sync_job(NULL, capability_image, SYNC_OPTION_NONE, NULL, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND);
@@ -1237,13 +1237,13 @@ int utc_sync_manager_remove_sync_job_p3(void)
 
        ret = sync_manager_remove_sync_job(sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
+#endif
 
        ret = sync_manager_add_data_change_sync_job(NULL, capability_contact, SYNC_OPTION_NO_RETRY, user_data, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
 
        ret = sync_manager_remove_sync_job(sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
-#endif
 
        ret = sync_manager_add_data_change_sync_job(account, capability_image, SYNC_OPTION_NONE, NULL, &sync_job_id);
        assert_eq(ret, SYNC_ERROR_NONE);
index e05ad63398f45fa858a151afbffa3c60a9b53403..aeb91aa53c0aa4edf42aa4adbf564707bb4127eb 100644 (file)
@@ -53,7 +53,7 @@ extern "C"
 /**
  *  @brief             This is contact capability string.
  *  @since_tizen 2.4
- *  @remarks   This capability is supported on Mobile profile only. If you want to receive notification about contact DB change, add it through sync_manager_add_data_change_sync_job().
+ *  @remarks   If you want to receive notification about contact DB change, add it through sync_manager_add_data_change_sync_job().
  *  @see               sync_manager_add_data_change_sync_job()
   */
 #define SYNC_SUPPORTS_CAPABILITY_CONTACT       "http://tizen.org/sync/capability/contact"
@@ -127,6 +127,9 @@ typedef enum {
  *
  * @since_tizen 2.4
  *
+ * @remarks Release account with account_destroy() after using it.\n\n
+ * Release sync_job_user_data with bundle_free() after using it.
+ *
  * @param[in] account                          An account handle on which sync operation was requested or @c NULL in the case of accountless sync operation
  * @param[in] sync_job_name                    A string representing a sync job which has been operated or @c NULL in the case of data change sync operation
  * @param[in] sync_capability          A string representing a sync job which has been operated because of data change or @c NULL in the case of on demand and periodic sync operation
@@ -217,7 +220,7 @@ int sync_manager_add_periodic_sync_job(account_h account, const char *sync_job_n
  *
  * @remarks Data change sync job can be added by using its capability. In the case of adding a sync job with same capability, it will replace previous setting with new one. \n\n
  * %http://tizen.org/privilege/calendar.read is needed to add data change sync job for receiving notification with @ref SYNC_SUPPORTS_CAPABILITY_CALENDAR. This capability is supported on Mobile profile only. \n\n
- * %http://tizen.org/privilege/contact.read is needed to add data change sync job for receiving notification with @ref SYNC_SUPPORTS_CAPABILITY_CONTACT. This capability is supported on Mobile profile only.
+ * %http://tizen.org/privilege/contact.read is needed to add data change sync job for receiving notification with @ref SYNC_SUPPORTS_CAPABILITY_CONTACT.
  *
  * @param[in] account                          An account handle on which sync operation was requested or @c NULL in the case of accountless sync operation
  * @param[in] sync_capability          A string representing a sync job which will be operated whenever data change of this capability
index 17a4556fe697226285e97b3a765586481149cdb4..d22927fe48d2830da0ad0ec22f7bccf7100b83f2 100644 (file)
@@ -55,7 +55,7 @@ typedef enum {
        SYNC_ERROR_QUOTA_EXCEEDED                       = TIZEN_ERROR_QUOTA_EXCEEDED,           /**< Quota exceeded */
        SYNC_ERROR_UNKNOWN                                      = TIZEN_ERROR_UNKNOWN,                          /**< Unknown Error */
        SYNC_ERROR_SYSTEM                                       = TIZEN_ERROR_SYNC_MANAGER | 0x01,      /**< System error */
-       SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND       = TIZEN_ERROR_SYNC_MANAGER | 0x02       /**< Sync adater is not registered */
+       SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND       = TIZEN_ERROR_SYNC_MANAGER | 0x02       /**< Sync adapter is not registered */
 } sync_error_e;
 
 
index 37348b15382a5250bf9c6f775445c8e156b0227e..1ab16deeefe8c67f6672ffd27355da57d5fa4544 100644 (file)
@@ -44,7 +44,9 @@ extern "C" {
  * @brief Callback function for Sync Adapter's start sync request.
  *
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks    This API only can be called at a service application.
+ * @remarks    This API only can be called at a service application.\n\n
+ * Release account with account_destroy() after using it.\n\n
+ * Release sync_job_user_data with bundle_free() after using it.
  *
  * @param[in] account                          An account handle on which sync operation was requested or @c NULL in the case of accountless sync operation
  * @param[in] sync_job_name                    A string representing a sync job which has been operated or @c NULL in the case of data change sync operation
@@ -70,7 +72,9 @@ typedef bool (*sync_adapter_start_sync_cb)(account_h account, const char *sync_j
  * @brief Callback function for Sync Adapter's cancel sync request.
  *
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks    This API only can be called at a service application after calling sync_manager_remove_sync_job().
+ * @remarks    This API only can be called at a service application after calling sync_manager_remove_sync_job().\n\n
+ * Release account with account_destroy() after using it.\n\n
+ * Release sync_job_user_data with bundle_free() after using it.
  *
  * @param[in] account                          An account handle on which sync operation was requested or @c NULL in the case of accountless sync operation
  * @param[in] sync_job_name                    A string representing a sync job which has been operated or @c NULL in the case of data change sync operation
@@ -87,7 +91,7 @@ typedef void (*sync_adapter_cancel_sync_cb)(account_h account, const char *sync_
 
 
 /**
- * @brief Sets client (Sync Aadapter) callback functions
+ * @brief Sets client (Sync Adapter) callback functions
  *
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  * @remarks    This API only can be called by a service application. And it can be set by only one service application per a package.
index 277e731a14978a0a11dd77de4193da12956b9abc..668ab16ad135e43b27db43a36526e5a68eb93de0 100644 (file)
@@ -41,6 +41,15 @@ extern "C"
  */
 
 
+/**
+ *  @brief             This is contact capability string.
+ *  @since_tizen 3.0
+ *  @remarks   If you want to receive notification about contact DB change, add it through sync_manager_add_data_change_sync_job().
+ *  @see               sync_manager_add_data_change_sync_job()
+  */
+#define SYNC_SUPPORTS_CAPABILITY_CONTACT       "http://tizen.org/sync/capability/contact"
+
+
 /**
  *  @brief             This is image capability string.
  *  @since_tizen 3.0
@@ -109,6 +118,9 @@ typedef enum {
  *
  * @since_tizen 3.0
  *
+ * @remarks Release account with account_destroy() after using it.\n\n
+ * Release sync_job_user_data with bundle_free() after using it.
+ *
  * @param[in] account                          An account handle on which sync operation was requested or @c NULL in the case of accountless sync operation
  * @param[in] sync_job_name                    A string representing a sync job which has been operated or @c NULL in the case of data change sync operation
  * @param[in] sync_capability          A string representing a sync job which has been operated because of data change or @c NULL in the case of on demand and periodic sync operation
@@ -193,8 +205,11 @@ int sync_manager_add_periodic_sync_job(account_h account, const char *sync_job_n
  * @brief Requests Sync Manager to perform sync operations whenever corresponding DB changed.
  *
  * @since_tizen 3.0
+ * @privlevel  public
+ * @privilege  %http://tizen.org/privilege/contact.read
  *
  * @remarks Data change sync job can be added by using its capability. In the case of adding a sync job with same capability, it will replace previous setting with new one. \n\n
+ * %http://tizen.org/privilege/contact.read is needed to add data change sync job for receiving notification with @ref SYNC_SUPPORTS_CAPABILITY_CONTACT.
  *
  * @param[in] account                          An account handle on which sync operation was requested or @c NULL in the case of accountless sync operation
  * @param[in] sync_capability          A string representing a sync job which will be operated whenever data change of this capability
index 5bf68a41a4eba7279c51beaf24261c76bf6339df..c1e5280f62d9b3a810b25983806694197944189e 100644 (file)
@@ -1,5 +1,5 @@
 Name:      sync-service
-Version:   0.1.5
+Version:   0.1.6
 Release:   1
 License:   Apache-2.0
 Summary:   Sync manager daemon
@@ -31,8 +31,8 @@ BuildRequires: pkgconfig(cynara-session)
 BuildRequires: pkgconfig(cynara-creds-gdbus)
 %if "%{?profile}" == "mobile"
 BuildRequires: pkgconfig(calendar-service2)
-BuildRequires: pkgconfig(contacts-service2)
 %endif
+BuildRequires: pkgconfig(contacts-service2)
 BuildRequires: pkgconfig(capi-content-media-content)
 BuildRequires: pkgconfig(libtzplatform-config)
 
@@ -73,10 +73,10 @@ cp %{SOURCE2} .
 _CONTAINER_ENABLE=OFF
 
 %if "%{?profile}" == "mobile"
-_CALENDAR_CONTACTS_ENABLE=ON
+_CALENDAR_ENABLE=ON
 _FEATURE_MOBILE_PROFILE=ON
 %else
-_CALENDAR_CONTACTS_ENABLE=OFF
+_CALENDAR_ENABLE=OFF
 _FEATURE_MOBILE_PROFILE=OFF
 %endif
 
@@ -87,7 +87,7 @@ cmake \
        -DLIBDIR=%{_libdir} \
        -DINCLUDEDIR=%{_includedir} \
        -D_SEC_FEATURE_CONTAINER_ENABLE:BOOL=${_CONTAINER_ENABLE} \
-       -D_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE:BOOL=${_CALENDAR_CONTACTS_ENABLE} \
+       -D_SEC_FEATURE_CALENDAR_ENABLE:BOOL=${_CALENDAR_ENABLE} \
        -D_SEC_FEATURE_MOBILE_PROFILE:BOOL=${_FEATURE_MOBILE_PROFILE} \
        -DVERSION=%{version}
 
index be6b6e1746403c2080342cd2eb6ce655f7151d31..5857c1ca2bf9a73fa7487cf0a367e669ef6990b7 100644 (file)
@@ -28,9 +28,9 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(VERSION_MAJOR 1)
 SET(FULLVER "${VERSION_MAJOR}.0")
 
-IF(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
-       ADD_DEFINITIONS("-D_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE=1")
-ENDIF(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+IF(_SEC_FEATURE_CALENDAR_ENABLE)
+       ADD_DEFINITIONS("-D_SEC_FEATURE_CALENDAR_ENABLE=1")
+ENDIF(_SEC_FEATURE_CALENDAR_ENABLE)
 
 
 INCLUDE_DIRECTORIES(
index 3a63dd654d0c00c23402d94a587b4dacd63ba913..d39c7c7c4e4fe49b6e60d9d492530b4ec48fa39e 100644 (file)
@@ -318,10 +318,10 @@ int sync_manager_add_data_change_sync_job(account_h account, const char *sync_ca
 {
        if (sync_capability != NULL) {
                if (
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
                        !(strcmp(sync_capability, "http://tizen.org/sync/capability/calendar")) ||
-                       !(strcmp(sync_capability, "http://tizen.org/sync/capability/contact")) ||
 #endif
+                       !(strcmp(sync_capability, "http://tizen.org/sync/capability/contact")) ||
                        !(strcmp(sync_capability, "http://tizen.org/sync/capability/image")) ||
                        !(strcmp(sync_capability, "http://tizen.org/sync/capability/video")) ||
                        !(strcmp(sync_capability, "http://tizen.org/sync/capability/sound")) ||
index 767681c4bf84113af91c62cb72b98d74fd009ff0..e6f8a1af402c8e44f915f544aac16048b3f733df 100644 (file)
@@ -75,9 +75,9 @@ SET(SRCS
 #      ADD_DEFINITIONS("-D_SEC_FEATURE_CONTAINER_ENABLE=1")
 #ENDIF(_SEC_FEATURE_CONTAINER_ENABLE)
 
-IF(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
-       ADD_DEFINITIONS("-D_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE=1")
-ENDIF(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+IF(_SEC_FEATURE_CALENDAR_ENABLE)
+       ADD_DEFINITIONS("-D_SEC_FEATURE_CALENDAR_ENABLE=1")
+ENDIF(_SEC_FEATURE_CALENDAR_ENABLE)
 
 ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
 
@@ -100,6 +100,7 @@ SET(PACKAGES
                gio-unix-2.0
                alarm-service
                bundle
+               contacts-service2
                cynara-client
                cynara-session
                cynara-creds-gdbus
@@ -110,9 +111,9 @@ IF(_SEC_FEATURE_CONTAINER_ENABLE)
        SET(PACKAGES ${PACKAGES} vasum)
 ENDIF(_SEC_FEATURE_CONTAINER_ENABLE)
 
-IF(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
-       SET(PACKAGES ${PACKAGES} calendar-service2 contacts-service2)
-ENDIF(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+IF(_SEC_FEATURE_CALENDAR_ENABLE)
+       SET(PACKAGES ${PACKAGES} calendar-service2)
+ENDIF(_SEC_FEATURE_CALENDAR_ENABLE)
 
 pkg_check_modules(PKGS REQUIRED ${PACKAGES})
 
index 51efd23d16d864bbdb522aff7f52995345c7b87a..a8dee4bc64017866288bbcbb63fb71775d82f05c 100644 (file)
  * @brief   This is the implementation file for the DataChangeListener class.
  */
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
 #include <calendar.h>
-#include <contacts.h>
 #endif
 
+#include <contacts.h>
 #include <media_content.h>
 #include "sync-error.h"
 #include "sync_manager.h"
@@ -33,7 +33,7 @@
 
 
 /* LCOV_EXCL_START */
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
 void OnCalendarBookChanged(const char* view_uri, void* user_data) {
        LOG_LOGD("On Calendar Book Changed");
 
@@ -56,6 +56,7 @@ void OnCalendarTodoChanged(const char* view_uri, void* user_data) {
        DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data);
        pDCScheduler->HandleDataChangeEvent(SYNC_SUPPORTS_CAPABILITY_CALENDAR);
 }
+#endif
 
 
 void OnContactsDataChanged(const char* view_uri, void* user_data) {
@@ -64,7 +65,6 @@ void OnContactsDataChanged(const char* view_uri, void* user_data) {
        DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data);
        pDCScheduler->HandleDataChangeEvent(SYNC_SUPPORTS_CAPABILITY_CONTACT);
 }
-#endif
 
 
 void OnMediaContentDataChanged(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, media_content_db_update_type_e update_type, media_content_type_e media_type, char *uuid, char *path, char *mime_type, void *user_data) {
@@ -117,7 +117,7 @@ DataChangeSyncScheduler::~DataChangeSyncScheduler(void) {
 /* LCOV_EXCL_STOP */
 
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
 int
 DataChangeSyncScheduler::SubscribeCalendarCallback(void) {
        SYNC_LOGE_RET_RES(!calendar_subscription_started, SYNC_ERROR_NONE, "Calendar Callback Already Subscribed");
@@ -170,6 +170,7 @@ DataChangeSyncScheduler::SubscribeCalendarCallback(void) {
 
        return SYNC_ERROR_NONE;
 }
+#endif
 
 
 int
@@ -195,7 +196,6 @@ DataChangeSyncScheduler::SubscribeContactsCallback(void) {
 
        return SYNC_ERROR_NONE;
 }
-#endif
 
 
 int
@@ -226,7 +226,7 @@ DataChangeSyncScheduler::SubscribeMediaContentCallback(void) {
 
 
 /* LCOV_EXCL_START */
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
 int
 DataChangeSyncScheduler::UnSubscribeCalendarCallback(void) {
        SYNC_LOGE_RET_RES(calendar_subscription_started, SYNC_ERROR_NONE, "Calendar Callback Already UnSubscribed");
@@ -240,6 +240,7 @@ DataChangeSyncScheduler::UnSubscribeCalendarCallback(void) {
 
        return SYNC_ERROR_NONE;
 }
+#endif
 
 
 int
@@ -253,7 +254,6 @@ DataChangeSyncScheduler::UnSubscribeContactsCallback(void) {
 
        return SYNC_ERROR_NONE;
 }
-#endif
 
 
 int
@@ -274,7 +274,7 @@ int
 DataChangeSyncScheduler::RegisterDataChangeListeners(void) {
        int err = SYNC_ERROR_NONE;
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
        err = SubscribeCalendarCallback();
        if (err != SYNC_ERROR_NONE) {
                /* LCOV_EXCL_START */
@@ -282,6 +282,7 @@ DataChangeSyncScheduler::RegisterDataChangeListeners(void) {
                return SYNC_ERROR_INVALID_OPERATION;
                /* LCOV_EXCL_STOP */
        }
+#endif
 
        err = SubscribeContactsCallback();
        if (err != SYNC_ERROR_NONE) {
@@ -290,7 +291,6 @@ DataChangeSyncScheduler::RegisterDataChangeListeners(void) {
                return SYNC_ERROR_INVALID_OPERATION;
                /* LCOV_EXCL_STOP */
        }
-#endif
 
        err = SubscribeMediaContentCallback();
        if (err != SYNC_ERROR_NONE) {
@@ -309,19 +309,19 @@ int
 DataChangeSyncScheduler::DeRegisterDataChangeListeners(void) {
        int err = VALUE_UNDEFINED;
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
        err = UnSubscribeCalendarCallback();
        if (err != SYNC_ERROR_NONE) {
                LOG_LOGD("DeRegistration of Calendar DataChangeListener Failed");
                return SYNC_ERROR_INVALID_OPERATION;
        }
+#endif
 
        err = UnSubscribeContactsCallback();
        if (err != SYNC_ERROR_NONE) {
                LOG_LOGD("DeRegistration of Contacts DataChangeListener Failed");
                return SYNC_ERROR_INVALID_OPERATION;
        }
-#endif
 
        err = UnSubscribeMediaContentCallback();
        if (err != SYNC_ERROR_NONE) {
index 5634842dc33f4a5e39129b7f56792ae32a710484..673516add67dd711be0f31f2981d5f6c06c809d2 100644 (file)
  * @brief   This is the implementation file for the PeriodicSyncScheduler class.
  */
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
 #include <calendar.h>
-#include <contacts.h>
 #endif
 
+#include <contacts.h>
 #include <media_content.h>
 #include "sync-error.h"
 #include "SyncManager_PeriodicSyncScheduler.h"
index 106abe66fdb2d4b1246f07556c9d83f75e59899b..2fae85bc5fdebec8a333a80107c45e18f81b887d 100644 (file)
@@ -121,20 +121,6 @@ enum BatteryStatus {
 };
 
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
-enum DataChangeStatus {
-       /** Calendar Book */
-       CALENDAR_BOOK_CHANGED = 0,
-       /** Calendar Event */
-       CALENDAR_EVENT_CHANGED,
-       /** Calendar Todo */
-       CALENDAR_TODO_CHANGED,
-       /** Contacts Modify */
-       CONTACTS_DATA_CHANGED,
-};
-#endif
-
-
 enum SyncDispatchMessage {
        /** Sync Finished*/
        SYNC_FINISHED = 0,
index c3e9c0066ca41733a121a27a87041004af822aa7..fbc4717e74953e3826c7a9cd63ea769e1fdab595 100644 (file)
@@ -60,11 +60,12 @@ static bool check_jobs = false;
 #define SYNC_ERROR_PREFIX "org.tizen.sync.Error"
 #define PRIV_ALARM_SET "http://tizen.org/privilege/alarm.set"
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
 #define PRIV_CALENDAR_READ "http://tizen.org/privilege/calendar.read"
-#define PRIV_CONTACT_READ "http://tizen.org/privilege/contact.read"
 #endif
 
+#define PRIV_CONTACT_READ "http://tizen.org/privilege/contact.read"
+
 #define SYS_DBUS_INTERFACE                             "org.tizen.system.deviced.PowerOff"
 #define SYS_DBUS_MATCH_RULE                            "type='signal',interface='org.tizen.system.deviced.PowerOff'"
 #define SYS_DBUS_PATH                                  "/Org/Tizen/System/DeviceD/PowerOff"
@@ -323,16 +324,16 @@ int _check_privilege_alarm_set(GDBusMethodInvocation *invocation) {
 }
 
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
 int _check_privilege_calendar_read(GDBusMethodInvocation *invocation) {
        return _check_privilege(invocation, PRIV_CALENDAR_READ);
 }
+#endif
 
 
 int _check_privilege_contact_read(GDBusMethodInvocation *invocation) {
        return _check_privilege(invocation, PRIV_CONTACT_READ);
 }
-#endif
 
 
 gboolean sync_adapter_handle_send_result(TizenSyncAdapter* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine, gint sync_result, const gchar* sync_job_name);
@@ -880,7 +881,7 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio
 
        int ret = SYNC_ERROR_NONE;
 
-#if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE)
+#if defined(_SEC_FEATURE_CALENDAR_ENABLE)
        const char *capability = (char *)pCapabilityArg;
        if (!strcmp(capability, "http://tizen.org/sync/capability/calendar") ||
                !strcmp(capability, "http://tizen.org/sync/capability/contact")) {
@@ -897,6 +898,22 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio
                        else
                                error = g_error_new(_sync_error_quark(), ret, "sync service: contact.read permission denied");
 
+                       g_dbus_method_invocation_return_gerror(pInvocation, error);
+                       g_clear_error(&error);
+                       /* LCOV_EXCL_STOP */
+                       return true;
+               }
+       }
+#else
+       const char *capability = (char *)pCapabilityArg;
+       if (!strcmp(capability, "http://tizen.org/sync/capability/contact")) {
+               ret = _check_privilege_contact_read(pInvocation);
+
+               if (ret != SYNC_ERROR_NONE) {
+                       /* LCOV_EXCL_START */
+                       GError* error = NULL;
+                       error = g_error_new(_sync_error_quark(), ret, "sync service: contact.read permission denied");
+
                        g_dbus_method_invocation_return_gerror(pInvocation, error);
                        g_clear_error(&error);
                        /* LCOV_EXCL_STOP */