summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Howard <showard@google.com>2010-08-03 15:52:36 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-08-03 15:52:36 -0700
commitfd3cf7d8582054a128fc16b6ee82bcb3de546b02 (patch)
tree3fedbb8d966ee7fa878ac1cfbcec2e35da4e2c21
parent40389839299240d63a734a1403529a1ee4a8c091 (diff)
parent3253c05afccc0cb62c29958d023d863222a5845c (diff)
downloadandroid_packages_providers_DownloadProvider-fd3cf7d8582054a128fc16b6ee82bcb3de546b02.tar.gz
android_packages_providers_DownloadProvider-fd3cf7d8582054a128fc16b6ee82bcb3de546b02.tar.bz2
android_packages_providers_DownloadProvider-fd3cf7d8582054a128fc16b6ee82bcb3de546b02.zip
am 3253c05a: am 0d4f9f10: Get wifi limit from secure settings.
Merge commit '3253c05afccc0cb62c29958d023d863222a5845c' * commit '3253c05afccc0cb62c29958d023d863222a5845c': Get wifi limit from secure settings.
-rw-r--r--src/com/android/providers/downloads/DownloadInfo.java2
-rw-r--r--src/com/android/providers/downloads/RealSystemFacade.java11
-rw-r--r--src/com/android/providers/downloads/SystemFacade.java2
-rw-r--r--tests/src/com/android/providers/downloads/FakeSystemFacade.java4
-rw-r--r--tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java2
5 files changed, 14 insertions, 7 deletions
diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java
index ee3ca544..4c08b156 100644
--- a/src/com/android/providers/downloads/DownloadInfo.java
+++ b/src/com/android/providers/downloads/DownloadInfo.java
@@ -345,7 +345,7 @@ public class DownloadInfo {
if (networkType == ConnectivityManager.TYPE_WIFI) {
return true; // anything goes over wifi
}
- Integer maxBytesOverMobile = mSystemFacade.getMaxBytesOverMobile();
+ Long maxBytesOverMobile = mSystemFacade.getMaxBytesOverMobile();
if (maxBytesOverMobile == null) {
return true; // no limit
}
diff --git a/src/com/android/providers/downloads/RealSystemFacade.java b/src/com/android/providers/downloads/RealSystemFacade.java
index adf0107a..710da10d 100644
--- a/src/com/android/providers/downloads/RealSystemFacade.java
+++ b/src/com/android/providers/downloads/RealSystemFacade.java
@@ -7,6 +7,8 @@ import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -59,8 +61,13 @@ class RealSystemFacade implements SystemFacade {
return isRoaming;
}
- public Integer getMaxBytesOverMobile() {
- return null;
+ public Long getMaxBytesOverMobile() {
+ try {
+ return Settings.Secure.getLong(mContext.getContentResolver(),
+ Settings.Secure.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
+ } catch (SettingNotFoundException exc) {
+ return null;
+ }
}
@Override
diff --git a/src/com/android/providers/downloads/SystemFacade.java b/src/com/android/providers/downloads/SystemFacade.java
index 3f8ff264..c1941692 100644
--- a/src/com/android/providers/downloads/SystemFacade.java
+++ b/src/com/android/providers/downloads/SystemFacade.java
@@ -27,7 +27,7 @@ interface SystemFacade {
* @return maximum size, in bytes, of downloads that may go over a mobile connection; or null if
* there's no limit
*/
- public Integer getMaxBytesOverMobile();
+ public Long getMaxBytesOverMobile();
/**
* Send a broadcast intent.
diff --git a/tests/src/com/android/providers/downloads/FakeSystemFacade.java b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
index 297c1d3a..40b2a900 100644
--- a/tests/src/com/android/providers/downloads/FakeSystemFacade.java
+++ b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
@@ -17,7 +17,7 @@ public class FakeSystemFacade implements SystemFacade {
long mTimeMillis = 0;
Integer mActiveNetworkType = ConnectivityManager.TYPE_WIFI;
boolean mIsRoaming = false;
- Integer mMaxBytesOverMobile = null;
+ Long mMaxBytesOverMobile = null;
List<Intent> mBroadcastsSent = new ArrayList<Intent>();
Map<Integer,Notification> mActiveNotifications = new HashMap<Integer,Notification>();
List<Notification> mCanceledNotifications = new ArrayList<Notification>();
@@ -39,7 +39,7 @@ public class FakeSystemFacade implements SystemFacade {
return mIsRoaming;
}
- public Integer getMaxBytesOverMobile() {
+ public Long getMaxBytesOverMobile() {
return mMaxBytesOverMobile ;
}
diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
index d33e458d..b601846a 100644
--- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
@@ -277,7 +277,7 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
}
public void testSizeLimitOverMobile() throws Exception {
- mSystemFacade.mMaxBytesOverMobile = FILE_CONTENT.length() - 1;
+ mSystemFacade.mMaxBytesOverMobile = (long) FILE_CONTENT.length() - 1;
mSystemFacade.mActiveNetworkType = ConnectivityManager.TYPE_MOBILE;
enqueueResponse(HTTP_OK, FILE_CONTENT);