aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian S <christian@pix-art.de>2016-04-15 21:27:28 +0200
committerChristian S <christian@pix-art.de>2016-04-15 21:27:28 +0200
commit0f4ccb64ba03630568b20c44814908c06c7aa88e (patch)
tree99e9f4d83e01c2f8fe8e5191df54b80c55e02a7f /src/main/java
parent00f9ca537cd3f8095b664427b52a8989008a2dfe (diff)
make foreground service always enabled
and don't let the user choose the foreground settings
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/Config.java3
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java2
4 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java
index 731b04cf5..f783583c4 100644
--- a/src/main/java/eu/siacs/conversations/Config.java
+++ b/src/main/java/eu/siacs/conversations/Config.java
@@ -49,7 +49,8 @@ public final class Config {
public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false;
public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification
- public static final boolean SHOW_DISABLE_FOREGROUND = true; //if set to true the foreground notification has a button to disable it
+ public static final boolean SHOW_DISABLE_FOREGROUND = false; //if set to true the foreground notification has a button to disable it
+ public static final boolean USE_ALWAYS_FOREGROUND = true; //if set to true the foreground service is always enabled
public static final boolean ALWAYS_NOTIFY_BY_DEFAULT = false;
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index 83e59faa0..a057fb029 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -564,7 +564,7 @@ public class NotificationService {
errors.add(account);
}
}
- if (mXmppConnectionService.getPreferences().getBoolean("keep_foreground_service", false)) {
+ if (Config.USE_ALWAYS_FOREGROUND) {
notificationManager.notify(FOREGROUND_NOTIFICATION_ID, createForegroundNotification());
}
final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index b77bc4c1d..d6866ed45 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -514,10 +514,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
case ACTION_CLEAR_NOTIFICATION:
mNotificationService.clear();
break;
- case ACTION_DISABLE_FOREGROUND:
- getPreferences().edit().putBoolean("keep_foreground_service", false).commit();
- toggleForegroundService();
- break;
case ACTION_TRY_AGAIN:
resetAllAttemptCounts(false);
interactive = true;
@@ -776,7 +772,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
public void toggleForegroundService() {
- if (getPreferences().getBoolean("keep_foreground_service", false)) {
+ if (Config.USE_ALWAYS_FOREGROUND) {
startForeground(NotificationService.FOREGROUND_NOTIFICATION_ID, this.mNotificationService.createForegroundNotification());
} else {
stopForeground(true);
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index 750a74212..7e501f034 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -178,8 +178,6 @@ public class SettingsActivity extends XmppActivity implements
}
}
}
- } else if (name.equals("keep_foreground_service")) {
- xmppConnectionService.toggleForegroundService();
} else if (resendPresence.contains(name)) {
if (xmppConnectionServiceBound) {
if (name.equals("away_when_screen_off")) {