2 * Copyright (C) 2016 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package android.hardware.audio@2.0;
19 import android.hardware.audio.common@2.0;
24 typedef android.hardware.audio@2.0::Result Result;
27 * Returns whether the audio hardware interface has been initialized.
29 * @return retval OK on success, NOT_INITIALIZED on failure.
31 initCheck() generates (Result retval);
34 * Sets the audio volume for all audio activities other than voice call. If
35 * NOT_SUPPORTED is returned, the software mixer will emulate this
38 * @param volume 1.0f means unity, 0.0f is zero.
39 * @return retval operation completion status.
41 setMasterVolume(float volume) generates (Result retval);
44 * Get the current master volume value for the HAL, if the HAL supports
45 * master volume control. For example, AudioFlinger will query this value
46 * from the primary audio HAL when the service starts and use the value for
47 * setting the initial master volume across all HALs. HALs which do not
48 * support this method must return NOT_SUPPORTED in 'retval'.
50 * @return retval operation completion status.
51 * @return volume 1.0f means unity, 0.0f is zero.
53 getMasterVolume() generates (Result retval, float volume);
56 * Sets microphone muting state.
58 * @param mute whether microphone is muted.
59 * @return retval operation completion status.
61 setMicMute(bool mute) generates (Result retval);
64 * Gets whether microphone is muted.
66 * @return retval operation completion status.
67 * @return mute whether microphone is muted.
69 getMicMute() generates (Result retval, bool mute);
72 * Set the audio mute status for all audio activities. If the return value
73 * is NOT_SUPPORTED, the software mixer will emulate this capability.
75 * @param mute whether audio is muted.
76 * @return retval operation completion status.
78 setMasterMute(bool mute) generates (Result retval);
81 * Get the current master mute status for the HAL, if the HAL supports
82 * master mute control. AudioFlinger will query this value from the primary
83 * audio HAL when the service starts and use the value for setting the
84 * initial master mute across all HALs. HAL must indicate that the feature
85 * is not supported by returning NOT_SUPPORTED status.
87 * @return retval operation completion status.
88 * @return mute whether audio is muted.
90 getMasterMute() generates (Result retval, bool mute);
93 * Returns audio input buffer size according to parameters passed or
94 * INVALID_ARGUMENTS if one of the parameters is not supported.
96 * @param config audio configuration.
97 * @return retval operation completion status.
98 * @return bufferSize input buffer size in bytes.
100 getInputBufferSize(AudioConfig config)
101 generates (Result retval, uint64_t bufferSize);
104 * This method creates and opens the audio hardware output stream.
105 * If the stream can not be opened with the proposed audio config,
106 * HAL must provide suggested values for the audio config.
108 * @param ioHandle handle assigned by AudioFlinger.
109 * @param device device type and (if needed) address.
110 * @param config stream configuration.
111 * @param flags additional flags.
112 * @return retval operation completion status.
113 * @return outStream created output stream.
114 * @return suggestedConfig in case of invalid parameters, suggested config.
117 AudioIoHandle ioHandle,
118 DeviceAddress device,
120 AudioOutputFlag flags) generates (
122 IStreamOut outStream,
123 AudioConfig suggestedConfig);
126 * This method creates and opens the audio hardware input stream.
127 * If the stream can not be opened with the proposed audio config,
128 * HAL must provide suggested values for the audio config.
130 * @param ioHandle handle assigned by AudioFlinger.
131 * @param device device type and (if needed) address.
132 * @param config stream configuration.
133 * @param flags additional flags.
134 * @param source source specification.
135 * @return retval operation completion status.
136 * @return inStream in case of success, created input stream.
137 * @return suggestedConfig in case of invalid parameters, suggested config.
140 AudioIoHandle ioHandle,
141 DeviceAddress device,
143 AudioInputFlag flags,
144 AudioSource source) generates (
147 AudioConfig suggestedConfig);
150 * Returns whether HAL supports audio patches.
152 * @return supports true if audio patches are supported.
154 supportsAudioPatches() generates (bool supports);
157 * Creates an audio patch between several source and sink ports. The handle
158 * is allocated by the HAL and must be unique for this audio HAL module.
160 * @param sources patch sources.
161 * @param sinks patch sinks.
162 * @return retval operation completion status.
163 * @return patch created patch handle.
165 createAudioPatch(vec<AudioPortConfig> sources, vec<AudioPortConfig> sinks)
166 generates (Result retval, AudioPatchHandle patch);
169 * Release an audio patch.
171 * @param patch patch handle.
172 * @return retval operation completion status.
174 releaseAudioPatch(AudioPatchHandle patch) generates (Result retval);
177 * Returns the list of supported attributes for a given audio port.
179 * As input, 'port' contains the information (type, role, address etc...)
180 * needed by the HAL to identify the port.
182 * As output, 'resultPort' contains possible attributes (sampling rates,
183 * formats, channel masks, gain controllers...) for this port.
185 * @param port port identifier.
186 * @return retval operation completion status.
187 * @return resultPort port descriptor with all parameters filled up.
189 getAudioPort(AudioPort port)
190 generates (Result retval, AudioPort resultPort);
193 * Set audio port configuration.
195 * @param config audio port configuration.
196 * @return retval operation completion status.
198 setAudioPortConfig(AudioPortConfig config) generates (Result retval);
201 * Gets the HW synchronization source of the device. Calling this method is
202 * equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.
204 * @return hwAvSync HW synchronization source
206 getHwAvSync() generates (AudioHwSync hwAvSync);
209 * Sets whether the screen is on. Calling this method is equivalent to
210 * setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
212 * @param turnedOn whether the screen is turned on.
213 * @return retval operation completion status.
215 setScreenState(bool turnedOn) generates (Result retval);
218 * Generic method for retrieving vendor-specific parameter values.
219 * The framework does not interpret the parameters, they are passed
220 * in an opaque manner between a vendor application and HAL.
222 * @param keys parameter keys.
223 * @return retval operation completion status.
224 * @return parameters parameter key value pairs.
226 getParameters(vec<string> keys)
227 generates (Result retval, vec<ParameterValue> parameters);
230 * Generic method for setting vendor-specific parameter values.
231 * The framework does not interpret the parameters, they are passed
232 * in an opaque manner between a vendor application and HAL.
234 * @param parameters parameter key value pairs.
235 * @return retval operation completion status.
237 setParameters(vec<ParameterValue> parameters) generates (Result retval);
240 * Dumps information about the stream into the provided file descriptor.
241 * This is used for the dumpsys facility.
243 * @param fd dump file descriptor.
245 debugDump(handle fd);