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

Commit 7a58427b authored by David Duarte's avatar David Duarte Committed by Gerrit Code Review
Browse files

Merge changes from topic "remove_bluetooth_service"

* changes:
  Remove bluetooth native service
  Add libPlatformProperties as dependency to bluetoothtbd
  Remove dependency to low_energy_constants.h
  Remove dependency to libbluetoothtbd_hal
parents 3933c33b 4b0e837a
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -112,9 +112,6 @@
    {
      "name": "bluetooth_vc_test"
    },
    {
      "name": "bluetoothtbd_test"
    },
    {
      "name": "bt_host_test_bta"
    },
+9 −2
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include "gd/common/strings.h"
#include "osi/include/log.h"
#include "osi/include/properties.h"
#include "service/common/bluetooth/low_energy_constants.h"
#include "stack/include/ble_advertiser.h"
#include "stack/include/btm_iso_api.h"
#include "stack/include/btu.h"
@@ -47,6 +46,14 @@ using namespace le_audio::broadcaster;

namespace {

// Advertising channels. These should be kept the same as those defined in the
// stack.
const int kAdvertisingChannel37 = (1 << 0);
const int kAdvertisingChannel38 = (1 << 1);
const int kAdvertisingChannel39 = (1 << 2);
const int kAdvertisingChannelAll =
    (kAdvertisingChannel37 | kAdvertisingChannel38 | kAdvertisingChannel39);

class BroadcastStateMachineImpl : public BroadcastStateMachine {
 public:
  BroadcastStateMachineImpl(BroadcastStateMachineConfig msg)
@@ -291,7 +298,7 @@ class BroadcastStateMachineImpl : public BroadcastStateMachine {
      adv_params.adv_int_min = 0x00A0; /* 160 * 0,625 = 100ms */
      adv_params.adv_int_max = 0x0140; /* 320 * 0,625 = 200ms */
      adv_params.advertising_event_properties = 0;
      adv_params.channel_map = bluetooth::kAdvertisingChannelAll;
      adv_params.channel_map = kAdvertisingChannelAll;
      adv_params.adv_filter_policy = 0;
      adv_params.tx_power = 8;
      adv_params.primary_advertising_phy = PHY_LE_1M;
+0 −2
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ static_library("bluetooth-static") {
  complete_static_lib = true

  sources = [
    "//bt/system/service/hal/bluetooth_interface.cc",
    "//bt/system/service/logging_helpers.cc",
  ]

  configs += [

system/service/Android.bp

deleted100644 → 0
+0 −311
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "system_bt_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["system_bt_license"],
}

subdirs = [
    "common",
]

cc_defaults {
    name: "fluoride_service_defaults",
    defaults: ["fluoride_defaults"],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
    ],
    header_libs: ["libbluetooth_headers"],
}

// Source variables
btserviceDaemonSrc = [
    "a2dp_sink.cc",
    "a2dp_source.cc",
    "adapter.cc",
    "avrcp_control.cc",
    "avrcp_target.cc",
    "daemon.cc",
    "gatt_client.cc",
    "gatt_server.cc",
    "gatt_server_old.cc",
    "hal/bluetooth_av_interface.cc",
    "hal/bluetooth_avrcp_interface.cc",
    "hal/bluetooth_gatt_interface.cc",
    "hal/bluetooth_interface.cc",
    "ipc/ipc_handler.cc",
    "ipc/ipc_manager.cc",
    "logging_helpers.cc",
    "low_energy_advertiser.cc",
    "low_energy_scanner.cc",
    "low_energy_client.cc",
    "settings.cc",
]

btserviceLinuxSrc = [
    "ipc/ipc_handler_linux.cc",
    "ipc/linux_ipc_host.cc",
]

btserviceBinderDaemonSrc = [
    "ipc/binder/bluetooth_a2dp_sink_binder_server.cc",
    "ipc/binder/bluetooth_a2dp_source_binder_server.cc",
    "ipc/binder/bluetooth_avrcp_control_binder_server.cc",
    "ipc/binder/bluetooth_avrcp_target_binder_server.cc",
    "ipc/binder/bluetooth_binder_server.cc",
    "ipc/binder/bluetooth_gatt_client_binder_server.cc",
    "ipc/binder/bluetooth_gatt_server_binder_server.cc",
    "ipc/binder/bluetooth_le_advertiser_binder_server.cc",
    "ipc/binder/bluetooth_le_scanner_binder_server.cc",
    "ipc/binder/bluetooth_low_energy_binder_server.cc",
    "ipc/binder/interface_with_instances_base.cc",
    "ipc/binder/ipc_handler_binder.cc",
]

// Main unit test sources. These get built for host and target.
btserviceBaseTestSrc = [
    "hal/fake_bluetooth_av_interface.cc",
    "hal/fake_bluetooth_gatt_interface.cc",
    "hal/fake_bluetooth_interface.cc",
    "test/a2dp_sink_unittest.cc",
    "test/a2dp_source_unittest.cc",
    "test/adapter_unittest.cc",
    "test/advertise_data_unittest.cc",
    "test/fake_hal_util.cc",
    "test/gatt_client_unittest.cc",
    "test/gatt_server_unittest.cc",
    "test/low_energy_advertiser_unittest.cc",
    "test/low_energy_client_unittest.cc",
    "test/low_energy_scanner_unittest.cc",
    "test/settings_unittest.cc",
]

// Native system service for target
cc_binary {
    name: "bluetoothtbd",
    defaults: ["fluoride_service_defaults"],
    srcs: btserviceBinderDaemonSrc +
        btserviceLinuxSrc +
        btserviceDaemonSrc +
        ["main.cc"],
    static_libs: [
        "avrcp-target-service",
        "libaudio-a2dp-hw-utils",
        "libbluetooth-binder-common",
        "libbluetooth-dumpsys",
        "libbluetooth-types",
        "libbt-audio-hal-interface",
        "libbt-bta",
        "libbt-bta-core",
        "libbt-common",
        "libbtcore",
        "libbtdevice",
        "libbte",
        "libbt-hci",
        "libbthalutils",
        "libbtif",
        "libbtif-core",
        "lib-bt-packets",
        "lib-bt-packets-avrcp",
        "lib-bt-packets-base",
        "libbt-protos-lite",
        "libbt-sbc-decoder",
        "libbt-sbc-encoder",
        "libbt-stack",
        "libbt-stack-core",
        "libbt-utils",
        "libc++fs",
        "libchrome",
        "libflatbuffers-cpp",
        "libFraunhoferAAC",
        "libg722codec",
        "liblc3",
        "libopus",
        "libosi",
        "libudrv-uipc",
    ],

    shared_libs: [
        "android.hardware.bluetooth@1.0",
        "android.hardware.bluetooth@1.1",
        "android.hardware.bluetooth.a2dp@1.0",
        "android.hardware.bluetooth.audio@2.0",
        "android.hardware.bluetooth.audio@2.1",
        "android.system.suspend.control-V1-ndk",
        "android.system.suspend-V1-ndk",
        "libaaudio",
        "libbinder",
        "libbinder_ndk",
        "libcrypto",
        "libcutils",
        "libfmq",
        "liblog",
        "libprocessgroup",
        "libprotobuf-cpp-lite",
        "libutils",
    ],
    init_rc: ["bluetoothtbd.rc"],
    target: {
        android: {
            shared_libs: [
                "android.hardware.bluetooth.audio-V3-ndk",
            ],
        },
    },
}

// Native system service unit tests for target and host

cc_test {
    name: "bluetoothtbd_test",
    test_suites: ["device-tests"],
    defaults: [
        "fluoride_service_defaults",
        "mts_defaults",
    ],
    srcs: btserviceBaseTestSrc +
        btserviceDaemonSrc + [
            "test/main.cc",
        ],
    aidl: {
        include_dirs: [
            "packages/modules/Bluetooth/system/service/common",
            "frameworks/native/aidl/binder",
        ],
    },
    static_libs: [
        "android.hardware.bluetooth.a2dp@1.0",
        "avrcp-target-service",
        "libaudio-a2dp-hw-utils",
        "libbluetooth-common",
        "libbluetooth-dumpsys",
        "libbluetooth-types",
        "libbt-audio-hal-interface",
        "libbt-bta",
        "libbt-bta-core",
        "libbt-common",
        "libbtcore",
        "libbtdevice",
        "libbte",
        "libbt-hci",
        "libbtif",
        "libbtif-core",
        "lib-bt-packets",
        "lib-bt-packets-avrcp",
        "lib-bt-packets-base",
        "libbt-protos-lite",
        "libbt-sbc-decoder",
        "libbt-sbc-encoder",
        "libbt-stack",
        "libbt-stack-core",
        "libbt-utils",
        "libc++fs",
        "libchrome",
        "libgmock",
        "liblog",
        "libflatbuffers-cpp",
        "libFraunhoferAAC",
        "libg722codec",
        "liblc3",
        "libopus",
        "libosi",
        "libudrv-uipc",
    ],
    shared_libs: [
        "android.hardware.bluetooth@1.0",
        "android.hardware.bluetooth@1.1",
        "android.hardware.bluetooth.audio@2.0",
        "android.hardware.bluetooth.audio@2.1",
        "libbinder_ndk",
        "libcrypto",
        "libfmq",
        "libprocessgroup",
        "libprotobuf-cpp-lite",
    ],

    // host_supported: true, // TODO (b/263324289)
    test_options: {
        unit_test: true,
    },
    target: {
        // This includes Binder related tests that can only be run
        // on target.
        android: {
            srcs: btserviceBinderDaemonSrc + [
                "test/parcelable_unittest.cc",
                "test/ParcelableTest.aidl",
            ],
            static_libs: [
                "android.system.suspend.control-V1-ndk",
                "libbluetooth-binder-common",
            ],
            shared_libs: [
                "android.hardware.bluetooth.audio-V3-ndk",
                "android.system.suspend-V1-ndk",
                "libbinder",
                "libvndksupport",
            ],
        },
        host: {
            srcs: [
                "test/stub_ipc_handler_binder.cc",
            ],
        },
        host_linux: {
            srcs: btserviceLinuxSrc + [
                // TODO(bcf): Fix this test.
                //"test/ipc_linux_unittest.cc",
            ],
        },
    },
    sanitize: {
        cfi: false,
    },
}

// Native system service CLI for target
cc_binary {
    name: "bluetooth-cli",
    defaults: ["fluoride_defaults"],
    srcs: ["client/main.cc"],
    static_libs: [
        "libbluetooth-binder-common",
    ],
    shared_libs: [
        "libbinder",
        "libutils",
    ],
}

// Heart Rate GATT service example for target
cc_binary {
    name: "bt-example-hr-server",
    defaults: ["fluoride_defaults"],
    local_include_dirs: ["example/heart_rate"],
    srcs: [
        "example/heart_rate/heart_rate_server.cc",
        "example/heart_rate/server_main.cc",
    ],
    static_libs: [
        "libbluetooth-binder-common",
    ],
    shared_libs: [
        "libbinder",
        "libutils",
    ],
}

cc_library_static {
    name: "libbluetoothtbd_hal",
    defaults: ["fluoride_defaults"],
    include_dirs: ["packages/modules/Bluetooth/system"],
    header_libs: ["libbluetooth_headers"],
    srcs: [
        "hal/bluetooth_gatt_interface.cc",
        "hal/bluetooth_interface.cc",
        "logging_helpers.cc",
    ],
}

system/service/BUILD.gn

deleted100644 → 0
+0 −171
Original line number Diff line number Diff line
#
#  Copyright 2015 Google
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at:
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

config("service_config") {
  include_dirs = [
    "//bt/system/",
    "//bt/system/linux_include",
    "//bt/system/include",
    "//bt/system/service",
    "//bt/system/service/common",
  ]

  configs = [ "//bt/system:target_defaults" ]
}

source_set("service_daemon_src") {
  sources = [
    "a2dp_sink.cc",
    "a2dp_source.cc",
    "adapter.cc",
    "avrcp_control.cc",
    "avrcp_target.cc",
    "daemon.cc",
    "gatt_client.cc",
    "gatt_server.cc",
    "gatt_server_old.cc",
    "hal/bluetooth_av_interface.cc",
    "hal/bluetooth_avrcp_interface.cc",
    "hal/bluetooth_gatt_interface.cc",
    "hal/bluetooth_interface.cc",
    "ipc/ipc_handler.cc",
    "ipc/ipc_manager.cc",
    "logging_helpers.cc",
    "low_energy_advertiser.cc",
    "low_energy_client.cc",
    "low_energy_scanner.cc",
    "settings.cc",
  ]

  deps = [
    "//bt/system/gd/rust/shim:init_flags_bridge_header",
    "//bt/system/osi",
    "//bt/system/types",
  ]

  configs += [ ":service_config" ]
}

source_set("service_linux_src") {
  sources = [
    "ipc/ipc_handler_linux.cc",
    "ipc/linux_ipc_host.cc",
    "ipc/dbus/ipc_handler_dbus.cc",
    "ipc/dbus/bluetooth_adapter.cc",
  ]

  deps = [
    "//bt/system/gd/rust/shim:init_flags_bridge_header",
    "//bt/system/osi",
    "//bt/system/types",
  ]

  configs += [ ":service_config" ]
}

static_library("service") {
  sources = [
    "common/bluetooth/a2dp_codec_config.cc",
    "common/bluetooth/adapter_state.cc",
    "common/bluetooth/advertise_data.cc",
    "common/bluetooth/advertise_settings.cc",
    "common/bluetooth/avrcp_int_value.cc",
    "common/bluetooth/avrcp_media_attr.cc",
    "common/bluetooth/avrcp_register_notification_response.cc",
    "common/bluetooth/characteristic.cc",
    "common/bluetooth/descriptor.cc",
    "common/bluetooth/remote_device_props.cc",
    "common/bluetooth/scan_filter.cc",
    "common/bluetooth/scan_result.cc",
    "common/bluetooth/scan_settings.cc",
    "common/bluetooth/service.cc",
    "common/bluetooth/util/atomic_string.cc",
  ]

  deps = [
    ":service_daemon_src",
    ":service_linux_src",
    "//bt/system/gd/rust/shim:init_flags_bridge_header",
    "//bt/system/osi",
    "//bt/system/types",
  ]

  configs += [ ":service_config" ]
}

executable("bluetoothtbd") {
  sources = [ "main.cc" ]

  deps = [
    ":service",
    "//bt/system/btcore",
    "//bt/system/main:bluetooth",
  ]

  configs += [ ":service_config" ]

  libs = [
    "dl",
    "pthread",
    "rt",
    "bt_shim_ffi",
    "ssl",
    "crypto",
  ]

  lib_dirs = [
    "${root_out_dir}/rust"
  ]
}

if (use.test) {
  source_set("service_base_test_src") {
    sources = [
      "hal/fake_bluetooth_av_interface.cc",
      "hal/fake_bluetooth_gatt_interface.cc",
      "hal/fake_bluetooth_interface.cc",
      "test/a2dp_sink_unittest.cc",
      "test/a2dp_source_unittest.cc",
      "test/adapter_unittest.cc",
      "test/advertise_data_unittest.cc",
      "test/fake_hal_util.cc",
      "test/gatt_client_unittest.cc",
      "test/gatt_server_unittest.cc",
      "test/low_energy_advertiser_unittest.cc",
      "test/low_energy_client_unittest.cc",
      "test/low_energy_scanner_unittest.cc",
      "test/settings_unittest.cc",
    ]

    configs += [ ":service_config" ]
  }

  executable("bluetoothtbd_test") {
    sources = [ "test/main.cc" ]

    deps = [
      ":service_base_test_src",
      ":service_daemon_src",
      ":service_linux_src",
      "//bt/system/service/common:libbluetooth_common",
    ]

    configs += [
      "//bt/system:external_gmock_main",
      ":service_config",
    ]
  }
}
Loading