diff options
author | Steve Howard <showard@google.com> | 2010-07-19 10:58:58 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-07-19 10:58:58 -0700 |
commit | 1aa26989047495ff58d3e2598d3f9549465cbb65 (patch) | |
tree | 78826ba7ac8cd747f1fa695eb7d747f78e958920 /src/com/android/providers/downloads/Helpers.java | |
parent | abb997df34680a8b2b733acbc2313991226c69d6 (diff) | |
parent | af28400b74de05862b470412a5c92f68e99f59f8 (diff) | |
download | android_packages_providers_DownloadProvider-1aa26989047495ff58d3e2598d3f9549465cbb65.tar.gz android_packages_providers_DownloadProvider-1aa26989047495ff58d3e2598d3f9549465cbb65.tar.bz2 android_packages_providers_DownloadProvider-1aa26989047495ff58d3e2598d3f9549465cbb65.zip |
Merge "Introduce a seam to ConnectivityManager and TelephonyManager" into gingerbread
Diffstat (limited to 'src/com/android/providers/downloads/Helpers.java')
-rw-r--r-- | src/com/android/providers/downloads/Helpers.java | 51 |
1 files changed, 4 insertions, 47 deletions
diff --git a/src/com/android/providers/downloads/Helpers.java b/src/com/android/providers/downloads/Helpers.java index 2705a7cb..4a0f860b 100644 --- a/src/com/android/providers/downloads/Helpers.java +++ b/src/com/android/providers/downloads/Helpers.java @@ -514,58 +514,15 @@ public class Helpers { /** * Returns whether the network is available */ - public static boolean isNetworkAvailable(Context context) { - ConnectivityManager connectivity = - (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - if (connectivity == null) { - Log.w(Constants.TAG, "couldn't get connectivity manager"); - } else { - NetworkInfo[] info = connectivity.getAllNetworkInfo(); - if (info != null) { - for (int i = 0; i < info.length; i++) { - if (info[i].getState() == NetworkInfo.State.CONNECTED) { - if (Constants.LOGVV) { - Log.v(Constants.TAG, "network is available"); - } - return true; - } - } - } - } - if (Constants.LOGVV) { - Log.v(Constants.TAG, "network is not available"); - } - return false; + public static boolean isNetworkAvailable(SystemFacade system) { + return !system.getConnectedNetworkTypes().isEmpty(); } /** * Returns whether the network is roaming */ - public static boolean isNetworkRoaming(Context context) { - ConnectivityManager connectivity = - (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - if (connectivity == null) { - Log.w(Constants.TAG, "couldn't get connectivity manager"); - } else { - NetworkInfo info = connectivity.getActiveNetworkInfo(); - if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE) { - if (TelephonyManager.getDefault().isNetworkRoaming()) { - if (Constants.LOGVV) { - Log.v(Constants.TAG, "network is roaming"); - } - return true; - } else { - if (Constants.LOGVV) { - Log.v(Constants.TAG, "network is not roaming"); - } - } - } else { - if (Constants.LOGVV) { - Log.v(Constants.TAG, "not using mobile network"); - } - } - } - return false; + public static boolean isNetworkRoaming(SystemFacade system) { + return system.isNetworkRoaming(); } /** |