Add CaptivePortalApiUrl to DhcpResults
The URL will be used by DhcpClient to return it in its results. It will not be parceled in DhcpResultsParcelable, but instead sent through LinkProperties to network agents. Bug: 139269711 Test: atest NetworkStackTests with associated NetworkStack change Change-Id: I4ec9e7f5efece3ede9b0da5eb1b75d8d43b94ba9
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.net.shared.InetAddressUtils;
|
||||
import android.os.Parcel;
|
||||
@@ -66,6 +67,9 @@ public final class DhcpResults implements Parcelable {
|
||||
|
||||
public String serverHostName;
|
||||
|
||||
@Nullable
|
||||
public String captivePortalApiUrl;
|
||||
|
||||
public DhcpResults() {
|
||||
super();
|
||||
}
|
||||
@@ -100,6 +104,7 @@ public final class DhcpResults implements Parcelable {
|
||||
leaseDuration = source.leaseDuration;
|
||||
mtu = source.mtu;
|
||||
serverHostName = source.serverHostName;
|
||||
captivePortalApiUrl = source.captivePortalApiUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +138,7 @@ public final class DhcpResults implements Parcelable {
|
||||
leaseDuration = 0;
|
||||
mtu = 0;
|
||||
serverHostName = null;
|
||||
captivePortalApiUrl = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,6 +150,9 @@ public final class DhcpResults implements Parcelable {
|
||||
str.append(" lease ").append(leaseDuration).append(" seconds");
|
||||
if (mtu != 0) str.append(" MTU ").append(mtu);
|
||||
str.append(" Servername ").append(serverHostName);
|
||||
if (captivePortalApiUrl != null) {
|
||||
str.append(" CaptivePortalApiUrl ").append(captivePortalApiUrl);
|
||||
}
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
@@ -161,7 +170,8 @@ public final class DhcpResults implements Parcelable {
|
||||
&& Objects.equals(vendorInfo, target.vendorInfo)
|
||||
&& Objects.equals(serverHostName, target.serverHostName)
|
||||
&& leaseDuration == target.leaseDuration
|
||||
&& mtu == target.mtu;
|
||||
&& mtu == target.mtu
|
||||
&& Objects.equals(captivePortalApiUrl, target.captivePortalApiUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,6 +196,7 @@ public final class DhcpResults implements Parcelable {
|
||||
InetAddressUtils.parcelInetAddress(dest, serverAddress, flags);
|
||||
dest.writeString(vendorInfo);
|
||||
dest.writeString(serverHostName);
|
||||
dest.writeString(captivePortalApiUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -201,6 +212,7 @@ public final class DhcpResults implements Parcelable {
|
||||
dhcpResults.serverAddress = (Inet4Address) InetAddressUtils.unparcelInetAddress(in);
|
||||
dhcpResults.vendorInfo = in.readString();
|
||||
dhcpResults.serverHostName = in.readString();
|
||||
dhcpResults.captivePortalApiUrl = in.readString();
|
||||
return dhcpResults;
|
||||
}
|
||||
|
||||
@@ -305,4 +317,12 @@ public final class DhcpResults implements Parcelable {
|
||||
public void setMtu(int mtu) {
|
||||
this.mtu = mtu;
|
||||
}
|
||||
|
||||
public String getCaptivePortalApiUrl() {
|
||||
return captivePortalApiUrl;
|
||||
}
|
||||
|
||||
public void setCaptivePortalApiUrl(String url) {
|
||||
captivePortalApiUrl = url;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user