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

Commit 410abb41 authored by Rongxuan Liu's avatar Rongxuan Liu
Browse files

[le audio] Fix bass client disconnection issues when connection state changed

For remote disconnection, close gatt properly.
And fix one background gatt connect issue.

Bug: 290411681
Tag: #bug
Test: atest BassClientStateMachineTest
Change-Id: Iab4861671d256808a1da5fc8179eaa1b6abed299
parent 4f3c7a98
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1192,7 +1192,7 @@ public class BassClientStateMachine extends StateMachine {
                if (mLastConnectionState != BluetoothProfile.STATE_DISCONNECTED) {
                    // Reconnect in background if not disallowed by the service
                    if (mService.okToConnect(mDevice) && mAllowReconnect) {
                        connectGatt(false);
                        connectGatt(true);
                    }
                }
            }
@@ -1588,6 +1588,11 @@ public class BassClientStateMachine extends StateMachine {
                        Log.w(TAG, "device is already connected to Bass" + mDevice);
                    } else {
                        Log.w(TAG, "unexpected disconnected from " + mDevice);
                        // cleanup mBluetoothGatt
                        if (mBluetoothGatt != null) {
                            mBluetoothGatt.close();
                            mBluetoothGatt = null;
                        }
                        cancelActiveSync(null);
                        transitionTo(mDisconnected);
                    }