Loading core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -25209,6 +25209,7 @@ package android.net { public final class Ikev2VpnProfile extends android.net.PlatformVpnProfile { public final class Ikev2VpnProfile extends android.net.PlatformVpnProfile { method @NonNull public java.util.List<java.lang.String> getAllowedAlgorithms(); method @NonNull public java.util.List<java.lang.String> getAllowedAlgorithms(); method @Nullable public android.net.ipsec.ike.IkeTunnelConnectionParams getIkeTunnelConnectionParams(); method public int getMaxMtu(); method public int getMaxMtu(); method @Nullable public String getPassword(); method @Nullable public String getPassword(); method @Nullable public byte[] getPresharedKey(); method @Nullable public byte[] getPresharedKey(); core/java/android/net/Ikev2VpnProfile.java +21 −5 Original line number Original line Diff line number Diff line Loading @@ -142,6 +142,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { private final boolean mIsMetered; // Defaults in builder private final boolean mIsMetered; // Defaults in builder private final int mMaxMtu; // Defaults in builder private final int mMaxMtu; // Defaults in builder private final boolean mIsRestrictedToTestNetworks; private final boolean mIsRestrictedToTestNetworks; @Nullable private final IkeTunnelConnectionParams mIkeTunConnParams; private Ikev2VpnProfile( private Ikev2VpnProfile( int type, int type, Loading @@ -160,7 +161,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { int maxMtu, int maxMtu, boolean restrictToTestNetworks, boolean restrictToTestNetworks, boolean excludeLocalRoutes, boolean excludeLocalRoutes, boolean requiresInternetValidation) { boolean requiresInternetValidation, @Nullable IkeTunnelConnectionParams ikeTunConnParams) { super(type, excludeLocalRoutes, requiresInternetValidation); super(type, excludeLocalRoutes, requiresInternetValidation); checkNotNull(serverAddr, MISSING_PARAM_MSG_TMPL, "Server address"); checkNotNull(serverAddr, MISSING_PARAM_MSG_TMPL, "Server address"); Loading Loading @@ -190,6 +192,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mMaxMtu = maxMtu; mMaxMtu = maxMtu; mIsRestrictedToTestNetworks = restrictToTestNetworks; mIsRestrictedToTestNetworks = restrictToTestNetworks; mIkeTunConnParams = ikeTunConnParams; validate(); validate(); } } Loading Loading @@ -375,6 +379,12 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { return mMaxMtu; return mMaxMtu; } } /** Retrieves the ikeTunnelConnectionParams contains IKEv2 configurations, if any was set. */ @Nullable public IkeTunnelConnectionParams getIkeTunnelConnectionParams() { return mIkeTunConnParams; } /** /** * Returns whether or not this VPN profile is restricted to test networks. * Returns whether or not this VPN profile is restricted to test networks. * * Loading Loading @@ -403,7 +413,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mMaxMtu, mMaxMtu, mIsRestrictedToTestNetworks, mIsRestrictedToTestNetworks, mExcludeLocalRoutes, mExcludeLocalRoutes, mRequiresInternetValidation); mRequiresInternetValidation, mIkeTunConnParams); } } @Override @Override Loading @@ -429,7 +440,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { && mMaxMtu == other.mMaxMtu && mMaxMtu == other.mMaxMtu && mIsRestrictedToTestNetworks == other.mIsRestrictedToTestNetworks && mIsRestrictedToTestNetworks == other.mIsRestrictedToTestNetworks && mExcludeLocalRoutes == other.mExcludeLocalRoutes && mExcludeLocalRoutes == other.mExcludeLocalRoutes && mRequiresInternetValidation == other.mRequiresInternetValidation; && mRequiresInternetValidation == other.mRequiresInternetValidation && Objects.equals(mIkeTunConnParams, other.mIkeTunConnParams); } } /** /** Loading Loading @@ -504,6 +516,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { @NonNull @NonNull public static Ikev2VpnProfile fromVpnProfile(@NonNull VpnProfile profile) public static Ikev2VpnProfile fromVpnProfile(@NonNull VpnProfile profile) throws GeneralSecurityException { throws GeneralSecurityException { // TODO: Build the VpnProfile from mIkeTunConnParams if it exists. final Builder builder = new Builder(profile.server, profile.ipsecIdentifier); final Builder builder = new Builder(profile.server, profile.ipsecIdentifier); builder.setProxy(profile.proxy); builder.setProxy(profile.proxy); builder.setAllowedAlgorithms(profile.getAllowedAlgorithms()); builder.setAllowedAlgorithms(profile.getAllowedAlgorithms()); Loading Loading @@ -788,7 +801,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { private int mMaxMtu = PlatformVpnProfile.MAX_MTU_DEFAULT; private int mMaxMtu = PlatformVpnProfile.MAX_MTU_DEFAULT; private boolean mIsRestrictedToTestNetworks = false; private boolean mIsRestrictedToTestNetworks = false; private boolean mExcludeLocalRoutes = false; private boolean mExcludeLocalRoutes = false; @Nullable private IkeTunnelConnectionParams mIkeTunConnParams; @Nullable private final IkeTunnelConnectionParams mIkeTunConnParams; /** /** * Creates a new builder with the basic parameters of an IKEv2/IPsec VPN. * Creates a new builder with the basic parameters of an IKEv2/IPsec VPN. Loading @@ -803,6 +816,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mServerAddr = serverAddr; mServerAddr = serverAddr; mUserIdentity = identity; mUserIdentity = identity; mIkeTunConnParams = null; } } /** /** Loading Loading @@ -1135,7 +1150,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mMaxMtu, mMaxMtu, mIsRestrictedToTestNetworks, mIsRestrictedToTestNetworks, mExcludeLocalRoutes, mExcludeLocalRoutes, mRequiresInternetValidation); mRequiresInternetValidation, mIkeTunConnParams); } } } } } } Loading
core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -25209,6 +25209,7 @@ package android.net { public final class Ikev2VpnProfile extends android.net.PlatformVpnProfile { public final class Ikev2VpnProfile extends android.net.PlatformVpnProfile { method @NonNull public java.util.List<java.lang.String> getAllowedAlgorithms(); method @NonNull public java.util.List<java.lang.String> getAllowedAlgorithms(); method @Nullable public android.net.ipsec.ike.IkeTunnelConnectionParams getIkeTunnelConnectionParams(); method public int getMaxMtu(); method public int getMaxMtu(); method @Nullable public String getPassword(); method @Nullable public String getPassword(); method @Nullable public byte[] getPresharedKey(); method @Nullable public byte[] getPresharedKey();
core/java/android/net/Ikev2VpnProfile.java +21 −5 Original line number Original line Diff line number Diff line Loading @@ -142,6 +142,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { private final boolean mIsMetered; // Defaults in builder private final boolean mIsMetered; // Defaults in builder private final int mMaxMtu; // Defaults in builder private final int mMaxMtu; // Defaults in builder private final boolean mIsRestrictedToTestNetworks; private final boolean mIsRestrictedToTestNetworks; @Nullable private final IkeTunnelConnectionParams mIkeTunConnParams; private Ikev2VpnProfile( private Ikev2VpnProfile( int type, int type, Loading @@ -160,7 +161,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { int maxMtu, int maxMtu, boolean restrictToTestNetworks, boolean restrictToTestNetworks, boolean excludeLocalRoutes, boolean excludeLocalRoutes, boolean requiresInternetValidation) { boolean requiresInternetValidation, @Nullable IkeTunnelConnectionParams ikeTunConnParams) { super(type, excludeLocalRoutes, requiresInternetValidation); super(type, excludeLocalRoutes, requiresInternetValidation); checkNotNull(serverAddr, MISSING_PARAM_MSG_TMPL, "Server address"); checkNotNull(serverAddr, MISSING_PARAM_MSG_TMPL, "Server address"); Loading Loading @@ -190,6 +192,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mMaxMtu = maxMtu; mMaxMtu = maxMtu; mIsRestrictedToTestNetworks = restrictToTestNetworks; mIsRestrictedToTestNetworks = restrictToTestNetworks; mIkeTunConnParams = ikeTunConnParams; validate(); validate(); } } Loading Loading @@ -375,6 +379,12 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { return mMaxMtu; return mMaxMtu; } } /** Retrieves the ikeTunnelConnectionParams contains IKEv2 configurations, if any was set. */ @Nullable public IkeTunnelConnectionParams getIkeTunnelConnectionParams() { return mIkeTunConnParams; } /** /** * Returns whether or not this VPN profile is restricted to test networks. * Returns whether or not this VPN profile is restricted to test networks. * * Loading Loading @@ -403,7 +413,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mMaxMtu, mMaxMtu, mIsRestrictedToTestNetworks, mIsRestrictedToTestNetworks, mExcludeLocalRoutes, mExcludeLocalRoutes, mRequiresInternetValidation); mRequiresInternetValidation, mIkeTunConnParams); } } @Override @Override Loading @@ -429,7 +440,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { && mMaxMtu == other.mMaxMtu && mMaxMtu == other.mMaxMtu && mIsRestrictedToTestNetworks == other.mIsRestrictedToTestNetworks && mIsRestrictedToTestNetworks == other.mIsRestrictedToTestNetworks && mExcludeLocalRoutes == other.mExcludeLocalRoutes && mExcludeLocalRoutes == other.mExcludeLocalRoutes && mRequiresInternetValidation == other.mRequiresInternetValidation; && mRequiresInternetValidation == other.mRequiresInternetValidation && Objects.equals(mIkeTunConnParams, other.mIkeTunConnParams); } } /** /** Loading Loading @@ -504,6 +516,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { @NonNull @NonNull public static Ikev2VpnProfile fromVpnProfile(@NonNull VpnProfile profile) public static Ikev2VpnProfile fromVpnProfile(@NonNull VpnProfile profile) throws GeneralSecurityException { throws GeneralSecurityException { // TODO: Build the VpnProfile from mIkeTunConnParams if it exists. final Builder builder = new Builder(profile.server, profile.ipsecIdentifier); final Builder builder = new Builder(profile.server, profile.ipsecIdentifier); builder.setProxy(profile.proxy); builder.setProxy(profile.proxy); builder.setAllowedAlgorithms(profile.getAllowedAlgorithms()); builder.setAllowedAlgorithms(profile.getAllowedAlgorithms()); Loading Loading @@ -788,7 +801,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { private int mMaxMtu = PlatformVpnProfile.MAX_MTU_DEFAULT; private int mMaxMtu = PlatformVpnProfile.MAX_MTU_DEFAULT; private boolean mIsRestrictedToTestNetworks = false; private boolean mIsRestrictedToTestNetworks = false; private boolean mExcludeLocalRoutes = false; private boolean mExcludeLocalRoutes = false; @Nullable private IkeTunnelConnectionParams mIkeTunConnParams; @Nullable private final IkeTunnelConnectionParams mIkeTunConnParams; /** /** * Creates a new builder with the basic parameters of an IKEv2/IPsec VPN. * Creates a new builder with the basic parameters of an IKEv2/IPsec VPN. Loading @@ -803,6 +816,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mServerAddr = serverAddr; mServerAddr = serverAddr; mUserIdentity = identity; mUserIdentity = identity; mIkeTunConnParams = null; } } /** /** Loading Loading @@ -1135,7 +1150,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { mMaxMtu, mMaxMtu, mIsRestrictedToTestNetworks, mIsRestrictedToTestNetworks, mExcludeLocalRoutes, mExcludeLocalRoutes, mRequiresInternetValidation); mRequiresInternetValidation, mIkeTunConnParams); } } } } } }