diff options
author | Jason Monk <jmonk@google.com> | 2013-08-21 15:57:30 -0400 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2013-08-22 16:33:26 -0400 |
commit | da205a749fadb3a87357d9bd607f094c7717764a (patch) | |
tree | 659b1785d4fb97c342b72cd54f1a602107c56b2a /services/java/com/android | |
parent | 6b223c6a5be788ca28d5d911ab10650be673684b (diff) | |
download | frameworks_base-da205a749fadb3a87357d9bd607f094c7717764a.zip frameworks_base-da205a749fadb3a87357d9bd607f094c7717764a.tar.gz frameworks_base-da205a749fadb3a87357d9bd607f094c7717764a.tar.bz2 |
System binds PAC Local Proxy instead of self start
The PAC Local Proxy priviously caught proxy broadcasts and started itself
when needed. Now it is bound by the system the same way the pac processing
service is started.
Bug: 10425091
Change-Id: I746daa21645a11aa18ef464f00c8cb5536d8c86f
Diffstat (limited to 'services/java/com/android')
-rw-r--r-- | services/java/com/android/server/connectivity/PacManager.java | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/services/java/com/android/server/connectivity/PacManager.java b/services/java/com/android/server/connectivity/PacManager.java index 0b68ff5..c8cc85e 100644 --- a/services/java/com/android/server/connectivity/PacManager.java +++ b/services/java/com/android/server/connectivity/PacManager.java @@ -48,10 +48,12 @@ import java.net.URLConnection; * @hide */ public class PacManager { - public static final String PROXY_PACKAGE = "com.android.pacprocessor"; - public static final String PROXY_SERVICE = "com.android.pacprocessor.PacService"; - public static final String PROXY_SERVICE_NAME = "com.android.net.IProxyService"; + public static final String PAC_PACKAGE = "com.android.pacprocessor"; + public static final String PAC_SERVICE = "com.android.pacprocessor.PacService"; + public static final String PAC_SERVICE_NAME = "com.android.net.IProxyService"; + public static final String PROXY_PACKAGE = "com.android.proxyhandler"; + public static final String PROXY_SERVICE = "com.android.proxyhandler.ProxyService"; private static final String TAG = "PacManager"; @@ -73,6 +75,7 @@ public class PacManager { private IProxyService mProxyService; private PendingIntent mPacRefreshIntent; private ServiceConnection mConnection; + private ServiceConnection mProxyConnection; private Context mContext; private int mCurrentDelay; @@ -229,7 +232,7 @@ public class PacManager { return; } Intent intent = new Intent(); - intent.setClassName(PROXY_PACKAGE, PROXY_SERVICE); + intent.setClassName(PAC_PACKAGE, PAC_SERVICE); mConnection = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName component) { @@ -242,12 +245,12 @@ public class PacManager { public void onServiceConnected(ComponentName component, IBinder binder) { synchronized (mProxyLock) { try { - Log.d(TAG, "Adding service " + PROXY_SERVICE_NAME + " " + Log.d(TAG, "Adding service " + PAC_SERVICE_NAME + " " + binder.getInterfaceDescriptor()); } catch (RemoteException e1) { Log.e(TAG, "Remote Exception", e1); } - ServiceManager.addService(PROXY_SERVICE_NAME, binder); + ServiceManager.addService(PAC_SERVICE_NAME, binder); mProxyService = IProxyService.Stub.asInterface(binder); if (mProxyService == null) { Log.e(TAG, "No proxy service"); @@ -262,13 +265,27 @@ public class PacManager { } } }; - Log.e(TAG, "Attempting to bind"); mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND | Context.BIND_NOT_VISIBLE); + + intent = new Intent(); + intent.setClassName(PROXY_PACKAGE, PROXY_SERVICE); + mProxyConnection = new ServiceConnection() { + @Override + public void onServiceDisconnected(ComponentName component) { + } + + @Override + public void onServiceConnected(ComponentName component, IBinder binder) { + } + }; + mContext.bindService(intent, mProxyConnection, + Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND | Context.BIND_NOT_VISIBLE); } private void unbind() { mContext.unbindService(mConnection); + mContext.unbindService(mProxyConnection); mConnection = null; } } |