diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-08-10 19:48:36 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-08-10 19:48:36 +0200 |
commit | fd81491b059983eb9bcafc91eb91055174bce131 (patch) | |
tree | 4480b0b6dea32a80c2f69e93c67204d633fada75 /src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java | |
parent | d30515a85acaedb57d0d4308aeb72d96074f729a (diff) |
put wake locks on out of band file transfers
Diffstat (limited to 'src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java | 4 |
1 files changed, 4 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 0c1ea503..0d202bb9 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -2,6 +2,7 @@ package eu.siacs.conversations.http; import android.content.Intent; import android.net.Uri; +import android.os.PowerManager; import android.util.Log; import java.io.BufferedInputStream; @@ -228,7 +229,9 @@ public class HttpDownloadConnection implements Transferable { private void download() throws IOException { InputStream is = null; + PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_"+message.getUuid()); try { + wakeLock.acquire(); HttpURLConnection connection = (HttpURLConnection) mUrl.openConnection(); if (connection instanceof HttpsURLConnection) { mHttpConnectionManager.setupTrustManager((HttpsURLConnection) connection, interactive); @@ -253,6 +256,7 @@ public class HttpDownloadConnection implements Transferable { } finally { FileBackend.close(os); FileBackend.close(is); + wakeLock.release(); } } |