Package: android.hardware.audio@4.0

IDevice

interface IDevice

Methods

initCheck

initCheck ()
generates (Result retval)

Returns whether the audio hardware interface has been initialized.

Details
Generates
retval
OK on success, NOT_INITIALIZED on failure.

setMasterVolume

setMasterVolume (float volume)
generates (Result retval)

Sets the audio volume for all audio activities other than voice call.If NOT_SUPPORTED is returned, the software mixer will emulate this capability.

Details
Parameters
volume
1.0f means unity, 0.0f is zero.
Generates
retval
operation completion status.

getMasterVolume

getMasterVolume ()
generates (Result retval, float volume)

Get the current master volume value for the HAL, if the HAL supports master volume control.For example, AudioFlinger will query this value from the primary audio HAL when the service starts and use the value for setting the initial master volume across all HALs.HALs which do not support this method must return NOT_SUPPORTED in 'retval'.

Details
Generates
retval
operation completion status.
volume
1.0f means unity, 0.0f is zero.

setMicMute

setMicMute (bool mute)
generates (Result retval)

Sets microphone muting state.

Details
Parameters
mute
whether microphone is muted.
Generates
retval
operation completion status.

getMicMute

getMicMute ()
generates (Result retval, bool mute)

Gets whether microphone is muted.

Details
Generates
retval
operation completion status.
mute
whether microphone is muted.

setMasterMute

setMasterMute (bool mute)
generates (Result retval)

Set the audio mute status for all audio activities.If the return value is NOT_SUPPORTED, the software mixer will emulate this capability.

Details
Parameters
mute
whether audio is muted.
Generates
retval
operation completion status.

getMasterMute

getMasterMute ()
generates (Result retval, bool mute)

Get the current master mute status for the HAL, if the HAL supports master mute control.AudioFlinger will query this value from the primary audio HAL when the service starts and use the value for setting the initial master mute across all HALs.HAL must indicate that the feature is not supported by returning NOT_SUPPORTED status.

Details
Generates
retval
operation completion status.
mute
whether audio is muted.

getInputBufferSize

getInputBufferSize (AudioConfig config)
generates (Result retval, uint64_t bufferSize)

Returns audio input buffer size according to parameters passed or INVALID_ARGUMENTS if one of the parameters is not supported.

Details
Parameters
config
audio configuration.
Generates
retval
operation completion status.
bufferSize
input buffer size in bytes.

openOutputStream

openOutputStream (AudioIoHandle ioHandle, DeviceAddress device, AudioConfig config, bitfield<AudioOutputFlag> flags, SourceMetadata sourceMetadata)
generates (Result retval, IStreamOut outStream, AudioConfig suggestedConfig)

This method creates and opens the audio hardware output stream.If the stream can not be opened with the proposed audio config, HAL must provide suggested values for the audio config.

Details
Parameters
ioHandle
handle assigned by AudioFlinger.
device
device type and(if needed)address.
config
stream configuration.
flags
additional flags.
sourceMetadata
Description of the audio that will be played.May be used by implementations to configure hardware effects.
Generates
retval
operation completion status.
outStream
created output stream.
suggestedConfig
in case of invalid parameters, suggested config.

openInputStream

openInputStream (AudioIoHandle ioHandle, DeviceAddress device, AudioConfig config, bitfield<AudioInputFlag> flags, SinkMetadata sinkMetadata)
generates (Result retval, IStreamIn inStream, AudioConfig suggestedConfig)

This method creates and opens the audio hardware input stream.If the stream can not be opened with the proposed audio config, HAL must provide suggested values for the audio config.

Details
Parameters
ioHandle
handle assigned by AudioFlinger.
device
device type and(if needed)address.
config
stream configuration.
flags
additional flags.
sinkMetadata
Description of the audio that is suggested by the client.May be used by implementations to configure hardware effects.
Generates
retval
operation completion status.
inStream
in case of success, created input stream.
suggestedConfig
in case of invalid parameters, suggested config.

supportsAudioPatches

supportsAudioPatches ()
generates (bool supports)

Returns whether HAL supports audio patches.

Details
Generates
supports
true if audio patches are supported.

createAudioPatch

createAudioPatch (vec<AudioPortConfig> sources, vec<AudioPortConfig> sinks)
generates (Result retval, AudioPatchHandle patch)

Creates an audio patch between several source and sink ports.The handle is allocated by the HAL and must be unique for this audio HAL module.

Details
Parameters
sources
patch sources.
sinks
patch sinks.
Generates
retval
operation completion status.
patch
created patch handle.

releaseAudioPatch

releaseAudioPatch (AudioPatchHandle patch)
generates (Result retval)

Release an audio patch.

Details
Parameters
patch
patch handle.
Generates
retval
operation completion status.

getAudioPort

getAudioPort (AudioPort port)
generates (Result retval, AudioPort resultPort)

Returns the list of supported attributes for a given audio port.

As input, 'port' contains the information(type, role, address etc.. .)needed by the HAL to identify the port.

As output, 'resultPort' contains possible attributes(sampling rates, formats, channel masks, gain controllers.. .)for this port.

Details
Parameters
port
port identifier.
Generates
retval
operation completion status.
resultPort
port descriptor with all parameters filled up.

setAudioPortConfig

setAudioPortConfig (AudioPortConfig config)
generates (Result retval)

Set audio port configuration.

Details
Parameters
config
audio port configuration.
Generates
retval
operation completion status.

getHwAvSync

getHwAvSync ()
generates (Result retval, AudioHwSync hwAvSync)

Gets the HW synchronization source of the device.Calling this method is equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.Optional method

Details
Generates
retval
operation completion status:OK or NOT_SUPPORTED.
hwAvSync
HW synchronization source

setScreenState

setScreenState (bool turnedOn)
generates (Result retval)

Sets whether the screen is on.Calling this method is equivalent to setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.Optional method

Details
Parameters
turnedOn
whether the screen is turned on.
Generates
retval
operation completion status.

getParameters

getParameters (vec<ParameterValue> context, vec<string> keys)
generates (Result retval, vec<ParameterValue> parameters)

Generic method for retrieving vendor-specific parameter values.The framework does not interpret the parameters, they are passed in an opaque manner between a vendor application and HAL.

Multiple parameters can be retrieved at the same time.The implementation should return as many requested parameters as possible, even if one or more is not supported

Details
Parameters
context
provides more information about the request
keys
keys of the requested parameters
Generates
retval
operation completion status.OK must be returned if keys is empty.NOT_SUPPORTED must be returned if at least one key is unknown.
parameters
parameter key value pairs.Must contain the value of all requested keys if retval == OK

setParameters

setParameters (vec<ParameterValue> context, vec<ParameterValue> parameters)
generates (Result retval)

Generic method for setting vendor-specific parameter values.The framework does not interpret the parameters, they are passed in an opaque manner between a vendor application and HAL.

Multiple parameters can be set at the same time though this is discouraged as it make failure analysis harder.

If possible, a failed setParameters should not impact the platform state.

Details
Parameters
context
provides more information about the request
parameters
parameter key value pairs.
Generates
retval
operation completion status.All parameters must be successfully set for OK to be returned

getMicrophones

getMicrophones ()
generates (Result retval, vec<MicrophoneInfo> microphones)

Returns an array with available microphones in device.

Details
Generates
retval
INVALID_STATE if the call is not successful, OK otherwise.
microphones
array with microphones info

setConnectedState

setConnectedState (DeviceAddress address, bool connected)
generates (Result retval)

Notifies the device module about the connection state of an input/output device attached to it.Calling this method is equivalent to setting AUDIO_PARAMETER_DEVICE_[DIS]CONNECT on the legacy HAL.

Details
Parameters
address
audio device specification.
connected
whether the device is connected.
Generates
retval
operation completion status.