|
|
|
@ -2251,7 +2251,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
|
private int queued = 0;
|
|
|
|
|
private long lastLost = 0;
|
|
|
|
|
private EntityFolder outbox = null;
|
|
|
|
|
private ExecutorService lifecycle = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
|
|
|
|
private ExecutorService queue = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
|
|
|
|
private ExecutorService executor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -2435,15 +2435,16 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
|
state = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void queue_reload(final boolean start, String reason) {
|
|
|
|
|
private void queue_reload(final boolean start, final String reason) {
|
|
|
|
|
synchronized (queue) {
|
|
|
|
|
final boolean doStop = started;
|
|
|
|
|
final boolean doStart = (start && isEnabled() && suitableNetwork());
|
|
|
|
|
|
|
|
|
|
EntityLog.log(ServiceSynchronize.this, "Reload start=" + start +
|
|
|
|
|
EntityLog.log(ServiceSynchronize.this, "Queue reload " +
|
|
|
|
|
" doStop=" + doStop + " doStart=" + doStart + " queued=" + queued + " " + reason);
|
|
|
|
|
|
|
|
|
|
queued++;
|
|
|
|
|
lifecycle.submit(new Runnable() {
|
|
|
|
|
queue.submit(new Runnable() {
|
|
|
|
|
PowerManager pm = getSystemService(PowerManager.class);
|
|
|
|
|
PowerManager.WakeLock wl = pm.newWakeLock(
|
|
|
|
|
PowerManager.PARTIAL_WAKE_LOCK,
|
|
|
|
@ -2451,6 +2452,9 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
EntityLog.log(ServiceSynchronize.this, "Reload " +
|
|
|
|
|
" doStop=" + doStop + " doStart=" + doStart + " queued=" + queued + " " + reason);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
wl.acquire();
|
|
|
|
|
|
|
|
|
@ -2466,6 +2470,8 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
|
wl.release();
|
|
|
|
|
|
|
|
|
|
queued--;
|
|
|
|
|
EntityLog.log(ServiceSynchronize.this, "Reload done queued=" + queued);
|
|
|
|
|
|
|
|
|
|
if (queued == 0 && !isEnabled()) {
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(STOP_DELAY);
|
|
|
|
@ -2482,6 +2488,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
|
|
|
|
|
|
started = doStart;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BroadcastReceiver outboxReceiver = new BroadcastReceiver() {
|
|
|
|
|
@Override
|
|
|
|
|