Loading core/java/android/net/ConnectivityManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -814,4 +814,22 @@ public class ConnectivityManager { } catch (RemoteException e) { } } /** * Returns true if the hardware supports the given network type * else it returns false. This doesn't indicate we have coverage * or are authorized onto a network, just whether or not the * hardware supports it. For example a gsm phone without a sim * should still return true for mobile data, but a wifi only tablet * would return false. * @param networkType The nework type we'd like to check * @return true if supported, else false * @hide */ public boolean isNetworkSupported(int networkType) { try { return mService.isNetworkSupported(networkType); } catch (RemoteException e) {} return false; } } core/java/android/net/IConnectivityManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ interface IConnectivityManager NetworkInfo getNetworkInfo(int networkType); NetworkInfo[] getAllNetworkInfo(); boolean isNetworkSupported(int networkType); LinkProperties getActiveLinkProperties(); LinkProperties getLinkProperties(int networkType); Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +10 −10 Original line number Diff line number Diff line Loading @@ -130,6 +130,8 @@ public class NetworkController extends BroadcastReceiver { int mLastDataTypeIconId = -1; String mLastLabel = ""; private boolean mHasMobileDataFeature; boolean mDataAndWifiStacked = false; // yuck -- stop doing this here and put it in the framework Loading @@ -147,6 +149,10 @@ public class NetworkController extends BroadcastReceiver { public NetworkController(Context context) { mContext = context; ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService( Context.CONNECTIVITY_SERVICE); mHasMobileDataFeature = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE); // set up the default wifi icon, used when no radios have ever appeared updateWifiIcons(); Loading Loading @@ -229,7 +235,7 @@ public class NetworkController extends BroadcastReceiver { mWifiIconId, mWifiActivityIconId); cluster.setMobileDataIndicators( hasMobileDataFeature(), mHasMobileDataFeature, mPhoneSignalIconId, mMobileActivityIconId, mDataTypeIconId); Loading Loading @@ -376,12 +382,6 @@ public class NetworkController extends BroadcastReceiver { } } private boolean hasMobileDataFeature() { // XXX: HAX: replace when a more reliable method is available return (! "wifi-only".equals(SystemProperties.get("ro.carrier"))); } private void updateAirplaneMode() { mAirplaneMode = (Settings.System.getInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1); Loading Loading @@ -828,8 +828,8 @@ public class NetworkController extends BroadcastReceiver { label = context.getString(R.string.status_bar_settings_signal_meter_disconnected); // On devices without mobile radios, we want to show the wifi icon combinedSignalIconId = hasMobileDataFeature() ? mDataSignalIconId : mWifiIconId; mContentDescriptionCombinedSignal = hasMobileDataFeature() mHasMobileDataFeature ? mDataSignalIconId : mWifiIconId; mContentDescriptionCombinedSignal = mHasMobileDataFeature ? mContentDescriptionDataType : mContentDescriptionWifi; mDataTypeIconId = 0; } Loading Loading @@ -866,7 +866,7 @@ public class NetworkController extends BroadcastReceiver { mWifiIconId, mWifiActivityIconId); cluster.setMobileDataIndicators( hasMobileDataFeature(), mHasMobileDataFeature, mPhoneSignalIconId, mMobileActivityIconId, mDataTypeIconId); Loading services/java/com/android/server/ConnectivityService.java +6 −0 Original line number Diff line number Diff line Loading @@ -703,6 +703,12 @@ public class ConnectivityService extends IConnectivityManager.Stub { return result.toArray(new NetworkInfo[result.size()]); } @Override public boolean isNetworkSupported(int networkType) { enforceAccessPermission(); return (isNetworkTypeValid(networkType) && (mNetTrackers[networkType] != null)); } /** * Return LinkProperties for the active (i.e., connected) default * network interface. It is assumed that at most one default network Loading services/java/com/android/server/SystemServer.java +1 −1 Original line number Diff line number Diff line Loading @@ -350,7 +350,6 @@ class ServerThread extends Thread { Slog.i(TAG, "Wi-Fi Service"); wifi = new WifiService(context); ServiceManager.addService(Context.WIFI_SERVICE, wifi); wifi.checkAndStartWifi(); } catch (Throwable e) { reportWtf("starting Wi-Fi Service", e); } Loading @@ -361,6 +360,7 @@ class ServerThread extends Thread { ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity); networkStats.bindConnectivityManager(connectivity); networkPolicy.bindConnectivityManager(connectivity); wifi.checkAndStartWifi(); wifiP2p.connectivityServiceReady(); } catch (Throwable e) { reportWtf("starting Connectivity Service", e); Loading Loading
core/java/android/net/ConnectivityManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -814,4 +814,22 @@ public class ConnectivityManager { } catch (RemoteException e) { } } /** * Returns true if the hardware supports the given network type * else it returns false. This doesn't indicate we have coverage * or are authorized onto a network, just whether or not the * hardware supports it. For example a gsm phone without a sim * should still return true for mobile data, but a wifi only tablet * would return false. * @param networkType The nework type we'd like to check * @return true if supported, else false * @hide */ public boolean isNetworkSupported(int networkType) { try { return mService.isNetworkSupported(networkType); } catch (RemoteException e) {} return false; } }
core/java/android/net/IConnectivityManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ interface IConnectivityManager NetworkInfo getNetworkInfo(int networkType); NetworkInfo[] getAllNetworkInfo(); boolean isNetworkSupported(int networkType); LinkProperties getActiveLinkProperties(); LinkProperties getLinkProperties(int networkType); Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +10 −10 Original line number Diff line number Diff line Loading @@ -130,6 +130,8 @@ public class NetworkController extends BroadcastReceiver { int mLastDataTypeIconId = -1; String mLastLabel = ""; private boolean mHasMobileDataFeature; boolean mDataAndWifiStacked = false; // yuck -- stop doing this here and put it in the framework Loading @@ -147,6 +149,10 @@ public class NetworkController extends BroadcastReceiver { public NetworkController(Context context) { mContext = context; ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService( Context.CONNECTIVITY_SERVICE); mHasMobileDataFeature = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE); // set up the default wifi icon, used when no radios have ever appeared updateWifiIcons(); Loading Loading @@ -229,7 +235,7 @@ public class NetworkController extends BroadcastReceiver { mWifiIconId, mWifiActivityIconId); cluster.setMobileDataIndicators( hasMobileDataFeature(), mHasMobileDataFeature, mPhoneSignalIconId, mMobileActivityIconId, mDataTypeIconId); Loading Loading @@ -376,12 +382,6 @@ public class NetworkController extends BroadcastReceiver { } } private boolean hasMobileDataFeature() { // XXX: HAX: replace when a more reliable method is available return (! "wifi-only".equals(SystemProperties.get("ro.carrier"))); } private void updateAirplaneMode() { mAirplaneMode = (Settings.System.getInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1); Loading Loading @@ -828,8 +828,8 @@ public class NetworkController extends BroadcastReceiver { label = context.getString(R.string.status_bar_settings_signal_meter_disconnected); // On devices without mobile radios, we want to show the wifi icon combinedSignalIconId = hasMobileDataFeature() ? mDataSignalIconId : mWifiIconId; mContentDescriptionCombinedSignal = hasMobileDataFeature() mHasMobileDataFeature ? mDataSignalIconId : mWifiIconId; mContentDescriptionCombinedSignal = mHasMobileDataFeature ? mContentDescriptionDataType : mContentDescriptionWifi; mDataTypeIconId = 0; } Loading Loading @@ -866,7 +866,7 @@ public class NetworkController extends BroadcastReceiver { mWifiIconId, mWifiActivityIconId); cluster.setMobileDataIndicators( hasMobileDataFeature(), mHasMobileDataFeature, mPhoneSignalIconId, mMobileActivityIconId, mDataTypeIconId); Loading
services/java/com/android/server/ConnectivityService.java +6 −0 Original line number Diff line number Diff line Loading @@ -703,6 +703,12 @@ public class ConnectivityService extends IConnectivityManager.Stub { return result.toArray(new NetworkInfo[result.size()]); } @Override public boolean isNetworkSupported(int networkType) { enforceAccessPermission(); return (isNetworkTypeValid(networkType) && (mNetTrackers[networkType] != null)); } /** * Return LinkProperties for the active (i.e., connected) default * network interface. It is assumed that at most one default network Loading
services/java/com/android/server/SystemServer.java +1 −1 Original line number Diff line number Diff line Loading @@ -350,7 +350,6 @@ class ServerThread extends Thread { Slog.i(TAG, "Wi-Fi Service"); wifi = new WifiService(context); ServiceManager.addService(Context.WIFI_SERVICE, wifi); wifi.checkAndStartWifi(); } catch (Throwable e) { reportWtf("starting Wi-Fi Service", e); } Loading @@ -361,6 +360,7 @@ class ServerThread extends Thread { ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity); networkStats.bindConnectivityManager(connectivity); networkPolicy.bindConnectivityManager(connectivity); wifi.checkAndStartWifi(); wifiP2p.connectivityServiceReady(); } catch (Throwable e) { reportWtf("starting Connectivity Service", e); Loading