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

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

Merge "Ensure IO Cap Response received before processing UserConfirmationRequest" am: 105c2c03

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

Change-Id: I95e24d14e9ecf6fe1f2e869dcb685335cffdac2c
parents 6599276f 105c2c03
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -199,6 +199,10 @@ void ClassicPairingHandler::OnReceive(hci::IoCapabilityResponseView packet) {
      break;
  }
  has_gotten_io_cap_response_ = true;
  if (user_confirmation_request_) {
    this->OnReceive(*user_confirmation_request_);
    user_confirmation_request_ = std::nullopt;
  }
}

void ClassicPairingHandler::OnReceive(hci::SimplePairingCompleteView packet) {
@@ -268,7 +272,13 @@ void ClassicPairingHandler::OnReceive(hci::KeypressNotificationView packet) {
 *
 * The table is on pg 2133 of the Core v5.1 spec.
 */

void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) {
  // Ensure we have io cap response otherwise checks will be wrong if it comes late
  if (!has_gotten_io_cap_response_) {
    user_confirmation_request_ = std::make_optional<hci::UserConfirmationRequestView>(packet);
    return;
  }
  ASSERT(packet.IsValid());
  LOG_INFO("Received: %s", hci::EventCodeText(packet.GetEventCode()).c_str());
  ASSERT_LOG(GetRecord()->GetPseudoAddress()->GetAddress() == packet.GetBdAddr(), "Address mismatch");
+1 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ class ClassicPairingHandler : public PairingHandler {
  bool is_cancelled_ = false;

  bool has_gotten_io_cap_response_ = false;
  std::optional<hci::UserConfirmationRequestView> user_confirmation_request_ = std::nullopt;

  hci::ErrorCode last_status_ = hci::ErrorCode::UNKNOWN_HCI_COMMAND;
  bool locally_initiated_ = false;