Loading system/bta/le_audio/client.cc +9 −2 Original line number Diff line number Diff line Loading @@ -1909,6 +1909,12 @@ class LeAudioClientImpl : public LeAudioClient { if (!leAudioDevice) return; if (leAudioDevice->conn_id_ != GATT_INVALID_CONN_ID) { LOG_DEBUG("Already connected %s, conn_id=0x%04x", ADDRESS_TO_LOGGABLE_CSTR(address), leAudioDevice->conn_id_); return; } if (status != GATT_SUCCESS) { /* Clear current connection request and let it be set again if needed */ BTA_GATTC_CancelOpen(gatt_if_, address, false); Loading Loading @@ -1947,6 +1953,9 @@ class LeAudioClientImpl : public LeAudioClient { } } leAudioDevice->conn_id_ = conn_id; leAudioDevice->mtu_ = mtu; /* Remove device from the background connect (it might be either Allow list * or TA) and add it again with reconnection_mode_. In case it is TA, we are * sure that device will not be in the allow list for other applications Loading @@ -1972,8 +1981,6 @@ class LeAudioClientImpl : public LeAudioClient { DeviceConnectState::CONNECTED_BY_USER_GETTING_READY); } leAudioDevice->conn_id_ = conn_id; leAudioDevice->mtu_ = mtu; /* Check if the device is in allow list and update the flag */ leAudioDevice->UpdateDeviceAllowlistFlag(); if (BTM_SecIsSecurityPending(address)) { Loading system/bta/le_audio/le_audio_client_test.cc +10 −2 Original line number Diff line number Diff line Loading @@ -4111,6 +4111,7 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { .Times(0); ON_CALL(mock_btm_interface_, BTM_IsEncrypted(test_address1, _)) .WillByDefault(DoAll(Return(true))); EXPECT_CALL(mock_gatt_interface_, Open(gatt_if, test_address1, BTM_BLE_DIRECT_CONNECTION, _)) .Times(0); Loading @@ -4135,6 +4136,7 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { SyncOnMainLoop(); ASSERT_TRUE(LeAudioClient::IsLeAudioClientRunning()); Mock::VerifyAndClearExpectations(&mock_gatt_interface_); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); // Simulate device is not there and phone fallbacks to targeted announcements EXPECT_CALL(mock_gatt_interface_, Loading @@ -4142,8 +4144,8 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { BTM_BLE_BKG_CONNECT_TARGETED_ANNOUNCEMENTS, _)) .Times(1); // Devices not found InjectConnectedEvent(test_address0, 0, GATT_ERROR); // Devices 0 is connected. Disconnect it InjectDisconnectedEvent(1, GATT_CONN_TERMINATE_PEER_USER); SyncOnMainLoop(); Mock::VerifyAndClearExpectations(&mock_gatt_interface_); Loading @@ -4155,6 +4157,12 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { BTM_BLE_BKG_CONNECT_TARGETED_ANNOUNCEMENTS, _)) .Times(1); /* Keep device in Getting Ready state */ ON_CALL(mock_btm_interface_, BTM_IsEncrypted(test_address0, _)) .WillByDefault(DoAll(Return(false))); ON_CALL(mock_btm_interface_, SetEncryption(test_address0, _, _, _, _)) .WillByDefault(Return(BTM_SUCCESS)); /* For background connect, test needs to Inject Connected Event */ InjectConnectedEvent(test_address0, 1); Loading Loading
system/bta/le_audio/client.cc +9 −2 Original line number Diff line number Diff line Loading @@ -1909,6 +1909,12 @@ class LeAudioClientImpl : public LeAudioClient { if (!leAudioDevice) return; if (leAudioDevice->conn_id_ != GATT_INVALID_CONN_ID) { LOG_DEBUG("Already connected %s, conn_id=0x%04x", ADDRESS_TO_LOGGABLE_CSTR(address), leAudioDevice->conn_id_); return; } if (status != GATT_SUCCESS) { /* Clear current connection request and let it be set again if needed */ BTA_GATTC_CancelOpen(gatt_if_, address, false); Loading Loading @@ -1947,6 +1953,9 @@ class LeAudioClientImpl : public LeAudioClient { } } leAudioDevice->conn_id_ = conn_id; leAudioDevice->mtu_ = mtu; /* Remove device from the background connect (it might be either Allow list * or TA) and add it again with reconnection_mode_. In case it is TA, we are * sure that device will not be in the allow list for other applications Loading @@ -1972,8 +1981,6 @@ class LeAudioClientImpl : public LeAudioClient { DeviceConnectState::CONNECTED_BY_USER_GETTING_READY); } leAudioDevice->conn_id_ = conn_id; leAudioDevice->mtu_ = mtu; /* Check if the device is in allow list and update the flag */ leAudioDevice->UpdateDeviceAllowlistFlag(); if (BTM_SecIsSecurityPending(address)) { Loading
system/bta/le_audio/le_audio_client_test.cc +10 −2 Original line number Diff line number Diff line Loading @@ -4111,6 +4111,7 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { .Times(0); ON_CALL(mock_btm_interface_, BTM_IsEncrypted(test_address1, _)) .WillByDefault(DoAll(Return(true))); EXPECT_CALL(mock_gatt_interface_, Open(gatt_if, test_address1, BTM_BLE_DIRECT_CONNECTION, _)) .Times(0); Loading @@ -4135,6 +4136,7 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { SyncOnMainLoop(); ASSERT_TRUE(LeAudioClient::IsLeAudioClientRunning()); Mock::VerifyAndClearExpectations(&mock_gatt_interface_); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); // Simulate device is not there and phone fallbacks to targeted announcements EXPECT_CALL(mock_gatt_interface_, Loading @@ -4142,8 +4144,8 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { BTM_BLE_BKG_CONNECT_TARGETED_ANNOUNCEMENTS, _)) .Times(1); // Devices not found InjectConnectedEvent(test_address0, 0, GATT_ERROR); // Devices 0 is connected. Disconnect it InjectDisconnectedEvent(1, GATT_CONN_TERMINATE_PEER_USER); SyncOnMainLoop(); Mock::VerifyAndClearExpectations(&mock_gatt_interface_); Loading @@ -4155,6 +4157,12 @@ TEST_F(UnicastTestNoInit, LoadStoredEarbudsCsisGroupedDifferently) { BTM_BLE_BKG_CONNECT_TARGETED_ANNOUNCEMENTS, _)) .Times(1); /* Keep device in Getting Ready state */ ON_CALL(mock_btm_interface_, BTM_IsEncrypted(test_address0, _)) .WillByDefault(DoAll(Return(false))); ON_CALL(mock_btm_interface_, SetEncryption(test_address0, _, _, _, _)) .WillByDefault(Return(BTM_SUCCESS)); /* For background connect, test needs to Inject Connected Event */ InjectConnectedEvent(test_address0, 1); Loading