diff options
author | 2020-05-03 05:20:48 +0000 | |
---|---|---|
committer | 2020-05-03 05:20:48 +0000 | |
commit | 248896bf982c7748592f603d87d34f7ddc3de96d (patch) | |
tree | 535903103fefe29d96986cc9a4d3aa284901177f | |
parent | ed2789354a437ac39c1b0f17c12d328ce7dc302a (diff) | |
parent | ee31c78cb89dad69a6da6a79f35ac1b245773b50 (diff) |
Merge "BluetoothProfileConnecter now calls the ServiceListener's onServiceDisconnected method after unbinding the service" into rvc-dev
-rw-r--r-- | core/java/android/bluetooth/BluetoothProfileConnector.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/core/java/android/bluetooth/BluetoothProfileConnector.java b/core/java/android/bluetooth/BluetoothProfileConnector.java index 863fd3698cbd..040f58ae4863 100644 --- a/core/java/android/bluetooth/BluetoothProfileConnector.java +++ b/core/java/android/bluetooth/BluetoothProfileConnector.java @@ -103,14 +103,21 @@ public abstract class BluetoothProfileConnector<T> { private void doUnbind() { synchronized (mConnection) { - if (mService != null) { - logDebug("Unbinding service..."); - try { - mContext.unbindService(mConnection); - } catch (IllegalArgumentException ie) { - logError("Unable to unbind service: " + ie); - } finally { - mService = null; + try { + if (mService != null) { + logDebug("Unbinding service..."); + try { + mContext.unbindService(mConnection); + } catch (IllegalArgumentException ie) { + logError("Unable to unbind service: " + ie); + } finally { + mService = null; + } + } + } finally { + if (mServiceListener != null) { + mServiceListener.onServiceDisconnected(mProfileId); + mServiceListener = null; } } } @@ -131,7 +138,6 @@ public abstract class BluetoothProfileConnector<T> { } void disconnect() { - mServiceListener = null; IBluetoothManager mgr = BluetoothAdapter.getDefaultAdapter().getBluetoothManager(); if (mgr != null) { try { |