Loading common/moduleutils/src/android/net/shared/ProvisioningConfiguration.java +46 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.net.ScanResultInfoParcelable; import android.net.StaticIpConfiguration; import android.net.apf.ApfCapabilities; import android.net.ip.IIpClient; import android.net.networkstack.aidl.dhcp.DhcpOption; import android.util.Log; import java.nio.BufferUnderflowException; Loading Loading @@ -226,6 +227,17 @@ public class ProvisioningConfiguration { return this; } /** * Specify the customized DHCP options to be put in the PRL or in the DHCP packet. Options * with null value will be put in the PRL. * * @param: options customized DHCP option stable parcelable list. */ public Builder withDhcpOptions(List<DhcpOption> options) { mConfig.mDhcpOptions = options; return this; } /** * Build the configuration using previously specified parameters. */ Loading Loading @@ -430,6 +442,7 @@ public class ProvisioningConfiguration { public String mDisplayName = null; public ScanResultInfo mScanResultInfo; public Layer2Information mLayer2Info; public List<DhcpOption> mDhcpOptions; public ProvisioningConfiguration() {} // used by Builder Loading @@ -451,6 +464,7 @@ public class ProvisioningConfiguration { mDisplayName = other.mDisplayName; mScanResultInfo = other.mScanResultInfo; mLayer2Info = other.mLayer2Info; mDhcpOptions = other.mDhcpOptions; } /** Loading @@ -464,8 +478,8 @@ public class ProvisioningConfiguration { p.usingMultinetworkPolicyTracker = mUsingMultinetworkPolicyTracker; p.usingIpReachabilityMonitor = mUsingIpReachabilityMonitor; p.requestedPreDhcpActionMs = mRequestedPreDhcpActionMs; p.initialConfig = mInitialConfig == null ? null : mInitialConfig.toStableParcelable(); p.staticIpConfig = mStaticIpConfig == null p.initialConfig = (mInitialConfig == null) ? null : mInitialConfig.toStableParcelable(); p.staticIpConfig = (mStaticIpConfig == null) ? null : new StaticIpConfiguration(mStaticIpConfig); p.apfCapabilities = mApfCapabilities; // ApfCapabilities is immutable Loading @@ -473,8 +487,9 @@ public class ProvisioningConfiguration { p.ipv6AddrGenMode = mIPv6AddrGenMode; p.network = mNetwork; p.displayName = mDisplayName; p.scanResultInfo = mScanResultInfo == null ? null : mScanResultInfo.toStableParcelable(); p.layer2Info = mLayer2Info == null ? null : mLayer2Info.toStableParcelable(); p.scanResultInfo = (mScanResultInfo == null) ? null : mScanResultInfo.toStableParcelable(); p.layer2Info = (mLayer2Info == null) ? null : mLayer2Info.toStableParcelable(); p.options = (mDhcpOptions == null) ? null : new ArrayList<>(mDhcpOptions); return p; } Loading @@ -492,7 +507,7 @@ public class ProvisioningConfiguration { config.mUsingIpReachabilityMonitor = p.usingIpReachabilityMonitor; config.mRequestedPreDhcpActionMs = p.requestedPreDhcpActionMs; config.mInitialConfig = InitialConfiguration.fromStableParcelable(p.initialConfig); config.mStaticIpConfig = p.staticIpConfig == null config.mStaticIpConfig = (p.staticIpConfig == null) ? null : new StaticIpConfiguration(p.staticIpConfig); config.mApfCapabilities = p.apfCapabilities; // ApfCapabilities is immutable Loading @@ -502,6 +517,7 @@ public class ProvisioningConfiguration { config.mDisplayName = p.displayName; config.mScanResultInfo = ScanResultInfo.fromStableParcelable(p.scanResultInfo); config.mLayer2Info = Layer2Information.fromStableParcelable(p.layer2Info); config.mDhcpOptions = (p.options == null) ? null : new ArrayList<>(p.options); return config; } Loading @@ -523,9 +539,32 @@ public class ProvisioningConfiguration { .add("mDisplayName: " + mDisplayName) .add("mScanResultInfo: " + mScanResultInfo) .add("mLayer2Info: " + mLayer2Info) .add("mDhcpOptions: " + mDhcpOptions) .toString(); } // TODO: mark DhcpOption stable parcelable with @JavaDerive(equals=true, toString=true) // and @JavaOnlyImmutable. private static boolean dhcpOptionEquals(@Nullable DhcpOption obj1, @Nullable DhcpOption obj2) { if (obj1 == obj2) return true; if (obj1 == null || obj2 == null) return false; return obj1.type == obj2.type && Arrays.equals(obj1.value, obj2.value); } // TODO: use Objects.equals(List<DhcpOption>, List<DhcpOption>) method instead once // auto-generated equals() method of stable parcelable is supported in mainline-prod. private static boolean dhcpOptionListEquals(@Nullable List<DhcpOption> l1, @Nullable List<DhcpOption> l2) { if (l1 == l2) return true; if (l1 == null || l2 == null) return false; if (l1.size() != l2.size()) return false; for (int i = 0; i < l1.size(); i++) { if (!dhcpOptionEquals(l1.get(i), l2.get(i))) return false; } return true; } @Override public boolean equals(Object obj) { if (!(obj instanceof ProvisioningConfiguration)) return false; Loading @@ -544,7 +583,8 @@ public class ProvisioningConfiguration { && Objects.equals(mNetwork, other.mNetwork) && Objects.equals(mDisplayName, other.mDisplayName) && Objects.equals(mScanResultInfo, other.mScanResultInfo) && Objects.equals(mLayer2Info, other.mLayer2Info); && Objects.equals(mLayer2Info, other.mLayer2Info) && dhcpOptionListEquals(mDhcpOptions, other.mDhcpOptions); } public boolean isValid() { Loading common/networkstackclient/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ aidl_interface { "src/android/net/ip/IIpClientCallbacks.aidl", // New AIDL classes should go into android.net.networkstack.aidl so they can be clearly // identified "src/android/net/networkstack/aidl/dhcp/DhcpOption.aidl", ], backend: { java: { Loading Loading @@ -124,6 +125,7 @@ aidl_interface { "7", "8", "9", "10", ], // TODO: have tethering depend on networkstack-client and set visibility to private visibility: [ Loading common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/.hash 0 → 100644 +1 −0 Original line number Diff line number Diff line 4925f4fdbb270e4f35cc5519a15ed8dd8c69a549 common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DataStallReportParcelable.aidl 0 → 100644 +27 −0 Original line number Diff line number Diff line /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// // This file is a snapshot of an AIDL file. Do not edit it manually. There are // two cases: // 1). this is a frozen version file - do not edit this in any case. // 2). this is a 'current' file. If you make a backwards compatible change to // the interface (from the latest frozen version), the build system will // prompt you to update this file with `m <name>-update-api`. // // You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped // with such a backward incompatible change, it has a high risk of breaking // later when a module using the interface is updated, e.g., Mainline modules. package android.net; @JavaDerive(toString=true) parcelable DataStallReportParcelable { long timestampMillis = 0; int detectionMethod = 1; int tcpPacketFailRate = 2; int tcpMetricsCollectionPeriodMillis = 3; int dnsConsecutiveTimeouts = 4; } common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DhcpResultsParcelable.aidl 0 → 100644 +29 −0 Original line number Diff line number Diff line /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// // This file is a snapshot of an AIDL file. Do not edit it manually. There are // two cases: // 1). this is a frozen version file - do not edit this in any case. // 2). this is a 'current' file. If you make a backwards compatible change to // the interface (from the latest frozen version), the build system will // prompt you to update this file with `m <name>-update-api`. // // You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped // with such a backward incompatible change, it has a high risk of breaking // later when a module using the interface is updated, e.g., Mainline modules. package android.net; @JavaDerive(toString=true) parcelable DhcpResultsParcelable { android.net.StaticIpConfiguration baseConfiguration; int leaseDuration; int mtu; String serverAddress; String vendorInfo; @nullable String serverHostName; @nullable String captivePortalApiUrl; } Loading
common/moduleutils/src/android/net/shared/ProvisioningConfiguration.java +46 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.net.ScanResultInfoParcelable; import android.net.StaticIpConfiguration; import android.net.apf.ApfCapabilities; import android.net.ip.IIpClient; import android.net.networkstack.aidl.dhcp.DhcpOption; import android.util.Log; import java.nio.BufferUnderflowException; Loading Loading @@ -226,6 +227,17 @@ public class ProvisioningConfiguration { return this; } /** * Specify the customized DHCP options to be put in the PRL or in the DHCP packet. Options * with null value will be put in the PRL. * * @param: options customized DHCP option stable parcelable list. */ public Builder withDhcpOptions(List<DhcpOption> options) { mConfig.mDhcpOptions = options; return this; } /** * Build the configuration using previously specified parameters. */ Loading Loading @@ -430,6 +442,7 @@ public class ProvisioningConfiguration { public String mDisplayName = null; public ScanResultInfo mScanResultInfo; public Layer2Information mLayer2Info; public List<DhcpOption> mDhcpOptions; public ProvisioningConfiguration() {} // used by Builder Loading @@ -451,6 +464,7 @@ public class ProvisioningConfiguration { mDisplayName = other.mDisplayName; mScanResultInfo = other.mScanResultInfo; mLayer2Info = other.mLayer2Info; mDhcpOptions = other.mDhcpOptions; } /** Loading @@ -464,8 +478,8 @@ public class ProvisioningConfiguration { p.usingMultinetworkPolicyTracker = mUsingMultinetworkPolicyTracker; p.usingIpReachabilityMonitor = mUsingIpReachabilityMonitor; p.requestedPreDhcpActionMs = mRequestedPreDhcpActionMs; p.initialConfig = mInitialConfig == null ? null : mInitialConfig.toStableParcelable(); p.staticIpConfig = mStaticIpConfig == null p.initialConfig = (mInitialConfig == null) ? null : mInitialConfig.toStableParcelable(); p.staticIpConfig = (mStaticIpConfig == null) ? null : new StaticIpConfiguration(mStaticIpConfig); p.apfCapabilities = mApfCapabilities; // ApfCapabilities is immutable Loading @@ -473,8 +487,9 @@ public class ProvisioningConfiguration { p.ipv6AddrGenMode = mIPv6AddrGenMode; p.network = mNetwork; p.displayName = mDisplayName; p.scanResultInfo = mScanResultInfo == null ? null : mScanResultInfo.toStableParcelable(); p.layer2Info = mLayer2Info == null ? null : mLayer2Info.toStableParcelable(); p.scanResultInfo = (mScanResultInfo == null) ? null : mScanResultInfo.toStableParcelable(); p.layer2Info = (mLayer2Info == null) ? null : mLayer2Info.toStableParcelable(); p.options = (mDhcpOptions == null) ? null : new ArrayList<>(mDhcpOptions); return p; } Loading @@ -492,7 +507,7 @@ public class ProvisioningConfiguration { config.mUsingIpReachabilityMonitor = p.usingIpReachabilityMonitor; config.mRequestedPreDhcpActionMs = p.requestedPreDhcpActionMs; config.mInitialConfig = InitialConfiguration.fromStableParcelable(p.initialConfig); config.mStaticIpConfig = p.staticIpConfig == null config.mStaticIpConfig = (p.staticIpConfig == null) ? null : new StaticIpConfiguration(p.staticIpConfig); config.mApfCapabilities = p.apfCapabilities; // ApfCapabilities is immutable Loading @@ -502,6 +517,7 @@ public class ProvisioningConfiguration { config.mDisplayName = p.displayName; config.mScanResultInfo = ScanResultInfo.fromStableParcelable(p.scanResultInfo); config.mLayer2Info = Layer2Information.fromStableParcelable(p.layer2Info); config.mDhcpOptions = (p.options == null) ? null : new ArrayList<>(p.options); return config; } Loading @@ -523,9 +539,32 @@ public class ProvisioningConfiguration { .add("mDisplayName: " + mDisplayName) .add("mScanResultInfo: " + mScanResultInfo) .add("mLayer2Info: " + mLayer2Info) .add("mDhcpOptions: " + mDhcpOptions) .toString(); } // TODO: mark DhcpOption stable parcelable with @JavaDerive(equals=true, toString=true) // and @JavaOnlyImmutable. private static boolean dhcpOptionEquals(@Nullable DhcpOption obj1, @Nullable DhcpOption obj2) { if (obj1 == obj2) return true; if (obj1 == null || obj2 == null) return false; return obj1.type == obj2.type && Arrays.equals(obj1.value, obj2.value); } // TODO: use Objects.equals(List<DhcpOption>, List<DhcpOption>) method instead once // auto-generated equals() method of stable parcelable is supported in mainline-prod. private static boolean dhcpOptionListEquals(@Nullable List<DhcpOption> l1, @Nullable List<DhcpOption> l2) { if (l1 == l2) return true; if (l1 == null || l2 == null) return false; if (l1.size() != l2.size()) return false; for (int i = 0; i < l1.size(); i++) { if (!dhcpOptionEquals(l1.get(i), l2.get(i))) return false; } return true; } @Override public boolean equals(Object obj) { if (!(obj instanceof ProvisioningConfiguration)) return false; Loading @@ -544,7 +583,8 @@ public class ProvisioningConfiguration { && Objects.equals(mNetwork, other.mNetwork) && Objects.equals(mDisplayName, other.mDisplayName) && Objects.equals(mScanResultInfo, other.mScanResultInfo) && Objects.equals(mLayer2Info, other.mLayer2Info); && Objects.equals(mLayer2Info, other.mLayer2Info) && dhcpOptionListEquals(mDhcpOptions, other.mDhcpOptions); } public boolean isValid() { Loading
common/networkstackclient/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ aidl_interface { "src/android/net/ip/IIpClientCallbacks.aidl", // New AIDL classes should go into android.net.networkstack.aidl so they can be clearly // identified "src/android/net/networkstack/aidl/dhcp/DhcpOption.aidl", ], backend: { java: { Loading Loading @@ -124,6 +125,7 @@ aidl_interface { "7", "8", "9", "10", ], // TODO: have tethering depend on networkstack-client and set visibility to private visibility: [ Loading
common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/.hash 0 → 100644 +1 −0 Original line number Diff line number Diff line 4925f4fdbb270e4f35cc5519a15ed8dd8c69a549
common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DataStallReportParcelable.aidl 0 → 100644 +27 −0 Original line number Diff line number Diff line /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// // This file is a snapshot of an AIDL file. Do not edit it manually. There are // two cases: // 1). this is a frozen version file - do not edit this in any case. // 2). this is a 'current' file. If you make a backwards compatible change to // the interface (from the latest frozen version), the build system will // prompt you to update this file with `m <name>-update-api`. // // You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped // with such a backward incompatible change, it has a high risk of breaking // later when a module using the interface is updated, e.g., Mainline modules. package android.net; @JavaDerive(toString=true) parcelable DataStallReportParcelable { long timestampMillis = 0; int detectionMethod = 1; int tcpPacketFailRate = 2; int tcpMetricsCollectionPeriodMillis = 3; int dnsConsecutiveTimeouts = 4; }
common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DhcpResultsParcelable.aidl 0 → 100644 +29 −0 Original line number Diff line number Diff line /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// // This file is a snapshot of an AIDL file. Do not edit it manually. There are // two cases: // 1). this is a frozen version file - do not edit this in any case. // 2). this is a 'current' file. If you make a backwards compatible change to // the interface (from the latest frozen version), the build system will // prompt you to update this file with `m <name>-update-api`. // // You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped // with such a backward incompatible change, it has a high risk of breaking // later when a module using the interface is updated, e.g., Mainline modules. package android.net; @JavaDerive(toString=true) parcelable DhcpResultsParcelable { android.net.StaticIpConfiguration baseConfiguration; int leaseDuration; int mtu; String serverAddress; String vendorInfo; @nullable String serverHostName; @nullable String captivePortalApiUrl; }