summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java14
-rw-r--r--src/com/android/providers/downloads/RealSystemFacade.java8
-rw-r--r--src/com/android/providers/downloads/SystemFacade.java3
-rw-r--r--tests/src/com/android/providers/downloads/FakeSystemFacade.java7
4 files changed, 1 insertions, 31 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index f6b0be6..65142db 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -45,7 +45,6 @@ import android.drm.DrmManagerClient;
import android.drm.DrmOutputStream;
import android.net.ConnectivityManager;
import android.net.INetworkPolicyListener;
-import android.net.Network;
import android.net.NetworkInfo;
import android.net.NetworkPolicyManager;
import android.net.TrafficStats;
@@ -352,15 +351,6 @@ public class DownloadThread implements Runnable {
throw new StopRequestException(STATUS_BAD_REQUEST, e);
}
- // Use the caller's default network to make this connection, since they might be subject to
- // restrictions that we shouldn't let them circumvent.
- final Network network = mSystemFacade.getActiveNetwork(mInfo.mUid);
- if (network == null) {
- throw new StopRequestException(Downloads.Impl.STATUS_WAITING_FOR_NETWORK,
- "no network associated with requesting UID");
- }
- logDebug("Using network: " + network);
-
boolean cleartextTrafficPermitted = mSystemFacade.isCleartextTrafficPermitted(mInfo.mUid);
int redirectionCount = 0;
while (redirectionCount++ < Constants.MAX_REDIRECTS) {
@@ -376,10 +366,8 @@ public class DownloadThread implements Runnable {
// response with body.
HttpURLConnection conn = null;
try {
- // Check that the caller is allowed to make network connections. If so, make one on
- // their behalf to open the url.
checkConnectivity();
- conn = (HttpURLConnection) network.openConnection(url);
+ conn = (HttpURLConnection) url.openConnection();
conn.setInstanceFollowRedirects(false);
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
diff --git a/src/com/android/providers/downloads/RealSystemFacade.java b/src/com/android/providers/downloads/RealSystemFacade.java
index 48df2a0..b3f170f 100644
--- a/src/com/android/providers/downloads/RealSystemFacade.java
+++ b/src/com/android/providers/downloads/RealSystemFacade.java
@@ -26,7 +26,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
-import android.net.Network;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -60,13 +59,6 @@ class RealSystemFacade implements SystemFacade {
}
@Override
- public Network getActiveNetwork(int uid) {
- ConnectivityManager connectivity =
- (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
- return connectivity.getActiveNetworkForUid(uid);
- }
-
- @Override
public boolean isActiveNetworkMetered() {
final ConnectivityManager conn = ConnectivityManager.from(mContext);
return conn.isActiveNetworkMetered();
diff --git a/src/com/android/providers/downloads/SystemFacade.java b/src/com/android/providers/downloads/SystemFacade.java
index 7f97b91..83fc7a6 100644
--- a/src/com/android/providers/downloads/SystemFacade.java
+++ b/src/com/android/providers/downloads/SystemFacade.java
@@ -18,7 +18,6 @@ package com.android.providers.downloads;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
-import android.net.Network;
import android.net.NetworkInfo;
interface SystemFacade {
@@ -33,8 +32,6 @@ interface SystemFacade {
*/
public NetworkInfo getActiveNetworkInfo(int uid);
- public Network getActiveNetwork(int uid);
-
public boolean isActiveNetworkMetered();
/**
diff --git a/tests/src/com/android/providers/downloads/FakeSystemFacade.java b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
index af5482e..7581e6f 100644
--- a/tests/src/com/android/providers/downloads/FakeSystemFacade.java
+++ b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
@@ -3,7 +3,6 @@ package com.android.providers.downloads;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
-import android.net.Network;
import android.net.NetworkInfo;
import android.net.NetworkInfo.DetailedState;
@@ -11,7 +10,6 @@ import java.util.ArrayList;
import java.util.List;
public class FakeSystemFacade implements SystemFacade {
long mTimeMillis = 0;
- Network mActiveNetwork = null;
Integer mActiveNetworkType = ConnectivityManager.TYPE_WIFI;
boolean mIsRoaming = false;
boolean mIsMetered = false;
@@ -45,11 +43,6 @@ public class FakeSystemFacade implements SystemFacade {
}
@Override
- public Network getActiveNetwork(int uid) {
- return mActiveNetwork;
- }
-
- @Override
public NetworkInfo getActiveNetworkInfo(int uid) {
if (mActiveNetworkType == null) {
return null;