Use 'audio_port_config' in DeviceHalInterface::add/removeDeviceEffect
Previously, `audio_port_handle_t` was used to specify the device
port. However, these port handles are allocated by the framework
and are not known to the HAL a priori. The current scenario
assumes that the framework first creates an audio patch, thus
passes a complete `audio_port_config` to the HAL prior to adding
an effect. However, this assumption isn't stated anywhere in
the legacy interface definition.
To make things more flexible, make the framework to pass
`audio_port_config` when it adds/removes a device effect.
This also makes unnecessary to pass the hw module ID as it is
contained within the port config. The legacy HAL interface
is left intact.
Bug: 205884982
Test: m
Change-Id: Ie9410637ad092bff22b2c0fe1c92e516a1f24ee0
diff --git a/services/audioflinger/DeviceEffectManager.h b/services/audioflinger/DeviceEffectManager.h
index 493800e..dc1e2ec 100644
--- a/services/audioflinger/DeviceEffectManager.h
+++ b/services/audioflinger/DeviceEffectManager.h
@@ -46,13 +46,13 @@
status_t createEffectHal(const effect_uuid_t *pEffectUuid,
int32_t sessionId, int32_t deviceId,
sp<EffectHalInterface> *effect);
- status_t addEffectToHal(audio_port_handle_t deviceId, audio_module_handle_t hwModuleId,
+ status_t addEffectToHal(const struct audio_port_config *device,
const sp<EffectHalInterface>& effect) {
- return mAudioFlinger.addEffectToHal(deviceId, hwModuleId, effect);
+ return mAudioFlinger.addEffectToHal(device, effect);
};
- status_t removeEffectFromHal(audio_port_handle_t deviceId, audio_module_handle_t hwModuleId,
+ status_t removeEffectFromHal(const struct audio_port_config *device,
const sp<EffectHalInterface>& effect) {
- return mAudioFlinger.removeEffectFromHal(deviceId, hwModuleId, effect);
+ return mAudioFlinger.removeEffectFromHal(device, effect);
};
AudioFlinger& audioFlinger() const { return mAudioFlinger; }
@@ -203,13 +203,13 @@
int newEffectId() { return mManager.audioFlinger().nextUniqueId(AUDIO_UNIQUE_ID_USE_EFFECT); }
- status_t addEffectToHal(audio_port_handle_t deviceId,
- audio_module_handle_t hwModuleId, const sp<EffectHalInterface>& effect) {
- return mManager.addEffectToHal(deviceId, hwModuleId, effect);
+ status_t addEffectToHal(const struct audio_port_config *device,
+ const sp<EffectHalInterface>& effect) {
+ return mManager.addEffectToHal(device, effect);
}
- status_t removeEffectFromHal(audio_port_handle_t deviceId,
- audio_module_handle_t hwModuleId, const sp<EffectHalInterface>& effect) {
- return mManager.removeEffectFromHal(deviceId, hwModuleId, effect);
+ status_t removeEffectFromHal(const struct audio_port_config *device,
+ const sp<EffectHalInterface>& effect) {
+ return mManager.removeEffectFromHal(device, effect);
}
private:
DeviceEffectManager& mManager;