audio: Add AIDL definitions for Playback/RecordTrackMetadata

These types are used by I/O streams of the Audio HAL and
also by other HALs, so they are placed into 'a.h.audio.common'
types-only package.

Bug: 198812639
Test: m android.hardware.audio.common
Test: m check-vintf-all
Change-Id: I7064c3819d4c8e61981542ca2ccc52ca992a4ef8
This commit is contained in:
Mikhail Naganov 2021-10-26 14:00:00 -07:00
parent 04e371dc3f
commit 32a8ef3d8e
10 changed files with 373 additions and 0 deletions

54
audio/aidl/Android.bp Normal file
View file

@ -0,0 +1,54 @@
/*
* Copyright (C) 2021 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"],
}
aidl_interface {
name: "android.hardware.audio.common",
vendor_available: true,
srcs: [
"android/hardware/audio/common/PlaybackTrackMetadata.aidl",
"android/hardware/audio/common/RecordTrackMetadata.aidl",
"android/hardware/audio/common/SinkMetadata.aidl",
"android/hardware/audio/common/SourceMetadata.aidl",
],
imports: [
"android.media.audio.common.types",
],
stability: "vintf",
backend: {
cpp: {
enabled: true,
},
java: {
platform_apis: true,
},
ndk: {
vndk: {
enabled: true,
},
},
},
versions: [
],
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (C) 2021 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.audio.common;
@JavaDerive(equals=true, toString=true) @VintfStability
parcelable PlaybackTrackMetadata {
android.media.audio.common.AudioUsage usage = android.media.audio.common.AudioUsage.INVALID;
android.media.audio.common.AudioContentType contentType = android.media.audio.common.AudioContentType.UNKNOWN;
float gain;
android.media.audio.common.AudioChannelLayout channelMask;
@nullable android.media.audio.common.AudioDevice sourceDevice;
@utf8InCpp String[] tags;
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (C) 2021 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.audio.common;
@JavaDerive(equals=true, toString=true) @VintfStability
parcelable RecordTrackMetadata {
android.media.audio.common.AudioSource source = android.media.audio.common.AudioSource.SYS_RESERVED_INVALID;
float gain;
@nullable android.media.audio.common.AudioDevice destinationDevice;
android.media.audio.common.AudioChannelLayout channelMask;
@utf8InCpp String[] tags;
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (C) 2021 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.audio.common;
@JavaDerive(equals=true, toString=true) @VintfStability
parcelable SinkMetadata {
android.hardware.audio.common.RecordTrackMetadata[] tracks;
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (C) 2021 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.audio.common;
@JavaDerive(equals=true, toString=true) @VintfStability
parcelable SourceMetadata {
android.hardware.audio.common.PlaybackTrackMetadata[] tracks;
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (C) 2021 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.audio.common;
import android.media.audio.common.AudioChannelLayout;
import android.media.audio.common.AudioContentType;
import android.media.audio.common.AudioDevice;
import android.media.audio.common.AudioUsage;
/**
* Metadata of a playback track for an output stream.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable PlaybackTrackMetadata {
AudioUsage usage = AudioUsage.INVALID;
AudioContentType contentType = AudioContentType.UNKNOWN;
/**
* Non-negative linear gain (scaling) applied to track samples.
* 0 means muted, 1 is unity gain, 2 means double amplitude, etc.
*/
float gain;
AudioChannelLayout channelMask;
/**
* Indicates the source of an output stream, can be left unspecified.
*/
@nullable AudioDevice sourceDevice;
/**
* Tags from AudioTrack audio attributes. Tag is an additional use case
* qualifier complementing AudioUsage and AudioContentType. Tags are set by
* vendor specific applications and must be prefixed by "VX_". Vendor must
* namespace their tag names to avoid conflicts, for example:
* "VX_GOOGLE_VR". At least 3 characters are required for the vendor
* namespace.
*/
@utf8InCpp String[] tags;
}

View file

@ -0,0 +1,50 @@
/*
* Copyright (C) 2021 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.audio.common;
import android.media.audio.common.AudioChannelLayout;
import android.media.audio.common.AudioContentType;
import android.media.audio.common.AudioDevice;
import android.media.audio.common.AudioSource;
/**
* Metadata of a record track for an input stream.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable RecordTrackMetadata {
AudioSource source = AudioSource.SYS_RESERVED_INVALID;
/**
* Non-negative linear gain (scaling) applied to track samples.
* 0 means muted, 1 is unity gain, 2 means double amplitude, etc.
*/
float gain;
/**
* Indicates the destination of an input stream, can be left unspecified.
*/
@nullable AudioDevice destinationDevice;
AudioChannelLayout channelMask;
/**
* Tags from AudioRecord audio attributes. Tag is an additional use case
* qualifier complementing AudioUsage and AudioContentType. Tags are set by
* vendor specific applications and must be prefixed by "VX_". Vendor must
* namespace their tag names to avoid conflicts, for example:
* "VX_GOOGLE_VR". At least 3 characters are required for the vendor
* namespace.
*/
@utf8InCpp String[] tags;
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (C) 2021 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.audio.common;
import android.hardware.audio.common.RecordTrackMetadata;
/**
* Metadata of record tracks for an input stream.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable SinkMetadata {
RecordTrackMetadata[] tracks;
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (C) 2021 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.audio.common;
import android.hardware.audio.common.PlaybackTrackMetadata;
/**
* Metadata of playback tracks for an output stream.
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable SourceMetadata {
PlaybackTrackMetadata[] tracks;
}

View file

@ -51,6 +51,7 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) {
"android.hardware.media.bufferpool@2.0",
"android.hardware.radio.config@1.2",
// AIDL
"android.hardware.audio.common",
"android.hardware.biometrics.common",
"android.hardware.common",
"android.hardware.common.fmq",