1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-04 10:39:25 +00:00

Cleanup back-off alarm

This commit is contained in:
M66B 2018-11-09 08:54:24 +00:00
parent c5847f3ec9
commit 4115882949

View file

@ -1220,16 +1220,22 @@ public class ServiceSynchronize extends LifecycleService {
registerReceiver(alarm, new IntentFilter(id));
AlarmManager am = getSystemService(AlarmManager.class);
am.setAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + CONNECT_BACKOFF_AlARM * 60 * 1000L,
pi);
try {
wl0.release();
Thread.sleep(2 * CONNECT_BACKOFF_AlARM * 60 * 1000L);
am.setAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + CONNECT_BACKOFF_AlARM * 60 * 1000L,
pi);
try {
wl0.release();
Thread.sleep(2 * CONNECT_BACKOFF_AlARM * 60 * 1000L);
} finally {
wl0.acquire();
}
} finally {
wl0.acquire();
// Cleanup
am.cancel(pi);
unregisterReceiver(alarm);
}
}