Merge "Add fields used by NetworkStack to the API"

This commit is contained in:
Remi NGUYEN VAN
2019-01-21 23:20:26 +00:00
committed by Gerrit Code Review
4 changed files with 27 additions and 7 deletions

View File

@@ -26,6 +26,7 @@ import static android.system.OsConstants.RT_SCOPE_SITE;
import static android.system.OsConstants.RT_SCOPE_UNIVERSE; import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage;
import android.os.Build; import android.os.Build;
import android.os.Parcel; import android.os.Parcel;
@@ -117,7 +118,8 @@ public class LinkAddress implements Parcelable {
* @return true if the address is IPv6. * @return true if the address is IPv6.
* @hide * @hide
*/ */
@UnsupportedAppUsage @TestApi
@SystemApi
public boolean isIPv6() { public boolean isIPv6() {
return address instanceof Inet6Address; return address instanceof Inet6Address;
} }
@@ -126,6 +128,8 @@ public class LinkAddress implements Parcelable {
* @return true if the address is IPv4 or is a mapped IPv4 address. * @return true if the address is IPv4 or is a mapped IPv4 address.
* @hide * @hide
*/ */
@TestApi
@SystemApi
public boolean isIPv4() { public boolean isIPv4() {
return address instanceof Inet4Address; return address instanceof Inet4Address;
} }
@@ -263,7 +267,8 @@ public class LinkAddress implements Parcelable {
* otherwise. * otherwise.
* @hide * @hide
*/ */
@UnsupportedAppUsage @TestApi
@SystemApi
public boolean isSameAddressAs(LinkAddress other) { public boolean isSameAddressAs(LinkAddress other) {
return address.equals(other.address) && prefixLength == other.prefixLength; return address.equals(other.address) && prefixLength == other.prefixLength;
} }
@@ -310,6 +315,8 @@ public class LinkAddress implements Parcelable {
* Returns true if this {@code LinkAddress} is global scope and preferred. * Returns true if this {@code LinkAddress} is global scope and preferred.
* @hide * @hide
*/ */
@TestApi
@SystemApi
public boolean isGlobalPreferred() { public boolean isGlobalPreferred() {
/** /**
* Note that addresses flagged as IFA_F_OPTIMISTIC are * Note that addresses flagged as IFA_F_OPTIMISTIC are

View File

@@ -52,6 +52,8 @@ public final class MacAddress implements Parcelable {
/** /**
* The MacAddress zero MAC address. * The MacAddress zero MAC address.
*
* <p>Not publicly exposed or treated specially since the OUI 00:00:00 is registered.
* @hide * @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage

View File

@@ -16,6 +16,8 @@
package android.net; package android.net;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -157,6 +159,8 @@ public class Network implements Parcelable {
* *
* @hide * @hide
*/ */
@TestApi
@SystemApi
public Network getPrivateDnsBypassingCopy() { public Network getPrivateDnsBypassingCopy() {
return new Network(netId, true); return new Network(netId, true);
} }

View File

@@ -16,16 +16,17 @@
package android.net; package android.net;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage;
import android.os.Build; import android.os.Build;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import java.net.UnknownHostException;
import java.net.InetAddress;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.Inet6Address; import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
@@ -67,12 +68,18 @@ public final class RouteInfo implements Parcelable {
/** Unicast route. @hide */ /** Unicast route. @hide */
@SystemApi
@TestApi
public static final int RTN_UNICAST = 1; public static final int RTN_UNICAST = 1;
/** Unreachable route. @hide */ /** Unreachable route. @hide */
@SystemApi
@TestApi
public static final int RTN_UNREACHABLE = 7; public static final int RTN_UNREACHABLE = 7;
/** Throw route. @hide */ /** Throw route. @hide */
@SystemApi
@TestApi
public static final int RTN_THROW = 9; public static final int RTN_THROW = 9;
/** /**
@@ -317,6 +324,8 @@ public final class RouteInfo implements Parcelable {
* *
* @hide * @hide
*/ */
@TestApi
@SystemApi
public int getType() { public int getType() {
return mType; return mType;
} }
@@ -362,9 +371,7 @@ public final class RouteInfo implements Parcelable {
* ({@code false}). * ({@code false}).
* *
* @return {@code true} if a gateway is specified * @return {@code true} if a gateway is specified
* @hide
*/ */
@UnsupportedAppUsage
public boolean hasGateway() { public boolean hasGateway() {
return mHasGateway; return mHasGateway;
} }