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

Commit d6f48d95 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Automerger Merge Worker
Browse files

leaudio: Fix cleaning autoconnect flag am: 8ed41c96 am: 8d11ad85

parents 12da59bf 8d11ad85
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -883,6 +883,10 @@ class LeAudioClientImpl : public LeAudioClient {
    BTA_GATTC_CancelOpen(0, address, false);

    if (leAudioDevice->conn_id_ != GATT_INVALID_CONN_ID) {
      /* User is disconnecting the device, we shall remove the autoconnect flag
       */
      btif_storage_set_leaudio_autoconnect(address, false);

      auto group = aseGroups_.FindById(leAudioDevice->group_id_);
      if (group &&
          group->GetState() ==
+13 −0
Original line number Diff line number Diff line
@@ -1970,6 +1970,13 @@ TEST_F(UnicastTest, ConnectTwoEarbudsCsisGrouped) {
                    codec_spec_conf::kLeAudioLocationFrontRight, group_size,
                    group_id, 2 /* rank*/, true /*connect_through_csis*/);

  Mock::VerifyAndClearExpectations(&mock_btif_storage_);

  EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address1, false))
      .Times(1);
  EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address0, false))
      .Times(1);

  // Verify grouping information
  std::vector<RawAddress> devs =
      LeAudioClient::Get()->GetGroupDevices(group_id);
@@ -2006,12 +2013,18 @@ TEST_F(UnicastTest, ConnectTwoEarbudsCsisGroupUnknownAtConnect) {
                    codec_spec_conf::kLeAudioLocationFrontRight, group_size,
                    group_id, 2 /* rank*/, true /*connect_through_csis*/);

  Mock::VerifyAndClearExpectations(&mock_btif_storage_);

  // Verify grouping information
  std::vector<RawAddress> devs =
      LeAudioClient::Get()->GetGroupDevices(group_id);
  ASSERT_NE(std::find(devs.begin(), devs.end(), test_address0), devs.end());
  ASSERT_NE(std::find(devs.begin(), devs.end(), test_address1), devs.end());

  EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address1, false))
      .Times(1);
  EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address0, false))
      .Times(1);
  DisconnectLeAudio(test_address0, 1);
  DisconnectLeAudio(test_address1, 2);
}
+0 −2
Original line number Diff line number Diff line
@@ -151,8 +151,6 @@ class LeAudioClientInterfaceImpl : public LeAudioClientInterface,
    do_in_main_thread(FROM_HERE,
                      Bind(&LeAudioClient::Disconnect,
                           Unretained(LeAudioClient::Get()), address));
    do_in_jni_thread(
        FROM_HERE, Bind(&btif_storage_set_leaudio_autoconnect, address, false));
  }

  void GroupAddNode(const int group_id, const RawAddress& address) override {