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

Commit 894cd384 authored by William Escande's avatar William Escande
Browse files

uuid: remove libchrome dependency

Bug: 343550315
Test: atest net_test_types
Test: atest net_test_stack_gatt
Test: atest bluetooth_groups_test
Test: atest net_test_bluetooth
Test: atest net_test_stack_sdp
Flag: Exempt mechanical
Change-Id: I0922a88d6b1770faaf81ed1404f406d582d5471d
parent 281c98bc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -155,6 +155,9 @@ cc_library_static {
        "libcom.android.sysprop.bluetooth.wrapped",
        "liblc3",
    ],
    shared_libs: [
        "libcrypto",
    ],
    generated_headers: [
        "LeAudioSetConfigSchemas_h",
    ],
@@ -220,6 +223,9 @@ cc_library_static {
        "libflatbuffers-cpp",
        "server_configurable_flags",
    ],
    shared_libs: [
        "libcrypto",
    ],
    apex_available: [
        "com.android.btservices",
    ],
+7 −2
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@
#include <vector>

#include "bta/gatt/bta_gattc_int.h"
#include "gd/hci/uuid.h"
#include "gd/os/rand.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "stack/include/bt_hdr.h"
@@ -84,9 +86,12 @@ void BTA_GATTC_AppRegister(tBTA_GATTC_CBACK* p_client_cb,
    bta_sys_register(BTA_ID_GATTC, &bta_gattc_reg);
  }

  Uuid uuid =
      Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());

  do_in_main_thread(FROM_HERE,
                    base::BindOnce(&bta_gattc_register, Uuid::GetRandom(),
                                   p_client_cb, std::move(cb), eatt_support));
                    base::BindOnce(&bta_gattc_register, uuid, p_client_cb,
                                   std::move(cb), eatt_support));
}

static void app_deregister_impl(tGATT_IF client_if) {
+13 −6
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <gtest/gtest.h>

#include "bta_groups.h"
#include "gd/os/rand.h"
#include "test/common/mock_functions.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"
@@ -169,8 +170,10 @@ TEST_F(GroupsTest, test_add_multiple_groups) {
}

TEST_F(GroupsTest, test_remove_multiple_groups) {
  Uuid uuid1 = Uuid::GetRandom();
  Uuid uuid2 = Uuid::GetRandom();
  Uuid uuid1 =
      Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
  Uuid uuid2 =
      Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
  ASSERT_NE(uuid1, uuid2);

  EXPECT_CALL(*callbacks, OnGroupAdded(_, _, _)).Times(2);
@@ -189,8 +192,10 @@ TEST_F(GroupsTest, test_remove_multiple_groups) {
}

TEST_F(GroupsTest, test_remove_device_fo_devices) {
  Uuid uuid1 = Uuid::GetRandom();
  Uuid uuid2 = Uuid::GetRandom();
  Uuid uuid1 =
      Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
  Uuid uuid2 =
      Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
  EXPECT_CALL(*callbacks, OnGroupAdded(_, _, _)).Times(2);
  DeviceGroups::Initialize(callbacks.get());
  DeviceGroups::Get()->AddDevice(GetTestAddress(1), uuid1, 8);
@@ -270,8 +275,10 @@ TEST_F(GroupsTest, test_storage_calls) {
TEST_F(GroupsTest, test_storage_content) {
  int gid1 = bluetooth::groups::kGroupUnknown;
  int gid2 = bluetooth::groups::kGroupUnknown;
  Uuid uuid1 = Uuid::GetRandom();
  Uuid uuid2 = Uuid::GetRandom();
  Uuid uuid1 =
      Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
  Uuid uuid2 =
      Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
  ASSERT_NE(uuid1, uuid2);

  DeviceGroups::Initialize(callbacks.get());
+5 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
#include "bta/include/bta_gatt_api.h"
#include "bta/include/bta_ras_api.h"
#include "bta/ras/ras_types.h"
#include "gd/hci/uuid.h"
#include "gd/os/rand.h"
#include "os/logging/log_adapter.h"
#include "stack/include/bt_types.h"
#include "stack/include/btm_ble_addr.h"
@@ -63,7 +65,9 @@ class RasServerImpl : public bluetooth::ras::RasServer {
  };

  void Initialize() {
    app_uuid_ = bluetooth::Uuid::GetRandom();
    Uuid uuid =
        Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
    app_uuid_ = uuid;
    log::info("Register server with uuid:{}", app_uuid_.ToString());

    BTA_GATTS_AppRegister(
+4 −2
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ bt_status_t btsock_l2cap_connect(const RawAddress* bd_addr, int channel,
void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id);
void on_l2cap_psm_assigned(int id, int psm);
bt_status_t btsock_l2cap_disconnect(const RawAddress* bd_addr);
bt_status_t btsock_l2cap_get_l2cap_local_cid(Uuid& conn_uuid, uint16_t* cid);
bt_status_t btsock_l2cap_get_l2cap_remote_cid(Uuid& conn_uuid, uint16_t* cid);
bt_status_t btsock_l2cap_get_l2cap_local_cid(bluetooth::Uuid& conn_uuid,
                                             uint16_t* cid);
bt_status_t btsock_l2cap_get_l2cap_remote_cid(bluetooth::Uuid& conn_uuid,
                                              uint16_t* cid);

#endif
Loading