0

Floss: use direct connect for initial Gatt connection

Add initial status for Gatt connection and use direct connect for the
first Gatt client connection request.

BUG=b:297629431
TEST=CTSV secure client tests
TEST=Manual test mouse reconnection with LL privacy

Change-Id: If651581ba2ea7103340db81aa1de36fa5ae2329a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5558773
Reviewed-by: Katherine Lai <laikatherine@chromium.org>
Commit-Queue: Zhengping Jiang <jiangzp@google.com>
Reviewed-by: Ying Hsu <yinghsu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1305383}
This commit is contained in:
Zhengping Jiang
2024-05-23 22:56:56 +00:00
committed by Chromium LUCI CQ
parent ee8099b6e4
commit 59f953150d
2 changed files with 6 additions and 2 deletions

@ -657,7 +657,9 @@ void BluetoothDeviceFloss::CreateGattConnectionImpl(
// Generally, the first ever connection to a device should be direct and
// subsequent connections to known devices should be invoked with is_direct =
// false. Refer to |autoConnect| on BluetoothGatt.java.
bool is_direct = !IsBondedImpl();
bool is_direct =
gatt_connecting_state_ == GattConnectingState::kGattConnectionInit ||
!IsBondedImpl();
UpdateGattConnectingState(GattConnectingState::kGattConnecting);

@ -42,6 +42,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceFloss
kGattDisconnected = 0,
kGattConnecting,
kGattConnected,
// Initial state, no prior connection built. Use direct connection.
kGattConnectionInit,
};
enum PropertiesState : uint32_t {
kNotRead = 0,
@ -332,7 +334,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceFloss
// The status of GATT connecting.
GattConnectingState gatt_connecting_state_ =
GattConnectingState::kGattDisconnected;
GattConnectingState::kGattConnectionInit;
// UI thread task runner and socket thread used to create sockets.
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;