blob: 38bfe211a4a1c9bbcb7bd74ab8ee4eed0758a1db [file] [log] [blame]
Mikhail Naganov96b30be2016-10-05 11:21:12 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17package android.hardware.audio@2.0;
18
19import android.hardware.audio.common@2.0;
20import IStreamIn;
21import IStreamOut;
22
23interface IDevice {
24 typedef android.hardware.audio@2.0::Result Result;
25
26 /*
27 * Returns whether the audio hardware interface has been initialized.
28 *
29 * @return retval OK on success, NOT_INITIALIZED on failure.
30 */
31 initCheck() generates (Result retval);
32
33 /*
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
36 * capability.
37 *
38 * @param volume 1.0f means unity, 0.0f is zero.
39 * @return retval operation completion status.
40 */
41 setMasterVolume(float volume) generates (Result retval);
42
43 /*
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'.
49 *
50 * @return retval operation completion status.
51 * @return volume 1.0f means unity, 0.0f is zero.
52 */
53 getMasterVolume() generates (Result retval, float volume);
54
55 /*
56 * Sets microphone muting state.
57 *
58 * @param mute whether microphone is muted.
59 * @return retval operation completion status.
60 */
61 setMicMute(bool mute) generates (Result retval);
62
63 /*
64 * Gets whether microphone is muted.
65 *
66 * @return retval operation completion status.
67 * @return mute whether microphone is muted.
68 */
69 getMicMute() generates (Result retval, bool mute);
70
71 /*
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.
74 *
75 * @param mute whether audio is muted.
76 * @return retval operation completion status.
77 */
78 setMasterMute(bool mute) generates (Result retval);
79
80 /**
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.
86 *
87 * @return retval operation completion status.
88 * @return mute whether audio is muted.
89 */
90 getMasterMute() generates (Result retval, bool mute);
91
92 /*
93 * Returns audio input buffer size according to parameters passed or
94 * INVALID_ARGUMENTS if one of the parameters is not supported.
95 *
96 * @param config audio configuration.
97 * @return retval operation completion status.
98 * @return bufferSize input buffer size in bytes.
99 */
100 getInputBufferSize(AudioConfig config)
101 generates (Result retval, uint64_t bufferSize);
102
103 /*
104 * This method creates and opens the audio hardware output stream.
105 *
106 * @param ioHandle handle assigned by AudioFlinger.
107 * @param device device type and (if needed) address.
108 * @param config stream configuration.
109 * @param flags additional flags.
110 * @return retval operation completion status.
111 * @return outStream created output stream.
112 */
113 openOutputStream(
114 AudioIoHandle ioHandle,
115 DeviceAddress device,
116 AudioConfig config,
117 AudioOutputFlag flags) generates (Result retval, IStreamOut outStream);
118
119 /*
120 * This method creates and opens the audio hardware input stream.
121 *
122 * @param ioHandle handle assigned by AudioFlinger.
123 * @param device device type and (if needed) address.
124 * @param config stream configuration.
125 * @param flags additional flags.
126 * @param source source specification.
127 * @return retval operation completion status.
128 * @return inStream created input stream.
129 */
130 openInputStream(
131 AudioIoHandle ioHandle,
132 DeviceAddress device,
133 AudioConfig config,
134 AudioInputFlag flags,
135 AudioSource source) generates (Result retval, IStreamIn inStream);
136
137 /*
138 * Creates an audio patch between several source and sink ports. The handle
139 * is allocated by the HAL and must be unique for this audio HAL module.
140 *
141 * @param sources patch sources.
142 * @param sinks patch sinks.
143 * @return retval operation completion status.
144 * @return patch created patch handle.
145 */
146 createAudioPatch(vec<AudioPortConfig> sources, vec<AudioPortConfig> sinks)
147 generates (Result retval, AudioPatchHandle patch);
148
149 /*
150 * Release an audio patch.
151 *
152 * @param patch patch handle.
153 * @return retval operation completion status.
154 */
155 releaseAudioPatch(AudioPatchHandle patch) generates (Result retval);
156
157 /*
158 * Returns the list of supported attributes for a given audio port.
159 *
160 * As input, 'port' contains the information (type, role, address etc...)
161 * needed by the HAL to identify the port.
162 *
163 * As output, 'port' contains possible attributes (sampling rates, formats,
164 * channel masks, gain controllers...) for this port.
165 *
166 * @param port port identifier.
167 * @return retval operation completion status.
168 * @return port port descriptor with all parameters filled up.
169 */
170 getAudioPort(AudioPort port)
171 generates (Result retval, AudioPort port);
172
173 /*
174 * Set audio port configuration.
175 *
176 * @param config audio port configuration.
177 * @return retval operation completion status.
178 */
179 setAudioPortConfig(AudioPortConfig config) generates (Result retval);
180
181 /*
182 * Gets the HW synchronization source of the device. Calling this method is
Mikhail Naganov10548292016-10-31 10:39:47 -0700183 * equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700184 *
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700185 * @return hwAvSync HW synchronization source
186 */
Mikhail Naganov10548292016-10-31 10:39:47 -0700187 getHwAvSync() generates (AudioHwSync hwAvSync);
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700188
189 /*
190 * Sets whether the screen is on. Calling this method is equivalent to
191 * setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
Mikhail Naganov10548292016-10-31 10:39:47 -0700192 *
193 * @param turnedOn whether the screen is turned on.
194 * @return retval operation completion status.
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700195 */
Mikhail Naganov10548292016-10-31 10:39:47 -0700196 setScreenState(bool turnedOn) generates (Result retval);
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700197
198 /*
199 * Generic method for retrieving vendor-specific parameter values.
200 * The framework does not interpret the parameters, they are passed
201 * in an opaque manner between a vendor application and HAL.
202 *
203 * @param keys parameter keys.
204 * @return retval operation completion status.
205 * @return parameters parameter key value pairs.
206 */
207 getParameters(vec<string> keys)
208 generates (Result retval, vec<ParameterValue> parameters);
209
210 /*
211 * Generic method for setting vendor-specific parameter values.
212 * The framework does not interpret the parameters, they are passed
213 * in an opaque manner between a vendor application and HAL.
214 *
215 * @param parameters parameter key value pairs.
216 * @return retval operation completion status.
217 */
218 setParameters(vec<ParameterValue> parameters) generates (Result retval);
219
220 /*
221 * Dumps information about the stream into the provided file descriptor.
222 * This is used for the dumpsys facility.
223 *
224 * @param fd dump file descriptor.
225 */
226 debugDump(handle fd);
227};