From 0a9e68e77ea53fa051e4050e1a63ea15930f4943 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 1 Jun 2018 21:52:33 +0200 Subject: add more logging to setIsInForeground --- src/main/java/de/pixart/messenger/services/NotificationService.java | 1 - src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 3 +++ src/main/java/de/pixart/messenger/ui/ConversationsActivity.java | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index ede62630c..03e51bef8 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -199,7 +199,6 @@ public class NotificationService { final boolean isScreenOn = mXmppConnectionService.isInteractive(); if (this.mIsInForeground && isScreenOn && this.mOpenConversation == message.getConversation()) { Log.d(Config.LOGTAG, message.getConversation().getAccount().getJid().asBareJid() + ": suppressing notification because conversation is open"); - mXmppConnectionService.vibrate(); return; } if (this.mIsInForeground && isScreenOn) { diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 988f247f0..cf3dd7462 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2124,6 +2124,7 @@ public class XmppConnectionService extends Service { switchToForeground(); } this.mOnConversationUpdates.add(listener); + Log.d(Config.LOGTAG, "XmppConnectionService setOnConversationListChangedListener(): setIsInForeground = " + (this.mOnConversationUpdates.size() > 0)); this.mNotificationService.setIsInForeground(this.mOnConversationUpdates.size() > 0); } } @@ -2131,6 +2132,7 @@ public class XmppConnectionService extends Service { public void removeOnConversationListChangedListener(OnConversationUpdate listener) { synchronized (this) { this.mOnConversationUpdates.remove(listener); + Log.d(Config.LOGTAG, "XmppConnectionService removeOnConversationListChangedListener(): setIsInForeground = " + (this.mOnConversationUpdates.size() > 0)); this.mNotificationService.setIsInForeground(this.mOnConversationUpdates.size() > 0); if (checkListeners()) { switchToBackground(); @@ -2321,6 +2323,7 @@ public class XmppConnectionService extends Service { } } } + Log.d(Config.LOGTAG, "XmppConnectionService switchToBackground(): setIsInForeground = false"); this.mNotificationService.setIsInForeground(false); Log.d(Config.LOGTAG, "app switched into background"); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java index 686d435bb..590b93d6c 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java @@ -145,6 +145,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio if (performRedirectIfNecessary(true)) { return; } + Log.d(Config.LOGTAG, "ConversationsActivity onBackendConnected(): setIsInForeground = true"); xmppConnectionService.getNotificationService().setIsInForeground(true); final Intent FirstStartIntent = getIntent(); -- cgit v1.2.3