diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-01-21 16:59:19 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-01-21 16:59:19 +0100 |
commit | ca8b091cd896bd8a131cd4c4930bec942f9d5305 (patch) | |
tree | 3b45478ae6e7ffb0568333b547f3f4b10b4a7268 /src/main/java/de/pixart/messenger/xml/XmlReader.java | |
parent | 1fde63fc5406d2b92ee5412e9c7f2955d3776cf9 (diff) |
remove wakelocks in XmlReader
Diffstat (limited to 'src/main/java/de/pixart/messenger/xml/XmlReader.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/xml/XmlReader.java | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/main/java/de/pixart/messenger/xml/XmlReader.java b/src/main/java/de/pixart/messenger/xml/XmlReader.java index 440fdd2fe..703f1239c 100644 --- a/src/main/java/de/pixart/messenger/xml/XmlReader.java +++ b/src/main/java/de/pixart/messenger/xml/XmlReader.java @@ -1,7 +1,5 @@ package de.pixart.messenger.xml; -import android.os.PowerManager; -import android.os.PowerManager.WakeLock; import android.util.Log; import android.util.Xml; @@ -16,17 +14,15 @@ import de.pixart.messenger.Config; public class XmlReader { private XmlPullParser parser; - private PowerManager.WakeLock wakeLock; private InputStream is; - public XmlReader(WakeLock wakeLock) { + public XmlReader() { this.parser = Xml.newPullParser(); try { this.parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); } catch (XmlPullParserException e) { Log.d(Config.LOGTAG, "error setting namespace feature on parser"); } - this.wakeLock = wakeLock; } public void setInputStream(InputStream inputStream) throws IOException { @@ -53,16 +49,8 @@ public class XmlReader { } public Tag readTag() throws XmlPullParserException, IOException { - if (wakeLock.isHeld()) { - try { - wakeLock.release(); - } catch (RuntimeException re) { - Log.d(Config.LOGTAG, "runtime exception releasing wakelock before reading tag " + re.getMessage()); - } - } try { while (this.is != null && parser.next() != XmlPullParser.END_DOCUMENT) { - wakeLock.acquire(); if (parser.getEventType() == XmlPullParser.START_TAG) { Tag tag = Tag.start(parser.getName()); final String xmlns = parser.getNamespace(); @@ -89,14 +77,6 @@ public class XmlReader { } catch (Throwable throwable) { throw new IOException("xml parser mishandled " + throwable.getClass().getSimpleName() + "(" + throwable.getMessage() + ")", throwable); - } finally { - if (wakeLock.isHeld()) { - try { - wakeLock.release(); - } catch (RuntimeException re) { - Log.d(Config.LOGTAG, "runtime exception releasing wakelock after exception " + re.getMessage()); - } - } } return null; } |