Merge "TestNetworkManager: add support for configuring tap link addresses"

This commit is contained in:
Patrick Rohr 2022-07-09 02:08:36 +00:00 • committed by Gerrit Code Review
commit e548be264b

View file

@ -192,6 +192,24 @@ public class TestNetworkManager {
}
}
/**
* Create a tap interface for testing purposes
*
* @param linkAddrs an array of LinkAddresses to assign to the TAP interface
* @return A TestNetworkInterface representing the underlying TAP interface. Close the contained
* ParcelFileDescriptor to tear down the TAP interface.
* @hide
*/
@RequiresPermission(Manifest.permission.MANAGE_TEST_NETWORKS)
@NonNull
public TestNetworkInterface createTapInterface(@NonNull LinkAddress[] linkAddrs) {
try {
return mService.createInterface(TAP, CARRIER_UP, BRING_UP, linkAddrs, null /* iface */);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Create a tap interface for testing purposes
*