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

Commit 25af49b8 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Automerger Merge Worker
Browse files

Merge "LeAudio: Improve detecting disconnected devices." am: abcf1209 am:...

Merge "LeAudio: Improve detecting disconnected devices." am: abcf1209 am: b006f54c am: 56510bd2

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2509376



Change-Id: I261fdc4a7669fd6c8e7e45d0adc380ecff78160d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 71616345 56510bd2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ int LeAudioDeviceGroup::NumOfConnected(types::LeAudioContextType context_type) {
      leAudioDevices_.begin(), leAudioDevices_.end(),
      [type_set, check_context_type](auto& iter) {
        if (iter.expired()) return false;
        if (iter.lock()->conn_id_ == GATT_INVALID_CONN_ID) return false;
        if (iter.lock()->GetConnectionState() != DeviceConnectState::CONNECTED)
          return false;

+15 −0
Original line number Diff line number Diff line
@@ -1366,6 +1366,21 @@ TEST_F(LeAudioAseConfigurationTest, test_reactivation_conversational) {
  /* Only two ASEs can be bonded to one bi-directional CIS */
  ASSERT_EQ(bi_dir_ases_count, 2);
}

TEST_F(LeAudioAseConfigurationTest, test_num_of_connected) {
  auto device1 = AddTestDevice(2, 1);
  auto device2 = AddTestDevice(2, 1);
  ASSERT_EQ(2, group_->NumOfConnected());

  // Drop the ACL connection
  device1->conn_id_ = GATT_INVALID_CONN_ID;
  ASSERT_EQ(1, group_->NumOfConnected());

  // Fully disconnect the other device
  device2->SetConnectionState(DeviceConnectState::DISCONNECTING);
  ASSERT_EQ(0, group_->NumOfConnected());
}

}  // namespace
}  // namespace internal
}  // namespace le_audio