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

Commit 9448da9d authored by Jack He's avatar Jack He Committed by Automerger Merge Worker
Browse files

Merge "[GD ACL] Do the right check by transport when sending ACL data and cmd"...

Merge "[GD ACL] Do the right check by transport when sending ACL data and cmd" am: 565c6400 am: 1090281a

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1c97943122fb039d62bd255947efedf5770ff288
parents b7f60ce3 1090281a
Loading
Loading
Loading
Loading
+26 −25
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@

#include <base/location.h>
#include <base/strings/stringprintf.h>

#include <time.h>

#include <chrono>
#include <cstdint>
#include <functional>
@@ -588,6 +588,8 @@ struct bluetooth::shim::legacy::Acl::impl {

  void EnqueueClassicPacket(
      HciHandle handle, std::unique_ptr<bluetooth::packet::RawBuilder> packet) {
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
               handle);
    handle_to_classic_connection_map_[handle]->EnqueuePacket(std::move(packet));
  }

@@ -596,32 +598,30 @@ struct bluetooth::shim::legacy::Acl::impl {
           handle_to_le_connection_map_.end();
  }

  bool ClassicConnectionExists(HciHandle handle) {
    return handle_to_classic_connection_map_.find(handle) !=
           handle_to_classic_connection_map_.end();
  }

  void EnqueueLePacket(HciHandle handle,
                       std::unique_ptr<bluetooth::packet::RawBuilder> packet) {
    if (ClassicConnectionExists(handle))
    ASSERT_LOG(IsLeAcl(handle), "handle %d is not a LE connection", handle);
    handle_to_le_connection_map_[handle]->EnqueuePacket(std::move(packet));
  }

  void HoldMode(HciHandle handle, uint16_t max_interval,
                uint16_t min_interval) {
    if (ClassicConnectionExists(handle))
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
               handle);
    handle_to_classic_connection_map_[handle]->HoldMode(max_interval,
                                                        min_interval);
  }

  void ExitSniffMode(HciHandle handle) {
    if (ClassicConnectionExists(handle))
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
               handle);
    handle_to_classic_connection_map_[handle]->ExitSniffMode();
  }

  void SniffMode(HciHandle handle, uint16_t max_interval, uint16_t min_interval,
                 uint16_t attempt, uint16_t timeout) {
    if (ClassicConnectionExists(handle))
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
               handle);
    handle_to_classic_connection_map_[handle]->SniffMode(
        max_interval, min_interval, attempt, timeout);
  }
@@ -629,15 +629,16 @@ struct bluetooth::shim::legacy::Acl::impl {
  void SniffSubrating(HciHandle handle, uint16_t maximum_latency,
                      uint16_t minimum_remote_timeout,
                      uint16_t minimum_local_timeout) {
    if (ClassicConnectionExists(handle))
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
               handle);
    handle_to_classic_connection_map_[handle]->SniffSubrating(
        maximum_latency, minimum_remote_timeout, minimum_local_timeout);
  }

  void SetConnectionEncryption(HciHandle handle, hci::Enable enable) {
    if (ClassicConnectionExists(handle))
      handle_to_classic_connection_map_[handle]->SetConnectionEncryption(
          enable);
    ASSERT_LOG(IsClassicAcl(handle), "handle %d is not a classic connection",
               handle);
    handle_to_classic_connection_map_[handle]->SetConnectionEncryption(enable);
  }

  void DumpConnectionHistory() const {