Tethering: Fix hidden API selectBestRoute

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

Change-Id: I824a05fac8b606123667d20ab9b1f7de905e4088
This commit is contained in:
markchien
2020-01-14 17:28:47 +08:00
committed by Mark Chien
parent c3bd773863
commit 78c1bbcf14
2 changed files with 4 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ java_defaults {
"netlink-client", "netlink-client",
"networkstack-aidl-interfaces-unstable-java", "networkstack-aidl-interfaces-unstable-java",
"android.hardware.tetheroffload.control-V1.0-java", "android.hardware.tetheroffload.control-V1.0-java",
"net-utils-framework-common",
], ],
libs: [ libs: [
"framework-tethering", "framework-tethering",

View File

@@ -22,6 +22,8 @@ import android.net.NetworkCapabilities;
import android.net.RouteInfo; import android.net.RouteInfo;
import android.net.util.InterfaceSet; import android.net.util.InterfaceSet;
import com.android.net.module.util.NetUtils;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@@ -85,7 +87,7 @@ public final class TetheringInterfaceUtils {
private static String getInterfaceForDestination(LinkProperties lp, InetAddress dst) { private static String getInterfaceForDestination(LinkProperties lp, InetAddress dst) {
final RouteInfo ri = (lp != null) final RouteInfo ri = (lp != null)
? RouteInfo.selectBestRoute(lp.getAllRoutes(), dst) ? NetUtils.selectBestRoute(lp.getAllRoutes(), dst)
: null; : null;
return (ri != null) ? ri.getInterface() : null; return (ri != null) ? ri.getInterface() : null;
} }