diff options
Diffstat (limited to 'src/com/android/browser/NetworkStateHandler.java')
-rw-r--r-- | src/com/android/browser/NetworkStateHandler.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/browser/NetworkStateHandler.java b/src/com/android/browser/NetworkStateHandler.java index 4480664..f3c46aa 100644 --- a/src/com/android/browser/NetworkStateHandler.java +++ b/src/com/android/browser/NetworkStateHandler.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 The Android Open Source Project + * Copyright (c) 2012, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,6 +113,23 @@ public class NetworkStateHandler { return mIsNetworkUp; } + boolean isWifiUp() { + ConnectivityManager cm = (ConnectivityManager) mActivity + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo info = cm.getActiveNetworkInfo(); + if (info != null) { + switch (info.getType()) { + case ConnectivityManager.TYPE_WIFI: + case ConnectivityManager.TYPE_ETHERNET: + case ConnectivityManager.TYPE_BLUETOOTH: + return true; + default: + return false; + } + } else + return false; + } + private void sendNetworkType(String type, String subtype) { WebView w = mController.getCurrentWebView(); if (w != null) { |