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

Commit 73ce45bd authored by Hansong Zhang's avatar Hansong Zhang
Browse files

ACL: Fix on_connection_packet_type_changed

This could happen before Connection Complete event is received from
controller.

We never did anything about it in legacy stack.
(HCI_CONN_PKT_TYPE_CHANGE_EVT is unused)

Bug: 174450658
Test: cert/run
Tag: #stability
Change-Id: Ia33dfb358988ebbd45abd66b9115e8529cf27d43
parent 42582a54
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -243,10 +243,7 @@ struct classic_impl : public security::ISecurityManagerListener {
      LOG_ERROR("Received on_connection_packet_type_changed with error code %s", error_code.c_str());
      return;
    }
    uint16_t handle = packet_type_changed.GetConnectionHandle();
    auto& acl_connection = acl_connections_.find(handle)->second;
    uint16_t packet_type = packet_type_changed.GetPacketType();
    acl_connection.connection_management_callbacks_->OnConnectionPacketTypeChanged(packet_type);
    // We don't handle this event; we didn't do this in legacy stack either.
  }

  void on_central_link_key_complete(EventPacketView packet) {
+0 −12
Original line number Diff line number Diff line
@@ -910,18 +910,6 @@ TEST_F(AclManagerWithConnectionTest, send_write_default_link_policy_settings) {
  ASSERT_EQ(link_policy_settings, acl_manager_->ReadDefaultLinkPolicySettings());
}

TEST_F(AclManagerWithConnectionTest, send_change_connection_packet_type) {
  test_hci_layer_->SetCommandFuture();
  connection_->ChangeConnectionPacketType(0xEE1C);
  auto packet = test_hci_layer_->GetCommandPacket(OpCode::CHANGE_CONNECTION_PACKET_TYPE);
  auto command_view = ChangeConnectionPacketTypeView::Create(packet);
  ASSERT_TRUE(command_view.IsValid());
  ASSERT_EQ(command_view.GetPacketType(), 0xEE1C);

  EXPECT_CALL(mock_connection_management_callbacks_, OnConnectionPacketTypeChanged(0xEE1C));
  test_hci_layer_->IncomingEvent(ConnectionPacketTypeChangedBuilder::Create(ErrorCode::SUCCESS, handle_, 0xEE1C));
}

TEST_F(AclManagerWithConnectionTest, send_authentication_requested) {
  test_hci_layer_->SetCommandFuture();
  connection_->AuthenticationRequested();