Replace Proxy hidden constants and methods usages
Proxy is a part of incoming connectivity mainline module. The hidden APIs are no longer available outside the module. These shared constants and methods are moving to ProxyUtils insdide net shared lib. Update the corresponding usage in the caller side. Bug: 172183305 Test: atest SettingsRoboTests Change-Id: I2d51442e65dbcdf1a36940d8a25c7571363d56e6
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user