Merge "Add additional SystemApi for NetworkStack"

This commit is contained in:
Remi NGUYEN VAN
2019-01-24 09:55:01 +00:00
committed by Gerrit Code Review
4 changed files with 18 additions and 1 deletions

View File

@@ -16,6 +16,8 @@
package android.net; package android.net;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.util.Pair; 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). * @param prefixLength the prefix length. Must be >= 0 and <= (32 or 128) (IPv4 or IPv6).
* @hide * @hide
*/ */
@SystemApi
@TestApi
public IpPrefix(InetAddress address, int prefixLength) { public IpPrefix(InetAddress address, int prefixLength) {
// We don't reuse the (byte[], int) constructor because it calls clone() on the byte array, // 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. // which is unnecessary because getAddress() already returns a clone.

View File

@@ -162,6 +162,8 @@ public class LinkAddress implements Parcelable {
* {@link OsConstants#RT_SCOPE_LINK} or {@link OsConstants#RT_SCOPE_SITE}). * {@link OsConstants#RT_SCOPE_LINK} or {@link OsConstants#RT_SCOPE_SITE}).
* @hide * @hide
*/ */
@SystemApi
@TestApi
public LinkAddress(InetAddress address, int prefixLength, int flags, int scope) { public LinkAddress(InetAddress address, int prefixLength, int flags, int scope) {
init(address, prefixLength, flags, scope); init(address, prefixLength, flags, scope);
} }

View File

@@ -174,7 +174,8 @@ public final class LinkProperties implements Parcelable {
/** /**
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
@TestApi
public LinkProperties(LinkProperties source) { public LinkProperties(LinkProperties source) {
if (source != null) { if (source != null) {
mIfaceName = source.mIfaceName; 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. * @param addresses The {@link Collection} of PCSCF servers to set in this object.
* @hide * @hide
*/ */
@SystemApi
@TestApi
public void setPcscfServers(Collection<InetAddress> pcscfServers) { public void setPcscfServers(Collection<InetAddress> pcscfServers) {
mPcscfs.clear(); mPcscfs.clear();
for (InetAddress pcscfServer: pcscfServers) { for (InetAddress pcscfServer: pcscfServers) {
@@ -590,6 +593,8 @@ public final class LinkProperties implements Parcelable {
* this link. * this link.
* @hide * @hide
*/ */
@SystemApi
@TestApi
public List<InetAddress> getPcscfServers() { public List<InetAddress> getPcscfServers() {
return Collections.unmodifiableList(mPcscfs); return Collections.unmodifiableList(mPcscfs);
} }
@@ -781,6 +786,8 @@ public final class LinkProperties implements Parcelable {
* @return the NAT64 prefix. * @return the NAT64 prefix.
* @hide * @hide
*/ */
@SystemApi
@TestApi
public @Nullable IpPrefix getNat64Prefix() { public @Nullable IpPrefix getNat64Prefix() {
return mNat64Prefix; return mNat64Prefix;
} }
@@ -794,6 +801,8 @@ public final class LinkProperties implements Parcelable {
* @param prefix the NAT64 prefix. * @param prefix the NAT64 prefix.
* @hide * @hide
*/ */
@SystemApi
@TestApi
public void setNat64Prefix(IpPrefix prefix) { public void setNat64Prefix(IpPrefix prefix) {
if (prefix != null && prefix.getPrefixLength() != 96) { if (prefix != null && prefix.getPrefixLength() != 96) {
throw new IllegalArgumentException("Only 96-bit prefixes are supported: " + prefix); throw new IllegalArgumentException("Only 96-bit prefixes are supported: " + prefix);

View File

@@ -110,6 +110,8 @@ public final class RouteInfo implements Parcelable {
* *
* @hide * @hide
*/ */
@SystemApi
@TestApi
public RouteInfo(IpPrefix destination, InetAddress gateway, String iface, int type) { public RouteInfo(IpPrefix destination, InetAddress gateway, String iface, int type) {
switch (type) { switch (type) {
case RTN_UNICAST: case RTN_UNICAST: