Merge "Add fields used by NetworkStack to the API"

am: 79a6d5e30c

Change-Id: Iaf2dfea8263a1c7e78130222126e2ebbaa84fedd
This commit is contained in:
Remi NGUYEN VAN
2019-01-21 15:36:17 -08:00
committed by android-build-merger
8 changed files with 64 additions and 9 deletions

View File

@@ -27553,6 +27553,7 @@ package android.net {
method public android.net.IpPrefix getDestination();
method public java.net.InetAddress getGateway();
method public String getInterface();
method public boolean hasGateway();
method public boolean isDefaultRoute();
method public boolean matches(java.net.InetAddress);
method public void writeToParcel(android.os.Parcel, int);

View File

@@ -3044,6 +3044,10 @@ package android.net {
public class LinkAddress implements android.os.Parcelable {
ctor public LinkAddress(java.net.InetAddress, int);
ctor public LinkAddress(String);
method public boolean isGlobalPreferred();
method public boolean isIPv4();
method public boolean isIPv6();
method public boolean isSameAddressAs(android.net.LinkAddress);
}
public final class LinkProperties implements android.os.Parcelable {
@@ -3058,6 +3062,10 @@ package android.net {
method public void setMtu(int);
}
public class Network implements android.os.Parcelable {
method public android.net.Network getPrivateDnsBypassingCopy();
}
public final class NetworkCapabilities implements android.os.Parcelable {
method public int getSignalStrength();
field public static final int NET_CAPABILITY_OEM_PAID = 22; // 0x16
@@ -3099,6 +3107,13 @@ package android.net {
field public static final String EXTRA_PACKAGE_NAME = "packageName";
}
public final class RouteInfo implements android.os.Parcelable {
method public int getType();
field public static final int RTN_THROW = 9; // 0x9
field public static final int RTN_UNICAST = 1; // 0x1
field public static final int RTN_UNREACHABLE = 7; // 0x7
}
public class RssiCurve implements android.os.Parcelable {
ctor public RssiCurve(int, int, byte[]);
ctor public RssiCurve(int, int, byte[], int);

View File

@@ -602,11 +602,29 @@ package android.net {
field public static final int INVALID_SECURITY_PARAMETER_INDEX = 0; // 0x0
}
public class LinkAddress implements android.os.Parcelable {
method public boolean isGlobalPreferred();
method public boolean isIPv4();
method public boolean isIPv6();
method public boolean isSameAddressAs(android.net.LinkAddress);
}
public class Network implements android.os.Parcelable {
method public android.net.Network getPrivateDnsBypassingCopy();
}
public final class NetworkCapabilities implements android.os.Parcelable {
method public int[] getCapabilities();
method public int[] getTransportTypes();
}
public final class RouteInfo implements android.os.Parcelable {
method public int getType();
field public static final int RTN_THROW = 9; // 0x9
field public static final int RTN_UNICAST = 1; // 0x1
field public static final int RTN_UNREACHABLE = 7; // 0x7
}
public class TrafficStats {
method public static long getLoopbackRxBytes();
method public static long getLoopbackRxPackets();

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;
}

View File

@@ -16,9 +16,9 @@
package android.net.util;
import static android.net.MacAddress.ALL_ZEROS_ADDRESS;
import static android.net.util.NetworkConstants.ETHER_MTU;
import static android.net.util.NetworkConstants.IPV6_MIN_MTU;
import static com.android.internal.util.Preconditions.checkArgument;
import android.net.MacAddress;
@@ -67,7 +67,8 @@ public class InterfaceParams {
checkArgument((index > 0), "invalid interface index");
this.name = name;
this.index = index;
this.macAddr = (macAddr != null) ? macAddr : ALL_ZEROS_ADDRESS;
this.macAddr = (macAddr != null) ? macAddr : MacAddress.fromBytes(new byte[] {
0x02, 0x00, 0x00, 0x00, 0x00, 0x00 });
this.defaultMtu = (defaultMtu > IPV6_MIN_MTU) ? defaultMtu : IPV6_MIN_MTU;
}