1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]; 20*4d7e907cSAndroid Build Coastguard Workerimport IDevice; 21*4d7e907cSAndroid Build Coastguard Workerimport IPrimaryDevice; 22*4d7e907cSAndroid Build Coastguard Worker 23*4d7e907cSAndroid Build Coastguard Worker/** This factory allows a HAL implementation to be split in multiple independent 24*4d7e907cSAndroid Build Coastguard Worker * devices (called module in the pre-treble API). 25*4d7e907cSAndroid Build Coastguard Worker * Note that this division is arbitrary and implementation are free 26*4d7e907cSAndroid Build Coastguard Worker * to only have a Primary. 27*4d7e907cSAndroid Build Coastguard Worker * The framework will query the devices according to audio_policy_configuration.xml 28*4d7e907cSAndroid Build Coastguard Worker * 29*4d7e907cSAndroid Build Coastguard Worker * Each device name is arbitrary, provided by the vendor's audio_policy_configuration.xml 30*4d7e907cSAndroid Build Coastguard Worker * and only used to identify a device in this factory. 31*4d7e907cSAndroid Build Coastguard Worker * The framework must not interpret the name, treating it as a vendor opaque data 32*4d7e907cSAndroid Build Coastguard Worker * with the following exception: 33*4d7e907cSAndroid Build Coastguard Worker * - the "r_submix" device that must be present to support policyMixes (Eg: Android projected). 34*4d7e907cSAndroid Build Coastguard Worker * Note that this Device is included by default in a build derived from AOSP. 35*4d7e907cSAndroid Build Coastguard Worker * 36*4d7e907cSAndroid Build Coastguard Worker * Note that on AOSP Oreo (including MR1) the "a2dp" module is not using this API 37*4d7e907cSAndroid Build Coastguard Worker * but is loaded directly from the system partition using the legacy API 38*4d7e907cSAndroid Build Coastguard Worker * due to limitations with the Bluetooth framework. 39*4d7e907cSAndroid Build Coastguard Worker */ 40*4d7e907cSAndroid Build Coastguard Workerinterface IDevicesFactory { 41*4d7e907cSAndroid Build Coastguard Worker 42*4d7e907cSAndroid Build Coastguard Worker /** 43*4d7e907cSAndroid Build Coastguard Worker * Opens an audio device. To close the device, it is necessary to release 44*4d7e907cSAndroid Build Coastguard Worker * references to the returned device object. 45*4d7e907cSAndroid Build Coastguard Worker * 46*4d7e907cSAndroid Build Coastguard Worker * @param device device name. 47*4d7e907cSAndroid Build Coastguard Worker * @return retval operation completion status. Returns INVALID_ARGUMENTS 48*4d7e907cSAndroid Build Coastguard Worker * if there is no corresponding hardware module found, 49*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if an error occured while opening the hardware 50*4d7e907cSAndroid Build Coastguard Worker * module. 51*4d7e907cSAndroid Build Coastguard Worker * @return result the interface for the created device. 52*4d7e907cSAndroid Build Coastguard Worker */ 53*4d7e907cSAndroid Build Coastguard Worker openDevice(string device) generates (Result retval, IDevice result); 54*4d7e907cSAndroid Build Coastguard Worker 55*4d7e907cSAndroid Build Coastguard Worker /** 56*4d7e907cSAndroid Build Coastguard Worker * Opens the Primary audio device that must be present. 57*4d7e907cSAndroid Build Coastguard Worker * This function is not optional and must return successfully the primary device. 58*4d7e907cSAndroid Build Coastguard Worker * 59*4d7e907cSAndroid Build Coastguard Worker * This device must have the name "primary". 60*4d7e907cSAndroid Build Coastguard Worker * 61*4d7e907cSAndroid Build Coastguard Worker * The telephony stack uses this device to control the audio during a voice call. 62*4d7e907cSAndroid Build Coastguard Worker * 63*4d7e907cSAndroid Build Coastguard Worker * @return retval operation completion status. Must be SUCCESS. 64*4d7e907cSAndroid Build Coastguard Worker * For debuging, return INVALID_ARGUMENTS if there is no corresponding 65*4d7e907cSAndroid Build Coastguard Worker * hardware module found, NOT_INITIALIZED if an error occurred 66*4d7e907cSAndroid Build Coastguard Worker * while opening the hardware module. 67*4d7e907cSAndroid Build Coastguard Worker * @return result the interface for the created device. 68*4d7e907cSAndroid Build Coastguard Worker */ 69*4d7e907cSAndroid Build Coastguard Worker openPrimaryDevice() generates (Result retval, IPrimaryDevice result); 70*4d7e907cSAndroid Build Coastguard Worker}; 71