1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 04:35:57 +00:00

Keep alive via the watchdog

This commit is contained in:
M66B 2021-03-29 20:08:35 +02:00
parent 5a79409ed3
commit 7b5d25b56c
3 changed files with 7 additions and 15 deletions

View file

@ -115,7 +115,7 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
getMainHandler().postDelayed(new Runnable() {
@Override
public void run() {
ServiceSynchronize.eval(ActivityMain.this, "main");
ServiceSynchronize.watchdog(ActivityMain.this);
ServiceSend.watchdog(ActivityMain.this);
}
}, SERVICE_START_DELAY);

View file

@ -174,15 +174,10 @@ public class ApplicationEx extends Application
DisconnectBlacklist.init(this);
boolean watchdog = prefs.getBoolean("watchdog", true);
boolean enabled = prefs.getBoolean("enabled", true);
if (watchdog && enabled)
WorkerWatchdog.init(this);
else {
ServiceSynchronize.watchdog(this);
ServiceSend.watchdog(this);
}
ServiceSynchronize.watchdog(this);
ServiceSend.watchdog(this);
WorkerWatchdog.init(this);
WorkerCleanup.init(this);
registerReceiver(onScreenOff, new IntentFilter(Intent.ACTION_SCREEN_OFF));

View file

@ -2502,12 +2502,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
static void watchdog(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean enabled = prefs.getBoolean("enabled", true);
if (enabled)
start(context,
new Intent(context, ServiceSynchronize.class)
.setAction("watchdog"));
start(context,
new Intent(context, ServiceSynchronize.class)
.setAction("watchdog"));
}
static void restart(Context context) {