1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2020 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 ICloseHandle; 20*4d7e907cSAndroid Build Coastguard Workerimport IFocusListener; 21*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::AudioUsage; 22*4d7e907cSAndroid Build Coastguard Worker 23*4d7e907cSAndroid Build Coastguard Worker/** 24*4d7e907cSAndroid Build Coastguard Worker * Interacts with the car's audio subsystem to manage audio sources and volumes 25*4d7e907cSAndroid Build Coastguard Worker */ 26*4d7e907cSAndroid Build Coastguard Workerinterface IAudioControl { 27*4d7e907cSAndroid Build Coastguard Worker /** 28*4d7e907cSAndroid Build Coastguard Worker * Registers focus listener to be used by HAL for requesting and abandoning audio focus. 29*4d7e907cSAndroid Build Coastguard Worker * 30*4d7e907cSAndroid Build Coastguard Worker * It is expected that there will only ever be a single focus listener registered. If the 31*4d7e907cSAndroid Build Coastguard Worker * observer dies, the HAL implementation must unregister observer automatically. If called when 32*4d7e907cSAndroid Build Coastguard Worker * a listener is already registered, the existing one should be unregistered and replaced with 33*4d7e907cSAndroid Build Coastguard Worker * the new listener. 34*4d7e907cSAndroid Build Coastguard Worker * 35*4d7e907cSAndroid Build Coastguard Worker * @param listener the listener interface 36*4d7e907cSAndroid Build Coastguard Worker * @return closeHandle A handle to unregister observer. 37*4d7e907cSAndroid Build Coastguard Worker */ 38*4d7e907cSAndroid Build Coastguard Worker registerFocusListener(IFocusListener listener) generates (ICloseHandle closeHandle); 39*4d7e907cSAndroid Build Coastguard Worker 40*4d7e907cSAndroid Build Coastguard Worker /** 41*4d7e907cSAndroid Build Coastguard Worker * Notifies HAL of changes in audio focus status for focuses requested or abandoned by the HAL. 42*4d7e907cSAndroid Build Coastguard Worker * 43*4d7e907cSAndroid Build Coastguard Worker * This will be called in response to IFocusListener's requestAudioFocus and 44*4d7e907cSAndroid Build Coastguard Worker * abandonAudioFocus, as well as part of any change in focus being held by the HAL due focus 45*4d7e907cSAndroid Build Coastguard Worker * request from other activities or services. 46*4d7e907cSAndroid Build Coastguard Worker * 47*4d7e907cSAndroid Build Coastguard Worker * The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor 48*4d7e907cSAndroid Build Coastguard Worker * is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received. 49*4d7e907cSAndroid Build Coastguard Worker * 50*4d7e907cSAndroid Build Coastguard Worker * @param usage The audio usage associated with the focus change {@code AttributeUsage} 51*4d7e907cSAndroid Build Coastguard Worker * @param zoneId The identifier for the audio zone that the HAL is playing the stream in 52*4d7e907cSAndroid Build Coastguard Worker * @param focusChange the AudioFocusChange that has occurred 53*4d7e907cSAndroid Build Coastguard Worker */ 54*4d7e907cSAndroid Build Coastguard Worker oneway onAudioFocusChange(bitfield<AudioUsage> usage, int32_t zoneId, 55*4d7e907cSAndroid Build Coastguard Worker bitfield<AudioFocusChange> focusChange); 56*4d7e907cSAndroid Build Coastguard Worker 57*4d7e907cSAndroid Build Coastguard Worker /** 58*4d7e907cSAndroid Build Coastguard Worker * Control the right/left balance setting of the car speakers. 59*4d7e907cSAndroid Build Coastguard Worker * 60*4d7e907cSAndroid Build Coastguard Worker * This is intended to shift the speaker volume toward the right (+) or left (-) side of 61*4d7e907cSAndroid Build Coastguard Worker * the car. 0.0 means "centered". +1.0 means fully right. -1.0 means fully left. 62*4d7e907cSAndroid Build Coastguard Worker * 63*4d7e907cSAndroid Build Coastguard Worker * A value outside the range -1 to 1 must be clamped by the implementation to the -1 to 1 64*4d7e907cSAndroid Build Coastguard Worker * range. 65*4d7e907cSAndroid Build Coastguard Worker */ 66*4d7e907cSAndroid Build Coastguard Worker oneway setBalanceTowardRight(float value); 67*4d7e907cSAndroid Build Coastguard Worker 68*4d7e907cSAndroid Build Coastguard Worker /** 69*4d7e907cSAndroid Build Coastguard Worker * Control the fore/aft fade setting of the car speakers. 70*4d7e907cSAndroid Build Coastguard Worker * 71*4d7e907cSAndroid Build Coastguard Worker * This is intended to shift the speaker volume toward the front (+) or back (-) of the car. 72*4d7e907cSAndroid Build Coastguard Worker * 0.0 means "centered". +1.0 means fully forward. -1.0 means fully rearward. 73*4d7e907cSAndroid Build Coastguard Worker * 74*4d7e907cSAndroid Build Coastguard Worker * A value outside the range -1 to 1 must be clamped by the implementation to the -1 to 1 75*4d7e907cSAndroid Build Coastguard Worker * range. 76*4d7e907cSAndroid Build Coastguard Worker */ 77*4d7e907cSAndroid Build Coastguard Worker oneway setFadeTowardFront(float value); 78*4d7e907cSAndroid Build Coastguard Worker}; 79