Abstract away access to audio devices HAL
In this CL all direct access to audio_hw_device_t and its functions is
encapsulated within the new class DeviceHalLocal. Loading of hardware
modules is encapsulated withing DevicesFactoryHalLocal. AudioFlinger
uses interface classes DevicesFactoryHalInterface and DeviceHalInterface
to access these functions.
Bug: 30222631
Change-Id: Ic88b20c55813a24b898f4a832e082c17d81935b7
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index cbd9a08..1890c94 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -71,6 +71,8 @@
class AudioMixer;
class AudioBuffer;
class AudioResampler;
+class DeviceHalInterface;
+class DevicesFactoryHalInterface;
class EffectsFactoryHalInterface;
class FastMixer;
class PassthruBufferProvider;
@@ -616,7 +618,7 @@
audio_stream_in_t* const stream;
audio_input_flags_t flags;
- audio_hw_device_t* hwDev() const { return audioHwDev->hwDevice(); }
+ sp<DeviceHalInterface> hwDev() const { return audioHwDev->hwDevice(); }
AudioStreamIn(AudioHwDevice *dev, audio_stream_in_t *in, audio_input_flags_t flags) :
audioHwDev(dev), stream(in), flags(flags) {}
@@ -647,6 +649,8 @@
AudioHwDevice* mPrimaryHardwareDev; // mAudioHwDevs[0] or NULL
DefaultKeyedVector<audio_module_handle_t, AudioHwDevice*> mAudioHwDevs;
+ sp<DevicesFactoryHalInterface> mDevicesFactoryHal;
+
// for dump, indicates which hardware operation is currently in progress (but not stream ops)
enum hardware_call_state {
AUDIO_HW_IDLE = 0, // no operation in progress