summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIckhee Woo <ickhee.woo@samsung.com>2016-06-23 11:21:20 +0900
committerIckhee Woo <ickhee.woo@samsung.com>2016-06-23 13:40:11 +0900
commit98eb21d186c58c9113c03022c6aa7be02de2e84a (patch)
treee947cb163f55324b76e0ebc958f27e8423b44a0f
parent12b2207cdacce90c97c16cea3d9ddb18e6275ecf (diff)
downloadsync-manager-98eb21d186c58c9113c03022c6aa7be02de2e84a.tar.gz
sync-manager-98eb21d186c58c9113c03022c6aa7be02de2e84a.tar.bz2
sync-manager-98eb21d186c58c9113c03022c6aa7be02de2e84a.zip
Change-Id: Iccef654d715a3fb24336afa9122a606629090ac7 Signed-off-by: Ickhee Woo <ickhee.woo@samsung.com>
-rwxr-xr-xTC/utc-sync-manager.c14
-rw-r--r--include/mobile/sync_manager.h7
-rw-r--r--include/sync-error.h2
-rw-r--r--include/sync_adapter.h10
-rw-r--r--include/wearable/sync_manager.h15
-rw-r--r--packaging/sync-manager.spec10
-rw-r--r--src/sync-client/CMakeLists.txt6
-rw-r--r--src/sync-client/sync_manager.c4
-rw-r--r--src/sync-service/CMakeLists.txt13
-rw-r--r--src/sync-service/SyncManager_DataChangeSyncScheduler.cpp24
-rw-r--r--src/sync-service/SyncManager_PeriodicSyncScheduler.cpp4
-rw-r--r--src/sync-service/SyncManager_SyncDefines.h14
-rw-r--r--src/sync-service/SyncManager_SyncService.cpp27
13 files changed, 88 insertions, 62 deletions
diff --git a/TC/utc-sync-manager.c b/TC/utc-sync-manager.c
index 54c9bab..f552952 100755
--- a/TC/utc-sync-manager.c
+++ b/TC/utc-sync-manager.c
@@ -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);
diff --git a/include/mobile/sync_manager.h b/include/mobile/sync_manager.h
index e05ad63..aeb91aa 100644
--- a/include/mobile/sync_manager.h
+++ b/include/mobile/sync_manager.h
@@ -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
diff --git a/include/sync-error.h b/include/sync-error.h
index 17a4556..d22927f 100644
--- a/include/sync-error.h
+++ b/include/sync-error.h
@@ -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;
diff --git a/include/sync_adapter.h b/include/sync_adapter.h
index 37348b1..1ab16de 100644
--- a/include/sync_adapter.h
+++ b/include/sync_adapter.h
@@ -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.
diff --git a/include/wearable/sync_manager.h b/include/wearable/sync_manager.h
index 277e731..668ab16 100644
--- a/include/wearable/sync_manager.h
+++ b/include/wearable/sync_manager.h
@@ -42,6 +42,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
* @remarks If you want to receive notification about media image DB change, add it through sync_manager_add_data_change_sync_job().
@@ -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
diff --git a/packaging/sync-manager.spec b/packaging/sync-manager.spec
index 5bf68a4..c1e5280 100644
--- a/packaging/sync-manager.spec
+++ b/packaging/sync-manager.spec
@@ -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}
diff --git a/src/sync-client/CMakeLists.txt b/src/sync-client/CMakeLists.txt
index be6b6e1..5857c1c 100644
--- a/src/sync-client/CMakeLists.txt
+++ b/src/sync-client/CMakeLists.txt
@@ -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(
diff --git a/src/sync-client/sync_manager.c b/src/sync-client/sync_manager.c
index 3a63dd6..d39c7c7 100644
--- a/src/sync-client/sync_manager.c
+++ b/src/sync-client/sync_manager.c
@@ -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")) ||
diff --git a/src/sync-service/CMakeLists.txt b/src/sync-service/CMakeLists.txt
index 767681c..e6f8a1a 100644
--- a/src/sync-service/CMakeLists.txt
+++ b/src/sync-service/CMakeLists.txt
@@ -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})
diff --git a/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp b/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp
index 51efd23..a8dee4b 100644
--- a/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp
+++ b/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp
@@ -19,11 +19,11 @@
* @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) {
diff --git a/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp b/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp
index 5634842..673516a 100644
--- a/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp
+++ b/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp
@@ -19,11 +19,11 @@
* @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"
diff --git a/src/sync-service/SyncManager_SyncDefines.h b/src/sync-service/SyncManager_SyncDefines.h
index 106abe6..2fae85b 100644
--- a/src/sync-service/SyncManager_SyncDefines.h
+++ b/src/sync-service/SyncManager_SyncDefines.h
@@ -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,
diff --git a/src/sync-service/SyncManager_SyncService.cpp b/src/sync-service/SyncManager_SyncService.cpp
index c3e9c00..fbc4717 100644
--- a/src/sync-service/SyncManager_SyncService.cpp
+++ b/src/sync-service/SyncManager_SyncService.cpp
@@ -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")) {
@@ -903,6 +904,22 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio
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 */
+ return true;
+ }
+ }
#endif
guint pid = get_caller_pid(pInvocation);