Merge changes from topic "ACH_CONFIGURATIONS" into main

* changes:
  Add audio control configuraiton APIs VTS
  Add default implementation to load current XML
  Add audio configurations API to audio control HAL
This commit is contained in:
Oscar Azucena
2024-11-01 02:25:16 +00:00
committed by Android (Google) Code Review
74 changed files with 6841 additions and 27 deletions

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2024 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 AudioDeviceConfiguration {
android.hardware.automotive.audiocontrol.RoutingDeviceConfiguration routingConfig;
boolean useCoreAudioVolume;
boolean useHalDuckingSignals;
boolean useCarVolumeGroupMuting;
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2024 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 AudioFadeConfiguration {
String name;
android.hardware.automotive.audiocontrol.FadeState fadeState;
long fadeInDurationMs = DEFAULT_FADE_IN_DURATION_MS /* 1000 */;
long fadeOutDurationMs = DEFAULT_FADE_OUT_DURATION_MS /* 2000 */;
long fadeInDelayedForOffendersMs = DEFAULT_DELAY_FADE_IN_OFFENDERS_MS /* 2000 */;
android.media.audio.common.AudioUsage[] fadeableUsages;
@nullable android.media.audio.common.AudioContentType[] unfadeableContentTypes;
List<android.media.audio.common.AudioAttributes> unfadableAudioAttributes;
List<android.hardware.automotive.audiocontrol.FadeConfiguration> fadeOutConfigurations;
List<android.hardware.automotive.audiocontrol.FadeConfiguration> fadeInConfigurations;
const long DEFAULT_FADE_IN_DURATION_MS = 1000;
const long DEFAULT_FADE_OUT_DURATION_MS = 2000;
const long DEFAULT_DELAY_FADE_IN_OFFENDERS_MS = 2000;
}

View File

@@ -39,7 +39,7 @@ enum AudioFocusChange {
GAIN_TRANSIENT = 2,
GAIN_TRANSIENT_MAY_DUCK = 3,
GAIN_TRANSIENT_EXCLUSIVE = 4,
LOSS = -1,
LOSS_TRANSIENT = -2,
LOSS_TRANSIENT_CAN_DUCK = -3,
LOSS = ((-1) * GAIN) /* -1 */,
LOSS_TRANSIENT = ((-1) * GAIN_TRANSIENT) /* -2 */,
LOSS_TRANSIENT_CAN_DUCK = ((-1) * GAIN_TRANSIENT_MAY_DUCK) /* -3 */,
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2024 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 AudioZone {
String name;
int id;
int occupantZoneId = UNASSIGNED_OCCUPANT /* -1 */;
android.hardware.automotive.audiocontrol.AudioZoneContext audioZoneContext;
List<android.hardware.automotive.audiocontrol.AudioZoneConfig> audioZoneConfigs;
List<android.media.audio.common.AudioPort> inputAudioDevices;
const int PRIMARY_AUDIO_ZONE = 0;
const int UNASSIGNED_OCCUPANT = (-1) /* -1 */;
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2024 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 AudioZoneConfig {
String name;
boolean isDefault;
List<android.hardware.automotive.audiocontrol.VolumeGroupConfig> volumeGroups;
@nullable android.hardware.automotive.audiocontrol.AudioZoneFadeConfiguration fadeConfiguration;
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2024 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 AudioZoneContext {
List<android.hardware.automotive.audiocontrol.AudioZoneContextInfo> audioContextInfos;
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2024 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 AudioZoneContextInfo {
String name;
int id = UNASSIGNED_CONTEXT_ID /* -1 */;
List<android.media.audio.common.AudioAttributes> audioAttributes;
const int UNASSIGNED_CONTEXT_ID = (-1) /* -1 */;
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 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 AudioZoneFadeConfiguration {
android.hardware.automotive.audiocontrol.AudioFadeConfiguration defaultConfiguration;
List<android.hardware.automotive.audiocontrol.TransientFadeConfigurationEntry> transientConfiguration;
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 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 DeviceToContextEntry {
List<String> contextNames;
android.media.audio.common.AudioPort device;
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2024 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 FadeConfiguration {
long fadeDurationMillis;
android.hardware.automotive.audiocontrol.FadeConfiguration.AudioAttributesOrUsage audioAttributesOrUsage;
@JavaDerive(equals=true, toString=true) @VintfStability
union AudioAttributesOrUsage {
android.media.audio.common.AudioAttributes fadeAttribute;
android.media.audio.common.AudioUsage usage;
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 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") @JavaDerive(toString=true) @VintfStability
enum FadeState {
FADE_STATE_DISABLED,
FADE_STATE_ENABLED_DEFAULT,
}

View File

@@ -12,6 +12,34 @@
* 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.
*//**
* 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.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
@@ -48,4 +76,7 @@ interface IAudioControl {
oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback);
void setModuleChangeCallback(in android.hardware.automotive.audiocontrol.IModuleChangeCallback callback);
void clearModuleChangeCallback();
android.hardware.automotive.audiocontrol.AudioDeviceConfiguration getAudioDeviceConfiguration();
List<android.media.audio.common.AudioPort> getOutputMirroringDevices();
List<android.hardware.automotive.audiocontrol.AudioZone> getCarAudioZones();
}

View File

@@ -34,14 +34,14 @@
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,
FORCED_MASTER_MUTE = 0x1,
REMOTE_MUTE = 0x2,
TCU_MUTE = 0x4,
ADAS_DUCKING = 0x8,
NAV_DUCKING = 0x10,
PROJECTION_DUCKING = 0x20,
THERMAL_LIMITATION = 0x40,
SUSPEND_EXIT_VOL_LIMITATION = 0x80,
EXTERNAL_AMP_VOL_FEEDBACK = 0x100,
OTHER = 0x80000000,
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2024 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
enum RoutingDeviceConfiguration {
DEFAULT_AUDIO_ROUTING,
DYNAMIC_AUDIO_ROUTING,
CONFIGURABLE_AUDIO_ENGINE_ROUTING,
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 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 TransientFadeConfigurationEntry {
android.media.audio.common.AudioUsage[] transientUsages;
android.hardware.automotive.audiocontrol.AudioFadeConfiguration transientFadeConfiguration;
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 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 VolumeActivationConfiguration {
@nullable String name;
List<android.hardware.automotive.audiocontrol.VolumeActivationConfigurationEntry> volumeActivationEntries;
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2024 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 VolumeActivationConfigurationEntry {
android.hardware.automotive.audiocontrol.VolumeInvocationType type = android.hardware.automotive.audiocontrol.VolumeInvocationType.ON_PLAYBACK_CHANGED;
int maxActivationVolumePercentage = DEFAULT_MAX_ACTIVATION_VALUE /* 100 */;
int minActivationVolumePercentage = DEFAULT_MIN_ACTIVATION_VALUE /* 0 */;
const int DEFAULT_MAX_ACTIVATION_VALUE = 100;
const int DEFAULT_MIN_ACTIVATION_VALUE = 0;
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2024 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 VolumeGroupConfig {
String name;
int id = UNASSIGNED_ID /* -1 */;
List<android.hardware.automotive.audiocontrol.DeviceToContextEntry> carAudioRoutes;
@nullable android.hardware.automotive.audiocontrol.VolumeActivationConfiguration activationConfiguration;
const int UNASSIGNED_ID = (-1) /* -1 */;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2024 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") @JavaDerive(toString=true) @VintfStability
enum VolumeInvocationType {
ON_PLAYBACK_CHANGED,
ON_SOURCE_CHANGED,
ON_BOOT,
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2024 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.RoutingDeviceConfiguration;
/**
* Use to configure audio configurations at boot up time.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioDeviceConfiguration {
/**
* Use to configure audio device routing mechanism
*/
RoutingDeviceConfiguration routingConfig;
/**
* Use to configure core audio volume usage in car audio service
*/
boolean useCoreAudioVolume;
/**
* Use to determine if HAL ducking signal should be sent to audio control HAL from car audio
* service
*/
boolean useHalDuckingSignals;
/**
* Use to determine if HAL volume signal should be sent to audio control HAL from car audio
* service
*/
boolean useCarVolumeGroupMuting;
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright (C) 2024 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.FadeConfiguration;
import android.hardware.automotive.audiocontrol.FadeState;
import android.media.audio.common.AudioAttributes;
import android.media.audio.common.AudioContentType;
import android.media.audio.common.AudioUsage;
/**
* Encapsulates the audio fade configuration info
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioFadeConfiguration {
/**
* Default fade in duration
*/
const long DEFAULT_FADE_IN_DURATION_MS = 1000;
/**
* Default fade out duration
*/
const long DEFAULT_FADE_OUT_DURATION_MS = 2000;
/**
* Default delay for fade in offenders
*/
const long DEFAULT_DELAY_FADE_IN_OFFENDERS_MS = 2000;
/**
* Audio configuration name, use for debugging purposes
*/
String name;
/**
* Audio configuration state
*/
FadeState fadeState;
/**
* Fade in duration in milliseconds
*
* <p>Use to construct the default fade in configuration. This can be overwritten for different
* attributes/usages by passing a list of fade-in configuration,
* see {@code #fadeInConfigurations}
*/
long fadeInDurationMs = DEFAULT_FADE_IN_DURATION_MS;
/**
* Fade out duration in milliseconds
*
* <p>Use to construct the default fade out configuration. This can be overwritten for different
* attributes/usages by passing a list of fade-out configuration,
* see {@code #fadeOutConfigurations}
*/
long fadeOutDurationMs = DEFAULT_FADE_OUT_DURATION_MS;
/**
* Fade in delayed duration for audio focus offender in milliseconds
*/
long fadeInDelayedForOffendersMs = DEFAULT_DELAY_FADE_IN_OFFENDERS_MS;
/**
* List of audio attribute usage that should be faded using the parameters in
* this configuration.
*
*<p>If the list is empty car audio service will overwrite the list for the confgiruation with
* default usages, e.g. {AudioUsage#MEDIA, AudioUsage#GAME}
*/
AudioUsage[] fadeableUsages;
/**
* Optional list of audio attribute content types that should not be faded.
*
**<p>The list can be empty in cases where there are no unfadeable content types.
*
*<p>If the list is not set car audio service will overwrite the list for the confgiruation
* with default content type, e.g. {AudioContentType#SPEECH}.
*/
@nullable AudioContentType[] unfadeableContentTypes;
/**
* List of audio attribute that should not be faded.
*
*<p>The list can be empty in cases where there are no unfadeable attributes
*/
List<AudioAttributes> unfadableAudioAttributes;
/**
* List of fade out configutions which should apply to this audio fade configurations
*
*<p>The list can be empty in cases where there are no fade out configurations.
*/
List<FadeConfiguration> fadeOutConfigurations;
/**
* List of fade in configutions which should apply to this audio fade configurations
*
*<p>The list can be empty in cases where there are no fade out configurations
*/
List<FadeConfiguration> fadeInConfigurations;
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2024 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.AudioZoneConfig;
import android.hardware.automotive.audiocontrol.AudioZoneContext;
import android.media.audio.common.AudioPort;
/**
* Encapsulates the audio configurations for each audio zone
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioZone {
/**
* Value indicating the primary audio zone
*/
const int PRIMARY_AUDIO_ZONE = 0;
/**
* Value indicating the occupant zone is not assigned.
*/
const int UNASSIGNED_OCCUPANT = -1;
/**
* Audio zone name, only use for debug purposes.
*
* <p>If present it must be non-empty otherwise car audio service will construct a name
* based on audio zone id.
*/
String name;
/**
* Audio zone id use to distiguish between the different audio zones for
* volume management, fade, and min/max activation management.
*/
int id;
/**
* Occupant zone id that should be mapped to this audio zone.
*
* <p>For audio zones not mapped to an occupant zone use UNASSIGNED_OCCUPANT
*/
int occupantZoneId = UNASSIGNED_OCCUPANT;
/**
* Car audio context which can be used in the audio zone
*/
AudioZoneContext audioZoneContext;
/**
* List of car audio configurations
*/
List<AudioZoneConfig> audioZoneConfigs;
/**
* List of input audio devices used for this zone
*/
List<AudioPort> inputAudioDevices;
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2024 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.AudioZoneFadeConfiguration;
import android.hardware.automotive.audiocontrol.VolumeGroupConfig;
/**
* Encapsulates the audio zone config information
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioZoneConfig {
/**
* Audio zone config name
*
* <p>Must be non-empty and unique among the configurations within a zone.
*/
String name;
/**
* Determines if the audio configuration is the default configuration.
*
* <p>There can only be a single default configuration per zone.
*/
boolean isDefault;
/**
* List car volume group that should be managed within this configuration
*/
List<VolumeGroupConfig> volumeGroups;
/**
* Car audio zone fade configuration
*/
@nullable AudioZoneFadeConfiguration fadeConfiguration;
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2024 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.AudioZoneContextInfo;
/**
* Encapsulates the list of car audio context info definitions
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioZoneContext {
/**
* List of car audio context info.
*
* <p>The list must include all audio attributes usages currently supported so that all audio
* attribute usages can be routed for each car audio configuration.
*/
List<AudioZoneContextInfo> audioContextInfos;
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2024 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.media.audio.common.AudioAttributes;
/**
* Encapsulates groups of audio attributes which should be managed together.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioZoneContextInfo {
/**
* Value indicating the context info id is not assigned.
*/
const int UNASSIGNED_CONTEXT_ID = -1;
/**
* Context name which can be used to map the info to an audio route
* management as described in each audio configuration.
*
* <P>Name must be non-empty and unique among all audio context info within the same
* {@link android.hardware.automotive.audiocontrol.AudioZoneContext} container.
*/
String name;
/**
* Used in car audio service to manage the info
*
* <P>Must be non-negative integer if assigned, or UNASSIGNED_CONTEXT_ID otherwise. If using
* configurable audio policy engine audio routing with multi-zone configurations the value must
* be assigned.
*/
int id = UNASSIGNED_CONTEXT_ID;
/**
* List of audio attributes that belong to the context
*/
List<AudioAttributes> audioAttributes;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2024 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.AudioFadeConfiguration;
import android.hardware.automotive.audiocontrol.TransientFadeConfigurationEntry;
/**
* Encapsulates the audio zone fade configuration
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioZoneFadeConfiguration {
/**
* Defines the default fade configuration
*/
AudioFadeConfiguration defaultConfiguration;
/**
* List of transient fade configurations.
*
* <p>The list can be empty if the fade configuration for the zone does not have transient fade
* configurations.
*/
List<TransientFadeConfigurationEntry> transientConfiguration;
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2024 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.media.audio.common.AudioPort;
/**
* Encapsulates the audio context that should be route to particular device
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable DeviceToContextEntry {
/**
* List of audio context names that should be routed to the audio device.
*
* <p>The names must match a {@link AudioZoneContextInfo#name} in the corresponding
* {@link AudioZone#audioZoneContext).
*
* <p>Within a {@link AudioZoneConfig} a context name must not repeat among the different
* {@link VolumeGroupConfig}. The value can repeat among different {@link AudioZoneConfig}
* within a {@link AudioZone}.
*/
List<String> contextNames;
/**
* Audio port where contexts should be routed.
*
* <p>For dynamic devices (OUT_HEADSET, OUT_HEADPHONE, etc.) , the audio device address can be
* omitted since the information will be obtained at run time when the device is
* connected/enabled.
*/
AudioPort device;
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2024 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.media.audio.common.AudioAttributes;
import android.media.audio.common.AudioUsage;
/**
* Encapsulates the in/out fade configuration
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable FadeConfiguration {
/**
* Fade duration in milliseconds
*/
long fadeDurationMillis;
@JavaDerive(equals=true, toString=true)
@VintfStability
union AudioAttributesOrUsage {
AudioAttributes fadeAttribute;
AudioUsage usage;
}
/**
* Audio attribute or usage that should be impacted by the fade out duration
* {@code #fadeDurationMillis}
*/
AudioAttributesOrUsage audioAttributesOrUsage;
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2024 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;
/**
* Encapsulates the audio fade configuration state
*/
@VintfStability
@Backing(type="int")
@JavaDerive(toString=true)
enum FadeState {
/**
* Fade configuration should be disabled
*/
FADE_STATE_DISABLED,
/**
* Fade configuration should be enabled by default
*/
FADE_STATE_ENABLED_DEFAULT,
}

View File

@@ -46,14 +46,17 @@ package android.hardware.automotive.audiocontrol;
* audio_policy_engine_configuration.xml file.
*/
import android.hardware.audio.common.PlaybackTrackMetadata;
import android.hardware.automotive.audiocontrol.AudioDeviceConfiguration;
import android.hardware.automotive.audiocontrol.AudioFocusChange;
import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
import android.hardware.automotive.audiocontrol.AudioZone;
import android.hardware.automotive.audiocontrol.DuckingInfo;
import android.hardware.automotive.audiocontrol.IAudioGainCallback;
import android.hardware.automotive.audiocontrol.IFocusListener;
import android.hardware.automotive.audiocontrol.IModuleChangeCallback;
import android.hardware.automotive.audiocontrol.MutingInfo;
import android.hardware.automotive.audiocontrol.Reasons;
import android.media.audio.common.AudioPort;
/**
* Interacts with the car's audio subsystem to manage audio sources and volumes
@@ -206,4 +209,41 @@ interface IAudioControl {
* @throws EX_UNSUPPORTED_OPERATION if dynamic audio configs are not supported.
*/
void clearModuleChangeCallback();
/**
* Returns the audio device configurations that should be used to configure
* the car audio service audio management.
*
* <p>If this method is not supported, car audio service will attempt to configure the car audio
* service properties based on previously supported mechanisms.
*
* <p>If the returned value contains the
* {@link RoutingDeviceConfiguration#DEFAULT_AUDIO_ROUTING} value, the car audio service will
* attempt to configure audio routing based on the mechanism previously supported by car audio
* service (e.g. car audio configuration file). Otherwise, the {@link #getCarAudioZones()}
* API must return valid audio zone(s) configuration(s) for the device.
*
*/
AudioDeviceConfiguration getAudioDeviceConfiguration();
/**
* Returns the list of audio devices that can be used for mirroring between different audio
* zones.
*
* @throws EX_UNSUPPORTED_OPERATION if mirroring devices are not supported.
*/
List<AudioPort> getOutputMirroringDevices();
/**
* List of audio zones used to configure car audio service at bootup.
*
* <p>If the returned value from {@link #getAudioDeviceConfiguration()} contains
* {@link RoutingDeviceConfiguration#DEFAULT_AUDIO_ROUTING} value, the car audio service will
* attempt to configure the audio routing based on the mechanism previously supported by
* car audio service (e.g. car audio configuration file). Otherwise, this method must return
* valid audio zone(s) configuration(s) for the device.
*
* @throws EX_UNSUPPORTED_OPERATION if audio zone configuration are not supported.
*/
List<AudioZone> getCarAudioZones();
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2024 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;
/**
* Use to configure audio device routing mechanism
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
enum RoutingDeviceConfiguration {
/**
* Use to indicate that audio should be managed based on previously supportec mechamisms in
* car audio service.
*
* <p>If this used then the API to setup the audio zones can just throw
* {@code EX_UNSUPPORTED_OPERATION} if called.
*/
DEFAULT_AUDIO_ROUTING,
/**
* Use to indicate that audio should be managed using the dynamic audio
* policy as setup by car audio service using the setup configuration from
* the {@Link android.hardware.automotive.audiocontrol.AudioZone}'s info from audio control HAL.
*
* <p>If this used then the APIs to setup the audio zones must return a valid audio zone
* configuration for the device.
*/
DYNAMIC_AUDIO_ROUTING,
/**
* Use to indicate that audio should be managed using the core audio
* routing as setup by car audio service using the setup configuration from
* the {@Link android.hardware.automotive.audiocontrol.AudioZone}'s info from audio control HAL
* and the information contained within the configurable audio policy engine.
*
* <p>If this used then the APIs to setup the audio zone(s) must return valid audio zone
* configuration(s) for the device.
*/
CONFIGURABLE_AUDIO_ENGINE_ROUTING,
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2024 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.AudioFadeConfiguration;
import android.media.audio.common.AudioUsage;
/**
* Encapsulates the transient audio fade configuration entry.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable TransientFadeConfigurationEntry {
/**
* List of audio usages gainers that should be used for this configuration entry.
*/
AudioUsage[] transientUsages;
/**
* Defines the transient fade configuration that should be used for the focus interaction with
* the usages defined in {@link #transientUsages}
*/
AudioFadeConfiguration transientFadeConfiguration;
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2024 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.VolumeActivationConfigurationEntry;
/**
* Use to configure audio activiations, only used at boot up time.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable VolumeActivationConfiguration {
/**
* Configuration name used for debugging purposes to identify config used.
*
* <p>Is present, it must be non-empty and unique for all volume acvitations, otherwise
* car audio service will construct one based on audio zone, configuration and volume group
* info.
*/
@nullable String name;
/**
* List of activation configurations.
*
* <P>Car audio service currently only uses the first activation config on the list.
*/
List<VolumeActivationConfigurationEntry> volumeActivationEntries;
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) 2024 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.VolumeInvocationType;
/**
* Audio activiation volume configuration entry.
*
* <p> The entry can defined both the minimum and maximum activation values or only one. The latter
* allows activations to occur only on the minimum value or maximum value as configured.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable VolumeActivationConfigurationEntry {
/**
* Default maximum activation value.
*/
const int DEFAULT_MAX_ACTIVATION_VALUE = 100;
/**
* Default minimum activation value.
*/
const int DEFAULT_MIN_ACTIVATION_VALUE = 0;
/**
* Activation type, should be one of:
* ON_PLAYBACK_CHANGED, ON_SOURCE_CHANGED, ON_BOOT
*/
VolumeInvocationType type = VolumeInvocationType.ON_PLAYBACK_CHANGED;
/**
* Max activation percentage between {@code DEFAULT_MIN_ACTIVATION_VALUE} to
* {@code DEFAULT_MAX_ACTIVATION_VALUE} percen.
*
* <p>The value should be {@code DEFAULT_MAX_ACTIVATION_VALUE} if max activation should not
* apply.
*/
int maxActivationVolumePercentage = DEFAULT_MAX_ACTIVATION_VALUE;
/**
* Min activation percentage between {@code DEFAULT_MIN_ACTIVATION_VALUE} to
* {@code DEFAULT_MAX_ACTIVATION_VALUE} percent.
*
* <p>The value should be {@code DEFAULT_MIN_ACTIVATION_VALUE} if min activation should not
* apply.
*/
int minActivationVolumePercentage = DEFAULT_MIN_ACTIVATION_VALUE;
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) 2024 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.DeviceToContextEntry;
import android.hardware.automotive.audiocontrol.VolumeActivationConfiguration;
/**
* Encapsulates the audio volume grouping for audio zone config.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable VolumeGroupConfig {
/**
* Value indicating the volume group is not assigned an ID.
*/
const int UNASSIGNED_ID = -1;
/**
* Audio zone group name.
*
* <p>Must be non-empty if using configurable audio policy engine volume management, see
* {@code AudioDeviceConfiguration#useCoreAudioVolume} for details.
*/
String name;
/**
* Audio zone group id.
*
* <p>Must be set if using configurable audio policy engine volume management, can be
* {@code #UNASSIGNED_ID} otherwise. See {@code AudioDeviceConfiguration#useCoreAudioVolume}
* for details.
*/
int id = UNASSIGNED_ID;
/**
* Entries of audio device to audio context that are managed similarly for this volume group.
*/
List<DeviceToContextEntry> carAudioRoutes;
/**
* Optional volume activation configuration that should be used for this volume group.
*/
@nullable VolumeActivationConfiguration activationConfiguration;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2024 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;
/**
* Audio activiation type which can be used to activate the min/max
* volume changes.
*/
@VintfStability
@Backing(type="int")
@JavaDerive(toString=true)
enum VolumeInvocationType {
/**
* Invocation of volume group activation performed at every playback change.
*/
ON_PLAYBACK_CHANGED,
/**
* Invocation of volume group activation performed only once at playback after first playback
* for a client (app/service UID).
*/
ON_SOURCE_CHANGED,
/**
* Invocation of volume group activation in perform only at playback once after boot up.
*/
ON_BOOT,
}

View File

@@ -31,13 +31,19 @@ cc_binary {
"latest_android_hardware_audio_common_ndk_shared",
"latest_android_hardware_automotive_audiocontrol_ndk_shared",
"powerpolicyclient_defaults",
"car.audio.configuration.xsd.default",
"car.fade.configuration.xsd.default",
],
shared_libs: [
"android.hardware.audio.common@7.0-enums",
"libbase",
"libbinder_ndk",
"libcutils",
"liblog",
"libbase",
"libxml2",
"libutils",
"android.hardware.audiocontrol.internal",
"libaudio_aidl_conversion_common_ndk",
],
srcs: [
"AudioControl.cpp",

View File

@@ -19,6 +19,7 @@
#include "AudioControl.h"
#include <aidl/android/hardware/automotive/audiocontrol/AudioDeviceConfiguration.h>
#include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
#include <aidl/android/hardware/automotive/audiocontrol/DuckingInfo.h>
#include <aidl/android/hardware/automotive/audiocontrol/IFocusListener.h>
@@ -27,8 +28,8 @@
#include <android-base/parsebool.h>
#include <android-base/parseint.h>
#include <android-base/strings.h>
#include <android_audio_policy_configuration_V7_0-enums.h>
#include <private/android_filesystem_config.h>
#include <numeric>
@@ -41,16 +42,18 @@ using ::android::base::EqualsIgnoreCase;
using ::android::base::ParseBool;
using ::android::base::ParseBoolResult;
using ::android::base::ParseInt;
using ::android::hardware::audiocontrol::internal::CarAudioConfigurationXmlConverter;
using ::std::shared_ptr;
using ::std::string;
namespace xsd {
using namespace ::android::audio::policy::configuration::V7_0;
namespace converter {
using namespace ::android::hardware::audiocontrol::internal;
}
namespace api = aidl::android::hardware::automotive::audiocontrol;
namespace xsd = ::android::audio::policy::configuration::V7_0;
namespace {
const float kLowerBound = -1.0f;
const float kUpperBound = 1.0f;
bool checkCallerHasWritePermissions(int fd) {
// Double check that's only called by root - it should be be blocked at debug() level,
// but it doesn't hurt to make sure...
@@ -62,7 +65,7 @@ bool checkCallerHasWritePermissions(int fd) {
}
bool isValidValue(float value) {
return (value >= kLowerBound) && (value <= kUpperBound);
return (value >= -1.0f) && (value <= 1.0f);
}
bool safelyParseInt(string s, int* out) {
@@ -71,6 +74,53 @@ bool safelyParseInt(string s, int* out) {
}
return true;
}
std::string formatDump(const std::string& input) {
const char kSpacer = ' ';
std::string output;
int indentLevel = 0;
bool newLine = false;
for (char c : input) {
switch (c) {
case '{':
if (!newLine) {
output += '\n';
}
newLine = true;
indentLevel++;
for (int i = 0; i < indentLevel; ++i) {
output += kSpacer;
}
break;
case '}':
if (!newLine) {
output += '\n';
}
newLine = true;
indentLevel--;
for (int i = 0; i < indentLevel; ++i) {
output += kSpacer;
}
break;
case ',':
if (!newLine) {
output += '\n';
}
newLine = true;
for (int i = 0; i < indentLevel; ++i) {
output += kSpacer;
}
break;
default:
newLine = false;
output += c;
}
}
return output;
}
} // namespace
namespace {
@@ -90,6 +140,9 @@ using ::aidl::android::media::audio::common::AudioPortMixExt;
using ::aidl::android::media::audio::common::AudioProfile;
using ::aidl::android::media::audio::common::PcmType;
const static std::string kAudioConfigFile = "/vendor/etc/car_audio_configuration.xml";
const static std::string kFadeConfigFile = "/vendor/etc/car_audio_fade_configuration.xml";
// reuse common code artifacts
void fillProfile(const std::vector<int32_t>& channelLayouts,
const std::vector<int32_t>& sampleRates, AudioProfile* profile) {
@@ -162,6 +215,12 @@ AudioGain createGain(int32_t mode, AudioChannelLayout channelMask, int32_t minVa
}
} // namespace
AudioControl::AudioControl() : AudioControl(kAudioConfigFile, kFadeConfigFile) {}
AudioControl::AudioControl(const std::string& carAudioConfig, const std::string& audioFadeConfig)
: mCarAudioConfigurationConverter(std::make_shared<CarAudioConfigurationXmlConverter>(
carAudioConfig, audioFadeConfig)) {}
ndk::ScopedAStatus AudioControl::registerFocusListener(
const shared_ptr<IFocusListener>& in_listener) {
LOG(DEBUG) << "registering focus listener";
@@ -245,14 +304,23 @@ template <typename aidl_type>
static inline std::string toString(const std::vector<aidl_type>& in_values) {
return std::accumulate(std::begin(in_values), std::end(in_values), std::string{},
[](const std::string& ls, const aidl_type& rs) {
return ls + (ls.empty() ? "" : ",") + rs.toString();
return ls + (ls.empty() ? "" : ", ") + rs.toString();
});
}
template <typename aidl_enum_type>
static inline std::string toEnumString(const std::vector<aidl_enum_type>& in_values) {
return std::accumulate(std::begin(in_values), std::end(in_values), std::string{},
[](const std::string& ls, const aidl_enum_type& rs) {
return ls + (ls.empty() ? "" : ",") + toString(rs);
return ls + (ls.empty() ? "" : ", ") + toString(rs);
});
}
template <typename aidl_type>
static inline std::string toString(const std::vector<std::optional<aidl_type>>& in_values) {
return std::accumulate(std::begin(in_values), std::end(in_values), std::string{},
[](const std::string& ls, const std::optional<aidl_type>& rs) {
return ls + (ls.empty() ? "" : ", ") +
(rs.has_value() ? rs.value().toString() : "empty");
});
}
@@ -309,6 +377,50 @@ ndk::ScopedAStatus AudioControl::clearModuleChangeCallback() {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus AudioControl::getAudioDeviceConfiguration(
AudioDeviceConfiguration* audioDeviceConfig) {
if (!audioDeviceConfig) {
LOG(ERROR) << __func__ << "Audio device configuration must not be null";
return ndk::ScopedAStatus::fromStatus(STATUS_UNEXPECTED_NULL);
}
if (!mCarAudioConfigurationConverter) {
return ndk::ScopedAStatus::ok();
}
const auto& innerDeviceConfig = mCarAudioConfigurationConverter->getAudioDeviceConfiguration();
audioDeviceConfig->routingConfig = innerDeviceConfig.routingConfig;
audioDeviceConfig->useCoreAudioVolume = innerDeviceConfig.useCoreAudioVolume;
audioDeviceConfig->useCarVolumeGroupMuting = innerDeviceConfig.useCarVolumeGroupMuting;
audioDeviceConfig->useHalDuckingSignals = innerDeviceConfig.useHalDuckingSignals;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus AudioControl::getOutputMirroringDevices(
std::vector<AudioPort>* mirroringDevices) {
if (!mirroringDevices) {
LOG(ERROR) << __func__ << "Mirroring devices must not be null";
return ndk::ScopedAStatus::fromStatus(STATUS_UNEXPECTED_NULL);
}
if (!mCarAudioConfigurationConverter || !mCarAudioConfigurationConverter->getErrors().empty()) {
return ndk::ScopedAStatus::ok();
}
const auto& innerDevice = mCarAudioConfigurationConverter->getOutputMirroringDevices();
mirroringDevices->insert(mirroringDevices->end(), innerDevice.begin(), innerDevice.end());
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus AudioControl::getCarAudioZones(std::vector<AudioZone>* audioZones) {
if (!audioZones) {
LOG(ERROR) << __func__ << "Audio zones must not be null";
return ndk::ScopedAStatus::fromStatus(STATUS_UNEXPECTED_NULL);
}
if (!mCarAudioConfigurationConverter || !mCarAudioConfigurationConverter->getErrors().empty()) {
return ndk::ScopedAStatus::ok();
}
const auto& innerZones = mCarAudioConfigurationConverter->getAudioZones();
audioZones->insert(audioZones->end(), innerZones.begin(), innerZones.end());
return ndk::ScopedAStatus::ok();
}
binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) {
if (numArgs == 0) {
return dumpsys(fd);
@@ -342,6 +454,25 @@ binder_status_t AudioControl::dumpsys(int fd) {
dprintf(fd, "Focus listener registered\n");
}
dprintf(fd, "AudioGainCallback %sregistered\n", (mAudioGainCallback == nullptr ? "NOT " : ""));
AudioDeviceConfiguration configuration;
if (getAudioDeviceConfiguration(&configuration).isOk()) {
dprintf(fd, "AudioDeviceConfiguration: %s\n", configuration.toString().c_str());
}
std::vector<AudioZone> audioZones;
if (getCarAudioZones(&audioZones).isOk()) {
dprintf(fd, "Audio zones count: %zu\n", audioZones.size());
for (const auto& zone : audioZones) {
dprintf(fd, "AudioZone: %s\n", formatDump(zone.toString()).c_str());
}
}
std::vector<AudioPort> mirroringDevices;
if (getOutputMirroringDevices(&mirroringDevices).isOk()) {
dprintf(fd, "Mirroring devices count: %zu\n", mirroringDevices.size());
for (const auto& device : mirroringDevices) {
dprintf(fd, "Mirroring device: %s\n", formatDump(device.toString()).c_str());
}
}
return STATUS_OK;
}

View File

@@ -35,13 +35,17 @@
#include <aidl/android/media/audio/common/AudioIoFlags.h>
#include <aidl/android/media/audio/common/AudioOutputFlags.h>
#include "converter/include/CarAudioConfigurationXmlConverter.h"
namespace aidl::android::hardware::automotive::audiocontrol {
namespace audiohalcommon = ::aidl::android::hardware::audio::common;
namespace audiomediacommon = ::aidl::android::media::audio::common;
namespace audiohalcommon = ::aidl::android::hardware::audio::common;
class AudioControl : public BnAudioControl {
public:
AudioControl();
AudioControl(const std::string& carAudioConfig, const std::string& audioFadeConfig);
ndk::ScopedAStatus onAudioFocusChange(const std::string& in_usage, int32_t in_zoneId,
AudioFocusChange in_focusChange) override;
ndk::ScopedAStatus onDevicesToDuckChange(
@@ -63,6 +67,11 @@ class AudioControl : public BnAudioControl {
ndk::ScopedAStatus setModuleChangeCallback(
const std::shared_ptr<IModuleChangeCallback>& in_callback) override;
ndk::ScopedAStatus clearModuleChangeCallback() override;
ndk::ScopedAStatus getAudioDeviceConfiguration(
AudioDeviceConfiguration* audioDeviceConfig) override;
ndk::ScopedAStatus getOutputMirroringDevices(
std::vector<::aidl::android::media::audio::common::AudioPort>* mirrorDevices) override;
ndk::ScopedAStatus getCarAudioZones(std::vector<AudioZone>* audioZones) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
@@ -81,6 +90,9 @@ class AudioControl : public BnAudioControl {
std::shared_ptr<IModuleChangeCallback> mModuleChangeCallback = nullptr;
std::shared_ptr<::android::hardware::audiocontrol::internal::CarAudioConfigurationXmlConverter>
mCarAudioConfigurationConverter = nullptr;
binder_status_t cmdHelp(int fd) const;
binder_status_t cmdRequestFocus(int fd, const char** args, uint32_t numArgs);
binder_status_t cmdAbandonFocus(int fd, const char** args, uint32_t numArgs);

View File

@@ -1,7 +1,7 @@
<manifest version="2.0" type="device">
<hal format="aidl">
<name>android.hardware.automotive.audiocontrol</name>
<version>4</version>
<version>5</version>
<fqname>IAudioControl/default</fqname>
</hal>
</manifest>

View File

@@ -0,0 +1,56 @@
// Copyright (C) 2024 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
cc_library {
name: "android.hardware.audiocontrol.internal",
vendor: true,
srcs: [
"src/CarAudioConfigurationXmlConverter.cpp",
"src/CarAudioConfigurationUtils.cpp",
],
export_include_dirs: [
"include",
],
defaults: [
"latest_android_hardware_audio_common_ndk_static",
"latest_android_hardware_automotive_audiocontrol_ndk_shared",
"car.audio.configuration.xsd.default",
"car.fade.configuration.xsd.default",
"aidlaudioservice_defaults",
"latest_android_media_audio_common_types_ndk_static",
],
shared_libs: [
"libbase",
"libutils",
"libmedia_helper",
"car.audio.configuration.xsd.default",
"car.fade.configuration.xsd.default",
"liblog",
],
static_libs: [
"libaudio_aidl_conversion_common_ndk_cpp",
],
header_libs: [
"libaudio_system_headers",
],
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2024 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.
*/
#ifndef ANDROID_HARDWARE_AUDIOCONTROL_INTERNAL_CONFIGURATION_UTILS_H
#define ANDROID_HARDWARE_AUDIOCONTROL_INTERNAL_CONFIGURATION_UTILS_H
#include <string>
#include <aidl/android/hardware/automotive/audiocontrol/AudioZoneContext.h>
#include <aidl/android/hardware/automotive/audiocontrol/AudioZoneContextInfo.h>
namespace android {
namespace hardware {
namespace audiocontrol {
namespace internal {
::aidl::android::hardware::automotive::audiocontrol::AudioZoneContext getDefaultCarAudioContext();
} // namespace internal
} // namespace audiocontrol
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIOCONTROL_INTERNAL_CONFIGURATION_UTILS_H

View File

@@ -0,0 +1,87 @@
/*
* Copyright (C) 2024 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.
*/
#ifndef MAIN8_CARAUDIOCONFIGURATIONXMLCONVERTER_H
#define MAIN8_CARAUDIOCONFIGURATIONXMLCONVERTER_H
#include <string>
#include "../include/CarAudioConfigurationUtils.h"
#include <aidl/android/hardware/automotive/audiocontrol/AudioDeviceConfiguration.h>
#include <aidl/android/hardware/automotive/audiocontrol/AudioZone.h>
#include <aidl/android/hardware/automotive/audiocontrol/AudioZoneContext.h>
namespace android::hardware::automotive::audiocontrol {
class CarAudioConfigurationType;
}
namespace android {
namespace hardware {
namespace audiocontrol {
namespace internal {
class CarAudioConfigurationXmlConverter {
public:
explicit CarAudioConfigurationXmlConverter(const std::string& audioConfigFile,
const std::string& fadeConfigFile)
: mAudioConfigFile(audioConfigFile), mFadeConfigFile(fadeConfigFile) {
init();
}
::aidl::android::hardware::automotive::audiocontrol::AudioDeviceConfiguration
getAudioDeviceConfiguration() const;
std::vector<::aidl::android::hardware::automotive::audiocontrol::AudioZone> getAudioZones()
const;
std::vector<::aidl::android::media::audio::common::AudioPort> getOutputMirroringDevices() const;
const std::string getErrors() const { return mParseErrors; }
private:
void init();
void initNonDynamicRouting();
void initFadeConfigurations();
void initAudioDeviceConfiguration(
const ::android::hardware::automotive::audiocontrol::CarAudioConfigurationType&
carAudioConfigurationType);
void initCarAudioConfigurations(
const ::android::hardware::automotive::audiocontrol::CarAudioConfigurationType&
carAudioConfigurationType);
void parseAudioDeviceConfigurations(
const ::android::hardware::automotive::audiocontrol::CarAudioConfigurationType&
carAudioConfigurationType);
const std::string mAudioConfigFile;
const std::string mFadeConfigFile;
::aidl::android::hardware::automotive::audiocontrol::AudioDeviceConfiguration
mAudioDeviceConfiguration;
std::optional<::aidl::android::hardware::automotive::audiocontrol::AudioZoneContext>
mAudioZoneContext;
std::vector<::aidl::android::hardware::automotive::audiocontrol::AudioZone> mAudioZones;
std::vector<::aidl::android::media::audio::common::AudioPort> mOutputMirroringDevices;
std::string mParseErrors;
std::unordered_map<std::string,
::aidl::android::hardware::automotive::audiocontrol::AudioFadeConfiguration>
mFadeConfigurations;
};
} // namespace internal
} // namespace audiocontrol
} // namespace hardware
} // namespace android
#endif // MAIN8_CARAUDIOCONFIGURATIONXMLCONVERTER_H

View File

@@ -0,0 +1,104 @@
/*
* Copyright (C) 2024 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.
*/
#include <android-base/logging.h>
#include "../include/CarAudioConfigurationUtils.h"
#include <aidl/android/media/audio/common/AudioAttributes.h>
#include <aidl/android/media/audio/common/AudioUsage.h>
#include <tuple>
#include <vector>
using ::aidl::android::hardware::automotive::audiocontrol::AudioZoneContext;
using ::aidl::android::hardware::automotive::audiocontrol::AudioZoneContextInfo;
using aidl::android::media::audio::common::AudioAttributes;
using aidl::android::media::audio::common::AudioUsage;
using aidl::android::media::audio::common::AudioUsage::ALARM;
using aidl::android::media::audio::common::AudioUsage::ANNOUNCEMENT;
using aidl::android::media::audio::common::AudioUsage::ASSISTANCE_ACCESSIBILITY;
using aidl::android::media::audio::common::AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE;
using aidl::android::media::audio::common::AudioUsage::ASSISTANCE_SONIFICATION;
using aidl::android::media::audio::common::AudioUsage::ASSISTANT;
using aidl::android::media::audio::common::AudioUsage::CALL_ASSISTANT;
using aidl::android::media::audio::common::AudioUsage::EMERGENCY;
using aidl::android::media::audio::common::AudioUsage::GAME;
using aidl::android::media::audio::common::AudioUsage::MEDIA;
using aidl::android::media::audio::common::AudioUsage::NOTIFICATION;
using aidl::android::media::audio::common::AudioUsage::NOTIFICATION_EVENT;
using aidl::android::media::audio::common::AudioUsage::NOTIFICATION_TELEPHONY_RINGTONE;
using aidl::android::media::audio::common::AudioUsage::SAFETY;
using aidl::android::media::audio::common::AudioUsage::UNKNOWN;
using aidl::android::media::audio::common::AudioUsage::VEHICLE_STATUS;
using aidl::android::media::audio::common::AudioUsage::VOICE_COMMUNICATION;
using aidl::android::media::audio::common::AudioUsage::VOICE_COMMUNICATION_SIGNALLING;
namespace android {
namespace hardware {
namespace audiocontrol {
namespace internal {
std::vector<AudioAttributes> createAudioAttributes(const std::vector<AudioUsage>& usages) {
std::vector<AudioAttributes> audioAttributes;
for (const auto& usage : usages) {
AudioAttributes attributes;
attributes.usage = usage;
audioAttributes.push_back(attributes);
}
return audioAttributes;
}
AudioZoneContextInfo createAudioZoneContextInfo(const std::string& name, int id,
const std::vector<AudioUsage>& usages) {
AudioZoneContextInfo info;
info.name = name;
info.id = id;
info.audioAttributes = createAudioAttributes(usages);
return info;
}
AudioZoneContext createAudioZoneContextInfo(const std::vector<AudioZoneContextInfo>& info) {
AudioZoneContext context;
context.audioContextInfos.insert(context.audioContextInfos.begin(), info.begin(), info.end());
return context;
}
AudioZoneContext getDefaultCarAudioContext() {
// For legacy reasons, context names are lower case here.
static const AudioZoneContext kDefaultContext = createAudioZoneContextInfo(
{createAudioZoneContextInfo("music", 1, {UNKNOWN, MEDIA, GAME}),
createAudioZoneContextInfo("navigation", 2, {ASSISTANCE_NAVIGATION_GUIDANCE}),
createAudioZoneContextInfo("voice_command", 3, {ASSISTANCE_ACCESSIBILITY, ASSISTANT}),
createAudioZoneContextInfo("call_ring", 4, {NOTIFICATION_TELEPHONY_RINGTONE}),
createAudioZoneContextInfo(
"call", 5,
{VOICE_COMMUNICATION, CALL_ASSISTANT, VOICE_COMMUNICATION_SIGNALLING}),
createAudioZoneContextInfo("alarm", 6, {ALARM}),
createAudioZoneContextInfo("notification", 7, {NOTIFICATION, NOTIFICATION_EVENT}),
createAudioZoneContextInfo("system_sound", 8, {ASSISTANCE_SONIFICATION}),
createAudioZoneContextInfo("emergency", 9, {EMERGENCY}),
createAudioZoneContextInfo("safety", 10, {SAFETY}),
createAudioZoneContextInfo("vehicle_status", 11, {VEHICLE_STATUS}),
createAudioZoneContextInfo("announcement", 12, {ANNOUNCEMENT})});
return kDefaultContext;
}
} // namespace internal
} // namespace audiocontrol
} // namespace hardware
} // namespace android

View File

@@ -0,0 +1,63 @@
// Copyright (C) 2024 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 {
default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
filegroup {
name: "simple_car_audio_configuration_xml",
srcs: [
"simple_car_audio_configuration.xml",
"simple_car_audio_configuration_with_device_type.xml",
"multi_zone_car_audio_configuration.xml",
"car_audio_configuration_without_configuration.xml",
"car_audio_configuration_with_default_context.xml",
"car_audio_configuration_with_missing_zones.xml",
"car_audio_configuration_without_audio_zone.xml",
"car_audio_fade_configuration.xml",
],
}
cc_test {
name: "AudioControlConverterUnitTest",
vendor: true,
require_root: true,
srcs: ["*.cpp"],
stl: "libc++_static",
static_libs: [
"libbase",
"android.hardware.audiocontrol.internal",
"libgtest",
"libgmock",
"libutils",
"libaudio_aidl_conversion_common_ndk",
],
shared_libs: ["liblog"],
defaults: [
"latest_android_hardware_audio_common_ndk_static",
"car.audio.configuration.xsd.default",
"car.fade.configuration.xsd.default",
"latest_android_hardware_automotive_audiocontrol_ndk_static",
"latest_android_media_audio_common_types_ndk_static",
],
data: [
":simple_car_audio_configuration_xml",
],
test_suites: ["device-tests"],
exclude_shared_libs: [
"android.hardware.automotive.audiocontrol-V5-ndk",
],
}

View File

@@ -0,0 +1,834 @@
/*
* Copyright (C) 2024 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.
*/
#include <android-base/file.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <memory>
#include <string>
#include <utility>
#include <CarAudioConfigurationXmlConverter.h>
#include <aidl/android/hardware/automotive/audiocontrol/AudioDeviceConfiguration.h>
namespace converter = ::android::hardware::audiocontrol::internal;
namespace api = ::aidl::android::hardware::automotive::audiocontrol;
using ::testing::ContainsRegex;
using ::testing::UnorderedElementsAreArray;
namespace {
using ::aidl::android::media::audio::common::AudioAttributes;
using ::aidl::android::media::audio::common::AudioContentType;
using ::aidl::android::media::audio::common::AudioDevice;
using ::aidl::android::media::audio::common::AudioDeviceAddress;
using ::aidl::android::media::audio::common::AudioDeviceDescription;
using ::aidl::android::media::audio::common::AudioDeviceType;
using ::aidl::android::media::audio::common::AudioPort;
using ::aidl::android::media::audio::common::AudioPortDeviceExt;
using ::aidl::android::media::audio::common::AudioPortExt;
using ::aidl::android::media::audio::common::AudioUsage;
std::string getTestFilePath(const std::string& filename) {
static std::string baseDir = android::base::GetExecutableDirectory();
return baseDir + "/" + filename;
}
AudioAttributes createAudioAttributes(const AudioUsage& usage,
const AudioContentType& type = AudioContentType::UNKNOWN,
const std::string tags = "") {
AudioAttributes attributes;
attributes.usage = usage;
attributes.contentType = type;
if (!tags.empty()) {
attributes.tags.push_back(tags);
}
return attributes;
}
api::AudioZoneContextInfo createContextInfo(const std::string& name,
const std::vector<AudioAttributes>& attributes,
const int id = -1) {
api::AudioZoneContextInfo info;
info.name = name;
if (id != -1) {
info.id = id;
}
for (const auto& attribute : attributes) {
info.audioAttributes.push_back(attribute);
}
return info;
}
api::AudioZoneContextInfo createContextInfo(const std::string& name,
const std::vector<AudioUsage>& usages,
const int id = -1) {
std::vector<AudioAttributes> attributes;
attributes.reserve(usages.size());
for (const auto& usage : usages) {
attributes.push_back(createAudioAttributes(usage));
}
return createContextInfo(name, attributes, id);
}
AudioPort createAudioPort(const std::string& address, const AudioDeviceType& type,
const std::string& connection = "") {
AudioPort port;
AudioDevice device;
device.address = AudioDeviceAddress::make<AudioDeviceAddress::Tag::id>(address);
AudioDeviceDescription description;
description.type = type;
description.connection = connection;
device.type = description;
port.ext = AudioPortExt::make<AudioPortExt::Tag::device>(device);
return port;
}
api::DeviceToContextEntry createRoutes(const AudioPort& port,
const std::vector<std::string>& contexts) {
api::DeviceToContextEntry entry;
entry.device = port;
entry.contextNames = contexts;
return entry;
}
api::VolumeGroupConfig createVolumeGroup(const std::string& name,
const api::VolumeActivationConfiguration& activation,
const std::vector<api::DeviceToContextEntry>& routes) {
api::VolumeGroupConfig config;
config.name = name;
config.activationConfiguration = activation;
config.carAudioRoutes = routes;
return config;
}
api::AudioZoneConfig createAudioZoneConfig(const std::string& name,
const api::AudioZoneFadeConfiguration& fadeConfiguration,
const std::vector<api::VolumeGroupConfig>& groups,
bool isDefault = false) {
api::AudioZoneConfig config;
config.name = name;
config.isDefault = isDefault;
config.volumeGroups = groups;
config.fadeConfiguration = fadeConfiguration;
return config;
}
api::VolumeActivationConfiguration createVolumeActivation(const std::string& name,
const api::VolumeInvocationType& type,
int minVolume, int maxVolume) {
api::VolumeActivationConfiguration activation;
activation.name = name;
api::VolumeActivationConfigurationEntry entry;
entry.maxActivationVolumePercentage = maxVolume;
entry.minActivationVolumePercentage = minVolume;
entry.type = type;
activation.volumeActivationEntries.push_back(entry);
return activation;
}
api::FadeConfiguration createFadeConfiguration(const long& fadeDurationsMillis,
const AudioAttributes& audioAttributes) {
api::FadeConfiguration configuration;
configuration.fadeDurationMillis = fadeDurationsMillis;
configuration.audioAttributesOrUsage
.set<api::FadeConfiguration::AudioAttributesOrUsage::Tag::fadeAttribute>(
audioAttributes);
return configuration;
}
api::FadeConfiguration createFadeConfiguration(const long& fadeDurationsMillis,
const AudioUsage& audioUsage) {
api::FadeConfiguration configuration;
configuration.fadeDurationMillis = fadeDurationsMillis;
configuration.audioAttributesOrUsage
.set<api::FadeConfiguration::AudioAttributesOrUsage::Tag::usage>(audioUsage);
return configuration;
}
api::AudioFadeConfiguration createAudioFadeConfiguration(
const std::string& name, const api::FadeState& state,
const std::vector<AudioUsage>& fadeableUsages = std::vector<AudioUsage>(),
const std::optional<std::vector<AudioContentType>>& unfadeableContentTypes = std::nullopt,
const std::vector<AudioAttributes> unfadeableAudioAttributes =
std::vector<AudioAttributes>(),
const std::vector<api::FadeConfiguration> fadeOutConfigurations =
std::vector<api::FadeConfiguration>(),
const std::vector<api::FadeConfiguration> fadeInConfigurations =
std::vector<api::FadeConfiguration>(),
const long& fadeOutDurationMs = api::AudioFadeConfiguration::DEFAULT_FADE_OUT_DURATION_MS,
const long& fadeInDurationMs = api::AudioFadeConfiguration::DEFAULT_FADE_IN_DURATION_MS,
const long& fadeInDelayedForOffendersMs =
api::AudioFadeConfiguration::DEFAULT_DELAY_FADE_IN_OFFENDERS_MS) {
api::AudioFadeConfiguration audioZoneFadeConfiguration;
audioZoneFadeConfiguration.name = name;
audioZoneFadeConfiguration.fadeInDurationMs = fadeInDurationMs;
audioZoneFadeConfiguration.fadeOutDurationMs = fadeOutDurationMs;
audioZoneFadeConfiguration.fadeInDelayedForOffendersMs = fadeInDelayedForOffendersMs;
audioZoneFadeConfiguration.fadeState = state;
audioZoneFadeConfiguration.fadeableUsages = fadeableUsages;
audioZoneFadeConfiguration.unfadeableContentTypes = unfadeableContentTypes;
audioZoneFadeConfiguration.unfadableAudioAttributes = unfadeableAudioAttributes;
audioZoneFadeConfiguration.fadeOutConfigurations = fadeOutConfigurations;
audioZoneFadeConfiguration.fadeInConfigurations = fadeInConfigurations;
return audioZoneFadeConfiguration;
}
api::TransientFadeConfigurationEntry createTransientFadeConfiguration(
const api::AudioFadeConfiguration& fadeConfig, const std::vector<AudioUsage>& usages) {
api::TransientFadeConfigurationEntry entry;
entry.transientFadeConfiguration = fadeConfig;
entry.transientUsages = usages;
return entry;
}
api::AudioZoneFadeConfiguration createAudioZoneFadeConfiguration(
const api::AudioFadeConfiguration& defaultConfig,
const std::vector<api::TransientFadeConfigurationEntry>& transientConfigs) {
api::AudioZoneFadeConfiguration zoneFadeConfiguration;
zoneFadeConfiguration.defaultConfiguration = defaultConfig;
zoneFadeConfiguration.transientConfiguration = transientConfigs;
return zoneFadeConfiguration;
}
api::AudioZone createAudioZone(const std::string& name, const int zoneId,
const std::vector<api::AudioZoneContextInfo>& contexts,
const std::vector<api::AudioZoneConfig>& configs) {
api::AudioZone zone;
zone.name = name;
zone.id = zoneId;
zone.occupantZoneId = zoneId;
zone.audioZoneContext.audioContextInfos = contexts;
zone.audioZoneConfigs = configs;
return zone;
}
const std::vector<AudioUsage> kFadeableUsages = {AudioUsage::MEDIA,
AudioUsage::GAME,
AudioUsage::ASSISTANCE_SONIFICATION,
AudioUsage::ASSISTANCE_ACCESSIBILITY,
AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE,
AudioUsage::ASSISTANT,
AudioUsage::NOTIFICATION,
AudioUsage::ANNOUNCEMENT};
const std::vector<AudioAttributes> kUnfadeableAudioAttributes = {
createAudioAttributes(AudioUsage::MEDIA, AudioContentType::UNKNOWN, "oem_specific_tag1")};
const std::vector<api::FadeConfiguration> kFadeOutConfigurations = {
createFadeConfiguration(
500, createAudioAttributes(AudioUsage::ASSISTANT, AudioContentType::UNKNOWN,
"oem_specific_tag2")),
createFadeConfiguration(500, AudioUsage::MEDIA),
createFadeConfiguration(500, AudioUsage::GAME),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_SONIFICATION),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_ACCESSIBILITY),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE),
createFadeConfiguration(800, AudioUsage::ASSISTANT),
createFadeConfiguration(800, AudioUsage::ANNOUNCEMENT),
};
const std::vector<api::FadeConfiguration> kFadeInConfigurations = {
createFadeConfiguration(
1000, createAudioAttributes(AudioUsage::ASSISTANT, AudioContentType::UNKNOWN,
"oem_specific_tag2")),
createFadeConfiguration(1000, AudioUsage::MEDIA),
createFadeConfiguration(1000, AudioUsage::GAME),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_SONIFICATION),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_ACCESSIBILITY),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE),
createFadeConfiguration(800, AudioUsage::ASSISTANT),
createFadeConfiguration(800, AudioUsage::ANNOUNCEMENT),
};
const api::AudioFadeConfiguration kRelaxedFading = createAudioFadeConfiguration(
"relaxed fading", api::FadeState::FADE_STATE_ENABLED_DEFAULT, kFadeableUsages,
std::optional<std::vector<AudioContentType>>(
{AudioContentType::SPEECH, AudioContentType::SONIFICATION}),
kUnfadeableAudioAttributes, kFadeOutConfigurations, kFadeInConfigurations, 800, 500, 10000);
const std::vector<AudioAttributes> kAggressiveUnfadeableAudioAttributes = {
createAudioAttributes(AudioUsage::MEDIA, AudioContentType::UNKNOWN, "oem_specific_tag1"),
createAudioAttributes(AudioUsage::ASSISTANT, AudioContentType::UNKNOWN,
"oem_projection_service"),
};
const std::vector<api::FadeConfiguration> kAggressiveFadeOutConfigurations = {
createFadeConfiguration(150, AudioUsage::MEDIA),
createFadeConfiguration(150, AudioUsage::GAME),
createFadeConfiguration(400, AudioUsage::ASSISTANCE_SONIFICATION),
createFadeConfiguration(400, AudioUsage::ASSISTANCE_ACCESSIBILITY),
createFadeConfiguration(400, AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE),
createFadeConfiguration(400, AudioUsage::ASSISTANT),
createFadeConfiguration(400, AudioUsage::ANNOUNCEMENT),
};
const std::vector<api::FadeConfiguration> kAggressiveFadeInConfigurations = {
createFadeConfiguration(300, AudioUsage::MEDIA),
createFadeConfiguration(300, AudioUsage::GAME),
createFadeConfiguration(550, AudioUsage::ASSISTANCE_SONIFICATION),
createFadeConfiguration(550, AudioUsage::ASSISTANCE_ACCESSIBILITY),
createFadeConfiguration(550, AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE),
createFadeConfiguration(550, AudioUsage::ASSISTANT),
createFadeConfiguration(550, AudioUsage::ANNOUNCEMENT),
};
const api::AudioFadeConfiguration kAggressiveFading = createAudioFadeConfiguration(
"aggressive fading", api::FadeState::FADE_STATE_ENABLED_DEFAULT, kFadeableUsages,
std::optional<std::vector<AudioContentType>>(
{AudioContentType::SPEECH, AudioContentType::MUSIC}),
kAggressiveUnfadeableAudioAttributes, kAggressiveFadeOutConfigurations,
kAggressiveFadeInConfigurations);
const api::AudioFadeConfiguration kDisabledFading =
createAudioFadeConfiguration("disabled fading", api::FadeState::FADE_STATE_DISABLED);
const std::vector<api::FadeConfiguration> kDynamicFadeOutConfigurations = {
createFadeConfiguration(
500, createAudioAttributes(AudioUsage::ASSISTANT, AudioContentType::UNKNOWN,
"oem_specific_tag2")),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_SONIFICATION),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_ACCESSIBILITY),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE),
createFadeConfiguration(800, AudioUsage::ASSISTANT),
createFadeConfiguration(800, AudioUsage::ANNOUNCEMENT),
};
const std::vector<api::FadeConfiguration> kDynamicFadeInConfigurations = {
createFadeConfiguration(
1000, createAudioAttributes(AudioUsage::ASSISTANT, AudioContentType::UNKNOWN,
"oem_specific_tag2")),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_SONIFICATION),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_ACCESSIBILITY),
createFadeConfiguration(800, AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE),
createFadeConfiguration(800, AudioUsage::ASSISTANT),
createFadeConfiguration(800, AudioUsage::ANNOUNCEMENT),
};
const api::AudioFadeConfiguration kDynamicFading = createAudioFadeConfiguration(
"dynamic fading", api::FadeState::FADE_STATE_ENABLED_DEFAULT, kFadeableUsages,
std::optional<std::vector<AudioContentType>>(
{AudioContentType::SPEECH, AudioContentType::MOVIE}),
kUnfadeableAudioAttributes, kDynamicFadeOutConfigurations, kDynamicFadeInConfigurations,
800, 500);
const api::AudioZoneFadeConfiguration kDefaultAudioConfigFading = createAudioZoneFadeConfiguration(
kRelaxedFading,
{createTransientFadeConfiguration(
kAggressiveFading, {AudioUsage::VOICE_COMMUNICATION, AudioUsage::ANNOUNCEMENT,
AudioUsage::VEHICLE_STATUS, AudioUsage::SAFETY}),
createTransientFadeConfiguration(kDisabledFading, {AudioUsage::EMERGENCY})});
const api::AudioZoneFadeConfiguration kDynamicDeviceAudioConfigFading =
createAudioZoneFadeConfiguration(
kDynamicFading,
{createTransientFadeConfiguration(
kAggressiveFading,
{AudioUsage::VOICE_COMMUNICATION, AudioUsage::ANNOUNCEMENT,
AudioUsage::VEHICLE_STATUS, AudioUsage::SAFETY}),
createTransientFadeConfiguration(kDisabledFading, {AudioUsage::EMERGENCY})});
const api::AudioZoneContextInfo kMusicContextInfo =
createContextInfo("oem_music", {AudioUsage::MEDIA, AudioUsage::GAME, AudioUsage::UNKNOWN});
const api::AudioZoneContextInfo kNotificationContextInfo = createContextInfo(
"oem_notification", {AudioUsage::NOTIFICATION, AudioUsage::NOTIFICATION_EVENT});
const api::AudioZoneContextInfo kVoiceContextInfo = createContextInfo(
"oem_voice_command", {AudioUsage::ASSISTANT, AudioUsage::ASSISTANCE_ACCESSIBILITY,
AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE});
const api::AudioZoneContextInfo kCallContextInfo =
createContextInfo("oem_call", {AudioUsage::VOICE_COMMUNICATION, AudioUsage::CALL_ASSISTANT,
AudioUsage::VOICE_COMMUNICATION_SIGNALLING});
const api::AudioZoneContextInfo kRingContextInfo =
createContextInfo("oem_call_ring", {AudioUsage::NOTIFICATION_TELEPHONY_RINGTONE});
const api::AudioZoneContextInfo kAlarmContextInfo =
createContextInfo("oem_alarm", {AudioUsage::ALARM});
const api::AudioZoneContextInfo kSystemContextInfo = createContextInfo(
"oem_system_sound",
{AudioUsage::ASSISTANCE_SONIFICATION, AudioUsage::EMERGENCY, AudioUsage::SAFETY,
AudioUsage::VEHICLE_STATUS, AudioUsage::ANNOUNCEMENT});
const api::AudioZoneContextInfo kOemContextInfo = createContextInfo(
"oem_context", {createAudioAttributes(AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE,
AudioContentType::SPEECH, "oem=extension_8675309")});
const std::vector<api::AudioZoneContextInfo> kSimpleCarAudioConfigurationContext = {
kOemContextInfo, kMusicContextInfo, kNotificationContextInfo, kVoiceContextInfo,
kCallContextInfo, kRingContextInfo, kAlarmContextInfo, kSystemContextInfo};
const api::AudioZoneContextInfo kDefaultMusicContextInfo =
createContextInfo("music", {AudioUsage::UNKNOWN, AudioUsage::MEDIA, AudioUsage::GAME}, 1);
const api::AudioZoneContextInfo kDefaultNavContextInfo =
createContextInfo("navigation", {AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE}, 2);
const api::AudioZoneContextInfo kDefaultVoiceContextInfo = createContextInfo(
"voice_command", {AudioUsage::ASSISTANCE_ACCESSIBILITY, AudioUsage::ASSISTANT}, 3);
const api::AudioZoneContextInfo kDefaultRingContextInfo =
createContextInfo("call_ring", {AudioUsage::NOTIFICATION_TELEPHONY_RINGTONE}, 4);
const api::AudioZoneContextInfo kDefaultCallContextInfo =
createContextInfo("call",
{AudioUsage::VOICE_COMMUNICATION, AudioUsage::CALL_ASSISTANT,
AudioUsage::VOICE_COMMUNICATION_SIGNALLING},
5);
const api::AudioZoneContextInfo kDefaultAlarmContextInfo =
createContextInfo("alarm", {AudioUsage::ALARM}, 6);
const api::AudioZoneContextInfo kDefaultNotificationContextInfo = createContextInfo(
"notification", {AudioUsage::NOTIFICATION, AudioUsage::NOTIFICATION_EVENT}, 7);
const api::AudioZoneContextInfo kDefaultSystemContextInfo =
createContextInfo("system_sound", {AudioUsage::ASSISTANCE_SONIFICATION}, 8);
const api::AudioZoneContextInfo kDefaultEmergencyContextInfo =
createContextInfo("emergency", {AudioUsage::EMERGENCY}, 9);
const api::AudioZoneContextInfo kDefaultSafetyContextInfo =
createContextInfo("safety", {AudioUsage::SAFETY}, 10);
const api::AudioZoneContextInfo kDefaultVehicleStatusContextInfo =
createContextInfo("vehicle_status", {AudioUsage::VEHICLE_STATUS}, 11);
const api::AudioZoneContextInfo kDefaultAnnouncementContextInfo =
createContextInfo("announcement", {AudioUsage::ANNOUNCEMENT}, 12);
const std::vector<api::AudioZoneContextInfo> kDefaultCarAudioConfigurationContext = {
kDefaultMusicContextInfo, kDefaultNavContextInfo,
kDefaultVoiceContextInfo, kDefaultRingContextInfo,
kDefaultCallContextInfo, kDefaultAlarmContextInfo,
kDefaultNotificationContextInfo, kDefaultSystemContextInfo,
kDefaultEmergencyContextInfo, kDefaultSafetyContextInfo,
kDefaultVehicleStatusContextInfo, kDefaultAnnouncementContextInfo};
const api::VolumeActivationConfiguration kOnBootVolumeActivation =
createVolumeActivation("on_boot_config", api::VolumeInvocationType::ON_BOOT, 0, 80);
const api::VolumeActivationConfiguration kOnSourceVolumeActivation = createVolumeActivation(
"on_source_changed_config", api::VolumeInvocationType::ON_SOURCE_CHANGED, 20, 80);
const api::VolumeActivationConfiguration kOnPlayVolumeActivation = createVolumeActivation(
"on_playback_changed_config", api::VolumeInvocationType::ON_PLAYBACK_CHANGED, 10, 90);
const AudioPort kBusMediaDevice = createAudioPort("BUS00_MEDIA", AudioDeviceType::OUT_BUS);
const AudioPort kBTMediaDevice = createAudioPort("temp", AudioDeviceType::OUT_DEVICE, "bt-a2dp");
const AudioPort kUSBMediaDevice = createAudioPort("", AudioDeviceType::OUT_HEADSET, "usb");
const AudioPort kBusNavDevice = createAudioPort("BUS02_NAV_GUIDANCE", AudioDeviceType::OUT_BUS);
const AudioPort kBusPhoneDevice = createAudioPort("BUS03_PHONE", AudioDeviceType::OUT_BUS);
const AudioPort kBusSysDevice = createAudioPort("BUS01_SYS_NOTIFICATION", AudioDeviceType::OUT_BUS);
const AudioPort kMirrorDevice1 = createAudioPort("mirror_bus_device_1", AudioDeviceType::OUT_BUS);
const AudioPort kMirrorDevice2 = createAudioPort("mirror_bus_device_2", AudioDeviceType::OUT_BUS);
const std::vector<AudioPort> kMirroringDevices = {kMirrorDevice1, kMirrorDevice2};
const AudioPort kMirrorDeviceThree =
createAudioPort("mirror_bus_device_three", AudioDeviceType::OUT_BUS);
const AudioPort kMirrorDeviceFour =
createAudioPort("mirror_bus_device_four", AudioDeviceType::OUT_BUS);
const std::vector<AudioPort> kMultiZoneMirroringDevices = {kMirrorDeviceThree, kMirrorDeviceFour};
const AudioPort kInFMTunerDevice = createAudioPort("fm_tuner", AudioDeviceType::IN_FM_TUNER);
const AudioPort kInMicDevice = createAudioPort("built_in_mic", AudioDeviceType::IN_MICROPHONE);
const AudioPort kInBusDevice = createAudioPort("in_bus_device", AudioDeviceType::IN_BUS);
const std::vector<AudioPort> kInputDevices{kInFMTunerDevice, kInMicDevice, kInBusDevice};
const api::VolumeGroupConfig kBusMediaVolumeGroup = createVolumeGroup(
"entertainment", kOnBootVolumeActivation, {createRoutes(kBusMediaDevice, {"oem_music"})});
const api::VolumeGroupConfig kUSBMediaVolumeGroup = createVolumeGroup(
"entertainment", kOnBootVolumeActivation, {createRoutes(kUSBMediaDevice, {"oem_music"})});
const api::VolumeGroupConfig kBTMediaVolumeGroup = createVolumeGroup(
"entertainment", kOnBootVolumeActivation, {createRoutes(kBTMediaDevice, {"oem_music"})});
const api::VolumeGroupConfig kBusNavVolumeGroup =
createVolumeGroup("navvoicecommand", kOnSourceVolumeActivation,
{createRoutes(kBusNavDevice, {"oem_voice_command"})});
const api::VolumeGroupConfig kBusCallVolumeGroup =
createVolumeGroup("telringvol", kOnPlayVolumeActivation,
{createRoutes(kBusPhoneDevice, {"oem_call", "oem_call_ring"})});
const api::VolumeGroupConfig kBusSysVolumeGroup = createVolumeGroup(
"systemalarm", kOnSourceVolumeActivation,
{createRoutes(kBusSysDevice, {"oem_alarm", "oem_system_sound", "oem_notification"})});
const api::AudioZoneConfig kAllBusZoneConfig = createAudioZoneConfig(
"primary zone config 0", kDefaultAudioConfigFading,
{kBusMediaVolumeGroup, kBusNavVolumeGroup, kBusCallVolumeGroup, kBusSysVolumeGroup}, true);
const api::AudioZoneConfig kBTMediaZoneConfig = createAudioZoneConfig(
"primary zone BT media", kDynamicDeviceAudioConfigFading,
{kBTMediaVolumeGroup, kBusNavVolumeGroup, kBusCallVolumeGroup, kBusSysVolumeGroup});
const api::AudioZoneConfig kUsBMediaZoneConfig = createAudioZoneConfig(
"primary zone USB media", kDynamicDeviceAudioConfigFading,
{kUSBMediaVolumeGroup, kBusNavVolumeGroup, kBusCallVolumeGroup, kBusSysVolumeGroup});
const std::unordered_map<std::string, api::AudioZoneConfig> kConfigNameToZoneConfig = {
{kAllBusZoneConfig.name, kAllBusZoneConfig},
{kBTMediaZoneConfig.name, kBTMediaZoneConfig},
{kUsBMediaZoneConfig.name, kUsBMediaZoneConfig},
};
const api::AudioZoneConfig kDriverZoneConfig = createAudioZoneConfig(
"driver zone config 0", kDefaultAudioConfigFading,
{kBusMediaVolumeGroup, kBusNavVolumeGroup, kBusCallVolumeGroup, kBusSysVolumeGroup}, true);
const api::AudioZone kDriverZone =
createAudioZone("driver zone", api::AudioZone::PRIMARY_AUDIO_ZONE,
kSimpleCarAudioConfigurationContext, {kDriverZoneConfig});
const api::AudioZoneFadeConfiguration kZoneAudioConfigFading = createAudioZoneFadeConfiguration(
kRelaxedFading,
{createTransientFadeConfiguration(kDisabledFading, {AudioUsage::EMERGENCY})});
const AudioPort kBusFrontDevice = createAudioPort("BUS_FRONT", AudioDeviceType::OUT_BUS);
const api::VolumeGroupConfig kFrontVolumeGroup = createVolumeGroup(
"entertainment", kOnBootVolumeActivation,
{createRoutes(kBusFrontDevice,
{"oem_music", "oem_voice_command", "oem_call", "oem_call_ring", "oem_alarm",
"oem_system_sound", "oem_notification"})});
const api::AudioZoneConfig kFrontZoneConfig = createAudioZoneConfig(
"front passenger config 0", kZoneAudioConfigFading, {kFrontVolumeGroup}, true);
const api::AudioZone kFrontZone =
createAudioZone("front passenger zone", api::AudioZone::PRIMARY_AUDIO_ZONE + 1,
kSimpleCarAudioConfigurationContext, {kFrontZoneConfig});
const AudioPort kBusRearDevice = createAudioPort("BUS_REAR", AudioDeviceType::OUT_BUS);
const api::VolumeGroupConfig kRearVolumeGroup =
createVolumeGroup("entertainment", kOnBootVolumeActivation,
{createRoutes(kBusRearDevice, {"oem_music", "oem_voice_command",
"oem_call", "oem_call_ring", "oem_alarm",
"oem_system_sound", "oem_notification"})});
const api::AudioZoneConfig kRearZoneConfig = createAudioZoneConfig(
"rear seat config 0", kZoneAudioConfigFading, {kRearVolumeGroup}, true);
const api::AudioZone kRearZone =
createAudioZone("rear seat zone", api::AudioZone::PRIMARY_AUDIO_ZONE + 2,
kSimpleCarAudioConfigurationContext, {kRearZoneConfig});
std::vector<api::AudioZone> kMultiZones = {kDriverZone, kFrontZone, kRearZone};
void expectSameFadeConfiguration(const api::AudioFadeConfiguration& actual,
const api::AudioFadeConfiguration& expected,
const std::string& configName) {
EXPECT_EQ(actual.name, expected.name) << "Audio fade configuration for config " << configName;
const std::string fadeConfigInfo =
"fade config " + actual.name + " in config name " + configName;
EXPECT_EQ(actual.fadeState, expected.fadeState)
<< "Audio fade config state for " << fadeConfigInfo;
EXPECT_EQ(actual.fadeInDurationMs, expected.fadeInDurationMs)
<< "Audio fade in duration for " << fadeConfigInfo;
EXPECT_EQ(actual.fadeOutDurationMs, expected.fadeOutDurationMs)
<< "Audio fade out duration for " << fadeConfigInfo;
EXPECT_EQ(actual.fadeInDelayedForOffendersMs, expected.fadeInDelayedForOffendersMs)
<< "Audio fade in delayed for offenders duration for " << fadeConfigInfo;
EXPECT_THAT(actual.fadeableUsages, UnorderedElementsAreArray(expected.fadeableUsages))
<< "Fadeable usages for " << fadeConfigInfo;
EXPECT_TRUE(actual.unfadeableContentTypes.has_value() ==
expected.unfadeableContentTypes.has_value())
<< "Optional unfadeable for " << fadeConfigInfo;
if (actual.unfadeableContentTypes.has_value() && expected.unfadeableContentTypes.has_value()) {
EXPECT_THAT(actual.unfadeableContentTypes.value(),
UnorderedElementsAreArray(expected.unfadeableContentTypes.value()))
<< "Unfadeable content type for " << fadeConfigInfo;
}
EXPECT_THAT(actual.unfadableAudioAttributes,
UnorderedElementsAreArray(expected.unfadableAudioAttributes))
<< "Unfadeable audio attributes type for " << fadeConfigInfo;
EXPECT_THAT(actual.fadeOutConfigurations,
UnorderedElementsAreArray(expected.fadeOutConfigurations))
<< "Fade-out configurations for " << fadeConfigInfo;
EXPECT_THAT(actual.fadeInConfigurations,
UnorderedElementsAreArray(expected.fadeInConfigurations))
<< "Fade-in configurations for " << fadeConfigInfo;
}
void expectSameAudioZoneFadeConfiguration(
const std::optional<api::AudioZoneFadeConfiguration>& actual,
const std::optional<api::AudioZoneFadeConfiguration>& expected,
const std::string& configName) {
if (!actual.has_value() || !expected.has_value()) {
EXPECT_EQ(actual.has_value(), expected.has_value())
<< "Audio zone config " << configName << " fade configuration missing";
return;
}
const api::AudioZoneFadeConfiguration& actualConfig = actual.value();
const api::AudioZoneFadeConfiguration& expectedConfig = expected.value();
expectSameFadeConfiguration(actualConfig.defaultConfiguration,
expectedConfig.defaultConfiguration, configName);
EXPECT_THAT(actualConfig.transientConfiguration,
UnorderedElementsAreArray(expectedConfig.transientConfiguration))
<< "Transient fade configuration for config " << configName;
}
void expectSameAudioZoneConfiguration(const api::AudioZoneConfig& actual,
const api::AudioZoneConfig& expected) {
EXPECT_EQ(actual.isDefault, expected.isDefault)
<< "Zone default's status do not match for config " << actual.name;
EXPECT_THAT(actual.volumeGroups, UnorderedElementsAreArray(expected.volumeGroups))
<< "Volume groups for config " << actual.name;
expectSameAudioZoneFadeConfiguration(actual.fadeConfiguration, expected.fadeConfiguration,
actual.name);
}
class CarAudioConfigurationTest : public testing::Test {
protected:
void SetUp() override;
void TearDown() override;
std::unique_ptr<converter::CarAudioConfigurationXmlConverter> converter;
protected:
virtual std::string getCarAudioConfiguration() = 0;
virtual std::string getCarFadeConfiguration() = 0;
};
void CarAudioConfigurationTest::SetUp() {
converter = std::make_unique<converter::CarAudioConfigurationXmlConverter>(
getTestFilePath(getCarAudioConfiguration()),
getTestFilePath(getCarFadeConfiguration()));
}
void CarAudioConfigurationTest::TearDown() {
converter.reset();
}
class SimpleCarAudioConfigurationTest : public CarAudioConfigurationTest {
virtual std::string getCarAudioConfiguration() { return "simple_car_audio_configuration.xml"; }
virtual std::string getCarFadeConfiguration() { return "car_audio_fade_configuration.xml"; }
};
TEST_F(SimpleCarAudioConfigurationTest, TestLoadSimpleConfiguration) {
EXPECT_EQ(converter->getErrors(), "");
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::DYNAMIC_AUDIO_ROUTING);
EXPECT_FALSE(audioDeviceConfigs.useCoreAudioVolume);
EXPECT_TRUE(audioDeviceConfigs.useHalDuckingSignals);
EXPECT_TRUE(audioDeviceConfigs.useCarVolumeGroupMuting);
const auto& mirroringDevices = converter->getOutputMirroringDevices();
EXPECT_EQ(mirroringDevices.size(), 2) << "Mirroring device size";
for (const auto& mirroringDevice : mirroringDevices) {
const auto& it =
std::find(kMirroringDevices.begin(), kMirroringDevices.end(), mirroringDevice);
EXPECT_TRUE(it != kMirroringDevices.end())
<< "Mirroring device not found " << mirroringDevice.toString();
}
const auto zones = converter->getAudioZones();
EXPECT_EQ(zones.size(), 1);
const auto& zone = zones.front();
EXPECT_EQ(zone.id, api::AudioZone::PRIMARY_AUDIO_ZONE);
EXPECT_EQ(zone.occupantZoneId, 0);
EXPECT_EQ(zone.name, "primary zone");
EXPECT_EQ(zone.audioZoneContext.audioContextInfos.size(),
kSimpleCarAudioConfigurationContext.size());
for (const auto& info : zone.audioZoneContext.audioContextInfos) {
const auto iterator = std::find(kSimpleCarAudioConfigurationContext.begin(),
kSimpleCarAudioConfigurationContext.end(), info);
EXPECT_TRUE(iterator != kSimpleCarAudioConfigurationContext.end())
<< "Context name " << info.toString() << kMusicContextInfo.toString();
}
for (const auto& config : zone.audioZoneConfigs) {
const auto& iterator = kConfigNameToZoneConfig.find(config.name);
EXPECT_TRUE(iterator != kConfigNameToZoneConfig.end())
<< "Zone config not found " << config.name;
expectSameAudioZoneConfiguration(config, iterator->second);
}
const auto& inputDevices = zone.inputAudioDevices;
EXPECT_EQ(inputDevices.size(), 3) << "Input devices";
for (const auto& inputDevice : inputDevices) {
const auto& it = std::find(kInputDevices.begin(), kInputDevices.end(), inputDevice);
EXPECT_TRUE(it != kInputDevices.end())
<< "Input device " << inputDevice.toString() << " not found";
}
}
class TypeDeviceCarAudioConfigurationTest : public CarAudioConfigurationTest {
virtual std::string getCarAudioConfiguration() {
return "simple_car_audio_configuration_with_device_type.xml";
}
virtual std::string getCarFadeConfiguration() { return "car_audio_fade_configuration.xml"; }
};
TEST_F(TypeDeviceCarAudioConfigurationTest, TestLoadConfigurationWithDeviceType) {
EXPECT_EQ(converter->getErrors(), "");
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::DYNAMIC_AUDIO_ROUTING);
EXPECT_FALSE(audioDeviceConfigs.useCoreAudioVolume);
EXPECT_TRUE(audioDeviceConfigs.useHalDuckingSignals);
EXPECT_TRUE(audioDeviceConfigs.useCarVolumeGroupMuting);
const auto& mirroringDevices = converter->getOutputMirroringDevices();
EXPECT_EQ(mirroringDevices.size(), 2) << "Mirroring device size";
for (const auto& mirroringDevice : mirroringDevices) {
const auto& it =
std::find(kMirroringDevices.begin(), kMirroringDevices.end(), mirroringDevice);
EXPECT_TRUE(it != kMirroringDevices.end())
<< "Mirroring device not found " << mirroringDevice.toString();
}
const auto zones = converter->getAudioZones();
EXPECT_EQ(zones.size(), 1);
const auto& zone = zones.front();
EXPECT_EQ(zone.id, api::AudioZone::PRIMARY_AUDIO_ZONE);
EXPECT_EQ(zone.occupantZoneId, 0);
EXPECT_EQ(zone.name, "primary zone");
EXPECT_EQ(zone.audioZoneContext.audioContextInfos.size(),
kSimpleCarAudioConfigurationContext.size());
for (const auto& info : zone.audioZoneContext.audioContextInfos) {
const auto iterator = std::find(kSimpleCarAudioConfigurationContext.begin(),
kSimpleCarAudioConfigurationContext.end(), info);
EXPECT_TRUE(iterator != kSimpleCarAudioConfigurationContext.end())
<< "Context name " << info.toString() << kMusicContextInfo.toString();
}
for (const auto& config : zone.audioZoneConfigs) {
const auto& iterator = kConfigNameToZoneConfig.find(config.name);
EXPECT_TRUE(iterator != kConfigNameToZoneConfig.end())
<< "Zone config not found " << config.name;
expectSameAudioZoneConfiguration(config, iterator->second);
}
const auto& inputDevices = zone.inputAudioDevices;
EXPECT_EQ(inputDevices.size(), 3) << "Input devices";
for (const auto& inputDevice : inputDevices) {
const auto& it = std::find(kInputDevices.begin(), kInputDevices.end(), inputDevice);
EXPECT_TRUE(it != kInputDevices.end())
<< "Input device " << inputDevice.toString() << " not found";
}
}
class CarAudioConfigurationWithDefaultContextTest : public CarAudioConfigurationTest {
virtual std::string getCarAudioConfiguration() {
return "car_audio_configuration_with_default_context.xml";
}
virtual std::string getCarFadeConfiguration() { return ""; }
};
TEST_F(CarAudioConfigurationWithDefaultContextTest, TestLoadConfiguration) {
EXPECT_EQ(converter->getErrors(), "");
const auto& zones = converter->getAudioZones();
EXPECT_EQ(zones.size(), 1) << "Default audio context zones";
const auto& zone = zones.front();
const auto& context = zone.audioZoneContext;
EXPECT_THAT(context.audioContextInfos,
UnorderedElementsAreArray(kDefaultCarAudioConfigurationContext))
<< "Default audio contexts";
}
class MultiZoneCarAudioConfigurationTest : public CarAudioConfigurationTest {
std::string getCarAudioConfiguration() override {
return "multi_zone_car_audio_configuration.xml";
}
std::string getCarFadeConfiguration() override { return "car_audio_fade_configuration.xml"; }
};
TEST_F(MultiZoneCarAudioConfigurationTest, TestLoadMultiZoneConfiguration) {
EXPECT_EQ(converter->getErrors(), "");
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::CONFIGURABLE_AUDIO_ENGINE_ROUTING);
EXPECT_TRUE(audioDeviceConfigs.useCoreAudioVolume);
EXPECT_FALSE(audioDeviceConfigs.useHalDuckingSignals);
EXPECT_FALSE(audioDeviceConfigs.useCarVolumeGroupMuting);
const auto& mirroringDevices = converter->getOutputMirroringDevices();
EXPECT_THAT(mirroringDevices, UnorderedElementsAreArray(kMultiZoneMirroringDevices));
const auto zones = converter->getAudioZones();
EXPECT_THAT(zones, UnorderedElementsAreArray(kMultiZones));
}
class MalformedCarAudioConfigurationTest : public testing::Test {
protected:
void TearDown() override;
std::unique_ptr<converter::CarAudioConfigurationXmlConverter> converter;
};
void MalformedCarAudioConfigurationTest::TearDown() {
converter.reset();
}
TEST_F(MalformedCarAudioConfigurationTest, TestLoadEmptyConfiguration) {
converter =
std::make_unique<converter::CarAudioConfigurationXmlConverter>(getTestFilePath(""), "");
EXPECT_THAT(converter->getErrors(), ContainsRegex("Configuration file .+ is not readable"))
<< "Empty configuration file";
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::DEFAULT_AUDIO_ROUTING)
<< "Default configuration for empty file";
}
TEST_F(MalformedCarAudioConfigurationTest, TestLoadNonExistingConfiguration) {
converter = std::make_unique<converter::CarAudioConfigurationXmlConverter>(
getTestFilePath("non_existing_file.xml"), "");
EXPECT_THAT(converter->getErrors(), ContainsRegex("Configuration file .+ is not readable"))
<< "Empty configuration file";
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::DEFAULT_AUDIO_ROUTING)
<< "Default configuration for empty file";
}
TEST_F(MalformedCarAudioConfigurationTest, TestLoadMalforedConfiguration) {
converter = std::make_unique<converter::CarAudioConfigurationXmlConverter>(
getTestFilePath("car_audio_configuration_without_configuration.xml"), "");
EXPECT_THAT(converter->getErrors(),
ContainsRegex("Configuration file .+ does not have any configurations"))
<< "Configuration file without configurations";
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::DEFAULT_AUDIO_ROUTING)
<< "Default configuration for malformed file";
}
TEST_F(MalformedCarAudioConfigurationTest, TestLoadConfigurationWithoutZones) {
converter = std::make_unique<converter::CarAudioConfigurationXmlConverter>(
getTestFilePath("car_audio_configuration_without_audio_zone.xml"), "");
EXPECT_THAT(converter->getErrors(), ContainsRegex("Audio zones not found in file"))
<< "Configuration file without zones";
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::DEFAULT_AUDIO_ROUTING)
<< "Default configuration for file without zones";
}
TEST_F(MalformedCarAudioConfigurationTest, TestLoadConfigurationWithMissingZones) {
converter = std::make_unique<converter::CarAudioConfigurationXmlConverter>(
getTestFilePath("car_audio_configuration_with_missing_zones.xml"), "");
EXPECT_THAT(converter->getErrors(), ContainsRegex("Error parsing audio zone"))
<< "Configuration file with missing zones";
const auto audioDeviceConfigs = converter->getAudioDeviceConfiguration();
EXPECT_EQ(audioDeviceConfigs.routingConfig,
api::RoutingDeviceConfiguration::DEFAULT_AUDIO_ROUTING)
<< "Default configuration for file with missing zones";
}
} // namespace

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<carAudioConfiguration version="4">
<zones>
<zone name="primary zone" isPrimary="true">
<zoneConfigs>
<zoneConfig name="primary zone config" isDefault="true">
<volumeGroups>
<group name="entertainment" >
<device address="BUS00_MEDIA">
<context context="MUSIC"/>
</device>
</group>
<group name="navvoicecommand" >
<device address="BUS02_NAV_GUIDANCE">
<context context="NAVIGATION"/>
<context context="VOICE_COMMAND"/>
</device>
</group>
<group name="telringvol" >
<device address="BUS03_PHONE">
<context context="CALL"/>
<context context="CALL_RING"/>
</device>
</group>
<group name="alarm" >
<device address="BUS01_NOTIFICATION">
<context context="ALARM"/>
<context context="NOTIFICATION"/>
</device>
</group>
<group name="system" >
<device address="BUS05_SYSTEM">
<context context="SYSTEM_SOUND"/>
<context context="EMERGENCY"/>
<context context="SAFETY"/>
<context context="VEHICLE_STATUS"/>
<context context="ANNOUNCEMENT"/>
</device>
</group>
</volumeGroups>
</zoneConfig>
</zoneConfigs>
</zone>
</zones>
</carAudioConfiguration>

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<carAudioConfiguration version="4">
<deviceConfigurations>
<deviceConfiguration name="useHalDuckingSignals" value="true" />
<deviceConfiguration name="useCoreAudioRouting" value="false" />
<deviceConfiguration name="useCoreAudioVolume" value="false" />
<deviceConfiguration name="useCarVolumeGroupMuting" value="true" />
</deviceConfigurations>
<oemContexts>
<oemContext name="oem_context">
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
contentType="AUDIO_CONTENT_TYPE_SPEECH"
tags="oem=extension_8675309" />
</audioAttributes>
</oemContext>
<oemContext name="oem_music">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_UNKNOWN" />
</audioAttributes>
</oemContext>
<oemContext name="oem_notification">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_NOTIFICATION_EVENT" />
</audioAttributes>
</oemContext>
<oemContext name="oem_voice_command">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_CALL_ASSISTANT" />
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call_ring">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_alarm">
<audioAttributes>
<usage value="AUDIO_USAGE_ALARM" />
</audioAttributes>
</oemContext>
<oemContext name="oem_system_sound">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_EMERGENCY" />
<usage value="AUDIO_USAGE_SAFETY" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
</audioAttributes>
</oemContext>
</oemContexts>
<activationVolumeConfigs>
<activationVolumeConfig name="on_boot_config">
<activationVolumeConfigEntry maxActivationVolumePercentage="80" invocationType="onBoot" />
</activationVolumeConfig>
<activationVolumeConfig name="on_source_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="20" maxActivationVolumePercentage="80" invocationType="onSourceChanged" />
</activationVolumeConfig>
<activationVolumeConfig name="on_playback_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="10" maxActivationVolumePercentage="90" invocationType="onPlaybackChanged" />
</activationVolumeConfig>
</activationVolumeConfigs>
<mirroringDevices>
<mirroringDevice address="mirror_bus_device_1"/>
<mirroringDevice address="mirror_bus_device_2"/>
</mirroringDevices>
<zones>
</zones>
</carAudioConfiguration>

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<carAudioConfiguration version="4">
<deviceConfigurations>
<deviceConfiguration name="useHalDuckingSignals" value="true" />
<deviceConfiguration name="useCoreAudioRouting" value="false" />
<deviceConfiguration name="useCoreAudioVolume" value="false" />
<deviceConfiguration name="useCarVolumeGroupMuting" value="true" />
</deviceConfigurations>
<oemContexts>
<oemContext name="oem_context">
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
contentType="AUDIO_CONTENT_TYPE_SPEECH"
tags="oem=extension_8675309" />
</audioAttributes>
</oemContext>
<oemContext name="oem_music">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_UNKNOWN" />
</audioAttributes>
</oemContext>
<oemContext name="oem_notification">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_NOTIFICATION_EVENT" />
</audioAttributes>
</oemContext>
<oemContext name="oem_voice_command">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_CALL_ASSISTANT" />
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call_ring">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_alarm">
<audioAttributes>
<usage value="AUDIO_USAGE_ALARM" />
</audioAttributes>
</oemContext>
<oemContext name="oem_system_sound">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_EMERGENCY" />
<usage value="AUDIO_USAGE_SAFETY" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
</audioAttributes>
</oemContext>
</oemContexts>
<activationVolumeConfigs>
<activationVolumeConfig name="on_boot_config">
<activationVolumeConfigEntry maxActivationVolumePercentage="80" invocationType="onBoot" />
</activationVolumeConfig>
<activationVolumeConfig name="on_source_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="20" maxActivationVolumePercentage="80" invocationType="onSourceChanged" />
</activationVolumeConfig>
<activationVolumeConfig name="on_playback_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="10" maxActivationVolumePercentage="90" invocationType="onPlaybackChanged" />
</activationVolumeConfig>
</activationVolumeConfigs>
<mirroringDevices>
<mirroringDevice address="mirror_bus_device_1"/>
<mirroringDevice address="mirror_bus_device_2"/>
</mirroringDevices>
</carAudioConfiguration>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<nonCarAudioConfiguration version="4">
</nonCarAudioConfiguration>

View File

@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<carAudioFadeConfiguration version="1">
<configs>
<config name="relaxed fading" defaultFadeOutDurationInMillis="800" defaultFadeInDurationInMillis="500" defaultFadeInDelayForOffenders="10000" >
<fadeState value="1" />
<fadeableUsages>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</fadeableUsages>
<unfadeableContentTypes>
<contentType value="AUDIO_CONTENT_TYPE_SPEECH" />
<contentType value="AUDIO_CONTENT_TYPE_SONIFICATION" />
</unfadeableContentTypes>
<unfadeableAudioAttributes>
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_MEDIA" tags="oem_specific_tag1" />
</audioAttributes>
</unfadeableAudioAttributes>
<fadeOutConfigurations>
<fadeConfiguration fadeDurationMillis="500">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<audioAttribute usage="AUDIO_USAGE_ASSISTANT" tags="oem_specific_tag2" />
</audioAttributes>
</fadeConfiguration>
<fadeConfiguration fadeDurationMillis="800">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</audioAttributes>
</fadeConfiguration>
</fadeOutConfigurations>
<fadeInConfigurations>
<fadeConfiguration fadeDurationMillis="1000">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<audioAttribute usage="AUDIO_USAGE_ASSISTANT" tags="oem_specific_tag2" />
</audioAttributes>
</fadeConfiguration>
<fadeConfiguration fadeDurationMillis="800">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</audioAttributes>
</fadeConfiguration>
</fadeInConfigurations>
</config>
<config name="aggressive fading">
<fadeState value="FADE_STATE_ENABLED_DEFAULT" />
<fadeableUsages>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</fadeableUsages>
<unfadeableContentTypes>
<contentType value="AUDIO_CONTENT_TYPE_SPEECH" />
<contentType value="AUDIO_CONTENT_TYPE_MUSIC" />
</unfadeableContentTypes>
<unfadeableAudioAttributes>
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_MEDIA" tags="oem_specific_tag1" />
<audioAttribute usage="AUDIO_USAGE_ASSISTANT" tags="oem_projection_service" />
</audioAttributes>
</unfadeableAudioAttributes>
<fadeOutConfigurations>
<fadeConfiguration fadeDurationMillis="150">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
</audioAttributes>
</fadeConfiguration>
<fadeConfiguration fadeDurationMillis="400">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</audioAttributes>
</fadeConfiguration>
</fadeOutConfigurations>
<fadeInConfigurations>
<fadeConfiguration fadeDurationMillis="300">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
</audioAttributes>
</fadeConfiguration>
<fadeConfiguration fadeDurationMillis="550">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</audioAttributes>
</fadeConfiguration>
</fadeInConfigurations>
</config>
<config name="disabled fading">
<fadeState value="0" />
</config>
<config name="dynamic fading" defaultFadeOutDurationInMillis="800" defaultFadeInDurationInMillis="500">
<fadeState value="1" />
<fadeableUsages>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</fadeableUsages>
<unfadeableContentTypes>
<contentType value="AUDIO_CONTENT_TYPE_SPEECH" />
<contentType value="AUDIO_CONTENT_TYPE_MOVIE" />
</unfadeableContentTypes>
<unfadeableAudioAttributes>
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_MEDIA" tags="oem_specific_tag1" />
</audioAttributes>
</unfadeableAudioAttributes>
<fadeOutConfigurations>
<fadeConfiguration fadeDurationMillis="500">
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_ASSISTANT" tags="oem_specific_tag2" />
</audioAttributes>
</fadeConfiguration>
<fadeConfiguration fadeDurationMillis="800">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</audioAttributes>
</fadeConfiguration>
</fadeOutConfigurations>
<fadeInConfigurations>
<fadeConfiguration fadeDurationMillis="1000">
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_ASSISTANT" tags="oem_specific_tag2" />
</audioAttributes>
</fadeConfiguration>
<fadeConfiguration fadeDurationMillis="800">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT"/>
</audioAttributes>
</fadeConfiguration>
</fadeInConfigurations>
</config>
</configs>
</carAudioFadeConfiguration>

View File

@@ -0,0 +1,196 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<carAudioConfiguration version="4">
<deviceConfigurations>
<deviceConfiguration name="useHalDuckingSignals" value="false" />
<deviceConfiguration name="useCoreAudioRouting" value="true" />
<deviceConfiguration name="useCoreAudioVolume" value="true" />
<deviceConfiguration name="useCarVolumeGroupMuting" value="false" />
</deviceConfigurations>
<oemContexts>
<oemContext name="oem_context">
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
contentType="AUDIO_CONTENT_TYPE_SPEECH"
tags="oem=extension_8675309" />
</audioAttributes>
</oemContext>
<oemContext name="oem_music">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_UNKNOWN" />
</audioAttributes>
</oemContext>
<oemContext name="oem_notification">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_NOTIFICATION_EVENT" />
</audioAttributes>
</oemContext>
<oemContext name="oem_voice_command">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_CALL_ASSISTANT" />
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call_ring">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_alarm">
<audioAttributes>
<usage value="AUDIO_USAGE_ALARM" />
</audioAttributes>
</oemContext>
<oemContext name="oem_system_sound">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_EMERGENCY" />
<usage value="AUDIO_USAGE_SAFETY" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
</audioAttributes>
</oemContext>
</oemContexts>
<activationVolumeConfigs>
<activationVolumeConfig name="on_boot_config">
<activationVolumeConfigEntry maxActivationVolumePercentage="80" invocationType="onBoot" />
</activationVolumeConfig>
<activationVolumeConfig name="on_source_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="20" maxActivationVolumePercentage="80" invocationType="onSourceChanged" />
</activationVolumeConfig>
<activationVolumeConfig name="on_playback_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="10" maxActivationVolumePercentage="90" invocationType="onPlaybackChanged" />
</activationVolumeConfig>
</activationVolumeConfigs>
<mirroringDevices>
<mirroringDevice address="mirror_bus_device_three"/>
<mirroringDevice address="mirror_bus_device_four"/>
</mirroringDevices>
<zones>
<zone name="driver zone" isPrimary="true" audioZoneId="0" occupantZoneId="0">
<zoneConfigs>
<zoneConfig name="driver zone config 0" isDefault="true">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device address="BUS00_MEDIA">
<context context="oem_music"/>
</device>
</group>
<group name="navvoicecommand" activationConfig="on_source_changed_config">
<device address="BUS02_NAV_GUIDANCE">
<context context="oem_voice_command"/>
</device>
</group>
<group name="telringvol" activationConfig="on_playback_changed_config">
<device address="BUS03_PHONE">
<context context="oem_call"/>
<context context="oem_call_ring"/>
</device>
</group>
<group name="systemalarm" activationConfig="on_source_changed_config">
<device address="BUS01_SYS_NOTIFICATION">
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="relaxed fading" isDefault="true">
</fadeConfig>
<fadeConfig name="aggressive fading">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_SAFETY" />
</audioAttributes>
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
</zoneConfigs>
</zone>
<zone name="front passenger zone" audioZoneId="1" occupantZoneId="1">
<zoneConfigs>
<zoneConfig name="front passenger config 0" isDefault="true">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device address="BUS_FRONT">
<context context="oem_music"/>
<context context="oem_voice_command"/>
<context context="oem_call"/>
<context context="oem_call_ring"/>
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="relaxed fading" isDefault="true">
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
</zoneConfigs>
</zone>
<zone name="rear seat zone" audioZoneId="2" occupantZoneId="2">
<zoneConfigs>
<zoneConfig name="rear seat config 0" isDefault="true">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device address="BUS_REAR">
<context context="oem_music"/>
<context context="oem_voice_command"/>
<context context="oem_call"/>
<context context="oem_call_ring"/>
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="relaxed fading" isDefault="true">
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
</zoneConfigs>
</zone>
</zones>
</carAudioConfiguration>

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<carAudioConfiguration version="4">
<deviceConfigurations>
<deviceConfiguration name="useHalDuckingSignals" value="true" />
<deviceConfiguration name="useCoreAudioRouting" value="false" />
<deviceConfiguration name="useCoreAudioVolume" value="false" />
<deviceConfiguration name="useCarVolumeGroupMuting" value="true" />
</deviceConfigurations>
<oemContexts>
<oemContext name="oem_context">
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
contentType="AUDIO_CONTENT_TYPE_SPEECH"
tags="oem=extension_8675309" />
</audioAttributes>
</oemContext>
<oemContext name="oem_music">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_UNKNOWN" />
</audioAttributes>
</oemContext>
<oemContext name="oem_notification">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_NOTIFICATION_EVENT" />
</audioAttributes>
</oemContext>
<oemContext name="oem_voice_command">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_CALL_ASSISTANT" />
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call_ring">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_alarm">
<audioAttributes>
<usage value="AUDIO_USAGE_ALARM" />
</audioAttributes>
</oemContext>
<oemContext name="oem_system_sound">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_EMERGENCY" />
<usage value="AUDIO_USAGE_SAFETY" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
</audioAttributes>
</oemContext>
</oemContexts>
<activationVolumeConfigs>
<activationVolumeConfig name="on_boot_config">
<activationVolumeConfigEntry maxActivationVolumePercentage="80" invocationType="onBoot" />
</activationVolumeConfig>
<activationVolumeConfig name="on_source_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="20" maxActivationVolumePercentage="80" invocationType="onSourceChanged" />
</activationVolumeConfig>
<activationVolumeConfig name="on_playback_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="10" maxActivationVolumePercentage="90" invocationType="onPlaybackChanged" />
</activationVolumeConfig>
</activationVolumeConfigs>
<mirroringDevices>
<mirroringDevice address="mirror_bus_device_1"/>
<mirroringDevice address="mirror_bus_device_2"/>
</mirroringDevices>
<zones>
<zone name="primary zone" isPrimary="true" audioZoneId="0" occupantZoneId="0">
<inputDevices>
<inputDevice address="fm_tuner" type="AUDIO_DEVICE_IN_FM_TUNER" />
<inputDevice address="built_in_mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" />
<inputDevice address="in_bus_device" type="AUDIO_DEVICE_IN_BUS" />
</inputDevices>
<zoneConfigs>
<zoneConfig name="primary zone config 0" isDefault="true">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device address="BUS00_MEDIA">
<context context="oem_music"/>
</device>
</group>
<group name="navvoicecommand" activationConfig="on_source_changed_config">
<device address="BUS02_NAV_GUIDANCE">
<context context="oem_voice_command"/>
</device>
</group>
<group name="telringvol" activationConfig="on_playback_changed_config">
<device address="BUS03_PHONE">
<context context="oem_call"/>
<context context="oem_call_ring"/>
</device>
</group>
<group name="systemalarm" activationConfig="on_source_changed_config">
<device address="BUS01_SYS_NOTIFICATION">
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="relaxed fading" isDefault="true">
</fadeConfig>
<fadeConfig name="aggressive fading">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_SAFETY" />
</audioAttributes>
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
<zoneConfig name="primary zone BT media">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" address="temp">
<context context="oem_music"/>
</device>
</group>
<group name="navvoicecommand" activationConfig="on_source_changed_config">
<device address="BUS02_NAV_GUIDANCE">
<context context="oem_voice_command"/>
</device>
</group>
<group name="telringvol" activationConfig="on_playback_changed_config">
<device address="BUS03_PHONE">
<context context="oem_call"/>
<context context="oem_call_ring"/>
</device>
</group>
<group name="systemalarm" activationConfig="on_source_changed_config">
<device address="BUS01_SYS_NOTIFICATION">
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="dynamic fading" isDefault="true">
</fadeConfig>
<fadeConfig name="aggressive fading">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_SAFETY" />
</audioAttributes>
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
<zoneConfig name="primary zone USB media">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device type="AUDIO_DEVICE_OUT_USB_HEADSET">
<context context="oem_music"/>
</device>
</group>
<group name="navvoicecommand" activationConfig="on_source_changed_config">
<device address="BUS02_NAV_GUIDANCE">
<context context="oem_voice_command"/>
</device>
</group>
<group name="telringvol" activationConfig="on_playback_changed_config">
<device address="BUS03_PHONE">
<context context="oem_call"/>
<context context="oem_call_ring"/>
</device>
</group>
<group name="systemalarm" activationConfig="on_source_changed_config">
<device address="BUS01_SYS_NOTIFICATION">
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="dynamic fading" isDefault="true">
</fadeConfig>
<fadeConfig name="aggressive fading">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_SAFETY" />
</audioAttributes>
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
</zoneConfigs>
</zone>
</zones>
</carAudioConfiguration>

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<carAudioConfiguration version="4">
<deviceConfigurations>
<deviceConfiguration name="useHalDuckingSignals" value="true" />
<deviceConfiguration name="useCoreAudioRouting" value="false" />
<deviceConfiguration name="useCoreAudioVolume" value="false" />
<deviceConfiguration name="useCarVolumeGroupMuting" value="true" />
</deviceConfigurations>
<oemContexts>
<oemContext name="oem_context">
<audioAttributes>
<audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
contentType="AUDIO_CONTENT_TYPE_SPEECH"
tags="oem=extension_8675309" />
</audioAttributes>
</oemContext>
<oemContext name="oem_music">
<audioAttributes>
<usage value="AUDIO_USAGE_MEDIA" />
<usage value="AUDIO_USAGE_GAME" />
<usage value="AUDIO_USAGE_UNKNOWN" />
</audioAttributes>
</oemContext>
<oemContext name="oem_notification">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION" />
<usage value="AUDIO_USAGE_NOTIFICATION_EVENT" />
</audioAttributes>
</oemContext>
<oemContext name="oem_voice_command">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANT" />
<usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
<usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_CALL_ASSISTANT" />
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING" />
</audioAttributes>
</oemContext>
<oemContext name="oem_call_ring">
<audioAttributes>
<usage value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE" />
</audioAttributes>
</oemContext>
<oemContext name="oem_alarm">
<audioAttributes>
<usage value="AUDIO_USAGE_ALARM" />
</audioAttributes>
</oemContext>
<oemContext name="oem_system_sound">
<audioAttributes>
<usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
<usage value="AUDIO_USAGE_EMERGENCY" />
<usage value="AUDIO_USAGE_SAFETY" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
</audioAttributes>
</oemContext>
</oemContexts>
<activationVolumeConfigs>
<activationVolumeConfig name="on_boot_config">
<activationVolumeConfigEntry maxActivationVolumePercentage="80" invocationType="onBoot" />
</activationVolumeConfig>
<activationVolumeConfig name="on_source_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="20" maxActivationVolumePercentage="80" invocationType="onSourceChanged" />
</activationVolumeConfig>
<activationVolumeConfig name="on_playback_changed_config">
<activationVolumeConfigEntry minActivationVolumePercentage="10" maxActivationVolumePercentage="90" invocationType="onPlaybackChanged" />
</activationVolumeConfig>
</activationVolumeConfigs>
<mirroringDevices>
<mirroringDevice address="mirror_bus_device_1"/>
<mirroringDevice address="mirror_bus_device_2"/>
</mirroringDevices>
<zones>
<zone name="primary zone" isPrimary="true" audioZoneId="0" occupantZoneId="0">
<inputDevices>
<inputDevice address="fm_tuner" type="AUDIO_DEVICE_IN_FM_TUNER" />
<inputDevice address="built_in_mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" />
<inputDevice address="in_bus_device" type="AUDIO_DEVICE_IN_BUS" />
</inputDevices>
<zoneConfigs>
<zoneConfig name="primary zone config 0" isDefault="true">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device address="BUS00_MEDIA">
<context context="oem_music"/>
</device>
</group>
<group name="navvoicecommand" activationConfig="on_source_changed_config">
<device address="BUS02_NAV_GUIDANCE">
<context context="oem_voice_command"/>
</device>
</group>
<group name="telringvol" activationConfig="on_playback_changed_config">
<device address="BUS03_PHONE">
<context context="oem_call"/>
<context context="oem_call_ring"/>
</device>
</group>
<group name="systemalarm" activationConfig="on_source_changed_config">
<device address="BUS01_SYS_NOTIFICATION">
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="relaxed fading" isDefault="true">
</fadeConfig>
<fadeConfig name="aggressive fading">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_SAFETY" />
</audioAttributes>
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
<zoneConfig name="primary zone BT media">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device type="TYPE_BLUETOOTH_A2DP" address="temp">
<context context="oem_music"/>
</device>
</group>
<group name="navvoicecommand" activationConfig="on_source_changed_config">
<device address="BUS02_NAV_GUIDANCE">
<context context="oem_voice_command"/>
</device>
</group>
<group name="telringvol" activationConfig="on_playback_changed_config">
<device address="BUS03_PHONE">
<context context="oem_call"/>
<context context="oem_call_ring"/>
</device>
</group>
<group name="systemalarm" activationConfig="on_source_changed_config">
<device address="BUS01_SYS_NOTIFICATION">
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="dynamic fading" isDefault="true">
</fadeConfig>
<fadeConfig name="aggressive fading">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_SAFETY" />
</audioAttributes>
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
<zoneConfig name="primary zone USB media">
<volumeGroups>
<group name="entertainment" activationConfig="on_boot_config">
<device type="TYPE_USB_HEADSET">
<context context="oem_music"/>
</device>
</group>
<group name="navvoicecommand" activationConfig="on_source_changed_config">
<device address="BUS02_NAV_GUIDANCE">
<context context="oem_voice_command"/>
</device>
</group>
<group name="telringvol" activationConfig="on_playback_changed_config">
<device address="BUS03_PHONE">
<context context="oem_call"/>
<context context="oem_call_ring"/>
</device>
</group>
<group name="systemalarm" activationConfig="on_source_changed_config">
<device address="BUS01_SYS_NOTIFICATION">
<context context="oem_alarm"/>
<context context="oem_system_sound"/>
<context context="oem_notification"/>
</device>
</group>
</volumeGroups>
<applyFadeConfigs>
<fadeConfig name="dynamic fading" isDefault="true">
</fadeConfig>
<fadeConfig name="aggressive fading">
<audioAttributes>
<usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
<usage value="AUDIO_USAGE_ANNOUNCEMENT" />
<usage value="AUDIO_USAGE_VEHICLE_STATUS" />
<usage value="AUDIO_USAGE_SAFETY" />
</audioAttributes>
</fadeConfig>
<fadeConfig name="disabled fading">
<audioAttributes>
<usage value="AUDIO_USAGE_EMERGENCY" />
</audioAttributes>
</fadeConfig>
</applyFadeConfigs>
</zoneConfig>
</zoneConfigs>
</zone>
</zones>
</carAudioConfiguration>

View File

@@ -0,0 +1,45 @@
// Copyright (C) 2024 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
xsd_config {
name: "car_audio_configuration_xsd",
srcs: ["car_audio_configuration.xsd"],
package_name: "android.hardware.automotive.audiocontrol",
nullability: true,
}
cc_defaults {
name: "car.audio.configuration.xsd.default",
static_libs: [
"libxml2",
],
generated_sources: [
"car_audio_configuration_xsd",
],
generated_headers: [
"car_audio_configuration_xsd",
],
header_libs: [
"libxsdc-utils",
],
}

View File

@@ -0,0 +1,331 @@
// Signature format: 2.0
package android.hardware.automotive.audiocontrol {
public enum ActivationType {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.ActivationType onBoot;
enum_constant public static final android.hardware.automotive.audiocontrol.ActivationType onPlaybackChanged;
enum_constant public static final android.hardware.automotive.audiocontrol.ActivationType onSourceChanged;
}
public class ActivationVolumeConfigEntryType {
ctor public ActivationVolumeConfigEntryType();
method @Nullable public android.hardware.automotive.audiocontrol.ActivationType getInvocationType();
method @Nullable public String getMaxActivationVolumePercentage();
method @Nullable public String getMinActivationVolumePercentage();
method public void setInvocationType(@Nullable android.hardware.automotive.audiocontrol.ActivationType);
method public void setMaxActivationVolumePercentage(@Nullable String);
method public void setMinActivationVolumePercentage(@Nullable String);
}
public class ActivationVolumeConfigType {
ctor public ActivationVolumeConfigType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.ActivationVolumeConfigEntryType> getActivationVolumeConfigEntry();
method @Nullable public String getName();
method public void setName(@Nullable String);
}
public class ActivationVolumeConfigsType {
ctor public ActivationVolumeConfigsType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.ActivationVolumeConfigType> getActivationVolumeConfig();
}
public class ApplyFadeConfigType {
ctor public ApplyFadeConfigType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.AudioAttributeUsagesType> getAudioAttributes();
method @Nullable public boolean getIsDefault();
method @Nullable public String getName();
method public void setIsDefault(@Nullable boolean);
method public void setName(@Nullable String);
}
public class ApplyFadeConfigsType {
ctor public ApplyFadeConfigsType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.ApplyFadeConfigType> getFadeConfig();
}
public class AttributesType {
ctor public AttributesType();
method @Nullable public android.hardware.automotive.audiocontrol.ContentTypeEnum getContentType();
method @Nullable public String getTags();
method @Nullable public android.hardware.automotive.audiocontrol.UsageEnumType getUsage();
method public void setContentType(@Nullable android.hardware.automotive.audiocontrol.ContentTypeEnum);
method public void setTags(@Nullable String);
method public void setUsage(@Nullable android.hardware.automotive.audiocontrol.UsageEnumType);
}
public class AudioAttributeUsagesType {
ctor public AudioAttributeUsagesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.UsageType> getUsage();
}
public class AudioAttributesUsagesType {
ctor public AudioAttributesUsagesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.AttributesType> getAudioAttribute_optional();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.UsageType> getUsage_optional();
}
public class CarAudioConfigurationType {
ctor public CarAudioConfigurationType();
method @Nullable public android.hardware.automotive.audiocontrol.ActivationVolumeConfigsType getActivationVolumeConfigs();
method @Nullable public android.hardware.automotive.audiocontrol.DeviceConfigurationsType getDeviceConfigurations();
method @Nullable public android.hardware.automotive.audiocontrol.MirroringDevicesType getMirroringDevices();
method @Nullable public android.hardware.automotive.audiocontrol.OemContextsType getOemContexts();
method @Nullable public String getVersion();
method @Nullable public android.hardware.automotive.audiocontrol.ZonesType getZones();
method public void setActivationVolumeConfigs(@Nullable android.hardware.automotive.audiocontrol.ActivationVolumeConfigsType);
method public void setDeviceConfigurations(@Nullable android.hardware.automotive.audiocontrol.DeviceConfigurationsType);
method public void setMirroringDevices(@Nullable android.hardware.automotive.audiocontrol.MirroringDevicesType);
method public void setOemContexts(@Nullable android.hardware.automotive.audiocontrol.OemContextsType);
method public void setVersion(@Nullable String);
method public void setZones(@Nullable android.hardware.automotive.audiocontrol.ZonesType);
}
public class ContentType {
ctor public ContentType();
method @Nullable public android.hardware.automotive.audiocontrol.ContentTypeEnum getValue();
method public void setValue(@Nullable android.hardware.automotive.audiocontrol.ContentTypeEnum);
}
public enum ContentTypeEnum {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.ContentTypeEnum AUDIO_CONTENT_TYPE_MOVIE;
enum_constant public static final android.hardware.automotive.audiocontrol.ContentTypeEnum AUDIO_CONTENT_TYPE_MUSIC;
enum_constant public static final android.hardware.automotive.audiocontrol.ContentTypeEnum AUDIO_CONTENT_TYPE_SONIFICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.ContentTypeEnum AUDIO_CONTENT_TYPE_SPEECH;
enum_constant public static final android.hardware.automotive.audiocontrol.ContentTypeEnum AUDIO_CONTENT_TYPE_UNKNOWN;
}
public class ContextNameType {
ctor public ContextNameType();
method @Nullable public String getContext();
method public void setContext(@Nullable String);
}
public class DeviceConfigurationType {
ctor public DeviceConfigurationType();
method @Nullable public String getName();
method @Nullable public String getValue();
method public void setName(@Nullable String);
method public void setValue(@Nullable String);
}
public class DeviceConfigurationsType {
ctor public DeviceConfigurationsType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.DeviceConfigurationType> getDeviceConfiguration();
}
public class DeviceRoutesType {
ctor public DeviceRoutesType();
method @Nullable public String getAddress();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.ContextNameType> getContext();
method @Nullable public android.hardware.automotive.audiocontrol.OutDeviceType getType();
method public void setAddress(@Nullable String);
method public void setType(@Nullable android.hardware.automotive.audiocontrol.OutDeviceType);
}
public enum InDeviceType {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_AMBIENT;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_AUX_DIGITAL;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_BACK_MIC;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_BLUETOOTH_A2DP;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_BLUETOOTH_BLE;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_BUILTIN_MIC;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_BUS;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_COMMUNICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_DEFAULT;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_ECHO_REFERENCE;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_FM_TUNER;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_HDMI;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_HDMI_ARC;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_IP;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_LINE;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_LOOPBACK;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_PROXY;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_REMOTE_SUBMIX;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_SPDIF;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_STUB;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_TELEPHONY_RX;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_TV_TUNER;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_USB_ACCESSORY;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_USB_DEVICE;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_USB_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_VOICE_CALL;
enum_constant public static final android.hardware.automotive.audiocontrol.InDeviceType AUDIO_DEVICE_IN_WIRED_HEADSET;
}
public class InputDeviceType {
ctor public InputDeviceType();
method @Nullable public String getAddress();
method @Nullable public android.hardware.automotive.audiocontrol.InDeviceType getType();
method public void setAddress(@Nullable String);
method public void setType(@Nullable android.hardware.automotive.audiocontrol.InDeviceType);
}
public class InputDevicesType {
ctor public InputDevicesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.InputDeviceType> getInputDevice();
}
public class MirroringDevice {
ctor public MirroringDevice();
method @Nullable public String getAddress();
method public void setAddress(@Nullable String);
}
public class MirroringDevicesType {
ctor public MirroringDevicesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.MirroringDevice> getMirroringDevice();
}
public class OemContextType {
ctor public OemContextType();
method @Nullable public android.hardware.automotive.audiocontrol.AudioAttributesUsagesType getAudioAttributes();
method @Nullable public String getId();
method @Nullable public String getName();
method public void setAudioAttributes(@Nullable android.hardware.automotive.audiocontrol.AudioAttributesUsagesType);
method public void setId(@Nullable String);
method public void setName(@Nullable String);
}
public class OemContextsType {
ctor public OemContextsType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.OemContextType> getOemContext();
}
public enum OutDeviceType {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_AUX_DIGITAL;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_AUX_LINE;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_BLE_BROADCAST;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_BLE_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_BLE_SPEAKER;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_BUS;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_DEFAULT;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_HDMI;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_HDMI_ARC;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_HDMI_EARC;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_LINE;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_SPEAKER;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_SPEAKER_SAFE;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_USB_ACCESSORY;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_USB_DEVICE;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_USB_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType AUDIO_DEVICE_OUT_WIRED_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_AUX_LINE;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_BLE_BROADCAST;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_BLE_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_BLE_SPEAKER;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_BLUETOOTH_A2DP;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_BUILTIN_SPEAKER;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_BUS;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_HDMI;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_USB_ACCESSORY;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_USB_DEVICE;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_USB_HEADSET;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_WIRED_HEADPHONES;
enum_constant public static final android.hardware.automotive.audiocontrol.OutDeviceType TYPE_WIRED_HEADSET;
}
public enum UsageEnumType {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_ALARM;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_ANNOUNCEMENT;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_ASSISTANCE_SONIFICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_ASSISTANT;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_CALL_ASSISTANT;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_EMERGENCY;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_GAME;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_MEDIA;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_NOTIFICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_NOTIFICATION_EVENT;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_SAFETY;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_UNKNOWN;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_VEHICLE_STATUS;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_VIRTUAL_SOURCE;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_VOICE_COMMUNICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.UsageEnumType AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING;
}
public class UsageType {
ctor public UsageType();
method @Nullable public android.hardware.automotive.audiocontrol.UsageEnumType getValue();
method public void setValue(@Nullable android.hardware.automotive.audiocontrol.UsageEnumType);
}
public class VolumeGroupType {
ctor public VolumeGroupType();
method @Nullable public String getActivationConfig();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.DeviceRoutesType> getDevice();
method @Nullable public String getName();
method public void setActivationConfig(@Nullable String);
method public void setName(@Nullable String);
}
public class VolumeGroupsType {
ctor public VolumeGroupsType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.VolumeGroupType> getGroup();
}
public class XmlParser {
ctor public XmlParser();
method @Nullable public static android.hardware.automotive.audiocontrol.CarAudioConfigurationType read(@NonNull java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method @Nullable public static String readText(@NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static void skip(@NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
}
public class ZoneConfigType {
ctor public ZoneConfigType();
method @Nullable public android.hardware.automotive.audiocontrol.ApplyFadeConfigsType getApplyFadeConfigs();
method @Nullable public boolean getIsDefault();
method @Nullable public String getName();
method @Nullable public android.hardware.automotive.audiocontrol.VolumeGroupsType getVolumeGroups();
method public void setApplyFadeConfigs(@Nullable android.hardware.automotive.audiocontrol.ApplyFadeConfigsType);
method public void setIsDefault(@Nullable boolean);
method public void setName(@Nullable String);
method public void setVolumeGroups(@Nullable android.hardware.automotive.audiocontrol.VolumeGroupsType);
}
public class ZoneConfigsType {
ctor public ZoneConfigsType();
method @Nullable public android.hardware.automotive.audiocontrol.ZoneConfigType getZoneConfig();
method public void setZoneConfig(@Nullable android.hardware.automotive.audiocontrol.ZoneConfigType);
}
public class ZoneType {
ctor public ZoneType();
method @Nullable public String getAudioZoneId();
method @Nullable public android.hardware.automotive.audiocontrol.InputDevicesType getInputDevices();
method @Nullable public boolean getIsPrimary();
method @Nullable public String getName();
method @Nullable public String getOccupantZoneId();
method @Nullable public android.hardware.automotive.audiocontrol.ZoneConfigsType getZoneConfigs();
method public void setAudioZoneId(@Nullable String);
method public void setInputDevices(@Nullable android.hardware.automotive.audiocontrol.InputDevicesType);
method public void setIsPrimary(@Nullable boolean);
method public void setName(@Nullable String);
method public void setOccupantZoneId(@Nullable String);
method public void setZoneConfigs(@Nullable android.hardware.automotive.audiocontrol.ZoneConfigsType);
}
public class ZonesType {
ctor public ZonesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.ZoneType> getZone();
}
}

View File

@@ -0,0 +1 @@
// Signature format: 2.0

View File

@@ -0,0 +1,248 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2024 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.
-->
<xs:schema version="2.0" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="carAudioConfiguration" type="CarAudioConfigurationType" minOccurs="1" maxOccurs="1" />
<xs:complexType name="CarAudioConfigurationType">
<xs:attribute name="version" type="xs:string" use="required" />
<xs:sequence>
<xs:element name="mirroringDevices" type="MirroringDevicesType" minOccurs="0" />
<xs:element name="deviceConfigurations" type="DeviceConfigurationsType" minOccurs="0" />
<xs:element name="oemContexts" type="OemContextsType" />
<xs:element name="activationVolumeConfigs" type="ActivationVolumeConfigsType" minOccurs="0" />
<xs:element name="zones" type="ZonesType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ZonesType">
<xs:element name="zone" type="ZoneType" minOccurs="1" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="ActivationVolumeConfigsType">
<xs:element name="activationVolumeConfig" type="ActivationVolumeConfigType" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="OemContextsType">
<xs:element name="oemContext" type="OemContextType" minOccurs="1" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="DeviceConfigurationsType">
<xs:element name="deviceConfiguration" type="DeviceConfigurationType" minOccurs="0" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="ZoneType">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="audioZoneId" type="xs:string" use="required" />
<xs:attribute name="isPrimary" type="xs:boolean" />
<xs:attribute name="occupantZoneId" type="xs:string" />
<xs:element name="inputDevices" type="InputDevicesType" />
<xs:element name="zoneConfigs" type="ZoneConfigsType" />
</xs:complexType>
<xs:complexType name="ZoneConfigsType">
<xs:element name="zoneConfig" type="ZoneConfigType"/>
</xs:complexType>
<xs:complexType name="ZoneConfigType">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="isDefault" type="xs:boolean" />
<xs:element name="volumeGroups" type="VolumeGroupsType" />
<xs:element name="applyFadeConfigs" type="ApplyFadeConfigsType" />
</xs:complexType>
<xs:complexType name="ApplyFadeConfigsType">
<xs:element name="fadeConfig" type="ApplyFadeConfigType" minOccurs="0" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="ApplyFadeConfigType">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="isDefault" type="xs:boolean" />
<xs:element name="audioAttributes" type="AudioAttributeUsagesType" minOccurs="0" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="AudioAttributeUsagesType">
<xs:element name="usage" type="UsageType" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="VolumeGroupsType">
<xs:element name="group" type="VolumeGroupType" minOccurs="1" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="VolumeGroupType">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="activationConfig" type="xs:string" />
<xs:element name="device" type="DeviceRoutesType" minOccurts="1" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="DeviceRoutesType" >
<xs:attribute name="address" type="xs:string" />
<xs:attribute name="type" type="OutDeviceType" />
<xs:element name="context" type="ContextNameType" mixOccurs="1" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="ContextNameType">
<xs:attribute name="context" type="xs:string"/>
</xs:complexType>
<xs:complexType name="OemContextType">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="id" type="xs:string" />
<xs:element name="audioAttributes" type="AudioAttributesUsagesType" minOccurs="1" maxOccurs="1" />
</xs:complexType>
<xs:complexType name="AudioAttributesUsagesType" >
<xs:choice minOccurs="0" maxOccurs="unbounded" >
<xs:element name="audioAttribute" type="AttributesType" />
<xs:element name="usage" type="UsageType" />
</xs:choice>
</xs:complexType>
<xs:complexType name="AttributesType">
<xs:attribute name="contentType" type="contentTypeEnum" />
<xs:attribute name="usage" type="usageEnumType" />
<xs:attribute name="tags" type="xs:string" />
</xs:complexType>
<xs:complexType name="DeviceConfigurationType">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="value" type="xs:string" />
</xs:complexType>
<xs:complexType name="ContentType" >
<xs:attribute name="value" type="contentTypeEnum" use="required" />
</xs:complexType>
<xs:complexType name="UsageType">
<xs:attribute name="value" type="usageEnumType" use="required" />
</xs:complexType>
<xs:simpleType name="contentTypeEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="AUDIO_CONTENT_TYPE_UNKNOWN"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_SPEECH"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_MUSIC"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_MOVIE"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_SONIFICATION"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="usageEnumType">
<xs:restriction base="xs:string">
<xs:enumeration value="AUDIO_USAGE_UNKNOWN"/>
<xs:enumeration value="AUDIO_USAGE_MEDIA"/>
<xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION"/>
<xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING"/>
<xs:enumeration value="AUDIO_USAGE_ALARM"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"/>
<!-- Note: the following 3 values were deprecated in Android T (13) SDK -->
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_EVENT"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION"/>
<xs:enumeration value="AUDIO_USAGE_GAME"/>
<xs:enumeration value="AUDIO_USAGE_VIRTUAL_SOURCE"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANT"/>
<xs:enumeration value="AUDIO_USAGE_CALL_ASSISTANT"/>
<xs:enumeration value="AUDIO_USAGE_EMERGENCY" />
<xs:enumeration value="AUDIO_USAGE_SAFETY" />
<xs:enumeration value="AUDIO_USAGE_VEHICLE_STATUS" />
<xs:enumeration value="AUDIO_USAGE_ANNOUNCEMENT" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ActivationVolumeConfigType">
<xs:attribute name="name" type="xs:string" />
<xs:element name="activationVolumeConfigEntry" type="ActivationVolumeConfigEntryType" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="ActivationVolumeConfigEntryType">
<xs:attribute name="maxActivationVolumePercentage" type="xs:string" />
<xs:attribute name="minActivationVolumePercentage" type="xs:string" />
<xs:attribute name="invocationType" type="ActivationType" />
</xs:complexType>
<xs:simpleType name="ActivationType">
<xs:restriction base="xs:string">
<xs:enumeration value="onBoot"/>
<xs:enumeration value="onSourceChanged"/>
<xs:enumeration value="onPlaybackChanged"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="OutDeviceType">
<xs:restriction base="xs:string">
<xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADPHONE"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_EARC"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_USB_DEVICE"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_LINE"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_ARC"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_AUX_LINE"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER_SAFE"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BUS"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLE_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLE_SPEAKER"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLE_BROADCAST"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/>
<!-- Added to support legacy files -->
<xs:enumeration value="TYPE_BUILTIN_SPEAKER"/>
<xs:enumeration value="TYPE_WIRED_HEADSET"/>
<xs:enumeration value="TYPE_WIRED_HEADPHONES"/>
<xs:enumeration value="TYPE_BLUETOOTH_A2DP"/>
<xs:enumeration value="TYPE_HDMI"/>
<xs:enumeration value="TYPE_USB_ACCESSORY"/>
<xs:enumeration value="TYPE_USB_DEVICE"/>
<xs:enumeration value="TYPE_USB_HEADSET"/>
<xs:enumeration value="TYPE_AUX_LINE"/>
<xs:enumeration value="TYPE_BUS"/>
<xs:enumeration value="TYPE_BLE_HEADSET"/>
<xs:enumeration value="TYPE_BLE_SPEAKER"/>
<xs:enumeration value="TYPE_BLE_BROADCAST"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="MirroringDevicesType">
<xs:element name="mirroringDevice" type="MirroringDevice" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="MirroringDevice">
<xs:attribute name="address" type="xs:string" />
</xs:complexType>
<xs:complexType name="InputDevicesType">
<xs:element name="inputDevice" type="InputDeviceType" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="InputDeviceType">
<xs:attribute name="address" type="xs:string" />
<xs:attribute name="type" type="InDeviceType" />
</xs:complexType>
<xs:simpleType name="InDeviceType">
<xs:restriction base="xs:string">
<xs:enumeration value="AUDIO_DEVICE_IN_COMMUNICATION"/>
<xs:enumeration value="AUDIO_DEVICE_IN_AMBIENT"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_WIRED_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/>
<xs:enumeration value="AUDIO_DEVICE_IN_HDMI"/>
<xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/>
<xs:enumeration value="AUDIO_DEVICE_IN_TELEPHONY_RX"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BACK_MIC"/>
<xs:enumeration value="AUDIO_DEVICE_IN_REMOTE_SUBMIX"/>
<xs:enumeration value="AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_USB_ACCESSORY"/>
<xs:enumeration value="AUDIO_DEVICE_IN_USB_DEVICE"/>
<xs:enumeration value="AUDIO_DEVICE_IN_FM_TUNER"/>
<xs:enumeration value="AUDIO_DEVICE_IN_TV_TUNER"/>
<xs:enumeration value="AUDIO_DEVICE_IN_LINE"/>
<xs:enumeration value="AUDIO_DEVICE_IN_SPDIF"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_A2DP"/>
<xs:enumeration value="AUDIO_DEVICE_IN_LOOPBACK"/>
<xs:enumeration value="AUDIO_DEVICE_IN_IP"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BUS"/>
<xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/>
<xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/>
<xs:enumeration value="AUDIO_DEVICE_IN_HDMI_ARC"/>
<xs:enumeration value="AUDIO_DEVICE_IN_ECHO_REFERENCE"/>
<xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
<xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,45 @@
// Copyright (C) 2024 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
xsd_config {
name: "car_fade_audio_configuration_xsd",
srcs: ["car_fade_audio_configuration.xsd"],
package_name: "android.hardware.automotive.audiocontrol.fade",
nullability: true,
}
cc_defaults {
name: "car.fade.configuration.xsd.default",
static_libs: [
"libxml2",
],
generated_sources: [
"car_fade_audio_configuration_xsd",
],
generated_headers: [
"car_fade_audio_configuration_xsd",
],
header_libs: [
"libxsdc-utils",
],
}

View File

@@ -0,0 +1,160 @@
// Signature format: 2.0
package android.hardware.automotive.audiocontrol.fade {
public class AttributesType {
ctor public AttributesType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.ContentTypeEnum getContentType();
method @Nullable public String getTags();
method @Nullable public android.hardware.automotive.audiocontrol.fade.UsageEnumType getUsage();
method public void setContentType(@Nullable android.hardware.automotive.audiocontrol.fade.ContentTypeEnum);
method public void setTags(@Nullable String);
method public void setUsage(@Nullable android.hardware.automotive.audiocontrol.fade.UsageEnumType);
}
public class AudioAttributesUsagesType {
ctor public AudioAttributesUsagesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.fade.AttributesType> getAudioAttribute_optional();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.fade.UsageType> getUsage_optional();
}
public class CarAudioFadeConfigurationType {
ctor public CarAudioFadeConfigurationType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeConfigurationConfigs getConfigs();
method public void setConfigs(@Nullable android.hardware.automotive.audiocontrol.fade.FadeConfigurationConfigs);
}
public class ContentType {
ctor public ContentType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.ContentTypeEnum getValue();
method public void setValue(@Nullable android.hardware.automotive.audiocontrol.fade.ContentTypeEnum);
}
public enum ContentTypeEnum {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.fade.ContentTypeEnum AUDIO_CONTENT_TYPE_MOVIE;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.ContentTypeEnum AUDIO_CONTENT_TYPE_MUSIC;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.ContentTypeEnum AUDIO_CONTENT_TYPE_SONIFICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.ContentTypeEnum AUDIO_CONTENT_TYPE_SPEECH;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.ContentTypeEnum AUDIO_CONTENT_TYPE_UNKNOWN;
}
public class FadeConfigurationConfig {
ctor public FadeConfigurationConfig();
method @Nullable public String getDefaultFadeInDelayForOffenders();
method @Nullable public String getDefaultFadeInDurationInMillis();
method @Nullable public String getDefaultFadeOutDurationInMillis();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeInConfigurationsType getFadeInConfigurations();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeOutConfigurationsType getFadeOutConfigurations();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeStateType getFadeState();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeableUsagesType getFadeableUsages();
method @Nullable public String getName();
method @Nullable public android.hardware.automotive.audiocontrol.fade.UnfadeableAudioAttributesType getUnfadeableAudioAttributes();
method @Nullable public android.hardware.automotive.audiocontrol.fade.UnfadeableContentTypesType getUnfadeableContentTypes();
method public void setDefaultFadeInDelayForOffenders(@Nullable String);
method public void setDefaultFadeInDurationInMillis(@Nullable String);
method public void setDefaultFadeOutDurationInMillis(@Nullable String);
method public void setFadeInConfigurations(@Nullable android.hardware.automotive.audiocontrol.fade.FadeInConfigurationsType);
method public void setFadeOutConfigurations(@Nullable android.hardware.automotive.audiocontrol.fade.FadeOutConfigurationsType);
method public void setFadeState(@Nullable android.hardware.automotive.audiocontrol.fade.FadeStateType);
method public void setFadeableUsages(@Nullable android.hardware.automotive.audiocontrol.fade.FadeableUsagesType);
method public void setName(@Nullable String);
method public void setUnfadeableAudioAttributes(@Nullable android.hardware.automotive.audiocontrol.fade.UnfadeableAudioAttributesType);
method public void setUnfadeableContentTypes(@Nullable android.hardware.automotive.audiocontrol.fade.UnfadeableContentTypesType);
}
public class FadeConfigurationConfigs {
ctor public FadeConfigurationConfigs();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.fade.FadeConfigurationConfig> getConfig();
}
public class FadeConfigurationType {
ctor public FadeConfigurationType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.AudioAttributesUsagesType getAudioAttributes();
method @Nullable public String getFadeDurationMillis();
method public void setAudioAttributes(@Nullable android.hardware.automotive.audiocontrol.fade.AudioAttributesUsagesType);
method public void setFadeDurationMillis(@Nullable String);
}
public class FadeInConfigurationsType {
ctor public FadeInConfigurationsType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeConfigurationType getFadeConfiguration();
method public void setFadeConfiguration(@Nullable android.hardware.automotive.audiocontrol.fade.FadeConfigurationType);
}
public class FadeOutConfigurationsType {
ctor public FadeOutConfigurationsType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeConfigurationType getFadeConfiguration();
method public void setFadeConfiguration(@Nullable android.hardware.automotive.audiocontrol.fade.FadeConfigurationType);
}
public enum FadeStateEnumType {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.fade.FadeStateEnumType FADE_STATE_DISABLED;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.FadeStateEnumType FADE_STATE_ENABLED_DEFAULT;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.FadeStateEnumType _0;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.FadeStateEnumType _1;
}
public class FadeStateType {
ctor public FadeStateType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.FadeStateEnumType getValue();
method public void setValue(@Nullable android.hardware.automotive.audiocontrol.fade.FadeStateEnumType);
}
public class FadeableUsagesType {
ctor public FadeableUsagesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.fade.UsageType> getUsage();
}
public class UnfadeableAudioAttributesType {
ctor public UnfadeableAudioAttributesType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.AudioAttributesUsagesType getAudioAttributes();
method public void setAudioAttributes(@Nullable android.hardware.automotive.audiocontrol.fade.AudioAttributesUsagesType);
}
public class UnfadeableContentTypesType {
ctor public UnfadeableContentTypesType();
method @Nullable public java.util.List<android.hardware.automotive.audiocontrol.fade.ContentType> getContentType();
}
public enum UsageEnumType {
method @NonNull public String getRawName();
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_ALARM;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_ANNOUNCEMENT;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_ASSISTANCE_SONIFICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_ASSISTANT;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_CALL_ASSISTANT;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_EMERGENCY;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_GAME;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_MEDIA;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_NOTIFICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_NOTIFICATION_EVENT;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_SAFETY;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_UNKNOWN;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_VEHICLE_STATUS;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_VIRTUAL_SOURCE;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_VOICE_COMMUNICATION;
enum_constant public static final android.hardware.automotive.audiocontrol.fade.UsageEnumType AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING;
}
public class UsageType {
ctor public UsageType();
method @Nullable public android.hardware.automotive.audiocontrol.fade.UsageEnumType getValue();
method public void setValue(@Nullable android.hardware.automotive.audiocontrol.fade.UsageEnumType);
}
public class XmlParser {
ctor public XmlParser();
method @Nullable public static android.hardware.automotive.audiocontrol.fade.CarAudioFadeConfigurationType read(@NonNull java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method @Nullable public static String readText(@NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static void skip(@NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
}
}

View File

@@ -0,0 +1 @@
// Signature format: 2.0

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2024 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.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="2.0">
<xs:element name="carAudioFadeConfiguration" type="CarAudioFadeConfigurationType" />
<xs:complexType name="CarAudioFadeConfigurationType">
<xs:element name="configs" type="FadeConfigurationConfigs" />
</xs:complexType>
<xs:complexType name="FadeConfigurationConfigs">
<xs:element name="config" type="FadeConfigurationConfig" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="FadeConfigurationConfig">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="defaultFadeOutDurationInMillis" type="xs:string" />
<xs:attribute name="defaultFadeInDurationInMillis" type="xs:string" />
<xs:attribute name="defaultFadeInDelayForOffenders" type="xs:string" />
<xs:element name="fadeState" type="FadeStateType" />
<xs:element name="fadeableUsages" type="FadeableUsagesType" />
<xs:element name="unfadeableContentTypes" type="UnfadeableContentTypesType" />
<xs:element name="unfadeableAudioAttributes" type="UnfadeableAudioAttributesType" />
<xs:element name="fadeOutConfigurations" type="FadeOutConfigurationsType" />
<xs:element name="fadeInConfigurations" type="FadeInConfigurationsType" />
</xs:complexType>
<xs:complexType name="FadeStateType">
<xs:attribute name="value" type="fadeStateEnumType" />
</xs:complexType>
<xs:simpleType name="fadeStateEnumType" >
<xs:restriction base="xs:string">
<xs:enumeration value="0" />
<xs:enumeration value="1" />
<xs:enumeration value="FADE_STATE_DISABLED" />
<xs:enumeration value="FADE_STATE_ENABLED_DEFAULT" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="FadeableUsagesType">
<xs:element name="usage" type="UsageType" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="UsageType">
<xs:attribute name="value" type="usageEnumType" />
</xs:complexType>
<xs:simpleType name="usageEnumType">
<xs:restriction base="xs:string">
<xs:enumeration value="AUDIO_USAGE_UNKNOWN"/>
<xs:enumeration value="AUDIO_USAGE_MEDIA"/>
<xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION"/>
<xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING"/>
<xs:enumeration value="AUDIO_USAGE_ALARM"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_EVENT"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION"/>
<xs:enumeration value="AUDIO_USAGE_GAME"/>
<xs:enumeration value="AUDIO_USAGE_VIRTUAL_SOURCE"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANT"/>
<xs:enumeration value="AUDIO_USAGE_CALL_ASSISTANT"/>
<xs:enumeration value="AUDIO_USAGE_EMERGENCY" />
<xs:enumeration value="AUDIO_USAGE_SAFETY" />
<xs:enumeration value="AUDIO_USAGE_VEHICLE_STATUS" />
<xs:enumeration value="AUDIO_USAGE_ANNOUNCEMENT" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="UnfadeableContentTypesType">
<xs:element name="contentType" type="ContentType" maxOccurs="unbounded" />
</xs:complexType>
<xs:complexType name="ContentType">
<xs:attribute name="value" type="contentTypeEnum" />
</xs:complexType>
<xs:simpleType name="contentTypeEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="AUDIO_CONTENT_TYPE_UNKNOWN"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_SPEECH"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_MUSIC"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_MOVIE"/>
<xs:enumeration value="AUDIO_CONTENT_TYPE_SONIFICATION"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="UnfadeableAudioAttributesType">
<xs:element name="audioAttributes" type="AudioAttributesUsagesType" />
</xs:complexType>
<xs:complexType name="AudioAttributesUsagesType" >
<xs:choice minOccurs="0" maxOccurs="unbounded" >
<xs:element name="audioAttribute" type="AttributesType" />
<xs:element name="usage" type="UsageType" />
</xs:choice>
</xs:complexType>
<xs:complexType name="AttributesType">
<xs:attribute name="contentType" type="contentTypeEnum" />
<xs:attribute name="usage" type="usageEnumType" />
<xs:attribute name="tags" type="xs:string" />
</xs:complexType>
<xs:complexType name="FadeOutConfigurationsType">
<xs:element name="fadeConfiguration" type="FadeConfigurationType" />
</xs:complexType>
<xs:complexType name="FadeConfigurationType">
<xs:attribute name="fadeDurationMillis" type="xs:string" />
<xs:element name="audioAttributes" type="AudioAttributesUsagesType" />
</xs:complexType>
<xs:complexType name="FadeInConfigurationsType">
<xs:element name="fadeConfiguration" type="FadeConfigurationType" />
</xs:complexType>
</xs:schema>

View File

@@ -15,7 +15,7 @@
*/
rust_binary {
name: "android.hardware.automotive.audiocontrol-V4-rust-service",
name: "android.hardware.automotive.audiocontrol-rust-service",
relative_install_path: "hw",
vendor: true,
srcs: ["src/*.rs"],
@@ -23,6 +23,7 @@ rust_binary {
defaults: [
"latest_android_hardware_automotive_audiocontrol_rust",
"latest_android_hardware_audio_common_rust",
"latest_android_media_audio_common_types_rust",
],
vintf_fragments: ["audiocontrol-rust-service.xml"],
init_rc: ["audiocontrol-rust-service.rc"],

View File

@@ -6,7 +6,7 @@ not contain any actual implementation.
This folder contains a skeleton audio control HAL implementation in Rust to
demonstrate how vendor may implement a Rust audio control HAL. To run this
audio control HAL, include
`android.hardware.automotive.audiocontrol-V4-rust-service` in your image.
`android.hardware.automotive.audiocontrol-rust-service` in your image.
This implementation returns `StatusCode::UNKNOWN_ERROR` for all operations
and does not pass VTS/CTS. Vendor must replace the logic in

View File

@@ -23,8 +23,15 @@ use android_hardware_automotive_audiocontrol::aidl::android::hardware::automotiv
IModuleChangeCallback::IModuleChangeCallback,
MutingInfo::MutingInfo,
Reasons::Reasons,
AudioDeviceConfiguration::AudioDeviceConfiguration,
AudioZone::AudioZone
};
use android_hardware_audio_common::aidl::android::hardware::audio::common::{
PlaybackTrackMetadata::PlaybackTrackMetadata,
};
use android_media_audio_common_types::aidl::android::media::audio::common::{
AudioPort::AudioPort,
};
use android_hardware_audio_common::aidl::android::hardware::audio::common::PlaybackTrackMetadata::PlaybackTrackMetadata;
use binder::{Interface, Result as BinderResult, StatusCode, Strong};
/// This struct is defined to implement IAudioControl AIDL interface.
@@ -81,4 +88,16 @@ impl IAudioControl for DefaultAudioControlHal {
fn clearModuleChangeCallback(&self) -> BinderResult<()> {
Err(StatusCode::UNKNOWN_ERROR.into())
}
fn getAudioDeviceConfiguration(&self) -> std::result::Result<AudioDeviceConfiguration, binder::Status> {
Err(binder::StatusCode::UNKNOWN_ERROR.into())
}
fn getOutputMirroringDevices(&self) -> std::result::Result<std::vec::Vec<AudioPort>, binder::Status> {
Err(binder::StatusCode::UNKNOWN_ERROR.into())
}
fn getCarAudioZones(&self) -> std::result::Result<std::vec::Vec<AudioZone>, binder::Status> {
Err(binder::StatusCode::UNKNOWN_ERROR.into())
}
}

View File

@@ -22,6 +22,25 @@ package {
default_applicable_licenses: ["hardware_interfaces_license"],
}
cc_library {
name: "AudioControlHalTestUtils",
srcs: [
"src/AudioControlTestUtils.cpp",
],
export_include_dirs: [
"include",
],
defaults: [
"latest_android_hardware_audio_common_cpp_static",
"latest_android_hardware_automotive_audiocontrol_cpp_static",
"latest_android_media_audio_common_types_cpp_static",
],
shared_libs: [
"libbase",
"libutils",
],
}
cc_test {
name: "VtsAidlHalAudioControlTest",
defaults: [
@@ -39,9 +58,11 @@ cc_test {
"libbinder",
"libbase",
"libxml2",
"libutils",
],
static_libs: [
"libgmock",
"AudioControlHalTestUtils",
],
test_suites: [
"general-tests",

View File

@@ -18,6 +18,8 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <gmock/gmock.h>
#include <utils/String16.h>
#include <set>
#include <android/hardware/automotive/audiocontrol/BnAudioGainCallback.h>
#include <android/hardware/automotive/audiocontrol/BnFocusListener.h>
@@ -26,24 +28,49 @@
#include <android/log.h>
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
#include <include/AudioControlTestUtils.h>
using android::ProcessState;
using android::sp;
using android::String16;
using android::binder::Status;
using android::hardware::automotive::audiocontrol::AudioDeviceConfiguration;
using android::hardware::automotive::audiocontrol::AudioFadeConfiguration;
using android::hardware::automotive::audiocontrol::AudioFocusChange;
using android::hardware::automotive::audiocontrol::AudioGainConfigInfo;
using android::hardware::automotive::audiocontrol::AudioZone;
using android::hardware::automotive::audiocontrol::AudioZoneConfig;
using android::hardware::automotive::audiocontrol::AudioZoneContextInfo;
using android::hardware::automotive::audiocontrol::AudioZoneFadeConfiguration;
using android::hardware::automotive::audiocontrol::BnAudioGainCallback;
using android::hardware::automotive::audiocontrol::BnFocusListener;
using android::hardware::automotive::audiocontrol::BnModuleChangeCallback;
using android::hardware::automotive::audiocontrol::DeviceToContextEntry;
using android::hardware::automotive::audiocontrol::DuckingInfo;
using android::hardware::automotive::audiocontrol::FadeConfiguration;
using android::hardware::automotive::audiocontrol::IAudioControl;
using android::hardware::automotive::audiocontrol::IModuleChangeCallback;
using android::hardware::automotive::audiocontrol::MutingInfo;
using android::hardware::automotive::audiocontrol::Reasons;
using android::hardware::automotive::audiocontrol::VolumeActivationConfiguration;
using android::hardware::automotive::audiocontrol::VolumeActivationConfigurationEntry;
using android::hardware::automotive::audiocontrol::VolumeGroupConfig;
using android::hardware::automotive::audiocontrol::RoutingDeviceConfiguration::
CONFIGURABLE_AUDIO_ENGINE_ROUTING;
using android::hardware::automotive::audiocontrol::RoutingDeviceConfiguration::
DEFAULT_AUDIO_ROUTING;
using android::hardware::automotive::audiocontrol::VolumeActivationConfigurationEntry::
DEFAULT_MAX_ACTIVATION_VALUE;
using android::hardware::automotive::audiocontrol::VolumeActivationConfigurationEntry::
DEFAULT_MIN_ACTIVATION_VALUE;
using ::testing::AnyOf;
using ::testing::Eq;
using ::testing::Not;
using ::testing::UnorderedElementsAreArray;
using android::internal::ToString;
#include "android_audio_policy_configuration_V7_0.h"
namespace xsd {
@@ -52,11 +79,218 @@ using namespace android::audio::policy::configuration::V7_0;
namespace audiohalcommon = android::hardware::audio::common;
namespace audiomediacommon = android::media::audio::common;
namespace testutils = android::hardware::audiocontrol::testutils;
namespace {
constexpr int32_t kAidlVersionThree = 3;
constexpr int32_t kAidlVersionFive = 5;
bool hasValidVolumeGroupActivation(const VolumeActivationConfiguration& activation,
std::string& message) {
if (activation.volumeActivationEntries.empty()) {
message = "Volume group activation must have at least one volume activation entry";
return false;
}
for (const auto& entry : activation.volumeActivationEntries) {
int32_t max = entry.maxActivationVolumePercentage;
int32_t min = entry.minActivationVolumePercentage;
if (min > DEFAULT_MAX_ACTIVATION_VALUE || min < DEFAULT_MIN_ACTIVATION_VALUE) {
message = "Invalid minActivationVolumePercentage, must be between " +
std::to_string(DEFAULT_MIN_ACTIVATION_VALUE) + " and " +
std::to_string(DEFAULT_MAX_ACTIVATION_VALUE);
return false;
}
if (max > DEFAULT_MAX_ACTIVATION_VALUE || max < DEFAULT_MIN_ACTIVATION_VALUE) {
message = "Invalid maxActivationVolumePercentage, must be between " +
std::to_string(DEFAULT_MIN_ACTIVATION_VALUE) + " and " +
std::to_string(DEFAULT_MAX_ACTIVATION_VALUE);
return false;
}
if (min >= max) {
message =
"Invalid maxActivationVolumePercentage and minActivationVolumePercentage "
"combination, minActivationVolumePercentage must be less than "
"maxActivationVolumePercentage";
return false;
}
}
return true;
}
bool hasValidAudioRoute(const DeviceToContextEntry& entry, std::string& message,
std::set<std::string>& groupDevices) {
if (entry.contextNames.empty()) {
message = " Contexts can not be empty for DeviceToContextEntry";
return false;
}
std::set<std::string> contextInRoute;
for (const auto& context : entry.contextNames) {
if (!contextInRoute.contains(ToString(context))) {
continue;
}
message = " Context can not repeat for the same DeviceToContextEntry";
return false;
}
audiomediacommon::AudioDeviceDescription description;
if (!testutils::getAudioPortDeviceDescriptor(entry.device, description)) {
message = " DeviceToContextEntry must have a valid device port";
return false;
}
// BUS type also has empty connection
// Note: OUT_BUS is also mapped to OUT_DEVICE
if (description.type != audiomediacommon::AudioDeviceType::OUT_BUS &&
!description.connection.empty()) {
return true;
}
std::string address;
if (!testutils::getAddressForAudioPort(entry.device, address) || address.empty()) {
message = " Address can not be empty for BUS devices";
return false;
}
if (groupDevices.contains(address)) {
message = " Audio device address can not repeat in the same volume group";
return false;
}
groupDevices.insert(address);
return true;
}
inline bool hasValidTimeout(int64_t timeout) {
return timeout > 0;
}
bool hasValidFadeConfiguration(const FadeConfiguration& fadeConfiguration,
const std::string& prefix, std::string& message) {
if (!hasValidTimeout(fadeConfiguration.fadeDurationMillis)) {
message = prefix + " duration must be greater than 0";
return false;
}
return true;
}
bool hadValidAudioFadeConfiguration(const AudioFadeConfiguration& fadeConfiguration,
std::string& message) {
if (!hasValidTimeout(fadeConfiguration.fadeInDurationMs)) {
message = "Fade-in duration must be greater than 0";
return false;
}
if (!hasValidTimeout(fadeConfiguration.fadeOutDurationMs)) {
message = "Fade-out duration must be greater than 0";
return false;
}
if (!hasValidTimeout(fadeConfiguration.fadeInDelayedForOffendersMs)) {
message = "Fade-in delayed for offenders duration must be greater than 0";
return false;
}
for (const auto& fadeOutConfig : fadeConfiguration.fadeOutConfigurations) {
if (!hasValidFadeConfiguration(fadeOutConfig, "Fade-out", message)) {
return false;
}
}
for (const auto& fadeOutConfig : fadeConfiguration.fadeInConfigurations) {
if (!hasValidFadeConfiguration(fadeOutConfig, "Fade-in", message)) {
return false;
}
}
return true;
}
void validateVolumeGroupInfo(const AudioZoneConfig& audioZoneConfig,
const VolumeGroupConfig& volumeGroupConfig,
const AudioDeviceConfiguration& deviceConfig) {
std::string zoneConfigName = testutils::toAlphaNumeric(ToString(audioZoneConfig.name));
std::string volumeGroupName = testutils::toAlphaNumeric(ToString(volumeGroupConfig.name));
std::string volumeGroupInfo =
"Audio zone config " + zoneConfigName + " volume group " + volumeGroupName;
ALOGI("%s test", volumeGroupInfo.c_str());
EXPECT_FALSE(volumeGroupConfig.carAudioRoutes.empty())
<< volumeGroupInfo << " must have at least one audio route";
if (deviceConfig.routingConfig == CONFIGURABLE_AUDIO_ENGINE_ROUTING) {
EXPECT_FALSE(volumeGroupConfig.name.empty())
<< volumeGroupInfo << " must have a non-empty volume name";
}
std::set<std::string> groupDevices;
for (const auto& audioRoute : volumeGroupConfig.carAudioRoutes) {
std::string routeMessage;
EXPECT_TRUE(hasValidAudioRoute(audioRoute, routeMessage, groupDevices))
<< volumeGroupInfo << " Volume route message: " << routeMessage;
}
if (volumeGroupConfig.activationConfiguration.has_value()) {
std::string activationMessage;
EXPECT_TRUE(hasValidVolumeGroupActivation(volumeGroupConfig.activationConfiguration.value(),
activationMessage))
<< volumeGroupInfo << " Activation message: " << activationMessage;
}
}
void validateAudioZoneFadeConfiguration(const AudioZoneFadeConfiguration& fadeConfiguration) {
ALOGI("Fade configuration test");
std::set<audiomediacommon::AudioUsage> usages;
std::string defaultValidationMessage;
EXPECT_TRUE(hadValidAudioFadeConfiguration(fadeConfiguration.defaultConfiguration,
defaultValidationMessage))
<< "Default configuration validation failed: " << defaultValidationMessage;
for (const auto& entry : fadeConfiguration.transientConfiguration) {
ALOGI("Transient fade configuration test");
std::string transientFadeConfigurationMessage;
EXPECT_TRUE(hadValidAudioFadeConfiguration(entry.transientFadeConfiguration,
transientFadeConfigurationMessage))
<< "Transient fade configuration validation failed: "
<< transientFadeConfigurationMessage;
EXPECT_FALSE(entry.transientUsages.empty())
<< "Transient fade configuration must have at least one audio usage";
for (const auto& usage : entry.transientUsages) {
EXPECT_FALSE(usages.contains(usage)) << "Audio usages " << ToString(usage)
<< " repeat in transient fade configuration";
}
}
}
void validateAudioZoneConfiguration(const AudioZone& carAudioZone,
const AudioZoneConfig& audioZoneConfig,
const AudioDeviceConfiguration& deviceConfig) {
std::string zoneConfigName = testutils::toAlphaNumeric(ToString(audioZoneConfig.name));
ALOGI("Zone config name %s test", zoneConfigName.c_str());
std::set<std::string> contextInfoNames;
EXPECT_FALSE(audioZoneConfig.volumeGroups.empty())
<< "Volume groups for zone config " << zoneConfigName.c_str();
for (const auto& volumeGroup : audioZoneConfig.volumeGroups) {
ALOGI("Zone config name %s volume group test %s", zoneConfigName.c_str(),
ToString(volumeGroup.name).c_str());
std::vector<std::string> groupContexts =
testutils::getContextInfoNamesForVolumeGroup(volumeGroup);
for (const auto& context : groupContexts) {
EXPECT_FALSE(contextInfoNames.contains(context))
<< "Context " << context << " repeats in zone config " << zoneConfigName;
contextInfoNames.insert(context);
}
validateVolumeGroupInfo(audioZoneConfig, volumeGroup, deviceConfig);
}
const auto& audioZoneContexts = carAudioZone.audioZoneContext.audioContextInfos;
std::map<std::string, AudioZoneContextInfo> infoNameToInfo;
std::transform(audioZoneContexts.begin(), audioZoneContexts.end(),
std::inserter(infoNameToInfo, infoNameToInfo.end()),
[&](const AudioZoneContextInfo& context) {
return std::make_pair(ToString(context.name), context);
});
std::vector<AudioZoneContextInfo> configContextInfos;
for (const auto& contextName : contextInfoNames) {
const auto& pair = infoNameToInfo.find(contextName);
if (pair == infoNameToInfo.end()) {
continue;
}
configContextInfos.push_back(pair->second);
}
std::string message;
EXPECT_TRUE(testutils::contextInfosContainAllAudioAttributeUsages(configContextInfos, message))
<< "Config " << zoneConfigName << " message: " << message;
if (audioZoneConfig.fadeConfiguration.has_value()) {
validateAudioZoneFadeConfiguration(audioZoneConfig.fadeConfiguration.value());
}
}
} // namespace
class AudioControlAidl : public testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
@@ -292,12 +526,193 @@ TEST_P(AudioControlAidl, RegisterModuleChangeNullCallbackThrowsException) {
AnyOf(Eq(Status::EX_ILLEGAL_ARGUMENT), Eq(Status::EX_UNSUPPORTED_OPERATION)));
}
class AudioControlVersionFiveAndAbove : public AudioControlAidl {
public:
virtual void SetUp() override {
AudioControlAidl::SetUp();
if (isAidlVersionAtleast(kAidlVersionFive)) {
return;
}
GTEST_SKIP() << " Version is lower than " << std::to_string(kAidlVersionFive);
}
};
class AudioControlWithAudioConfiguration : public AudioControlVersionFiveAndAbove {
public:
virtual void SetUp() override {
AudioControlVersionFiveAndAbove::SetUp();
if (IsSkipped()) {
return;
}
const auto& configStatus =
audioControl->getAudioDeviceConfiguration(&audioDeviceConfiguration);
EXPECT_THAT(configStatus.exceptionCode(),
AnyOf(Eq(Status::EX_NONE), Eq(Status::EX_UNSUPPORTED_OPERATION)));
if (!configStatus.isOk()) {
GTEST_SKIP() << "Device does not support audio configurations APIs";
}
ALOGD("Audio device info: %s", audioDeviceConfiguration.toString().c_str());
}
AudioDeviceConfiguration audioDeviceConfiguration;
};
TEST_P(AudioControlWithAudioConfiguration, DefaultAudioRoutingConfiguration) {
if (audioDeviceConfiguration.routingConfig != DEFAULT_AUDIO_ROUTING) {
GTEST_SKIP() << "Default audio routing not supported";
}
std::vector<AudioZone> zones;
const auto& zoneStatus = audioControl->getCarAudioZones(&zones);
EXPECT_THAT(zoneStatus.exceptionCode(),
AnyOf(Eq(Status::EX_NONE), Eq(Status::EX_UNSUPPORTED_OPERATION)))
<< "Default routing can be implemented or unsupported";
if (!zoneStatus.isOk()) return;
EXPECT_TRUE(zones.empty()) << "Zones must be empty for default routing";
}
class AudioControlWithDynamicConfiguration : public AudioControlWithAudioConfiguration {
public:
virtual void SetUp() override {
AudioControlWithAudioConfiguration::SetUp();
if (IsSkipped()) {
return;
}
if (audioDeviceConfiguration.routingConfig == DEFAULT_AUDIO_ROUTING) {
GTEST_SKIP() << "Dynamic/core audio routing not supported";
}
const auto& zoneStatus = audioControl->getCarAudioZones(&audioZones);
EXPECT_EQ(zoneStatus.exceptionCode(), Status::EX_NONE)
<< "Zones API must be supported for core/dynamic routing";
}
std::vector<AudioZone> audioZones;
};
TEST_P(AudioControlWithDynamicConfiguration, DynamicAudioRoutingConfiguration) {
EXPECT_FALSE(audioZones.empty()) << "Zones must not be empty for core/dynamic routing";
}
class AudioControlWithAudioZoneInfo : public AudioControlWithDynamicConfiguration {
public:
virtual void SetUp() override {
AudioControlWithDynamicConfiguration::SetUp();
if (IsSkipped()) {
return;
}
EXPECT_TRUE(!audioZones.empty()) << "Zones must exist for core/dynamic routing";
}
};
TEST_P(AudioControlWithAudioZoneInfo, AudioZonesRequirements) {
bool primaryZoneFound = false;
std::set<int> zoneIds;
std::set<int> occupantIds;
std::set<android::String16> zoneNames;
std::set<std::string> deviceAddresses;
for (const auto& zone : audioZones) {
if (zone.id == AudioZone::PRIMARY_AUDIO_ZONE) {
EXPECT_FALSE(primaryZoneFound) << "There can only be one primary zone";
primaryZoneFound = true;
}
EXPECT_FALSE(zoneIds.contains(zone.id)) << "Zone " << std::to_string(zone.id) << " repeats";
zoneIds.insert(zone.id);
if (!zone.name.empty()) {
EXPECT_FALSE(zoneNames.contains(zone.name)) << "Zone " << zone.name << " repeats";
zoneNames.insert(zone.name);
}
if (zone.occupantZoneId != AudioZone::UNASSIGNED_OCCUPANT) {
EXPECT_FALSE(occupantIds.contains(zone.occupantZoneId))
<< "Occupant zone id " << zone.occupantZoneId << " repeats";
occupantIds.insert(zone.occupantZoneId);
}
const auto& zoneAddresses = testutils::getDeviceAddressesForZone(zone);
for (const auto& address : zoneAddresses) {
EXPECT_FALSE(deviceAddresses.contains(address))
<< "Device address " << address << " in zone " << zone.name << " repeats";
}
// Add after zone comparison is done since devices may repeat within a zone for different
// configurations
deviceAddresses.insert(zoneAddresses.begin(), zoneAddresses.end());
}
EXPECT_TRUE(primaryZoneFound) << "Primary zone must exist";
}
TEST_P(AudioControlWithAudioZoneInfo, AudioZoneInfoRequirements) {
for (const auto& carAudioZone : audioZones) {
ALOGI("Zone id %d test", carAudioZone.id);
std::string missingContextMessage;
EXPECT_TRUE(testutils::contextContainsAllAudioAttributeUsages(carAudioZone.audioZoneContext,
missingContextMessage))
<< "Audio zone context for zone id " << std::to_string(carAudioZone.id)
<< missingContextMessage;
EXPECT_FALSE(carAudioZone.audioZoneConfigs.empty())
<< "Audio zone zone id " << std::to_string(carAudioZone.id)
<< " missing zone configs";
std::set<android::String16> configNames;
bool defaultConfigFound = false;
for (const auto& config : carAudioZone.audioZoneConfigs) {
ALOGI("Zone id %d config name %s test", carAudioZone.id, ToString(config.name).c_str());
if (config.isDefault) {
EXPECT_FALSE(defaultConfigFound)
<< "Config name " << config.name
<< " repeats default config value in zone id " << carAudioZone.id;
defaultConfigFound = true;
}
EXPECT_FALSE(configNames.contains(config.name))
<< "Config name " << config.name << " repeats in " << carAudioZone.id;
}
EXPECT_TRUE(defaultConfigFound)
<< "Audio zone " << carAudioZone.id << " must contain default config";
std::set<audiomediacommon::AudioPort> inputPorts;
ALOGI("Zone id %d input devices test", carAudioZone.id);
for (const auto& audioPort : carAudioZone.inputAudioDevices) {
std::string address;
const auto hasAddress = testutils::getAddressForAudioPort(audioPort, address);
EXPECT_FALSE(inputPorts.contains(audioPort))
<< "Repeating input device for " << carAudioZone.id << ", device address "
<< (hasAddress ? address : "empty address");
inputPorts.insert(audioPort);
}
}
}
TEST_P(AudioControlWithAudioZoneInfo, AudioZoneConfigInfoRequirements) {
for (const auto& carAudioZone : audioZones) {
for (const auto& audioZoneConfig : carAudioZone.audioZoneConfigs) {
validateAudioZoneConfiguration(carAudioZone, audioZoneConfig, audioDeviceConfiguration);
}
}
}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlAidl);
INSTANTIATE_TEST_SUITE_P(
Audiocontrol, AudioControlAidl,
testing::ValuesIn(android::getAidlHalInstanceNames(IAudioControl::descriptor)),
android::PrintInstanceNameToString);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlWithAudioConfiguration);
INSTANTIATE_TEST_SUITE_P(
Audiocontrol, AudioControlWithAudioConfiguration,
testing::ValuesIn(android::getAidlHalInstanceNames(IAudioControl::descriptor)),
android::PrintInstanceNameToString);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlWithDynamicConfiguration);
INSTANTIATE_TEST_SUITE_P(
Audiocontrol, AudioControlWithDynamicConfiguration,
testing::ValuesIn(android::getAidlHalInstanceNames(IAudioControl::descriptor)),
android::PrintInstanceNameToString);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlWithAudioZoneInfo);
INSTANTIATE_TEST_SUITE_P(
Audiocontrol, AudioControlWithAudioZoneInfo,
testing::ValuesIn(android::getAidlHalInstanceNames(IAudioControl::descriptor)),
android::PrintInstanceNameToString);
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
ProcessState::self()->setThreadPoolMaxThreadCount(1);

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2024 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.
*/
#ifndef MAIN8_AUDIOCONTROLTESTUTILS_H
#define MAIN8_AUDIOCONTROLTESTUTILS_H
#include <android/hardware/automotive/audiocontrol/IAudioControl.h>
#include <string>
#include <vector>
namespace android {
namespace hardware {
namespace audiocontrol {
namespace testutils {
std::string toAlphaNumeric(const std::string& info);
bool getAudioPortDeviceDescriptor(
const android::media::audio::common::AudioPort& audioPort,
android::media::audio::common::AudioDeviceDescription& description);
bool getAddressForAudioPort(const android::media::audio::common::AudioPort& audioPort,
std::string& address);
bool getAddressForAudioDevice(
const android::hardware::automotive::audiocontrol::DeviceToContextEntry& device,
std::string& address);
std::vector<std::string> getDeviceAddressesForVolumeGroup(
const android::hardware::automotive::audiocontrol::VolumeGroupConfig& config);
std::vector<std::string> getDeviceAddressesForZoneConfig(
const android::hardware::automotive::audiocontrol::AudioZoneConfig& config);
std::vector<std::string> getDeviceAddressesForZone(
const android::hardware::automotive::audiocontrol::AudioZone& config);
bool contextInfosContainAllAudioAttributeUsages(
const std::vector<android::hardware::automotive::audiocontrol::AudioZoneContextInfo>& infos,
std::string& message);
bool contextContainsAllAudioAttributeUsages(
const android::hardware::automotive::audiocontrol::AudioZoneContext& context,
std::string& message);
std::vector<std::string> getContextInfoNamesForVolumeGroup(
const android::hardware::automotive::audiocontrol::VolumeGroupConfig& group);
} // namespace testutils
} // namespace audiocontrol
} // namespace hardware
} // namespace android
#endif // MAIN8_AUDIOCONTROLTESTUTILS_H

View File

@@ -0,0 +1,203 @@
/*
* Copyright (C) 2024 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.
*/
#include "../include/AudioControlTestUtils.h"
#include <set>
using android::hardware::automotive::audiocontrol::AudioZone;
using android::hardware::automotive::audiocontrol::AudioZoneConfig;
using android::hardware::automotive::audiocontrol::AudioZoneContext;
using android::hardware::automotive::audiocontrol::AudioZoneContextInfo;
using android::hardware::automotive::audiocontrol::DeviceToContextEntry;
using android::hardware::automotive::audiocontrol::VolumeGroupConfig;
namespace audiomediacommon = android::media::audio::common;
namespace android {
namespace hardware {
namespace audiocontrol {
namespace testutils {
std::string toAlphaNumeric(const std::string& info) {
std::string name = info;
for (size_t i = 0; i < name.size(); i++) {
// gtest test names must only contain alphanumeric characters
if (!std::isalnum(name[i])) name[i] = '_';
}
return name;
}
bool getAudioPortDeviceDescriptor(const audiomediacommon::AudioPort& audioPort,
audiomediacommon::AudioDeviceDescription& description) {
if (audioPort.ext.getTag() != audiomediacommon::AudioPortExt::Tag::device) {
return false;
}
const auto& audioDevice =
audioPort.ext.get<audiomediacommon::AudioPortExt::Tag::device>().device;
description = audioDevice.type;
return true;
}
bool getAddressForAudioPort(const android::media::audio::common::AudioPort& audioPort,
std::string& address) {
if (audioPort.ext.getTag() != audiomediacommon::AudioPortExt::Tag::device) {
return false;
}
const auto& audioDevice =
audioPort.ext.get<audiomediacommon::AudioPortExt::Tag::device>().device;
switch (audioDevice.address.getTag()) {
case audiomediacommon::AudioDeviceAddress::Tag::id:
address = audioDevice.address.get<audiomediacommon::AudioDeviceAddress::Tag::id>();
return true;
case audiomediacommon::AudioDeviceAddress::Tag::alsa:
address = android::internal::ToString(
audioDevice.address.get<audiomediacommon::AudioDeviceAddress::Tag::alsa>());
return true;
case audiomediacommon::AudioDeviceAddress::Tag::mac:
address = android::internal::ToString(
audioDevice.address.get<audiomediacommon::AudioDeviceAddress::Tag::mac>());
return true;
case audiomediacommon::AudioDeviceAddress::Tag::ipv4:
address = android::internal::ToString(
audioDevice.address.get<audiomediacommon::AudioDeviceAddress::Tag::ipv4>());
return true;
case audiomediacommon::AudioDeviceAddress::Tag::ipv6:
address = android::internal::ToString(
audioDevice.address.get<audiomediacommon::AudioDeviceAddress::Tag::ipv6>());
return true;
default:
address = audioDevice.address.toString();
return true;
}
}
bool getAddressForAudioDevice(const DeviceToContextEntry& device, std::string& address) {
if (device.device.flags.getTag() == audiomediacommon::AudioIoFlags::input ||
device.device.ext.getTag() != audiomediacommon::AudioPortExt::Tag::device) {
return false;
}
return getAddressForAudioPort(device.device, address);
}
std::vector<std::string> getDeviceAddressesForVolumeGroup(const VolumeGroupConfig& config) {
std::vector<std::string> addresses;
for (const auto& route : config.carAudioRoutes) {
std::string address;
if (!getAddressForAudioDevice(route, address)) {
continue;
}
addresses.push_back(address);
}
return addresses;
}
std::vector<std::string> getDeviceAddressesForZoneConfig(const AudioZoneConfig& config) {
std::vector<std::string> addresses;
for (const auto& volumeGroup : config.volumeGroups) {
const auto groupAddresses = getDeviceAddressesForVolumeGroup(volumeGroup);
addresses.insert(addresses.begin(), groupAddresses.begin(), groupAddresses.end());
}
return addresses;
}
std::vector<std::string> getDeviceAddressesForZone(const AudioZone& config) {
std::vector<std::string> addresses;
for (const auto& zoneConfig : config.audioZoneConfigs) {
const auto groupAddresses = getDeviceAddressesForZoneConfig(zoneConfig);
addresses.insert(addresses.begin(), groupAddresses.begin(), groupAddresses.end());
}
return addresses;
}
static void addContextUsages(const AudioZoneContextInfo& info,
std::set<audiomediacommon::AudioUsage>& contextUsages) {
for (const auto& audioAttribute : info.audioAttributes) {
contextUsages.insert(audioAttribute.usage);
}
}
bool contextInfosContainAllAudioAttributeUsages(const std::vector<AudioZoneContextInfo>& infos,
std::string& message) {
static const std::vector<audiomediacommon::AudioUsage> audioUsages{
audiomediacommon::AudioUsage::UNKNOWN,
audiomediacommon::AudioUsage::MEDIA,
audiomediacommon::AudioUsage::VOICE_COMMUNICATION,
audiomediacommon::AudioUsage::VOICE_COMMUNICATION_SIGNALLING,
audiomediacommon::AudioUsage::ALARM,
audiomediacommon::AudioUsage::NOTIFICATION,
audiomediacommon::AudioUsage::NOTIFICATION_TELEPHONY_RINGTONE,
audiomediacommon::AudioUsage::NOTIFICATION_EVENT,
audiomediacommon::AudioUsage::ASSISTANCE_ACCESSIBILITY,
audiomediacommon::AudioUsage::ASSISTANCE_NAVIGATION_GUIDANCE,
audiomediacommon::AudioUsage::ASSISTANCE_SONIFICATION,
audiomediacommon::AudioUsage::GAME,
audiomediacommon::AudioUsage::ASSISTANT,
audiomediacommon::AudioUsage::CALL_ASSISTANT,
audiomediacommon::AudioUsage::EMERGENCY,
audiomediacommon::AudioUsage::SAFETY,
audiomediacommon::AudioUsage::VEHICLE_STATUS,
audiomediacommon::AudioUsage::ANNOUNCEMENT,
};
std::set<audiomediacommon::AudioUsage> contextUsages;
for (const auto& contextInfo : infos) {
addContextUsages(contextInfo, contextUsages);
}
bool allUsagesPresent = true;
for (const auto& usage : audioUsages) {
if (contextUsages.contains(usage)) {
continue;
}
if (message.empty()) {
message = " Missing usage(s): ";
}
message += audiomediacommon::toString(usage) + ", ";
allUsagesPresent = false;
}
return allUsagesPresent;
}
bool contextContainsAllAudioAttributeUsages(const AudioZoneContext& context, std::string& message) {
return contextInfosContainAllAudioAttributeUsages(context.audioContextInfos, message);
}
std::vector<std::string> getContextInfoNamesForAudioRoute(const DeviceToContextEntry& route) {
std::vector<std::string> contextInfoNames;
contextInfoNames.reserve(route.contextNames.size());
for (const auto& contextName : route.contextNames) {
contextInfoNames.push_back(android::internal::ToString(contextName));
}
return contextInfoNames;
}
std::vector<std::string> getContextInfoNamesForVolumeGroup(const VolumeGroupConfig& group) {
std::vector<std::string> contextInfoNames;
for (const auto& route : group.carAudioRoutes) {
std::vector<std::string> routeContexts = getContextInfoNamesForAudioRoute(route);
contextInfoNames.insert(contextInfoNames.begin(), routeContexts.begin(),
routeContexts.end());
}
return contextInfoNames;
}
} // namespace testutils
} // namespace audiocontrol
} // namespace hardware
} // namespace android