am bf857065: Merge "Support multiple calls to AsyncChannel.disconnect"
* commit 'bf857065afa38bb55b370a6b4e38b4703d22376d': Support multiple calls to AsyncChannel.disconnect
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user