Revert "Revert "Unhide RouteInfo#getType and related fields""
This reverts commit 6d1ea2bb16.
Reason for revert: Re-landing changes not related to postsubmit failure
Change-Id: If7940801518be5ddec91270b3663ddfc8b42eadb
This commit is contained in:
@@ -439,11 +439,15 @@ package android.net {
|
||||
method @NonNull public android.net.IpPrefix getDestination();
|
||||
method @Nullable public java.net.InetAddress getGateway();
|
||||
method @Nullable public String getInterface();
|
||||
method public int getType();
|
||||
method public boolean hasGateway();
|
||||
method public boolean isDefaultRoute();
|
||||
method public boolean matches(java.net.InetAddress);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.RouteInfo> CREATOR;
|
||||
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 abstract class SocketKeepalive implements java.lang.AutoCloseable {
|
||||
|
||||
@@ -432,10 +432,6 @@ package android.net {
|
||||
ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int);
|
||||
ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int, int);
|
||||
method public int getMtu();
|
||||
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 abstract class SocketKeepalive implements java.lang.AutoCloseable {
|
||||
|
||||
@@ -86,16 +86,26 @@ public final class RouteInfo implements Parcelable {
|
||||
private final String mInterface;
|
||||
|
||||
|
||||
/** Unicast route. @hide */
|
||||
@SystemApi
|
||||
/**
|
||||
* Unicast route.
|
||||
*
|
||||
* Indicates that destination is reachable directly or via gateway.
|
||||
**/
|
||||
public static final int RTN_UNICAST = 1;
|
||||
|
||||
/** Unreachable route. @hide */
|
||||
@SystemApi
|
||||
/**
|
||||
* Unreachable route.
|
||||
*
|
||||
* Indicates that destination is unreachable.
|
||||
**/
|
||||
public static final int RTN_UNREACHABLE = 7;
|
||||
|
||||
/** Throw route. @hide */
|
||||
@SystemApi
|
||||
/**
|
||||
* Throw route.
|
||||
*
|
||||
* Indicates that routing information about this destination is not in this table.
|
||||
* Routing lookup should continue in another table.
|
||||
**/
|
||||
public static final int RTN_THROW = 9;
|
||||
|
||||
/**
|
||||
@@ -391,10 +401,7 @@ public final class RouteInfo implements Parcelable {
|
||||
* Retrieves the type of this route.
|
||||
*
|
||||
* @return The type of this route; one of the {@code RTN_xxx} constants defined in this class.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RouteType
|
||||
public int getType() {
|
||||
return mType;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
import static android.net.RouteInfo.RTN_THROW;
|
||||
import static android.net.RouteInfo.RTN_UNICAST;
|
||||
import static android.net.RouteInfo.RTN_UNREACHABLE;
|
||||
|
||||
import static com.android.testutils.MiscAsserts.assertEqualBothWays;
|
||||
@@ -328,6 +330,16 @@ public class RouteInfoTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRouteTypes() {
|
||||
RouteInfo r = new RouteInfo(new IpPrefix(Inet6Address.ANY, 0), RTN_UNREACHABLE);
|
||||
assertEquals(RTN_UNREACHABLE, r.getType());
|
||||
r = new RouteInfo(new IpPrefix(Inet6Address.ANY, 0), RTN_UNICAST);
|
||||
assertEquals(RTN_UNICAST, r.getType());
|
||||
r = new RouteInfo(new IpPrefix(Inet6Address.ANY, 0), RTN_THROW);
|
||||
assertEquals(RTN_THROW, r.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTruncation() {
|
||||
LinkAddress l;
|
||||
|
||||
Reference in New Issue
Block a user