aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-08-10 19:48:36 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-08-10 19:48:36 +0200
commitfd81491b059983eb9bcafc91eb91055174bce131 (patch)
tree4480b0b6dea32a80c2f69e93c67204d633fada75 /src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
parentd30515a85acaedb57d0d4308aeb72d96074f729a (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.java4
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();
}
}