Merge "Split out the ethernet API surface and use framework-connectivity-t"
This commit is contained in:
@@ -154,17 +154,17 @@ filegroup {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove this empty filegroup.
|
||||||
filegroup {
|
filegroup {
|
||||||
name: "framework-connectivity-tiramisu-sources",
|
name: "framework-connectivity-tiramisu-sources",
|
||||||
srcs: [
|
srcs: [],
|
||||||
":framework-connectivity-ethernet-sources",
|
|
||||||
],
|
|
||||||
visibility: ["//frameworks/base"],
|
visibility: ["//frameworks/base"],
|
||||||
}
|
}
|
||||||
|
|
||||||
filegroup {
|
filegroup {
|
||||||
name: "framework-connectivity-tiramisu-updatable-sources",
|
name: "framework-connectivity-tiramisu-updatable-sources",
|
||||||
srcs: [
|
srcs: [
|
||||||
|
":framework-connectivity-ethernet-sources",
|
||||||
":framework-connectivity-ipsec-sources",
|
":framework-connectivity-ipsec-sources",
|
||||||
":framework-connectivity-netstats-sources",
|
":framework-connectivity-netstats-sources",
|
||||||
":framework-connectivity-nsd-sources",
|
":framework-connectivity-nsd-sources",
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ public final class ConnectivityFrameworkInitializerTiramisu {
|
|||||||
private ConnectivityFrameworkInitializerTiramisu() {}
|
private ConnectivityFrameworkInitializerTiramisu() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by {@link SystemServiceRegistry}'s static initializer and registers nsd services to
|
* Called by {@link SystemServiceRegistry}'s static initializer and registers NetworkStats, nsd,
|
||||||
* {@link Context}, so that {@link Context#getSystemService} can return them.
|
* ipsec and ethernet services to {@link Context}, so that {@link Context#getSystemService} can
|
||||||
|
* return them.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException if this is called anywhere besides
|
* @throws IllegalStateException if this is called anywhere besides
|
||||||
* {@link SystemServiceRegistry}.
|
* {@link SystemServiceRegistry}.
|
||||||
@@ -68,5 +69,14 @@ public final class ConnectivityFrameworkInitializerTiramisu {
|
|||||||
return new NetworkStatsManager(context, service);
|
return new NetworkStatsManager(context, service);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
SystemServiceRegistry.registerContextAwareService(
|
||||||
|
Context.ETHERNET_SERVICE,
|
||||||
|
EthernetManager.class,
|
||||||
|
(context, serviceBinder) -> {
|
||||||
|
IEthernetManager service = IEthernetManager.Stub.asInterface(serviceBinder);
|
||||||
|
return new EthernetManager(context, service);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import android.os.Build;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.os.BackgroundThread;
|
import com.android.modules.utils.BackgroundThread;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|||||||
@@ -102,17 +102,16 @@ filegroup {
|
|||||||
],
|
],
|
||||||
path: "src",
|
path: "src",
|
||||||
visibility: [
|
visibility: [
|
||||||
"//frameworks/opt/net/ethernet",
|
"//frameworks/opt/net/ethernet/tests",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connectivity-T common libraries.
|
// Connectivity-T common libraries.
|
||||||
|
|
||||||
|
// TODO: remove this empty filegroup.
|
||||||
filegroup {
|
filegroup {
|
||||||
name: "services.connectivity-tiramisu-sources",
|
name: "services.connectivity-tiramisu-sources",
|
||||||
srcs: [
|
srcs: [],
|
||||||
":services.connectivity-ethernet-sources",
|
|
||||||
],
|
|
||||||
path: "src",
|
path: "src",
|
||||||
visibility: ["//frameworks/base/services/core"],
|
visibility: ["//frameworks/base/services/core"],
|
||||||
}
|
}
|
||||||
@@ -120,6 +119,7 @@ filegroup {
|
|||||||
filegroup {
|
filegroup {
|
||||||
name: "services.connectivity-tiramisu-updatable-sources",
|
name: "services.connectivity-tiramisu-updatable-sources",
|
||||||
srcs: [
|
srcs: [
|
||||||
|
":services.connectivity-ethernet-sources",
|
||||||
":services.connectivity-ipsec-sources",
|
":services.connectivity-ipsec-sources",
|
||||||
":services.connectivity-netstats-sources",
|
":services.connectivity-netstats-sources",
|
||||||
":services.connectivity-nsd-sources",
|
":services.connectivity-nsd-sources",
|
||||||
|
|||||||
@@ -48,10 +48,16 @@ import java.util.Arrays;
|
|||||||
*/
|
*/
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class IpConfigStoreTest {
|
public class IpConfigStoreTest {
|
||||||
|
private static final int KEY_CONFIG = 17;
|
||||||
|
private static final String IFACE_1 = "eth0";
|
||||||
|
private static final String IFACE_2 = "eth1";
|
||||||
|
private static final String IP_ADDR_1 = "192.168.1.10/24";
|
||||||
|
private static final String IP_ADDR_2 = "192.168.1.20/24";
|
||||||
|
private static final String DNS_IP_ADDR_1 = "1.2.3.4";
|
||||||
|
private static final String DNS_IP_ADDR_2 = "5.6.7.8";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void backwardCompatibility2to3() throws IOException {
|
public void backwardCompatibility2to3() throws IOException {
|
||||||
final int KEY_CONFIG = 17;
|
|
||||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
|
||||||
DataOutputStream outputStream = new DataOutputStream(byteStream);
|
DataOutputStream outputStream = new DataOutputStream(byteStream);
|
||||||
|
|
||||||
@@ -73,13 +79,6 @@ public class IpConfigStoreTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void staticIpMultiNetworks() throws Exception {
|
public void staticIpMultiNetworks() throws Exception {
|
||||||
final String IFACE_1 = "eth0";
|
|
||||||
final String IFACE_2 = "eth1";
|
|
||||||
final String IP_ADDR_1 = "192.168.1.10/24";
|
|
||||||
final String IP_ADDR_2 = "192.168.1.20/24";
|
|
||||||
final String DNS_IP_ADDR_1 = "1.2.3.4";
|
|
||||||
final String DNS_IP_ADDR_2 = "5.6.7.8";
|
|
||||||
|
|
||||||
final ArrayList<InetAddress> dnsServers = new ArrayList<>();
|
final ArrayList<InetAddress> dnsServers = new ArrayList<>();
|
||||||
dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_1));
|
dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_1));
|
||||||
dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_2));
|
dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_2));
|
||||||
@@ -144,11 +143,11 @@ public class IpConfigStoreTest {
|
|||||||
|
|
||||||
/** Synchronously writes into given byte steam */
|
/** Synchronously writes into given byte steam */
|
||||||
private static class MockedDelayedDiskWrite extends DelayedDiskWrite {
|
private static class MockedDelayedDiskWrite extends DelayedDiskWrite {
|
||||||
final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
|
final ByteArrayOutputStream mByteStream = new ByteArrayOutputStream();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(String filePath, Writer w) {
|
public void write(String filePath, Writer w) {
|
||||||
DataOutputStream outputStream = new DataOutputStream(byteStream);
|
DataOutputStream outputStream = new DataOutputStream(mByteStream);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
w.onWriteCalled(outputStream);
|
w.onWriteCalled(outputStream);
|
||||||
Reference in New Issue
Block a user