Loading services/core/java/com/android/server/content/SyncManager.java +33 −19 Original line number Diff line number Diff line Loading @@ -316,25 +316,9 @@ public class SyncManager { } public void updateRunningAccounts() { mRunningAccounts = AccountManagerService.getSingleton().getRunningAccounts(); if (mBootCompleted) { doDatabaseCleanup(); } AccountAndUser[] accounts = mRunningAccounts; for (ActiveSyncContext currentSyncContext : mActiveSyncContexts) { if (!containsAccountAndUser(accounts, currentSyncContext.mSyncOperation.target.account, currentSyncContext.mSyncOperation.target.userId)) { Log.d(TAG, "canceling sync since the account is no longer running"); sendSyncFinishedOrCanceledMessage(currentSyncContext, null /* no result since this is a cancel */); } } // we must do this since we don't bother scheduling alarms when // the accounts are not set yet sendCheckAlarmsMessage(); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "sending MESSAGE_ACCOUNTS_UPDATED"); // Update accounts in handler thread. mSyncHandler.sendEmptyMessage(SyncHandler.MESSAGE_ACCOUNTS_UPDATED); } private void doDatabaseCleanup() { Loading Loading @@ -2099,6 +2083,7 @@ public class SyncManager { * obj: {@link com.android.server.content.SyncManager.ActiveSyncContext} */ private static final int MESSAGE_MONITOR_SYNC = 8; private static final int MESSAGE_ACCOUNTS_UPDATED = 9; public final SyncNotificationInfo mSyncNotificationInfo = new SyncNotificationInfo(); private Long mAlarmScheduleTime = null; Loading Loading @@ -2216,6 +2201,13 @@ public class SyncManager { // to also take into account the periodic syncs. earliestFuturePollTime = scheduleReadyPeriodicSyncs(); switch (msg.what) { case SyncHandler.MESSAGE_ACCOUNTS_UPDATED: if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "handleSyncHandlerMessage: MESSAGE_ACCOUNTS_UPDATED"); } updateRunningAccountsH(); break; case SyncHandler.MESSAGE_CANCEL: SyncStorageEngine.EndPoint endpoint = (SyncStorageEngine.EndPoint) msg.obj; Bundle extras = msg.peekData(); Loading Loading @@ -2764,6 +2756,28 @@ public class SyncManager { return nextReadyToRunTime; } private void updateRunningAccountsH() { mRunningAccounts = AccountManagerService.getSingleton().getRunningAccounts(); if (mBootCompleted) { doDatabaseCleanup(); } AccountAndUser[] accounts = mRunningAccounts; for (ActiveSyncContext currentSyncContext : mActiveSyncContexts) { if (!containsAccountAndUser(accounts, currentSyncContext.mSyncOperation.target.account, currentSyncContext.mSyncOperation.target.userId)) { Log.d(TAG, "canceling sync since the account is no longer running"); sendSyncFinishedOrCanceledMessage(currentSyncContext, null /* no result since this is a cancel */); } } // we must do this since we don't bother scheduling alarms when // the accounts are not set yet sendCheckAlarmsMessage(); } private boolean isSyncNotUsingNetworkH(ActiveSyncContext activeSyncContext) { final long bytesTransferredCurrent = getTotalBytesTransferredByUid(activeSyncContext.mSyncAdapterUid); Loading Loading
services/core/java/com/android/server/content/SyncManager.java +33 −19 Original line number Diff line number Diff line Loading @@ -316,25 +316,9 @@ public class SyncManager { } public void updateRunningAccounts() { mRunningAccounts = AccountManagerService.getSingleton().getRunningAccounts(); if (mBootCompleted) { doDatabaseCleanup(); } AccountAndUser[] accounts = mRunningAccounts; for (ActiveSyncContext currentSyncContext : mActiveSyncContexts) { if (!containsAccountAndUser(accounts, currentSyncContext.mSyncOperation.target.account, currentSyncContext.mSyncOperation.target.userId)) { Log.d(TAG, "canceling sync since the account is no longer running"); sendSyncFinishedOrCanceledMessage(currentSyncContext, null /* no result since this is a cancel */); } } // we must do this since we don't bother scheduling alarms when // the accounts are not set yet sendCheckAlarmsMessage(); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "sending MESSAGE_ACCOUNTS_UPDATED"); // Update accounts in handler thread. mSyncHandler.sendEmptyMessage(SyncHandler.MESSAGE_ACCOUNTS_UPDATED); } private void doDatabaseCleanup() { Loading Loading @@ -2099,6 +2083,7 @@ public class SyncManager { * obj: {@link com.android.server.content.SyncManager.ActiveSyncContext} */ private static final int MESSAGE_MONITOR_SYNC = 8; private static final int MESSAGE_ACCOUNTS_UPDATED = 9; public final SyncNotificationInfo mSyncNotificationInfo = new SyncNotificationInfo(); private Long mAlarmScheduleTime = null; Loading Loading @@ -2216,6 +2201,13 @@ public class SyncManager { // to also take into account the periodic syncs. earliestFuturePollTime = scheduleReadyPeriodicSyncs(); switch (msg.what) { case SyncHandler.MESSAGE_ACCOUNTS_UPDATED: if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "handleSyncHandlerMessage: MESSAGE_ACCOUNTS_UPDATED"); } updateRunningAccountsH(); break; case SyncHandler.MESSAGE_CANCEL: SyncStorageEngine.EndPoint endpoint = (SyncStorageEngine.EndPoint) msg.obj; Bundle extras = msg.peekData(); Loading Loading @@ -2764,6 +2756,28 @@ public class SyncManager { return nextReadyToRunTime; } private void updateRunningAccountsH() { mRunningAccounts = AccountManagerService.getSingleton().getRunningAccounts(); if (mBootCompleted) { doDatabaseCleanup(); } AccountAndUser[] accounts = mRunningAccounts; for (ActiveSyncContext currentSyncContext : mActiveSyncContexts) { if (!containsAccountAndUser(accounts, currentSyncContext.mSyncOperation.target.account, currentSyncContext.mSyncOperation.target.userId)) { Log.d(TAG, "canceling sync since the account is no longer running"); sendSyncFinishedOrCanceledMessage(currentSyncContext, null /* no result since this is a cancel */); } } // we must do this since we don't bother scheduling alarms when // the accounts are not set yet sendCheckAlarmsMessage(); } private boolean isSyncNotUsingNetworkH(ActiveSyncContext activeSyncContext) { final long bytesTransferredCurrent = getTotalBytesTransferredByUid(activeSyncContext.mSyncAdapterUid); Loading