summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers
diff options
context:
space:
mode:
authorAndreas Sandblad <andreas.sandblad@sonyericsson.com>2010-06-16 13:10:26 +0200
committerJohan Redestig <johan.redestig@sonyericsson.com>2010-06-28 09:27:30 +0200
commit31073f8e470e9fe2782ecf95890c0a4acc91b8be (patch)
tree0ebf31f2eb6adbcf37e1aa7f6affc49680d68e6b /src/com/android/providers
parentfbe18a4c8d357a93f3add12bc01afe8ad6ea54c6 (diff)
downloadandroid_packages_providers_DownloadProvider-31073f8e470e9fe2782ecf95890c0a4acc91b8be.tar.gz
android_packages_providers_DownloadProvider-31073f8e470e9fe2782ecf95890c0a4acc91b8be.tar.bz2
android_packages_providers_DownloadProvider-31073f8e470e9fe2782ecf95890c0a4acc91b8be.zip
Use proxy for downloads.
Uses the new Proxy method getPreferredHttpHost to easily get correct proxy. Change-Id: If859ad03c2ed5a896c62592aa131d0e79d1b9c02
Diffstat (limited to 'src/com/android/providers')
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index d2bd3220..9e93e6a1 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -20,6 +20,7 @@ import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.HttpClient;
+import org.apache.http.conn.params.ConnRouteParams;
import org.apache.http.entity.StringEntity;
import android.content.ContentUris;
@@ -27,8 +28,9 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.drm.mobile1.DrmRawContent;
-import android.net.Uri;
import android.net.http.AndroidHttpClient;
+import android.net.Proxy;
+import android.net.Uri;
import android.os.FileUtils;
import android.os.PowerManager;
import android.os.Process;
@@ -180,6 +182,10 @@ public class DownloadThread extends Thread {
*/
http_request_loop:
while (true) {
+ // Set or unset proxy, which may have changed since last GET request.
+ // setDefaultProxy() supports null as proxy parameter.
+ ConnRouteParams.setDefaultProxy(client.getParams(),
+ Proxy.getPreferredHttpHost(mContext, mInfo.mUri));
// Prepares the request and fires it.
HttpGet request = new HttpGet(mInfo.mUri);