[PT04] Move PacManager into ProxyTracker.
Test: runtest Change-Id: I45d22857459fe1746d484ac04f8d5cd81fc61835
This commit is contained in:
@@ -429,9 +429,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
|
||||
// A helper object to track the current default HTTP proxy. ConnectivityService needs to tell
|
||||
// the world when it changes.
|
||||
private final ProxyTracker mProxyTracker = new ProxyTracker();
|
||||
|
||||
private PacManager mPacManager = null;
|
||||
private final ProxyTracker mProxyTracker;
|
||||
|
||||
final private SettingsObserver mSettingsObserver;
|
||||
|
||||
@@ -730,6 +728,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
mPolicyManagerInternal = checkNotNull(
|
||||
LocalServices.getService(NetworkPolicyManagerInternal.class),
|
||||
"missing NetworkPolicyManagerInternal");
|
||||
mProxyTracker = new ProxyTracker(context, mHandler, EVENT_PROXY_HAS_CHANGED);
|
||||
|
||||
mKeyStore = KeyStore.getInstance();
|
||||
mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
@@ -840,8 +839,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
final DataConnectionStats dataConnectionStats = new DataConnectionStats(mContext);
|
||||
dataConnectionStats.startMonitoring();
|
||||
|
||||
mPacManager = new PacManager(mContext, mHandler, EVENT_PROXY_HAS_CHANGED);
|
||||
|
||||
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
|
||||
mKeepaliveTracker = new KeepaliveTracker(mHandler);
|
||||
@@ -3454,7 +3451,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
|
||||
private void sendProxyBroadcast(ProxyInfo proxy) {
|
||||
if (proxy == null) proxy = new ProxyInfo("", 0, "");
|
||||
if (mPacManager.setCurrentProxyScriptUrl(proxy)) return;
|
||||
if (mProxyTracker.setCurrentProxyScriptUrl(proxy)) return;
|
||||
if (DBG) log("sending Proxy Broadcast for " + proxy);
|
||||
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING |
|
||||
|
||||
@@ -18,8 +18,10 @@ package com.android.server.connectivity;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.net.ProxyInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
@@ -45,6 +47,14 @@ public class ProxyTracker {
|
||||
@GuardedBy("mProxyLock")
|
||||
public boolean mDefaultProxyDisabled = false;
|
||||
|
||||
@NonNull
|
||||
private final PacManager mPacManager;
|
||||
|
||||
public ProxyTracker(@NonNull final Context context,
|
||||
@NonNull final Handler connectivityServiceInternalHandler, final int pacChangedEvent) {
|
||||
mPacManager = new PacManager(context, connectivityServiceInternalHandler, pacChangedEvent);
|
||||
}
|
||||
|
||||
// Convert empty ProxyInfo's to null as null-checks are used to determine if proxies are present
|
||||
// (e.g. if mGlobalProxy==null fall back to network-specific proxy, if network-specific
|
||||
// proxy is null then there is no proxy in place).
|
||||
@@ -91,4 +101,8 @@ public class ProxyTracker {
|
||||
return mGlobalProxy;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setCurrentProxyScriptUrl(@NonNull final ProxyInfo proxy) {
|
||||
return mPacManager.setCurrentProxyScriptUrl(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user