Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc018d89 authored by Jason Monk's avatar Jason Monk
Browse files

Fix PacManager to not unbind when no connection

PacManager previously would unbind service even when there was no
connection.  This means that multiple set proxies of no PAC after a PAC was
present would cause the framework to crash.

Bug: 10801296
Change-Id: I4387b50b6510cea3ee73425c8a0a837f816b0ce1
parent fd111c8f
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ public class PacManager {
        Intent intent = new Intent();
        intent.setClassName(PAC_PACKAGE, PAC_SERVICE);
        // Already bound no need to bind again.
        if (mProxyConnection != null) {
        if ((mProxyConnection != null) && (mConnection != null)) {
            if (mLastPort != -1) {
                sendPacBroadcast(new ProxyProperties(mPacUrl, mLastPort));
            } else {
@@ -332,11 +332,16 @@ public class PacManager {
    }

    private void unbind() {
        if (mConnection != null) {
            mContext.unbindService(mConnection);
        mContext.unbindService(mProxyConnection);
            mConnection = null;
        }
        if (mProxyConnection != null) {
            mContext.unbindService(mProxyConnection);
            mProxyConnection = null;
        }
        mProxyService = null;
    }

    private void sendPacBroadcast(ProxyProperties proxy) {
        Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);