From f898e2fdf62bcfb6ec3edd1eb5a7632e1fe38159 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 16 May 2016 17:46:03 +0200 Subject: use wakelock on retrieve filesize --- src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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; -- cgit v1.2.3