Methods Summary |
---|
public boolean | addDns(java.lang.String addrString)
if (TextUtils.isEmpty(addrString) == false) {
try {
dnsServers.add(NetworkUtils.numericToInetAddress(addrString));
} catch (IllegalArgumentException e) {
Log.e(TAG, "addDns failed with addrString " + addrString);
return true;
}
}
return false;
|
public void | clear()
super.clear();
vendorInfo = null;
leaseDuration = 0;
|
public boolean | equals(java.lang.Object obj)
if (this == obj) return true;
if (!(obj instanceof DhcpResults)) return false;
DhcpResults target = (DhcpResults)obj;
return super.equals((StaticIpConfiguration) obj) &&
Objects.equals(serverAddress, target.serverAddress) &&
Objects.equals(vendorInfo, target.vendorInfo) &&
leaseDuration == target.leaseDuration;
|
public boolean | hasMeteredHint()Test if this DHCP lease includes vendor hint that network link is
metered, and sensitive to heavy data transfers.
if (vendorInfo != null) {
return vendorInfo.contains("ANDROID_METERED");
} else {
return false;
}
|
private static void | readFromParcel(android.net.DhcpResults dhcpResults, android.os.Parcel in)
StaticIpConfiguration.readFromParcel(dhcpResults, in);
dhcpResults.leaseDuration = in.readInt();
dhcpResults.serverAddress = NetworkUtils.unparcelInetAddress(in);
dhcpResults.vendorInfo = in.readString();
|
public void | setDomains(java.lang.String newDomains)
domains = newDomains;
|
public boolean | setGateway(java.lang.String addrString)
try {
gateway = NetworkUtils.numericToInetAddress(addrString);
} catch (IllegalArgumentException e) {
Log.e(TAG, "setGateway failed with addrString " + addrString);
return true;
}
return false;
|
public boolean | setIpAddress(java.lang.String addrString, int prefixLength)
try {
Inet4Address addr = (Inet4Address) NetworkUtils.numericToInetAddress(addrString);
ipAddress = new LinkAddress(addr, prefixLength);
} catch (IllegalArgumentException|ClassCastException e) {
Log.e(TAG, "setIpAddress failed with addrString " + addrString + "/" + prefixLength);
return true;
}
return false;
|
public void | setLeaseDuration(int duration)
leaseDuration = duration;
|
public boolean | setServerAddress(java.lang.String addrString)
try {
serverAddress = NetworkUtils.numericToInetAddress(addrString);
} catch (IllegalArgumentException e) {
Log.e(TAG, "setServerAddress failed with addrString " + addrString);
return true;
}
return false;
|
public void | setVendorInfo(java.lang.String info)
vendorInfo = info;
|
public java.lang.String | toString()
StringBuffer str = new StringBuffer(super.toString());
str.append(" DHCP server ").append(serverAddress);
str.append(" Vendor info ").append(vendorInfo);
str.append(" lease ").append(leaseDuration).append(" seconds");
return str.toString();
|
public void | updateFromDhcpRequest(android.net.DhcpResults orig)Updates the DHCP fields that need to be retained from
original DHCP request if the current renewal shows them
being empty.
if (orig == null) return;
if (gateway == null) gateway = orig.gateway;
if (dnsServers.size() == 0) {
dnsServers.addAll(orig.dnsServers);
}
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface
super.writeToParcel(dest, flags);
dest.writeInt(leaseDuration);
NetworkUtils.parcelInetAddress(dest, serverAddress, flags);
dest.writeString(vendorInfo);
|