Loading services/audiopolicy/common/managerdefinitions/include/HwModule.h +1 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ private: class HwModuleCollection : public Vector<sp<HwModule> > { public: sp<HwModule> getModuleFromHandle(audio_module_handle_t handle) const; sp<HwModule> getModuleFromName(const char *name) const; /** Loading services/audiopolicy/common/managerdefinitions/src/HwModule.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,16 @@ void HwModule::dump(String8 *dst, int spaces) const dumpAudioRouteVector(mRoutes, dst, spaces); } sp<HwModule> HwModuleCollection::getModuleFromHandle(audio_module_handle_t handle) const { for (const auto& module : *this) { if (module->getHandle() == handle) { return module; } } return nullptr; } sp <HwModule> HwModuleCollection::getModuleFromName(const char *name) const { for (const auto& module : *this) { Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -1650,11 +1650,11 @@ status_t AudioPolicyManager::openDirectOutput(audio_stream_type_t stream, outputDesc->mDirectClientSession = session; addOutput(*output, outputDesc); setOutputDevices(__func__, outputDesc, devices, true, 0, NULL); // The version check is essentially to avoid making this call in the case of the HIDL HAL. if (auto hwModule = mHwModules.getModuleFromHandle(mPrimaryModuleHandle); hwModule && hwModule->getHalVersionMajor() >= 3) { setOutputDevices(__func__, outputDesc, devices, true, 0, NULL); } mPreviousOutputs = mOutputs; ALOGV("%s returns new direct output %d", __func__, *output); mpClientInterface->onAudioPortListUpdate(); Loading Loading @@ -8886,11 +8886,11 @@ sp<SwAudioOutputDescriptor> AudioPolicyManager::openOutputWithProfileAndDevice( } addOutput(output, desc); setOutputDevices(__func__, desc, devices, true, 0, NULL); // The version check is essentially to avoid making this call in the case of the HIDL HAL. if (auto hwModule = mHwModules.getModuleFromHandle(mPrimaryModuleHandle); hwModule && hwModule->getHalVersionMajor() >= 3) { setOutputDevices(__func__, desc, devices, true, 0, NULL); } sp<DeviceDescriptor> speaker = mAvailableOutputDevices.getDevice( AUDIO_DEVICE_OUT_SPEAKER, String8(""), AUDIO_FORMAT_DEFAULT); Loading services/audiopolicy/tests/audiopolicymanager_tests.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -498,6 +498,9 @@ INSTANTIATE_TEST_CASE_P( void AudioPolicyManagerTestMsd::SetUpManagerConfig() { // TODO: Consider using Serializer to load part of the config from a string. ASSERT_NO_FATAL_FAILURE(AudioPolicyManagerTest::SetUpManagerConfig()); mConfig->getHwModules().getModuleFromName( AUDIO_HARDWARE_MODULE_ID_PRIMARY)->setHalVersion(3, 0); mMsdOutputDevice = new DeviceDescriptor(AUDIO_DEVICE_OUT_BUS); sp<AudioProfile> pcmOutputProfile = new AudioProfile( AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_OUT_STEREO, k48000SamplingRate); Loading Loading @@ -529,7 +532,7 @@ void AudioPolicyManagerTestMsd::SetUpManagerConfig() { addOutputProfile(spdifOutputProfile); } sp<HwModule> msdModule = new HwModule(AUDIO_HARDWARE_MODULE_ID_MSD, 2 /*halVersionMajor*/); sp<HwModule> msdModule = new HwModule(AUDIO_HARDWARE_MODULE_ID_MSD, 3 /*halVersionMajor*/); HwModuleCollection modules = mConfig->getHwModules(); modules.add(msdModule); mConfig->setHwModules(modules); Loading Loading
services/audiopolicy/common/managerdefinitions/include/HwModule.h +1 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ private: class HwModuleCollection : public Vector<sp<HwModule> > { public: sp<HwModule> getModuleFromHandle(audio_module_handle_t handle) const; sp<HwModule> getModuleFromName(const char *name) const; /** Loading
services/audiopolicy/common/managerdefinitions/src/HwModule.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,16 @@ void HwModule::dump(String8 *dst, int spaces) const dumpAudioRouteVector(mRoutes, dst, spaces); } sp<HwModule> HwModuleCollection::getModuleFromHandle(audio_module_handle_t handle) const { for (const auto& module : *this) { if (module->getHandle() == handle) { return module; } } return nullptr; } sp <HwModule> HwModuleCollection::getModuleFromName(const char *name) const { for (const auto& module : *this) { Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -1650,11 +1650,11 @@ status_t AudioPolicyManager::openDirectOutput(audio_stream_type_t stream, outputDesc->mDirectClientSession = session; addOutput(*output, outputDesc); setOutputDevices(__func__, outputDesc, devices, true, 0, NULL); // The version check is essentially to avoid making this call in the case of the HIDL HAL. if (auto hwModule = mHwModules.getModuleFromHandle(mPrimaryModuleHandle); hwModule && hwModule->getHalVersionMajor() >= 3) { setOutputDevices(__func__, outputDesc, devices, true, 0, NULL); } mPreviousOutputs = mOutputs; ALOGV("%s returns new direct output %d", __func__, *output); mpClientInterface->onAudioPortListUpdate(); Loading Loading @@ -8886,11 +8886,11 @@ sp<SwAudioOutputDescriptor> AudioPolicyManager::openOutputWithProfileAndDevice( } addOutput(output, desc); setOutputDevices(__func__, desc, devices, true, 0, NULL); // The version check is essentially to avoid making this call in the case of the HIDL HAL. if (auto hwModule = mHwModules.getModuleFromHandle(mPrimaryModuleHandle); hwModule && hwModule->getHalVersionMajor() >= 3) { setOutputDevices(__func__, desc, devices, true, 0, NULL); } sp<DeviceDescriptor> speaker = mAvailableOutputDevices.getDevice( AUDIO_DEVICE_OUT_SPEAKER, String8(""), AUDIO_FORMAT_DEFAULT); Loading
services/audiopolicy/tests/audiopolicymanager_tests.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -498,6 +498,9 @@ INSTANTIATE_TEST_CASE_P( void AudioPolicyManagerTestMsd::SetUpManagerConfig() { // TODO: Consider using Serializer to load part of the config from a string. ASSERT_NO_FATAL_FAILURE(AudioPolicyManagerTest::SetUpManagerConfig()); mConfig->getHwModules().getModuleFromName( AUDIO_HARDWARE_MODULE_ID_PRIMARY)->setHalVersion(3, 0); mMsdOutputDevice = new DeviceDescriptor(AUDIO_DEVICE_OUT_BUS); sp<AudioProfile> pcmOutputProfile = new AudioProfile( AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_OUT_STEREO, k48000SamplingRate); Loading Loading @@ -529,7 +532,7 @@ void AudioPolicyManagerTestMsd::SetUpManagerConfig() { addOutputProfile(spdifOutputProfile); } sp<HwModule> msdModule = new HwModule(AUDIO_HARDWARE_MODULE_ID_MSD, 2 /*halVersionMajor*/); sp<HwModule> msdModule = new HwModule(AUDIO_HARDWARE_MODULE_ID_MSD, 3 /*halVersionMajor*/); HwModuleCollection modules = mConfig->getHwModules(); modules.add(msdModule); mConfig->setHwModules(modules); Loading