Remove IpServer.Dependencies#getIfIndex.

This code is unused.

Test: atest TetheringTests
Change-Id: Iaac422d72e8538b67798cb3ae3737deb7b426401
This commit is contained in:
Lorenzo Colitti
2021-01-26 22:46:27 +09:00
parent 51c1a95c82
commit f3b201f819
2 changed files with 0 additions and 15 deletions

View File

@@ -71,10 +71,8 @@ import com.android.networkstack.tethering.BpfCoordinator.ClientInfo;
import com.android.networkstack.tethering.BpfCoordinator.Ipv6ForwardingRule; import com.android.networkstack.tethering.BpfCoordinator.Ipv6ForwardingRule;
import com.android.networkstack.tethering.PrivateAddressCoordinator; import com.android.networkstack.tethering.PrivateAddressCoordinator;
import java.io.IOException;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.Inet6Address; import java.net.Inet6Address;
import java.net.NetworkInterface;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -187,16 +185,6 @@ public class IpServer extends StateMachine {
return InterfaceParams.getByName(ifName); return InterfaceParams.getByName(ifName);
} }
/** Get |ifName|'s interface index. */
public int getIfindex(String ifName) {
try {
return NetworkInterface.getByName(ifName).getIndex();
} catch (IOException | NullPointerException e) {
Log.e(TAG, "Can't determine interface index for interface " + ifName);
return 0;
}
}
/** Create a DhcpServer instance to be used by IpServer. */ /** Create a DhcpServer instance to be used by IpServer. */
public abstract void makeDhcpServer(String ifName, DhcpServingParamsParcel params, public abstract void makeDhcpServer(String ifName, DhcpServingParamsParcel params,
DhcpServerCallbacks cb); DhcpServerCallbacks cb);

View File

@@ -206,9 +206,6 @@ public class IpServerTest {
when(mDependencies.getInterfaceParams(UPSTREAM_IFACE)).thenReturn(UPSTREAM_IFACE_PARAMS); when(mDependencies.getInterfaceParams(UPSTREAM_IFACE)).thenReturn(UPSTREAM_IFACE_PARAMS);
when(mDependencies.getInterfaceParams(UPSTREAM_IFACE2)).thenReturn(UPSTREAM_IFACE_PARAMS2); when(mDependencies.getInterfaceParams(UPSTREAM_IFACE2)).thenReturn(UPSTREAM_IFACE_PARAMS2);
when(mDependencies.getIfindex(eq(UPSTREAM_IFACE))).thenReturn(UPSTREAM_IFINDEX);
when(mDependencies.getIfindex(eq(UPSTREAM_IFACE2))).thenReturn(UPSTREAM_IFINDEX2);
mInterfaceConfiguration = new InterfaceConfigurationParcel(); mInterfaceConfiguration = new InterfaceConfigurationParcel();
mInterfaceConfiguration.flags = new String[0]; mInterfaceConfiguration.flags = new String[0];
if (interfaceType == TETHERING_BLUETOOTH) { if (interfaceType == TETHERING_BLUETOOTH) {