summaryrefslogtreecommitdiffstats
path: root/core/tests/ConnectivityManagerTest
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-07-31 00:48:01 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-08-19 11:59:43 -0700
commit0a82e80073e193725a9d4c84a93db8a04b2456b9 (patch)
tree0fc1bb0fab2818df4175215e88ac52372e20bc66 /core/tests/ConnectivityManagerTest
parent3a6eba01c48363f675090bd8e0f853a7fbf2165d (diff)
downloadframeworks_base-0a82e80073e193725a9d4c84a93db8a04b2456b9.zip
frameworks_base-0a82e80073e193725a9d4c84a93db8a04b2456b9.tar.gz
frameworks_base-0a82e80073e193725a9d4c84a93db8a04b2456b9.tar.bz2
Stop using LinkProperties for static configuration.
LinkProperties can represent way more complicated configurations than what we can actually apply to interfaces. This makes it error-prone to use it to represent static configuration, both when trying to apply configuration coming from LinkProperties and when trying to save configuration from current LinkProperties. Instead, move static configuration (IPv4 only, since we don't support static IPv6 configuration) into a separate StaticIpConfiguration class. Bug: 16114392 Bug: 16893413 Change-Id: Ib33f35c004e30b6067bb20235ffa43c247d174df
Diffstat (limited to 'core/tests/ConnectivityManagerTest')
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java
index 116a31e..93b16e7 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java
@@ -26,8 +26,8 @@ import org.xml.sax.helpers.DefaultHandler;
import android.net.IpConfiguration.IpAssignment;
import android.net.IpConfiguration.ProxySettings;
import android.net.LinkAddress;
-import android.net.LinkProperties;
import android.net.RouteInfo;
+import android.net.StaticIpConfiguration;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiConfiguration.AuthAlgorithm;
import android.net.wifi.WifiConfiguration.KeyMgmt;
@@ -116,7 +116,7 @@ public class AccessPointParserHelper {
boolean usercert = false;
WifiConfiguration config = null;
int securityType = NONE;
- LinkProperties mLinkProperties = null;
+ StaticIpConfiguration mStaticIpConfiguration = null;
InetAddress mInetAddr = null;
@Override
@@ -153,7 +153,7 @@ public class AccessPointParserHelper {
usercert = true;
}
if (tagName.equalsIgnoreCase("ip")) {
- mLinkProperties = new LinkProperties();
+ mStaticIpConfiguration = new StaticIpConfiguration();
ip = true;
}
if (tagName.equalsIgnoreCase("gateway")) {
@@ -173,15 +173,15 @@ public class AccessPointParserHelper {
@Override
public void endElement(String uri, String localName, String tagName) throws SAXException {
if (tagName.equalsIgnoreCase("accesspoint")) {
- if (mLinkProperties != null) {
+ if (mStaticIpConfiguration != null) {
config.setIpAssignment(IpAssignment.STATIC);
- config.setLinkProperties(mLinkProperties);
+ config.setStaticIpConfiguration(mStaticIpConfiguration);
} else {
config.setIpAssignment(IpAssignment.DHCP);
}
config.setProxySettings(ProxySettings.NONE);
networks.add(config);
- mLinkProperties = null;
+ mStaticIpConfiguration = null;
}
}
@@ -312,7 +312,7 @@ public class AccessPointParserHelper {
if (!InetAddress.isNumeric(gwAddr)) {
throw new SAXException();
}
- mLinkProperties.addRoute(new RouteInfo(InetAddress.getByName(gwAddr)));
+ mStaticIpConfiguration.gateway = InetAddress.getByName(gwAddr);
} catch (UnknownHostException e) {
throw new SAXException();
}
@@ -324,7 +324,7 @@ public class AccessPointParserHelper {
if ((nwPrefixLength < 0) || (nwPrefixLength > 32)) {
throw new SAXException();
}
- mLinkProperties.addLinkAddress(new LinkAddress(mInetAddr, nwPrefixLength));
+ mStaticIpConfiguration.ipAddress = new LinkAddress(mInetAddr, nwPrefixLength);
} catch (NumberFormatException e) {
throw new SAXException();
}
@@ -336,7 +336,7 @@ public class AccessPointParserHelper {
if (!InetAddress.isNumeric(dnsAddr)) {
throw new SAXException();
}
- mLinkProperties.addDnsServer(InetAddress.getByName(dnsAddr));
+ mStaticIpConfiguration.dnsServers.add(InetAddress.getByName(dnsAddr));
} catch (UnknownHostException e) {
throw new SAXException();
}
@@ -348,7 +348,7 @@ public class AccessPointParserHelper {
if (!InetAddress.isNumeric(dnsAddr)) {
throw new SAXException();
}
- mLinkProperties.addDnsServer(InetAddress.getByName(dnsAddr));
+ mStaticIpConfiguration.dnsServers.add(InetAddress.getByName(dnsAddr));
} catch (UnknownHostException e) {
throw new SAXException();
}