Maintain VPN type form the VpnProfile

the connectedLegacyVpn may already exist within the VpnProfiles. Because
the stub profile generated from the LegacyVpnInfo does not contain type
information, overriding whether the VPN is insecure using this
information will provide an incomplete picture.

Test: atest -c SettingsUnitTests
Bug: 184922172
Change-Id: Icf2e08826c444863eaebdaa47bfd217795d2bad6
This commit is contained in:
Jeremy Goldman
2021-04-12 15:37:19 +08:00
parent d62b2c23cf
commit 88ee31e269

View File

@@ -304,7 +304,9 @@ public class VpnSettings extends RestrictedSettingsFragment implements
LegacyVpnPreference p = mSettings.findOrCreatePreference(stubProfile, false);
p.setState(vpn.state);
p.setAlwaysOn(lockdownVpnKey != null && lockdownVpnKey.equals(vpn.key));
p.setInsecureVpn(VpnProfile.isLegacyType(stubProfile.type));
// (b/184921649) do not call setInsecureVpn() for connectedLegacyVpns, since the
// LegacyVpnInfo does not contain VPN type information, and the profile already
// exists within vpnProfiles.
updates.add(p);
}