From 6cca3d719e7fa20452d0d8fb9cbcab984deda845 Mon Sep 17 00:00:00 2001 From: Aaron Huang Date: Fri, 18 Oct 2019 18:42:19 +0800 Subject: [PATCH] Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri) Update all callers to use ProxyInfo(Uri) and remove ProxyInfo(String). Bug: 160557668 Test: build pass atest FrameworksNetTests Change-Id: I4c980764c8839c48acf03208bb68cd53eb910121 --- core/java/android/net/ProxyInfo.java | 12 ------------ core/java/com/android/internal/net/VpnProfile.java | 3 ++- .../android/server/connectivity/ProxyTracker.java | 2 +- .../java/com/android/server/net/IpConfigStore.java | 3 ++- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/core/java/android/net/ProxyInfo.java b/core/java/android/net/ProxyInfo.java index ffe9ae9521a82..a32b41f6be4be 100644 --- a/core/java/android/net/ProxyInfo.java +++ b/core/java/android/net/ProxyInfo.java @@ -126,18 +126,6 @@ public class ProxyInfo implements Parcelable { mPacFileUrl = pacFileUrl; } - /** - * Create a ProxyProperties that points at a PAC URL. - * @hide - */ - public ProxyInfo(String pacFileUrl) { - mHost = LOCAL_HOST; - mPort = LOCAL_PORT; - mExclusionList = LOCAL_EXCL_LIST; - mParsedExclusionList = parseExclusionList(mExclusionList); - mPacFileUrl = Uri.parse(pacFileUrl); - } - /** * Only used in PacManager after Local Proxy is bound. * @hide diff --git a/core/java/com/android/internal/net/VpnProfile.java b/core/java/com/android/internal/net/VpnProfile.java index 8ea5aa815a1c5..b4727499d8ef4 100644 --- a/core/java/com/android/internal/net/VpnProfile.java +++ b/core/java/com/android/internal/net/VpnProfile.java @@ -21,6 +21,7 @@ import android.compat.annotation.UnsupportedAppUsage; import android.net.Ikev2VpnProfile; import android.net.PlatformVpnProfile; import android.net.ProxyInfo; +import android.net.Uri; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; @@ -287,7 +288,7 @@ public final class VpnProfile implements Cloneable, Parcelable { profile.proxy = new ProxyInfo(host, port.isEmpty() ? 0 : Integer.parseInt(port), exclList); } else if (!pacFileUrl.isEmpty()) { - profile.proxy = new ProxyInfo(pacFileUrl); + profile.proxy = new ProxyInfo(Uri.parse(pacFileUrl)); } } // else profile.proxy = null diff --git a/services/core/java/com/android/server/connectivity/ProxyTracker.java b/services/core/java/com/android/server/connectivity/ProxyTracker.java index e715890fb211d..e92679d6c3948 100644 --- a/services/core/java/com/android/server/connectivity/ProxyTracker.java +++ b/services/core/java/com/android/server/connectivity/ProxyTracker.java @@ -157,7 +157,7 @@ public class ProxyTracker { if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) { ProxyInfo proxyProperties; if (!TextUtils.isEmpty(pacFileUrl)) { - proxyProperties = new ProxyInfo(pacFileUrl); + proxyProperties = new ProxyInfo(Uri.parse(pacFileUrl)); } else { proxyProperties = new ProxyInfo(host, port, exclList); } diff --git a/services/core/java/com/android/server/net/IpConfigStore.java b/services/core/java/com/android/server/net/IpConfigStore.java index e3e02e32ad50c..f0bf5c0975f23 100644 --- a/services/core/java/com/android/server/net/IpConfigStore.java +++ b/services/core/java/com/android/server/net/IpConfigStore.java @@ -24,6 +24,7 @@ import android.net.NetworkUtils; import android.net.ProxyInfo; import android.net.RouteInfo; import android.net.StaticIpConfiguration; +import android.net.Uri; import android.util.ArrayMap; import android.util.Log; import android.util.SparseArray; @@ -372,7 +373,7 @@ public class IpConfigStore { config.httpProxy = proxyInfo; break; case PAC: - ProxyInfo proxyPacProperties = new ProxyInfo(pacFileUrl); + ProxyInfo proxyPacProperties = new ProxyInfo(Uri.parse(pacFileUrl)); config.proxySettings = proxySettings; config.httpProxy = proxyPacProperties; break;