summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJames Mattis <jmattis@google.com>2022-02-17 13:08:20 -0800
committerJames Mattis <jmattis@google.com>2022-02-24 17:36:59 -0800
commitfcc56fc1588a9f5f884cd8b3eaa63bcea610f8b5 (patch)
treecb8eaf86126f8a61acd2a7da857a5d57febf6c73 /java
parent47b8ff501c0730f93c2c829bf8c531c9f046f8ef (diff)
downloadethernet-fcc56fc1588a9f5f884cd8b3eaa63bcea610f8b5.tar.gz
Using a builder for eth requests
Updating ethernet classes to use a builder when creating an EthernetNetworkUpdateRequest and also changing to use IpConfiguration instead of StaticIpConfiguration for the UpdateConfiguration API. Bug: 220017952 Bug: 210487893 Bug: 210485380 Test: atest EthernetServiceTests Change-Id: I2647115bf867dfaa3f3dadf00e3c875aa7e8d88f
Diffstat (limited to 'java')
-rw-r--r--java/com/android/server/ethernet/EthernetServiceImpl.java2
-rw-r--r--java/com/android/server/ethernet/EthernetTracker.java18
2 files changed, 8 insertions, 12 deletions
diff --git a/java/com/android/server/ethernet/EthernetServiceImpl.java b/java/com/android/server/ethernet/EthernetServiceImpl.java
index c1c6d3a..fed500f 100644
--- a/java/com/android/server/ethernet/EthernetServiceImpl.java
+++ b/java/com/android/server/ethernet/EthernetServiceImpl.java
@@ -239,7 +239,7 @@ public class EthernetServiceImpl extends IEthernetManager.Stub {
// TODO: validate that iface is listed in overlay config_ethernet_interfaces
mTracker.updateConfiguration(
- iface, request.getIpConfig(), request.getNetworkCapabilities(), listener);
+ iface, request.getIpConfiguration(), request.getNetworkCapabilities(), listener);
}
@Override
diff --git a/java/com/android/server/ethernet/EthernetTracker.java b/java/com/android/server/ethernet/EthernetTracker.java
index 2571fe6..794b5d1 100644
--- a/java/com/android/server/ethernet/EthernetTracker.java
+++ b/java/com/android/server/ethernet/EthernetTracker.java
@@ -229,18 +229,18 @@ public class EthernetTracker {
@VisibleForTesting(visibility = PACKAGE)
protected void updateConfiguration(@NonNull final String iface,
- @NonNull final StaticIpConfiguration staticIpConfig,
+ @NonNull final IpConfiguration ipConfig,
@NonNull final NetworkCapabilities capabilities,
@Nullable final IEthernetNetworkManagementListener listener) {
if (DBG) {
Log.i(TAG, "updateConfiguration, iface: " + iface + ", capabilities: " + capabilities
- + ", staticIpConfig: " + staticIpConfig);
+ + ", ipConfig: " + ipConfig);
}
- final IpConfiguration ipConfig = createIpConfiguration(staticIpConfig);
- writeIpConfiguration(iface, ipConfig);
+ final IpConfiguration localIpConfig = new IpConfiguration(ipConfig);
+ writeIpConfiguration(iface, localIpConfig);
mNetworkCapabilities.put(iface, capabilities);
mHandler.post(() -> {
- mFactory.updateInterface(iface, ipConfig, capabilities, listener);
+ mFactory.updateInterface(iface, localIpConfig, capabilities, listener);
broadcastInterfaceStateChange(iface);
});
}
@@ -715,13 +715,9 @@ public class EthernetTracker {
return createIpConfiguration(staticIpConfigBuilder.build());
}
- static IpConfiguration createIpConfiguration(
+ private static IpConfiguration createIpConfiguration(
@NonNull final StaticIpConfiguration staticIpConfig) {
- final IpConfiguration ret = new IpConfiguration();
- ret.setIpAssignment(IpAssignment.STATIC);
- ret.setProxySettings(ProxySettings.NONE);
- ret.setStaticIpConfiguration(staticIpConfig);
- return ret;
+ return new IpConfiguration.Builder().setStaticIpConfiguration(staticIpConfig).build();
}
private IpConfiguration getOrCreateIpConfiguration(String iface) {