diff options
author | Jyothi Kumar Sambolu <s.jyothi@samsung.com> | 2015-12-08 14:08:13 +0530 |
---|---|---|
committer | Jyothi Kumar Sambolu <s.jyothi@samsung.com> | 2015-12-10 19:45:32 +0530 |
commit | 4c55a31cbe6179e032c07caa52e4299068f7f2ec (patch) | |
tree | 628be53a483fb94272d2283608e3ebe9f8719072 | |
parent | 96d5d0379e435efbf26f34400631f11efbe887ab (diff) | |
download | sync-manager-4c55a31cbe6179e032c07caa52e4299068f7f2ec.tar.gz sync-manager-4c55a31cbe6179e032c07caa52e4299068f7f2ec.tar.bz2 sync-manager-4c55a31cbe6179e032c07caa52e4299068f7f2ec.zip |
Removal of unecessary packages, gdbus migration and prevent fixessubmit/tizen_tv/20151214.084119submit/tizen_mobile/20151214.084052accepted/tizen/tv/20151214.135208accepted/tizen/mobile/20151214.134821
Change-Id: I534d28b7e215b413262e01791de35508fd93f88d
Signed-off-by: Jyothi Kumar Sambolu <s.jyothi@samsung.com>
-rw-r--r-- | packaging/sync-manager.spec | 9 | ||||
-rw-r--r-- | src/sync-client/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/sync-client/sync_adapter.c | 6 | ||||
-rw-r--r-- | src/sync-service/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/sync-service/SyncManager_CurrentSyncContext.cpp | 2 | ||||
-rw-r--r-- | src/sync-service/SyncManager_ISyncJob.h | 1 | ||||
-rw-r--r-- | src/sync-service/SyncManager_PeriodicSyncJob.cpp | 1 | ||||
-rw-r--r-- | src/sync-service/SyncManager_RepositoryEngine.h | 2 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncAdapterAggregator.cpp | 1 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncDefines.h | 1 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncJobDispatcher.cpp | 2 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncJobQueue.cpp | 1 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncManager.cpp | 3 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncService.cpp | 70 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncStatusInfo.cpp | 1 | ||||
-rw-r--r-- | src/sync-service/SyncManager_SyncWorker.cpp | 11 | ||||
-rw-r--r-- | src/sync-service/main.cpp | 66 |
17 files changed, 77 insertions, 112 deletions
diff --git a/packaging/sync-manager.spec b/packaging/sync-manager.spec index bf6e433..c449112 100644 --- a/packaging/sync-manager.spec +++ b/packaging/sync-manager.spec @@ -14,19 +14,13 @@ ExcludeArch: %{arm} %ix86 x86_64 %endif BuildRequires: cmake -BuildRequires: pkgconfig(capi-system-info) -BuildRequires: pkgconfig(capi-system-runtime-info) -BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(capi-appfw-application) -BuildRequires: pkgconfig(capi-appfw-package-manager) BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(pkgmgr) BuildRequires: pkgconfig(pkgmgr-info) -BuildRequires: pkgconfig(appsvc) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(vconf-internal-keys) BuildRequires: pkgconfig(libxml-2.0) @@ -44,8 +38,7 @@ BuildRequires: pkgconfig(contacts-service2) %endif BuildRequires: pkgconfig(capi-content-media-content) BuildRequires: pkgconfig(libtzplatform-config) -BuildRequires: python-xml -#BuildRequires: pkgconfig(vasum) + %description sync manager service and sync framework which manages sync of registered applications diff --git a/src/sync-client/CMakeLists.txt b/src/sync-client/CMakeLists.txt index 2118010..129ef86 100644 --- a/src/sync-client/CMakeLists.txt +++ b/src/sync-client/CMakeLists.txt @@ -52,15 +52,8 @@ ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"") INCLUDE(FindPkgConfig) pkg_check_modules(PKGS REQUIRED - capi-system-device - capi-system-info - capi-appfw-application capi-appfw-app-manager - pkgmgr - pkgmgr-info dlog - appsvc - appcore-efl gio-unix-2.0 bundle) diff --git a/src/sync-client/sync_adapter.c b/src/sync-client/sync_adapter.c index c2a87fb..83849ac 100644 --- a/src/sync-client/sync_adapter.c +++ b/src/sync-client/sync_adapter.c @@ -21,7 +21,6 @@ #include <stdio.h> #include <app.h> #include <app_manager.h> -#include <pkgmgr-info.h> #include <account.h> #include <bundle.h> #include <pthread.h> @@ -158,14 +157,15 @@ int __register_sync_adapter(bool flag) SYNC_LOGE_RET_RES(error == NULL && ipcObj != NULL, SYNC_ERROR_IO_ERROR, "tizen_sync_manager_proxy_new_sync failed %s", error->message); char *command_line = proc_get_cmdline_self(); - if (flag) + if (flag) { ret = tizen_sync_manager_call_add_sync_adapter_sync(ipcObj, command_line, NULL, &error); + SYNC_LOGE_RET_RES(ret && !error, SYNC_ERROR_QUOTA_EXCEEDED, "Register sync adapter failed %s", error->message); + } else tizen_sync_manager_call_remove_sync_adapter_sync(ipcObj, command_line, NULL, &error); free(command_line); - SYNC_LOGE_RET_RES(ret, SYNC_ERROR_QUOTA_EXCEEDED, "Register sync adapter failed %s", error->message); SYNC_LOGE_RET_RES(error == NULL, SYNC_ERROR_IO_ERROR, "Register sync adapter failed %s", error->message); return SYNC_ERROR_NONE; diff --git a/src/sync-service/CMakeLists.txt b/src/sync-service/CMakeLists.txt index 6c9d651..d462a1e 100644 --- a/src/sync-service/CMakeLists.txt +++ b/src/sync-service/CMakeLists.txt @@ -82,18 +82,13 @@ INCLUDE(FindPkgConfig) SET(PACKAGES ecore capi-network-connection - capi-system-runtime-info - capi-system-device capi-appfw-application capi-appfw-app-manager pkgmgr pkgmgr-info dlog - db-util - appsvc appcore-efl glib-2.0 - capi-system-info vconf vconf-internal-keys accounts-svc diff --git a/src/sync-service/SyncManager_CurrentSyncContext.cpp b/src/sync-service/SyncManager_CurrentSyncContext.cpp index 307568e..38c1a64 100644 --- a/src/sync-service/SyncManager_CurrentSyncContext.cpp +++ b/src/sync-service/SyncManager_CurrentSyncContext.cpp @@ -32,6 +32,8 @@ CurrentSyncContext::CurrentSyncContext(SyncJob* pSyncJob) { __pCurrentSyncJob = pSyncJob; + __startTime = 0; + __timerId = -1; } diff --git a/src/sync-service/SyncManager_ISyncJob.h b/src/sync-service/SyncManager_ISyncJob.h index 380b2f4..7f88255 100644 --- a/src/sync-service/SyncManager_ISyncJob.h +++ b/src/sync-service/SyncManager_ISyncJob.h @@ -47,6 +47,7 @@ class ISyncJob public: ISyncJob() : __syncJobId(-1) + , __syncType(SYNC_TYPE_UNKNOWN) { } diff --git a/src/sync-service/SyncManager_PeriodicSyncJob.cpp b/src/sync-service/SyncManager_PeriodicSyncJob.cpp index 7ad91eb..5257e86 100644 --- a/src/sync-service/SyncManager_PeriodicSyncJob.cpp +++ b/src/sync-service/SyncManager_PeriodicSyncJob.cpp @@ -42,6 +42,7 @@ PeriodicSyncJob::PeriodicSyncJob(const string appId, const string syncJobName, i PeriodicSyncJob::PeriodicSyncJob(const PeriodicSyncJob& other) : SyncJob(other) + , __period(other.__period) { /* this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; diff --git a/src/sync-service/SyncManager_RepositoryEngine.h b/src/sync-service/SyncManager_RepositoryEngine.h index 7994ca0..48b6aed 100644 --- a/src/sync-service/SyncManager_RepositoryEngine.h +++ b/src/sync-service/SyncManager_RepositoryEngine.h @@ -99,8 +99,6 @@ private: map<string, map<string, SyncJob*> > __Aggr; // Data sync job list to be scheduled map<int, SyncStatusInfo*> __syncStatus; - int PENDING_FINISH_TO_WRITE; - static RepositoryEngine* __pInstance; static const long DEFAULT_PERIOD_SEC; diff --git a/src/sync-service/SyncManager_SyncAdapterAggregator.cpp b/src/sync-service/SyncManager_SyncAdapterAggregator.cpp index f90f598..c040c62 100644 --- a/src/sync-service/SyncManager_SyncAdapterAggregator.cpp +++ b/src/sync-service/SyncManager_SyncAdapterAggregator.cpp @@ -27,7 +27,6 @@ #include <vconf.h> #include <alarm.h> #include <glib.h> -#include <aul.h> #include <pkgmgr-info.h> #include <app_manager.h> #include "SyncManager_SyncManager.h" diff --git a/src/sync-service/SyncManager_SyncDefines.h b/src/sync-service/SyncManager_SyncDefines.h index e0eb99d..2d7da06 100644 --- a/src/sync-service/SyncManager_SyncDefines.h +++ b/src/sync-service/SyncManager_SyncDefines.h @@ -229,6 +229,7 @@ struct Message acc = NULL; pSyncJob = NULL; res = SYNC_STATUS_UNKNOWN; + type = SYNC_CHECK_ALARM; } SyncDispatchMessage type; diff --git a/src/sync-service/SyncManager_SyncJobDispatcher.cpp b/src/sync-service/SyncManager_SyncJobDispatcher.cpp index 69df945..52d905a 100644 --- a/src/sync-service/SyncManager_SyncJobDispatcher.cpp +++ b/src/sync-service/SyncManager_SyncJobDispatcher.cpp @@ -25,10 +25,8 @@ #include <alarm.h> #include <glib.h> #include <unistd.h> -#include <device/power.h> #include "sync-error.h" #include "sync-log.h" -#include <aul.h> #include "SyncManager_SyncJobDispatcher.h" #include "SyncManager_SyncManager.h" #include "SyncManager_SyncJob.h" diff --git a/src/sync-service/SyncManager_SyncJobQueue.cpp b/src/sync-service/SyncManager_SyncJobQueue.cpp index b464c2e..ecc956e 100644 --- a/src/sync-service/SyncManager_SyncJobQueue.cpp +++ b/src/sync-service/SyncManager_SyncJobQueue.cpp @@ -42,6 +42,7 @@ extern "C" SyncJobQueue::SyncJobQueue(void) + : __pSyncRepositoryEngine(NULL) { //Empty } diff --git a/src/sync-service/SyncManager_SyncManager.cpp b/src/sync-service/SyncManager_SyncManager.cpp index ae4717e..b13b99e 100644 --- a/src/sync-service/SyncManager_SyncManager.cpp +++ b/src/sync-service/SyncManager_SyncManager.cpp @@ -28,7 +28,6 @@ #include <vconf.h> #include <alarm.h> #include <glib.h> -#include <aul.h> #include <pkgmgr-info.h> #include <app_manager.h> #include <tzplatform_config.h> @@ -199,6 +198,8 @@ SyncManager::RemoveSyncJob(string packageId, int syncJobId) } SyncJob* pJob = dynamic_cast< SyncJob* > (pSyncJob); + SYNC_LOGE_RET_RES(pJob != NULL, SYNC_ERROR_SYSTEM, "Failed to cast %d", syncJobId); + CancelSync(pJob); __pSyncJobsAggregator->RemoveSyncJob(packageId.c_str(), syncJobId); diff --git a/src/sync-service/SyncManager_SyncService.cpp b/src/sync-service/SyncManager_SyncService.cpp index 6d7200c..fc29d19 100644 --- a/src/sync-service/SyncManager_SyncService.cpp +++ b/src/sync-service/SyncManager_SyncService.cpp @@ -28,14 +28,15 @@ #include <assert.h> #include <glib.h> #include <app.h> -#include <aul.h> #include <app_manager.h> #include <pkgmgr-info.h> +#include <Elementary.h> #include <cynara-client.h> #include <cynara-session.h> #include <cynara-creds-gdbus.h> #include "sync-error.h" #include "SyncManager_SyncManager.h" +#include "SyncManager_ServiceInterface.h" #include "sync-manager-stub.h" #include "sync-ipc-marshal.h" #include "sync-adapter-stub.h" @@ -64,12 +65,16 @@ static cynara *pCynara; #endif -GDBusObjectManagerServer* pServerManager = NULL; - +#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" +#define POWEROFF_MSG "ChangeState" +bool ShutdownInitiated = false; static TizenSyncManager* sync_ipc_obj = NULL; GHashTable* g_hash_table = NULL; string sa_app_id; +static guint signal_id = -1; using namespace std; @@ -351,7 +356,7 @@ SyncService::TriggerStartSync(const char* appId, int accountId, const char* sync -1, NULL, &error); - if (error || ret == NULL) + if (error) { LOG_LOGD("g_dbus_connection_call_sync gdbus error [%s]", error->message); g_clear_error(&error); @@ -361,8 +366,9 @@ SyncService::TriggerStartSync(const char* appId, int accountId, const char* sync } else { - int isRunning = aul_app_is_running(appId); - if (isRunning == 0) + bool isRunning = false; + app_manager_is_running(appId, &isRunning); + if (!isRunning) { LOG_LOGD("app is not running, launch the app and wait for signal"); ret = app_control_create(&app_control); @@ -559,7 +565,7 @@ int get_service_name_by_pid(guint pid, char** pAppId) -1, NULL, &error); - if (error || unit == NULL) + if (error) { LOG_LOGC("get_service_name_by_pid gdbus error [%s]", error->message); *pAppId = NULL; @@ -581,7 +587,7 @@ int get_service_name_by_pid(guint pid, char** pAppId) -1, NULL, &error); - if (error || service == NULL) + if (error) { LOG_LOGC("get_service_name_by_pid gdbus error [%s]", error->message); *pAppId = NULL; @@ -1029,6 +1035,12 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* { bool check_jobs = false; SyncAdapterAggregator* pAggregator = SyncManager::GetInstance()->GetSyncAdapterAggregator(); + if (pAggregator == NULL) + { + LOG_LOGD("sync adapter aggregator is NULL"); + tizen_sync_manager_complete_add_sync_adapter(pObject, pInvocation); + return true; + } if (pAggregator->HasSyncAdapter(pkgIdStr.c_str())) { const char *registered_app_id = pAggregator->GetSyncAdapter(pkgIdStr.c_str()); @@ -1059,12 +1071,6 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* if (g_dbus_interface_skeleton_export(interface, gdbusConnection, object_path, &error)) { g_signal_connect(syncAdapterObj, "handle-send-result", G_CALLBACK(sync_adapter_handle_send_result), NULL); - - if (pAggregator == NULL) { - LOG_LOGD("sync adapter aggregator is NULL"); - tizen_sync_manager_complete_add_sync_adapter(pObject, pInvocation); - return true; - } pAggregator->AddSyncAdapter(pkgIdStr.c_str(), pAppId); LOG_LOGD("inserting sync adapter ipc %s", pAppId); @@ -1275,6 +1281,32 @@ sync_manager_set_sync_status( TizenSyncManager* pObject, GDBusMethodInvocation* } +void +DbusSignalHandler(GDBusConnection* pConnection, + const gchar* pSenderName, + const gchar* pObjectPath, + const gchar* pInterfaceName, + const gchar* pSignalName, + GVariant* pParameters, + gpointer data) +{ + if (!(g_strcmp0(pObjectPath, SYS_DBUS_PATH)) && !(g_strcmp0(pSignalName, POWEROFF_MSG))) + { + LOG_LOGD("Shutdown dbus received"); + if (ShutdownInitiated == false) + { + ShutdownInitiated = true; + sync_service_finalise(); + ecore_main_loop_quit(); + } + if (pConnection && (signal_id != (unsigned int)-1)) + { + g_dbus_connection_signal_unsubscribe(pConnection, signal_id); + g_object_unref(pConnection); + } + } +} + /* * DBus related initialization and setup */ @@ -1304,9 +1336,14 @@ OnBusAcquired (GDBusConnection* pConnection, const gchar* pName, gpointer userDa g_signal_connect(sync_ipc_obj, "handle-set-sync-status", G_CALLBACK(sync_manager_set_sync_status), NULL); gdbusConnection = pConnection; - LOG_LOGD("Sync Service started [%s]", pName); - //g_dbus_object_manager_server_set_connection(pServerManager, connection); + signal_id = g_dbus_connection_signal_subscribe(pConnection, NULL, SYS_DBUS_INTERFACE, POWEROFF_MSG, SYS_DBUS_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE, DbusSignalHandler, NULL, NULL); + if (signal_id == (unsigned int)-1) + { + LOG_LOGD("unable to register for PowerOff Signal"); + return; + } + LOG_LOGD("Sync Service started [%s]", pName); } @@ -1365,6 +1402,7 @@ SyncService::InitializeDbus(void) * DBus related initialization done */ SyncService::SyncService(void) + : __pSyncManagerInstance(NULL) { LOG_LOGD("Sync service initialization starts"); diff --git a/src/sync-service/SyncManager_SyncStatusInfo.cpp b/src/sync-service/SyncManager_SyncStatusInfo.cpp index 1cc48a5..595f3f1 100644 --- a/src/sync-service/SyncManager_SyncStatusInfo.cpp +++ b/src/sync-service/SyncManager_SyncStatusInfo.cpp @@ -62,6 +62,7 @@ SyncStatusInfo::operator =(SyncStatusInfo& other) } SyncStatusInfo::SyncStatusInfo(string statusInfo) + : capabilityId(-1) { if (statusInfo.empty()) { diff --git a/src/sync-service/SyncManager_SyncWorker.cpp b/src/sync-service/SyncManager_SyncWorker.cpp index 49b7a4e..c0b49db 100644 --- a/src/sync-service/SyncManager_SyncWorker.cpp +++ b/src/sync-service/SyncManager_SyncWorker.cpp @@ -29,6 +29,13 @@ {*/ SyncWorker::SyncWorker(void) + : __pendingRequestsMutex(PTHREAD_MUTEX_INITIALIZER) + , __message(SYNC_CHECK_ALARM) + , __pContext(NULL) + , __pLoop(NULL) + , __pChannel(NULL) + , __pSource(NULL) + , __pThread(NULL) { } @@ -173,10 +180,10 @@ gboolean SyncWorker::OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpointer data) { LOG_LOGD("GIO event received"); - SyncWorker* pSyncWorker = static_cast<SyncWorker*>(data); + SYNC_LOGE_RET_RES(pSyncWorker != NULL, FALSE, "Data is NULL"); - if ((condition & G_IO_IN) && pSyncWorker != NULL) + if ((condition & G_IO_IN) != 0) { uint64_t tmp = 0; gsize readSize = 0; diff --git a/src/sync-service/main.cpp b/src/sync-service/main.cpp index 20fd4db..f1d0d17 100644 --- a/src/sync-service/main.cpp +++ b/src/sync-service/main.cpp @@ -14,44 +14,19 @@ * limitations under the License. */ -#include <dbus/dbus.h> -#include <dbus/dbus-glib-lowlevel.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <bundle.h> #include <vector> #include <app.h> -#include <aul.h> #include <Elementary.h> #include "pthread.h" #include "SyncManager_ServiceInterface.h" #include "sync-log.h" -#define SYS_DBUS_INTERFACE "org.tizen.system.deviced.PowerOff" -#define SYS_DBUS_MATCH_RULE "type='signal',interface='org.tizen.system.deviced.PowerOff'" -#define POWEROFF_MSG "ChangeState" - -static bool ShutdownInitiated = false; - -DBusHandlerResult -DbusSignalHandler(DBusConnection* pConnection, DBusMessage* pMsg, void* pUserData) -{ - if (dbus_message_is_signal(pMsg, SYS_DBUS_INTERFACE, POWEROFF_MSG)) - { - LOG_LOGD("Shutdown dbus received"); - if (ShutdownInitiated == false) - { - ShutdownInitiated = true; - sync_service_finalise(); - ecore_main_loop_quit(); - } - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - +extern bool ShutdownInitiated; static Eina_Bool OnIdle(void* pUserData) @@ -89,45 +64,6 @@ main(int argc, char **argv) ecore_idler_add(OnIdle, NULL); - //Dbus handler to catch shutdown signal in kiran - DBusError error; - - dbus_error_init(&error); - DBusConnection* pConn = dbus_bus_get(DBUS_BUS_SESSION, &error); - - if (dbus_error_is_set(&error)) - { - LOG_LOGD("Failed to get System BUS connection: %s", error.message); - dbus_error_free(&error); - } - else - { - dbus_connection_setup_with_g_main(pConn, NULL); - //dbus_bus_get_with_g_main () - if (dbus_error_is_set(&error)) - { - LOG_LOGD("Failed to add D-BUS poweroff match rule, cause: %s", error.message); - dbus_error_free(&error); - } - else - { - dbus_bus_add_match(pConn, SYS_DBUS_MATCH_RULE, &error); - if (dbus_error_is_set(&error)) - { - LOG_LOGD("Failed to add Poweroff match rule, cause: %s", error.message); - dbus_error_free(&error); - } - else - { - if (!dbus_connection_add_filter(pConn, DbusSignalHandler, NULL, NULL)) - { - LOG_LOGD("Not enough memory to add poweroff filter"); - dbus_bus_remove_match(pConn, SYS_DBUS_MATCH_RULE, NULL); - } - } - } - } - ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, OnTerminate, NULL); int ret = sync_service_initialise(); |