|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|