1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 11:45:36 +00:00

Cancel watchdog

This commit is contained in:
M66B 2022-03-04 20:10:25 +01:00
parent 0f9d7c3ba4
commit fe163967ae

View file

@ -2972,6 +2972,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
pi = PendingIntentCompat.getForegroundService(context, PI_WATCHDOG, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
am.cancel(pi);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean watchdog = prefs.getBoolean("watchdog", true);
boolean enabled = prefs.getBoolean("enabled", true);
@ -2982,8 +2984,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
next += WATCHDOG_INTERVAL;
EntityLog.log(context, "Watchdog next=" + new Date(next));
AlarmManagerCompatEx.setAndAllowWhileIdle(context, am, AlarmManager.RTC_WAKEUP, next, pi);
} else
am.cancel(pi);
}
}
static void eval(Context context, String reason) {