diff options
| author | 2021-07-02 05:27:30 +0000 | |
|---|---|---|
| committer | 2021-07-02 05:27:30 +0000 | |
| commit | 30d17bd9a16db9733ea43e2bf865c5f2aca4a58d (patch) | |
| tree | 97c4c6545c7b431dfb927a3114fd67450c547c88 | |
| parent | afde3f2ca0cf60658ab8930f096d5018d9d37cf1 (diff) | |
| parent | 64e5f3e6f7c38962707a5b8a7dfb1bf5ec161e15 (diff) | |
Merge "Fix Ikev2 vpn cannot establish through startLegacyVpn()" into sc-dev
| -rw-r--r-- | core/java/com/android/internal/net/VpnProfile.java | 13 | ||||
| -rw-r--r-- | services/core/java/com/android/server/VpnManagerService.java | 3 |
2 files changed, 10 insertions, 6 deletions
diff --git a/core/java/com/android/internal/net/VpnProfile.java b/core/java/com/android/internal/net/VpnProfile.java index 6e1d3ce9a297..5f84b5a92305 100644 --- a/core/java/com/android/internal/net/VpnProfile.java +++ b/core/java/com/android/internal/net/VpnProfile.java @@ -377,12 +377,15 @@ public final class VpnProfile implements Cloneable, Parcelable { /** Checks if this profile specifies a LegacyVpn type. */ public static boolean isLegacyType(int type) { switch (type) { - case VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS: // fall through - case VpnProfile.TYPE_IKEV2_IPSEC_RSA: // fall through - case VpnProfile.TYPE_IKEV2_IPSEC_PSK: - return false; - default: + case VpnProfile.TYPE_PPTP: + case VpnProfile.TYPE_L2TP_IPSEC_PSK: + case VpnProfile.TYPE_L2TP_IPSEC_RSA: + case VpnProfile.TYPE_IPSEC_XAUTH_PSK: + case VpnProfile.TYPE_IPSEC_XAUTH_RSA: + case VpnProfile.TYPE_IPSEC_HYBRID_RSA: return true; + default: + return false; } } diff --git a/services/core/java/com/android/server/VpnManagerService.java b/services/core/java/com/android/server/VpnManagerService.java index 70176a0fefeb..d483f1863258 100644 --- a/services/core/java/com/android/server/VpnManagerService.java +++ b/services/core/java/com/android/server/VpnManagerService.java @@ -357,7 +357,8 @@ public class VpnManagerService extends IVpnManager.Stub { @SuppressWarnings("AndroidFrameworkCompatChange") // This is not an app-visible API. @Override public void startLegacyVpn(VpnProfile profile) { - if (Build.VERSION.DEVICE_INITIAL_SDK_INT >= Build.VERSION_CODES.S) { + if (Build.VERSION.DEVICE_INITIAL_SDK_INT >= Build.VERSION_CODES.S + && VpnProfile.isLegacyType(profile.type)) { throw new UnsupportedOperationException("Legacy VPN is deprecated"); } int user = UserHandle.getUserId(mDeps.getCallingUid()); |