Merge "Replace Proxy hidden constants and methods usages"

This commit is contained in:
Chiachang Wang
2021-02-08 10:27:05 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 10 deletions

View File

@@ -23,7 +23,6 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.Proxy;
import android.net.ProxyInfo;
import android.os.Bundle;
import android.text.Selection;
@@ -186,18 +185,18 @@ public class ProxySelector extends InstrumentedFragment implements DialogCreatab
* @return 0 on success, string resource ID on failure
*/
public static int validate(String hostname, String port, String exclList) {
switch (Proxy.validate(hostname, port, exclList)) {
case Proxy.PROXY_VALID:
switch (ProxyUtils.validate(hostname, port, exclList)) {
case ProxyUtils.PROXY_VALID:
return 0;
case Proxy.PROXY_HOSTNAME_EMPTY:
case ProxyUtils.PROXY_HOSTNAME_EMPTY:
return R.string.proxy_error_empty_host_set_port;
case Proxy.PROXY_HOSTNAME_INVALID:
case ProxyUtils.PROXY_HOSTNAME_INVALID:
return R.string.proxy_error_invalid_host;
case Proxy.PROXY_PORT_EMPTY:
case ProxyUtils.PROXY_PORT_EMPTY:
return R.string.proxy_error_empty_port;
case Proxy.PROXY_PORT_INVALID:
case ProxyUtils.PROXY_PORT_INVALID:
return R.string.proxy_error_invalid_port;
case Proxy.PROXY_EXCLLIST_INVALID:
case ProxyUtils.PROXY_EXCLLIST_INVALID:
return R.string.proxy_error_invalid_exclusion_list;
default:
// should neven happen

View File

@@ -21,7 +21,6 @@ import static com.android.internal.net.VpnProfile.isLegacyType;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.net.Proxy;
import android.net.ProxyInfo;
import android.os.Bundle;
import android.os.SystemProperties;
@@ -41,6 +40,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.android.internal.net.VpnProfile;
import com.android.net.module.util.ProxyUtils;
import com.android.settings.R;
import java.net.InetAddress;
@@ -637,7 +637,7 @@ class ConfigDialog extends AlertDialog implements TextWatcher,
final String host = mProxyHost.getText().toString().trim();
final String port = mProxyPort.getText().toString().trim();
return Proxy.validate(host, port, "") == Proxy.PROXY_VALID;
return ProxyUtils.validate(host, port, "") == ProxyUtils.PROXY_VALID;
}
}