/**
* @brief This is calendar capability string.
- * @since_tizen @if MOBILE 2.4 @endif
- * @remarks This capability is supported on Mobile profile only. If you want to receive notification about calendar DB change, add it through sync_manager_add_data_change_sync_job().
+ * @since_tizen @if MOBILE 2.4 @endif WEARABLE 4.0 @endif
+ * @remarks If you want to receive notification about calendar DB change, add it through sync_manager_add_data_change_sync_job().
* @see sync_manager_add_data_change_sync_job()
*/
#define SYNC_SUPPORTS_CAPABILITY_CALENDAR "http://tizen.org/sync/capability/calendar"
%global __provides_exclude_from ^.*\\.extension-calendar
Name: sync-service
-Version: 0.2.24
+Version: 0.2.25
Release: 1
License: Apache-2.0
Summary: Sync manager daemon
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-session)
BuildRequires: pkgconfig(cynara-creds-gdbus)
-# If it is mobile, common, or "unified (undefined)"
-%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
BuildRequires: pkgconfig(calendar-service2)
-%endif
BuildRequires: pkgconfig(contacts-service2)
BuildRequires: pkgconfig(capi-content-media-content)
BuildRequires: pkgconfig(libtzplatform-config)
%define _pkgdir /usr
%define _upgrade_script_path %{_pkgdir}/share/upgrade/scripts/
%define _upgrade_script 500.sync-manager.sh
-#%define _bindir %{_pkgdir}/bin
-#%define _systemd_dir /usr/lib/systemd/system
%prep
%setup -q
%build
_FEATURE_CONTAINER_ENABLE=OFF
-# If it is mobile, common, or "unified (undefined)"
-%if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi"
-# Support runtime feature on/off
-_RUNTIME_PROFILE_TEST=ON
-%else
-# Always off.
-_RUNTIME_PROFILE_TEST=OFF
-%endif
-
cmake \
-DCMAKE_INSTALL_PREFIX=%{_pkgdir} \
-DPACKAGE_NAME=%{name} \
-DLIBDIR=%{_libdir} \
-DINCLUDEDIR=%{_includedir} \
-D_FEATURE_CONTAINER_ENABLE:BOOL=${_FEATURE_CONTAINER_ENABLE} \
- -D_RUNTIME_PROFILE_TEST:BOOL=${_RUNTIME_PROFILE_TEST} \
-DVERSION=%{version}
-
make %{?jobs:-j%jobs}
%install
chsmack -a "*" %{TZ_SYS_HOME}/%{TZ_SYS_DEFAULT_USER}/.applications/dbspace/.sync-manager.db
chsmack -a "*" %{TZ_SYS_HOME}/%{TZ_SYS_DEFAULT_USER}/.applications/dbspace/.sync-manager.db-journal
-#chown system:system %{TZ_SYS_DATA}/sync-manager/
-#systemctl enable sync-manager.service
-#systemctl start sync-manager.service
-
%postun -n libcore-sync-client -p /sbin/ldconfig
%postun -n libcore-sync-client-devel -p /sbin/ldconfig
%defattr(-,root,root,-)
%config %{_sysconfdir}/dbus-1/session.d/org.tizen.sync.conf
%{_bindir}/*
-#%{_unitdir}/*
-#%{TZ_SYS_DATA}/sync-manager/
%{_unitdir_user}/sync-manager.service
%{_unitdir_user}/default.target.wants/sync-manager.service
%attr(0644,root,root) /usr/share/dbus-1/services/org.tizen.sync.service
ENDIF(NOT DEFINED PACKAGE_NAME)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-#SET(LIBDIR "${PREFIX}/lib")
-#SET(INCLUDEDIR "${PREFIX}/include")
SET(VERSION_MAJOR 1)
SET(FULLVER "${VERSION_MAJOR}.0")
-IF(_RUNTIME_PROFILE_TEST)
- ADD_DEFINITIONS("-D_RUNTIME_PROFILE_TEST=1")
-ENDIF(_RUNTIME_PROFILE_TEST)
-
-
INCLUDE_DIRECTORIES(
-# ./
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/common
)
#define SYNC_ADAPTER_DBUS_PATH "/org/tizen/sync/adapter"
#define SYNC_ERROR_PREFIX "org.tizen.sync.Error"
-#ifdef _RUNTIME_PROFILE_TEST
+
#include <system_info.h>
typedef enum {
TIZEN_PROFILE_UNKNOWN = 0,
return profile;
}
-#define _FEATURE_CALENDAR_ENABLE (_get_tizen_profile() == TIZEN_PROFILE_MOBILE)
-
-#else /* _RUNTIME_PROFILE_TEST */
-
-#define _FEATURE_CALENDAR_ENABLE (0)
-#endif /* _RUNTIME_PROFILE_TEST */
typedef struct sync_manager_s {
TizenSyncManager *ipcObj;
int sync_manager_add_data_change_sync_job(account_h account, const char *sync_capability, sync_option_e sync_option, bundle *sync_job_user_data, int *sync_job_id)
{
if (sync_capability != NULL) {
- if (
- ((_FEATURE_CALENDAR_ENABLE) ? !(strcmp(sync_capability, "http://tizen.org/sync/capability/calendar")) : 0) ||
+ if (!(strcmp(sync_capability, "http://tizen.org/sync/capability/calendar")) ||
!(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")) ||
# ADD_DEFINITIONS("-D_FEATURE_CONTAINER_ENABLE=1")
#ENDIF(_FEATURE_CONTAINER_ENABLE)
-IF(_RUNTIME_PROFILE_TEST)
- ADD_DEFINITIONS("-D_RUNTIME_PROFILE_TEST=1")
-ENDIF(_RUNTIME_PROFILE_TEST)
-
ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
INCLUDE(FindPkgConfig)
gio-unix-2.0
alarm-service
bundle
+ calendar-service2
contacts-service2
cynara-client
cynara-session
SET(PACKAGES ${PACKAGES} vasum)
ENDIF(_FEATURE_CONTAINER_ENABLE)
-IF(_RUNTIME_PROFILE_TEST)
- SET(PACKAGES ${PACKAGES} calendar-service2)
-ENDIF(_RUNTIME_PROFILE_TEST)
-
pkg_check_modules(PKGS REQUIRED ${PACKAGES})
FOREACH(flag ${PKGS_CFLAGS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS} "-ldl")
#TARGET_LINK_LIBRARIES(${PROJECT_NAME} core-sync-client)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+
* @brief This is the implementation file for the DataChangeListener class.
*/
-#if defined(_RUNTIME_PROFILE_TEST)
-#include <calendar.h>
-#endif
+#include <calendar.h>
#include <contacts.h>
#include <media_content.h>
#include "sync-error.h"
/* LCOV_EXCL_START */
-#if defined(_RUNTIME_PROFILE_TEST)
void OnCalendarBookChanged(const char* view_uri, void* user_data) {
LOG_LOGD("On Calendar Book Changed");
DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data);
pDCScheduler->HandleDataChangeEvent(SYNC_SUPPORTS_CAPABILITY_CALENDAR);
}
-#endif
void OnContactsDataChanged(const char* view_uri, void* user_data) {
/* LCOV_EXCL_STOP */
-#if defined(_RUNTIME_PROFILE_TEST)
int
DataChangeSyncScheduler::SubscribeCalendarCallback(void) {
SYNC_LOGE_RET_RES(!calendar_subscription_started, SYNC_ERROR_NONE, "Calendar Callback Already Subscribed");
return SYNC_ERROR_NONE;
}
-#endif
int
/* LCOV_EXCL_START */
-#if defined(_RUNTIME_PROFILE_TEST)
int
DataChangeSyncScheduler::UnSubscribeCalendarCallback(void) {
SYNC_LOGE_RET_RES(calendar_subscription_started, SYNC_ERROR_NONE, "Calendar Callback Already UnSubscribed");
return SYNC_ERROR_NONE;
}
-#endif
int
DataChangeSyncScheduler::RegisterDataChangeListeners(void) {
int err = SYNC_ERROR_NONE;
- if (_FEATURE_CALENDAR_ENABLE) {
- err = SubscribeCalendarCallback();
- if (err != SYNC_ERROR_NONE) {
- /* LCOV_EXCL_START */
- LOG_LOGD("Registration of Calendar DataChangeListener Failed");
- return SYNC_ERROR_INVALID_OPERATION;
- /* LCOV_EXCL_STOP */
- }
+ err = SubscribeCalendarCallback();
+ if (err != SYNC_ERROR_NONE) {
+ /* LCOV_EXCL_START */
+ LOG_LOGD("Registration of Calendar DataChangeListener Failed");
+ return SYNC_ERROR_INVALID_OPERATION;
+ /* LCOV_EXCL_STOP */
}
err = SubscribeContactsCallback();
DataChangeSyncScheduler::DeRegisterDataChangeListeners(void) {
int err = VALUE_UNDEFINED;
- if (_FEATURE_CALENDAR_ENABLE) {
- err = UnSubscribeCalendarCallback();
- if (err != SYNC_ERROR_NONE) {
- LOG_LOGD("DeRegistration of Calendar DataChangeListener Failed");
- return SYNC_ERROR_INVALID_OPERATION;
- }
+ err = UnSubscribeCalendarCallback();
+ if (err != SYNC_ERROR_NONE) {
+ LOG_LOGD("DeRegistration of Calendar DataChangeListener Failed");
+ return SYNC_ERROR_INVALID_OPERATION;
}
err = UnSubscribeContactsCallback();
}
}
}
+
} tizen_profile_t;
extern tizen_profile_t _get_tizen_profile();
-#ifdef _RUNTIME_PROFILE_TEST
-#define _FEATURE_CALENDAR_ENABLE (_get_tizen_profile() == TIZEN_PROFILE_MOBILE)
-#else /* _RUNTIME_PROFILE_TEST */
-#define _FEATURE_CALENDAR_ENABLE (0)
-#endif /* _RUNTIME_PROFILE_TEST */
#endif /* SYNC_SERVICE_SYNC_DEFINES_H */
int ret = SYNC_ERROR_NONE;
- if (_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")) {
- if (!strcmp(capability, "http://tizen.org/sync/capability/calendar"))
- ret = _check_privilege_calendar_read(pInvocation);
- else
- ret = _check_privilege_contact_read(pInvocation);
-
- if (ret != SYNC_ERROR_NONE) {
- /* LCOV_EXCL_START */
- GError* error = NULL;
- if (!strcmp(capability, "http://tizen.org/sync/capability/calendar"))
- error = g_error_new(_sync_error_quark(), ret, "sync service: calendar.read permission denied");
- 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")) {
+ const char *capability = (char *)pCapabilityArg;
+ if (!strcmp(capability, "http://tizen.org/sync/capability/calendar") ||
+ !strcmp(capability, "http://tizen.org/sync/capability/contact")) {
+ if (!strcmp(capability, "http://tizen.org/sync/capability/calendar"))
+ ret = _check_privilege_calendar_read(pInvocation);
+ else
ret = _check_privilege_contact_read(pInvocation);
- if (ret != SYNC_ERROR_NONE) {
- /* LCOV_EXCL_START */
- GError* error = NULL;
+ if (ret != SYNC_ERROR_NONE) {
+ /* LCOV_EXCL_START */
+ GError* error = NULL;
+ if (!strcmp(capability, "http://tizen.org/sync/capability/calendar"))
+ error = g_error_new(_sync_error_quark(), ret, "sync service: calendar.read permission denied");
+ 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;
- }
+ g_dbus_method_invocation_return_gerror(pInvocation, error);
+ g_clear_error(&error);
+ /* LCOV_EXCL_STOP */
+ return true;
}
}