Merge "Revert "BluetoothProfileConnecter now calls the ServiceListener'..."" into rvc-dev am: 1c85c4501b

Change-Id: If2434bd41589e2a300654b4cb46c9445242f9476
This commit is contained in:
Hungyen Weng
2020-05-04 07:04:26 +00:00
committed by Automerger Merge Worker

View File

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