From 470410b389bc38ab22fe5f877149c93795c5b0fb Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Tue, 14 Oct 2014 17:14:07 +0200 Subject: possible work around for notification bug --- .../conversations/services/XmppConnectionService.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/eu/siacs/conversations/services/XmppConnectionService.java') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 3549ce0a..0dda4b31 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -975,6 +975,10 @@ public class XmppConnectionService extends Service { public void setOnConversationListChangedListener( OnConversationUpdate listener) { + if (!isScreenOn()) { + Log.d(Config.LOGTAG,"ignoring setOnConversationListChangedListener"); + return; + } this.mNotificationService.deactivateGracePeriod(); if (checkListeners()) { switchToForeground(); @@ -996,6 +1000,10 @@ public class XmppConnectionService extends Service { } public void setOnAccountListChangedListener(OnAccountUpdate listener) { + if (!isScreenOn()) { + Log.d(Config.LOGTAG,"ignoring setOnAccountListChangedListener"); + return; + } this.mNotificationService.deactivateGracePeriod(); if (checkListeners()) { switchToForeground(); @@ -1015,6 +1023,10 @@ public class XmppConnectionService extends Service { } public void setOnRosterUpdateListener(OnRosterUpdate listener) { + if (!isScreenOn()) { + Log.d(Config.LOGTAG,"ignoring setOnRosterUpdateListener"); + return; + } this.mNotificationService.deactivateGracePeriod(); if (checkListeners()) { switchToForeground(); @@ -1063,6 +1075,11 @@ public class XmppConnectionService extends Service { } } } + + private boolean isScreenOn() { + PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE); + return pm.isScreenOn(); + } public void connectMultiModeConversations(Account account) { List conversations = getConversations(); -- cgit v1.2.3