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

Commit fa2d961e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "csis: Fix loading from storage" am: 84bba84c am: f07087ca am:...

Merge "csis: Fix loading from storage" am: 84bba84c am: f07087ca am: fee78357 am: 7ef02277 am: 0eb70a3b

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1847053

Change-Id: I331767a3d295ec34f87af7be750f10e0ccf22fd0
parents 0781d8bd 0eb70a3b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -572,8 +572,8 @@ class CsisClientImpl : public CsisClient {

    auto device = FindDeviceByAddress(addr);
    if (device == nullptr) {
      auto dev = std::make_shared<CsisDevice>(addr, false);
      devices_.push_back(dev);
      device = std::make_shared<CsisDevice>(addr, false);
      devices_.push_back(device);
    }

    for (const auto& csis_group : csis_groups_) {
+8 −1
Original line number Diff line number Diff line
@@ -1055,8 +1055,9 @@ TEST_F(CsisClientTest, test_storage_content) {
  // Two devices in one set
  SetSampleDatabaseCsis(1, 1);
  SetSampleDatabaseCsis(2, 2);
  // One device in the other set
  // Devices in the other set
  SetSampleDatabaseCsis(3, 1, 2);
  SetSampleDatabaseCsis(4, 1, 2);

  TestAppRegister();
  TestConnect(GetTestAddress(1));
@@ -1110,6 +1111,12 @@ TEST_F(CsisClientTest, test_storage_content) {
  ASSERT_EQ(2, CsisClient::Get()->GetGroupId(
                   GetTestAddress(3), bluetooth::Uuid::From16Bit(0x0000)));

  // Restore not inerrogated dev4 - empty buffer but valid sirk for group 2
  std::vector<uint8_t> no_set_info;
  TestAddFromStorage(GetTestAddress(4), 4, no_set_info);
  ASSERT_EQ(2, CsisClient::Get()->GetGroupId(
                   GetTestAddress(4), bluetooth::Uuid::From16Bit(0x0000)));

  TestAppUnregister();
}

+3 −2
Original line number Diff line number Diff line
@@ -1830,6 +1830,7 @@ void btif_storage_load_bonded_csis_devices(void) {
      btif_config_get_bin(name, BTIF_STORAGE_CSIS_SET_INFO_BIN, in.data(),
                          &buffer_size);

    if (buffer_size != 0 || autoconnect)
      do_in_main_thread(FROM_HERE, Bind(&CsisClient::AddFromStorage, bd_addr,
                                        std::move(in), autoconnect));
  }