Add fields used by NetworkStack to the API

Test: m
Bug: 112869080
Change-Id: I59f6d5ae8a601b7496548b87f137a577f2365a37
This commit is contained in:
Remi NGUYEN VAN
2019-01-20 12:52:43 +09:00
parent 5ceb563f51
commit 85b9665073
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 android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
@@ -117,7 +118,8 @@ public class LinkAddress implements Parcelable {
* @return true if the address is IPv6.
* @hide
*/
@UnsupportedAppUsage
@TestApi
@SystemApi
public boolean isIPv6() {
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.
* @hide
*/
@TestApi
@SystemApi
public boolean isIPv4() {
return address instanceof Inet4Address;
}
@@ -263,7 +267,8 @@ public class LinkAddress implements Parcelable {
* otherwise.
* @hide
*/
@UnsupportedAppUsage
@TestApi
@SystemApi
public boolean isSameAddressAs(LinkAddress other) {
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.
* @hide
*/
@TestApi
@SystemApi
public boolean isGlobalPreferred() {
/**
* 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.
*
* <p>Not publicly exposed or treated specially since the OUI 00:00:00 is registered.
* @hide
*/
@UnsupportedAppUsage

View File

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

View File

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