Split out the ethernet API surface and use framework-connectivity-t
Ethernet framework and service source code is going to be moved to Connectivity mainline module, this CL contains below corresponding changes to adapt the migration in f/b side: 1. Split out ethernet module-lib APIs to Connectivity module. Add the ethernet resource filegroup to tiramisu-updatable-sources filegroup as well, build them together. Also update the module-lib and system api txt to reflect the APIs change. Remove the hidden APIs which are moved to Connectivity module. This removal fixes the api inconsistent issue with Tethering/apex/hidden/. 2. Remove EthernetService from SystemServer which will be registered from ConnectivityServiceInitializer. 3. Replace the BackgroundThread class(imported from f/b/core/java) with the one in the modules-utils-backgroundthread lib, which is visible to Connectivity module. Bug: 210586283 Test: m Test: atest FrameworksNetTests EthernetServiceTests Change-Id: I1956848d3248cc56e9841d221e5e4c160bed65a4
This commit is contained in:
parent
de247f70ba
commit
218c4d3162
@ -32472,14 +32472,6 @@ Landroid/net/DhcpResults;->setLeaseDuration(I)V
|
||||
Landroid/net/DhcpResults;->setServerAddress(Ljava/lang/String;)Z
|
||||
Landroid/net/DhcpResults;->setVendorInfo(Ljava/lang/String;)V
|
||||
Landroid/net/DhcpResults;->TAG:Ljava/lang/String;
|
||||
Landroid/net/EthernetManager;-><init>(Landroid/content/Context;Landroid/net/IEthernetManager;)V
|
||||
Landroid/net/EthernetManager;->mContext:Landroid/content/Context;
|
||||
Landroid/net/EthernetManager;->mHandler:Landroid/os/Handler;
|
||||
Landroid/net/EthernetManager;->mListeners:Ljava/util/ArrayList;
|
||||
Landroid/net/EthernetManager;->mService:Landroid/net/IEthernetManager;
|
||||
Landroid/net/EthernetManager;->mServiceListener:Landroid/net/IEthernetServiceListener$Stub;
|
||||
Landroid/net/EthernetManager;->MSG_AVAILABILITY_CHANGED:I
|
||||
Landroid/net/EthernetManager;->TAG:Ljava/lang/String;
|
||||
Landroid/net/EventLogTags;-><init>()V
|
||||
Landroid/net/EventLogTags;->NTP_FAILURE:I
|
||||
Landroid/net/EventLogTags;->NTP_SUCCESS:I
|
||||
@ -32513,39 +32505,6 @@ Landroid/net/http/X509TrustManagerExtensions;->mCheckServerTrusted:Ljava/lang/re
|
||||
Landroid/net/http/X509TrustManagerExtensions;->mDelegate:Lcom/android/org/conscrypt/TrustManagerImpl;
|
||||
Landroid/net/http/X509TrustManagerExtensions;->mIsSameTrustConfiguration:Ljava/lang/reflect/Method;
|
||||
Landroid/net/http/X509TrustManagerExtensions;->mTrustManager:Ljavax/net/ssl/X509TrustManager;
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->addListener(Landroid/net/IEthernetServiceListener;)V
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->getAvailableInterfaces()[Ljava/lang/String;
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->getConfiguration(Ljava/lang/String;)Landroid/net/IpConfiguration;
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->getInterfaceDescriptor()Ljava/lang/String;
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->isAvailable(Ljava/lang/String;)Z
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->mRemote:Landroid/os/IBinder;
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->removeListener(Landroid/net/IEthernetServiceListener;)V
|
||||
Landroid/net/IEthernetManager$Stub$Proxy;->setConfiguration(Ljava/lang/String;Landroid/net/IpConfiguration;)V
|
||||
Landroid/net/IEthernetManager$Stub;-><init>()V
|
||||
Landroid/net/IEthernetManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/IEthernetManager;
|
||||
Landroid/net/IEthernetManager$Stub;->DESCRIPTOR:Ljava/lang/String;
|
||||
Landroid/net/IEthernetManager$Stub;->TRANSACTION_addListener:I
|
||||
Landroid/net/IEthernetManager$Stub;->TRANSACTION_getAvailableInterfaces:I
|
||||
Landroid/net/IEthernetManager$Stub;->TRANSACTION_getConfiguration:I
|
||||
Landroid/net/IEthernetManager$Stub;->TRANSACTION_isAvailable:I
|
||||
Landroid/net/IEthernetManager$Stub;->TRANSACTION_removeListener:I
|
||||
Landroid/net/IEthernetManager$Stub;->TRANSACTION_setConfiguration:I
|
||||
Landroid/net/IEthernetManager;->addListener(Landroid/net/IEthernetServiceListener;)V
|
||||
Landroid/net/IEthernetManager;->getAvailableInterfaces()[Ljava/lang/String;
|
||||
Landroid/net/IEthernetManager;->getConfiguration(Ljava/lang/String;)Landroid/net/IpConfiguration;
|
||||
Landroid/net/IEthernetManager;->isAvailable(Ljava/lang/String;)Z
|
||||
Landroid/net/IEthernetManager;->removeListener(Landroid/net/IEthernetServiceListener;)V
|
||||
Landroid/net/IEthernetManager;->setConfiguration(Ljava/lang/String;Landroid/net/IpConfiguration;)V
|
||||
Landroid/net/IEthernetServiceListener$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
|
||||
Landroid/net/IEthernetServiceListener$Stub$Proxy;->getInterfaceDescriptor()Ljava/lang/String;
|
||||
Landroid/net/IEthernetServiceListener$Stub$Proxy;->mRemote:Landroid/os/IBinder;
|
||||
Landroid/net/IEthernetServiceListener$Stub$Proxy;->onAvailabilityChanged(Ljava/lang/String;Z)V
|
||||
Landroid/net/IEthernetServiceListener$Stub;-><init>()V
|
||||
Landroid/net/IEthernetServiceListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/IEthernetServiceListener;
|
||||
Landroid/net/IEthernetServiceListener$Stub;->DESCRIPTOR:Ljava/lang/String;
|
||||
Landroid/net/IEthernetServiceListener$Stub;->TRANSACTION_onAvailabilityChanged:I
|
||||
Landroid/net/IEthernetServiceListener;->onAvailabilityChanged(Ljava/lang/String;Z)V
|
||||
Landroid/net/IIpConnectivityMetrics$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
|
||||
Landroid/net/IIpConnectivityMetrics$Stub$Proxy;->addNetdEventCallback(ILandroid/net/INetdEventCallback;)Z
|
||||
Landroid/net/IIpConnectivityMetrics$Stub$Proxy;->getInterfaceDescriptor()Ljava/lang/String;
|
||||
|
@ -26506,14 +26506,6 @@ package android.net {
|
||||
method public int getUid();
|
||||
}
|
||||
|
||||
public final class EthernetNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
|
||||
ctor public EthernetNetworkSpecifier(@NonNull String);
|
||||
method public int describeContents();
|
||||
method @Nullable public String getInterfaceName();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.EthernetNetworkSpecifier> CREATOR;
|
||||
}
|
||||
|
||||
public final class Ikev2VpnProfile extends android.net.PlatformVpnProfile {
|
||||
method @NonNull public java.util.List<java.lang.String> getAllowedAlgorithms();
|
||||
method public int getMaxMtu();
|
||||
|
@ -232,22 +232,6 @@ package android.media.session {
|
||||
|
||||
package android.net {
|
||||
|
||||
public class EthernetManager {
|
||||
method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void addInterfaceStateListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.EthernetManager.InterfaceStateListener);
|
||||
method public void removeInterfaceStateListener(@NonNull android.net.EthernetManager.InterfaceStateListener);
|
||||
method public void setIncludeTestInterfaces(boolean);
|
||||
field public static final int ROLE_CLIENT = 1; // 0x1
|
||||
field public static final int ROLE_NONE = 0; // 0x0
|
||||
field public static final int ROLE_SERVER = 2; // 0x2
|
||||
field public static final int STATE_ABSENT = 0; // 0x0
|
||||
field public static final int STATE_LINK_DOWN = 1; // 0x1
|
||||
field public static final int STATE_LINK_UP = 2; // 0x2
|
||||
}
|
||||
|
||||
public static interface EthernetManager.InterfaceStateListener {
|
||||
method public void onInterfaceStateChanged(@NonNull String, int, int, @Nullable android.net.IpConfiguration);
|
||||
}
|
||||
|
||||
public class LocalSocket implements java.io.Closeable {
|
||||
ctor public LocalSocket(@NonNull java.io.FileDescriptor);
|
||||
}
|
||||
|
@ -8523,45 +8523,6 @@ package android.metrics {
|
||||
|
||||
package android.net {
|
||||
|
||||
public class EthernetManager {
|
||||
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.MANAGE_ETHERNET_NETWORKS}) public void connectNetwork(@NonNull String, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.BiConsumer<android.net.Network,android.net.EthernetNetworkManagementException>);
|
||||
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.MANAGE_ETHERNET_NETWORKS}) public void disconnectNetwork(@NonNull String, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.BiConsumer<android.net.Network,android.net.EthernetNetworkManagementException>);
|
||||
method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public android.net.EthernetManager.TetheredInterfaceRequest requestTetheredInterface(@NonNull java.util.concurrent.Executor, @NonNull android.net.EthernetManager.TetheredInterfaceCallback);
|
||||
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.MANAGE_ETHERNET_NETWORKS}) public void updateConfiguration(@NonNull String, @NonNull android.net.EthernetNetworkUpdateRequest, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.BiConsumer<android.net.Network,android.net.EthernetNetworkManagementException>);
|
||||
}
|
||||
|
||||
public static interface EthernetManager.TetheredInterfaceCallback {
|
||||
method public void onAvailable(@NonNull String);
|
||||
method public void onUnavailable();
|
||||
}
|
||||
|
||||
public static class EthernetManager.TetheredInterfaceRequest {
|
||||
method public void release();
|
||||
}
|
||||
|
||||
public final class EthernetNetworkManagementException extends java.lang.RuntimeException implements android.os.Parcelable {
|
||||
ctor public EthernetNetworkManagementException(@NonNull String);
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.EthernetNetworkManagementException> CREATOR;
|
||||
}
|
||||
|
||||
public final class EthernetNetworkUpdateRequest implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method @NonNull public android.net.IpConfiguration getIpConfiguration();
|
||||
method @Nullable public android.net.NetworkCapabilities getNetworkCapabilities();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.EthernetNetworkUpdateRequest> CREATOR;
|
||||
}
|
||||
|
||||
public static final class EthernetNetworkUpdateRequest.Builder {
|
||||
ctor public EthernetNetworkUpdateRequest.Builder();
|
||||
ctor public EthernetNetworkUpdateRequest.Builder(@NonNull android.net.EthernetNetworkUpdateRequest);
|
||||
method @NonNull public android.net.EthernetNetworkUpdateRequest build();
|
||||
method @NonNull public android.net.EthernetNetworkUpdateRequest.Builder setIpConfiguration(@NonNull android.net.IpConfiguration);
|
||||
method @NonNull public android.net.EthernetNetworkUpdateRequest.Builder setNetworkCapabilities(@Nullable android.net.NetworkCapabilities);
|
||||
}
|
||||
|
||||
public final class MatchAllNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
|
||||
ctor public MatchAllNetworkSpecifier();
|
||||
method public int describeContents();
|
||||
|
@ -138,8 +138,6 @@ import android.media.tv.tunerresourcemanager.TunerResourceManager;
|
||||
import android.nearby.NearbyFrameworkInitializer;
|
||||
import android.net.ConnectivityFrameworkInitializer;
|
||||
import android.net.ConnectivityFrameworkInitializerTiramisu;
|
||||
import android.net.EthernetManager;
|
||||
import android.net.IEthernetManager;
|
||||
import android.net.INetworkPolicyManager;
|
||||
import android.net.IPacProxyManager;
|
||||
import android.net.IVpnManager;
|
||||
@ -789,15 +787,6 @@ public final class SystemServiceRegistry {
|
||||
return new LowpanManager(ctx.getOuterContext(), service);
|
||||
}});
|
||||
|
||||
registerService(Context.ETHERNET_SERVICE, EthernetManager.class,
|
||||
new CachedServiceFetcher<EthernetManager>() {
|
||||
@Override
|
||||
public EthernetManager createService(ContextImpl ctx) throws ServiceNotFoundException {
|
||||
IBinder b = ServiceManager.getServiceOrThrow(Context.ETHERNET_SERVICE);
|
||||
IEthernetManager service = IEthernetManager.Stub.asInterface(b);
|
||||
return new EthernetManager(ctx.getOuterContext(), service);
|
||||
}});
|
||||
|
||||
registerService(Context.WIFI_NL80211_SERVICE, WifiNl80211Manager.class,
|
||||
new CachedServiceFetcher<WifiNl80211Manager>() {
|
||||
@Override
|
||||
|
@ -154,17 +154,17 @@ filegroup {
|
||||
],
|
||||
}
|
||||
|
||||
// TODO: remove this empty filegroup.
|
||||
filegroup {
|
||||
name: "framework-connectivity-tiramisu-sources",
|
||||
srcs: [
|
||||
":framework-connectivity-ethernet-sources",
|
||||
],
|
||||
srcs: [],
|
||||
visibility: ["//frameworks/base"],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "framework-connectivity-tiramisu-updatable-sources",
|
||||
srcs: [
|
||||
":framework-connectivity-ethernet-sources",
|
||||
":framework-connectivity-ipsec-sources",
|
||||
":framework-connectivity-netstats-sources",
|
||||
":framework-connectivity-nsd-sources",
|
||||
|
@ -34,8 +34,9 @@ public final class ConnectivityFrameworkInitializerTiramisu {
|
||||
private ConnectivityFrameworkInitializerTiramisu() {}
|
||||
|
||||
/**
|
||||
* Called by {@link SystemServiceRegistry}'s static initializer and registers nsd services to
|
||||
* {@link Context}, so that {@link Context#getSystemService} can return them.
|
||||
* Called by {@link SystemServiceRegistry}'s static initializer and registers NetworkStats, nsd,
|
||||
* ipsec and ethernet services to {@link Context}, so that {@link Context#getSystemService} can
|
||||
* return them.
|
||||
*
|
||||
* @throws IllegalStateException if this is called anywhere besides
|
||||
* {@link SystemServiceRegistry}.
|
||||
@ -68,5 +69,14 @@ public final class ConnectivityFrameworkInitializerTiramisu {
|
||||
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 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.RetentionPolicy;
|
||||
|
@ -102,17 +102,16 @@ filegroup {
|
||||
],
|
||||
path: "src",
|
||||
visibility: [
|
||||
"//frameworks/opt/net/ethernet",
|
||||
"//frameworks/opt/net/ethernet/tests",
|
||||
],
|
||||
}
|
||||
|
||||
// Connectivity-T common libraries.
|
||||
|
||||
// TODO: remove this empty filegroup.
|
||||
filegroup {
|
||||
name: "services.connectivity-tiramisu-sources",
|
||||
srcs: [
|
||||
":services.connectivity-ethernet-sources",
|
||||
],
|
||||
srcs: [],
|
||||
path: "src",
|
||||
visibility: ["//frameworks/base/services/core"],
|
||||
}
|
||||
@ -120,6 +119,7 @@ filegroup {
|
||||
filegroup {
|
||||
name: "services.connectivity-tiramisu-updatable-sources",
|
||||
srcs: [
|
||||
":services.connectivity-ethernet-sources",
|
||||
":services.connectivity-ipsec-sources",
|
||||
":services.connectivity-netstats-sources",
|
||||
":services.connectivity-nsd-sources",
|
||||
|
@ -48,10 +48,16 @@ import java.util.Arrays;
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
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
|
||||
public void backwardCompatibility2to3() throws IOException {
|
||||
final int KEY_CONFIG = 17;
|
||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
|
||||
DataOutputStream outputStream = new DataOutputStream(byteStream);
|
||||
|
||||
@ -73,13 +79,6 @@ public class IpConfigStoreTest {
|
||||
|
||||
@Test
|
||||
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<>();
|
||||
dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_1));
|
||||
dnsServers.add(InetAddresses.parseNumericAddress(DNS_IP_ADDR_2));
|
||||
@ -144,11 +143,11 @@ public class IpConfigStoreTest {
|
||||
|
||||
/** Synchronously writes into given byte steam */
|
||||
private static class MockedDelayedDiskWrite extends DelayedDiskWrite {
|
||||
final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
|
||||
final ByteArrayOutputStream mByteStream = new ByteArrayOutputStream();
|
||||
|
||||
@Override
|
||||
public void write(String filePath, Writer w) {
|
||||
DataOutputStream outputStream = new DataOutputStream(byteStream);
|
||||
DataOutputStream outputStream = new DataOutputStream(mByteStream);
|
||||
|
||||
try {
|
||||
w.onWriteCalled(outputStream);
|
@ -293,8 +293,6 @@ public final class SystemServer implements Dumpable {
|
||||
"com.android.server.wifi.p2p.WifiP2pService";
|
||||
private static final String LOWPAN_SERVICE_CLASS =
|
||||
"com.android.server.lowpan.LowpanService";
|
||||
private static final String ETHERNET_SERVICE_CLASS =
|
||||
"com.android.server.ethernet.EthernetService";
|
||||
private static final String JOB_SCHEDULER_SERVICE_CLASS =
|
||||
"com.android.server.job.JobSchedulerService";
|
||||
private static final String LOCK_SETTINGS_SERVICE_CLASS =
|
||||
@ -1995,13 +1993,6 @@ public final class SystemServer implements Dumpable {
|
||||
t.traceEnd();
|
||||
}
|
||||
|
||||
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET) ||
|
||||
mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)) {
|
||||
t.traceBegin("StartEthernet");
|
||||
mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS);
|
||||
t.traceEnd();
|
||||
}
|
||||
|
||||
t.traceBegin("StartPacProxyService");
|
||||
try {
|
||||
pacProxyService = new PacProxyService(context);
|
||||
|
Loading…
x
Reference in New Issue
Block a user