mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 22:04:26 +00:00
Adding AIDL version 2 of AudioControl HAL
- Updated APIs to use PlaybackTrackMetadata (aka AudioAttributes) instead of usage to get rid of usages list limitation. - Add Gain Callback to notify unexpected gain changed from HAL (as currently done for Audio Focus). - Aggregate Callbacks within a unique IAudioControlCallback interface Bug: b/154906631 Test: build and run VTS tests Signed-off-by: Francois Gaffie <francois.gaffie@renault.com> Change-Id: If74d575fad3888b698250a8ec9a6918f7cb294d7 Merged-In: If74d575fad3888b698250a8ec9a6918f7cb294d7
This commit is contained in:
committed by
François
parent
f17f24ee52
commit
a7e6cd0b73
@@ -13,11 +13,17 @@ aidl_interface {
|
||||
name: "android.hardware.automotive.audiocontrol",
|
||||
vendor_available: true,
|
||||
srcs: ["android/hardware/automotive/audiocontrol/*.aidl"],
|
||||
imports: [
|
||||
"android.media.audio.common.types",
|
||||
"android.hardware.audio.common",
|
||||
],
|
||||
stability: "vintf",
|
||||
backend: {
|
||||
java: {
|
||||
sdk_version: "module_current",
|
||||
platform_apis: true,
|
||||
},
|
||||
},
|
||||
versions: ["1"],
|
||||
versions: [
|
||||
"1",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
||||
// edit this file. It looks like you are doing that because you have modified
|
||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
||||
// from an interface or a field from a parcelable and it broke the build. That
|
||||
// breakage is intended.
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible changes to the AIDL files built
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
@JavaDerive(equals=true, toString=true) @VintfStability
|
||||
parcelable AudioGainConfigInfo {
|
||||
int zoneId;
|
||||
String devicePortAddress;
|
||||
int volumeIndex;
|
||||
}
|
||||
@@ -1,14 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
||||
// edit this file. It looks like you are doing that because you have modified
|
||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
||||
// from an interface or a field from a parcelable and it broke the build. That
|
||||
// breakage is intended.
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible changes to the AIDL files built
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
@@ -22,4 +38,5 @@ parcelable DuckingInfo {
|
||||
String[] deviceAddressesToDuck;
|
||||
String[] deviceAddressesToUnduck;
|
||||
String[] usagesHoldingFocus;
|
||||
@nullable android.hardware.audio.common.PlaybackTrackMetadata[] playbackMetaDataHoldingFocus;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
||||
// edit this file. It looks like you are doing that because you have modified
|
||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
||||
// from an interface or a field from a parcelable and it broke the build. That
|
||||
// breakage is intended.
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible changes to the AIDL files built
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
@@ -18,10 +34,16 @@
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
@VintfStability
|
||||
interface IAudioControl {
|
||||
/**
|
||||
* @deprecated use {@link android.hardware.audio.common.PlaybackTrackMetadata} instead.
|
||||
*/
|
||||
oneway void onAudioFocusChange(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
|
||||
oneway void onDevicesToDuckChange(in android.hardware.automotive.audiocontrol.DuckingInfo[] duckingInfos);
|
||||
oneway void onDevicesToMuteChange(in android.hardware.automotive.audiocontrol.MutingInfo[] mutingInfos);
|
||||
oneway void registerFocusListener(in android.hardware.automotive.audiocontrol.IFocusListener listener);
|
||||
oneway void setBalanceTowardRight(in float value);
|
||||
oneway void setFadeTowardFront(in float value);
|
||||
oneway void onAudioFocusChangeWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
|
||||
oneway void setAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains);
|
||||
oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
@VintfStability
|
||||
interface IAudioGainCallback {
|
||||
oneway void onAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains);
|
||||
}
|
||||
@@ -1,14 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
||||
// edit this file. It looks like you are doing that because you have modified
|
||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
||||
// from an interface or a field from a parcelable and it broke the build. That
|
||||
// breakage is intended.
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible changes to the AIDL files built
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
@@ -20,4 +36,6 @@ package android.hardware.automotive.audiocontrol;
|
||||
interface IFocusListener {
|
||||
oneway void abandonAudioFocus(in String usage, in int zoneId);
|
||||
oneway void requestAudioFocus(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain);
|
||||
oneway void abandonAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId);
|
||||
oneway void requestAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
||||
// edit this file. It looks like you are doing that because you have modified
|
||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
||||
// from an interface or a field from a parcelable and it broke the build. That
|
||||
// breakage is intended.
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible changes to the AIDL files built
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum Reasons {
|
||||
FORCED_MASTER_MUTE = 1,
|
||||
REMOTE_MUTE = 2,
|
||||
TCU_MUTE = 4,
|
||||
ADAS_DUCKING = 8,
|
||||
NAV_DUCKING = 16,
|
||||
PROJECTION_DUCKING = 32,
|
||||
THERMAL_LIMITATION = 64,
|
||||
SUSPEND_EXIT_VOL_LIMITATION = 128,
|
||||
EXTERNAL_AMP_VOL_FEEDBACK = 256,
|
||||
OTHER = -2147483648,
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
|
||||
/**
|
||||
* NOTE:
|
||||
* Was expecting to reuse android.media.audio types... Limit info to minimum to prevent
|
||||
* duplicating aidl_api. Will follow up if AudioGainConfig is exposed by android.media AIDL API.
|
||||
*/
|
||||
@JavaDerive(equals=true, toString=true)
|
||||
@VintfStability
|
||||
parcelable AudioGainConfigInfo {
|
||||
/**
|
||||
* The identifier for the audio zone the audio device port associated to this gain belongs to.
|
||||
*
|
||||
*/
|
||||
int zoneId;
|
||||
|
||||
/**
|
||||
* The Audio Output Device Port Address.
|
||||
*
|
||||
* This is the address that can be retrieved at JAVA layer using the introspection
|
||||
* {@link android.media.AudioManager#listAudioDevicePorts} API then
|
||||
* {@link audio.media.AudioDeviceInfo#getAddress} API.
|
||||
*
|
||||
* At HAL layer, it corresponds to audio_port_v7.audio_port_device_ext.address.
|
||||
*
|
||||
* Devices that does not have an address will indicate an empty string "".
|
||||
*/
|
||||
String devicePortAddress;
|
||||
|
||||
/**
|
||||
* UI Index of the corresponding AudioGain in AudioPort.gains.
|
||||
*/
|
||||
int volumeIndex;
|
||||
}
|
||||
@@ -14,7 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
|
||||
import android.hardware.audio.common.PlaybackTrackMetadata;
|
||||
|
||||
/**
|
||||
* The current ducking information for a single audio zone.
|
||||
@@ -48,7 +50,15 @@
|
||||
/**
|
||||
* List of usages currently holding focus for this audio zone.
|
||||
*
|
||||
* This field was deprecated in version 2.
|
||||
* Use playbackMetaDataHoldingFocus instead.
|
||||
*
|
||||
* <p> See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
|
||||
*/
|
||||
String[] usagesHoldingFocus;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of output stream metadata associated with the current focus holder for this audio zone
|
||||
*/
|
||||
@nullable PlaybackTrackMetadata[] playbackMetaDataHoldingFocus;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,40 @@ import android.hardware.automotive.audiocontrol.AudioFocusChange;
|
||||
import android.hardware.automotive.audiocontrol.DuckingInfo;
|
||||
import android.hardware.automotive.audiocontrol.MutingInfo;
|
||||
import android.hardware.automotive.audiocontrol.IFocusListener;
|
||||
import android.hardware.automotive.audiocontrol.IAudioGainCallback;
|
||||
import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
|
||||
import android.hardware.automotive.audiocontrol.Reasons;
|
||||
|
||||
/**
|
||||
* Important note on Metadata:
|
||||
* Metadata qualifies a playback track for an output stream.
|
||||
* This is highly closed to {@link android.media.AudioAttributes}.
|
||||
* It allows to identify the audio stream rendered / requesting / abandonning the focus.
|
||||
*
|
||||
* AudioControl 1.0 was limited to identification through {@code AttributeUsage} listed as
|
||||
* {@code audioUsage} in audio_policy_configuration.xsd.
|
||||
*
|
||||
* Any new OEM needs would not be possible without extension.
|
||||
*
|
||||
* Relying on {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata} allows
|
||||
* to use a combination of {@code AttributeUsage}, {@code AttributeContentType} and
|
||||
* {@code AttributeTags} to identify the use case / routing thanks to
|
||||
* {@link android.media.audiopolicy.AudioProductStrategy}.
|
||||
* The belonging to a strategy is deduced by an AOSP logic (in sync at native and java layer).
|
||||
*
|
||||
* IMPORTANT NOTE ON TAGS:
|
||||
* To limit the possibilies and prevent from confusion, we expect the String to follow
|
||||
* a given formalism that will be enforced.
|
||||
*
|
||||
* 1 / By convention, tags shall be a "key=value" pair.
|
||||
* Vendor must namespace their tag's key (for example com.google.strategy=VR) to avoid conflicts.
|
||||
* vendor specific applications and must be prefixed by "VX_". Vendor must
|
||||
*
|
||||
* 2 / Tags reported here shall be the same as the tags used to define a given
|
||||
* {@link android.media.audiopolicy.AudioProductStrategy} and so in
|
||||
* audio_policy_engine_configuration.xml file.
|
||||
*/
|
||||
import android.hardware.audio.common.PlaybackTrackMetadata;
|
||||
|
||||
/**
|
||||
* Interacts with the car's audio subsystem to manage audio sources and volumes
|
||||
@@ -36,8 +70,12 @@ interface IAudioControl {
|
||||
* The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor
|
||||
* is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received.
|
||||
*
|
||||
* This method was deprecated in version 2 to allow getting rid of usages limitation.
|
||||
* Use {@link IAudioControl#onAudioFocusChangeWithMetaData} instead.
|
||||
*
|
||||
* @param usage The audio usage associated with the focus change {@code AttributeUsage}. See
|
||||
* {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
|
||||
* @deprecated use {@link android.hardware.audio.common.PlaybackTrackMetadata} instead.
|
||||
* @param zoneId The identifier for the audio zone that the HAL is playing the stream in
|
||||
* @param focusChange the AudioFocusChange that has occurred.
|
||||
*/
|
||||
@@ -99,4 +137,51 @@ interface IAudioControl {
|
||||
* range.
|
||||
*/
|
||||
oneway void setFadeTowardFront(in float value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies HAL of changes in audio focus status for focuses requested or abandoned by the HAL.
|
||||
*
|
||||
* This will be called in response to IFocusListener's requestAudioFocus and
|
||||
* abandonAudioFocus, as well as part of any change in focus being held by the HAL due focus
|
||||
* request from other activities or services.
|
||||
*
|
||||
* The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor
|
||||
* is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received.
|
||||
*
|
||||
* @param playbackMetaData The output stream metadata associated with the focus request
|
||||
* @param zoneId The identifier for the audio zone that the HAL is playing the stream in
|
||||
* @param focusChange the AudioFocusChange that has occurred.
|
||||
*/
|
||||
oneway void onAudioFocusChangeWithMetaData(in PlaybackTrackMetadata playbackMetaData,
|
||||
in int zoneId, in AudioFocusChange focusChange);
|
||||
|
||||
/**
|
||||
* Notifies HAL of changes in output devices that the HAL should apply gain change to
|
||||
* and the reason(s) why
|
||||
*
|
||||
* This may be called in response to changes in audio focus, and will include a list of
|
||||
* {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} objects per audio zone
|
||||
* that experienced a change in audo focus.
|
||||
*
|
||||
* @param reasons List of reasons that triggered the given gains changed.
|
||||
* This must be one or more of the
|
||||
* {@link android.hardware.automotive.audiocontrol.Reasons} constants.
|
||||
*
|
||||
* @param gains List of gains the change is intended to.
|
||||
*/
|
||||
oneway void setAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains);
|
||||
|
||||
/**
|
||||
* Registers callback to be used by HAL for reporting unexpected gain(s) changed and the
|
||||
* reason(s) why.
|
||||
*
|
||||
* It is expected that there will only ever be a single callback registered. If the
|
||||
* observer dies, the HAL implementation must unregister observer automatically. If called when
|
||||
* a listener is already registered, the existing one should be unregistered and replaced with
|
||||
* the new callback.
|
||||
*
|
||||
* @param callback The {@link android.hardware.automotive.audiocontrol.IAudioGainCallback}
|
||||
* interface.
|
||||
*/
|
||||
oneway void registerGainCallback(in IAudioGainCallback callback);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
|
||||
import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
|
||||
import android.hardware.automotive.audiocontrol.Reasons;
|
||||
|
||||
/**
|
||||
* Interface definition for a callback to be invoked when the gain(s) of the device port(s) is(are)
|
||||
* updated at HAL layer.
|
||||
*
|
||||
* <p>This defines counter part API of
|
||||
* {@link android.hardware.automotive.audiocontrol.IAudioControl#onDevicesToDuckChange},
|
||||
* {@link android.hardware.automotive.audiocontrol.IAudioControl#onDevicesToMuteChange} and
|
||||
* {@link android.hardware.automotive.audiocontrol.IAudioControl#setAudioDeviceGainsChanged} APIs.
|
||||
*
|
||||
* The previous API defines Mute/Duck order decided by the client (e.g. CarAudioService)
|
||||
* and delegated to AudioControl for application.
|
||||
*
|
||||
* This callback interface defines Mute/Duck notification decided by AudioControl HAL (due to
|
||||
* e.g. - external conditions from Android IVI subsystem
|
||||
* - regulation / need faster decision rather than using
|
||||
* {@link android.hardware.automotive.audiocontrol.IAudioControl#onAudioFocusChange} to
|
||||
* report the use case and then waiting for CarAudioService decision to Mute/Duck.
|
||||
*/
|
||||
@VintfStability
|
||||
oneway interface IAudioGainCallback {
|
||||
/**
|
||||
* Used to indicated the one or more audio device port gains have changed unexpectidely, i.e.
|
||||
* initiated by HAL, not by CarAudioService.
|
||||
* This is the counter part of the
|
||||
* {@link android.hardware.automotive.audiocontrol.onDevicesToDuckChange},
|
||||
* {@link android.hardware.automotive.audiocontrol.onDevicesToMuteChange} and
|
||||
* {@link android.hardware.automotive.audiocontrol.setAudioDeviceGainsChanged} APIs.
|
||||
*
|
||||
* Flexibility is given to OEM to mute/duck in HAL or in CarAudioService.
|
||||
* For critical use cases (i.e. when regulation is required), better to handle mute/duck in
|
||||
* HAL layer and informs upper layer.
|
||||
* Non critical use case may report gain and focus and CarAudioService to decide of duck/mute.
|
||||
*
|
||||
* @param reasons List of reasons that triggered the given gains changed.
|
||||
* This must be one or more of the
|
||||
* {@link android.hardware.automotive.audiocontrol.Reasons} constants.
|
||||
* It will define if the port has been muted/ducked or must now affected
|
||||
* by gain limitation that shall be notified/enforced at CarAudioService
|
||||
* layer.
|
||||
*
|
||||
* @param gains List of gains affected by the change.
|
||||
*/
|
||||
void onAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains);
|
||||
}
|
||||
@@ -18,10 +18,13 @@ package android.hardware.automotive.audiocontrol;
|
||||
|
||||
import android.hardware.automotive.audiocontrol.AudioFocusChange;
|
||||
|
||||
import android.hardware.audio.common.PlaybackTrackMetadata;
|
||||
|
||||
/**
|
||||
* Callback interface for audio focus listener.
|
||||
*
|
||||
* For typical configuration, the listener the car audio service.
|
||||
*
|
||||
*/
|
||||
@VintfStability
|
||||
interface IFocusListener {
|
||||
@@ -33,6 +36,9 @@ interface IFocusListener {
|
||||
* interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
|
||||
* before stopping audio playback.
|
||||
*
|
||||
* Deprecated in version 2 to allow generic interface callback listener.
|
||||
* Use {@link IFocusListener#abandonHalAudioFocusWithMetaData} instead.
|
||||
*
|
||||
* @param usage The audio usage for which the HAL is abandoning focus {@code AttributeUsage}.
|
||||
* See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
|
||||
* @param zoneId The identifier for the audio zone that the HAL abandoning focus
|
||||
@@ -47,6 +53,9 @@ interface IFocusListener {
|
||||
* interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
|
||||
* before playing audio.
|
||||
*
|
||||
* Deprecated in version 2 to allow generic interface callback listener.
|
||||
* Use {@link IFocusListener#requestAudioFocusWithMetaData} instead.
|
||||
*
|
||||
* @param usage The audio usage associated with the focus request {@code AttributeUsage}. See
|
||||
* {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
|
||||
* @param zoneId The identifier for the audio zone where the HAL is requesting focus
|
||||
@@ -54,4 +63,29 @@ interface IFocusListener {
|
||||
* following: GAIN, GAIN_TRANSIENT, GAIN_TRANSIENT_MAY_DUCK, GAIN_TRANSIENT_EXCLUSIVE.
|
||||
*/
|
||||
oneway void requestAudioFocus(in String usage, in int zoneId, in AudioFocusChange focusGain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to indicate that the audio output stream associated with
|
||||
* {@link android.hardware.audio.common.PlaybackTrackMetadata} has released
|
||||
* the focus.
|
||||
*
|
||||
* @param playbackMetaData The output stream metadata associated with the focus request
|
||||
* @param zoneId The identifier for the audio zone that the HAL abandoning focus
|
||||
*/
|
||||
oneway void abandonAudioFocusWithMetaData(in PlaybackTrackMetadata playbackMetaData,
|
||||
in int zoneId);
|
||||
|
||||
/**
|
||||
* Used to indicate that the audio output stream associated with
|
||||
* {@link android.hardware.audio.common.PlaybackTrackMetadata} has taken the focus.
|
||||
*
|
||||
* @param playbackMetaData The output stream metadata associated with the focus request
|
||||
* @param zoneId The identifier for the audio zone that the HAL abandoning focus
|
||||
* @param focusGain The focus type requested.
|
||||
* This must be one of the
|
||||
* {@link android.hardware.automotive.audiocontrol.AudioFocusChange}
|
||||
* constants.
|
||||
*/
|
||||
oneway void requestAudioFocusWithMetaData(in PlaybackTrackMetadata playbackMetaData,
|
||||
in int zoneId, in AudioFocusChange focusGain);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.automotive.audiocontrol;
|
||||
|
||||
/**
|
||||
* Enum to identify the reason(s) of
|
||||
* {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} changed event
|
||||
*/
|
||||
@Backing(type="int")
|
||||
@VintfStability
|
||||
enum Reasons {
|
||||
/**
|
||||
* Magic Key Code (may be SWRC button combination) to force muting all audio sources.
|
||||
* This may be used for example in case of cyber attach to ensure driver can safely drive back
|
||||
* to garage to restore sw.
|
||||
*/
|
||||
FORCED_MASTER_MUTE = 0x1,
|
||||
/**
|
||||
* Reports a mute request outside the IVI (Android) system.
|
||||
* It may target to mute the list of
|
||||
* {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo}.
|
||||
* A focus request may also be reported in addition if the use case that initiates the mute
|
||||
* has matching {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata}
|
||||
* For regulation issue, the action of mute could be managed by HAL itself.
|
||||
*/
|
||||
REMOTE_MUTE = 0x2,
|
||||
/**
|
||||
* Reports a mute initiated by the TCU. It may be applied to all audio source (no
|
||||
* associated {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} reported, or
|
||||
* it may target to mute only the given list of ports.
|
||||
* A focus request may also be reported in addition.
|
||||
* For regulation issue, the action of mute could be managed by HAL itself.
|
||||
*/
|
||||
TCU_MUTE = 0x4,
|
||||
/**
|
||||
* Reports a duck due to ADAS use case. A focus request may also be reported in addition.
|
||||
* For regulation issue, the action of duck could be managed by HAL itself.
|
||||
* It gives a chance to CarAudioService to decide whether contextual volume change may be
|
||||
* applied from the ducked index base or not.
|
||||
*/
|
||||
ADAS_DUCKING = 0x8,
|
||||
/**
|
||||
* Reports a duck due to navigation use case. It gives a chance to CarAudioService to decide
|
||||
* whether contextual volume change may be applied from the ducked index base or not.
|
||||
*/
|
||||
NAV_DUCKING = 0x10,
|
||||
/**
|
||||
* Some device projection stack may send signal to IVI to duck / unduck main audio stream.
|
||||
* In this case, Contextual Volume Policy may be adapted to control the alternate / secondary
|
||||
* audio stream.
|
||||
*/
|
||||
PROJECTION_DUCKING = 0x20,
|
||||
/**
|
||||
* When the amplifier is overheating, it may be recovered by limiting the volume.
|
||||
*/
|
||||
THERMAL_LIMITATION = 0x40,
|
||||
/**
|
||||
* Before the system enters suspend, it may ensure while exiting suspend or during cold boot
|
||||
* that the volume is limited to prevent from sound explosion.
|
||||
*/
|
||||
SUSPEND_EXIT_VOL_LIMITATION = 0x80,
|
||||
/**
|
||||
* When using an external amplifier, it may be required to keep volume in sync and have
|
||||
* asynchronous notification of effective volume change.
|
||||
*/
|
||||
EXTERNAL_AMP_VOL_FEEDBACK = 0x100,
|
||||
/**
|
||||
* For other OEM use.
|
||||
*/
|
||||
OTHER = 0x80000000,
|
||||
}
|
||||
Reference in New Issue
Block a user