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

Commit f825e820 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5987274 from 7f24629b to rvc-release

Change-Id: If0ab1e2b58a8395ecceba16b83d934ac20472357
parents 38e5cf5a 7f24629b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -564,8 +564,8 @@ void bta_ag_resume_open(tBTA_AG_SCB* p_scb) {
  if (p_scb->state == BTA_AG_INIT_ST) {
    LOG(INFO) << __func__ << ": Resume connection to " << p_scb->peer_addr
              << ", handle" << bta_ag_scb_to_idx(p_scb);
    tBTA_AG_DATA open_data = {.api_open.bd_addr = p_scb->peer_addr,
                              .api_open.sec_mask = p_scb->cli_sec_mask};
    tBTA_AG_DATA open_data = {.api_open = {.bd_addr = p_scb->peer_addr,
                                           .sec_mask = p_scb->cli_sec_mask}};
    bta_ag_sm_execute(p_scb, BTA_AG_API_OPEN_EVT, open_data);
  } else {
    VLOG(1) << __func__ << ": device " << p_scb->peer_addr
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ static void bta_ag_sdp_cback(uint16_t status, uint8_t idx) {
    } else {
      event = BTA_AG_DISC_INT_RES_EVT;
    }
    tBTA_AG_DATA disc_result = {.disc_result.status = status};
    tBTA_AG_DATA disc_result = {.disc_result = {.status = status}};
    do_in_main_thread(FROM_HERE, base::Bind(&bta_ag_sm_execute_by_handle, idx,
                                            event, disc_result));
  }
+1 −1
Original line number Diff line number Diff line
@@ -747,7 +747,7 @@ static bt_status_t send_at_cmd(const RawAddress* bd_addr, int cmd, int val1,
}

static const bthf_client_interface_t bthfClientInterface = {
    sizeof(bthf_client_interface_t),
    .size = sizeof(bthf_client_interface_t),
    .init = init,
    .connect = connect,
    .disconnect = disconnect,
+6 −14
Original line number Diff line number Diff line
@@ -30,20 +30,16 @@ using namespace bluetooth::hci;
std::shared_ptr<ClassicDevice> DeviceDatabase::CreateClassicDevice(Address address) {
  ClassicDevice device(address);
  const std::string uuid = device.GetUuid();
  if (AddDeviceToMap(std::move(device))) {
  AddDeviceToMap(std::move(device));
  return GetClassicDevice(uuid);
}
  return std::shared_ptr<ClassicDevice>();
}

std::shared_ptr<LeDevice> DeviceDatabase::CreateLeDevice(Address address) {
  LeDevice device(address);
  const std::string uuid = device.GetUuid();
  if (AddDeviceToMap(std::move(device))) {
  AddDeviceToMap(std::move(device));
  return GetLeDevice(uuid);
}
  return std::shared_ptr<LeDevice>();
}

std::shared_ptr<DualDevice> DeviceDatabase::CreateDualDevice(Address address) {
  auto classic = CreateClassicDevice(address);
@@ -51,10 +47,9 @@ std::shared_ptr<DualDevice> DeviceDatabase::CreateDualDevice(Address address) {
  if (classic && le) {
    DualDevice device(address, classic, le);
    std::string uuid = device.GetUuid();
    if (AddDeviceToMap(std::move(device))) {
    AddDeviceToMap(std::move(device));
    return GetDualDevice(uuid);
  }
  }
  LOG_WARN("Attempting to instert a DUAL device that already exists!");
  return std::shared_ptr<DualDevice>();
}
@@ -189,7 +184,6 @@ bool DeviceDatabase::AddDeviceToMap(ClassicDevice&& device) {
    auto it = classic_device_map_.find(device.GetUuid());
    // If we have a record with the same key
    if (it != classic_device_map_.end()) {
      LOG_ERROR("Attempt to re-insert classic device '%s' object with same UUID", uuid.c_str());
      // We don't want to insert and overwrite
      return false;
    }
@@ -217,7 +211,6 @@ bool DeviceDatabase::AddDeviceToMap(LeDevice&& device) {
    auto it = le_device_map_.find(device.GetUuid());
    // If we have a record with the same key
    if (it != le_device_map_.end()) {
      LOG_ERROR("Attempt to re-insert LE device '%s' object with same UUID", uuid.c_str());
      // We don't want to insert and overwrite
      return false;
    }
@@ -244,7 +237,6 @@ bool DeviceDatabase::AddDeviceToMap(DualDevice&& device) {
    auto it = dual_device_map_.find(device.GetUuid());
    // If we have a record with the same key
    if (it != dual_device_map_.end()) {
      LOG_ERROR("Attempt to re-insert dual device '%s' object with same UUID", uuid.c_str());
      // We don't want to insert and overwrite
      return false;
    }
+4 −3
Original line number Diff line number Diff line
@@ -61,12 +61,13 @@ TEST_F(DeviceDatabaseTest, create_dual_device) {
  ASSERT_EQ(address_str, dual_device->GetUuid());
}

// Shouldn't fail when creating twice.  Should just get back a s_ptr the same device
TEST_F(DeviceDatabaseTest, create_classic_device_twice) {
  auto classic_device = device_database_.CreateClassicDevice(address);
  ASSERT_TRUE(classic_device);
  ASSERT_EQ(CLASSIC, classic_device->GetDeviceType());
  ASSERT_EQ(address_str, classic_device->GetUuid());
  ASSERT_FALSE(device_database_.CreateClassicDevice(address));
  ASSERT_TRUE(device_database_.CreateClassicDevice(address));
}

TEST_F(DeviceDatabaseTest, create_le_device_twice) {
@@ -74,7 +75,7 @@ TEST_F(DeviceDatabaseTest, create_le_device_twice) {
  ASSERT_TRUE(le_device);
  ASSERT_EQ(LE, le_device->GetDeviceType());
  ASSERT_EQ(address_str, le_device->GetUuid());
  ASSERT_FALSE(device_database_.CreateLeDevice(address));
  ASSERT_TRUE(device_database_.CreateLeDevice(address));
}

TEST_F(DeviceDatabaseTest, create_dual_device_twice) {
@@ -93,7 +94,7 @@ TEST_F(DeviceDatabaseTest, create_dual_device_twice) {
  ASSERT_EQ(DUAL, dual_device->GetLeDevice()->GetDeviceType());
  ASSERT_EQ(address_str, dual_device->GetLeDevice()->GetUuid());

  ASSERT_FALSE(device_database_.CreateDualDevice(address));
  ASSERT_TRUE(device_database_.CreateDualDevice(address));
}

TEST_F(DeviceDatabaseTest, remove_device) {
Loading