|
|
|
@ -1418,9 +1418,6 @@ public class ServiceSynchronize extends ServiceBase {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void boot(final Context context) {
|
|
|
|
|
if (!booted) {
|
|
|
|
|
booted = true;
|
|
|
|
|
|
|
|
|
|
Thread thread = new Thread(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
@ -1443,9 +1440,7 @@ public class ServiceSynchronize extends ServiceBase {
|
|
|
|
|
int pollInterval = prefs.getInt("poll_interval", 0);
|
|
|
|
|
int accounts = db.account().getSynchronizingAccounts().size();
|
|
|
|
|
if (enabled && pollInterval == 0 && accounts > 0)
|
|
|
|
|
ContextCompat.startForegroundService(context,
|
|
|
|
|
new Intent(context, ServiceSynchronize.class)
|
|
|
|
|
.setAction("init"));
|
|
|
|
|
init(context);
|
|
|
|
|
else {
|
|
|
|
|
for (EntityAccount account : db.account().getAccounts())
|
|
|
|
|
db.account().setAccountState(account.id, null);
|
|
|
|
@ -1463,6 +1458,11 @@ public class ServiceSynchronize extends ServiceBase {
|
|
|
|
|
thread.setPriority(THREAD_PRIORITY_BACKGROUND);
|
|
|
|
|
thread.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void init(Context context) {
|
|
|
|
|
ContextCompat.startForegroundService(context,
|
|
|
|
|
new Intent(context, ServiceSynchronize.class)
|
|
|
|
|
.setAction("init"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void schedule(Context context) {
|
|
|
|
|