Skip starting sync service on watchdog when receiving disabled

This commit is contained in:
M66B 2020-06-22 15:17:02 +02:00
parent 66eea4221a
commit eebf062b4e
1 changed files with 6 additions and 3 deletions

View File

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