Merge changes I752c39bd,I00f49555 am: 98d3db878a

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1782429

Change-Id: I9531411108263e0bd77be690562c6315ca46bbe0
This commit is contained in:
Lucas Lin
2021-08-05 06:55:18 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 6 deletions

View File

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

View File

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