mirror of https://github.com/M66B/FairEmail.git
Small improvements
This commit is contained in:
parent
3351a2efbe
commit
fe43910b93
|
@ -2318,6 +2318,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
private boolean started = false;
|
private boolean started = false;
|
||||||
private int queued = 0;
|
private int queued = 0;
|
||||||
private long lastLost = 0;
|
private long lastLost = 0;
|
||||||
|
PowerManager pm = getSystemService(PowerManager.class);
|
||||||
|
PowerManager.WakeLock wl = pm.newWakeLock(
|
||||||
|
PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":manage");
|
||||||
private ExecutorService queue = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
private ExecutorService queue = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2576,18 +2579,14 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
|
|
||||||
queued++;
|
queued++;
|
||||||
queue.submit(new Runnable() {
|
queue.submit(new Runnable() {
|
||||||
PowerManager pm = getSystemService(PowerManager.class);
|
|
||||||
PowerManager.WakeLock wl = pm.newWakeLock(
|
|
||||||
PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":manage");
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
EntityLog.log(ServiceSynchronize.this, "Reload " +
|
|
||||||
" stop=" + doStop + " start=" + doStart + " queued=" + queued + " " + reason);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
wl.acquire();
|
wl.acquire();
|
||||||
|
|
||||||
|
EntityLog.log(ServiceSynchronize.this, "Reload " +
|
||||||
|
" stop=" + doStop + " start=" + doStart + " queued=" + queued + " " + reason);
|
||||||
|
|
||||||
if (doStop)
|
if (doStop)
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
|
@ -2597,8 +2596,6 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||||
} finally {
|
} finally {
|
||||||
wl.release();
|
|
||||||
|
|
||||||
queued--;
|
queued--;
|
||||||
EntityLog.log(ServiceSynchronize.this, "Reload done queued=" + queued);
|
EntityLog.log(ServiceSynchronize.this, "Reload done queued=" + queued);
|
||||||
|
|
||||||
|
@ -2612,6 +2609,8 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2635,7 +2634,6 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
new Intent(context, ServiceSynchronize.class)
|
new Intent(context, ServiceSynchronize.class)
|
||||||
.setAction("reload")
|
.setAction("reload")
|
||||||
.putExtra("reason", reason));
|
.putExtra("reason", reason));
|
||||||
JobDaily.schedule(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ServiceState {
|
private class ServiceState {
|
||||||
|
|
Loading…
Reference in New Issue