From 02156d600db553b07d5152621d02624352bf3501 Mon Sep 17 00:00:00 2001 From: chiachangwang Date: Thu, 13 Apr 2023 07:47:53 +0000 Subject: [PATCH] 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 --- src/com/android/settings/vpn2/ConfigDialog.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/vpn2/ConfigDialog.java b/src/com/android/settings/vpn2/ConfigDialog.java index be2a68e237a..036487dc484 100644 --- a/src/com/android/settings/vpn2/ConfigDialog.java +++ b/src/com/android/settings/vpn2/ConfigDialog.java @@ -653,10 +653,14 @@ class ConfigDialog extends AlertDialog implements TextWatcher, 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();