diff options
Diffstat (limited to 'src/com/android/providers/downloads/RealSystemFacade.java')
-rw-r--r-- | src/com/android/providers/downloads/RealSystemFacade.java | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/com/android/providers/downloads/RealSystemFacade.java b/src/com/android/providers/downloads/RealSystemFacade.java index 41ca6b6e..89cf3b1d 100644 --- a/src/com/android/providers/downloads/RealSystemFacade.java +++ b/src/com/android/providers/downloads/RealSystemFacade.java @@ -6,8 +6,6 @@ import android.net.NetworkInfo; import android.telephony.TelephonyManager; import android.util.Log; -import java.util.BitSet; - class RealSystemFacade implements SystemFacade { private Context mContext; @@ -19,30 +17,22 @@ class RealSystemFacade implements SystemFacade { return System.currentTimeMillis(); } - public BitSet getConnectedNetworkTypes() { - BitSet connectedTypes = new BitSet(); - + public Integer getActiveNetworkType() { ConnectivityManager connectivity = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity == null) { Log.w(Constants.TAG, "couldn't get connectivity manager"); - return connectedTypes; + return null; } - NetworkInfo[] infos = connectivity.getAllNetworkInfo(); - if (infos != null) { - for (NetworkInfo info : infos) { - if (info.getState() == NetworkInfo.State.CONNECTED) { - connectedTypes.set(info.getType()); - } + NetworkInfo activeInfo = connectivity.getActiveNetworkInfo(); + if (activeInfo == null) { + if (Constants.LOGVV) { + Log.v(Constants.TAG, "network is not available"); } + return null; } - - if (Constants.LOGVV) { - boolean isConnected = !connectedTypes.isEmpty(); - Log.v(Constants.TAG, "network is " + (isConnected ? "" : "not ") + "available"); - } - return connectedTypes; + return activeInfo.getType(); } public boolean isNetworkRoaming() { @@ -56,10 +46,13 @@ class RealSystemFacade implements SystemFacade { NetworkInfo info = connectivity.getActiveNetworkInfo(); boolean isMobile = (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE); boolean isRoaming = isMobile && TelephonyManager.getDefault().isNetworkRoaming(); - if (Constants.LOGVV) { - Log.v(Constants.TAG, "network is mobile: " + isMobile); - Log.v(Constants.TAG, "network is roaming: " + isRoaming); + if (Constants.LOGVV && isRoaming) { + Log.v(Constants.TAG, "network is roaming"); } - return isMobile && isRoaming; + return isRoaming; + } + + public Integer getMaxBytesOverMobile() { + return null; } } |