Loading src/com/android/settings/wifi/WifiConfigController.java +67 −53 Original line number Diff line number Diff line Loading @@ -327,9 +327,9 @@ public class WifiConfigController implements TextWatcher, // Display IP address. StaticIpConfiguration staticConfig = config.getIpConfiguration() .getStaticIpConfiguration(); if (staticConfig != null && staticConfig.ipAddress != null) { if (staticConfig != null && staticConfig.getIpAddress() != null) { addRow(group, R.string.wifi_ip_address, staticConfig.ipAddress.getAddress().getHostAddress()); staticConfig.getIpAddress().getAddress().getHostAddress()); } } else { mIpSettingsSpinner.setSelection(DHCP); Loading Loading @@ -915,14 +915,21 @@ public class WifiConfigController implements TextWatcher, if (inetAddr == null || inetAddr.equals(Inet4Address.ANY)) { return R.string.wifi_ip_settings_invalid_ip_address; } // Copy all fields into the builder first and set desired value later with builder. final StaticIpConfiguration.Builder staticIPBuilder = new StaticIpConfiguration.Builder() .setDnsServers(staticIpConfiguration.getDnsServers()) .setDomains(staticIpConfiguration.getDomains()) .setGateway(staticIpConfiguration.getGateway()) .setIpAddress(staticIpConfiguration.getIpAddress()); try { int networkPrefixLength = -1; try { networkPrefixLength = Integer.parseInt(mNetworkPrefixLengthView.getText().toString()); networkPrefixLength = Integer.parseInt( mNetworkPrefixLengthView.getText().toString()); if (networkPrefixLength < 0 || networkPrefixLength > 32) { return R.string.wifi_ip_settings_invalid_network_prefix_length; } staticIpConfiguration.ipAddress = new LinkAddress(inetAddr, networkPrefixLength); staticIPBuilder.setIpAddress(new LinkAddress(inetAddr, networkPrefixLength)); } catch (NumberFormatException e) { // Set the hint as default after user types in ip address mNetworkPrefixLengthView.setText(mConfigUi.getContext().getString( Loading Loading @@ -950,11 +957,12 @@ public class WifiConfigController implements TextWatcher, if (gatewayAddr.isMulticastAddress()) { return R.string.wifi_ip_settings_invalid_gateway; } staticIpConfiguration.gateway = gatewayAddr; staticIPBuilder.setGateway(gatewayAddr); } String dns = mDns1View.getText().toString(); InetAddress dnsAddr = null; final ArrayList<InetAddress> dnsServers = new ArrayList<>(); if (TextUtils.isEmpty(dns)) { //If everything else is valid, provide hint as a default option Loading @@ -964,7 +972,7 @@ public class WifiConfigController implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } staticIpConfiguration.dnsServers.add(dnsAddr); dnsServers.add(dnsAddr); } if (mDns2View.length() > 0) { Loading @@ -973,9 +981,15 @@ public class WifiConfigController implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } staticIpConfiguration.dnsServers.add(dnsAddr); dnsServers.add(dnsAddr); } staticIPBuilder.setDnsServers(dnsServers); return 0; } finally { // Caller of this method may rely on staticIpConfiguration, so build the final result // at the end of the method. staticIpConfiguration = staticIPBuilder.build(); } } private void showSecurityFields(boolean refreshEapMethods, boolean refreshCertificates) { Loading src/com/android/settings/wifi/WifiConfigController2.java +75 −58 Original line number Diff line number Diff line Loading @@ -317,9 +317,9 @@ public class WifiConfigController2 implements TextWatcher, // Display IP address. StaticIpConfiguration staticConfig = config.getIpConfiguration() .getStaticIpConfiguration(); if (staticConfig != null && staticConfig.ipAddress != null) { if (staticConfig != null && staticConfig.getIpAddress() != null) { addRow(group, R.string.wifi_ip_address, staticConfig.ipAddress.getAddress().getHostAddress()); staticConfig.getIpAddress().getAddress().getHostAddress()); } } else { mIpSettingsSpinner.setSelection(DHCP); Loading Loading @@ -898,13 +898,21 @@ public class WifiConfigController2 implements TextWatcher, return R.string.wifi_ip_settings_invalid_ip_address; } // Copy all fields into the builder first and set desired value later with builder. final StaticIpConfiguration.Builder staticIPBuilder = new StaticIpConfiguration.Builder() .setDnsServers(staticIpConfiguration.getDnsServers()) .setDomains(staticIpConfiguration.getDomains()) .setGateway(staticIpConfiguration.getGateway()) .setIpAddress(staticIpConfiguration.getIpAddress()); try { int networkPrefixLength = -1; try { networkPrefixLength = Integer.parseInt(mNetworkPrefixLengthView.getText().toString()); networkPrefixLength = Integer.parseInt(mNetworkPrefixLengthView.getText().toString()); if (networkPrefixLength < 0 || networkPrefixLength > 32) { return R.string.wifi_ip_settings_invalid_network_prefix_length; } staticIpConfiguration.ipAddress = new LinkAddress(inetAddr, networkPrefixLength); staticIPBuilder.setIpAddress(new LinkAddress(inetAddr, networkPrefixLength)); } catch (NumberFormatException e) { // Set the hint as default after user types in ip address mNetworkPrefixLengthView.setText(mConfigUi.getContext().getString( Loading Loading @@ -932,11 +940,12 @@ public class WifiConfigController2 implements TextWatcher, if (gatewayAddr.isMulticastAddress()) { return R.string.wifi_ip_settings_invalid_gateway; } staticIpConfiguration.gateway = gatewayAddr; staticIPBuilder.setGateway(gatewayAddr); } String dns = mDns1View.getText().toString(); InetAddress dnsAddr = null; final ArrayList<InetAddress> dnsServers = new ArrayList<>(); if (TextUtils.isEmpty(dns)) { //If everything else is valid, provide hint as a default option Loading @@ -946,6 +955,7 @@ public class WifiConfigController2 implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } dnsServers.add(dnsAddr); staticIpConfiguration.dnsServers.add(dnsAddr); } Loading @@ -955,9 +965,16 @@ public class WifiConfigController2 implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } dnsServers.add(dnsAddr); staticIpConfiguration.dnsServers.add(dnsAddr); } staticIPBuilder.setDnsServers(dnsServers); return 0; } finally { // Caller of this method may rely on staticIpConfiguration, so build the final result // at the end of the method. staticIpConfiguration = staticIPBuilder.build(); } } private void showSecurityFields(boolean refreshEapMethods, boolean refreshCertificates) { Loading Loading @@ -1367,18 +1384,18 @@ public class WifiConfigController2 implements TextWatcher, StaticIpConfiguration staticConfig = config.getIpConfiguration() .getStaticIpConfiguration(); if (staticConfig != null) { if (staticConfig.ipAddress != null) { if (staticConfig.getIpAddress() != null) { mIpAddressView.setText( staticConfig.ipAddress.getAddress().getHostAddress()); mNetworkPrefixLengthView.setText(Integer.toString(staticConfig.ipAddress .getPrefixLength())); staticConfig.getIpAddress().getAddress().getHostAddress()); mNetworkPrefixLengthView.setText(Integer.toString( staticConfig.getIpAddress().getPrefixLength())); } if (staticConfig.gateway != null) { mGatewayView.setText(staticConfig.gateway.getHostAddress()); mGatewayView.setText(staticConfig.getGateway().getHostAddress()); } Iterator<InetAddress> dnsIterator = staticConfig.dnsServers.iterator(); Iterator<InetAddress> dnsIterator = staticConfig.getDnsServers().iterator(); if (dnsIterator.hasNext()) { mDns1View.setText(dnsIterator.next().getHostAddress()); } Loading Loading
src/com/android/settings/wifi/WifiConfigController.java +67 −53 Original line number Diff line number Diff line Loading @@ -327,9 +327,9 @@ public class WifiConfigController implements TextWatcher, // Display IP address. StaticIpConfiguration staticConfig = config.getIpConfiguration() .getStaticIpConfiguration(); if (staticConfig != null && staticConfig.ipAddress != null) { if (staticConfig != null && staticConfig.getIpAddress() != null) { addRow(group, R.string.wifi_ip_address, staticConfig.ipAddress.getAddress().getHostAddress()); staticConfig.getIpAddress().getAddress().getHostAddress()); } } else { mIpSettingsSpinner.setSelection(DHCP); Loading Loading @@ -915,14 +915,21 @@ public class WifiConfigController implements TextWatcher, if (inetAddr == null || inetAddr.equals(Inet4Address.ANY)) { return R.string.wifi_ip_settings_invalid_ip_address; } // Copy all fields into the builder first and set desired value later with builder. final StaticIpConfiguration.Builder staticIPBuilder = new StaticIpConfiguration.Builder() .setDnsServers(staticIpConfiguration.getDnsServers()) .setDomains(staticIpConfiguration.getDomains()) .setGateway(staticIpConfiguration.getGateway()) .setIpAddress(staticIpConfiguration.getIpAddress()); try { int networkPrefixLength = -1; try { networkPrefixLength = Integer.parseInt(mNetworkPrefixLengthView.getText().toString()); networkPrefixLength = Integer.parseInt( mNetworkPrefixLengthView.getText().toString()); if (networkPrefixLength < 0 || networkPrefixLength > 32) { return R.string.wifi_ip_settings_invalid_network_prefix_length; } staticIpConfiguration.ipAddress = new LinkAddress(inetAddr, networkPrefixLength); staticIPBuilder.setIpAddress(new LinkAddress(inetAddr, networkPrefixLength)); } catch (NumberFormatException e) { // Set the hint as default after user types in ip address mNetworkPrefixLengthView.setText(mConfigUi.getContext().getString( Loading Loading @@ -950,11 +957,12 @@ public class WifiConfigController implements TextWatcher, if (gatewayAddr.isMulticastAddress()) { return R.string.wifi_ip_settings_invalid_gateway; } staticIpConfiguration.gateway = gatewayAddr; staticIPBuilder.setGateway(gatewayAddr); } String dns = mDns1View.getText().toString(); InetAddress dnsAddr = null; final ArrayList<InetAddress> dnsServers = new ArrayList<>(); if (TextUtils.isEmpty(dns)) { //If everything else is valid, provide hint as a default option Loading @@ -964,7 +972,7 @@ public class WifiConfigController implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } staticIpConfiguration.dnsServers.add(dnsAddr); dnsServers.add(dnsAddr); } if (mDns2View.length() > 0) { Loading @@ -973,9 +981,15 @@ public class WifiConfigController implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } staticIpConfiguration.dnsServers.add(dnsAddr); dnsServers.add(dnsAddr); } staticIPBuilder.setDnsServers(dnsServers); return 0; } finally { // Caller of this method may rely on staticIpConfiguration, so build the final result // at the end of the method. staticIpConfiguration = staticIPBuilder.build(); } } private void showSecurityFields(boolean refreshEapMethods, boolean refreshCertificates) { Loading
src/com/android/settings/wifi/WifiConfigController2.java +75 −58 Original line number Diff line number Diff line Loading @@ -317,9 +317,9 @@ public class WifiConfigController2 implements TextWatcher, // Display IP address. StaticIpConfiguration staticConfig = config.getIpConfiguration() .getStaticIpConfiguration(); if (staticConfig != null && staticConfig.ipAddress != null) { if (staticConfig != null && staticConfig.getIpAddress() != null) { addRow(group, R.string.wifi_ip_address, staticConfig.ipAddress.getAddress().getHostAddress()); staticConfig.getIpAddress().getAddress().getHostAddress()); } } else { mIpSettingsSpinner.setSelection(DHCP); Loading Loading @@ -898,13 +898,21 @@ public class WifiConfigController2 implements TextWatcher, return R.string.wifi_ip_settings_invalid_ip_address; } // Copy all fields into the builder first and set desired value later with builder. final StaticIpConfiguration.Builder staticIPBuilder = new StaticIpConfiguration.Builder() .setDnsServers(staticIpConfiguration.getDnsServers()) .setDomains(staticIpConfiguration.getDomains()) .setGateway(staticIpConfiguration.getGateway()) .setIpAddress(staticIpConfiguration.getIpAddress()); try { int networkPrefixLength = -1; try { networkPrefixLength = Integer.parseInt(mNetworkPrefixLengthView.getText().toString()); networkPrefixLength = Integer.parseInt(mNetworkPrefixLengthView.getText().toString()); if (networkPrefixLength < 0 || networkPrefixLength > 32) { return R.string.wifi_ip_settings_invalid_network_prefix_length; } staticIpConfiguration.ipAddress = new LinkAddress(inetAddr, networkPrefixLength); staticIPBuilder.setIpAddress(new LinkAddress(inetAddr, networkPrefixLength)); } catch (NumberFormatException e) { // Set the hint as default after user types in ip address mNetworkPrefixLengthView.setText(mConfigUi.getContext().getString( Loading Loading @@ -932,11 +940,12 @@ public class WifiConfigController2 implements TextWatcher, if (gatewayAddr.isMulticastAddress()) { return R.string.wifi_ip_settings_invalid_gateway; } staticIpConfiguration.gateway = gatewayAddr; staticIPBuilder.setGateway(gatewayAddr); } String dns = mDns1View.getText().toString(); InetAddress dnsAddr = null; final ArrayList<InetAddress> dnsServers = new ArrayList<>(); if (TextUtils.isEmpty(dns)) { //If everything else is valid, provide hint as a default option Loading @@ -946,6 +955,7 @@ public class WifiConfigController2 implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } dnsServers.add(dnsAddr); staticIpConfiguration.dnsServers.add(dnsAddr); } Loading @@ -955,9 +965,16 @@ public class WifiConfigController2 implements TextWatcher, if (dnsAddr == null) { return R.string.wifi_ip_settings_invalid_dns; } dnsServers.add(dnsAddr); staticIpConfiguration.dnsServers.add(dnsAddr); } staticIPBuilder.setDnsServers(dnsServers); return 0; } finally { // Caller of this method may rely on staticIpConfiguration, so build the final result // at the end of the method. staticIpConfiguration = staticIPBuilder.build(); } } private void showSecurityFields(boolean refreshEapMethods, boolean refreshCertificates) { Loading Loading @@ -1367,18 +1384,18 @@ public class WifiConfigController2 implements TextWatcher, StaticIpConfiguration staticConfig = config.getIpConfiguration() .getStaticIpConfiguration(); if (staticConfig != null) { if (staticConfig.ipAddress != null) { if (staticConfig.getIpAddress() != null) { mIpAddressView.setText( staticConfig.ipAddress.getAddress().getHostAddress()); mNetworkPrefixLengthView.setText(Integer.toString(staticConfig.ipAddress .getPrefixLength())); staticConfig.getIpAddress().getAddress().getHostAddress()); mNetworkPrefixLengthView.setText(Integer.toString( staticConfig.getIpAddress().getPrefixLength())); } if (staticConfig.gateway != null) { mGatewayView.setText(staticConfig.gateway.getHostAddress()); mGatewayView.setText(staticConfig.getGateway().getHostAddress()); } Iterator<InetAddress> dnsIterator = staticConfig.dnsServers.iterator(); Iterator<InetAddress> dnsIterator = staticConfig.getDnsServers().iterator(); if (dnsIterator.hasNext()) { mDns1View.setText(dnsIterator.next().getHostAddress()); } Loading