audio: Add android.hardware.audio[.common]@7.1-util modules

android.hardware.audio.common@7.1-util and
android.hardware.audio@7.1-util utilize the 7.1 XSD enums
conversion library and thus can work with the new
enum strings added in 7.1

Bug: 218504031
Test: atest VtsHalAudioV7_1TargetTest
Test: atest android.hardware.audio.common@7.0-util_tests
Test: atest android.hardware.audio.common@7.1-util_tests
Test: atest android.hardware.audio@7.0-util_tests
Test: atest android.hardware.audio@7.1-util_tests
Change-Id: Icc5a354cdc2e377a2a2424c28377bcb0ba05bf4e
This commit is contained in:
Mikhail Naganov
2022-02-09 00:23:14 +00:00
parent 9a30ec87a3
commit fa4a4f8da7
9 changed files with 124 additions and 11 deletions

View File

@@ -157,6 +157,28 @@ cc_library {
],
}
cc_library {
name: "android.hardware.audio.common@7.1-util",
defaults: ["android.hardware.audio.common-util_default"],
srcs: [
"7.0/HidlUtils.cpp",
"HidlUtilsCommon.cpp",
"UuidUtils.cpp",
],
shared_libs: [
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.1-enums",
"libbase",
],
cflags: [
"-DMAJOR_VERSION=7",
"-DMINOR_VERSION=1",
"-DCOMMON_TYPES_MINOR_VERSION=0",
"-DCORE_TYPES_MINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
],
}
// Note: this isn't a VTS test, but rather a unit test
// to verify correctness of conversion utilities.
cc_test {
@@ -214,3 +236,35 @@ cc_test {
test_suites: ["device-tests"],
}
cc_test {
name: "android.hardware.audio.common@7.1-util_tests",
defaults: ["android.hardware.audio.common-util_default"],
srcs: ["tests/hidlutils_tests.cpp"],
// Use static linking to allow running in presubmit on
// targets that don't have HAL V7.1.
static_libs: [
"android.hardware.audio.common@7.1-enums",
"android.hardware.audio.common@7.1-util",
"android.hardware.audio.common@7.0",
],
shared_libs: [
"libbase",
"libxml2",
],
cflags: [
"-Werror",
"-Wall",
"-DMAJOR_VERSION=7",
"-DMINOR_VERSION=1",
"-DCOMMON_TYPES_MINOR_VERSION=0",
"-DCORE_TYPES_MINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
],
test_suites: ["device-tests"],
}

View File

@@ -20,7 +20,7 @@ namespace android {
namespace hardware {
namespace audio {
namespace common {
namespace CPP_VERSION {
namespace COMMON_TYPES_CPP_VERSION {
namespace implementation {
status_t HidlUtils::audioPortConfigsFromHal(unsigned int numHalConfigs,
@@ -51,7 +51,7 @@ status_t HidlUtils::audioPortConfigsToHal(const hidl_vec<AudioPortConfig>& confi
}
} // namespace implementation
} // namespace CPP_VERSION
} // namespace COMMON_TYPES_CPP_VERSION
} // namespace common
} // namespace audio
} // namespace hardware

View File

@@ -5,6 +5,9 @@
},
{
"name": "android.hardware.audio.common@7.0-util_tests"
},
{
"name": "android.hardware.audio.common@7.1-util_tests"
}
]
}

View File

@@ -23,7 +23,7 @@
#include <log/log.h>
#include <HidlUtils.h>
#include <android_audio_policy_configuration_V7_0-enums.h>
#include PATH(APM_XSD_ENUMS_H_FILENAME)
#include <system/audio.h>
#include <xsdc/XsdcSupport.h>
@@ -32,7 +32,7 @@ using ::android::hardware::hidl_vec;
using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils;
namespace xsd {
using namespace ::android::audio::policy::configuration::V7_0;
using namespace ::android::audio::policy::configuration::CPP_VERSION;
}
static constexpr audio_channel_mask_t kInvalidHalChannelMask = AUDIO_CHANNEL_INVALID;

View File

@@ -168,10 +168,10 @@ cc_defaults {
shared_libs: [
"android.hardware.audio@7.0",
"android.hardware.audio@7.1",
"android.hardware.audio@7.0-util",
"android.hardware.audio@7.1-util",
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.1-enums",
"android.hardware.audio.common@7.0-util",
"android.hardware.audio.common@7.1-util",
"libbase",
],
cflags: [

View File

@@ -3,6 +3,9 @@
{
"name": "android.hardware.audio@7.0-util_tests"
},
{
"name": "android.hardware.audio@7.1-util_tests"
},
{
"name": "HalAudioV6_0GeneratorTest"
},

View File

@@ -112,6 +112,25 @@ cc_library {
],
}
cc_library {
name: "android.hardware.audio@7.1-util",
defaults: ["android.hardware.audio-util_default"],
shared_libs: [
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.1-enums",
"android.hardware.audio.common@7.1-util",
"android.hardware.audio@7.1",
"libbase",
],
cflags: [
"-DMAJOR_VERSION=7",
"-DMINOR_VERSION=1",
"-DCOMMON_TYPES_MINOR_VERSION=0",
"-DCORE_TYPES_MINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
],
}
// Note: this isn't a VTS test, but rather a unit test
// to verify correctness of conversion utilities.
cc_test {
@@ -145,3 +164,37 @@ cc_test {
test_suites: ["device-tests"],
}
cc_test {
name: "android.hardware.audio@7.1-util_tests",
defaults: ["android.hardware.audio-util_default"],
srcs: ["tests/coreutils_tests.cpp"],
// Use static linking to allow running in presubmit on
// targets that don't have HAL V7.1.
static_libs: [
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.1-enums",
"android.hardware.audio.common@7.1-util",
"android.hardware.audio@7.1",
"android.hardware.audio@7.1-util",
],
shared_libs: [
"libbase",
"libxml2",
],
cflags: [
"-Werror",
"-Wall",
"-DMAJOR_VERSION=7",
"-DMINOR_VERSION=1",
"-DCOMMON_TYPES_MINOR_VERSION=0",
"-DCORE_TYPES_MINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
],
test_suites: ["device-tests"],
}

View File

@@ -22,18 +22,18 @@
#define LOG_TAG "CoreUtils_Test"
#include <log/log.h>
#include <android_audio_policy_configuration_V7_0-enums.h>
#include PATH(APM_XSD_ENUMS_H_FILENAME)
#include <system/audio.h>
#include <util/CoreUtils.h>
#include <xsdc/XsdcSupport.h>
using namespace android;
using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
using namespace ::android::hardware::audio::CPP_VERSION;
using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION;
using ::android::hardware::hidl_vec;
using ::android::hardware::audio::CPP_VERSION::implementation::CoreUtils;
using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::CoreUtils;
namespace xsd {
using namespace ::android::audio::policy::configuration::V7_0;
using namespace ::android::audio::policy::configuration::CPP_VERSION;
}
static constexpr audio_channel_mask_t kInvalidHalChannelMask = AUDIO_CHANNEL_INVALID;

View File

@@ -200,7 +200,7 @@ cc_test {
"android.hardware.audio.common@7.0",
"android.hardware.audio.common@7.0-enums",
"android.hardware.audio.common@7.1-enums",
"android.hardware.audio.common@7.0-util",
"android.hardware.audio.common@7.1-util",
],
cflags: [
"-DMAJOR_VERSION=7",