Kevin Rocard | a4e6d8b | 2018-01-20 21:52:01 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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 | |
| 17 | package android.hardware.audio@4.0; |
| 18 | |
| 19 | import android.hardware.audio.common@4.0; |
| 20 | import IDevice; |
| 21 | |
Kevin Rocard | f663759 | 2018-02-28 15:15:07 -0800 | [diff] [blame] | 22 | /** This factory allows a HAL implementation to be split in multiple independent |
| 23 | * devices (called module in the pre-treble API). |
| 24 | * Note that this division is arbitrary and implementation are free |
| 25 | * to only have a Primary. |
| 26 | * The framework will query the devices according to audio_policy_configuration.xml |
| 27 | * |
| 28 | * Each device name is arbitrary, provided by the vendor's audio_policy_configuration.xml |
| 29 | * and only used to identify a device in this factory. |
| 30 | * The framework must not interpret the name, treating it as a vendor opaque data |
| 31 | * with the following exceptions: |
| 32 | * - the "primary" device must always be present and is the device used by the telephony framework. |
| 33 | * - the "r_submix" device that must be present to support policyMixes (Eg: Android projected). |
| 34 | * Note that this Device is included by default in a build derived from AOSP. |
| 35 | * |
| 36 | * Note that on AOSP Oreo (including MR1) the "a2dp" module is not using this API |
| 37 | * but is loaded directly from the system partition using the legacy API |
| 38 | * due to limitations with the Bluetooth framework. |
| 39 | */ |
Kevin Rocard | a4e6d8b | 2018-01-20 21:52:01 -0800 | [diff] [blame] | 40 | interface IDevicesFactory { |
Kevin Rocard | a4e6d8b | 2018-01-20 21:52:01 -0800 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Opens an audio device. To close the device, it is necessary to release |
| 44 | * references to the returned device object. |
| 45 | * |
Kevin Rocard | f663759 | 2018-02-28 15:15:07 -0800 | [diff] [blame] | 46 | * @param device device name. |
Kevin Rocard | a4e6d8b | 2018-01-20 21:52:01 -0800 | [diff] [blame] | 47 | * @return retval operation completion status. Returns INVALID_ARGUMENTS |
| 48 | * if there is no corresponding hardware module found, |
| 49 | * NOT_INITIALIZED if an error occured while opening the hardware |
| 50 | * module. |
| 51 | * @return result the interface for the created device. |
| 52 | */ |
Kevin Rocard | f663759 | 2018-02-28 15:15:07 -0800 | [diff] [blame] | 53 | openDevice(string device) generates (Result retval, IDevice result); |
Kevin Rocard | a4e6d8b | 2018-01-20 21:52:01 -0800 | [diff] [blame] | 54 | }; |