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

Commit 7fcbf51c authored by Zach Johnson's avatar Zach Johnson Committed by Automerger Merge Worker
Browse files

Merge changes I10a05872,I1a990478 am: afc16d07

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5280bfce7af3c4cbbb5e05a5ab6cb9b0a6437bb9
parents 3a1faf89 afc16d07
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -182,7 +182,7 @@ class CertSelfTest(BaseTestClass):
        inside = hci_packets.ReadScanEnableBuilder()
        inside = hci_packets.ReadScanEnableBuilder()
        logging.debug(inside.Serialize())
        logging.debug(inside.Serialize())
        logging.debug("building outside")
        logging.debug("building outside")
        outside = hci_packets.AclPacketBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE,
        outside = hci_packets.AclBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE,
                                         hci_packets.BroadcastFlag.POINT_TO_POINT, inside)
                                         hci_packets.BroadcastFlag.POINT_TO_POINT, inside)
        logging.debug(outside.Serialize())
        logging.debug(outside.Serialize())
        logging.debug("Done!")
        logging.debug("Done!")
@@ -199,7 +199,7 @@ class CertSelfTest(BaseTestClass):
            [mtu_opt, fcs_opt])
            [mtu_opt, fcs_opt])
        request_b_frame = l2cap_packets.BasicFrameBuilder(0x01, request)
        request_b_frame = l2cap_packets.BasicFrameBuilder(0x01, request)
        handle = 123
        handle = 123
        wrapped = hci_packets.AclPacketBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE,
        wrapped = hci_packets.AclBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE,
                                         hci_packets.BroadcastFlag.POINT_TO_POINT, request_b_frame)
                                         hci_packets.BroadcastFlag.POINT_TO_POINT, request_b_frame)
        # Size is ACL (4) + L2CAP (4) + Configure (8) + MTU (4) + FCS (3)
        # Size is ACL (4) + L2CAP (4) + Configure (8) + MTU (4) + FCS (3)
        asserts.assert_true(len(wrapped.Serialize()) == 23, "Packet serialized incorrectly")
        asserts.assert_true(len(wrapped.Serialize()) == 23, "Packet serialized incorrectly")
+3 −3
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@ from cert.truth import assertThat
from hal import facade_pb2 as hal_facade
from hal import facade_pb2 as hal_facade
from bluetooth_packets_python3.hci_packets import WriteScanEnableBuilder
from bluetooth_packets_python3.hci_packets import WriteScanEnableBuilder
from bluetooth_packets_python3.hci_packets import ScanEnable
from bluetooth_packets_python3.hci_packets import ScanEnable
from bluetooth_packets_python3.hci_packets import AclPacketBuilder
from bluetooth_packets_python3.hci_packets import AclBuilder
from bluetooth_packets_python3 import RawBuilder
from bluetooth_packets_python3 import RawBuilder
from bluetooth_packets_python3.hci_packets import BroadcastFlag
from bluetooth_packets_python3.hci_packets import BroadcastFlag
from bluetooth_packets_python3.hci_packets import PacketBoundaryFlag
from bluetooth_packets_python3.hci_packets import PacketBoundaryFlag
@@ -60,7 +60,7 @@ class PyHalAclConnection(IEventStream):
        self.our_acl_stream = FilteringEventStream(acl_stream, None)
        self.our_acl_stream = FilteringEventStream(acl_stream, None)


    def send(self, pb_flag, b_flag, data):
    def send(self, pb_flag, b_flag, data):
        acl = AclPacketBuilder(self.handle, pb_flag, b_flag, RawBuilder(data))
        acl = AclBuilder(self.handle, pb_flag, b_flag, RawBuilder(data))
        self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize())))
        self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize())))


    def send_first(self, data):
    def send_first(self, data):
@@ -141,7 +141,7 @@ class PyHal(Closable):
        self.device.hal.SendCommand(hal_facade.Command(payload=bytes(command.Serialize())))
        self.device.hal.SendCommand(hal_facade.Command(payload=bytes(command.Serialize())))


    def send_acl(self, handle, pb_flag, b_flag, data):
    def send_acl(self, handle, pb_flag, b_flag, data):
        acl = AclPacketBuilder(handle, pb_flag, b_flag, RawBuilder(data))
        acl = AclBuilder(handle, pb_flag, b_flag, RawBuilder(data))
        self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize())))
        self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize())))


    def send_acl_first(self, handle, data):
    def send_acl_first(self, handle, data):
+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ from facade import rootservice_pb2 as facade_rootservice_pb2
from hal import facade_pb2 as hal_facade_pb2
from hal import facade_pb2 as hal_facade_pb2
from bluetooth_packets_python3 import hci_packets
from bluetooth_packets_python3 import hci_packets
import bluetooth_packets_python3 as bt_packets
import bluetooth_packets_python3 as bt_packets
from bluetooth_packets_python3.hci_packets import AclPacketBuilder
from bluetooth_packets_python3.hci_packets import AclBuilder
from bluetooth_packets_python3 import RawBuilder
from bluetooth_packets_python3 import RawBuilder


_GRPC_TIMEOUT = 10
_GRPC_TIMEOUT = 10
+2 −2
Original line number Original line Diff line number Diff line
@@ -85,7 +85,7 @@ void FuzzHciHal::injectHciEvent(std::vector<uint8_t> data) {
}
}


void FuzzHciHal::injectAclData(std::vector<uint8_t> data) {
void FuzzHciHal::injectAclData(std::vector<uint8_t> data) {
  hci::AclPacketView aclPacket = hci::AclPacketView::FromBytes(data);
  hci::AclView aclPacket = hci::AclView::FromBytes(data);
  if (!aclPacket.IsValid()) {
  if (!aclPacket.IsValid()) {
    return;
    return;
  }
  }
@@ -94,7 +94,7 @@ void FuzzHciHal::injectAclData(std::vector<uint8_t> data) {
}
}


void FuzzHciHal::injectScoData(std::vector<uint8_t> data) {
void FuzzHciHal::injectScoData(std::vector<uint8_t> data) {
  hci::ScoPacketView scoPacket = hci::ScoPacketView::FromBytes(data);
  hci::ScoView scoPacket = hci::ScoView::FromBytes(data);
  if (!scoPacket.IsValid()) {
  if (!scoPacket.IsValid()) {
    return;
    return;
  }
  }
+9 −9
Original line number Original line Diff line number Diff line
@@ -64,8 +64,8 @@ TEST(AclBuilderTest, buildAclCount) {
  count_payload->AddOctets(counting_bytes);
  count_payload->AddOctets(counting_bytes);
  ASSERT_EQ(counting_bytes.size(), count_payload->size());
  ASSERT_EQ(counting_bytes.size(), count_payload->size());


  std::unique_ptr<AclPacketBuilder> count_packet =
  std::unique_ptr<AclBuilder> count_packet =
      AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(count_payload));
      AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(count_payload));


  ASSERT_EQ(counting_bytes.size() + 4, count_packet->size());
  ASSERT_EQ(counting_bytes.size() + 4, count_packet->size());


@@ -74,7 +74,7 @@ TEST(AclBuilderTest, buildAclCount) {
  count_packet->Serialize(it);
  count_packet->Serialize(it);


  PacketView<true> count_packet_bytes_view(count_packet_bytes);
  PacketView<true> count_packet_bytes_view(count_packet_bytes);
  AclPacketView count_packet_view = AclPacketView::Create(count_packet_bytes_view);
  AclView count_packet_view = AclView::Create(count_packet_bytes_view);
  ASSERT_TRUE(count_packet_view.IsValid());
  ASSERT_TRUE(count_packet_view.IsValid());


  ASSERT_EQ(handle, count_packet_view.GetHandle());
  ASSERT_EQ(handle, count_packet_view.GetHandle());
@@ -97,8 +97,8 @@ TEST(AclBuilderTest, buildAclCountInverted) {
  counting_down_bytes_payload->AddOctets(counting_down_bytes);
  counting_down_bytes_payload->AddOctets(counting_down_bytes);
  ASSERT_EQ(counting_down_bytes.size(), counting_down_bytes_payload->size());
  ASSERT_EQ(counting_down_bytes.size(), counting_down_bytes_payload->size());


  std::unique_ptr<AclPacketBuilder> counting_down_bytes_packet =
  std::unique_ptr<AclBuilder> counting_down_bytes_packet =
      AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(counting_down_bytes_payload));
      AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(counting_down_bytes_payload));


  ASSERT_EQ(counting_down_bytes.size() + 4, counting_down_bytes_packet->size());
  ASSERT_EQ(counting_down_bytes.size() + 4, counting_down_bytes_packet->size());


@@ -106,7 +106,7 @@ TEST(AclBuilderTest, buildAclCountInverted) {
  BitInserter it(*counting_down_bytes_packet_bytes);
  BitInserter it(*counting_down_bytes_packet_bytes);
  counting_down_bytes_packet->Serialize(it);
  counting_down_bytes_packet->Serialize(it);
  PacketView<true> counting_down_bytes_packet_bytes_view(counting_down_bytes_packet_bytes);
  PacketView<true> counting_down_bytes_packet_bytes_view(counting_down_bytes_packet_bytes);
  AclPacketView counting_down_bytes_packet_view = AclPacketView::Create(counting_down_bytes_packet_bytes_view);
  AclView counting_down_bytes_packet_view = AclView::Create(counting_down_bytes_packet_bytes_view);
  ASSERT_TRUE(counting_down_bytes_packet_view.IsValid());
  ASSERT_TRUE(counting_down_bytes_packet_view.IsValid());


  ASSERT_EQ(handle, counting_down_bytes_packet_view.GetHandle());
  ASSERT_EQ(handle, counting_down_bytes_packet_view.GetHandle());
@@ -130,8 +130,8 @@ TEST(AclBuilderTest, buildInformationRequest) {
  payload->AddOctets(payload_bytes);
  payload->AddOctets(payload_bytes);
  ASSERT_EQ(payload_bytes.size(), payload->size());
  ASSERT_EQ(payload_bytes.size(), payload->size());


  std::unique_ptr<AclPacketBuilder> packet =
  std::unique_ptr<AclBuilder> packet =
      AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(payload));
      AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(payload));


  ASSERT_EQ(information_request.size(), packet->size());
  ASSERT_EQ(information_request.size(), packet->size());


@@ -139,7 +139,7 @@ TEST(AclBuilderTest, buildInformationRequest) {
  BitInserter it(*packet_bytes);
  BitInserter it(*packet_bytes);
  packet->Serialize(it);
  packet->Serialize(it);
  PacketView<true> packet_bytes_view(packet_bytes);
  PacketView<true> packet_bytes_view(packet_bytes);
  AclPacketView packet_view = AclPacketView::Create(packet_bytes_view);
  AclView packet_view = AclView::Create(packet_bytes_view);
  ASSERT_TRUE(packet_view.IsValid());
  ASSERT_TRUE(packet_view.IsValid());


  ASSERT_EQ(packet_bytes->size(), information_request.size());
  ASSERT_EQ(packet_bytes->size(), information_request.size());
Loading