Loading core/java/android/net/ProxyProperties.java +5 −2 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public class ProxyProperties implements Parcelable { // If PAC URL is present in either then they must be equal. // Other parameters will only be for fall back. if (!TextUtils.isEmpty(mPacFileUrl)) { return mPacFileUrl.equals(p.getPacFileUrl()); return mPacFileUrl.equals(p.getPacFileUrl()) && mPort == p.mPort; } if (!TextUtils.isEmpty(p.getPacFileUrl())) { return false; Loading Loading @@ -219,6 +219,7 @@ public class ProxyProperties implements Parcelable { if (mPacFileUrl != null) { dest.writeByte((byte)1); dest.writeString(mPacFileUrl); dest.writeInt(mPort); return; } else { dest.writeByte((byte)0); Loading @@ -244,7 +245,9 @@ public class ProxyProperties implements Parcelable { String host = null; int port = 0; if (in.readByte() != 0) { return new ProxyProperties(in.readString()); String url = in.readString(); int localPort = in.readInt(); return new ProxyProperties(url, localPort); } if (in.readByte() != 0) { host = in.readString(); Loading services/java/com/android/server/ConnectivityService.java +10 −1 Original line number Diff line number Diff line Loading @@ -353,6 +353,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { */ private static final int EVENT_SAMPLE_INTERVAL_ELAPSED = 15; /** * PAC manager has received new port. */ private static final int EVENT_PROXY_HAS_CHANGED = 16; /** Handler used for internal events. */ private InternalHandler mHandler; /** Handler used for incoming {@link NetworkStateTracker} events. */ Loading Loading @@ -679,7 +684,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { }, new IntentFilter(filter)); mPacManager = new PacManager(mContext); mPacManager = new PacManager(mContext, mHandler, EVENT_PROXY_HAS_CHANGED); filter = new IntentFilter(); filter.addAction(CONNECTED_TO_PROVISIONING_NETWORK_ACTION); Loading Loading @@ -3124,6 +3129,10 @@ public class ConnectivityService extends IConnectivityManager.Stub { handleNetworkSamplingTimeout(); break; } case EVENT_PROXY_HAS_CHANGED: { handleApplyDefaultProxy((ProxyProperties)msg.obj); break; } } } } Loading services/java/com/android/server/connectivity/PacManager.java +12 −11 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.ServiceConnection; import android.net.Proxy; import android.net.ProxyProperties; import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; Loading Loading @@ -89,6 +90,9 @@ public class PacManager { private boolean mHasSentBroadcast; private boolean mHasDownloaded; private Handler mConnectivityHandler; private int mProxyMessage; /** * Used for locking when setting mProxyService and all references to mPacUrl or mCurrentPac. */ Loading Loading @@ -128,7 +132,7 @@ public class PacManager { } } public PacManager(Context context) { public PacManager(Context context, Handler handler, int proxyMessage) { mContext = context; mLastPort = -1; Loading @@ -136,6 +140,8 @@ public class PacManager { context, 0, new Intent(ACTION_PAC_REFRESH), 0); context.registerReceiver(new PacRefreshIntentReceiver(), new IntentFilter(ACTION_PAC_REFRESH)); mConnectivityHandler = handler; mProxyMessage = proxyMessage; } private AlarmManager getAlarmManager() { Loading @@ -156,6 +162,10 @@ public class PacManager { */ public synchronized boolean setCurrentProxyScriptUrl(ProxyProperties proxy) { if (!TextUtils.isEmpty(proxy.getPacFileUrl())) { if (proxy.getPacFileUrl().equals(mPacUrl)) { // Allow to send broadcast, nothing to do. return false; } synchronized (mProxyLock) { mPacUrl = proxy.getPacFileUrl(); } Loading Loading @@ -356,16 +366,7 @@ public class PacManager { } private void sendPacBroadcast(ProxyProperties proxy) { Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.putExtra(Proxy.EXTRA_PROXY_INFO, proxy); final long ident = Binder.clearCallingIdentity(); try { mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } finally { Binder.restoreCallingIdentity(ident); } mConnectivityHandler.sendMessage(mConnectivityHandler.obtainMessage(mProxyMessage, proxy)); } private synchronized void sendProxyIfNeeded() { Loading Loading
core/java/android/net/ProxyProperties.java +5 −2 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public class ProxyProperties implements Parcelable { // If PAC URL is present in either then they must be equal. // Other parameters will only be for fall back. if (!TextUtils.isEmpty(mPacFileUrl)) { return mPacFileUrl.equals(p.getPacFileUrl()); return mPacFileUrl.equals(p.getPacFileUrl()) && mPort == p.mPort; } if (!TextUtils.isEmpty(p.getPacFileUrl())) { return false; Loading Loading @@ -219,6 +219,7 @@ public class ProxyProperties implements Parcelable { if (mPacFileUrl != null) { dest.writeByte((byte)1); dest.writeString(mPacFileUrl); dest.writeInt(mPort); return; } else { dest.writeByte((byte)0); Loading @@ -244,7 +245,9 @@ public class ProxyProperties implements Parcelable { String host = null; int port = 0; if (in.readByte() != 0) { return new ProxyProperties(in.readString()); String url = in.readString(); int localPort = in.readInt(); return new ProxyProperties(url, localPort); } if (in.readByte() != 0) { host = in.readString(); Loading
services/java/com/android/server/ConnectivityService.java +10 −1 Original line number Diff line number Diff line Loading @@ -353,6 +353,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { */ private static final int EVENT_SAMPLE_INTERVAL_ELAPSED = 15; /** * PAC manager has received new port. */ private static final int EVENT_PROXY_HAS_CHANGED = 16; /** Handler used for internal events. */ private InternalHandler mHandler; /** Handler used for incoming {@link NetworkStateTracker} events. */ Loading Loading @@ -679,7 +684,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { }, new IntentFilter(filter)); mPacManager = new PacManager(mContext); mPacManager = new PacManager(mContext, mHandler, EVENT_PROXY_HAS_CHANGED); filter = new IntentFilter(); filter.addAction(CONNECTED_TO_PROVISIONING_NETWORK_ACTION); Loading Loading @@ -3124,6 +3129,10 @@ public class ConnectivityService extends IConnectivityManager.Stub { handleNetworkSamplingTimeout(); break; } case EVENT_PROXY_HAS_CHANGED: { handleApplyDefaultProxy((ProxyProperties)msg.obj); break; } } } } Loading
services/java/com/android/server/connectivity/PacManager.java +12 −11 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.ServiceConnection; import android.net.Proxy; import android.net.ProxyProperties; import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; Loading Loading @@ -89,6 +90,9 @@ public class PacManager { private boolean mHasSentBroadcast; private boolean mHasDownloaded; private Handler mConnectivityHandler; private int mProxyMessage; /** * Used for locking when setting mProxyService and all references to mPacUrl or mCurrentPac. */ Loading Loading @@ -128,7 +132,7 @@ public class PacManager { } } public PacManager(Context context) { public PacManager(Context context, Handler handler, int proxyMessage) { mContext = context; mLastPort = -1; Loading @@ -136,6 +140,8 @@ public class PacManager { context, 0, new Intent(ACTION_PAC_REFRESH), 0); context.registerReceiver(new PacRefreshIntentReceiver(), new IntentFilter(ACTION_PAC_REFRESH)); mConnectivityHandler = handler; mProxyMessage = proxyMessage; } private AlarmManager getAlarmManager() { Loading @@ -156,6 +162,10 @@ public class PacManager { */ public synchronized boolean setCurrentProxyScriptUrl(ProxyProperties proxy) { if (!TextUtils.isEmpty(proxy.getPacFileUrl())) { if (proxy.getPacFileUrl().equals(mPacUrl)) { // Allow to send broadcast, nothing to do. return false; } synchronized (mProxyLock) { mPacUrl = proxy.getPacFileUrl(); } Loading Loading @@ -356,16 +366,7 @@ public class PacManager { } private void sendPacBroadcast(ProxyProperties proxy) { Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.putExtra(Proxy.EXTRA_PROXY_INFO, proxy); final long ident = Binder.clearCallingIdentity(); try { mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } finally { Binder.restoreCallingIdentity(ident); } mConnectivityHandler.sendMessage(mConnectivityHandler.obtainMessage(mProxyMessage, proxy)); } private synchronized void sendProxyIfNeeded() { Loading