From a7ae77fdae69bcc6d6609d4639fed5d96e55eeaa Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 17 Apr 2012 12:26:06 -0700 Subject: Add and enforce ALLOW_METERED column. Include flag with each download to indicate if its allowed to proceed over metered networks. Downloads are left in WAITING_FOR_NETWORK state, similar to how ALLOWED_NETWORK_TYPES is handled. Also keep blocked downloads in WAITING_FOR_NETWORK state instead of marking them as failed. Bug: 3001465, 5734560 Change-Id: I80bb9aa9bd25ddf6f7a2472db344b6ba6878bd74 --- src/com/android/providers/downloads/RealSystemFacade.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/com/android/providers/downloads/RealSystemFacade.java') diff --git a/src/com/android/providers/downloads/RealSystemFacade.java b/src/com/android/providers/downloads/RealSystemFacade.java index f2423d47..6580f909 100644 --- a/src/com/android/providers/downloads/RealSystemFacade.java +++ b/src/com/android/providers/downloads/RealSystemFacade.java @@ -42,6 +42,12 @@ class RealSystemFacade implements SystemFacade { return activeInfo; } + @Override + public boolean isActiveNetworkMetered() { + final ConnectivityManager conn = ConnectivityManager.from(mContext); + return conn.isActiveNetworkMetered(); + } + public boolean isNetworkRoaming() { ConnectivityManager connectivity = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); -- cgit v1.2.3