Tethering: Fix hidden API selectBestRoute

Bug: 143925787
Test: -build, flash, boot
      -ON/OFF hotspot
      -atest TetheringTests

Merged-In: I824a05fac8b606123667d20ab9b1f7de905e4088
Change-Id: I824a05fac8b606123667d20ab9b1f7de905e4088
(clean cherry-pick)
diff --git a/Tethering/Android.bp b/Tethering/Android.bp
index 1315ed0..e5bf4fa 100644
--- a/Tethering/Android.bp
+++ b/Tethering/Android.bp
@@ -29,6 +29,7 @@
         "netlink-client",
         "networkstack-aidl-interfaces-unstable-java",
         "android.hardware.tetheroffload.control-V1.0-java",
+        "net-utils-framework-common",
     ],
     libs: [
         "framework-tethering",
diff --git a/Tethering/src/com/android/server/connectivity/tethering/TetheringInterfaceUtils.java b/Tethering/src/com/android/server/connectivity/tethering/TetheringInterfaceUtils.java
index d5cdd8a..4dd6830 100644
--- a/Tethering/src/com/android/server/connectivity/tethering/TetheringInterfaceUtils.java
+++ b/Tethering/src/com/android/server/connectivity/tethering/TetheringInterfaceUtils.java
@@ -22,6 +22,8 @@
 import android.net.RouteInfo;
 import android.net.util.InterfaceSet;
 
+import com.android.net.module.util.NetUtils;
+
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
@@ -85,7 +87,7 @@
 
     private static String getInterfaceForDestination(LinkProperties lp, InetAddress dst) {
         final RouteInfo ri = (lp != null)
-                ? RouteInfo.selectBestRoute(lp.getAllRoutes(), dst)
+                ? NetUtils.selectBestRoute(lp.getAllRoutes(), dst)
                 : null;
         return (ri != null) ? ri.getInterface() : null;
     }