diff options
author | Steve Howard <showard@google.com> | 2010-07-27 19:47:50 -0700 |
---|---|---|
committer | Steve Howard <showard@google.com> | 2010-07-28 18:26:08 -0700 |
commit | 0d4f9f105c3a31475a36e9a1edfa868c66ff455f (patch) | |
tree | 6d1b04a5be4daef4e6ed6f792afedc68e8b2830c /src/com/android/providers/downloads | |
parent | dea0a5f8e5804d3aba40eaa7de763dd88058384e (diff) | |
download | android_packages_providers_DownloadProvider-0d4f9f105c3a31475a36e9a1edfa868c66ff455f.tar.gz android_packages_providers_DownloadProvider-0d4f9f105c3a31475a36e9a1edfa868c66ff455f.tar.bz2 android_packages_providers_DownloadProvider-0d4f9f105c3a31475a36e9a1edfa868c66ff455f.zip |
Get wifi limit from secure settings.
Change-Id: I750654c28cb3d9f9aa67bd56e4d8d770dbfde4b4
Diffstat (limited to 'src/com/android/providers/downloads')
-rw-r--r-- | src/com/android/providers/downloads/DownloadInfo.java | 2 | ||||
-rw-r--r-- | src/com/android/providers/downloads/RealSystemFacade.java | 11 | ||||
-rw-r--r-- | src/com/android/providers/downloads/SystemFacade.java | 2 |
3 files changed, 11 insertions, 4 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. |