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

Commit b7fbb9b6 authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Support multiple calls to AsyncChannel.disconnect

prior to this you'd get a crash if you called it twice.

Change-Id: Ie066b1e00970e17b2ebab5c51a57a9a3459aee26
parent 54257654
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -450,6 +450,7 @@ public class AsyncChannel {
    public void disconnect() {
        if ((mConnection != null) && (mSrcContext != null)) {
            mSrcContext.unbindService(mConnection);
            mConnection = null;
        }
        try {
            // Send the DISCONNECTED, although it may not be received
@@ -463,10 +464,12 @@ public class AsyncChannel {
        // Tell source we're disconnected.
        if (mSrcHandler != null) {
            replyDisconnected(STATUS_SUCCESSFUL);
            mSrcHandler = null;
        }
        // Unlink only when bindService isn't used
        if (mConnection == null && mDstMessenger != null && mDeathMonitor!= null) {
            mDstMessenger.getBinder().unlinkToDeath(mDeathMonitor, 0);
            mDeathMonitor = null;
        }
    }