1/* 2 * Copyright (C) 2020 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 17package android.hardware.automotive.audiocontrol@2.0; 18 19import android.hardware.audio.common@6.0::AudioUsage; 20 21/** 22 * Callback interface for audio focus listener. 23 * 24 * For typical configuration, the listener the car audio service. 25 */ 26interface IFocusListener { 27 /** 28 * Called whenever HAL is requesting focus as it is starting to play audio of a given usage in a 29 * specified zone. 30 * 31 * In response, IAudioControl#onAudioFocusChange will be called with focusChange status. This 32 * interaction is oneway to avoid blocking HAL so that it is not required to wait for a response 33 * before playing audio. 34 * 35 * @param usage The audio usage associated with the focus request {@code AttributeUsage} 36 * @param zoneId The identifier for the audio zone where the HAL is requesting focus 37 * @param focusGain The AudioFocusChange associated with this request. Should be one of the 38 * following: GAIN, GAIN_TRANSIENT, GAIN_TRANSIENT_MAY_DUCK, GAIN_TRANSIENT_EXCLUSIVE. 39 */ 40 oneway requestAudioFocus(bitfield<AudioUsage> usage, int32_t zoneId, 41 bitfield<AudioFocusChange> focusGain); 42 43 /** 44 * Called whenever HAL is abandoning focus as it is finished playing audio of a given usage in a 45 * specific zone. 46 * 47 * In response, IAudioControl#onAudioFocusChange will be called with focusChange status. This 48 * interaction is oneway to avoid blocking HAL so that it is not required to wait for a response 49 * before stopping audio playback. 50 * 51 * @param usage The audio usage for which the HAL is abandoning focus {@code AttributeUsage} 52 * @param zoneId The identifier for the audio zone that the HAL abandoning focus 53 */ 54 oneway abandonAudioFocus(bitfield<AudioUsage> usage, int32_t zoneId); 55}; 56