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
This commit is contained in:
Lorenzo Colitti
2014-07-31 00:48:01 +09:00
parent 5d6a2cd7ca
commit eff82e8099
2 changed files with 52 additions and 47 deletions

View File

@@ -21,7 +21,6 @@ import android.net.IEthernetManager;
import android.net.IpConfiguration;
import android.net.IpConfiguration.IpAssignment;
import android.net.IpConfiguration.ProxySettings;
import android.net.LinkProperties;
import android.os.RemoteException;
/**
@@ -52,16 +51,12 @@ public class EthernetManager {
*/
public IpConfiguration getConfiguration() {
if (mService == null) {
return new IpConfiguration(IpAssignment.UNASSIGNED,
ProxySettings.UNASSIGNED,
new LinkProperties());
return new IpConfiguration();
}
try {
return mService.getConfiguration();
} catch (RemoteException e) {
return new IpConfiguration(IpAssignment.UNASSIGNED,
ProxySettings.UNASSIGNED,
new LinkProperties());
return new IpConfiguration();
}
}