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

Commit ea1f19db authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

libaudiohal: Add support for audio@7.1

Added libauiohal@7.1 to support audio@7.1, core interfaces only,
no effects (these are still @7.0). Removed version-bound
namespace from the implementation to simplify code reuse. The
implementation classes are not exported from the libaudiohal
.so, thus no name conflicts could occur.

libaudiohal now tries audio@7.1 first and loads libaudiohal@7.1
client library. The library code has been updated to handle
opening of the primary device in the way appropriate for V7.1.

Note that as the effect HAL is 7.0, libaudiohal ends up loading
@7.1 client for the core HAL and @7.0 client for the effect
HAL. This can increase memory consumption.

Bug: 214426419
Test: check audio functionality on cuttlefish
      and redfin (temporarily updated to @7.1)
Change-Id: I62f72dc86dee472d6b358a9861882b9b7f6c6177
(cherry picked from commit 6718c396)
Merged-In: I62f72dc86dee472d6b358a9861882b9b7f6c6177
parent a7fb63b8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ cc_library_shared {
        "libaudiohal@5.0",
        "libaudiohal@6.0",
        "libaudiohal@7.0",
        "libaudiohal@7.1",
    ],

    shared_libs: [
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ namespace {
/** Supported HAL versions, in order of preference.
 */
const char* sAudioHALVersions[] = {
    "7.1",
    "7.0",
    "6.0",
    "5.0",
+56 −7
Original line number Diff line number Diff line
@@ -7,22 +7,33 @@ package {
    default_applicable_licenses: ["frameworks_av_license"],
}

cc_defaults {
    name: "libaudiohal_default",

filegroup {
    name: "audio_core_hal_client_sources",
    srcs: [
        "DeviceHalLocal.cpp",
        "DevicesFactoryHalHybrid.cpp",
        "DevicesFactoryHalLocal.cpp",
        "StreamHalLocal.cpp",

        "ConversionHelperHidl.cpp",
        "DeviceHalHidl.cpp",
        "DevicesFactoryHalHidl.cpp",
        "StreamHalLocal.cpp",
        "StreamHalHidl.cpp",
    ],
}

filegroup {
    name: "audio_effect_hal_client_sources",
    srcs: [
        "EffectBufferHalHidl.cpp",
        "EffectHalHidl.cpp",
        "EffectsFactoryHalHidl.cpp",
        "StreamHalHidl.cpp",
    ],
}

cc_defaults {
    name: "libaudiohal_default",

    srcs: [
        "ConversionHelperHidl.cpp",
    ],

    cflags: [
@@ -65,6 +76,10 @@ cc_defaults {
cc_library_shared {
    name: "libaudiohal@4.0",
    defaults: ["libaudiohal_default"],
    srcs: [
        ":audio_core_hal_client_sources",
        ":audio_effect_hal_client_sources",
    ],
    shared_libs: [
        "android.hardware.audio.common@4.0",
        "android.hardware.audio.common@4.0-util",
@@ -83,6 +98,10 @@ cc_library_shared {
cc_library_shared {
    name: "libaudiohal@5.0",
    defaults: ["libaudiohal_default"],
    srcs: [
        ":audio_core_hal_client_sources",
        ":audio_effect_hal_client_sources",
    ],
    shared_libs: [
        "android.hardware.audio.common@5.0",
        "android.hardware.audio.common@5.0-util",
@@ -101,6 +120,10 @@ cc_library_shared {
cc_library_shared {
    name: "libaudiohal@6.0",
    defaults: ["libaudiohal_default"],
    srcs: [
        ":audio_core_hal_client_sources",
        ":audio_effect_hal_client_sources",
    ],
    shared_libs: [
        "android.hardware.audio.common@6.0",
        "android.hardware.audio.common@6.0-util",
@@ -119,6 +142,10 @@ cc_library_shared {
cc_library_shared {
    name: "libaudiohal@7.0",
    defaults: ["libaudiohal_default"],
    srcs: [
        ":audio_core_hal_client_sources",
        ":audio_effect_hal_client_sources",
    ],
    shared_libs: [
        "android.hardware.audio.common@7.0",
        "android.hardware.audio.common@7.0-util",
@@ -133,3 +160,25 @@ cc_library_shared {
        "-include common/all-versions/VersionMacro.h",
    ]
}

cc_library_shared {
    name: "libaudiohal@7.1",
    defaults: ["libaudiohal_default"],
    srcs: [
        ":audio_core_hal_client_sources",
    ],
    shared_libs: [
        "android.hardware.audio.common@7.0",
        "android.hardware.audio.common@7.0-util",
        "android.hardware.audio@7.0",
        "android.hardware.audio@7.1",
        "android.hardware.audio@7.0-util",
    ],
    cflags: [
        "-DMAJOR_VERSION=7",
        "-DMINOR_VERSION=1",
        "-DCOMMON_TYPES_MINOR_VERSION=0",
        "-DCORE_TYPES_MINOR_VERSION=0",
        "-include common/all-versions/VersionMacro.h",
    ]
}
+2 −4
Original line number Diff line number Diff line
@@ -24,10 +24,9 @@
#include "ConversionHelperHidl.h"

namespace android {
namespace CPP_VERSION {

using namespace ::android::hardware::audio::common::CPP_VERSION;
using namespace ::android::hardware::audio::CPP_VERSION;
using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION;

// static
status_t ConversionHelperHidl::keysFromHal(const String8& keys, hidl_vec<hidl_string> *hidlKeys) {
@@ -120,5 +119,4 @@ void ConversionHelperHidl::emitError(const char* funcName, const char* descripti
    ALOGE("%s %p %s: %s (from rpc)", mClassName, this, funcName, description);
}

}  // namespace CPP_VERSION
}  // namespace android
+3 −5
Original line number Diff line number Diff line
@@ -17,20 +17,19 @@
#ifndef ANDROID_HARDWARE_CONVERSION_HELPER_HIDL_H
#define ANDROID_HARDWARE_CONVERSION_HELPER_HIDL_H

#include PATH(android/hardware/audio/FILE_VERSION/types.h)
#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h)
#include <hidl/HidlSupport.h>
#include <system/audio.h>
#include <utils/String8.h>

using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using CoreResult = ::android::hardware::audio::CPP_VERSION::Result;
using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::ParameterValue;
using CoreResult = ::android::hardware::audio::CORE_TYPES_CPP_VERSION::Result;

using ::android::hardware::Return;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;

namespace android {
namespace CPP_VERSION {

class ConversionHelperHidl {
  protected:
@@ -82,7 +81,6 @@ class ConversionHelperHidl {
    void emitError(const char* funcName, const char* description);
};

}  // namespace CPP_VERSION
}  // namespace android

#endif // ANDROID_HARDWARE_CONVERSION_HELPER_HIDL_H
Loading