possible work around for notification bug

This commit is contained in:
iNPUTmice 2014-10-14 17:14:07 +02:00
parent c18e986a93
commit 470410b389
1 changed files with 17 additions and 0 deletions

View File

@ -975,6 +975,10 @@ public class XmppConnectionService extends Service {
public void setOnConversationListChangedListener( public void setOnConversationListChangedListener(
OnConversationUpdate listener) { OnConversationUpdate listener) {
if (!isScreenOn()) {
Log.d(Config.LOGTAG,"ignoring setOnConversationListChangedListener");
return;
}
this.mNotificationService.deactivateGracePeriod(); this.mNotificationService.deactivateGracePeriod();
if (checkListeners()) { if (checkListeners()) {
switchToForeground(); switchToForeground();
@ -996,6 +1000,10 @@ public class XmppConnectionService extends Service {
} }
public void setOnAccountListChangedListener(OnAccountUpdate listener) { public void setOnAccountListChangedListener(OnAccountUpdate listener) {
if (!isScreenOn()) {
Log.d(Config.LOGTAG,"ignoring setOnAccountListChangedListener");
return;
}
this.mNotificationService.deactivateGracePeriod(); this.mNotificationService.deactivateGracePeriod();
if (checkListeners()) { if (checkListeners()) {
switchToForeground(); switchToForeground();
@ -1015,6 +1023,10 @@ public class XmppConnectionService extends Service {
} }
public void setOnRosterUpdateListener(OnRosterUpdate listener) { public void setOnRosterUpdateListener(OnRosterUpdate listener) {
if (!isScreenOn()) {
Log.d(Config.LOGTAG,"ignoring setOnRosterUpdateListener");
return;
}
this.mNotificationService.deactivateGracePeriod(); this.mNotificationService.deactivateGracePeriod();
if (checkListeners()) { if (checkListeners()) {
switchToForeground(); 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) { public void connectMultiModeConversations(Account account) {
List<Conversation> conversations = getConversations(); List<Conversation> conversations = getConversations();