Throw IAE when Network's LinkProperties is null
Improve the setUnderlyingNetwork method by throwing IAE
when Network's LinkProperties is null. Also update the
API doc to give caller more guidance in using this API
Bug: 232309601
Test: UT: IpSecServiceParameterizedTest, IpSecServiceTest,
IpSecServiceRefcountedResourceTest, IpSecManagerTest, VpnTest
Test: CTS: IpSecManagerTest, IpSecManagerTunnelTest, Ikev2VpnTest
Test: make doc-comment-check-docs
Change-Id: Idab4706b0db42ed2222fb48b168589ed005d2f2f
This commit is contained in:
@@ -1452,6 +1452,11 @@ public class IpSecService extends IIpSecService.Stub {
|
||||
final ConnectivityManager connectivityManager =
|
||||
mContext.getSystemService(ConnectivityManager.class);
|
||||
final LinkProperties lp = connectivityManager.getLinkProperties(underlyingNetwork);
|
||||
if (lp == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"LinkProperties is null. The underlyingNetwork may not be functional");
|
||||
}
|
||||
|
||||
if (tunnelInterfaceInfo.getInterfaceName().equals(lp.getInterfaceName())) {
|
||||
throw new IllegalArgumentException(
|
||||
"Underlying network cannot be the network being exposed by this tunnel");
|
||||
|
||||
Reference in New Issue
Block a user