|
|
|
@ -1521,15 +1521,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
// Cancel transient sync operations
|
|
|
|
|
boolean enabled = prefs.getBoolean("enabled", true);
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", DEFAULT_POLL_INTERVAL);
|
|
|
|
|
List<EntityOperation> syncs = db.operation().getOperations(account.id, EntityOperation.SYNC);
|
|
|
|
|
if (syncs != null)
|
|
|
|
|
for (EntityOperation op : syncs) {
|
|
|
|
|
db.folder().setFolderSyncState(op.folder, null);
|
|
|
|
|
if (!enabled || account.ondemand || (pollInterval > 0 && !account.poll_exempted)) {
|
|
|
|
|
if (!enabled || account.ondemand || (pollInterval > 0 && !account.poll_exempted)) {
|
|
|
|
|
List<EntityOperation> syncs = db.operation().getOperations(account.id, EntityOperation.SYNC);
|
|
|
|
|
if (syncs != null) {
|
|
|
|
|
for (EntityOperation op : syncs) {
|
|
|
|
|
db.folder().setFolderSyncState(op.folder, null);
|
|
|
|
|
db.operation().deleteOperation(op.id);
|
|
|
|
|
Log.i(account.name + " cancelled sync folder=" + op.folder);
|
|
|
|
|
}
|
|
|
|
|
Log.i(account.name + " cancelled syncs=" + syncs.size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Long back-off period, let device sleep
|
|
|
|
|
Intent intent = new Intent(ServiceSynchronize.this, ServiceSynchronize.class);
|
|
|
|
|