Populate ipsecSecret field in VpnProfile
This commit fixes IKEv2 RSA VPN could not be an always-on VPN
issue to populate ipsecSecret field from "IPsec user certificate".
Fields ipsecUserCert and ipsecSecret are required for a valid
VpnProfile. The ipsecSecret field in VpnProfile should be
populated from "IPsec user certificate" field. It's the matching
private key.
Bug: 263610164
Bug: 230727391
Test: Verify if IKEv2 RSA VPN can setup successfully and set as
as always on VPN
Change-Id: I605b35fff9e399ee7b82d8441137984992ab2907
diff --git a/src/com/android/settings/vpn2/ConfigDialog.java b/src/com/android/settings/vpn2/ConfigDialog.java
index be2a68e..036487d 100644
--- a/src/com/android/settings/vpn2/ConfigDialog.java
+++ b/src/com/android/settings/vpn2/ConfigDialog.java
@@ -653,10 +653,14 @@
profile.ipsecSecret = mIpsecSecret.getText().toString();
break;
+ case VpnProfile.TYPE_IKEV2_IPSEC_RSA:
+ if (mIpsecUserCert.getSelectedItemPosition() != 0) {
+ profile.ipsecSecret = (String) mIpsecUserCert.getSelectedItem();
+ }
+ // fall through
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
profile.l2tpSecret = mL2tpSecret.getText().toString();
// fall through
- case VpnProfile.TYPE_IKEV2_IPSEC_RSA: // fall through
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
if (mIpsecUserCert.getSelectedItemPosition() != 0) {
profile.ipsecUserCert = (String) mIpsecUserCert.getSelectedItem();