From ca8b091cd896bd8a131cd4c4930bec942f9d5305 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sun, 21 Jan 2018 16:59:19 +0100 Subject: remove wakelocks in XmlReader --- src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/main/java/de/pixart/messenger/xmpp') diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 4ee5a6a4e..58329609a 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -2,8 +2,6 @@ package de.pixart.messenger.xmpp; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.os.PowerManager; -import android.os.PowerManager.WakeLock; import android.os.SystemClock; import android.security.KeyChain; import android.util.Base64; @@ -107,7 +105,6 @@ public class XmppConnection implements Runnable { private static final int PACKET_MESSAGE = 1; private static final int PACKET_PRESENCE = 2; protected final Account account; - private final WakeLock wakeLock; private Socket socket; private XmlReader tagReader; private TagWriter tagWriter = new TagWriter(); @@ -234,7 +231,6 @@ public class XmppConnection implements Runnable { public XmppConnection(final Account account, final XmppConnectionService service) { this.account = account; final String tag = account.getJid().toBareJid().toPreppedString(); - this.wakeLock = service.getPowerManager().newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, tag == null ? "[empty bare jid]" : tag); mXmppConnectionService = service; } @@ -469,14 +465,8 @@ public class XmppConnection implements Runnable { } finally { if (!Thread.currentThread().isInterrupted()) { forceCloseSocket(); - if (wakeLock.isHeld()) { - try { - wakeLock.release(); - } catch (final RuntimeException ignored) { - } - } } else { - Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": not force closing socket and releasing wake lock (is held=" + wakeLock.isHeld() + ") because thread was interrupted"); + Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": not force closing socket because thread was interrupted"); } } } @@ -491,7 +481,7 @@ public class XmppConnection implements Runnable { throw new InterruptedException(); } this.socket = socket; - tagReader = new XmlReader(wakeLock); + tagReader = new XmlReader(); if (tagWriter != null) { tagWriter.forceClose(); } -- cgit v1.2.3