mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 20:54:34 +00:00
Simplification
This commit is contained in:
parent
861cf0eb4a
commit
cd023f5855
1 changed files with 61 additions and 78 deletions
|
@ -96,7 +96,6 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
|
|||
public class ServiceSynchronize extends LifecycleService {
|
||||
private TupleAccountStats lastStats = null;
|
||||
private ServiceManager serviceManager = new ServiceManager();
|
||||
private ExecutorService executor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||
|
||||
private static final int CONNECT_BACKOFF_START = 8; // seconds
|
||||
private static final int CONNECT_BACKOFF_MAX = 64; // seconds (totally 2 minutes)
|
||||
|
@ -138,15 +137,6 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
@Override
|
||||
public void onChanged(final List<TupleMessageEx> messages) {
|
||||
executor.submit(new Runnable() {
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
PowerManager.WakeLock wl = pm.newWakeLock(
|
||||
PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":notify");
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
wl.acquire();
|
||||
Log.i("Notification messages=" + messages.size());
|
||||
|
||||
Widget.update(ServiceSynchronize.this, messages.size());
|
||||
|
@ -216,13 +206,6 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
notifying.put(account, all);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
wl.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue