disable automatic foreground service activation if related config paramaters are set to zero

This commit is contained in:
Daniel Gultsch 2016-12-30 20:24:35 +01:00
parent b8b2051f4c
commit fa70bd7536
1 changed files with 4 additions and 1 deletions

View File

@ -874,7 +874,10 @@ public class XmppConnectionService extends Service {
this.databaseBackend = DatabaseBackend.getInstance(getApplicationContext()); this.databaseBackend = DatabaseBackend.getInstance(getApplicationContext());
this.accounts = databaseBackend.getAccounts(); this.accounts = databaseBackend.getAccounts();
if (!keepForegroundService() && databaseBackend.startTimeCountExceedsThreshold()) { if (Config.FREQUENT_RESTARTS_THRESHOLD != 0
&& Config.FREQUENT_RESTARTS_DETECTION_WINDOW != 0
&& !keepForegroundService()
&& databaseBackend.startTimeCountExceedsThreshold()) {
getPreferences().edit().putBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE,true).commit(); getPreferences().edit().putBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE,true).commit();
Log.d(Config.LOGTAG,"number of restarts exceeds threshold. enabling foreground service"); Log.d(Config.LOGTAG,"number of restarts exceeds threshold. enabling foreground service");
} }