Merge "Use #setNetwork and #getNetwork for IkeSessionParams" am: 3022c5437c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675285 Change-Id: Ia1a32d6dd831b5debe134681ed0760c79aad6555
This commit is contained in:
@@ -83,7 +83,7 @@ public final class IkeSessionParamsUtils {
|
||||
/** Serializes an IkeSessionParams to a PersistableBundle. */
|
||||
@NonNull
|
||||
public static PersistableBundle toPersistableBundle(@NonNull IkeSessionParams params) {
|
||||
if (params.getConfiguredNetwork() != null || params.getIke3gppExtension() != null) {
|
||||
if (params.getNetwork() != null || params.getIke3gppExtension() != null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot convert a IkeSessionParams with a caller configured network or with"
|
||||
+ " 3GPP extension enabled");
|
||||
|
||||
@@ -2106,7 +2106,7 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
(VcnControlPlaneIkeConfig) mConnectionConfig.getControlPlaneConfig();
|
||||
final IkeSessionParams.Builder builder =
|
||||
new IkeSessionParams.Builder(controlPlaneConfig.getIkeSessionParams());
|
||||
builder.setConfiguredNetwork(network);
|
||||
builder.setNetwork(network);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@@ -22,12 +22,7 @@ import static android.net.ipsec.ike.SaProposal.PSEUDORANDOM_FUNCTION_AES128_XCBC
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.ipsec.ike.ChildSaProposal;
|
||||
import android.net.ipsec.ike.IkeFqdnIdentification;
|
||||
import android.net.ipsec.ike.IkeSaProposal;
|
||||
@@ -56,20 +51,13 @@ public class VcnControlPlaneIkeConfigTest {
|
||||
.addPseudorandomFunction(PSEUDORANDOM_FUNCTION_AES128_XCBC)
|
||||
.build();
|
||||
|
||||
Context mockContext = mock(Context.class);
|
||||
ConnectivityManager mockConnectManager = mock(ConnectivityManager.class);
|
||||
doReturn(mockConnectManager)
|
||||
.when(mockContext)
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
doReturn(mock(Network.class)).when(mockConnectManager).getActiveNetwork();
|
||||
|
||||
final String serverHostname = "192.0.2.100";
|
||||
final String testLocalId = "test.client.com";
|
||||
final String testRemoteId = "test.server.com";
|
||||
final byte[] psk = "psk".getBytes();
|
||||
|
||||
IKE_PARAMS =
|
||||
new IkeSessionParams.Builder(mockContext)
|
||||
new IkeSessionParams.Builder()
|
||||
.setServerHostname(serverHostname)
|
||||
.addSaProposal(ikeProposal)
|
||||
.setLocalIdentification(new IkeFqdnIdentification(testLocalId))
|
||||
|
||||
@@ -58,8 +58,7 @@ public class VcnGatewayConnectionConnectingStateTest extends VcnGatewayConnectio
|
||||
ArgumentCaptor.forClass(IkeSessionParams.class);
|
||||
verify(mDeps).newIkeSession(any(), paramsCaptor.capture(), any(), any(), any());
|
||||
assertEquals(
|
||||
TEST_UNDERLYING_NETWORK_RECORD_1.network,
|
||||
paramsCaptor.getValue().getConfiguredNetwork());
|
||||
TEST_UNDERLYING_NETWORK_RECORD_1.network, paramsCaptor.getValue().getNetwork());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user