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
(cherry picked from commit 29348dbfca)
Merged-In: I67ee2aa5c96dc22ba8fcd2be3fd4c090dec20697
This commit is contained in:
chiachangwang
2022-08-30 10:13:49 +00:00
committed by Cherrypicker Worker
parent 96fd9fad38
commit 9a80121f6b

View File

@@ -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));