Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb38966f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "BASS: Fix unable to disconnect from settings"

parents c92e13f3 6ec66047
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ public class BassClientStateMachine extends StateMachine {
    private boolean mForceSB = false;
    private int mBroadcastSourceIdLength = 3;
    private byte mNextSourceId = 0;
    private boolean mAllowReconnect = false;

    BluetoothGatt mBluetoothGatt = null;
    BluetoothGattCallback mGattCallback = null;
@@ -1080,7 +1081,7 @@ public class BassClientStateMachine extends StateMachine {
                        mDevice, mLastConnectionState, BluetoothProfile.STATE_DISCONNECTED);
                if (mLastConnectionState != BluetoothProfile.STATE_DISCONNECTED) {
                    // Reconnect in background if not disallowed by the service
                    if (mService.okToConnect(mDevice)) {
                    if (mService.okToConnect(mDevice) && mAllowReconnect) {
                        connectGatt(false);
                    }
                }
@@ -1107,6 +1108,7 @@ public class BassClientStateMachine extends StateMachine {
                        mBluetoothGatt.close();
                        mBluetoothGatt = null;
                    }
                    mAllowReconnect = true;
                    if (connectGatt(mIsAllowedList)) {
                        transitionTo(mConnecting);
                    } else {
@@ -1115,6 +1117,7 @@ public class BassClientStateMachine extends StateMachine {
                    break;
                case DISCONNECT:
                    // Disconnect if there's an ongoing background connection
                    mAllowReconnect = false;
                    if (mBluetoothGatt != null) {
                        log("Cancelling the background connection to " + mDevice);
                        mBluetoothGatt.disconnect();
@@ -1473,6 +1476,7 @@ public class BassClientStateMachine extends StateMachine {
                    break;
                case DISCONNECT:
                    log("Disconnecting from " + mDevice);
                    mAllowReconnect = false;
                    if (mBluetoothGatt != null) {
                        mBluetoothGatt.disconnect();
                        mBluetoothGatt.close();
@@ -1735,6 +1739,7 @@ public class BassClientStateMachine extends StateMachine {
                    break;
                case DISCONNECT:
                    Log.w(TAG, "DISCONNECT requested!: " + mDevice);
                    mAllowReconnect = false;
                    if (mBluetoothGatt != null) {
                        mBluetoothGatt.disconnect();
                        mBluetoothGatt.close();