Permalink
Browse files

Use proxy for downloads.

Uses the new Proxy method getPreferredHttpHost to easily get correct
proxy.

Change-Id: If859ad03c2ed5a896c62592aa131d0e79d1b9c02
  • Loading branch information...
1 parent fbe18a4 commit 31073f8e470e9fe2782ecf95890c0a4acc91b8be Andreas Sandblad committed with Johan Redestig Jun 16, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/com/android/providers/downloads/DownloadThread.java
@@ -20,15 +20,17 @@
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;
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 void run() {
*/
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);

0 comments on commit 31073f8

Please sign in to comment.