Merge "BluetoothProfileConnecter now calls the ServiceListener's onServiceDisconnected method after unbinding the service" into rvc-dev am: 248896bf98 am: d3d0f2a76d am: f0f934cb98
Change-Id: Ib2912605109d9f0660e2d2e1e0247a32a189343a
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user