log all background stanzas when background logging is enabled

This commit is contained in:
Daniel Gultsch 2016-06-05 02:04:31 +02:00
parent 7a97da6d21
commit 36ae840d76
4 changed files with 4 additions and 9 deletions

View File

@ -83,7 +83,7 @@ public final class Config {
public static final boolean DISABLE_HTTP_UPLOAD = false; public static final boolean DISABLE_HTTP_UPLOAD = false;
public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance
public static final boolean EXTENDED_SM_LOGGING = false; // log stanza counts public static final boolean EXTENDED_SM_LOGGING = false; // log stanza counts
public static final boolean BACKGROUND_STANZA_LOGGING = false; public static final boolean BACKGROUND_STANZA_LOGGING = false; //log all stanzas that were received while the app is in background
public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption
public static final boolean ENCRYPT_ON_HTTP_UPLOADED = false; public static final boolean ENCRYPT_ON_HTTP_UPLOADED = false;

View File

@ -277,11 +277,6 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
@Override @Override
public void onIqPacketReceived(final Account account, final IqPacket packet) { public void onIqPacketReceived(final Account account, final IqPacket packet) {
if (Config.BACKGROUND_STANZA_LOGGING && (packet.getType() == IqPacket.TYPE.GET || packet.getType() == IqPacket.TYPE.SET)) {
Element first = packet.getChildren().size() > 0 ? packet.getChildren().get(0) : null;
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": IQ request from "+packet.getFrom()+(first == null ? "" : " "+first));
}
if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) { if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) {
return; return;
} else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) { } else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) {

View File

@ -537,9 +537,6 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
} }
} }
} else if (!packet.hasChild("body")){ //no body } else if (!packet.hasChild("body")){ //no body
if (Config.BACKGROUND_STANZA_LOGGING && mXmppConnectionService.checkListeners()) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": " + packet+ " (carbon="+Boolean.toString(isCarbon)+")");
}
Conversation conversation = mXmppConnectionService.find(account, from.toBareJid()); Conversation conversation = mXmppConnectionService.find(account, from.toBareJid());
if (isTypeGroupChat) { if (isTypeGroupChat) {
if (packet.hasChild("subject")) { if (packet.hasChild("subject")) {

View File

@ -637,6 +637,9 @@ public class XmppConnection implements Runnable {
} }
++stanzasReceived; ++stanzasReceived;
lastPacketReceived = SystemClock.elapsedRealtime(); lastPacketReceived = SystemClock.elapsedRealtime();
if (Config.BACKGROUND_STANZA_LOGGING && mXmppConnectionService.checkListeners()) {
Log.d(Config.LOGTAG,"[background stanza] "+element);
}
return element; return element;
} }