Loading system/bta/le_audio/client.cc +9 −11 Original line number Diff line number Diff line Loading @@ -390,7 +390,8 @@ class LeAudioClientImpl : public LeAudioClient { */ void SetDeviceAsRemovePendingAndStopGroup(LeAudioDevice* leAudioDevice) { LOG_INFO("device %s", ADDRESS_TO_LOGGABLE_CSTR(leAudioDevice->address_)); leAudioDevice->SetConnectionState(DeviceConnectState::PENDING_REMOVAL); leAudioDevice->SetConnectionState(DeviceConnectState::REMOVING); leAudioDevice->closing_stream_for_disconnection_ = true; GroupStop(leAudioDevice->group_id_); } Loading Loading @@ -1262,7 +1263,6 @@ class LeAudioClientImpl : public LeAudioClient { auto connection_state = leAudioDevice->GetConnectionState(); switch (connection_state) { case DeviceConnectState::REMOVING: case DeviceConnectState::PENDING_REMOVAL: /* Just return, and let device disconnect */ return; case DeviceConnectState::CONNECTED: Loading Loading @@ -1484,7 +1484,11 @@ class LeAudioClientImpl : public LeAudioClient { * Cancel just direct connection and keep background if it is there. */ BTA_GATTC_CancelOpen(gatt_if_, address, true); break; /* If this is a device which is a part of the group which is connected, * lets start backgroup connect */ BackgroundConnectIfNeeded(leAudioDevice); return; case DeviceConnectState::CONNECTED: { /* User is disconnecting the device, we shall remove the autoconnect * flag for this device and all others if not TA is used Loading Loading @@ -1551,17 +1555,11 @@ class LeAudioClientImpl : public LeAudioClient { case DeviceConnectState::DISCONNECTING: case DeviceConnectState::DISCONNECTING_AND_RECOVER: case DeviceConnectState::CONNECTING_AUTOCONNECT: case DeviceConnectState::PENDING_REMOVAL: case DeviceConnectState::REMOVING: LOG_WARN("%s, invalid state %s", ADDRESS_TO_LOGGABLE_CSTR(address), bluetooth::common::ToString(connection_state).c_str()); break; return; } /* If this is a device which is a part of the group which is connected, * lets start backgroup connect */ BackgroundConnectIfNeeded(leAudioDevice); } void DisconnectDevice(LeAudioDevice* leAudioDevice, Loading Loading @@ -5007,7 +5005,7 @@ class LeAudioClientImpl : public LeAudioClient { void HandlePendingDeviceRemove(LeAudioDeviceGroup* group) { for (auto device = group->GetFirstDevice(); device != nullptr; device = group->GetNextDevice(device)) { if (device->GetConnectionState() == DeviceConnectState::PENDING_REMOVAL) { if (device->GetConnectionState() == DeviceConnectState::REMOVING) { if (device->closing_stream_for_disconnection_) { device->closing_stream_for_disconnection_ = false; LOG_INFO("Disconnecting group id: %d, address: %s", group->group_id_, Loading system/bta/le_audio/devices.cc +0 −3 Original line number Diff line number Diff line Loading @@ -78,9 +78,6 @@ std::ostream& operator<<(std::ostream& os, const DeviceConnectState& state) { case DeviceConnectState::DISCONNECTING_AND_RECOVER: char_value_ = "DISCONNECTING_AND_RECOVER"; break; case DeviceConnectState::PENDING_REMOVAL: char_value_ = "PENDING_REMOVAL"; break; case DeviceConnectState::CONNECTING_BY_USER: char_value_ = "CONNECTING_BY_USER"; break; Loading system/bta/le_audio/devices.h +0 −4 Original line number Diff line number Diff line Loading @@ -58,10 +58,6 @@ enum class DeviceConnectState : uint8_t { /* Disconnecting for recover - after that we want direct connect to be initiated */ DISCONNECTING_AND_RECOVER, /* Device will be removed after scheduled action is finished: One of such * action is taking Stream to IDLE */ PENDING_REMOVAL, /* 2 states below are used when user creates connection. Connect API is called. */ CONNECTING_BY_USER, Loading system/bta/le_audio/le_audio_client_test.cc +3 −3 Original line number Diff line number Diff line Loading @@ -3249,13 +3249,13 @@ TEST_F(UnicastTest, RemoveNodeWhileStreaming) { .Times(1); EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1); EXPECT_CALL(mock_state_machine_, ProcessHciNotifAclDisconnected(_, _)) .Times(0); .Times(1); EXPECT_CALL( mock_audio_hal_client_callbacks_, OnGroupNodeStatus(test_address0, group_id, GroupNodeStatus::REMOVED)); EXPECT_CALL(mock_audio_hal_client_callbacks_, OnConnectionState(ConnectionState::DISCONNECTED, test_address0)) .Times(0); .Times(1); LeAudioClient::Get()->GroupRemoveNode(group_id, test_address0); Loading Loading @@ -3775,7 +3775,7 @@ TEST_F(UnicastTest, RemoveWhileStreaming) { Mock::VerifyAndClearExpectations(&mock_state_machine_); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); ASSERT_NE(group, nullptr); ASSERT_EQ(group, nullptr); } TEST_F(UnicastTest, EarbudsTwsStyleStreaming) { Loading Loading
system/bta/le_audio/client.cc +9 −11 Original line number Diff line number Diff line Loading @@ -390,7 +390,8 @@ class LeAudioClientImpl : public LeAudioClient { */ void SetDeviceAsRemovePendingAndStopGroup(LeAudioDevice* leAudioDevice) { LOG_INFO("device %s", ADDRESS_TO_LOGGABLE_CSTR(leAudioDevice->address_)); leAudioDevice->SetConnectionState(DeviceConnectState::PENDING_REMOVAL); leAudioDevice->SetConnectionState(DeviceConnectState::REMOVING); leAudioDevice->closing_stream_for_disconnection_ = true; GroupStop(leAudioDevice->group_id_); } Loading Loading @@ -1262,7 +1263,6 @@ class LeAudioClientImpl : public LeAudioClient { auto connection_state = leAudioDevice->GetConnectionState(); switch (connection_state) { case DeviceConnectState::REMOVING: case DeviceConnectState::PENDING_REMOVAL: /* Just return, and let device disconnect */ return; case DeviceConnectState::CONNECTED: Loading Loading @@ -1484,7 +1484,11 @@ class LeAudioClientImpl : public LeAudioClient { * Cancel just direct connection and keep background if it is there. */ BTA_GATTC_CancelOpen(gatt_if_, address, true); break; /* If this is a device which is a part of the group which is connected, * lets start backgroup connect */ BackgroundConnectIfNeeded(leAudioDevice); return; case DeviceConnectState::CONNECTED: { /* User is disconnecting the device, we shall remove the autoconnect * flag for this device and all others if not TA is used Loading Loading @@ -1551,17 +1555,11 @@ class LeAudioClientImpl : public LeAudioClient { case DeviceConnectState::DISCONNECTING: case DeviceConnectState::DISCONNECTING_AND_RECOVER: case DeviceConnectState::CONNECTING_AUTOCONNECT: case DeviceConnectState::PENDING_REMOVAL: case DeviceConnectState::REMOVING: LOG_WARN("%s, invalid state %s", ADDRESS_TO_LOGGABLE_CSTR(address), bluetooth::common::ToString(connection_state).c_str()); break; return; } /* If this is a device which is a part of the group which is connected, * lets start backgroup connect */ BackgroundConnectIfNeeded(leAudioDevice); } void DisconnectDevice(LeAudioDevice* leAudioDevice, Loading Loading @@ -5007,7 +5005,7 @@ class LeAudioClientImpl : public LeAudioClient { void HandlePendingDeviceRemove(LeAudioDeviceGroup* group) { for (auto device = group->GetFirstDevice(); device != nullptr; device = group->GetNextDevice(device)) { if (device->GetConnectionState() == DeviceConnectState::PENDING_REMOVAL) { if (device->GetConnectionState() == DeviceConnectState::REMOVING) { if (device->closing_stream_for_disconnection_) { device->closing_stream_for_disconnection_ = false; LOG_INFO("Disconnecting group id: %d, address: %s", group->group_id_, Loading
system/bta/le_audio/devices.cc +0 −3 Original line number Diff line number Diff line Loading @@ -78,9 +78,6 @@ std::ostream& operator<<(std::ostream& os, const DeviceConnectState& state) { case DeviceConnectState::DISCONNECTING_AND_RECOVER: char_value_ = "DISCONNECTING_AND_RECOVER"; break; case DeviceConnectState::PENDING_REMOVAL: char_value_ = "PENDING_REMOVAL"; break; case DeviceConnectState::CONNECTING_BY_USER: char_value_ = "CONNECTING_BY_USER"; break; Loading
system/bta/le_audio/devices.h +0 −4 Original line number Diff line number Diff line Loading @@ -58,10 +58,6 @@ enum class DeviceConnectState : uint8_t { /* Disconnecting for recover - after that we want direct connect to be initiated */ DISCONNECTING_AND_RECOVER, /* Device will be removed after scheduled action is finished: One of such * action is taking Stream to IDLE */ PENDING_REMOVAL, /* 2 states below are used when user creates connection. Connect API is called. */ CONNECTING_BY_USER, Loading
system/bta/le_audio/le_audio_client_test.cc +3 −3 Original line number Diff line number Diff line Loading @@ -3249,13 +3249,13 @@ TEST_F(UnicastTest, RemoveNodeWhileStreaming) { .Times(1); EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1); EXPECT_CALL(mock_state_machine_, ProcessHciNotifAclDisconnected(_, _)) .Times(0); .Times(1); EXPECT_CALL( mock_audio_hal_client_callbacks_, OnGroupNodeStatus(test_address0, group_id, GroupNodeStatus::REMOVED)); EXPECT_CALL(mock_audio_hal_client_callbacks_, OnConnectionState(ConnectionState::DISCONNECTED, test_address0)) .Times(0); .Times(1); LeAudioClient::Get()->GroupRemoveNode(group_id, test_address0); Loading Loading @@ -3775,7 +3775,7 @@ TEST_F(UnicastTest, RemoveWhileStreaming) { Mock::VerifyAndClearExpectations(&mock_state_machine_); Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_); ASSERT_NE(group, nullptr); ASSERT_EQ(group, nullptr); } TEST_F(UnicastTest, EarbudsTwsStyleStreaming) { Loading