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

Commit ca6c0489 authored by Myles Watson's avatar Myles Watson
Browse files

Use EnhancedFlush in GD ACL

The legacy stack always uses EnhancedFlush.

Bug: 296434089
Test: mma -j32
Flag: EXEMPT, no logical change
Change-Id: I1a9c145abf4c7d11485e2207dd1d561faa4e4bf2
parent 1de13d04
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ constexpr EventCode AclConnectionEvents[] = {
    EventCode::READ_REMOTE_SUPPORTED_FEATURES_COMPLETE,
    EventCode::READ_REMOTE_EXTENDED_FEATURES_COMPLETE,
    EventCode::LINK_SUPERVISION_TIMEOUT_CHANGED,
    EventCode::ENHANCED_FLUSH_COMPLETE,
};

typedef CommandInterface<AclCommandBuilder> AclConnectionInterface;
+2 −2
Original line number Diff line number Diff line
@@ -490,8 +490,8 @@ bool ClassicAclConnection::SniffSubrating(uint16_t maximum_latency, uint16_t min

bool ClassicAclConnection::Flush() {
  acl_connection_interface_->EnqueueCommand(
      FlushBuilder::Create(handle_),
      pimpl_->tracker.client_handler_->BindOnce(check_complete<FlushCompleteView>));
      EnhancedFlushBuilder::Create(handle_),
      pimpl_->tracker.client_handler_->BindOnce(check_status<EnhancedFlushStatusView>));
  return true;
}

+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ class TestAclConnectionInterface : public hci::AclConnectionInterface {
    const std::lock_guard<std::mutex> lock(command_queue_mutex_);
    auto packet = std::move(command_queue_.front());
    command_queue_.pop();
    return std::move(packet);
    return packet;
  }

  std::shared_ptr<std::vector<uint8_t>> DequeueCommandBytes() {
+14 −0
Original line number Diff line number Diff line
@@ -112,6 +112,9 @@ struct classic_impl : public security::ISecurityManagerListener {
      case EventCode::FLUSH_OCCURRED:
        on_flush_occurred(event_packet);
        break;
      case EventCode::ENHANCED_FLUSH_COMPLETE:
        on_enhanced_flush_complete(event_packet);
        break;
      case EventCode::READ_REMOTE_SUPPORTED_FEATURES_COMPLETE:
        on_read_remote_supported_features_complete(event_packet);
        break;
@@ -605,6 +608,17 @@ struct classic_impl : public security::ISecurityManagerListener {
    connections.execute(handle, [=](ConnectionManagementCallbacks* callbacks) { callbacks->OnFlushOccurred(); });
  }

  void on_enhanced_flush_complete(EventView packet) {
    auto flush_complete = EnhancedFlushCompleteView::Create(packet);
    if (!flush_complete.IsValid()) {
      LOG_ERROR("Received an invalid packet");
      return;
    }
    uint16_t handle = flush_complete.GetConnectionHandle();
    connections.execute(
        handle, [=](ConnectionManagementCallbacks* callbacks) { callbacks->OnFlushOccurred(); });
  }

  void on_read_remote_version_information(
      hci::ErrorCode hci_status, uint16_t handle, uint8_t version, uint16_t manufacturer_name, uint16_t sub_version) {
    connections.execute(handle, [=](ConnectionManagementCallbacks* callbacks) {
+3 −3
Original line number Diff line number Diff line
@@ -956,12 +956,12 @@ TEST_F(AclManagerWithConnectionTest, send_flow_specification) {

TEST_F(AclManagerWithConnectionTest, send_flush) {
  connection_->Flush();
  auto packet = GetConnectionManagementCommand(OpCode::FLUSH);
  auto command_view = FlushView::Create(packet);
  auto packet = GetConnectionManagementCommand(OpCode::ENHANCED_FLUSH);
  auto command_view = EnhancedFlushView::Create(packet);
  ASSERT_TRUE(command_view.IsValid());

  EXPECT_CALL(mock_connection_management_callbacks_, OnFlushOccurred());
  test_hci_layer_->IncomingEvent(FlushOccurredBuilder::Create(handle_));
  test_hci_layer_->IncomingEvent(EnhancedFlushCompleteBuilder::Create(handle_));
  sync_client_handler();
}

Loading