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