From 29348dbfca787235ae1eabbe1a8b7b262187f197 Mon Sep 17 00:00:00 2001 From: chiachangwang Date: Tue, 30 Aug 2022 10:13:49 +0000 Subject: [PATCH] Correctly handle null ProxyInfo in Ikev2VpnProfile This change ensures that null ProxyInfo instances are honored and reflected in the actual VpnProfile. Ikev2VpnProfiles incorrectly set ProxyInfo as an empty instance when provided with a null ProxyInfo. Other components in the system sometimes have different behavior if presented with an empty ProxyInfo instead of a null one. Bug: 244281603 Test: atest FrameworksNetTests Test: Manual testing with VPN validation enabled Change-Id: I67ee2aa5c96dc22ba8fcd2be3fd4c090dec20697 --- core/java/android/net/Ikev2VpnProfile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/net/Ikev2VpnProfile.java b/core/java/android/net/Ikev2VpnProfile.java index ba0546aceb954..3979c6c78dcb4 100644 --- a/core/java/android/net/Ikev2VpnProfile.java +++ b/core/java/android/net/Ikev2VpnProfile.java @@ -171,7 +171,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mPassword = password; mRsaPrivateKey = rsaPrivateKey; mUserCert = userCert; - mProxyInfo = new ProxyInfo(proxyInfo); + mProxyInfo = (proxyInfo == null) ? null : new ProxyInfo(proxyInfo); // UnmodifiableList doesn't make a defensive copy by default. mAllowedAlgorithms = Collections.unmodifiableList(new ArrayList<>(allowedAlgorithms));