Loading core/java/com/android/internal/net/VpnProfile.java +30 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.internal.net; import android.annotation.UnsupportedAppUsage; import android.os.Build; import android.net.ProxyInfo; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; Loading Loading @@ -46,6 +48,10 @@ public class VpnProfile implements Cloneable, Parcelable { public static final int TYPE_IPSEC_HYBRID_RSA = 5; public static final int TYPE_MAX = 5; // Match these constants with R.array.vpn_proxy_settings. public static final int PROXY_NONE = 0; public static final int PROXY_MANUAL = 1; // Entity fields. @UnsupportedAppUsage public final String key; // -1 Loading @@ -68,6 +74,7 @@ public class VpnProfile implements Cloneable, Parcelable { public String ipsecUserCert = ""; // 12 public String ipsecCaCert = ""; // 13 public String ipsecServerCert = "";// 14 public ProxyInfo proxy = null; // 15~18 // Helper fields. @UnsupportedAppUsage Loading Loading @@ -96,6 +103,7 @@ public class VpnProfile implements Cloneable, Parcelable { ipsecCaCert = in.readString(); ipsecServerCert = in.readString(); saveLogin = in.readInt() != 0; proxy = in.readParcelable(null); } @Override Loading @@ -117,6 +125,7 @@ public class VpnProfile implements Cloneable, Parcelable { out.writeString(ipsecCaCert); out.writeString(ipsecServerCert); out.writeInt(saveLogin ? 1 : 0); out.writeParcelable(proxy, flags); } @UnsupportedAppUsage Loading @@ -127,8 +136,8 @@ public class VpnProfile implements Cloneable, Parcelable { } String[] values = new String(value, StandardCharsets.UTF_8).split("\0", -1); // There can be 14 or 15 values in ICS MR1. if (values.length < 14 || values.length > 15) { // There can be 14 - 19 Bytes in values.length. if (values.length < 14 || values.length > 19) { return null; } Loading @@ -151,7 +160,18 @@ public class VpnProfile implements Cloneable, Parcelable { profile.ipsecUserCert = values[12]; profile.ipsecCaCert = values[13]; profile.ipsecServerCert = (values.length > 14) ? values[14] : ""; if (values.length > 15) { String host = (values.length > 15) ? values[15] : ""; String port = (values.length > 16) ? values[16] : ""; String exclList = (values.length > 17) ? values[17] : ""; String pacFileUrl = (values.length > 18) ? values[18] : ""; if (pacFileUrl.isEmpty()) { profile.proxy = new ProxyInfo(host, port.isEmpty() ? 0 : Integer.parseInt(port), exclList); } else { profile.proxy = new ProxyInfo(pacFileUrl); } } // else profle.proxy = null profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty(); return profile; } catch (Exception e) { Loading @@ -176,6 +196,13 @@ public class VpnProfile implements Cloneable, Parcelable { builder.append('\0').append(ipsecUserCert); builder.append('\0').append(ipsecCaCert); builder.append('\0').append(ipsecServerCert); if (proxy != null) { builder.append('\0').append(proxy.getHost() != null ? proxy.getHost() : ""); builder.append('\0').append(proxy.getPort()); builder.append('\0').append(proxy.getExclusionListAsString() != null ? proxy.getExclusionListAsString() : ""); builder.append('\0').append(proxy.getPacFileUrl().toString()); } return builder.toString().getBytes(StandardCharsets.UTF_8); } Loading services/core/java/com/android/server/connectivity/Vpn.java +1 −0 Original line number Diff line number Diff line Loading @@ -1840,6 +1840,7 @@ public class Vpn { config.interfaze = iface; config.session = profile.name; config.isMetered = false; config.proxyInfo = profile.proxy; config.addLegacyRoutes(profile.routes); if (!profile.dnsServers.isEmpty()) { Loading Loading
core/java/com/android/internal/net/VpnProfile.java +30 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.internal.net; import android.annotation.UnsupportedAppUsage; import android.os.Build; import android.net.ProxyInfo; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; Loading Loading @@ -46,6 +48,10 @@ public class VpnProfile implements Cloneable, Parcelable { public static final int TYPE_IPSEC_HYBRID_RSA = 5; public static final int TYPE_MAX = 5; // Match these constants with R.array.vpn_proxy_settings. public static final int PROXY_NONE = 0; public static final int PROXY_MANUAL = 1; // Entity fields. @UnsupportedAppUsage public final String key; // -1 Loading @@ -68,6 +74,7 @@ public class VpnProfile implements Cloneable, Parcelable { public String ipsecUserCert = ""; // 12 public String ipsecCaCert = ""; // 13 public String ipsecServerCert = "";// 14 public ProxyInfo proxy = null; // 15~18 // Helper fields. @UnsupportedAppUsage Loading Loading @@ -96,6 +103,7 @@ public class VpnProfile implements Cloneable, Parcelable { ipsecCaCert = in.readString(); ipsecServerCert = in.readString(); saveLogin = in.readInt() != 0; proxy = in.readParcelable(null); } @Override Loading @@ -117,6 +125,7 @@ public class VpnProfile implements Cloneable, Parcelable { out.writeString(ipsecCaCert); out.writeString(ipsecServerCert); out.writeInt(saveLogin ? 1 : 0); out.writeParcelable(proxy, flags); } @UnsupportedAppUsage Loading @@ -127,8 +136,8 @@ public class VpnProfile implements Cloneable, Parcelable { } String[] values = new String(value, StandardCharsets.UTF_8).split("\0", -1); // There can be 14 or 15 values in ICS MR1. if (values.length < 14 || values.length > 15) { // There can be 14 - 19 Bytes in values.length. if (values.length < 14 || values.length > 19) { return null; } Loading @@ -151,7 +160,18 @@ public class VpnProfile implements Cloneable, Parcelable { profile.ipsecUserCert = values[12]; profile.ipsecCaCert = values[13]; profile.ipsecServerCert = (values.length > 14) ? values[14] : ""; if (values.length > 15) { String host = (values.length > 15) ? values[15] : ""; String port = (values.length > 16) ? values[16] : ""; String exclList = (values.length > 17) ? values[17] : ""; String pacFileUrl = (values.length > 18) ? values[18] : ""; if (pacFileUrl.isEmpty()) { profile.proxy = new ProxyInfo(host, port.isEmpty() ? 0 : Integer.parseInt(port), exclList); } else { profile.proxy = new ProxyInfo(pacFileUrl); } } // else profle.proxy = null profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty(); return profile; } catch (Exception e) { Loading @@ -176,6 +196,13 @@ public class VpnProfile implements Cloneable, Parcelable { builder.append('\0').append(ipsecUserCert); builder.append('\0').append(ipsecCaCert); builder.append('\0').append(ipsecServerCert); if (proxy != null) { builder.append('\0').append(proxy.getHost() != null ? proxy.getHost() : ""); builder.append('\0').append(proxy.getPort()); builder.append('\0').append(proxy.getExclusionListAsString() != null ? proxy.getExclusionListAsString() : ""); builder.append('\0').append(proxy.getPacFileUrl().toString()); } return builder.toString().getBytes(StandardCharsets.UTF_8); } Loading
services/core/java/com/android/server/connectivity/Vpn.java +1 −0 Original line number Diff line number Diff line Loading @@ -1840,6 +1840,7 @@ public class Vpn { config.interfaze = iface; config.session = profile.name; config.isMetered = false; config.proxyInfo = profile.proxy; config.addLegacyRoutes(profile.routes); if (!profile.dnsServers.isEmpty()) { Loading