Rename PacManager to PacProxyInstaller
Generally, a manager class in Android is used to access system services and it should be obtained from Context. This class is a bit different from the definition of a manager class. API linter will detect an error if trying to expose a class name end with Manager. ProxyTracker will create a new instance of this class so this class needs to be renamed to avoid API lint error. Bug: 177035719 Test: FrameworksNetTests Change-Id: I9185d4fb4342bd285a575f0bdd3518b758f37eb6
This commit is contained in:
@@ -127,7 +127,7 @@ public class ProxyInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used in PacManager after Local Proxy is bound.
|
||||
* Only used in PacProxyInstaller after Local Proxy is bound.
|
||||
* @hide
|
||||
*/
|
||||
public ProxyInfo(@NonNull Uri pacFileUrl, int localProxyPort) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018, The Android Open Source Project
|
||||
* Copyright (c) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,7 +67,7 @@ public class ProxyTracker {
|
||||
// is not set. Individual networks have their own settings that override this. This member
|
||||
// is set through setDefaultProxy, which is called when the default network changes proxies
|
||||
// in its LinkProperties, or when ConnectivityService switches to a new default network, or
|
||||
// when PacManager resolves the proxy.
|
||||
// when PacProxyInstaller resolves the proxy.
|
||||
@Nullable
|
||||
@GuardedBy("mProxyLock")
|
||||
private volatile ProxyInfo mDefaultProxy = null;
|
||||
@@ -79,13 +79,14 @@ public class ProxyTracker {
|
||||
|
||||
// The object responsible for Proxy Auto Configuration (PAC).
|
||||
@NonNull
|
||||
private final PacManager mPacManager;
|
||||
private final PacProxyInstaller mPacProxyInstaller;
|
||||
|
||||
public ProxyTracker(@NonNull final Context context,
|
||||
@NonNull final Handler connectivityServiceInternalHandler, final int pacChangedEvent) {
|
||||
mContext = context;
|
||||
mConnectivityServiceHandler = connectivityServiceInternalHandler;
|
||||
mPacManager = new PacManager(context, connectivityServiceInternalHandler, pacChangedEvent);
|
||||
mPacProxyInstaller = new PacProxyInstaller(
|
||||
context, connectivityServiceInternalHandler, pacChangedEvent);
|
||||
}
|
||||
|
||||
// Convert empty ProxyInfo's to null as null-checks are used to determine if proxies are present
|
||||
@@ -181,7 +182,7 @@ public class ProxyTracker {
|
||||
|
||||
if (!TextUtils.isEmpty(pacFileUrl)) {
|
||||
mConnectivityServiceHandler.post(
|
||||
() -> mPacManager.setCurrentProxyScriptUrl(proxyProperties));
|
||||
() -> mPacProxyInstaller.setCurrentProxyScriptUrl(proxyProperties));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +226,9 @@ public class ProxyTracker {
|
||||
final ProxyInfo defaultProxy = getDefaultProxy();
|
||||
final ProxyInfo proxyInfo = null != defaultProxy ?
|
||||
defaultProxy : ProxyInfo.buildDirectProxy("", 0, Collections.emptyList());
|
||||
if (mPacManager.setCurrentProxyScriptUrl(proxyInfo) == PacManager.DONT_SEND_BROADCAST) {
|
||||
|
||||
if (mPacProxyInstaller.setCurrentProxyScriptUrl(proxyInfo)
|
||||
== PacProxyInstaller.DONT_SEND_BROADCAST) {
|
||||
return;
|
||||
}
|
||||
if (DBG) Log.d(TAG, "sending Proxy Broadcast for " + proxyInfo);
|
||||
@@ -305,10 +308,10 @@ public class ProxyTracker {
|
||||
return;
|
||||
}
|
||||
|
||||
// This call could be coming from the PacManager, containing the port of the local
|
||||
// proxy. If this new proxy matches the global proxy then copy this proxy to the
|
||||
// This call could be coming from the PacProxyInstaller, containing the port of the
|
||||
// local proxy. If this new proxy matches the global proxy then copy this proxy to the
|
||||
// global (to get the correct local port), and send a broadcast.
|
||||
// TODO: Switch PacManager to have its own message to send back rather than
|
||||
// TODO: Switch PacProxyInstaller to have its own message to send back rather than
|
||||
// reusing EVENT_HAS_CHANGED_PROXY and this call to handleApplyDefaultProxy.
|
||||
if ((mGlobalProxy != null) && (proxyInfo != null)
|
||||
&& (!Uri.EMPTY.equals(proxyInfo.getPacFileUrl()))
|
||||
|
||||
Reference in New Issue
Block a user