Add additional SystemApi for NetworkStack
Members in this CL were missed in earlier changes. Test: m Bug: 112869080 Change-Id: I8b5b80ea7b267357eb0387d504a2f78358d6d502
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Pair;
|
||||
@@ -83,6 +85,8 @@ public final class IpPrefix implements Parcelable {
|
||||
* @param prefixLength the prefix length. Must be >= 0 and <= (32 or 128) (IPv4 or IPv6).
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public IpPrefix(InetAddress address, int prefixLength) {
|
||||
// We don't reuse the (byte[], int) constructor because it calls clone() on the byte array,
|
||||
// which is unnecessary because getAddress() already returns a clone.
|
||||
|
||||
@@ -162,6 +162,8 @@ public class LinkAddress implements Parcelable {
|
||||
* {@link OsConstants#RT_SCOPE_LINK} or {@link OsConstants#RT_SCOPE_SITE}).
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public LinkAddress(InetAddress address, int prefixLength, int flags, int scope) {
|
||||
init(address, prefixLength, flags, scope);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,8 @@ public final class LinkProperties implements Parcelable {
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public LinkProperties(LinkProperties source) {
|
||||
if (source != null) {
|
||||
mIfaceName = source.mIfaceName;
|
||||
@@ -576,6 +577,8 @@ public final class LinkProperties implements Parcelable {
|
||||
* @param addresses The {@link Collection} of PCSCF servers to set in this object.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public void setPcscfServers(Collection<InetAddress> pcscfServers) {
|
||||
mPcscfs.clear();
|
||||
for (InetAddress pcscfServer: pcscfServers) {
|
||||
@@ -590,6 +593,8 @@ public final class LinkProperties implements Parcelable {
|
||||
* this link.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public List<InetAddress> getPcscfServers() {
|
||||
return Collections.unmodifiableList(mPcscfs);
|
||||
}
|
||||
@@ -781,6 +786,8 @@ public final class LinkProperties implements Parcelable {
|
||||
* @return the NAT64 prefix.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public @Nullable IpPrefix getNat64Prefix() {
|
||||
return mNat64Prefix;
|
||||
}
|
||||
@@ -794,6 +801,8 @@ public final class LinkProperties implements Parcelable {
|
||||
* @param prefix the NAT64 prefix.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public void setNat64Prefix(IpPrefix prefix) {
|
||||
if (prefix != null && prefix.getPrefixLength() != 96) {
|
||||
throw new IllegalArgumentException("Only 96-bit prefixes are supported: " + prefix);
|
||||
|
||||
@@ -110,6 +110,8 @@ public final class RouteInfo implements Parcelable {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public RouteInfo(IpPrefix destination, InetAddress gateway, String iface, int type) {
|
||||
switch (type) {
|
||||
case RTN_UNICAST:
|
||||
|
||||
@@ -18,7 +18,6 @@ package android.net.metrics;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.net.ConnectivityMetricsEvent;
|
||||
import android.net.IIpConnectivityMetrics;
|
||||
import android.net.Network;
|
||||
@@ -51,7 +50,8 @@ public class IpConnectivityLog {
|
||||
public interface Event extends Parcelable {}
|
||||
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public IpConnectivityLog() {
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package android.net.metrics;
|
||||
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -24,19 +25,28 @@ import android.os.Parcelable;
|
||||
* An event logged when the APF packet socket receives an RA packet.
|
||||
* {@hide}
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public final class RaEvent implements IpConnectivityLog.Event {
|
||||
|
||||
public static final long NO_LIFETIME = -1L;
|
||||
private static final long NO_LIFETIME = -1L;
|
||||
|
||||
// Lifetime in seconds of options found in a single RA packet.
|
||||
// When an option is not set, the value of the associated field is -1;
|
||||
/** @hide */
|
||||
public final long routerLifetime;
|
||||
/** @hide */
|
||||
public final long prefixValidLifetime;
|
||||
/** @hide */
|
||||
public final long prefixPreferredLifetime;
|
||||
/** @hide */
|
||||
public final long routeInfoLifetime;
|
||||
/** @hide */
|
||||
public final long rdnssLifetime;
|
||||
/** @hide */
|
||||
public final long dnsslLifetime;
|
||||
|
||||
/** @hide */
|
||||
public RaEvent(long routerLifetime, long prefixValidLifetime, long prefixPreferredLifetime,
|
||||
long routeInfoLifetime, long rdnssLifetime, long dnsslLifetime) {
|
||||
this.routerLifetime = routerLifetime;
|
||||
@@ -47,6 +57,7 @@ public final class RaEvent implements IpConnectivityLog.Event {
|
||||
this.dnsslLifetime = dnsslLifetime;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
private RaEvent(Parcel in) {
|
||||
routerLifetime = in.readLong();
|
||||
prefixValidLifetime = in.readLong();
|
||||
@@ -56,6 +67,7 @@ public final class RaEvent implements IpConnectivityLog.Event {
|
||||
dnsslLifetime = in.readLong();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeLong(routerLifetime);
|
||||
@@ -66,6 +78,7 @@ public final class RaEvent implements IpConnectivityLog.Event {
|
||||
out.writeLong(dnsslLifetime);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -83,6 +96,7 @@ public final class RaEvent implements IpConnectivityLog.Event {
|
||||
.toString();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static final Parcelable.Creator<RaEvent> CREATOR = new Parcelable.Creator<RaEvent>() {
|
||||
public RaEvent createFromParcel(Parcel in) {
|
||||
return new RaEvent(in);
|
||||
@@ -102,47 +116,39 @@ public final class RaEvent implements IpConnectivityLog.Event {
|
||||
long rdnssLifetime = NO_LIFETIME;
|
||||
long dnsslLifetime = NO_LIFETIME;
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public RaEvent build() {
|
||||
return new RaEvent(routerLifetime, prefixValidLifetime, prefixPreferredLifetime,
|
||||
routeInfoLifetime, rdnssLifetime, dnsslLifetime);
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Builder updateRouterLifetime(long lifetime) {
|
||||
routerLifetime = updateLifetime(routerLifetime, lifetime);
|
||||
return this;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Builder updatePrefixValidLifetime(long lifetime) {
|
||||
prefixValidLifetime = updateLifetime(prefixValidLifetime, lifetime);
|
||||
return this;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Builder updatePrefixPreferredLifetime(long lifetime) {
|
||||
prefixPreferredLifetime = updateLifetime(prefixPreferredLifetime, lifetime);
|
||||
return this;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Builder updateRouteInfoLifetime(long lifetime) {
|
||||
routeInfoLifetime = updateLifetime(routeInfoLifetime, lifetime);
|
||||
return this;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Builder updateRdnssLifetime(long lifetime) {
|
||||
rdnssLifetime = updateLifetime(rdnssLifetime, lifetime);
|
||||
return this;
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
public Builder updateDnsslLifetime(long lifetime) {
|
||||
dnsslLifetime = updateLifetime(dnsslLifetime, lifetime);
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user