Merge changes from topic "fix-b-198812639-audio-profile"

* changes:
  Add AudioGain* to android.media.audio.common
  Add AudioProfile to android.media.audio.common
  Run aidl-format on media/aidl/android/media/audio/common
This commit is contained in:
TreeHugger Robot
2021-09-28 20:28:40 +00:00
committed by Android (Google) Code Review
11 changed files with 351 additions and 5 deletions

View File

@@ -65,11 +65,15 @@ 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",
"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",

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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,
}

View File

@@ -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,
}

View File

@@ -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,
}

View File

@@ -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;
}

View File

@@ -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 <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.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;
}

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.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;
}

View File

@@ -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 <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.media.audio.common;
/* @hide */
@Backing(type="byte") @VintfStability
enum AudioGainMode {
JOINT = 0,
CHANNELS = 1,
RAMP = 2,
}

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.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;
}