aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/services/NotificationService.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/services/NotificationService.java b/src/eu/siacs/conversations/services/NotificationService.java
index 012bac30..eb203909 100644
--- a/src/eu/siacs/conversations/services/NotificationService.java
+++ b/src/eu/siacs/conversations/services/NotificationService.java
@@ -12,6 +12,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
+import android.os.PowerManager;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.text.Html;
@@ -39,7 +40,12 @@ public class NotificationService {
}
public synchronized void push(Message message) {
- if (this.mIsInForeground
+
+ PowerManager pm = (PowerManager) mXmppConnectionService
+ .getSystemService(Context.POWER_SERVICE);
+ boolean isScreenOn = pm.isScreenOn();
+
+ if (this.mIsInForeground && isScreenOn
&& this.mOpenConversation == message.getConversation()) {
return; // simply ignore
}
@@ -51,7 +57,7 @@ public class NotificationService {
mList.add(message);
notifications.put(conversationUuid, mList);
}
- updateNotification(!(this.mIsInForeground && this.mOpenConversation == null));
+ updateNotification(!(this.mIsInForeground && this.mOpenConversation == null) || !isScreenOn);
}
public void clear() {