diff options
Diffstat (limited to 'src/com/android/settings/wifi')
-rw-r--r-- | src/com/android/settings/wifi/WifiConfigController.java | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index db1870e..a20e160 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -26,6 +26,7 @@ import android.net.NetworkInfo.DetailedState; import android.net.NetworkUtils; import android.net.Proxy; import android.net.ProxyProperties; +import android.net.RouteInfo; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration.IpAssignment; import android.net.wifi.WifiConfiguration.AuthAlgorithm; @@ -196,7 +197,7 @@ public class WifiConfigController implements TextWatcher, } WifiInfo info = mAccessPoint.getInfo(); - if (info != null) { + if (info != null && info.getLinkSpeed() != -1) { addRow(group, R.string.wifi_speed, info.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS); } @@ -264,19 +265,25 @@ public class WifiConfigController implements TextWatcher, if (submit == null) return; boolean enabled = false; - if ((mSsidView != null && mSsidView.length() == 0) || - ((mAccessPoint == null || mAccessPoint.networkId == INVALID_NETWORK_ID) && + boolean passwordInvalid = false; + + /* Check password invalidity for manual network set up alone */ + if (chosenNetworkSetupMethod() == MANUAL && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && mPasswordView.length() == 0) || - (mAccessPointSecurity == AccessPoint.SECURITY_PSK && mPasswordView.length() < 8)))) { - enabled = false; - } else { - enabled = true; + (mAccessPointSecurity == AccessPoint.SECURITY_PSK && mPasswordView.length() < 8))) { + passwordInvalid = true; } - if (ipAndProxyFieldsAreValid()) { - enabled = true; - } else { + if ((mSsidView != null && mSsidView.length() == 0) || + ((mAccessPoint == null || mAccessPoint.networkId == INVALID_NETWORK_ID) && + passwordInvalid)) { enabled = false; + } else { + if (ipAndProxyFieldsAreValid()) { + enabled = true; + } else { + enabled = false; + } } submit.setEnabled(enabled); } @@ -434,7 +441,7 @@ public class WifiConfigController implements TextWatcher, } catch (IllegalArgumentException e) { return R.string.wifi_ip_settings_invalid_gateway; } - linkProperties.addGateway(gatewayAddr); + linkProperties.addRoute(new RouteInfo(gatewayAddr)); String dns = mDns1View.getText().toString(); InetAddress dnsAddr = null; @@ -518,7 +525,7 @@ public class WifiConfigController implements TextWatcher, return; } mView.findViewById(R.id.eap).setVisibility(View.VISIBLE); - + if (mEapMethodSpinner == null) { mEapMethodSpinner = (Spinner) mView.findViewById(R.id.method); mPhase2Spinner = (Spinner) mView.findViewById(R.id.phase2); @@ -605,10 +612,13 @@ public class WifiConfigController implements TextWatcher, .getNetworkPrefixLength())); } - Iterator<InetAddress>gateways = linkProperties.getGateways().iterator(); - if (gateways.hasNext()) { - mGatewayView.setText(gateways.next().getHostAddress()); + for (RouteInfo route : linkProperties.getRoutes()) { + if (route.isDefaultRoute()) { + mGatewayView.setText(route.getGateway().getHostAddress()); + break; + } } + Iterator<InetAddress> dnsIterator = linkProperties.getDnses().iterator(); if (dnsIterator.hasNext()) { mDns1View.setText(dnsIterator.next().getHostAddress()); @@ -727,16 +737,14 @@ public class WifiConfigController implements TextWatcher, if (parent == mSecuritySpinner) { mAccessPointSecurity = position; showSecurityFields(); - enableSubmitIfAppropriate(); } else if (parent == mNetworkSetupSpinner) { showNetworkSetupFields(); } else if (parent == mProxySettingsSpinner) { showProxyFields(); - enableSubmitIfAppropriate(); } else { showIpConfigFields(); - enableSubmitIfAppropriate(); } + enableSubmitIfAppropriate(); } @Override |