diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-05-16 17:46:03 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-05-16 17:46:03 +0200 |
commit | f898e2fdf62bcfb6ec3edd1eb5a7632e1fe38159 (patch) | |
tree | f05154882018a184ce676dffb668e16427fb7cd1 /src/main/java | |
parent | 3dcda137b169003f60ea28b6117ecef206d619da (diff) |
use wakelock on retrieve filesize
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index d23cb71a3..51bfd5666 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -189,7 +189,9 @@ public class HttpDownloadConnection implements Transferable { } private long retrieveFileSize() throws IOException { + PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_"+message.getUuid()); try { + wakeLock.acquire(); Log.d(Config.LOGTAG, "retrieve file size. interactive:" + String.valueOf(interactive)); changeStatus(STATUS_CHECKING); HttpURLConnection connection; @@ -211,6 +213,7 @@ public class HttpDownloadConnection implements Transferable { if (contentLength == null) { throw new IOException(); } + wakeLock.release(); return Long.parseLong(contentLength, 10); } catch (IOException e) { throw e; |