Loading audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -140,20 +140,23 @@ TEST_P(AudioHidlDeviceTest, SetConnectedState) { #if MAJOR_VERSION <= 6 using AD = AudioDevice; for (auto deviceType : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) { SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType)); #elif MAJOR_VERSION >= 7 using AD = xsd::AudioDevice; for (auto deviceType : {toString(AD::AUDIO_DEVICE_OUT_HDMI), toString(AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE), toString(AD::AUDIO_DEVICE_IN_USB_HEADSET)}) { for (auto deviceType : {AD::AUDIO_DEVICE_OUT_HDMI, AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE, AD::AUDIO_DEVICE_IN_USB_HEADSET}) { SCOPED_TRACE("device=" + toString(deviceType)); #endif SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType)); for (bool state : {true, false}) { SCOPED_TRACE("state=" + ::testing::PrintToString(state)); DeviceAddress address = {}; #if MAJOR_VERSION <= 6 address.device = deviceType; #elif MAJOR_VERSION >= 7 address.deviceType = deviceType; address.deviceType = toString(deviceType); if (deviceType == AD::AUDIO_DEVICE_IN_USB_HEADSET) { address.address.alsa({0, 0}); } #endif auto ret = getDevice()->setConnectedState(address, state); ASSERT_TRUE(ret.isOk()); Loading audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +21 −13 Original line number Diff line number Diff line Loading @@ -44,14 +44,17 @@ const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { for (const auto& device : getDeviceParameters()) { auto module = getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); if (!module || !module->getFirstMixPorts()) break; for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile std::vector<AudioInOutFlag> flags; bool isOffload = false; if (mixPort.hasFlags()) { auto xsdFlags = mixPort.getFlags(); const bool isOffload = isOffload = std::find(xsdFlags.begin(), xsdFlags.end(), xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != xsdFlags.end(); std::vector<AudioInOutFlag> flags; if (!isOffload) { for (auto flag : xsdFlags) { if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) { Loading @@ -61,6 +64,7 @@ const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { } else { flags = offloadFlags; } } for (const auto& profile : mixPort.getProfile()) { auto configs = combineAudioConfig(profile.getChannelMasks(), Loading Loading @@ -94,11 +98,15 @@ const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters() { for (const auto& device : getDeviceParameters()) { auto module = getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); if (!module || !module->getFirstMixPorts()) break; for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile std::vector<AudioInOutFlag> flags; std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), flags.begin(), if (mixPort.hasFlags()) { std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), std::back_inserter(flags), [](auto flag) { return toString(flag); }); } for (const auto& profile : mixPort.getProfile()) { auto configs = combineAudioConfig(profile.getChannelMasks(), Loading audio/core/all-versions/vts/functional/7.0/PolicyConfig.h +13 −7 Original line number Diff line number Diff line Loading @@ -33,7 +33,9 @@ class PolicyConfig { if (mConfig) { mStatus = OK; mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); if (mConfig->getFirstModules()) { for (const auto& module : mConfig->getFirstModules()->get_module()) { if (module.getFirstAttachedDevices()) { auto attachedDevices = module.getFirstAttachedDevices()->getItem(); if (!attachedDevices.empty()) { mModulesWithDevicesNames.insert(module.getName()); Loading @@ -41,6 +43,8 @@ class PolicyConfig { } } } } } status_t getStatus() const { return mStatus; } std::string getError() const { if (mFilePath.empty()) { Loading @@ -52,7 +56,7 @@ class PolicyConfig { } const std::string& getFilePath() const { return mFilePath; } const xsd::Module* getModuleFromName(const std::string& name) const { if (mConfig) { if (mConfig && mConfig->getFirstModules()) { for (const auto& module : mConfig->getFirstModules()->get_module()) { if (module.getName() == name) return &module; } Loading @@ -65,9 +69,11 @@ class PolicyConfig { } bool haveInputProfilesInModule(const std::string& name) const { auto module = getModuleFromName(name); if (module && module->getFirstMixPorts()) { for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() == xsd::Role::sink) return true; } } return false; } Loading audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +15 −15 Original line number Diff line number Diff line Loading @@ -156,6 +156,21 @@ const PolicyConfig& getCachedPolicyConfig() { return *policyConfig; } TEST(CheckConfig, audioPolicyConfigurationValidation) { const auto factories = ::android::hardware::getAllHalInstanceNames(IDevicesFactory::descriptor); if (factories.size() == 0) { GTEST_SKIP() << "Skipping audioPolicyConfigurationValidation because no factory instances " "are found."; } RecordProperty("description", "Verify that the audio policy configuration file " "is valid according to the schema"); const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd"; EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName, android::audio_get_configuration_paths(), xsd); } ////////////////////////////////////////////////////////////////////////////// //////////////////// Test parameter types and definitions //////////////////// ////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -231,21 +246,6 @@ class AudioHidlTestWithDeviceParameter : public HidlTest, } }; TEST(CheckConfig, audioPolicyConfigurationValidation) { auto deviceParameters = getDeviceParametersForFactoryTests(); if (deviceParameters.size() == 0) { GTEST_SKIP() << "Skipping audioPolicyConfigurationValidation because no device parameter " "is found."; } RecordProperty("description", "Verify that the audio policy configuration file " "is valid according to the schema"); const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd"; EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName, android::audio_get_configuration_paths(), xsd); } class AudioPolicyConfigTest : public AudioHidlTestWithDeviceParameter { public: void SetUp() override { Loading neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Callbacks.h +21 −4 Original line number Diff line number Diff line Loading @@ -32,6 +32,26 @@ namespace android::hardware::neuralnetworks::V1_0::utils { // Converts the results of IDevice::getSupportedOperations* to the NN canonical format. On success, // this function returns with the supported operations as indicated by a driver. On failure, this // function returns with the appropriate nn::GeneralError. nn::GeneralResult<std::vector<bool>> supportedOperationsCallback( ErrorStatus status, const hidl_vec<bool>& supportedOperations); // Converts the results of IDevice::prepareModel* to the NN canonical format. On success, this // function returns with a non-null nn::SharedPreparedModel with a feature level of // nn::Version::ANDROID_OC_MR1. On failure, this function returns with the appropriate // nn::GeneralError. nn::GeneralResult<nn::SharedPreparedModel> prepareModelCallback( ErrorStatus status, const sp<IPreparedModel>& preparedModel); // Converts the results of IDevice::execute* to the NN canonical format. On success, this function // returns with an empty output shape vector and no timing information. On failure, this function // returns with the appropriate nn::ExecutionError. nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> executionCallback( ErrorStatus status); // A HIDL callback class to receive the results of IDevice::prepareModel asynchronously. class PreparedModelCallback final : public IPreparedModelCallback, public hal::utils::IProtectedCallback { public: Loading @@ -44,11 +64,10 @@ class PreparedModelCallback final : public IPreparedModelCallback, Data get(); private: void notifyInternal(Data result); hal::utils::TransferValue<Data> mData; }; // A HIDL callback class to receive the results of IDevice::execute asynchronously. class ExecutionCallback final : public IExecutionCallback, public hal::utils::IProtectedCallback { public: using Data = nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>>; Loading @@ -60,8 +79,6 @@ class ExecutionCallback final : public IExecutionCallback, public hal::utils::IP Data get(); private: void notifyInternal(Data result); hal::utils::TransferValue<Data> mData; }; Loading Loading
audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -140,20 +140,23 @@ TEST_P(AudioHidlDeviceTest, SetConnectedState) { #if MAJOR_VERSION <= 6 using AD = AudioDevice; for (auto deviceType : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) { SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType)); #elif MAJOR_VERSION >= 7 using AD = xsd::AudioDevice; for (auto deviceType : {toString(AD::AUDIO_DEVICE_OUT_HDMI), toString(AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE), toString(AD::AUDIO_DEVICE_IN_USB_HEADSET)}) { for (auto deviceType : {AD::AUDIO_DEVICE_OUT_HDMI, AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE, AD::AUDIO_DEVICE_IN_USB_HEADSET}) { SCOPED_TRACE("device=" + toString(deviceType)); #endif SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType)); for (bool state : {true, false}) { SCOPED_TRACE("state=" + ::testing::PrintToString(state)); DeviceAddress address = {}; #if MAJOR_VERSION <= 6 address.device = deviceType; #elif MAJOR_VERSION >= 7 address.deviceType = deviceType; address.deviceType = toString(deviceType); if (deviceType == AD::AUDIO_DEVICE_IN_USB_HEADSET) { address.address.alsa({0, 0}); } #endif auto ret = getDevice()->setConnectedState(address, state); ASSERT_TRUE(ret.isOk()); Loading
audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +21 −13 Original line number Diff line number Diff line Loading @@ -44,14 +44,17 @@ const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { for (const auto& device : getDeviceParameters()) { auto module = getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); if (!module || !module->getFirstMixPorts()) break; for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile std::vector<AudioInOutFlag> flags; bool isOffload = false; if (mixPort.hasFlags()) { auto xsdFlags = mixPort.getFlags(); const bool isOffload = isOffload = std::find(xsdFlags.begin(), xsdFlags.end(), xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != xsdFlags.end(); std::vector<AudioInOutFlag> flags; if (!isOffload) { for (auto flag : xsdFlags) { if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) { Loading @@ -61,6 +64,7 @@ const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { } else { flags = offloadFlags; } } for (const auto& profile : mixPort.getProfile()) { auto configs = combineAudioConfig(profile.getChannelMasks(), Loading Loading @@ -94,11 +98,15 @@ const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters() { for (const auto& device : getDeviceParameters()) { auto module = getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); if (!module || !module->getFirstMixPorts()) break; for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile std::vector<AudioInOutFlag> flags; std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), flags.begin(), if (mixPort.hasFlags()) { std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), std::back_inserter(flags), [](auto flag) { return toString(flag); }); } for (const auto& profile : mixPort.getProfile()) { auto configs = combineAudioConfig(profile.getChannelMasks(), Loading
audio/core/all-versions/vts/functional/7.0/PolicyConfig.h +13 −7 Original line number Diff line number Diff line Loading @@ -33,7 +33,9 @@ class PolicyConfig { if (mConfig) { mStatus = OK; mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); if (mConfig->getFirstModules()) { for (const auto& module : mConfig->getFirstModules()->get_module()) { if (module.getFirstAttachedDevices()) { auto attachedDevices = module.getFirstAttachedDevices()->getItem(); if (!attachedDevices.empty()) { mModulesWithDevicesNames.insert(module.getName()); Loading @@ -41,6 +43,8 @@ class PolicyConfig { } } } } } status_t getStatus() const { return mStatus; } std::string getError() const { if (mFilePath.empty()) { Loading @@ -52,7 +56,7 @@ class PolicyConfig { } const std::string& getFilePath() const { return mFilePath; } const xsd::Module* getModuleFromName(const std::string& name) const { if (mConfig) { if (mConfig && mConfig->getFirstModules()) { for (const auto& module : mConfig->getFirstModules()->get_module()) { if (module.getName() == name) return &module; } Loading @@ -65,9 +69,11 @@ class PolicyConfig { } bool haveInputProfilesInModule(const std::string& name) const { auto module = getModuleFromName(name); if (module && module->getFirstMixPorts()) { for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() == xsd::Role::sink) return true; } } return false; } Loading
audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +15 −15 Original line number Diff line number Diff line Loading @@ -156,6 +156,21 @@ const PolicyConfig& getCachedPolicyConfig() { return *policyConfig; } TEST(CheckConfig, audioPolicyConfigurationValidation) { const auto factories = ::android::hardware::getAllHalInstanceNames(IDevicesFactory::descriptor); if (factories.size() == 0) { GTEST_SKIP() << "Skipping audioPolicyConfigurationValidation because no factory instances " "are found."; } RecordProperty("description", "Verify that the audio policy configuration file " "is valid according to the schema"); const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd"; EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName, android::audio_get_configuration_paths(), xsd); } ////////////////////////////////////////////////////////////////////////////// //////////////////// Test parameter types and definitions //////////////////// ////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -231,21 +246,6 @@ class AudioHidlTestWithDeviceParameter : public HidlTest, } }; TEST(CheckConfig, audioPolicyConfigurationValidation) { auto deviceParameters = getDeviceParametersForFactoryTests(); if (deviceParameters.size() == 0) { GTEST_SKIP() << "Skipping audioPolicyConfigurationValidation because no device parameter " "is found."; } RecordProperty("description", "Verify that the audio policy configuration file " "is valid according to the schema"); const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd"; EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName, android::audio_get_configuration_paths(), xsd); } class AudioPolicyConfigTest : public AudioHidlTestWithDeviceParameter { public: void SetUp() override { Loading
neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Callbacks.h +21 −4 Original line number Diff line number Diff line Loading @@ -32,6 +32,26 @@ namespace android::hardware::neuralnetworks::V1_0::utils { // Converts the results of IDevice::getSupportedOperations* to the NN canonical format. On success, // this function returns with the supported operations as indicated by a driver. On failure, this // function returns with the appropriate nn::GeneralError. nn::GeneralResult<std::vector<bool>> supportedOperationsCallback( ErrorStatus status, const hidl_vec<bool>& supportedOperations); // Converts the results of IDevice::prepareModel* to the NN canonical format. On success, this // function returns with a non-null nn::SharedPreparedModel with a feature level of // nn::Version::ANDROID_OC_MR1. On failure, this function returns with the appropriate // nn::GeneralError. nn::GeneralResult<nn::SharedPreparedModel> prepareModelCallback( ErrorStatus status, const sp<IPreparedModel>& preparedModel); // Converts the results of IDevice::execute* to the NN canonical format. On success, this function // returns with an empty output shape vector and no timing information. On failure, this function // returns with the appropriate nn::ExecutionError. nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> executionCallback( ErrorStatus status); // A HIDL callback class to receive the results of IDevice::prepareModel asynchronously. class PreparedModelCallback final : public IPreparedModelCallback, public hal::utils::IProtectedCallback { public: Loading @@ -44,11 +64,10 @@ class PreparedModelCallback final : public IPreparedModelCallback, Data get(); private: void notifyInternal(Data result); hal::utils::TransferValue<Data> mData; }; // A HIDL callback class to receive the results of IDevice::execute asynchronously. class ExecutionCallback final : public IExecutionCallback, public hal::utils::IProtectedCallback { public: using Data = nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>>; Loading @@ -60,8 +79,6 @@ class ExecutionCallback final : public IExecutionCallback, public hal::utils::IP Data get(); private: void notifyInternal(Data result); hal::utils::TransferValue<Data> mData; }; Loading