diff options
| author | Xiao Ma <xiaom@google.com> | 2021-12-16 15:14:34 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-12-16 15:14:34 +0000 |
| commit | 5266f9e9d667f23b65b51dfcebaef210ef3c5ff7 (patch) | |
| tree | cd48da0a7f24eae9684440aa2846145e5da6ea34 | |
| parent | b1b2a5ebd3c99a655005e1213a533d8b37731fc1 (diff) | |
| parent | 9a735b3dd095ec3e496d23b98855a3ff17eafca8 (diff) | |
Merge "Move Ethernet related files to f/b/packages/ConnectivityT." am: 84f212ded1 am: 3190e7cc92 am: 9a735b3dd0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1922218
Change-Id: I36c9dea2d0026357c2292cf67d1a45424adeaf12
| -rw-r--r-- | framework-t/Sources.bp | 18 | ||||
| -rw-r--r-- | framework-t/src/android/net/EthernetManager.java (renamed from core/java/android/net/EthernetManager.java) | 0 | ||||
| -rw-r--r-- | framework-t/src/android/net/EthernetNetworkSpecifier.java (renamed from core/java/android/net/EthernetNetworkSpecifier.java) | 0 | ||||
| -rw-r--r-- | framework-t/src/android/net/IEthernetManager.aidl (renamed from core/java/android/net/IEthernetManager.aidl) | 0 | ||||
| -rw-r--r-- | framework-t/src/android/net/IEthernetServiceListener.aidl (renamed from core/java/android/net/IEthernetServiceListener.aidl) | 0 | ||||
| -rw-r--r-- | framework-t/src/android/net/ITetheredInterfaceCallback.aidl (renamed from core/java/android/net/ITetheredInterfaceCallback.aidl) | 0 | ||||
| -rw-r--r-- | service-t/Sources.bp | 14 | ||||
| -rw-r--r-- | service-t/src/com/android/server/net/IpConfigStore.java (renamed from services/core/java/com/android/server/net/IpConfigStore.java) | 32 |
8 files changed, 54 insertions, 10 deletions
diff --git a/framework-t/Sources.bp b/framework-t/Sources.bp index 931a55b27d..0bda923f23 100644 --- a/framework-t/Sources.bp +++ b/framework-t/Sources.bp @@ -114,6 +114,23 @@ filegroup { ], } +// Ethernet related libraries. + +filegroup { + name: "framework-connectivity-ethernet-sources", + srcs: [ + "src/android/net/EthernetManager.java", + "src/android/net/EthernetNetworkSpecifier.java", + "src/android/net/IEthernetManager.aidl", + "src/android/net/IEthernetServiceListener.aidl", + "src/android/net/ITetheredInterfaceCallback.aidl", + ], + path: "src", + visibility: [ + "//visibility:private", + ], +} + // Connectivity-T common libraries. filegroup { @@ -130,6 +147,7 @@ filegroup { filegroup { name: "framework-connectivity-tiramisu-sources", srcs: [ + ":framework-connectivity-ethernet-sources", ":framework-connectivity-ipsec-sources", ":framework-connectivity-netstats-sources", ":framework-connectivity-nsd-sources", diff --git a/core/java/android/net/EthernetManager.java b/framework-t/src/android/net/EthernetManager.java index 7cd63ef9cc..7cd63ef9cc 100644 --- a/core/java/android/net/EthernetManager.java +++ b/framework-t/src/android/net/EthernetManager.java diff --git a/core/java/android/net/EthernetNetworkSpecifier.java b/framework-t/src/android/net/EthernetNetworkSpecifier.java index 62c5761442..62c5761442 100644 --- a/core/java/android/net/EthernetNetworkSpecifier.java +++ b/framework-t/src/android/net/EthernetNetworkSpecifier.java diff --git a/core/java/android/net/IEthernetManager.aidl b/framework-t/src/android/net/IEthernetManager.aidl index e058e5a70c..e058e5a70c 100644 --- a/core/java/android/net/IEthernetManager.aidl +++ b/framework-t/src/android/net/IEthernetManager.aidl diff --git a/core/java/android/net/IEthernetServiceListener.aidl b/framework-t/src/android/net/IEthernetServiceListener.aidl index 782fa19d9d..782fa19d9d 100644 --- a/core/java/android/net/IEthernetServiceListener.aidl +++ b/framework-t/src/android/net/IEthernetServiceListener.aidl diff --git a/core/java/android/net/ITetheredInterfaceCallback.aidl b/framework-t/src/android/net/ITetheredInterfaceCallback.aidl index 14aa0237f2..14aa0237f2 100644 --- a/core/java/android/net/ITetheredInterfaceCallback.aidl +++ b/framework-t/src/android/net/ITetheredInterfaceCallback.aidl diff --git a/service-t/Sources.bp b/service-t/Sources.bp index 7b8817692b..97dfb64b33 100644 --- a/service-t/Sources.bp +++ b/service-t/Sources.bp @@ -61,11 +61,25 @@ filegroup { ], } +// Ethernet related libraries. + +filegroup { + name: "services.connectivity-ethernet-sources", + srcs: [ + "src/com/android/server/net/IpConfigStore.java", + ], + path: "src", + visibility: [ + "//frameworks/opt/net/ethernet", + ], +} + // Connectivity-T common libraries. filegroup { name: "services.connectivity-tiramisu-sources", srcs: [ + ":services.connectivity-ethernet-sources", ":services.connectivity-ipsec-sources", ":services.connectivity-netstats-sources", ":services.connectivity-nsd-sources", diff --git a/services/core/java/com/android/server/net/IpConfigStore.java b/service-t/src/com/android/server/net/IpConfigStore.java index d17dbde496..3a9a544155 100644 --- a/services/core/java/com/android/server/net/IpConfigStore.java +++ b/service-t/src/com/android/server/net/IpConfigStore.java @@ -44,6 +44,9 @@ import java.net.InetAddress; import java.util.ArrayList; import java.util.List; +/** + * This class provides an API to store and manage L3 network IP configuration. + */ public class IpConfigStore { private static final String TAG = "IpConfigStore"; private static final boolean DBG = false; @@ -78,6 +81,9 @@ public class IpConfigStore { return writeConfig(out, configKey, config, IPCONFIG_FILE_VERSION); } + /** + * Write the IP configuration with the given parameters to {@link DataOutputStream}. + */ @VisibleForTesting public static boolean writeConfig(DataOutputStream out, String configKey, IpConfiguration config, int version) throws IOException { @@ -154,10 +160,10 @@ public class IpConfigStore { break; case UNASSIGNED: /* Ignore */ - break; - default: - loge("Ignore invalid proxy settings while writing"); - break; + break; + default: + loge("Ignore invalid proxy settings while writing"); + break; } if (written) { @@ -177,7 +183,7 @@ public class IpConfigStore { } /** - * @Deprecated use {@link #writeIpConfigurations(String, ArrayMap)} instead. + * @deprecated use {@link #writeIpConfigurations(String, ArrayMap)} instead. * New method uses string as network identifier which could be interface name or MAC address or * other token. */ @@ -186,22 +192,28 @@ public class IpConfigStore { final SparseArray<IpConfiguration> networks) { mWriter.write(filePath, out -> { out.writeInt(IPCONFIG_FILE_VERSION); - for(int i = 0; i < networks.size(); i++) { + for (int i = 0; i < networks.size(); i++) { writeConfig(out, String.valueOf(networks.keyAt(i)), networks.valueAt(i)); } }); } + /** + * Write the IP configuration associated to the target networks to the destination path. + */ public void writeIpConfigurations(String filePath, ArrayMap<String, IpConfiguration> networks) { mWriter.write(filePath, out -> { out.writeInt(IPCONFIG_FILE_VERSION); - for(int i = 0; i < networks.size(); i++) { + for (int i = 0; i < networks.size(); i++) { writeConfig(out, networks.keyAt(i), networks.valueAt(i)); } }); } + /** + * Read the IP configuration from the destination path to {@link BufferedInputStream}. + */ public static ArrayMap<String, IpConfiguration> readIpConfigurations(String filePath) { BufferedInputStream bufferedInputStream; try { @@ -215,7 +227,7 @@ public class IpConfigStore { return readIpConfigurations(bufferedInputStream); } - /** @Deprecated use {@link #readIpConfigurations(String)} */ + /** @deprecated use {@link #readIpConfigurations(String)} */ @Deprecated public static SparseArray<IpConfiguration> readIpAndProxyConfigurations(String filePath) { BufferedInputStream bufferedInputStream; @@ -230,7 +242,7 @@ public class IpConfigStore { return readIpAndProxyConfigurations(bufferedInputStream); } - /** @Deprecated use {@link #readIpConfigurations(InputStream)} */ + /** @deprecated use {@link #readIpConfigurations(InputStream)} */ @Deprecated public static SparseArray<IpConfiguration> readIpAndProxyConfigurations( InputStream inputStream) { @@ -420,7 +432,7 @@ public class IpConfigStore { if (in != null) { try { in.close(); - } catch (Exception e) {} + } catch (Exception e) { } } } |
