Merge "Remove hidden connectivity methods access"

This commit is contained in:
Chiachang Wang
2021-03-19 08:13:06 +00:00
committed by Gerrit Code Review
7 changed files with 35 additions and 24 deletions

View File

@@ -825,9 +825,12 @@ public class WifiConfigController implements TextWatcher,
.get(mEapSimSpinner.getSelectedItemPosition()).getCarrierId();
}
config.setIpConfiguration(
new IpConfiguration(mIpAssignment, mProxySettings,
mStaticIpConfiguration, mHttpProxy));
final IpConfiguration ipConfig = new IpConfiguration();
ipConfig.setIpAssignment(mIpAssignment);
ipConfig.setProxySettings(mProxySettings);
ipConfig.setStaticIpConfiguration(mStaticIpConfiguration);
ipConfig.setHttpProxy(mHttpProxy);
config.setIpConfiguration(ipConfig);
if (mMeteredSettingsSpinner != null) {
config.meteredOverride = mMeteredSettingsSpinner.getSelectedItemPosition();
}
@@ -1400,18 +1403,18 @@ public class WifiConfigController 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());
if (staticConfig.getGateway() != null) {
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());
}

View File

@@ -807,9 +807,12 @@ public class WifiConfigController2 implements TextWatcher,
return null;
}
config.setIpConfiguration(
new IpConfiguration(mIpAssignment, mProxySettings,
mStaticIpConfiguration, mHttpProxy));
final IpConfiguration ipConfig = new IpConfiguration();
ipConfig.setIpAssignment(mIpAssignment);
ipConfig.setProxySettings(mProxySettings);
ipConfig.setStaticIpConfiguration(mStaticIpConfiguration);
ipConfig.setHttpProxy(mHttpProxy);
config.setIpConfiguration(ipConfig);
if (mMeteredSettingsSpinner != null) {
config.meteredOverride = mMeteredSettingsSpinner.getSelectedItemPosition();
}
@@ -958,7 +961,7 @@ public class WifiConfigController2 implements TextWatcher,
return R.string.wifi_ip_settings_invalid_dns;
}
dnsServers.add(dnsAddr);
staticIpConfiguration.dnsServers.add(dnsAddr);
staticIpConfiguration.getDnsServers().add(dnsAddr);
}
if (mDns2View.length() > 0) {
@@ -968,7 +971,7 @@ public class WifiConfigController2 implements TextWatcher,
return R.string.wifi_ip_settings_invalid_dns;
}
dnsServers.add(dnsAddr);
staticIpConfiguration.dnsServers.add(dnsAddr);
staticIpConfiguration.getDnsServers().add(dnsAddr);
}
staticIPBuilder.setDnsServers(dnsServers);
return 0;
@@ -1393,7 +1396,7 @@ public class WifiConfigController2 implements TextWatcher,
staticConfig.getIpAddress().getPrefixLength()));
}
if (staticConfig.gateway != null) {
if (staticConfig.getGateway() != null) {
mGatewayView.setText(staticConfig.getGateway().getHostAddress());
}

View File

@@ -901,7 +901,8 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
// Find IPv4 default gateway.
String gateway = null;
for (RouteInfo routeInfo : mLinkProperties.getRoutes()) {
if (routeInfo.isIPv4Default() && routeInfo.hasGateway()) {
if (routeInfo.hasGateway() && routeInfo.isDefaultRoute()
&& routeInfo.getDestination().getAddress() instanceof Inet4Address) {
gateway = routeInfo.getGateway().getHostAddress();
break;
}

View File

@@ -838,7 +838,8 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
// Find IPv4 default gateway.
String gateway = null;
for (RouteInfo routeInfo : mLinkProperties.getRoutes()) {
if (routeInfo.isIPv4Default() && routeInfo.hasGateway()) {
if (routeInfo.hasGateway() && routeInfo.isDefaultRoute()
&& routeInfo.getDestination().getAddress() instanceof Inet4Address) {
gateway = routeInfo.getGateway().getHostAddress();
break;
}