Replace the hidden ProxyInfo methods usage
The hidden ProxyInfo methods usage should be replaced because
ProxyInfo is moving to connectivity mainline module. Setting
will not be able to access it. Replace the usage with
corresponding APIs.
Bug: 172183305
Test: make RunSettingsRoboTests ROBOTEST_FILTER=\
com.android.settings.wifi.WifiConfigControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=\
com.android.settings.wifi.WifiConfigController2Test
Test: manually update proxy from setting and check the result
Change-Id: I59192d0d5d38c833eb83cc930e358a738ebe3d13
diff --git a/src/com/android/settings/ProxySelector.java b/src/com/android/settings/ProxySelector.java
index a685841..57d3c6a 100644
--- a/src/com/android/settings/ProxySelector.java
+++ b/src/com/android/settings/ProxySelector.java
@@ -44,6 +44,8 @@
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
import com.android.settings.core.InstrumentedFragment;
+import java.util.Arrays;
+
public class ProxySelector extends InstrumentedFragment implements DialogCreatable {
private static final String TAG = "ProxySelector";
@@ -229,7 +231,9 @@
return false;
}
}
- ProxyInfo p = new ProxyInfo(hostname, port, exclList);
+
+ ProxyInfo p = ProxyInfo.buildDirectProxy(
+ hostname, port, Arrays.asList(exclList.split(",")));
// FIXME: The best solution would be to make a better UI that would
// disable editing of the text boxes if the user chooses to use the
// default settings. i.e. checking a box to always use the default
diff --git a/src/com/android/settings/vpn2/ConfigDialog.java b/src/com/android/settings/vpn2/ConfigDialog.java
index 42bc67d..03e3613 100644
--- a/src/com/android/settings/vpn2/ConfigDialog.java
+++ b/src/com/android/settings/vpn2/ConfigDialog.java
@@ -592,7 +592,7 @@
// 0 is a last resort default, but the interface validates that the proxy port is
// present and non-zero.
int port = proxyPort.isEmpty() ? 0 : Integer.parseInt(proxyPort);
- profile.proxy = new ProxyInfo(proxyHost, port, null);
+ profile.proxy = ProxyInfo.buildDirectProxy(proxyHost, port);
} else {
profile.proxy = null;
}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 8086668..f6fda6d 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -83,6 +83,7 @@
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -878,7 +879,8 @@
result = R.string.proxy_error_invalid_port;
}
if (result == 0) {
- mHttpProxy = new ProxyInfo(host, port, exclusionList);
+ mHttpProxy = ProxyInfo.buildDirectProxy(
+ host, port, Arrays.asList(exclusionList.split(",")));
} else {
return false;
}
@@ -892,7 +894,7 @@
if (uri == null) {
return false;
}
- mHttpProxy = new ProxyInfo(uri);
+ mHttpProxy = ProxyInfo.buildPacProxy(uri);
}
return true;
}
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index 0ba9543..06fbc88 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -83,6 +83,7 @@
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -860,7 +861,8 @@
result = R.string.proxy_error_invalid_port;
}
if (result == 0) {
- mHttpProxy = new ProxyInfo(host, port, exclusionList);
+ mHttpProxy = ProxyInfo.buildDirectProxy(
+ host, port, Arrays.asList(exclusionList.split(",")));
} else {
return false;
}
@@ -874,7 +876,7 @@
if (uri == null) {
return false;
}
- mHttpProxy = new ProxyInfo(uri);
+ mHttpProxy = ProxyInfo.buildPacProxy(uri);
}
return true;
}