Merge changes from topic "revert-1551943-vpn-impl-FKOLCXTDDT" am: e89170bcb1

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1927304

Change-Id: Ifd4987c474742b20980bdf9bec07cee482e45425
diff --git a/framework/api/current.txt b/framework/api/current.txt
index c53f29a..9a77a3c 100644
--- a/framework/api/current.txt
+++ b/framework/api/current.txt
@@ -439,15 +439,11 @@
     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 {
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index 7db8725..cfab872 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -432,6 +432,10 @@
     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 {
diff --git a/framework/src/android/net/RouteInfo.java b/framework/src/android/net/RouteInfo.java
index df5f151..fad3144 100644
--- a/framework/src/android/net/RouteInfo.java
+++ b/framework/src/android/net/RouteInfo.java
@@ -86,26 +86,16 @@
     private final String mInterface;
 
 
-    /**
-     * Unicast route.
-     *
-     * Indicates that destination is reachable directly or via gateway.
-     **/
+    /** Unicast route. @hide */
+    @SystemApi
     public static final int RTN_UNICAST = 1;
 
-    /**
-     * Unreachable route.
-     *
-     * Indicates that destination is unreachable.
-     **/
+    /** Unreachable route. @hide */
+    @SystemApi
     public static final int RTN_UNREACHABLE = 7;
 
-    /**
-     * Throw route.
-     *
-     * Indicates that routing information about this destination is not in this table.
-     * Routing lookup should continue in another table.
-     **/
+    /** Throw route. @hide */
+    @SystemApi
     public static final int RTN_THROW = 9;
 
     /**
@@ -401,7 +391,10 @@
      * 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;
diff --git a/tests/common/java/android/net/RouteInfoTest.java b/tests/common/java/android/net/RouteInfoTest.java
index b69b045..71689f9 100644
--- a/tests/common/java/android/net/RouteInfoTest.java
+++ b/tests/common/java/android/net/RouteInfoTest.java
@@ -16,8 +16,6 @@
 
 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;
@@ -331,16 +329,6 @@
     }
 
     @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;
       RouteInfo r;