|
|
|
@ -106,6 +106,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
private static final long YIELD_DURATION = 200L; // milliseconds
|
|
|
|
|
private static final long QUIT_DELAY = 5 * 1000L; // milliseconds
|
|
|
|
|
private static final long STILL_THERE_THRESHOLD = 3 * 60 * 1000L; // milliseconds
|
|
|
|
|
static final int DEFAULT_POLL_INTERVAL = 0; // minutes
|
|
|
|
|
private static final int STILL_THERE_POLL_INTERVAL = 15; // minutes
|
|
|
|
|
private static final int CONNECT_BACKOFF_START = 8; // seconds
|
|
|
|
|
private static final int CONNECT_BACKOFF_MAX = 64; // seconds (totally 2 minutes)
|
|
|
|
@ -849,7 +850,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
if (!auto_optimize)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", 0);
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", DEFAULT_POLL_INTERVAL);
|
|
|
|
|
if (pollInterval == 0) {
|
|
|
|
|
prefs.edit().putInt("poll_interval", STILL_THERE_POLL_INTERVAL).apply();
|
|
|
|
|
try {
|
|
|
|
@ -940,7 +941,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
EntityLog.log(this, account.name + " last connected: " + new Date(account.last_connected));
|
|
|
|
|
|
|
|
|
|
long now = new Date().getTime();
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", 0);
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", DEFAULT_POLL_INTERVAL);
|
|
|
|
|
long delayed = now - account.last_connected - account.poll_interval * 60 * 1000L;
|
|
|
|
|
long maxDelayed = (pollInterval > 0 && !account.poll_exempted
|
|
|
|
|
? pollInterval * ACCOUNT_ERROR_AFTER_POLL : ACCOUNT_ERROR_AFTER) * 60 * 1000L;
|
|
|
|
@ -1541,7 +1542,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Stop retrying when polling
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", 0);
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", DEFAULT_POLL_INTERVAL);
|
|
|
|
|
if (pollInterval > 0 && !account.poll_exempted)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -1703,7 +1704,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSynchronize.this);
|
|
|
|
|
boolean enabled = prefs.getBoolean("enabled", true);
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", 0);
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", DEFAULT_POLL_INTERVAL);
|
|
|
|
|
|
|
|
|
|
long[] schedule = getSchedule(ServiceSynchronize.this);
|
|
|
|
|
long now = new Date().getTime();
|
|
|
|
|