Bug fixed: close() should not change value of mUserDisconnected flag

In case of an error it may happen that the service is destroyed (and
will call close()) before the onConnectionChange(..) callback finishes.
By setting this flag to false in close() the onLinklossOccur callback
may be called instead of onDeviceDisconnected.
This commit is contained in:
Aleksander Nowakowski
2016-10-06 11:45:45 +02:00
parent a026f6d399
commit f055bfbd0c

View File

@@ -155,7 +155,6 @@ public abstract class BleManager<E extends BleManagerCallbacks> {
public BleManager(final Context context) { public BleManager(final Context context) {
mContext = context; mContext = context;
mHandler = new Handler(); mHandler = new Handler();
mUserDisconnected = false;
// Register bonding broadcast receiver // Register bonding broadcast receiver
context.registerReceiver(mBondingBroadcastReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED)); context.registerReceiver(mBondingBroadcastReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
@@ -256,7 +255,6 @@ public abstract class BleManager<E extends BleManagerCallbacks> {
mBluetoothGatt = null; mBluetoothGatt = null;
} }
mBluetoothDevice = null; mBluetoothDevice = null;
mUserDisconnected = false;
} }
} }