2016-10-05 20:21:12 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package android.hardware.audio@2.0;
|
|
|
|
|
|
|
|
import android.hardware.audio.common@2.0;
|
|
|
|
import IStreamIn;
|
|
|
|
import IStreamOut;
|
|
|
|
|
|
|
|
interface IDevice {
|
|
|
|
typedef android.hardware.audio@2.0::Result Result;
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Returns whether the audio hardware interface has been initialized.
|
|
|
|
*
|
|
|
|
* @return retval OK on success, NOT_INITIALIZED on failure.
|
|
|
|
*/
|
|
|
|
initCheck() generates (Result retval);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Sets the audio volume for all audio activities other than voice call. If
|
|
|
|
* NOT_SUPPORTED is returned, the software mixer will emulate this
|
|
|
|
* capability.
|
|
|
|
*
|
|
|
|
* @param volume 1.0f means unity, 0.0f is zero.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
*/
|
|
|
|
setMasterVolume(float volume) generates (Result retval);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* 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'.
|
|
|
|
*
|
|
|
|
* @return retval operation completion status.
|
|
|
|
* @return volume 1.0f means unity, 0.0f is zero.
|
|
|
|
*/
|
|
|
|
getMasterVolume() generates (Result retval, float volume);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Sets microphone muting state.
|
|
|
|
*
|
|
|
|
* @param mute whether microphone is muted.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
*/
|
|
|
|
setMicMute(bool mute) generates (Result retval);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Gets whether microphone is muted.
|
|
|
|
*
|
|
|
|
* @return retval operation completion status.
|
|
|
|
* @return mute whether microphone is muted.
|
|
|
|
*/
|
|
|
|
getMicMute() generates (Result retval, bool mute);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Set the audio mute status for all audio activities. If the return value
|
|
|
|
* is NOT_SUPPORTED, the software mixer will emulate this capability.
|
|
|
|
*
|
|
|
|
* @param mute whether audio is muted.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
*/
|
|
|
|
setMasterMute(bool mute) generates (Result retval);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @return retval operation completion status.
|
|
|
|
* @return mute whether audio is muted.
|
|
|
|
*/
|
|
|
|
getMasterMute() generates (Result retval, bool mute);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Returns audio input buffer size according to parameters passed or
|
|
|
|
* INVALID_ARGUMENTS if one of the parameters is not supported.
|
|
|
|
*
|
|
|
|
* @param config audio configuration.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
* @return bufferSize input buffer size in bytes.
|
|
|
|
*/
|
|
|
|
getInputBufferSize(AudioConfig config)
|
|
|
|
generates (Result retval, uint64_t bufferSize);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* This method creates and opens the audio hardware output stream.
|
2016-11-17 01:30:17 +01:00
|
|
|
* If the stream can not be opened with the proposed audio config,
|
|
|
|
* HAL must provide suggested values for the audio config.
|
2016-10-05 20:21:12 +02:00
|
|
|
*
|
|
|
|
* @param ioHandle handle assigned by AudioFlinger.
|
|
|
|
* @param device device type and (if needed) address.
|
|
|
|
* @param config stream configuration.
|
|
|
|
* @param flags additional flags.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
* @return outStream created output stream.
|
2016-11-17 01:30:17 +01:00
|
|
|
* @return suggestedConfig in case of invalid parameters, suggested config.
|
2016-10-05 20:21:12 +02:00
|
|
|
*/
|
|
|
|
openOutputStream(
|
|
|
|
AudioIoHandle ioHandle,
|
|
|
|
DeviceAddress device,
|
|
|
|
AudioConfig config,
|
2016-11-17 01:30:17 +01:00
|
|
|
AudioOutputFlag flags) generates (
|
|
|
|
Result retval,
|
|
|
|
IStreamOut outStream,
|
|
|
|
AudioConfig suggestedConfig);
|
2016-10-05 20:21:12 +02:00
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* This method creates and opens the audio hardware input stream.
|
2016-11-17 01:30:17 +01:00
|
|
|
* If the stream can not be opened with the proposed audio config,
|
|
|
|
* HAL must provide suggested values for the audio config.
|
2016-10-05 20:21:12 +02:00
|
|
|
*
|
|
|
|
* @param ioHandle handle assigned by AudioFlinger.
|
|
|
|
* @param device device type and (if needed) address.
|
|
|
|
* @param config stream configuration.
|
|
|
|
* @param flags additional flags.
|
|
|
|
* @param source source specification.
|
|
|
|
* @return retval operation completion status.
|
2016-11-17 01:30:17 +01:00
|
|
|
* @return inStream in case of success, created input stream.
|
|
|
|
* @return suggestedConfig in case of invalid parameters, suggested config.
|
2016-10-05 20:21:12 +02:00
|
|
|
*/
|
|
|
|
openInputStream(
|
|
|
|
AudioIoHandle ioHandle,
|
|
|
|
DeviceAddress device,
|
|
|
|
AudioConfig config,
|
|
|
|
AudioInputFlag flags,
|
2016-11-17 01:30:17 +01:00
|
|
|
AudioSource source) generates (
|
|
|
|
Result retval,
|
|
|
|
IStreamIn inStream,
|
|
|
|
AudioConfig suggestedConfig);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-11-17 01:30:17 +01:00
|
|
|
* Returns whether HAL supports audio patches.
|
|
|
|
*
|
|
|
|
* @return supports true if audio patches are supported.
|
|
|
|
*/
|
|
|
|
supportsAudioPatches() generates (bool supports);
|
2016-10-05 20:21:12 +02:00
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param sources patch sources.
|
|
|
|
* @param sinks patch sinks.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
* @return patch created patch handle.
|
|
|
|
*/
|
|
|
|
createAudioPatch(vec<AudioPortConfig> sources, vec<AudioPortConfig> sinks)
|
|
|
|
generates (Result retval, AudioPatchHandle patch);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Release an audio patch.
|
|
|
|
*
|
|
|
|
* @param patch patch handle.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
*/
|
|
|
|
releaseAudioPatch(AudioPatchHandle patch) generates (Result retval);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2016-12-09 23:26:58 +01:00
|
|
|
* As output, 'resultPort' contains possible attributes (sampling rates,
|
|
|
|
* formats, channel masks, gain controllers...) for this port.
|
2016-10-05 20:21:12 +02:00
|
|
|
*
|
|
|
|
* @param port port identifier.
|
|
|
|
* @return retval operation completion status.
|
2016-12-09 23:26:58 +01:00
|
|
|
* @return resultPort port descriptor with all parameters filled up.
|
2016-10-05 20:21:12 +02:00
|
|
|
*/
|
|
|
|
getAudioPort(AudioPort port)
|
2016-12-09 23:26:58 +01:00
|
|
|
generates (Result retval, AudioPort resultPort);
|
2016-10-05 20:21:12 +02:00
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Set audio port configuration.
|
|
|
|
*
|
|
|
|
* @param config audio port configuration.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
*/
|
|
|
|
setAudioPortConfig(AudioPortConfig config) generates (Result retval);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Gets the HW synchronization source of the device. Calling this method is
|
2016-10-31 18:39:47 +01:00
|
|
|
* equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.
|
2016-10-05 20:21:12 +02:00
|
|
|
*
|
|
|
|
* @return hwAvSync HW synchronization source
|
|
|
|
*/
|
2016-10-31 18:39:47 +01:00
|
|
|
getHwAvSync() generates (AudioHwSync hwAvSync);
|
2016-10-05 20:21:12 +02:00
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Sets whether the screen is on. Calling this method is equivalent to
|
|
|
|
* setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
|
2016-10-31 18:39:47 +01:00
|
|
|
*
|
|
|
|
* @param turnedOn whether the screen is turned on.
|
|
|
|
* @return retval operation completion status.
|
2016-10-05 20:21:12 +02:00
|
|
|
*/
|
2016-10-31 18:39:47 +01:00
|
|
|
setScreenState(bool turnedOn) generates (Result retval);
|
2016-10-05 20:21:12 +02:00
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param keys parameter keys.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
* @return parameters parameter key value pairs.
|
|
|
|
*/
|
|
|
|
getParameters(vec<string> keys)
|
|
|
|
generates (Result retval, vec<ParameterValue> parameters);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param parameters parameter key value pairs.
|
|
|
|
* @return retval operation completion status.
|
|
|
|
*/
|
|
|
|
setParameters(vec<ParameterValue> parameters) generates (Result retval);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-10-05 20:21:12 +02:00
|
|
|
* Dumps information about the stream into the provided file descriptor.
|
|
|
|
* This is used for the dumpsys facility.
|
|
|
|
*
|
|
|
|
* @param fd dump file descriptor.
|
|
|
|
*/
|
|
|
|
debugDump(handle fd);
|
|
|
|
};
|