1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2022 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 @7.0::IDevicesFactory; 20*4d7e907cSAndroid Build Coastguard Workerimport @7.0::Result; 21*4d7e907cSAndroid Build Coastguard Workerimport IDevice; 22*4d7e907cSAndroid Build Coastguard Workerimport IPrimaryDevice; 23*4d7e907cSAndroid Build Coastguard Worker 24*4d7e907cSAndroid Build Coastguard Worker/** 25*4d7e907cSAndroid Build Coastguard Worker * This factory allows a HAL implementation to be split in multiple independent 26*4d7e907cSAndroid Build Coastguard Worker * devices (called module in the pre-treble API). Note that this division is 27*4d7e907cSAndroid Build Coastguard Worker * arbitrary and implementation are free to only have a Primary. The framework 28*4d7e907cSAndroid Build Coastguard Worker * will query the devices according to audio_policy_configuration.xml 29*4d7e907cSAndroid Build Coastguard Worker * 30*4d7e907cSAndroid Build Coastguard Worker * Each device name is arbitrary, provided by the vendor's audio_policy_configuration.xml 31*4d7e907cSAndroid Build Coastguard Worker * and only used to identify a device in this factory. 32*4d7e907cSAndroid Build Coastguard Worker * The framework must not interpret the name, treating it as a vendor opaque data 33*4d7e907cSAndroid Build Coastguard Worker * with the following exception: 34*4d7e907cSAndroid Build Coastguard Worker * - the "r_submix" device that must be present to support policyMixes (Eg: Android projected). 35*4d7e907cSAndroid Build Coastguard Worker * Note that this Device is included by default in a build derived from AOSP. 36*4d7e907cSAndroid Build Coastguard Worker */ 37*4d7e907cSAndroid Build Coastguard Workerinterface IDevicesFactory extends @7.0::IDevicesFactory { 38*4d7e907cSAndroid Build Coastguard Worker 39*4d7e907cSAndroid Build Coastguard Worker /** 40*4d7e907cSAndroid Build Coastguard Worker * Opens an audio device. To close the device, it is necessary to call 41*4d7e907cSAndroid Build Coastguard Worker * 'close' method on the returned device object. 42*4d7e907cSAndroid Build Coastguard Worker * 43*4d7e907cSAndroid Build Coastguard Worker * Important note: due to rules of HIDL, @7.1::IPrimaryDevice extends 44*4d7e907cSAndroid Build Coastguard Worker * @7.0::IPrimaryDevice, rather than @7.1::IDevice. Thus the returned 45*4d7e907cSAndroid Build Coastguard Worker * IDevice interface can not be up-casted to @7.1::IPrimaryDevice for the 46*4d7e907cSAndroid Build Coastguard Worker * primary device. The client needs to use IPrimaryDevice instead of this 47*4d7e907cSAndroid Build Coastguard Worker * method if it needs full functionality of the IPrimaryDevice interface. 48*4d7e907cSAndroid Build Coastguard Worker * 49*4d7e907cSAndroid Build Coastguard Worker * @param device device name. 50*4d7e907cSAndroid Build Coastguard Worker * @return retval operation completion status. Returns INVALID_ARGUMENTS 51*4d7e907cSAndroid Build Coastguard Worker * if there is no corresponding hardware module found, 52*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if an error occurred while opening the hardware 53*4d7e907cSAndroid Build Coastguard Worker * module. 54*4d7e907cSAndroid Build Coastguard Worker * @return result the interface for the created device. 55*4d7e907cSAndroid Build Coastguard Worker */ 56*4d7e907cSAndroid Build Coastguard Worker openDevice_7_1(string device) generates (Result retval, IDevice result); 57*4d7e907cSAndroid Build Coastguard Worker 58*4d7e907cSAndroid Build Coastguard Worker /** 59*4d7e907cSAndroid Build Coastguard Worker * Opens the Primary audio device that must be present. 60*4d7e907cSAndroid Build Coastguard Worker * This function is not optional and must return successfully the primary device. 61*4d7e907cSAndroid Build Coastguard Worker * 62*4d7e907cSAndroid Build Coastguard Worker * This device must have the name "primary". 63*4d7e907cSAndroid Build Coastguard Worker * 64*4d7e907cSAndroid Build Coastguard Worker * The telephony stack uses this device to control the audio during a voice call. 65*4d7e907cSAndroid Build Coastguard Worker * 66*4d7e907cSAndroid Build Coastguard Worker * @return retval operation completion status. Must be SUCCESS. 67*4d7e907cSAndroid Build Coastguard Worker * For debugging, return INVALID_ARGUMENTS if there is no corresponding 68*4d7e907cSAndroid Build Coastguard Worker * hardware module found, NOT_INITIALIZED if an error occurred 69*4d7e907cSAndroid Build Coastguard Worker * while opening the hardware module. 70*4d7e907cSAndroid Build Coastguard Worker * @return result the interface for the created device. 71*4d7e907cSAndroid Build Coastguard Worker */ 72*4d7e907cSAndroid Build Coastguard Worker openPrimaryDevice_7_1() generates (Result retval, IPrimaryDevice result); 73*4d7e907cSAndroid Build Coastguard Worker}; 74