Loading core/java/android/content/SyncManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -1588,7 +1588,7 @@ class SyncManager implements OnAccountsUpdatedListener { ContentResolver.SYNC_EXTRAS_MANUAL, false); final boolean syncAutomatically = mSyncStorageEngine.getSyncAutomatically(op.account, op.authority) || mSyncStorageEngine.getMasterSyncAutomatically(); && mSyncStorageEngine.getMasterSyncAutomatically(); boolean syncAllowed = manualSync || (backgroundDataUsageAllowed && syncAutomatically); if (!syncAllowed) { Loading core/java/android/content/SyncStorageEngine.java +16 −7 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ public class SyncStorageEngine extends Handler { private static final int MSG_WRITE_STATISTICS = 2; private static final long WRITE_STATISTICS_DELAY = 1000*60*30; // 1/2 hour private static final boolean SYNC_ENABLED_DEFAULT = false; public static class PendingOperation { final Account account; final int syncSource; Loading Loading @@ -158,7 +160,7 @@ public class SyncStorageEngine extends Handler { this.account = account; this.authority = authority; this.ident = ident; enabled = true; enabled = SYNC_ENABLED_DEFAULT; } } Loading Loading @@ -376,23 +378,30 @@ public class SyncStorageEngine extends Handler { } public void setSyncAutomatically(Account account, String providerName, boolean sync) { boolean wasEnabled; synchronized (mAuthorities) { AuthorityInfo authority = getAuthorityLocked(account, providerName, "setSyncAutomatically"); if (authority != null) { AuthorityInfo authority = getOrCreateAuthorityLocked(account, providerName, -1, false); wasEnabled = authority.enabled; authority.enabled = sync; } writeAccountInfoLocked(); } if (!wasEnabled && sync) { mContext.getContentResolver().requestSync(account, providerName, new Bundle()); } reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS); } public void setMasterSyncAutomatically(boolean flag) { boolean old; synchronized (mAuthorities) { old = mMasterSyncAutomatically; mMasterSyncAutomatically = flag; writeAccountInfoLocked(); } if (!old && flag) { mContext.getContentResolver().requestSync(null, null, new Bundle()); } reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS); mContext.sendBroadcast(SYNC_CONNECTION_SETTING_CHANGED_INTENT); } Loading Loading
core/java/android/content/SyncManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -1588,7 +1588,7 @@ class SyncManager implements OnAccountsUpdatedListener { ContentResolver.SYNC_EXTRAS_MANUAL, false); final boolean syncAutomatically = mSyncStorageEngine.getSyncAutomatically(op.account, op.authority) || mSyncStorageEngine.getMasterSyncAutomatically(); && mSyncStorageEngine.getMasterSyncAutomatically(); boolean syncAllowed = manualSync || (backgroundDataUsageAllowed && syncAutomatically); if (!syncAllowed) { Loading
core/java/android/content/SyncStorageEngine.java +16 −7 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ public class SyncStorageEngine extends Handler { private static final int MSG_WRITE_STATISTICS = 2; private static final long WRITE_STATISTICS_DELAY = 1000*60*30; // 1/2 hour private static final boolean SYNC_ENABLED_DEFAULT = false; public static class PendingOperation { final Account account; final int syncSource; Loading Loading @@ -158,7 +160,7 @@ public class SyncStorageEngine extends Handler { this.account = account; this.authority = authority; this.ident = ident; enabled = true; enabled = SYNC_ENABLED_DEFAULT; } } Loading Loading @@ -376,23 +378,30 @@ public class SyncStorageEngine extends Handler { } public void setSyncAutomatically(Account account, String providerName, boolean sync) { boolean wasEnabled; synchronized (mAuthorities) { AuthorityInfo authority = getAuthorityLocked(account, providerName, "setSyncAutomatically"); if (authority != null) { AuthorityInfo authority = getOrCreateAuthorityLocked(account, providerName, -1, false); wasEnabled = authority.enabled; authority.enabled = sync; } writeAccountInfoLocked(); } if (!wasEnabled && sync) { mContext.getContentResolver().requestSync(account, providerName, new Bundle()); } reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS); } public void setMasterSyncAutomatically(boolean flag) { boolean old; synchronized (mAuthorities) { old = mMasterSyncAutomatically; mMasterSyncAutomatically = flag; writeAccountInfoLocked(); } if (!old && flag) { mContext.getContentResolver().requestSync(null, null, new Bundle()); } reportChange(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS); mContext.sendBroadcast(SYNC_CONNECTION_SETTING_CHANGED_INTENT); } Loading