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

Commit 3d06cd77 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Łukasz Rymanowski
Browse files

LeAudio: Initial tests for LeAudioClientInterface

Bug: 327304653
Test: atest --host bluetooth-test-audio-hal-le-audio-software
Change-Id: I880fae831192d744d1e3f743865cfea9a78e8bd6
Flag: Exempt; test only change
parent 54360abe
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -31,6 +31,13 @@ filegroup {
    ],
}

filegroup {
    name: "TestMockCodecManager",
    srcs: [
        "bta/le_audio/mock_codec_manager.cc",
    ],
}

genrule {
    name: "BlueberryFacadeGeneratedStub_h",
    tools: [
+108 −0
Original line number Diff line number Diff line
@@ -191,3 +191,111 @@ cc_test {
    ],
    header_libs: ["libbluetooth_headers"],
}

cc_defaults {
    name: "libbt_audio_hal_interface_test_defaults",
    header_libs: [
        "avrcp_headers",
        "libbluetooth_headers",
    ],
    defaults: [
        "latest_android_hardware_audio_common_ndk_static",
        "latest_android_hardware_bluetooth_audio_ndk_static",
        "latest_android_media_audio_common_types_ndk_static",
    ],
    shared_libs: [
        "libPlatformProperties",
        "libbinder_ndk",
        "libcrypto",
        "libfmq",
        "libstatslog",
        "libz",
        "server_configurable_flags",
    ],
    static_libs: [
        "android.hardware.audio.common@5.0",
        "android.hardware.bluetooth.a2dp@1.0",
        "android.hardware.bluetooth.audio@2.0",
        "android.hardware.bluetooth.audio@2.1",
        "android.hardware.bluetooth@1.0",
        "android.hardware.bluetooth@1.1",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
        "libFraunhoferAAC",
        "libaudio-a2dp-hw-utils",
        "libbase",
        "libbluetooth-dumpsys",
        "libbluetooth-gdx",
        "libbluetooth-protos",
        "libbluetooth-types",
        "libbluetooth_core_rs",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbluetooth_rust_interop",
        "libbt-common", // needed for MessageLoopThread
        "libbt-jni-thread",
        "libbt-sbc-decoder",
        "libbt-sbc-encoder",
        "libbt-stack",
        "libbt-stack-core",
        "libbt_shim_bridge",
        "libbtcore",
        "libbtdevice",
        "libbte",
        "libbtif",
        "libbtif-core",
        "libcgrouprc",
        "libcgrouprc_format",
        "libchrome",
        "libcutils",
        "libevent",
        "libg722codec",
        "libhidlbase",
        "libjsoncpp",
        "liblc3",
        "liblog",
        "libopus",
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
        "libudrv-uipc",
        "libutils",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/include",
        "packages/modules/Bluetooth/system/btif",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/include",
    ],
}

// Bluetooth Audio client interface library unit tests
cc_test {
    name: "bluetooth-test-audio-hal-le-audio-software",
    host_supported: true,
    defaults: [
        "libbt_audio_hal_interface_test_defaults",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system/audio_hal_interface",
        "packages/modules/Bluetooth/system/bta",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockAudioHalInterface",
        ":TestMockCodecManager",
        ":TestMockOsi",
        "aidl/le_audio_software_aidl.cc",
        "hidl/le_audio_software_hidl.cc",
        "le_audio_software.cc",
        "le_audio_software_unittest.cc",
    ],
    static_libs: [
        "libgmock",
    ],
    cflags: [
        "-DBUILDCFG",
    ],
}
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@

#include <bluetooth/log.h>

#include "audio_aidl_interfaces.h"

namespace bluetooth {
namespace audio {
namespace aidl {
+4 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ BluetoothAudioClientInterface::BluetoothAudioClientInterface(
      AIBinder_DeathRecipient_new(binderDiedCallbackAidl));
}

bool BluetoothAudioClientInterface::IsValid() const {
  return provider_ != nullptr;
}

bool BluetoothAudioClientInterface::is_aidl_available() {
  return AServiceManager_isDeclared(
      kDefaultAudioProviderFactoryInterface.c_str());
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ class BluetoothAudioClientInterface {
  BluetoothAudioClientInterface(IBluetoothTransportInstance* instance);
  virtual ~BluetoothAudioClientInterface() = default;

  bool IsValid() const { return provider_ != nullptr; }
  bool IsValid() const;

  std::vector<AudioCapabilities> GetAudioCapabilities() const;

Loading