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; |
Kevin Rocard | 4e914ff | 2018-03-02 13:27:14 -0800 | [diff] [blame] | 21 | import IPrimaryDevice; |
Kevin Rocard | a4e6d8b | 2018-01-20 21:52:01 -0800 | [diff] [blame] | 22 | |
Kevin Rocard | f663759 | 2018-02-28 15:15:07 -0800 | [diff] [blame] | 23 | /** This factory allows a HAL implementation to be split in multiple independent |
| 24 | * devices (called module in the pre-treble API). |
| 25 | * Note that this division is arbitrary and implementation are free |
| 26 | * to only have a Primary. |
| 27 | * The framework will query the devices according to audio_policy_configuration.xml |
| 28 | * |
| 29 | * Each device name is arbitrary, provided by the vendor's audio_policy_configuration.xml |
| 30 | * and only used to identify a device in this factory. |
| 31 | * The framework must not interpret the name, treating it as a vendor opaque data |
Kevin Rocard | 4e914ff | 2018-03-02 13:27:14 -0800 | [diff] [blame] | 32 | * with the following exception: |
Kevin Rocard | f663759 | 2018-02-28 15:15:07 -0800 | [diff] [blame] | 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 | 4e914ff | 2018-03-02 13:27:14 -0800 | [diff] [blame] | 54 | |
| 55 | /** |
| 56 | * Opens the Primary audio device that must be present. |
| 57 | * This function is not optional and must return successfully the primary device. |
| 58 | * |
| 59 | * This device must have the name "primary". |
| 60 | * |
| 61 | * The telephony stack uses this device to control the audio during a voice call. |
| 62 | * |
| 63 | * @return retval operation completion status. Must be SUCCESS. |
| 64 | * For debuging, return INVALID_ARGUMENTS if there is no corresponding |
| 65 | * hardware module found, NOT_INITIALIZED if an error occurred |
| 66 | * while opening the hardware module. |
| 67 | * @return result the interface for the created device. |
| 68 | */ |
| 69 | openPrimaryDevice() generates (Result retval, IPrimaryDevice result); |
Kevin Rocard | a4e6d8b | 2018-01-20 21:52:01 -0800 | [diff] [blame] | 70 | }; |