diff options
Diffstat (limited to 'src/sync-service/SyncManager_SyncManager.cpp')
-rw-r--r-- | src/sync-service/SyncManager_SyncManager.cpp | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/src/sync-service/SyncManager_SyncManager.cpp b/src/sync-service/SyncManager_SyncManager.cpp index b94c71f..29921ad 100644 --- a/src/sync-service/SyncManager_SyncManager.cpp +++ b/src/sync-service/SyncManager_SyncManager.cpp @@ -72,7 +72,6 @@ Singleton< SyncManager >::GetInstance() } } return __pInstance; - } @@ -139,7 +138,6 @@ SyncManager::AddPeriodicSyncJob(string pPackageId, const char* syncJobName, int if (period < 1800) { LOG_LOGD("Requested period %d is less than minimum, rounding up to 30 mins", period); - period = 1800; } @@ -160,7 +158,10 @@ SyncManager::AddPeriodicSyncJob(string pPackageId, const char* syncJobName, int __pPeriodicSyncScheduler->SchedulePeriodicSyncJob(pRequestedJob); if (pRequestedJob->IsExpedited()) { + LOG_LOGD("The sync job has priority"); ScheduleSyncJob(pRequestedJob); + } else { + LOG_LOGD("It's non-priority sync job"); } return SYNC_ERROR_NONE; @@ -395,8 +396,6 @@ SyncManager::OnBatteryStatusChanged(int value) } - - static int OnPackageUninstalled(int reqId, const char* pPkgType, const char* pPkgId, const char* pKey, const char* pVal, const void* pMsg, void* pData) { @@ -681,6 +680,7 @@ SyncManager::SyncManager(void) , __isSimDataConnectionPresent(false) , __isUPSModeEnabled(false) , __isSyncPermitted(true) + , __pManageIdleState(NULL) , __pNetworkChangeListener(NULL) , __pStorageListener(NULL) , __pBatteryStatusListener(NULL) @@ -713,6 +713,9 @@ SyncManager::Construct(void) LOG_LOGE_BOOL(ret == VCONF_OK, "vconf_get_int failed %d", ret); __isUPSModeEnabled = (upsMode == SETTING_PSMODE_EMERGENCY) ? true : false; + __pManageIdleState = new (std::nothrow) ManageIdleState(); + LOG_LOGE_BOOL(__pManageIdleState, "Failed to construct ManageIdleState"); + __pNetworkChangeListener = new (std::nothrow) NetworkChangeListener(); LOG_LOGE_BOOL(__pNetworkChangeListener, "Failed to construct NetworkChangeListener"); @@ -783,8 +786,8 @@ SyncManager::Construct(void) Initialize(); + //__pSyncRepositoryEngine->OnBooting(); - __pSyncRepositoryEngine->OnBooting(); return true; } @@ -893,6 +896,14 @@ SyncManager::GetSyncJobsAggregator() return __pSyncJobsAggregator; } + +ManageIdleState* +SyncManager::GetManageIdleState() +{ + return __pManageIdleState; +} + + void SyncManager::HandleShutdown(void) { @@ -902,6 +913,24 @@ SyncManager::HandleShutdown(void) } +void +SyncManager::RecordSyncAdapter(void) +{ + pthread_mutex_lock(&__syncJobQueueMutex); + __pSyncRepositoryEngine->SaveCurrentSyncAdapter(); + pthread_mutex_unlock(&__syncJobQueueMutex); +} + + +void +SyncManager::RecordSyncJob(void) +{ + pthread_mutex_lock(&__syncJobQueueMutex); + __pSyncRepositoryEngine->SaveCurrentSyncJob(); + pthread_mutex_unlock(&__syncJobQueueMutex); +} + + bool SyncManager::GetSyncSupport(int accountId) { @@ -924,6 +953,8 @@ SyncManager::GetSyncSupport(int accountId) return false; } + LOG_LOGD("The account supports sync"); + return true; } @@ -1015,7 +1046,7 @@ SyncManager::SendSyncAlarmMessage() void SyncManager::SendSyncCheckAlarmMessage() { - LOG_LOGD("Fire SYNC_CHECK_ALARM "); + LOG_LOGD("Fire SYNC_CHECK_ALARM"); Message msg; msg.type = SYNC_CHECK_ALARM; //TO DO: Implement code to remove all the pending messages from queue before firing a new one @@ -1060,7 +1091,7 @@ SyncManager::ScheduleSyncJob(SyncJob* pJob, bool fireCheckAlarm) { if(fireCheckAlarm) { - LOG_LOGD("Added sync job [%s] to Main queue, Intiating dispatch sequence", pJob->__key.c_str()); + LOG_LOGD("Added sync job [%s] to Main queue, Initiating dispatch sequence", pJob->__key.c_str()); SendSyncCheckAlarmMessage(); } } |