From 01e70be58364ddb32d8a36401b269e34c7c98a72 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 22 Sep 2021 17:22:55 -0700 Subject: [PATCH 1/3] Run aidl-format on media/aidl/android/media/audio/common Bug: 198812639 Test: m Change-Id: If687409694da06c7608404b29f75779e3037b10b --- media/aidl/android/media/audio/common/AudioMMapPolicy.aidl | 6 +++--- .../android/media/audio/common/AudioMMapPolicyType.aidl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/media/aidl/android/media/audio/common/AudioMMapPolicy.aidl b/media/aidl/android/media/audio/common/AudioMMapPolicy.aidl index bbb0402072b85..e7e8710da95b0 100644 --- a/media/aidl/android/media/audio/common/AudioMMapPolicy.aidl +++ b/media/aidl/android/media/audio/common/AudioMMapPolicy.aidl @@ -29,13 +29,13 @@ enum AudioMMapPolicy { /** * The MMAP feature is disabled and never used. */ - NEVER = 1, + NEVER = 1, /** * If MMAP feature works then uses it. Otherwise, fall back to something else. */ - AUTO = 2, + AUTO = 2, /** * The MMAP feature must be used. If not available then fail. */ - ALWAYS = 3, + ALWAYS = 3, } diff --git a/media/aidl/android/media/audio/common/AudioMMapPolicyType.aidl b/media/aidl/android/media/audio/common/AudioMMapPolicyType.aidl index bbc6e571c4273..9a15b56d7957f 100644 --- a/media/aidl/android/media/audio/common/AudioMMapPolicyType.aidl +++ b/media/aidl/android/media/audio/common/AudioMMapPolicyType.aidl @@ -26,10 +26,10 @@ enum AudioMMapPolicyType { * Default aaudio mmap policy. It is used to query whether the * aaudio MMAP could be used or not. */ - DEFAULT = 1, + DEFAULT = 1, /** * Exclusive aaudio mmap policy. It is used to query whether the * aaudio MMAP could be used in exclusive mode or not. */ - EXCLUSIVE = 2, + EXCLUSIVE = 2, } From 651ff0aa887308262bf5c4ae505429932da78f24 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 21 Sep 2021 20:44:14 +0000 Subject: [PATCH 2/3] Add AudioProfile to android.media.audio.common a.m.a.c adds a version of AudioProfile struct which is similar to Audio HIDL HAL V7. Bug: 198812639 Test: m Change-Id: Ibb4beb21f6c7975eb0400956bca10111f186280c --- media/Android.bp | 1 + .../media/audio/common/AudioProfile.aidl | 45 +++++++++++++++++++ .../media/audio/common/AudioProfile.aidl | 43 ++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 media/aidl/android/media/audio/common/AudioProfile.aidl create mode 100644 media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioProfile.aidl diff --git a/media/Android.bp b/media/Android.bp index aab16479b8b14..ad4f96c9981fa 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -70,6 +70,7 @@ aidl_interface { "aidl/android/media/audio/common/AudioMMapPolicyType.aidl", "aidl/android/media/audio/common/AudioMode.aidl", "aidl/android/media/audio/common/AudioOffloadInfo.aidl", + "aidl/android/media/audio/common/AudioProfile.aidl", "aidl/android/media/audio/common/AudioSource.aidl", "aidl/android/media/audio/common/AudioStreamType.aidl", "aidl/android/media/audio/common/AudioUsage.aidl", diff --git a/media/aidl/android/media/audio/common/AudioProfile.aidl b/media/aidl/android/media/audio/common/AudioProfile.aidl new file mode 100644 index 0000000000000..2124b0d5f1f44 --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioProfile.aidl @@ -0,0 +1,45 @@ +/* + * 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.media.audio.common; + +import android.media.audio.common.AudioChannelLayout; +import android.media.audio.common.AudioEncapsulationType; +import android.media.audio.common.AudioFormatDescription; + +/** + * AudioProfile describes a set of configurations supported for a certain + * audio format. A profile can be either "static" which means all the + * configurations are predefined, or "dynamic" which means configurations + * are queried at run time. Dynamic profiles generally used with detachable + * devices, e.g. HDMI or USB devices. + * + * {@hide} + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioProfile { + /** Name is commonly used with static profiles. Can be empty. */ + @utf8InCpp String name; + /** If the format is set to 'DEFAULT', this indicates a dynamic profile. */ + AudioFormatDescription format; + /** Can be empty if channel masks are "dynamic". */ + AudioChannelLayout[] channelMasks; + /** Can be empty if sample rates are "dynamic". */ + int[] sampleRates; + /** For encoded audio formats, an encapsulation can be specified. */ + AudioEncapsulationType encapsulationType = AudioEncapsulationType.NONE; +} diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioProfile.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioProfile.aidl new file mode 100644 index 0000000000000..134cdd98c418b --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioProfile.aidl @@ -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 -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.media.audio.common; +/* @hide */ +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioProfile { + @utf8InCpp String name; + android.media.audio.common.AudioFormatDescription format; + android.media.audio.common.AudioChannelLayout[] channelMasks; + int[] sampleRates; + android.media.audio.common.AudioEncapsulationType encapsulationType = android.media.audio.common.AudioEncapsulationType.NONE; +} From 788d91b1352a05283934bdcd7a6cb18bd678ea26 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 22 Sep 2021 23:49:56 +0000 Subject: [PATCH 3/3] Add AudioGain* to android.media.audio.common a.m.a.c adds AudioGain* types which are similar to the ones from Audio HIDL HAL V7. Bug: 198812639 Test: m Change-Id: I6471d3a85fea81e45357f5d7e4363313bd36f7c7 --- media/Android.bp | 3 ++ .../android/media/audio/common/AudioGain.aidl | 46 +++++++++++++++++++ .../media/audio/common/AudioGainConfig.aidl | 44 ++++++++++++++++++ .../media/audio/common/AudioGainMode.aidl | 34 ++++++++++++++ .../android/media/audio/common/AudioGain.aidl | 46 +++++++++++++++++++ .../media/audio/common/AudioGainConfig.aidl | 43 +++++++++++++++++ .../media/audio/common/AudioGainMode.aidl | 41 +++++++++++++++++ 7 files changed, 257 insertions(+) create mode 100644 media/aidl/android/media/audio/common/AudioGain.aidl create mode 100644 media/aidl/android/media/audio/common/AudioGainConfig.aidl create mode 100644 media/aidl/android/media/audio/common/AudioGainMode.aidl create mode 100644 media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGain.aidl create mode 100644 media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainConfig.aidl create mode 100644 media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainMode.aidl diff --git a/media/Android.bp b/media/Android.bp index ad4f96c9981fa..22bbdb6979487 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -65,6 +65,9 @@ aidl_interface { "aidl/android/media/audio/common/AudioEncapsulationType.aidl", "aidl/android/media/audio/common/AudioFormatDescription.aidl", "aidl/android/media/audio/common/AudioFormatType.aidl", + "aidl/android/media/audio/common/AudioGain.aidl", + "aidl/android/media/audio/common/AudioGainConfig.aidl", + "aidl/android/media/audio/common/AudioGainMode.aidl", "aidl/android/media/audio/common/AudioMMapPolicy.aidl", "aidl/android/media/audio/common/AudioMMapPolicyInfo.aidl", "aidl/android/media/audio/common/AudioMMapPolicyType.aidl", diff --git a/media/aidl/android/media/audio/common/AudioGain.aidl b/media/aidl/android/media/audio/common/AudioGain.aidl new file mode 100644 index 0000000000000..90fdeb6378711 --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioGain.aidl @@ -0,0 +1,46 @@ +/* + * 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.media.audio.common; + +import android.media.audio.common.AudioChannelLayout; + +/** + * This structure represents a gain stage. A gain stage is always attached + * to an AudioPort. + * + * {@hide} + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioGain { + /** Bitmask, indexed by AudioGainMode. */ + int mode; + /** For AudioGainMode.CHANNELS, specifies controlled channels. */ + AudioChannelLayout channelMask; + /** Minimum gain value in millibels. */ + int minValue; + /** Maximum gain value in millibels. */ + int maxValue; + /** Default gain value in millibels. */ + int defaultValue; + /** Gain step in millibels. */ + int stepValue; + /** Minimum ramp duration in milliseconds. */ + int minRampMs; + /** Maximum ramp duration in milliseconds. */ + int maxRampMs; +} diff --git a/media/aidl/android/media/audio/common/AudioGainConfig.aidl b/media/aidl/android/media/audio/common/AudioGainConfig.aidl new file mode 100644 index 0000000000000..a24711171ea25 --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioGainConfig.aidl @@ -0,0 +1,44 @@ +/* + * 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.media.audio.common; + +import android.media.audio.common.AudioChannelLayout; + +/** + * The gain configuration structure is used to get or set the gain values of a + * given AudioPort. + * + * {@hide} + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioGainConfig { + /** Index of the corresponding AudioGain in AudioPort.gains. */ + int index; + /** Bitmask, indexed by AudioGainMode. */ + int mode; + /** For AudioGainMode.CHANNELS, specifies controlled channels. */ + AudioChannelLayout channelMask; + /** + * Gain values in millibels. For each channel ordered from LSb to MSb in + * channel mask. The number of values is 1 in joint mode, otherwise equals + * the number of bits implied by channelMask. + */ + int[] values; + /** Ramp duration in milliseconds. */ + int rampDurationMs; +} diff --git a/media/aidl/android/media/audio/common/AudioGainMode.aidl b/media/aidl/android/media/audio/common/AudioGainMode.aidl new file mode 100644 index 0000000000000..e46752e85414d --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioGainMode.aidl @@ -0,0 +1,34 @@ +/* + * 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.media.audio.common; + +/** + * Type of gain control exposed by an audio port. The values are + * indexes of bits in a bitmask. + * + * {@hide} + */ +@VintfStability +@Backing(type="byte") +enum AudioGainMode { + /** Gain is the same for all channels. */ + JOINT = 0, + /** The gain is set individually for each channel. */ + CHANNELS = 1, + /** Ramping is applied. */ + RAMP = 2, +} diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGain.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGain.aidl new file mode 100644 index 0000000000000..71891eb83ce6b --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGain.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.media.audio.common; +/* @hide */ +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioGain { + int mode; + android.media.audio.common.AudioChannelLayout channelMask; + int minValue; + int maxValue; + int defaultValue; + int stepValue; + int minRampMs; + int maxRampMs; +} diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainConfig.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainConfig.aidl new file mode 100644 index 0000000000000..01877c78ede44 --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainConfig.aidl @@ -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 -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.media.audio.common; +/* @hide */ +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioGainConfig { + int index; + int mode; + android.media.audio.common.AudioChannelLayout channelMask; + int[] values; + int rampDurationMs; +} diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainMode.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainMode.aidl new file mode 100644 index 0000000000000..fddc20c308d2d --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioGainMode.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.media.audio.common; +/* @hide */ +@Backing(type="byte") @VintfStability +enum AudioGainMode { + JOINT = 0, + CHANNELS = 1, + RAMP = 2, +}