aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-12-30 20:24:35 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-12-30 20:24:35 +0100
commitfa70bd75364536ed404af223c226613fa9c7b572 (patch)
tree46681ed78c6ecb666be6f6d997267bb2be97fdd7 /src
parentb8b2051f4cb9bde50b99319a95e04b2c5685021f (diff)
disable automatic foreground service activation if related config paramaters are set to zero
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 38c1214a..21fcc4b8 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -874,7 +874,10 @@ public class XmppConnectionService extends Service {
this.databaseBackend = DatabaseBackend.getInstance(getApplicationContext());
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();
Log.d(Config.LOGTAG,"number of restarts exceeds threshold. enabling foreground service");
}