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

Commit d380cb17 authored by Martin Brabham's avatar Martin Brabham
Browse files

BTM_API Shim: Implement BTM_ConfirmReqReply

Bug: 159815595
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd
Test: Manual testing with hybrid stack
Change-Id: I1f86b0d6ae924e0ea068831cfb27f737df32018d
parent fe6851f3
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1133,6 +1133,26 @@ bool bluetooth::shim::BTM_SecDeleteDevice(const RawAddress& bd_addr) {
  return Stack::GetInstance()->GetBtm()->RemoveBond(bd_addr);
}

void bluetooth::shim::BTM_ConfirmReqReply(tBTM_STATUS res,
                                          const RawAddress& bd_addr) {
  // Send for both Classic and LE until we can determine the type
  bool accept = res == BTM_SUCCESS;
  hci::AddressWithType address = ToAddressWithType(bd_addr, 0);
  hci::AddressWithType address2 = ToAddressWithType(bd_addr, 1);
  auto security_manager =
      bluetooth::shim::GetSecurityModule()->GetSecurityManager();
  if (ShimUi::GetInstance()->waiting_for_pairing_prompt_) {
    LOG(INFO) << "interpreting confirmation as pairing accept " << address;
    security_manager->OnPairingPromptAccepted(address, accept);
    security_manager->OnPairingPromptAccepted(address2, accept);
    ShimUi::GetInstance()->waiting_for_pairing_prompt_ = false;
  } else {
    LOG(INFO) << "interpreting confirmation as yes/no confirmation " << address;
    security_manager->OnConfirmYesNo(address, accept);
    security_manager->OnConfirmYesNo(address2, accept);
  }
}

uint16_t bluetooth::shim::BTM_GetHCIConnHandle(const RawAddress& remote_bda,
                                               tBT_TRANSPORT transport) {
  return Stack::GetInstance()->GetBtm()->GetAclHandle(remote_bda, transport);