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

Commit 10b5bfe8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "BASS: Fix unable to disconnect from settings" into tm-qpr-dev

parents ba88299a a039caaf
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;
@@ -1079,7 +1080,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);
                    }
                }
@@ -1106,6 +1107,7 @@ public class BassClientStateMachine extends StateMachine {
                        mBluetoothGatt.close();
                        mBluetoothGatt = null;
                    }
                    mAllowReconnect = true;
                    if (connectGatt(mIsAllowedList)) {
                        transitionTo(mConnecting);
                    } else {
@@ -1114,6 +1116,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();
@@ -1472,6 +1475,7 @@ public class BassClientStateMachine extends StateMachine {
                    break;
                case DISCONNECT:
                    log("Disconnecting from " + mDevice);
                    mAllowReconnect = false;
                    if (mBluetoothGatt != null) {
                        mBluetoothGatt.disconnect();
                        mBluetoothGatt.close();
@@ -1734,6 +1738,7 @@ public class BassClientStateMachine extends StateMachine {
                    break;
                case DISCONNECT:
                    Log.w(TAG, "DISCONNECT requested!: " + mDevice);
                    mAllowReconnect = false;
                    if (mBluetoothGatt != null) {
                        mBluetoothGatt.disconnect();
                        mBluetoothGatt.close();