Merge "BluetoothProfileConnecter now calls the ServiceListener's onServiceDisconnected method after unbinding the service" into rvc-dev am: 248896bf98

Change-Id: I4d661b90c146c389679d5e241d3cc8e2c76e00a7
This commit is contained in:
Rahul Sabnis
2020-05-03 05:32:58 +00:00
committed by Automerger Merge Worker

View File

@@ -103,14 +103,21 @@ public abstract class BluetoothProfileConnector<T> {
private void doUnbind() { private void doUnbind() {
synchronized (mConnection) { synchronized (mConnection) {
if (mService != null) { try {
logDebug("Unbinding service..."); if (mService != null) {
try { logDebug("Unbinding service...");
mContext.unbindService(mConnection); try {
} catch (IllegalArgumentException ie) { mContext.unbindService(mConnection);
logError("Unable to unbind service: " + ie); } catch (IllegalArgumentException ie) {
} finally { logError("Unable to unbind service: " + ie);
mService = null; } finally {
mService = null;
}
}
} finally {
if (mServiceListener != null) {
mServiceListener.onServiceDisconnected(mProfileId);
mServiceListener = null;
} }
} }
} }
@@ -131,7 +138,6 @@ public abstract class BluetoothProfileConnector<T> {
} }
void disconnect() { void disconnect() {
mServiceListener = null;
IBluetoothManager mgr = BluetoothAdapter.getDefaultAdapter().getBluetoothManager(); IBluetoothManager mgr = BluetoothAdapter.getDefaultAdapter().getBluetoothManager();
if (mgr != null) { if (mgr != null) {
try { try {