Merge "audio VTS: Consider device connection for external device address"
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 01af940..e6b0cee 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -120,8 +120,6 @@
"android/hardware/audio/core/IStreamOut.aidl",
"android/hardware/audio/core/IStreamOutEventCallback.aidl",
"android/hardware/audio/core/ITelephony.aidl",
- "android/hardware/audio/core/MicrophoneDynamicInfo.aidl",
- "android/hardware/audio/core/MicrophoneInfo.aidl",
"android/hardware/audio/core/MmapBufferDescriptor.aidl",
"android/hardware/audio/core/ModuleDebug.aidl",
"android/hardware/audio/core/StreamDescriptor.aidl",
@@ -225,11 +223,12 @@
],
srcs: [
"android/hardware/audio/effect/AcousticEchoCanceler.aidl",
- "android/hardware/audio/effect/AutomaticGainControl.aidl",
"android/hardware/audio/effect/AutomaticGainControlV1.aidl",
+ "android/hardware/audio/effect/AutomaticGainControlV2.aidl",
"android/hardware/audio/effect/BassBoost.aidl",
"android/hardware/audio/effect/Capability.aidl",
"android/hardware/audio/effect/CommandId.aidl",
+ "android/hardware/audio/effect/DefaultExtension.aidl",
"android/hardware/audio/effect/Descriptor.aidl",
"android/hardware/audio/effect/Downmix.aidl",
"android/hardware/audio/effect/DynamicsProcessing.aidl",
diff --git a/audio/aidl/TEST_MAPPING b/audio/aidl/TEST_MAPPING
index 6a545c1..3e06595 100644
--- a/audio/aidl/TEST_MAPPING
+++ b/audio/aidl/TEST_MAPPING
@@ -13,9 +13,6 @@
"name": "VtsHalDownmixTargetTest"
},
{
- "name": "VtsHalDynamicsProcessingTargetTest"
- },
- {
"name": "VtsHalEnvironmentalReverbTargetTest"
},
{
@@ -43,7 +40,10 @@
"name": "VtsHalAECTargetTest"
},
{
- "name": "VtsHalAGCTargetTest"
+ "name": "VtsHalAGC1TargetTest"
+ },
+ {
+ "name": "VtsHalAGC2TargetTest"
},
{
"name": "VtsHalNSTargetTest"
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
index 45217e7..1eafdab 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
@@ -58,7 +58,7 @@
void setMasterVolume(float volume);
boolean getMicMute();
void setMicMute(boolean mute);
- android.hardware.audio.core.MicrophoneInfo[] getMicrophones();
+ android.media.audio.common.MicrophoneInfo[] getMicrophones();
void updateAudioMode(android.media.audio.common.AudioMode mode);
void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation);
void updateScreenState(boolean isTurnedOn);
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl
index 1041943..a01f877 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl
@@ -35,7 +35,7 @@
@VintfStability
interface IStreamIn {
android.hardware.audio.core.IStreamCommon getStreamCommon();
- android.hardware.audio.core.MicrophoneDynamicInfo[] getActiveMicrophones();
+ android.media.audio.common.MicrophoneDynamicInfo[] getActiveMicrophones();
android.hardware.audio.core.IStreamIn.MicrophoneDirection getMicrophoneDirection();
void setMicrophoneDirection(android.hardware.audio.core.IStreamIn.MicrophoneDirection direction);
float getMicrophoneFieldDimension();
@@ -43,7 +43,7 @@
void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata);
float[] getHwGain();
void setHwGain(in float[] channelGains);
- const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1);
+ const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1) /* -1 */;
const int MIC_FIELD_DIMENSION_NO_ZOOM = 0;
const int MIC_FIELD_DIMENSION_MAX_ZOOM = 1;
const int HW_GAIN_MIN = 0;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl
index 001d074..84d7aa1 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl
@@ -46,7 +46,7 @@
const int VOICE_VOLUME_MAX = 1;
@Backing(type="int") @VintfStability
enum TtyMode {
- UNSPECIFIED = (-1),
+ UNSPECIFIED = (-1) /* -1 */,
OFF = 0,
FULL = 1,
HCO = 2,
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl
deleted file mode 100644
index b77afe3..0000000
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.audio.core;
-@JavaDerive(equals=true, toString=true) @VintfStability
-parcelable MicrophoneInfo {
- @utf8InCpp String id;
- android.media.audio.common.AudioDevice device;
- android.hardware.audio.core.MicrophoneInfo.Location location = android.hardware.audio.core.MicrophoneInfo.Location.UNKNOWN;
- int group = GROUP_UNKNOWN;
- int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN;
- @nullable android.hardware.audio.core.MicrophoneInfo.Sensitivity sensitivity;
- android.hardware.audio.core.MicrophoneInfo.Directionality directionality = android.hardware.audio.core.MicrophoneInfo.Directionality.UNKNOWN;
- android.hardware.audio.core.MicrophoneInfo.FrequencyResponsePoint[] frequencyResponse;
- @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate position;
- @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate orientation;
- const int GROUP_UNKNOWN = (-1);
- const int INDEX_IN_THE_GROUP_UNKNOWN = (-1);
- @Backing(type="int") @VintfStability
- enum Location {
- UNKNOWN = 0,
- MAINBODY = 1,
- MAINBODY_MOVABLE = 2,
- PERIPHERAL = 3,
- }
- @VintfStability
- parcelable Sensitivity {
- float leveldBFS;
- float maxSpldB;
- float minSpldB;
- }
- @Backing(type="int") @VintfStability
- enum Directionality {
- UNKNOWN = 0,
- OMNI = 1,
- BI_DIRECTIONAL = 2,
- CARDIOID = 3,
- HYPER_CARDIOID = 4,
- SUPER_CARDIOID = 5,
- }
- @VintfStability
- parcelable FrequencyResponsePoint {
- float frequencyHz;
- float leveldB;
- }
- @VintfStability
- parcelable Coordinate {
- float x;
- float y;
- float z;
- }
-}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl
index a65d7b7..3e3dc38 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl
@@ -39,12 +39,12 @@
int frameSizeBytes;
long bufferSizeFrames;
android.hardware.audio.core.StreamDescriptor.AudioBuffer audio;
- const int LATENCY_UNKNOWN = (-1);
+ const int LATENCY_UNKNOWN = (-1) /* -1 */;
@FixedSize @VintfStability
parcelable Position {
- long frames = UNKNOWN;
- long timeNs = UNKNOWN;
- const long UNKNOWN = (-1);
+ long frames = UNKNOWN /* -1 */;
+ long timeNs = UNKNOWN /* -1 */;
+ const long UNKNOWN = (-1) /* -1 */;
}
@Backing(type="int") @VintfStability
enum State {
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl
index 1d51ade..1ec7dad 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl
@@ -42,10 +42,4 @@
int vendorExtensionTag;
android.hardware.audio.effect.AcousticEchoCanceler.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- int maxEchoDelayUs;
- boolean supportMobileMode;
- }
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
index ff010c6..57d4418 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -43,9 +43,4 @@
int vendorExtensionTag;
android.hardware.audio.effect.AutomaticGainControlV1.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- android.hardware.audio.effect.Range[] ranges;
- }
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
similarity index 85%
rename from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
rename to audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
index 39068d5..bdb481c 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
@@ -33,21 +33,15 @@
package android.hardware.audio.effect;
@VintfStability
-union AutomaticGainControl {
+union AutomaticGainControlV2 {
android.hardware.audio.effect.VendorExtension vendor;
int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
+ android.hardware.audio.effect.AutomaticGainControlV2.LevelEstimator levelEstimator;
int saturationMarginMb;
@VintfStability
union Id {
int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- int maxFixedDigitalGainMb;
- int maxSaturationMarginMb;
+ android.hardware.audio.effect.AutomaticGainControlV2.Tag commonTag;
}
@Backing(type="int") @VintfStability
enum LevelEstimator {
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl
index f8baa2a..d09fe54 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl
@@ -41,10 +41,4 @@
int vendorExtensionTag;
android.hardware.audio.effect.BassBoost.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- int maxStrengthPm;
- boolean strengthSupported;
- }
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl
index 28f77b3..c9df073 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl
@@ -33,20 +33,7 @@
package android.hardware.audio.effect;
@VintfStability
-union Capability {
+parcelable Capability {
android.hardware.audio.effect.VendorExtension vendorExtension;
- android.hardware.audio.effect.AcousticEchoCanceler.Capability acousticEchoCanceler;
- android.hardware.audio.effect.AutomaticGainControl.Capability automaticGainControl;
- android.hardware.audio.effect.BassBoost.Capability bassBoost;
- android.hardware.audio.effect.Downmix.Capability downmix;
- android.hardware.audio.effect.DynamicsProcessing.Capability dynamicsProcessing;
- android.hardware.audio.effect.EnvironmentalReverb.Capability environmentalReverb;
- android.hardware.audio.effect.Equalizer.Capability equalizer;
- android.hardware.audio.effect.HapticGenerator.Capability hapticGenerator;
- android.hardware.audio.effect.LoudnessEnhancer.Capability loudnessEnhancer;
- android.hardware.audio.effect.NoiseSuppression.Capability noiseSuppression;
- android.hardware.audio.effect.PresetReverb.Capability presetReverb;
- android.hardware.audio.effect.Virtualizer.Capability virtualizer;
- android.hardware.audio.effect.Visualizer.Capability visualizer;
- android.hardware.audio.effect.Volume.Capability volume;
+ android.hardware.audio.effect.Range range;
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DefaultExtension.aidl
similarity index 79%
rename from audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
rename to audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DefaultExtension.aidl
index 50a5528..f1cf389 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DefaultExtension.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -31,15 +31,8 @@
// 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.core;
-@JavaDerive(equals=true, toString=true) @VintfStability
-parcelable MicrophoneDynamicInfo {
- @utf8InCpp String id;
- android.hardware.audio.core.MicrophoneDynamicInfo.ChannelMapping[] channelMapping;
- @Backing(type="int") @VintfStability
- enum ChannelMapping {
- UNUSED = 0,
- DIRECT = 1,
- PROCESSED = 2,
- }
+package android.hardware.audio.effect;
+@VintfStability
+parcelable DefaultExtension {
+ byte[] bytes;
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
index 990d369..0baac3d 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
@@ -41,7 +41,8 @@
const String EFFECT_TYPE_UUID_EQUALIZER = "0bed4300-ddd6-11db-8f34-0002a5d5c51b";
const String EFFECT_TYPE_UUID_BASS_BOOST = "0634f220-ddd4-11db-a0fc-0002a5d5c51b";
const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b";
- const String EFFECT_TYPE_UUID_AGC = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ const String EFFECT_TYPE_UUID_AGC1 = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ const String EFFECT_TYPE_UUID_AGC2 = "ae3c653b-be18-4ab8-8938-418f0a7f06ac";
const String EFFECT_TYPE_UUID_AEC = "7b491460-8d4d-11e0-bd61-0002a5d5c51b";
const String EFFECT_TYPE_UUID_NS = "58b4b260-8e06-11e0-aa8e-0002a5d5c51b";
const String EFFECT_TYPE_UUID_LOUDNESS_ENHANCER = "fe3199be-aed0-413f-87bb-11260eb63cf1";
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl
index 402441d..45a1f28 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl
@@ -42,10 +42,6 @@
android.hardware.audio.effect.Downmix.Tag commonTag;
}
@VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- }
- @VintfStability
enum Type {
STRIP,
FOLD,
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl
index 8e5b719..3e20e33 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl
@@ -49,12 +49,6 @@
int vendorExtensionTag;
android.hardware.audio.effect.DynamicsProcessing.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- float minCutOffFreq;
- float maxCutOffFreq;
- }
enum ResolutionPreference {
FAVOR_FREQUENCY_RESOLUTION,
FAVOR_TIME_RESOLUTION,
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl
index 9edad09..a193102 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl
@@ -49,20 +49,4 @@
int vendorExtensionTag;
android.hardware.audio.effect.EnvironmentalReverb.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- android.hardware.audio.effect.VendorExtension extension;
- int minRoomLevelMb;
- int maxRoomLevelMb;
- int minRoomHfLevelMb;
- int maxRoomHfLevelMb;
- int maxDecayTimeMs;
- int minDecayHfRatioPm;
- int maxDecayHfRatioPm;
- int minLevelMb;
- int maxLevelMb;
- int maxDelayMs;
- int maxDiffusionPm;
- int maxDensityPm;
- }
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl
index ea63de5..3e3539f 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl
@@ -38,18 +38,14 @@
android.hardware.audio.effect.Equalizer.BandLevel[] bandLevels;
int preset;
int[] centerFreqMh;
+ android.hardware.audio.effect.Equalizer.BandFrequency[] bandFrequencies;
+ android.hardware.audio.effect.Equalizer.Preset[] presets;
@VintfStability
union Id {
int vendorExtensionTag;
android.hardware.audio.effect.Equalizer.Tag commonTag;
}
@VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- android.hardware.audio.effect.Equalizer.BandFrequency[] bandFrequencies;
- android.hardware.audio.effect.Equalizer.Preset[] presets;
- }
- @VintfStability
parcelable BandLevel {
int index;
int levelMb;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl
index 35186c3..a7dc265 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl
@@ -42,10 +42,6 @@
int vendorExtensionTag;
android.hardware.audio.effect.HapticGenerator.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- android.hardware.audio.effect.VendorExtension extension;
- }
@Backing(type="int") @VintfStability
enum VibratorScale {
MUTE = (-100) /* -100 */,
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl
index 5c6ca16..774f45f 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl
@@ -41,8 +41,4 @@
int vendorExtensionTag;
android.hardware.audio.effect.LoudnessEnhancer.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- android.hardware.audio.effect.VendorExtension extension;
- }
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
index 153e021..f1a3449 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -42,10 +42,6 @@
int vendorExtensionTag;
android.hardware.audio.effect.NoiseSuppression.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- }
@Backing(type="int") @VintfStability
enum Level {
LOW,
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
index 3ba44a0..14aa1e8 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
@@ -44,7 +44,8 @@
union Id {
int vendorEffectTag;
android.hardware.audio.effect.AcousticEchoCanceler.Id acousticEchoCancelerTag;
- android.hardware.audio.effect.AutomaticGainControl.Id automaticGainControlTag;
+ android.hardware.audio.effect.AutomaticGainControlV1.Id automaticGainControlV1Tag;
+ android.hardware.audio.effect.AutomaticGainControlV2.Id automaticGainControlV2Tag;
android.hardware.audio.effect.BassBoost.Id bassBoostTag;
android.hardware.audio.effect.Downmix.Id downmixTag;
android.hardware.audio.effect.DynamicsProcessing.Id dynamicsProcessingTag;
@@ -75,7 +76,8 @@
union Specific {
android.hardware.audio.effect.VendorExtension vendorEffect;
android.hardware.audio.effect.AcousticEchoCanceler acousticEchoCanceler;
- android.hardware.audio.effect.AutomaticGainControl automaticGainControl;
+ android.hardware.audio.effect.AutomaticGainControlV1 automaticGainControlV1;
+ android.hardware.audio.effect.AutomaticGainControlV2 automaticGainControlV2;
android.hardware.audio.effect.BassBoost bassBoost;
android.hardware.audio.effect.Downmix downmix;
android.hardware.audio.effect.DynamicsProcessing dynamicsProcessing;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl
index 4651742..148f79d 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl
@@ -35,6 +35,7 @@
@VintfStability
union PresetReverb {
android.hardware.audio.effect.VendorExtension vendor;
+ android.hardware.audio.effect.PresetReverb.Presets[] supportedPresets;
android.hardware.audio.effect.PresetReverb.Presets preset;
@Backing(type="int") @VintfStability
enum Presets {
@@ -51,9 +52,4 @@
int vendorExtensionTag;
android.hardware.audio.effect.PresetReverb.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- android.hardware.audio.effect.VendorExtension extension;
- android.hardware.audio.effect.PresetReverb.Presets[] supportedPresets;
- }
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
index 531d3a1..93edc5e 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
@@ -33,34 +33,101 @@
package android.hardware.audio.effect;
@VintfStability
-parcelable Range {
- int tag;
- android.hardware.audio.effect.Range.Types types;
+union Range {
+ android.hardware.audio.effect.Range.VendorExtensionRange[] vendorExtension = {};
+ android.hardware.audio.effect.Range.AcousticEchoCancelerRange[] acousticEchoCanceler;
+ android.hardware.audio.effect.Range.AutomaticGainControlV1Range[] automaticGainControlV1;
+ android.hardware.audio.effect.Range.AutomaticGainControlV2Range[] automaticGainControlV2;
+ android.hardware.audio.effect.Range.BassBoostRange[] bassBoost;
+ android.hardware.audio.effect.Range.DownmixRange[] downmix;
+ android.hardware.audio.effect.Range.DynamicsProcessingRange[] dynamicsProcessing;
+ android.hardware.audio.effect.Range.EnvironmentalReverbRange[] environmentalReverb;
+ android.hardware.audio.effect.Range.EqualizerRange[] equalizer;
+ android.hardware.audio.effect.Range.HapticGeneratorRange[] hapticGenerator;
+ android.hardware.audio.effect.Range.LoudnessEnhancerRange[] loudnessEnhancer;
+ android.hardware.audio.effect.Range.NoiseSuppressionRange[] noiseSuppression;
+ android.hardware.audio.effect.Range.PresetReverbRange[] presetReverb;
+ android.hardware.audio.effect.Range.VirtualizerRange[] virtualizer;
+ android.hardware.audio.effect.Range.VisualizerRange[] visualizer;
+ android.hardware.audio.effect.Range.VolumeRange[] volume;
@VintfStability
- parcelable Int {
- int min;
- int max;
+ parcelable AcousticEchoCancelerRange {
+ android.hardware.audio.effect.AcousticEchoCanceler min;
+ android.hardware.audio.effect.AcousticEchoCanceler max;
}
@VintfStability
- parcelable Float {
- float min;
- float max;
+ parcelable AutomaticGainControlV1Range {
+ android.hardware.audio.effect.AutomaticGainControlV1 min;
+ android.hardware.audio.effect.AutomaticGainControlV1 max;
}
@VintfStability
- parcelable Long {
- long min;
- long max;
+ parcelable AutomaticGainControlV2Range {
+ android.hardware.audio.effect.AutomaticGainControlV2 min;
+ android.hardware.audio.effect.AutomaticGainControlV2 max;
}
@VintfStability
- parcelable Byte {
- byte min;
- byte max;
+ parcelable BassBoostRange {
+ android.hardware.audio.effect.BassBoost min;
+ android.hardware.audio.effect.BassBoost max;
}
@VintfStability
- union Types {
- android.hardware.audio.effect.Range.Int rangeInt;
- android.hardware.audio.effect.Range.Float rangeFloat;
- android.hardware.audio.effect.Range.Long rangeLong;
- android.hardware.audio.effect.Range.Byte rangeByte;
+ parcelable DownmixRange {
+ android.hardware.audio.effect.Downmix min;
+ android.hardware.audio.effect.Downmix max;
+ }
+ @VintfStability
+ parcelable DynamicsProcessingRange {
+ android.hardware.audio.effect.DynamicsProcessing min;
+ android.hardware.audio.effect.DynamicsProcessing max;
+ }
+ @VintfStability
+ parcelable EnvironmentalReverbRange {
+ android.hardware.audio.effect.EnvironmentalReverb min;
+ android.hardware.audio.effect.EnvironmentalReverb max;
+ }
+ @VintfStability
+ parcelable EqualizerRange {
+ android.hardware.audio.effect.Equalizer min;
+ android.hardware.audio.effect.Equalizer max;
+ }
+ @VintfStability
+ parcelable HapticGeneratorRange {
+ android.hardware.audio.effect.HapticGenerator min;
+ android.hardware.audio.effect.HapticGenerator max;
+ }
+ @VintfStability
+ parcelable LoudnessEnhancerRange {
+ android.hardware.audio.effect.LoudnessEnhancer min;
+ android.hardware.audio.effect.LoudnessEnhancer max;
+ }
+ @VintfStability
+ parcelable NoiseSuppressionRange {
+ android.hardware.audio.effect.NoiseSuppression min;
+ android.hardware.audio.effect.NoiseSuppression max;
+ }
+ @VintfStability
+ parcelable PresetReverbRange {
+ android.hardware.audio.effect.PresetReverb min;
+ android.hardware.audio.effect.PresetReverb max;
+ }
+ @VintfStability
+ parcelable VendorExtensionRange {
+ android.hardware.audio.effect.VendorExtension min;
+ android.hardware.audio.effect.VendorExtension max;
+ }
+ @VintfStability
+ parcelable VirtualizerRange {
+ android.hardware.audio.effect.Virtualizer min;
+ android.hardware.audio.effect.Virtualizer max;
+ }
+ @VintfStability
+ parcelable VisualizerRange {
+ android.hardware.audio.effect.Visualizer min;
+ android.hardware.audio.effect.Visualizer max;
+ }
+ @VintfStability
+ parcelable VolumeRange {
+ android.hardware.audio.effect.Volume min;
+ android.hardware.audio.effect.Volume max;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl
index 2f367d9..e9611e4 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl
@@ -50,12 +50,6 @@
android.media.audio.common.AudioDeviceDescription device;
}
@VintfStability
- parcelable Capability {
- android.hardware.audio.effect.VendorExtension extension;
- int maxStrengthPm;
- boolean strengthSupported;
- }
- @VintfStability
parcelable ChannelAngle {
int channel;
int azimuthDegree;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl
index c8cb551..d1b1b3e 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl
@@ -36,30 +36,18 @@
union Visualizer {
android.hardware.audio.effect.Visualizer.Id id;
android.hardware.audio.effect.VendorExtension vendor;
- android.hardware.audio.effect.Visualizer.GetOnlyParameters getOnlyParameters;
- android.hardware.audio.effect.Visualizer.SetOnlyParameters setOnlyParameters;
+ android.hardware.audio.effect.Visualizer.Measurement measurement;
+ byte[] captureSampleBuffer;
+ int latencyMs;
int captureSamples;
android.hardware.audio.effect.Visualizer.ScalingMode scalingMode;
android.hardware.audio.effect.Visualizer.MeasurementMode measurementMode;
@VintfStability
union Id {
int vendorExtensionTag;
- android.hardware.audio.effect.Visualizer.GetOnlyParameters.Tag getOnlyParamTag;
- android.hardware.audio.effect.Visualizer.SetOnlyParameters.Tag setOnlyParamTag;
android.hardware.audio.effect.Visualizer.Tag commonTag;
}
@VintfStability
- parcelable Capability {
- android.hardware.audio.effect.VendorExtension extension;
- int maxLatencyMs;
- android.hardware.audio.effect.Visualizer.CaptureSamplesRange captureSampleRange;
- }
- @VintfStability
- parcelable CaptureSamplesRange {
- int min;
- int max;
- }
- @VintfStability
enum ScalingMode {
NORMALIZED = 0,
AS_PLAYED,
@@ -70,17 +58,8 @@
PEAK_RMS,
}
@VintfStability
- union GetOnlyParameters {
- android.hardware.audio.effect.Visualizer.GetOnlyParameters.Measurement measurement;
- byte[] captureSampleBuffer;
- @VintfStability
- parcelable Measurement {
- int rms;
- int peak;
- }
- }
- @VintfStability
- union SetOnlyParameters {
- int latencyMs;
+ parcelable Measurement {
+ int rms;
+ int peak;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl
index 6259cfb..c2b2df7 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl
@@ -42,10 +42,4 @@
int vendorExtensionTag;
android.hardware.audio.effect.Volume.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- android.hardware.audio.effect.VendorExtension extension;
- int minLevelDb;
- int maxLevelDb;
- }
}
diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index 968b573..edfb9f2 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -26,7 +26,6 @@
import android.hardware.audio.core.IStreamOut;
import android.hardware.audio.core.IStreamOutEventCallback;
import android.hardware.audio.core.ITelephony;
-import android.hardware.audio.core.MicrophoneInfo;
import android.hardware.audio.core.ModuleDebug;
import android.hardware.audio.core.StreamDescriptor;
import android.hardware.audio.core.VendorParameter;
@@ -39,6 +38,7 @@
import android.media.audio.common.AudioPort;
import android.media.audio.common.AudioPortConfig;
import android.media.audio.common.Float;
+import android.media.audio.common.MicrophoneInfo;
/**
* Each instance of IModule corresponds to a separate audio module. The system
diff --git a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl
index c2b3633..93cad11 100644
--- a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl
+++ b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl
@@ -18,7 +18,7 @@
import android.hardware.audio.common.SinkMetadata;
import android.hardware.audio.core.IStreamCommon;
-import android.hardware.audio.core.MicrophoneDynamicInfo;
+import android.media.audio.common.MicrophoneDynamicInfo;
/**
* This interface provides means for receiving audio data from input devices.
diff --git a/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
deleted file mode 100644
index 36cc51f..0000000
--- a/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.audio.core;
-
-/**
- * Structure providing dynamic information on a microphone. This information
- * changes between recording sessions.
- */
-@JavaDerive(equals=true, toString=true)
-@VintfStability
-parcelable MicrophoneDynamicInfo {
- /**
- * Unique alphanumeric id for the microphone. It must match the id of one of
- * the 'MicrophoneInfo' entries returned by 'IModule.getMicrophones'.
- */
- @utf8InCpp String id;
-
- @VintfStability
- @Backing(type="int")
- enum ChannelMapping {
- /** Channel not used. */
- UNUSED = 0,
- /** Channel is used and the signal is not processed. */
- DIRECT = 1,
- /** Channel is used and the signal has some processing. */
- PROCESSED = 2,
- }
- /**
- * The vector is indexes by zero-based channels of the microphone, thus the
- * element '0' corresponds to the first channel, '1' is the second, etc. The
- * vector must contain at least 1 element.
- */
- ChannelMapping[] channelMapping;
-}
diff --git a/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl b/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl
deleted file mode 100644
index 3b8c7f3..0000000
--- a/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.audio.core;
-
-import android.media.audio.common.AudioDevice;
-
-/**
- * Structure providing static information on a microphone. This information
- * never changes during the lifetime of the IModule which owns the microphone.
- * The information presented in this structure indicates the location and
- * orientation of the microphone on the device as well as useful information
- * like frequency response and sensitivity.
- */
-@JavaDerive(equals=true, toString=true)
-@VintfStability
-parcelable MicrophoneInfo {
- /**
- * Unique alphanumeric id for the microphone. It must remain the same across
- * device reboots. The client must never attempt to parse the value of this
- * field.
- */
- @utf8InCpp String id;
- /**
- * Describes the location of the microphone in terms of managed audio devices.
- */
- AudioDevice device;
-
- @VintfStability
- @Backing(type="int")
- enum Location {
- /** Microphone location is unknown. */
- UNKNOWN = 0,
- /** The microphone is located on the main body of the device. */
- MAINBODY = 1,
- /** The microphone is located on a movable main body of the device. */
- MAINBODY_MOVABLE = 2,
- /** The microphone is located on a peripheral. */
- PERIPHERAL = 3,
- }
- /** Location of the microphone in regard to the body of the device */
- Location location = Location.UNKNOWN;
-
- /**
- * This value is used when the group of the microphone is unknown.
- */
- const int GROUP_UNKNOWN = -1;
- /**
- * An identifier to group related microphones together, for example,
- * microphones of a microphone array should all belong to the same group.
- * Note that microphones assigned to 'GROUP_UNKNOWN' do not form a group.
- */
- int group = GROUP_UNKNOWN;
- /**
- * This value is used when the index in the group of the microphone is
- * unknown.
- */
- const int INDEX_IN_THE_GROUP_UNKNOWN = -1;
- /**
- * Index of this microphone within the group. The pair (group, index) must
- * be unique within the same HAL module, except the pair
- * (GROUP_UNKNOWN, INDEX_IN_THE_GROUP_UNKNOWN).
- */
- int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN;
-
- @VintfStability
- parcelable Sensitivity {
- /** Level in dBFS produced by a 1000 Hz tone at 94 dB SPL. */
- float leveldBFS;
- /** Level in dB of the max SPL supported at 1000 Hz */
- float maxSpldB;
- /** Level in dB of the min SPL supported at 1000 Hz */
- float minSpldB;
- }
- /**
- * If provided, must describe acceptable sound pressure levels (SPL)
- * for a 1 kHz sine wave, and the resulting level in dBFS.
- */
- @nullable Sensitivity sensitivity;
-
- @VintfStability
- @Backing(type="int")
- enum Directionality {
- UNKNOWN = 0,
- OMNI = 1,
- BI_DIRECTIONAL = 2,
- CARDIOID = 3,
- HYPER_CARDIOID = 4,
- SUPER_CARDIOID = 5,
- }
- /**
- * The standard polar pattern of the microphone.
- */
- Directionality directionality = Directionality.UNKNOWN;
-
- /**
- * A (frequency, level) pair. Used to represent frequency response.
- */
- @VintfStability
- parcelable FrequencyResponsePoint {
- float frequencyHz;
- float leveldB;
- }
- /**
- * Vector with ordered frequency responses (from low to high frequencies)
- * with the frequency response of the microphone. Levels are in dB,
- * relative to level at 1000 Hz.
- */
- FrequencyResponsePoint[] frequencyResponse;
-
- /**
- * A 3D point used to represent position or orientation of a microphone.
- */
- @VintfStability
- parcelable Coordinate {
- float x;
- float y;
- float z;
- }
- /**
- * If provided, must specify distances of the microphone's capsule, in
- * meters, from the bottom-left-back corner of the bounding box of device in
- * its natural orientation (PORTRAIT for phones, LANDSCAPE for tablets, TVs,
- * etc).
- */
- @nullable Coordinate position;
- /**
- * If provided, describes the normalized point which defines the main
- * orientation of the microphone's capsule.
- * Magnitude = sqrt(x^2 + y^2 + z^2) = 1.
- */
- @nullable Coordinate orientation;
-}
diff --git a/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl b/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl
index 19d60b6..49377d6 100644
--- a/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl
+++ b/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl
@@ -22,9 +22,9 @@
* Acoustic Echo Canceler (AEC) is an audio pre-processor which removes the contribution of the
* signal received from the remote party from the captured audio signal.
*
- * All parameters defined in union AcousticEchoCanceler must be gettable and settable. The
- * capabilities defined in AcousticEchoCanceler.Capability can only acquired with
- * IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.acousticEchoCanceler
+ * definition if the definition for the corresponding parameter tag exist. See more detals about
+ * Range in Range.aidl.
*/
@VintfStability
union AcousticEchoCanceler {
@@ -43,35 +43,20 @@
VendorExtension vendor;
/**
- * Capability supported by AEC implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * AEC capability extension, vendor can use this extension in case existing capability
- * definition not enough.
- */
- ParcelableHolder extension;
-
- /**
- * Maximum AEC echo delay in microseconds supported.
- */
- int maxEchoDelayUs;
- /**
- * If AEC mobile mode was supported by the AEC implementation.
- */
- boolean supportMobileMode;
- }
-
- /**
* The AEC echo delay in microseconds.
- * Must never be negative, and not larger than maxEchoDelayUs in capability.
*/
int echoDelayUs;
/**
- * If AEC mobile mode enabled.
- * Can only be false if AEC implementation indicate not support mobile mode by set
- * supportMobileMode to false in capability.
+ * Indicate if the AEC mobile mode is enabled or not.
+ * If an effect implementation supports enabling and disabling mobileMode at runtime, it does
+ * not need to set the min and max range for mobileMode, or report the mobileMode min/max range
+ * as [false, true] in Range.AcousticEchoCancelerRange. If the effect implementation doesn't
+ * support mobileMode, it must report the mobileMode range as [false, false]. If the effect
+ * implementation supports mobileMode and cannot be disabled, it must report the mobileMode
+ * range as [true, true].
+ * If the effect implementation sets the range as invalid: [true, false], it indicates that
+ * mobileMode setParameter is not supported, and clients can only use getParameter to check if
+ * it's enabled or not.
*/
boolean mobileMode;
}
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl
deleted file mode 100644
index e82a564..0000000
--- a/audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.audio.effect;
-
-import android.hardware.audio.effect.VendorExtension;
-
-/**
- * Automatic Gain Control (AGC) is an audio pre-processor which automatically normalizes the output
- * of the captured signal by boosting or lowering input from the microphone to match a preset level
- * so that the output signal level is virtually constant. AGC can be used by applications where the
- * input signal dynamic range is not important but where a constant strong capture level is desired.
- *
- * All parameters defined in union AutomaticGainControl must be gettable and settable. The
- * capabilities defined in AutomaticGainControl.Capability can only acquired with
- * IEffect.getDescriptor() and not settable.
- */
-@VintfStability
-union AutomaticGainControl {
- /**
- * Effect parameter tag to identify the parameters for getParameter().
- */
- @VintfStability
- union Id {
- int vendorExtensionTag;
- AutomaticGainControl.Tag commonTag;
- }
-
- /**
- * Vendor AutomaticGainControl implementation definition for additional parameters.
- */
- VendorExtension vendor;
-
- /**
- * Capability supported by AutomaticGainControl implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * AutomaticGainControl capability extension, vendor can use this extension in case existing
- * capability definition not enough.
- */
- ParcelableHolder extension;
- /**
- * Max fixed digital gain supported by AGC implementation in millibel.
- */
- int maxFixedDigitalGainMb;
- /**
- * Max fixed saturation margin supported by AGC implementation in millibel.
- */
- int maxSaturationMarginMb;
- }
-
- @VintfStability
- @Backing(type="int")
- enum LevelEstimator {
- /* Use Root Mean Square level estimator*/
- RMS = 0,
- /* Use Peak level estimator*/
- PEAK = 1,
- }
-
- /**
- * The AGC fixed digital gain in millibel.
- * Must never be negative, and not larger than maxFixedDigitalGainMb in capability.
- */
- int fixedDigitalGainMb;
- /*
- * Adaptive digital level estimator.
- */
- LevelEstimator levelEstimator;
- /**
- * The AGC saturation margin in millibel.
- * Must never be negative, and not larger than maxSaturationMarginMb in capability.
- */
- int saturationMarginMb;
-}
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
index d6e0648..9b2feff 100644
--- a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -16,7 +16,6 @@
package android.hardware.audio.effect;
-import android.hardware.audio.effect.Range;
import android.hardware.audio.effect.VendorExtension;
/**
@@ -25,9 +24,9 @@
* so that the output signal level is virtually constant. AGC can be used by applications where the
* input signal dynamic range is not important but where a constant strong capture level is desired.
*
- * All parameters defined in union AutomaticGainControlV1 must be gettable and settable. The
- * capabilities defined in AutomaticGainControlV1.Capability can only acquired with
- * IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.automaticGainControlV1
+ * definition if the definition for the corresponding parameter tag exist. See more detals about
+ * Range in Range.aidl.
*/
@VintfStability
union AutomaticGainControlV1 {
@@ -46,31 +45,13 @@
VendorExtension vendor;
/**
- * Capability supported by AutomaticGainControlV1 implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * AutomaticGainControlV1 capability extension, vendor can use this extension in case
- * existing capability definition not enough.
- */
- ParcelableHolder extension;
- /**
- * Supported range for parameters.
- */
- Range[] ranges;
- }
-
- /**
* Target peak level (or envelope) of the AGC implementation in dBFs (dB relative to full
* scale).
- * Must be in range of AutomaticGainControlV1.Capability.ranges with targetPeakLevelDbFs tag.
*/
int targetPeakLevelDbFs;
/*
* Sets the maximum gain the digital compression stage may apply, in dB. A higher number
* corresponds to greater compression, while a value of 0 will leave the signal uncompressed.
- * Must be in range of AutomaticGainControlV1.Capability.ranges with maxCompressionGainDb tag.
*/
int maxCompressionGainDb;
/**
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
new file mode 100644
index 0000000..836d6b8
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * Automatic Gain Control V2 (AGC2) is an audio pre-processor which automatically normalizes the
+ * output of the captured signal by boosting or lowering input from the microphone to match a preset
+ * level so that the output signal level is virtually constant. AGC can be used by applications
+ * where the input signal dynamic range is not important but where a constant strong capture level
+ * is desired.
+ *
+ * All parameter settings must be inside the range of Capability.Range.automaticGainControlV2
+ * definition if the definition for the corresponding parameter tag exist. See more detals about
+ * Range in Range.aidl.
+ */
+@VintfStability
+union AutomaticGainControlV2 {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ AutomaticGainControlV2.Tag commonTag;
+ }
+
+ /**
+ * Vendor AutomaticGainControlV2 implementation definition for additional parameters.
+ */
+ VendorExtension vendor;
+
+ @VintfStability
+ @Backing(type="int")
+ enum LevelEstimator {
+ /* Use Root Mean Square level estimator*/
+ RMS = 0,
+ /* Use Peak level estimator*/
+ PEAK = 1,
+ }
+
+ /**
+ * The AGC fixed digital gain in millibel.
+ */
+ int fixedDigitalGainMb;
+ /*
+ * Adaptive digital level estimator.
+ */
+ LevelEstimator levelEstimator;
+ /**
+ * The AGC saturation margin in millibel.
+ */
+ int saturationMarginMb;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/BassBoost.aidl b/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
index 6a94242..d734825 100644
--- a/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
+++ b/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
@@ -22,8 +22,8 @@
* Bass boost is an audio effect to boost or amplify low frequencies of the sound. It is comparable
* to a simple equalizer but limited to one band amplification in the low frequency range.
*
- * All parameters defined in union BassBoost must be gettable and settable. The capabilities defined
- * in BassBoost.Capability can only acquired with IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.bassBoost definition if the
+ * definition for the corresponding parameter tag exist. See more detals about Range in Range.aidl.
*/
@VintfStability
union BassBoost {
@@ -42,35 +42,11 @@
VendorExtension vendor;
/**
- * Capability supported by BassBoost implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * BassBoost capability extension, vendor can use this extension in case existing capability
- * definition not enough.
- */
- ParcelableHolder extension;
- /**
- * Maximum possible per mille strength.
- */
- int maxStrengthPm;
- /**
- * Indicates whether setting strength is supported. False value indicates only one strength
- * is supported and setParameter() method will return EX_ILLEGAL_ARGUMENT.
- */
- boolean strengthSupported;
- }
-
- /**
* The per mille strength of the bass boost effect.
*
* If the implementation does not support per mille accuracy for setting the strength, it is
* allowed to round the given strength to the nearest supported value. In this case {@link
* #IEffect.getParameter()} method should return the rounded value that was actually set.
- *
- * The value of the strength must be non-negative and not exceed the value specified by
- * the 'maxStrengthPm' capability.
*/
int strengthPm;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Capability.aidl b/audio/aidl/android/hardware/audio/effect/Capability.aidl
index 30780e6..06c2024 100644
--- a/audio/aidl/android/hardware/audio/effect/Capability.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Capability.aidl
@@ -16,21 +16,8 @@
package android.hardware.audio.effect;
-import android.hardware.audio.effect.AcousticEchoCanceler;
-import android.hardware.audio.effect.AutomaticGainControl;
-import android.hardware.audio.effect.BassBoost;
-import android.hardware.audio.effect.Downmix;
-import android.hardware.audio.effect.DynamicsProcessing;
-import android.hardware.audio.effect.EnvironmentalReverb;
-import android.hardware.audio.effect.Equalizer;
-import android.hardware.audio.effect.HapticGenerator;
-import android.hardware.audio.effect.LoudnessEnhancer;
-import android.hardware.audio.effect.NoiseSuppression;
-import android.hardware.audio.effect.PresetReverb;
+import android.hardware.audio.effect.Range;
import android.hardware.audio.effect.VendorExtension;
-import android.hardware.audio.effect.Virtualizer;
-import android.hardware.audio.effect.Visualizer;
-import android.hardware.audio.effect.Volume;
/**
* Effect capability definitions.
@@ -38,32 +25,19 @@
* not meant to change at runtime.
*/
@VintfStability
-union Capability {
+parcelable Capability {
/**
* Vendor defined effect capability.
- * This extension can be used when vendor have a new effect implementated and need
+ * This extension can be used when vendor has a new effect implementation and needs
* capability definition for this new type of effect.
- * If vendor want to extend existing effect capabilities, it is recommended to expose though
- * the ParcelableHolder in each effect capability definition. For example:
- * Equalizer.Capability.extension.
+ * If vendor want to extend existing effect capabilities, it is recommended to expose through
+ * the ParcelableHolder in each effect definition. For example: Equalizer.vendorExtension. And
+ * define an appropriate Range for the extension.
*/
VendorExtension vendorExtension;
/**
- * Effect capabilities.
+ * Supported range for parameters. See Range.aidl.
*/
- AcousticEchoCanceler.Capability acousticEchoCanceler;
- AutomaticGainControl.Capability automaticGainControl;
- BassBoost.Capability bassBoost;
- Downmix.Capability downmix;
- DynamicsProcessing.Capability dynamicsProcessing;
- EnvironmentalReverb.Capability environmentalReverb;
- Equalizer.Capability equalizer;
- HapticGenerator.Capability hapticGenerator;
- LoudnessEnhancer.Capability loudnessEnhancer;
- NoiseSuppression.Capability noiseSuppression;
- PresetReverb.Capability presetReverb;
- Virtualizer.Capability virtualizer;
- Visualizer.Capability visualizer;
- Volume.Capability volume;
+ Range range;
}
diff --git a/audio/aidl/android/hardware/audio/effect/DefaultExtension.aidl b/audio/aidl/android/hardware/audio/effect/DefaultExtension.aidl
new file mode 100644
index 0000000..33e827f
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/DefaultExtension.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 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.effect;
+
+/**
+ * The default extension used for Parameter.Specific.vendorEffect ParcelableHolder.
+ *
+ * The audio framework attach this default extension to the ParcelableHolder in VendorExtension,
+ * and pass though all parameters it received from the client to audio HAL.
+ *
+ * For now it's not possible for vendor to define their own vendor extensions without changing the
+ * audio framework. More specificly, in order to add a customized effect parameter AIDL parcelable,
+ * vendors need to add the logic for conversion between AIDL and effect_param_t for the effect AIDL
+ * in: frameworks/av/media/libaudiohal/impl/effectAidlConversion.
+ *
+ * There is no VTS test cases for the vendor extension effect implementation, however all effect
+ * implementations must support the common parameters defined in Parameter.aidl, so vendor
+ * extension effect implementation still need to support setting and getting of these common
+ * parameters, which is enforced by VTS.
+ */
+@VintfStability
+parcelable DefaultExtension {
+ byte[] bytes;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
index 47c88dc..01ca1c6 100644
--- a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
@@ -57,9 +57,13 @@
*/
const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b";
/**
- * UUID for Automatic Gain Control (AGC) type.
+ * UUID for Automatic Gain Control V1 (AGC1) type.
*/
- const String EFFECT_TYPE_UUID_AGC = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ const String EFFECT_TYPE_UUID_AGC1 = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ /**
+ * UUID for Automatic Gain Control V2 (AGC2) type.
+ */
+ const String EFFECT_TYPE_UUID_AGC2 = "ae3c653b-be18-4ab8-8938-418f0a7f06ac";
/**
* UUID for Acoustic Echo Canceler (AEC) type.
*/
diff --git a/audio/aidl/android/hardware/audio/effect/Downmix.aidl b/audio/aidl/android/hardware/audio/effect/Downmix.aidl
index ee57baf..f90e339 100644
--- a/audio/aidl/android/hardware/audio/effect/Downmix.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Downmix.aidl
@@ -21,8 +21,8 @@
/**
* Downmix specific definitions.
*
- * All parameters defined in union Downmix must be gettable and settable. The capabilities defined
- * in Downmix.Capability can only acquired with IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.downmix definition if the
+ * definition for the corresponding parameter tag exist. See more detals about Range in Range.aidl.
*/
@VintfStability
union Downmix {
@@ -40,18 +40,6 @@
*/
VendorExtension vendor;
- /**
- * Capability supported by Downmix implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * Downmix capability extension, vendor can use this extension in case existing capability
- * definition not enough.
- */
- ParcelableHolder extension;
- }
-
@VintfStability
enum Type {
/**
diff --git a/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl b/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
index 6db3338..486d4f4 100644
--- a/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
+++ b/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
@@ -21,9 +21,9 @@
/**
* DynamicsProcessing specific definitions.
*
- * All parameters defined in union DynamicsProcessing must be gettable and settable. The
- * capabilities defined in DynamicsProcessing.Capability can only acquired with
- * IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.dynamicsProcessing definition
+ * if the definition for the corresponding parameter tag exist. See more detals about Range in
+ * Range.aidl.
*/
@VintfStability
union DynamicsProcessing {
@@ -42,26 +42,6 @@
VendorExtension vendorExtension;
/**
- * Capability supported by DynamicsProcessing implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * DynamicsProcessing capability extension, vendor can use this extension in case existing
- * capability definition not enough.
- */
- ParcelableHolder extension;
- /**
- * Min Cut off frequency (in Hz) for all Bands.
- */
- float minCutOffFreq;
- /**
- * Max Cut off frequency (in Hz) for all Bands.
- */
- float maxCutOffFreq;
- }
-
- /**
* Resolution preference definition.
*/
enum ResolutionPreference {
@@ -159,8 +139,7 @@
*/
boolean enable;
/**
- * Topmost frequency number (in Hz) this band will process. Must be in the range of
- * [minCutOffFreq, maxCutOffFreq] defined in Capability.
+ * Topmost frequency number (in Hz) this band will process.
*/
float cutoffFrequencyHz;
/**
@@ -190,8 +169,7 @@
*/
boolean enable;
/**
- * Topmost frequency number (in Hz) this band will process. Must be in the range of
- * [minCutOffFreq, maxCutOffFreq] defined in Capability.
+ * Topmost frequency number (in Hz) this band will process.
*/
float cutoffFrequencyHz;
/**
diff --git a/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl b/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl
index fc98fe6..a158dca 100644
--- a/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl
+++ b/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl
@@ -21,9 +21,9 @@
/**
* Environmental Reverb specific definitions.
*
- * All parameters defined in union Environmental must be gettable and settable. The capabilities
- * * defined in EnvironmentalReverb.Capability can only acquired with IEffect.getDescriptor() and
- * not * settable.
+ * All parameter settings must be inside the range of Capability.Range.environmentalReverb
+ * definition if the definition for the corresponding parameter tag exist. See more detals about
+ * Range in Range.aidl.
*/
@VintfStability
@@ -43,103 +43,35 @@
VendorExtension vendor;
/**
- * Capability supported by effect implementation.
- */
- @VintfStability
- parcelable Capability {
- VendorExtension extension;
-
- /**
- * Minimal possible room level in millibels.
- */
- int minRoomLevelMb;
- /**
- * Maximum possible room level in millibels.
- */
- int maxRoomLevelMb;
- /**
- * Minimal possible room hf level in millibels.
- */
- int minRoomHfLevelMb;
- /**
- * Maximum possible room hf level in millibels.
- */
- int maxRoomHfLevelMb;
- /**
- * Max decay time supported in millisecond.
- */
- int maxDecayTimeMs;
- /**
- * Minimal possible per mille decay hf ratio.
- */
- int minDecayHfRatioPm;
- /**
- * Maximum possible per mille decay hf ratio.
- */
- int maxDecayHfRatioPm;
- /**
- * Minimal possible room level in millibels.
- */
- int minLevelMb;
- /**
- * Maximum possible room level in millibels.
- */
- int maxLevelMb;
- /**
- * Maximum possible delay time in milliseconds.
- */
- int maxDelayMs;
- /**
- * Maximum possible per mille diffusion.
- */
- int maxDiffusionPm;
- /**
- * Maximum possible per mille density.
- */
- int maxDensityPm;
- }
-
- /**
- * Room level apply to the reverb effect in millibels. The value of the roomLevelMb must be in
- * range of the value specified by the 'minRoomLevelMb' capability and the 'maxRoomLevelMb'
- * capability.
+ * Room level apply to the reverb effect in millibels.
*/
int roomLevelMb;
/**
- * Room HF level apply to the reverb effect in millibels. The value of the roomHfLevelMb must be
- * in range of the value specified by the 'minRoomHfLevelMb' capability and the
- * 'maxRoomHfLevelMb' capability.
+ * Room HF level apply to the reverb effect in millibels.
*/
int roomHfLevelMb;
/**
- * Delay time apply to the reverb effect in milliseconds.The value of the decayTimeMs must
- * be non-negative and not exceed the value specified by the 'maxDecayTimeMs' capability.
+ * Delay time apply to the reverb effect in milliseconds.
*/
int decayTimeMs;
/**
- * HF decay ratio in permilles. The value of the decayHfRatioPm must be in range
- * of the value specified by the 'minDecayHfRatioPm' capability and the 'maxDecayHfRatioPm'
- * capability.
+ * HF decay ratio in permilles.
*/
int decayHfRatioPm;
/**
- * Reverb level in millibels. The value of the levelMb must be in range
- * of the value specified by the 'minLevelMb' capability and the 'maxLevelMb' capability.
+ * Reverb level in millibels.
*/
int levelMb;
/**
- * Reverb delay in milliseconds. The value of the delayMs must be non-negative and not
- * exceed the value specified by the 'maxDelayMs' capability.
+ * Reverb delay in milliseconds.
*/
int delayMs;
/**
- * Diffusion in permilles. The value of the diffusionPm must be non-negative and not
- * exceed the value specified by the 'maxDiffusionPm' capability.
+ * Diffusion in permilles.
*/
int diffusionPm;
/**
- * Density in permilles. The value of the densityPm must be non-negative and not
- * exceed the value specified by the 'maxDensityPm' capability.
+ * Density in permilles.
*/
int densityPm;
diff --git a/audio/aidl/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
index 7903fde..2bce151 100644
--- a/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
@@ -21,8 +21,8 @@
/**
* Equalizer specific definitions.
*
- * All parameters defined in union Equalizer must be gettable and settable. The capabilities defined
- * in Equalizer.Capability can only acquired with IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.equalizer definition if the
+ * definition for the corresponding parameter tag exist. See more detals about Range in Range.aidl.
*/
@VintfStability
union Equalizer {
@@ -41,28 +41,6 @@
VendorExtension vendorExtension;
/**
- * Capability MUST be supported by Equalizer implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * Equalizer capability extension, vendor can use this extension in case existing capability
- * definition not enough.
- */
- ParcelableHolder extension;
-
- /**
- * Bands frequency ranges supported.
- */
- BandFrequency[] bandFrequencies;
-
- /**
- * Presets name and index.
- */
- Preset[] presets;
- }
-
- /**
* Level setting for each band in millibels.
*/
@VintfStability
@@ -107,4 +85,14 @@
* Get only parameter, get the center frequency for all bands in milliHertz.
*/
int[] centerFreqMh;
+
+ /**
+ * Get only parameter, indicating bands frequency ranges supported by implementation.
+ */
+ BandFrequency[] bandFrequencies;
+
+ /**
+ * Get only parameter, indicating presets name and index supported by implementation.
+ */
+ Preset[] presets;
}
diff --git a/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl b/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
index 3063ee3..a8e4564 100644
--- a/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
+++ b/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
@@ -22,9 +22,9 @@
* HapticGenerator specific definitions. HapticGenerator effect provide HapticGenerator control and
* mute/unmute functionality.
*
- * All parameters defined in union HapticGenerator must be gettable and settable. The capabilities
- * defined in HapticGenerator.Capability can only acquired with IEffect.getDescriptor() and not
- * settable.
+ * All parameter settings must be inside the range of Capability.Range.hapticGenerator definition if
+ * the definition for the corresponding parameter tag exist. See more detals about Range in
+ * Range.aidl.
*/
@VintfStability
union HapticGenerator {
@@ -42,18 +42,6 @@
*/
VendorExtension vendorExtension;
- /**
- * Capability supported by HapticGenerator implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * HapticGenerator capability extension, vendor can use this extension in case existing
- * capability definition not enough.
- */
- VendorExtension extension;
- }
-
@VintfStability
@Backing(type="int")
enum VibratorScale {
diff --git a/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl b/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
index 0441f10..a7cbe8d 100644
--- a/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
@@ -21,9 +21,9 @@
/**
* LoudnessEnhancer specific definitions.
*
- * All parameters defined in union LoudnessEnhancer must be gettable and settable. The capabilities
- * defined in LoudnessEnhancer.Capability can only acquired with IEffect.getDescriptor() and not
- * settable.
+ * All parameter settings must be inside the range of Capability.Range.loudnessEnhancer definition
+ * if the definition for the corresponding parameter tag exist. See more detals about Range in
+ * Range.aidl.
*/
@VintfStability
union LoudnessEnhancer {
@@ -42,18 +42,6 @@
VendorExtension vendor;
/**
- * Capability supported by LoudnessEnhancer implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * LoudnessEnhancer capability extension, vendor can use this extension in case existing
- * capability definition not enough.
- */
- VendorExtension extension;
- }
-
- /**
* The maximum gain in millibels (mB) applied to the signal to process, default value is 0 which
* corresponds to no amplification.
*/
diff --git a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
index c4baff8..6c2fb5f 100644
--- a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -24,9 +24,9 @@
* engine, AC system) or non-stationary (other peoples conversations, car horn) for more advanced
* implementations.
*
- * All parameters defined in union NoiseSuppression must be gettable and settable. The capabilities
- * defined in NoiseSuppression.Capability can only acquired with IEffect.getDescriptor() and not
- * settable.
+ * All parameter settings must be inside the range of Capability.Range.noiseSuppression definition
+ * if the definition for the corresponding parameter tag exist. See more detals about Range in
+ * Range.aidl.
*/
@VintfStability
union NoiseSuppression {
@@ -45,18 +45,6 @@
VendorExtension vendor;
/**
- * Capability supported by NoiseSuppression implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * NoiseSuppression capability extension, vendor can use this extension in case existing
- * capability definition not enough.
- */
- ParcelableHolder extension;
- }
-
- /**
* Different level of Noise Suppression to set.
* As an example, webrtc have NsConfig::SuppressionLevel::k6dB applied for LOW level noise
* suppression, NsConfig::SuppressionLevel::k12dB for MEDIUM, and
diff --git a/audio/aidl/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
index 473dfb5..9f8874b 100644
--- a/audio/aidl/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
@@ -17,7 +17,8 @@
package android.hardware.audio.effect;
import android.hardware.audio.effect.AcousticEchoCanceler;
-import android.hardware.audio.effect.AutomaticGainControl;
+import android.hardware.audio.effect.AutomaticGainControlV1;
+import android.hardware.audio.effect.AutomaticGainControlV2;
import android.hardware.audio.effect.BassBoost;
import android.hardware.audio.effect.Downmix;
import android.hardware.audio.effect.DynamicsProcessing;
@@ -44,6 +45,14 @@
* 2. Parameters defined for a specific effect type.
* 3. Extension parameters ParcelableHolder can be used for vendor effect definition.
*
+ * All parameter settings must be inside the range of Capability.Range.$EffectType$ definition. If
+ * an effect implementation doesn't have limitation for a parameter, then don't define any effect
+ * range.
+ *
+ * All parameters are get-able, if any parameter doesn't support set, effect implementation should
+ * report the supported range for this parameter as range.min > range.max. If no support range is
+ * defined for a parameter, it means this parameter doesn't have any limitation.
+ *
*/
@VintfStability
union Parameter {
@@ -75,7 +84,8 @@
*
*/
AcousticEchoCanceler.Id acousticEchoCancelerTag;
- AutomaticGainControl.Id automaticGainControlTag;
+ AutomaticGainControlV1.Id automaticGainControlV1Tag;
+ AutomaticGainControlV2.Id automaticGainControlV2Tag;
BassBoost.Id bassBoostTag;
Downmix.Id downmixTag;
DynamicsProcessing.Id dynamicsProcessingTag;
@@ -157,7 +167,8 @@
union Specific {
VendorExtension vendorEffect;
AcousticEchoCanceler acousticEchoCanceler;
- AutomaticGainControl automaticGainControl;
+ AutomaticGainControlV1 automaticGainControlV1;
+ AutomaticGainControlV2 automaticGainControlV2;
BassBoost bassBoost;
Downmix downmix;
DynamicsProcessing dynamicsProcessing;
diff --git a/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl b/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl
index 6048eea..87c78b0 100644
--- a/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl
+++ b/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl
@@ -21,9 +21,9 @@
/**
* PresetReverb specific definitions.
*
- * All parameters defined in union PresetReverb must be gettable and settable. The capabilities
- * defined in PresetReverb.Capability can only acquired with IEffect.getDescriptor() and not
- * settable.
+ * All parameter settings must be inside the range of Capability.Range.presetReverb definition if
+ * the definition for the corresponding parameter tag exist. See more detals about Range in
+ * Range.aidl.
*/
@VintfStability
union PresetReverb {
@@ -78,21 +78,24 @@
VendorExtension vendor;
/**
- * Capability supported by effect implementation.
+ * The list of presets supported by implementation, effect implementation must declare the
+ * support of Presets with Capability.Range.presetReverb definition. For example, if an effect
+ * implementation supports all Presets in PresetReverb.Presets, then the capability will be:
+ * const std::vector<PresetReverb::Presets> kSupportedPresets{
+ * ndk::enum_range<PresetReverb::Presets>().begin(),
+ * ndk::enum_range<PresetReverb::Presets>().end()};
+ * const std::vector<Range::PresetReverbRange> kRanges = {
+ * MAKE_RANGE(PresetReverb, supportedPresets, kSupportedPresets, kSupportedPresets)};
*/
- @VintfStability
- parcelable Capability {
- VendorExtension extension;
-
- /**
- * List of presets supported.
- */
- Presets[] supportedPresets;
- }
+ Presets[] supportedPresets;
/**
* Get current reverb preset when used in getParameter.
* Enable a preset reverb when used in setParameter.
+ * With the current Range definition, there is no good way to define enum capability, so the
+ * Presets vector supportedPresets is used to defined the capability. Client must check the
+ * capability in PresetReverb.supportedPresets, and make sure to get the list of supported
+ * presets before setting.
*/
Presets preset;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Range.aidl b/audio/aidl/android/hardware/audio/effect/Range.aidl
index c052502..567320a 100644
--- a/audio/aidl/android/hardware/audio/effect/Range.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Range.aidl
@@ -16,50 +16,205 @@
package android.hardware.audio.effect;
+import android.hardware.audio.effect.AcousticEchoCanceler;
+import android.hardware.audio.effect.AutomaticGainControlV1;
+import android.hardware.audio.effect.AutomaticGainControlV2;
+import android.hardware.audio.effect.BassBoost;
+import android.hardware.audio.effect.Downmix;
+import android.hardware.audio.effect.DynamicsProcessing;
+import android.hardware.audio.effect.EnvironmentalReverb;
+import android.hardware.audio.effect.Equalizer;
+import android.hardware.audio.effect.HapticGenerator;
+import android.hardware.audio.effect.LoudnessEnhancer;
+import android.hardware.audio.effect.NoiseSuppression;
+import android.hardware.audio.effect.PresetReverb;
+import android.hardware.audio.effect.VendorExtension;
+import android.hardware.audio.effect.Virtualizer;
+import android.hardware.audio.effect.Visualizer;
+import android.hardware.audio.effect.Volume;
+
/**
- * Define the range (min and max) of a certain field, identified by tag.
- * Can be used by effect capabilities to define supported value ranges.
+ * Define the supported range of effect parameters.
+ * Effect implementation must report the supported range of parameter/capability if there is any
+ * limitation.
+ * Range of each effect type is defined with a vector, because each $EffectType$Range can only
+ * describe the range of one parameter. For example, Range::AcousticEchoCancelerRange can only
+ * describe one of vendor, echoDelayUs, and mobileMode.
+ *
+ * If an effect implementation needs to define the valid range for a certain parameter, it can
+ * write the minimum/maximum supported value to the corresponding effect range, and add the range
+ * to vector of this effect type.
+ * Say if an AcousticEchoCanceler implementation wants to define the supported range of echoDelayUs
+ * to [0, 500], then the Capability range should include an item in acousticEchoCanceler list:
+ * std::vector<Range::AcousticEchoCancelerRange> kRanges = {
+ * MAKE_RANGE(AcousticEchoCanceler, echoDelayUs, 0, 500)};
+ *
+ * For a more complex example, if a DynamicsProcessing implementation wants to define the
+ * supported range of preEqBand channel to [0, 1], band index to [0, 5], and cutoffFrequencyHz to
+ * [220, 20000]:
+ * Range::DynamicsProcessingRange kRange = {
+ * .min = DynamicsProcessing::make<DynamicsProcessing::preEqBand>(
+ * {EqBandConfig({.channel = 0,
+ * .band = 0,
+ * .enable = false,
+ * .cutoffFrequencyHz = 220,
+ * .gainDb = std::numeric_limits<float>::min()})}),
+ * .max = DynamicsProcessing::make<DynamicsProcessing::preEqBand>(
+ * {EqBandConfig({.channel = 1,
+ * .band = 5,
+ * .enable = true,
+ * .cutoffFrequencyHz = 20000,
+ * .gainDb = std::numeric_limits<float>::max()})})};
+ *
+ * For get only parameters, the effect implementation must define an invalid range (min > max), to
+ * indicate no parameter from the effect client can be accepted for setting. The effect
+ * implementation must return EX_ILLEGAL_ARGUMENT if it receives any setParameter call for a get
+ * only parameter.
+ * As an example, the get-only parameter Virtualizer.speakerAngles can be defined with:
+ * Range::VirtualizerRange kRanges = {
+ * MAKE_RANGE(Virtualizer, speakerAngles,
+ * {Virtualizer::ChannelAngle({.channel = 1},
+ * {Virtualizer::ChannelAngle({.channel = 0})};
+ *
+ * For a capability definition (which is also get only), the effect implementation must define a
+ * range with min == max, to indicate this is a fixed capability which shouldn't set by client.
+ * As an example, the Equalizer presets capability can be defined with:
+ * std::vector<Equalizer::Preset> kPresets = {
+ * {0, "Normal"}, {1, "Classical"}, {2, "Dance"}, {3, "Flat"}, {4, "Folk"},
+ * {5, "Heavy Metal"}, {6, "Hip Hop"}, {7, "Jazz"}, {8, "Pop"}, {9, "Rock"}};
+ * Range::EqualizerRange kRanges =
+ * MAKE_RANGE(Equalizer, presets, EqualizerSw::kPresets, EqualizerSw::kPresets);
+ *
+ * For enum capability, it's necessary to either list a range, or explicitly list out all enums in
+ * the Range definition, see PresetReverb.supportedPresets as example.
+ *
+ * The effect implementation must return EX_ILLEGAL_ARGUMENT if:
+ * 1. receive any setParameter call for get only parameter (min > max).
+ * 2. receive any setParameter call for capability parameter definition (min == max).
+ * 3. receive any setParameter call for parameters not in the range of [min, max].
+ *
*/
@VintfStability
-parcelable Range {
+union Range {
+ @VintfStability
+ parcelable AcousticEchoCancelerRange {
+ AcousticEchoCanceler min;
+ AcousticEchoCanceler max;
+ }
+
+ @VintfStability
+ parcelable AutomaticGainControlV1Range {
+ AutomaticGainControlV1 min;
+ AutomaticGainControlV1 max;
+ }
+
+ @VintfStability
+ parcelable AutomaticGainControlV2Range {
+ AutomaticGainControlV2 min;
+ AutomaticGainControlV2 max;
+ }
+
+ @VintfStability
+ parcelable BassBoostRange {
+ BassBoost min;
+ BassBoost max;
+ }
+
+ @VintfStability
+ parcelable DownmixRange {
+ Downmix min;
+ Downmix max;
+ }
+
+ @VintfStability
+ parcelable DynamicsProcessingRange {
+ DynamicsProcessing min;
+ DynamicsProcessing max;
+ }
+
+ @VintfStability
+ parcelable EnvironmentalReverbRange {
+ EnvironmentalReverb min;
+ EnvironmentalReverb max;
+ }
+
+ @VintfStability
+ parcelable EqualizerRange {
+ Equalizer min;
+ Equalizer max;
+ }
+
+ @VintfStability
+ parcelable HapticGeneratorRange {
+ HapticGenerator min;
+ HapticGenerator max;
+ }
+
+ @VintfStability
+ parcelable LoudnessEnhancerRange {
+ LoudnessEnhancer min;
+ LoudnessEnhancer max;
+ }
+
+ @VintfStability
+ parcelable NoiseSuppressionRange {
+ NoiseSuppression min;
+ NoiseSuppression max;
+ }
+
+ @VintfStability
+ parcelable PresetReverbRange {
+ PresetReverb min;
+ PresetReverb max;
+ }
+
+ @VintfStability
+ parcelable VendorExtensionRange {
+ VendorExtension min;
+ VendorExtension max;
+ }
+
+ @VintfStability
+ parcelable VirtualizerRange {
+ Virtualizer min;
+ Virtualizer max;
+ }
+
+ @VintfStability
+ parcelable VisualizerRange {
+ Visualizer min;
+ Visualizer max;
+ }
+
+ @VintfStability
+ parcelable VolumeRange {
+ Volume min;
+ Volume max;
+ }
+
/**
- * The union tag name which the range is defined for.
- * For example: if used in AutomaticGainControlV1.Capability, value of Range.tag could be
- * targetLevelDbFs or compressionGainDb.
+ * The vector of range defined for parameters of each effect implementation.
+ * Each element of the vector represents the min and max range of a parameter, so the size of
+ * vector is the number of parameter ranges defined for this effect implementation.
+ *
+ * The effect implementation must not have duplicated parameter range definition in the vector.
+ * Client side must go though the vector and make sure the parameter setting to effect
+ * implementation is in valid range.
*/
- int tag;
-
- @VintfStability
- parcelable Int {
- int min;
- int max;
- }
-
- @VintfStability
- parcelable Float {
- float min;
- float max;
- }
-
- @VintfStability
- parcelable Long {
- long min;
- long max;
- }
-
- @VintfStability
- parcelable Byte {
- byte min;
- byte max;
- }
-
- @VintfStability
- union Types {
- Int rangeInt;
- Float rangeFloat;
- Long rangeLong;
- Byte rangeByte;
- }
-
- Types types;
+ VendorExtensionRange[] vendorExtension = {};
+ AcousticEchoCancelerRange[] acousticEchoCanceler;
+ AutomaticGainControlV1Range[] automaticGainControlV1;
+ AutomaticGainControlV2Range[] automaticGainControlV2;
+ BassBoostRange[] bassBoost;
+ DownmixRange[] downmix;
+ DynamicsProcessingRange[] dynamicsProcessing;
+ EnvironmentalReverbRange[] environmentalReverb;
+ EqualizerRange[] equalizer;
+ HapticGeneratorRange[] hapticGenerator;
+ LoudnessEnhancerRange[] loudnessEnhancer;
+ NoiseSuppressionRange[] noiseSuppression;
+ PresetReverbRange[] presetReverb;
+ VirtualizerRange[] virtualizer;
+ VisualizerRange[] visualizer;
+ VolumeRange[] volume;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl b/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
index fc453ad..37ea2a4 100644
--- a/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
@@ -24,9 +24,8 @@
* Virtualizer specific definitions. An audio virtualizer is a general name for an effect to
* spatialize audio channels.
*
- * All parameters defined in union Virtualizer must be gettable and settable. The capabilities
- * defined in Virtualizer.Capability can only acquired with IEffect.getDescriptor() and not
- * settable.
+ * All parameter settings must be inside the range of Capability.Range.virtualizer definition if the
+ * definition for the corresponding parameter tag exist. See more detals about Range in Range.aidl.
*/
@VintfStability
union Virtualizer {
@@ -65,35 +64,12 @@
}
/**
- * Capability supported by Virtualizer implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * Virtualizer capability extension, vendor can use this extension in case existing
- * capability definition not enough.
- */
- VendorExtension extension;
- /**
- * Maximum possible per mille strength.
- */
- int maxStrengthPm;
- /**
- * Indicates whether setting strength is supported. False value indicates only one strength
- * is supported and setParameter() method will always return EX_ILLEGAL_ARGUMENT.
- */
- boolean strengthSupported;
- }
-
- /**
* The per mille strength of the virtualizer effect.
*
* If the implementation does not support per mille accuracy for setting the strength, it is
* allowed to round the given strength to the nearest supported value. In this case {@link
* #IEffect.getParameter()} method should return the rounded value that was actually set.
*
- * The value of the strength must be non-negative and not exceed the value specified by
- * the 'maxStrengthPm' capability.
*/
int strengthPm;
@@ -128,6 +104,7 @@
ChannelAngle[] speakerAngles;
/**
+ * Get only parameter.
* The audio device on which virtualzation mode is forced.
*/
AudioDeviceDescription device;
diff --git a/audio/aidl/android/hardware/audio/effect/Visualizer.aidl b/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
index dfe29c8..8f2faaa 100644
--- a/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
@@ -22,9 +22,8 @@
* Visualizer specific definitions. Visualizer enables application to retrieve part of the currently
* playing audio for visualization purpose
*
- * All parameters defined in union Visualizer other than these in GetOnlyParameters and
- * SetOnlyParameters must be gettable and settable. The capabilities defined in
- * Visualizer.Capability can only acquired with IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.visualizer definition if the
+ * definition for the corresponding parameter tag exist. See more detals about Range in Range.aidl.
*
*/
@VintfStability
@@ -35,8 +34,6 @@
@VintfStability
union Id {
int vendorExtensionTag;
- GetOnlyParameters.Tag getOnlyParamTag;
- SetOnlyParameters.Tag setOnlyParamTag;
Visualizer.Tag commonTag;
}
Id id;
@@ -47,35 +44,6 @@
VendorExtension vendor;
/**
- * Capability supported by Visualizer implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * Visualizer capability extension, vendor can use this extension in case existing
- * capability definition not enough.
- */
- VendorExtension extension;
- /**
- * Max latency supported in millseconds.
- */
- int maxLatencyMs;
- /**
- * Capture size range.
- */
- CaptureSamplesRange captureSampleRange;
- }
-
- /**
- * Supported capture size range in samples.
- */
- @VintfStability
- parcelable CaptureSamplesRange {
- int min;
- int max;
- }
-
- /**
* Type of scaling applied on the captured visualization data.
*/
@VintfStability
@@ -115,51 +83,42 @@
}
/**
- * Any parameter defined in this union must be gettable via getParameter(), but must not
- * settable.
+ * Get only parameter to get the current measurements.
*/
@VintfStability
- union GetOnlyParameters {
- /**
- * Get the current measurements.
- */
- @VintfStability
- parcelable Measurement {
- int rms;
- int peak;
- }
- Measurement measurement;
-
- /**
- * Get the latest captureSamples of PCM samples (8 bits per sample).
- */
- byte[] captureSampleBuffer;
+ parcelable Measurement {
+ int rms;
+ int peak;
}
- GetOnlyParameters getOnlyParameters;
+ Measurement measurement;
/**
- * Any parameter defined in this union must be settable via setParameter(), but must not
- * gettable.
+ * Get only parameter to get the latest captured samples of PCM samples (8 bits per sample).
*/
- @VintfStability
- union SetOnlyParameters {
- /**
- * Used by framework to inform the visualizer about the downstream latency (audio hardware
- * driver estimated latency in milliseconds).
- */
- int latencyMs;
- }
- SetOnlyParameters setOnlyParameters;
+ byte[] captureSampleBuffer;
/**
- * Current capture size in number of samples. The capture size must be inside
- * Capability.captureSizeRange.
+ * Used by framework to inform the visualizer about the downstream latency (audio hardware
+ * driver estimated latency in milliseconds).
+ *
+ * Visualizer implementation must use Range.VisualizerRange to define the range of supported
+ * latency.
+ */
+ int latencyMs;
+
+ /**
+ * Current capture size in number of samples.
+ *
+ * Visualizer implementation must use Range.VisualizerRange to define the range of supported
+ * capture size.
*/
int captureSamples;
+
/**
* Visualizer capture mode
*/
ScalingMode scalingMode;
+
/**
* Visualizer measurement mode.
*/
diff --git a/audio/aidl/android/hardware/audio/effect/Volume.aidl b/audio/aidl/android/hardware/audio/effect/Volume.aidl
index 5033881..4a76703 100644
--- a/audio/aidl/android/hardware/audio/effect/Volume.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Volume.aidl
@@ -21,8 +21,8 @@
/**
* Volume specific definitions. Volume effect provide volume control and mute/unmute functionality.
*
- * All parameters defined in union Volume must be gettable and settable. The capabilities defined in
- * Volume.Capability can only acquired with IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.volume definition if the
+ * definition for the corresponding parameter tag exist. See more detals about Range in Range.aidl.
*/
@VintfStability
union Volume {
@@ -41,29 +41,7 @@
VendorExtension vendor;
/**
- * Capability supported by Volume implementation.
- */
- @VintfStability
- parcelable Capability {
- /**
- * Volume capability extension, vendor can use this extension in case existing capability
- * definition not enough.
- */
- VendorExtension extension;
-
- /**
- * Minimum Volume level supported in dB.
- */
- int minLevelDb;
-
- /**
- * Maximum Volume level supported in dB.
- */
- int maxLevelDb;
- }
-
- /**
- * Current level in dB with supported minimum and maximum level specified in capability.
+ * Current level in dB.
*/
int levelDb;
/**
diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp
index 854c7f3..a72be24 100644
--- a/audio/aidl/default/Configuration.cpp
+++ b/audio/aidl/default/Configuration.cpp
@@ -40,6 +40,7 @@
using aidl::android::media::audio::common::AudioPortMixExt;
using aidl::android::media::audio::common::AudioProfile;
using aidl::android::media::audio::common::Int;
+using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
using android::hardware::audio::common::makeBitPositionFlagMask;
diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp
index 403a4b9..e90fe35 100644
--- a/audio/aidl/default/EffectImpl.cpp
+++ b/audio/aidl/default/EffectImpl.cpp
@@ -78,7 +78,7 @@
ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) {
LOG(DEBUG) << __func__ << " with: " << param.toString();
- auto tag = param.getTag();
+ const auto tag = param.getTag();
switch (tag) {
case Parameter::common:
case Parameter::deviceDescription:
@@ -107,11 +107,8 @@
"CommonParamNotSupported");
break;
}
- case Parameter::Id::vendorEffectTag: {
- LOG(DEBUG) << __func__ << " noop for vendor tag";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "vendortagNotSupported");
- }
+ case Parameter::Id::vendorEffectTag:
+ FALLTHROUGH_INTENDED;
default: {
Parameter::Specific specific;
RETURN_IF_ASTATUS_NOT_OK(getParameterSpecific(id, &specific), "SpecParamNotSupported");
diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp
index f7894c4..024c0ea 100644
--- a/audio/aidl/default/EffectThread.cpp
+++ b/audio/aidl/default/EffectThread.cpp
@@ -86,14 +86,14 @@
{
std::lock_guard lg(mThreadMutex);
if (stop == mStop) {
- LOG(WARNING) << __func__ << " already " << stop ? "stop" : "start";
+ LOG(WARNING) << __func__ << " already " << (stop ? "stop" : "start");
return RetCode::SUCCESS;
}
mStop = stop;
}
mCv.notify_one();
- LOG(DEBUG) << stop ? "stop done" : "start done";
+ LOG(DEBUG) << (stop ? "stop done" : "start done");
return RetCode::SUCCESS;
}
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 2f6ab2f..10aead2 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -55,6 +55,7 @@
using aidl::android::media::audio::common::AudioProfile;
using aidl::android::media::audio::common::Boolean;
using aidl::android::media::audio::common::Int;
+using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
using android::hardware::audio::common::getFrameSizeInBytes;
using android::hardware::audio::common::isBitPositionFlagSet;
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index d62ca1d..49ad2f2 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -31,6 +31,8 @@
using aidl::android::media::audio::common::AudioLatencyMode;
using aidl::android::media::audio::common::AudioOffloadInfo;
using aidl::android::media::audio::common::AudioPlaybackRate;
+using aidl::android::media::audio::common::MicrophoneDynamicInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
using android::hardware::audio::common::getChannelCount;
using android::hardware::audio::common::getFrameSizeInBytes;
diff --git a/audio/aidl/default/StreamStub.cpp b/audio/aidl/default/StreamStub.cpp
index 85d1e16..0ed9357 100644
--- a/audio/aidl/default/StreamStub.cpp
+++ b/audio/aidl/default/StreamStub.cpp
@@ -24,6 +24,7 @@
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::media::audio::common::AudioDevice;
using aidl::android::media::audio::common::AudioOffloadInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
index 40b46e0..f5af81e 100644
--- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
+++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
@@ -30,6 +30,7 @@
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kAcousticEchoCancelerSwImplUUID;
+using aidl::android::hardware::audio::effect::Range;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
@@ -60,8 +61,14 @@
namespace aidl::android::hardware::audio::effect {
const std::string AcousticEchoCancelerSw::kEffectName = "AcousticEchoCancelerSw";
-const AcousticEchoCanceler::Capability AcousticEchoCancelerSw::kCapability = {
- .maxEchoDelayUs = 500, .supportMobileMode = false};
+
+const std::vector<Range::AcousticEchoCancelerRange> AcousticEchoCancelerSw::kRanges = {
+ MAKE_RANGE(AcousticEchoCanceler, echoDelayUs, 0, 500),
+ /* mobile mode not supported, and not settable */
+ MAKE_RANGE(AcousticEchoCanceler, mobileMode, false, false)};
+
+const Capability AcousticEchoCancelerSw::kCapability = {.range = AcousticEchoCancelerSw::kRanges};
+
const Descriptor AcousticEchoCancelerSw::kDescriptor = {
.common = {.id = {.type = kAcousticEchoCancelerTypeUUID,
.uuid = kAcousticEchoCancelerSwImplUUID,
@@ -71,8 +78,7 @@
.volume = Flags::Volume::CTRL},
.name = AcousticEchoCancelerSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::acousticEchoCanceler>(
- AcousticEchoCancelerSw::kCapability)};
+ .capability = AcousticEchoCancelerSw::kCapability};
ndk::ScopedAStatus AcousticEchoCancelerSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -87,8 +93,9 @@
RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
auto& param = specific.get<Parameter::Specific::acousticEchoCanceler>();
- auto tag = param.getTag();
+ RETURN_IF(!inRange(param, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
+ auto tag = param.getTag();
switch (tag) {
case AcousticEchoCanceler::echoDelayUs: {
RETURN_IF(mContext->setEchoDelay(param.get<AcousticEchoCanceler::echoDelayUs>()) !=
@@ -182,10 +189,6 @@
}
RetCode AcousticEchoCancelerSwContext::setEchoDelay(int echoDelayUs) {
- if (echoDelayUs < 0 || echoDelayUs > AcousticEchoCancelerSw::kCapability.maxEchoDelayUs) {
- LOG(DEBUG) << __func__ << " illegal delay " << echoDelayUs;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
mEchoDelayUs = echoDelayUs;
return RetCode::SUCCESS;
}
diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h
index 5f1bc46..753207d 100644
--- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h
+++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h
@@ -17,6 +17,7 @@
#pragma once
#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <aidl/android/hardware/audio/effect/Range.h>
#include <fmq/AidlMessageQueue.h>
#include <cstdlib>
#include <memory>
@@ -43,8 +44,7 @@
class AcousticEchoCancelerSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const bool kStrengthSupported;
- static const AcousticEchoCanceler::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
AcousticEchoCancelerSw() { LOG(DEBUG) << __func__; }
~AcousticEchoCancelerSw() {
@@ -65,6 +65,7 @@
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
+ static const std::vector<Range::AcousticEchoCancelerRange> kRanges;
std::shared_ptr<AcousticEchoCancelerSwContext> mContext;
ndk::ScopedAStatus getParameterAcousticEchoCanceler(const AcousticEchoCanceler::Tag& tag,
Parameter::Specific* specific);
diff --git a/audio/aidl/default/audio_effects_config.xml b/audio/aidl/default/audio_effects_config.xml
index 6714a7e..88c4459 100644
--- a/audio/aidl/default/audio_effects_config.xml
+++ b/audio/aidl/default/audio_effects_config.xml
@@ -29,7 +29,8 @@
-->
<libraries>
<library name="aecsw" path="libaecsw.so"/>
- <library name="agcsw" path="libagcsw.so"/>
+ <library name="agc1sw" path="libagc1sw.so"/>
+ <library name="agc2sw" path="libagc2sw.so"/>
<library name="bassboostsw" path="libbassboostsw.so"/>
<library name="bundle" path="libbundleaidl.so"/>
<library name="downmix" path="libdownmixaidl.so"/>
@@ -44,6 +45,7 @@
<library name="virtualizersw" path="libvirtualizersw.so"/>
<library name="visualizer" path="libvisualizeraidl.so"/>
<library name="volumesw" path="libvolumesw.so"/>
+ <library name="extensioneffect" path="libextensioneffect.so"/>
</libraries>
<!-- list of effects to load.
@@ -67,7 +69,8 @@
<effects>
<effect name="acoustic_echo_canceler" library="aecsw" uuid="bb392ec0-8d4d-11e0-a896-0002a5d5c51b"/>
- <effect name="automatic_gain_control" library="agcsw" uuid="89f38e65-d4d2-4d64-ad0e-2b3e799ea886"/>
+ <effect name="automatic_gain_control_v1" library="agc1sw" uuid="aa8130e0-66fc-11e0-bad0-0002a5d5c51b"/>
+ <effect name="automatic_gain_control_v2" library="agc2sw" uuid="89f38e65-d4d2-4d64-ad0e-2b3e799ea886"/>
<effectProxy name="bassboost" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
<libsw library="bassboostsw" uuid="fa8181f2-588b-11ed-9b6a-0242ac120002"/>
<libsw library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/>
@@ -93,6 +96,7 @@
<libsw library="equalizersw" uuid="0bed4300-847d-11df-bb17-0002a5d5c51b"/>
<libsw library="bundle" uuid="ce772f20-847d-11df-bb17-0002a5d5c51b"/>
</effectProxy>
+ <effect name="extensioneffect" library="extensioneffect" uuid="fa81dd00-588b-11ed-9b6a-0242ac120002"/>
</effects>
<!-- Audio pre processor configurations.
diff --git a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp b/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp
deleted file mode 100644
index 8c706ef..0000000
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <algorithm>
-#include <cstddef>
-#include <memory>
-#define LOG_TAG "AHAL_AutomaticGainControlSw"
-#include <Utils.h>
-#include <unordered_set>
-
-#include <android-base/logging.h>
-#include <fmq/AidlMessageQueue.h>
-
-#include "AutomaticGainControlSw.h"
-
-using aidl::android::hardware::audio::effect::AutomaticGainControlSw;
-using aidl::android::hardware::audio::effect::Descriptor;
-using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kAutomaticGainControlSwImplUUID;
-using aidl::android::media::audio::common::AudioUuid;
-
-extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
- std::shared_ptr<IEffect>* instanceSpp) {
- if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlSwImplUUID) {
- LOG(ERROR) << __func__ << "uuid not supported";
- return EX_ILLEGAL_ARGUMENT;
- }
- if (instanceSpp) {
- *instanceSpp = ndk::SharedRefBase::make<AutomaticGainControlSw>();
- LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
- return EX_NONE;
- } else {
- LOG(ERROR) << __func__ << " invalid input parameter!";
- return EX_ILLEGAL_ARGUMENT;
- }
-}
-
-extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlSwImplUUID) {
- LOG(ERROR) << __func__ << "uuid not supported";
- return EX_ILLEGAL_ARGUMENT;
- }
- *_aidl_return = AutomaticGainControlSw::kDescriptor;
- return EX_NONE;
-}
-
-namespace aidl::android::hardware::audio::effect {
-
-const std::string AutomaticGainControlSw::kEffectName = "AutomaticGainControlSw";
-const AutomaticGainControl::Capability AutomaticGainControlSw::kCapability = {
- .maxFixedDigitalGainMb = 50000, .maxSaturationMarginMb = 10000};
-const Descriptor AutomaticGainControlSw::kDescriptor = {
- .common = {.id = {.type = kAutomaticGainControlTypeUUID,
- .uuid = kAutomaticGainControlSwImplUUID,
- .proxy = std::nullopt},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::FIRST,
- .volume = Flags::Volume::CTRL},
- .name = AutomaticGainControlSw::kEffectName,
- .implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::automaticGainControl>(
- AutomaticGainControlSw::kCapability)};
-
-ndk::ScopedAStatus AutomaticGainControlSw::getDescriptor(Descriptor* _aidl_return) {
- LOG(DEBUG) << __func__ << kDescriptor.toString();
- *_aidl_return = kDescriptor;
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus AutomaticGainControlSw::setParameterSpecific(
- const Parameter::Specific& specific) {
- RETURN_IF(Parameter::Specific::automaticGainControl != specific.getTag(), EX_ILLEGAL_ARGUMENT,
- "EffectNotSupported");
- RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
-
- auto& param = specific.get<Parameter::Specific::automaticGainControl>();
- auto tag = param.getTag();
-
- switch (tag) {
- case AutomaticGainControl::fixedDigitalGainMb: {
- RETURN_IF(mContext->setDigitalGain(
- param.get<AutomaticGainControl::fixedDigitalGainMb>()) !=
- RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "digitalGainNotSupported");
- return ndk::ScopedAStatus::ok();
- }
- case AutomaticGainControl::levelEstimator: {
- RETURN_IF(
- mContext->setLevelEstimator(
- param.get<AutomaticGainControl::levelEstimator>()) != RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "levelEstimatorNotSupported");
- return ndk::ScopedAStatus::ok();
- }
- case AutomaticGainControl::saturationMarginMb: {
- RETURN_IF(mContext->setSaturationMargin(
- param.get<AutomaticGainControl::saturationMarginMb>()) !=
- RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "saturationMarginNotSupported");
- return ndk::ScopedAStatus::ok();
- }
- default: {
- LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "AutomaticGainControlTagNotSupported");
- }
- }
-}
-
-ndk::ScopedAStatus AutomaticGainControlSw::getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) {
- auto tag = id.getTag();
- RETURN_IF(Parameter::Id::automaticGainControlTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
- auto specificId = id.get<Parameter::Id::automaticGainControlTag>();
- auto specificIdTag = specificId.getTag();
- switch (specificIdTag) {
- case AutomaticGainControl::Id::commonTag:
- return getParameterAutomaticGainControl(
- specificId.get<AutomaticGainControl::Id::commonTag>(), specific);
- default:
- LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "AutomaticGainControlTagNotSupported");
- }
-}
-
-ndk::ScopedAStatus AutomaticGainControlSw::getParameterAutomaticGainControl(
- const AutomaticGainControl::Tag& tag, Parameter::Specific* specific) {
- RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
- AutomaticGainControl param;
- switch (tag) {
- case AutomaticGainControl::fixedDigitalGainMb: {
- param.set<AutomaticGainControl::fixedDigitalGainMb>(mContext->getDigitalGain());
- break;
- }
- case AutomaticGainControl::levelEstimator: {
- param.set<AutomaticGainControl::levelEstimator>(mContext->getLevelEstimator());
- break;
- }
- case AutomaticGainControl::saturationMarginMb: {
- param.set<AutomaticGainControl::saturationMarginMb>(mContext->getSaturationMargin());
- break;
- }
- default: {
- LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "AutomaticGainControlTagNotSupported");
- }
- }
-
- specific->set<Parameter::Specific::automaticGainControl>(param);
- return ndk::ScopedAStatus::ok();
-}
-
-std::shared_ptr<EffectContext> AutomaticGainControlSw::createContext(
- const Parameter::Common& common) {
- if (mContext) {
- LOG(DEBUG) << __func__ << " context already exist";
- } else {
- mContext = std::make_shared<AutomaticGainControlSwContext>(1 /* statusFmqDepth */, common);
- }
- return mContext;
-}
-
-std::shared_ptr<EffectContext> AutomaticGainControlSw::getContext() {
- return mContext;
-}
-
-RetCode AutomaticGainControlSw::releaseContext() {
- if (mContext) {
- mContext.reset();
- }
- return RetCode::SUCCESS;
-}
-
-// Processing method running in EffectWorker thread.
-IEffect::Status AutomaticGainControlSw::effectProcessImpl(float* in, float* out, int samples) {
- // TODO: get data buffer and process.
- LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
- for (int i = 0; i < samples; i++) {
- *out++ = *in++;
- }
- return {STATUS_OK, samples, samples};
-}
-
-RetCode AutomaticGainControlSwContext::setDigitalGain(int gain) {
- if (gain < 0 || gain > AutomaticGainControlSw::kCapability.maxFixedDigitalGainMb) {
- LOG(DEBUG) << __func__ << " illegal digital gain " << gain;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- mDigitalGain = gain;
- return RetCode::SUCCESS;
-}
-
-int AutomaticGainControlSwContext::getDigitalGain() {
- return mDigitalGain;
-}
-
-RetCode AutomaticGainControlSwContext::setLevelEstimator(
- AutomaticGainControl::LevelEstimator levelEstimator) {
- mLevelEstimator = levelEstimator;
- return RetCode::SUCCESS;
-}
-
-AutomaticGainControl::LevelEstimator AutomaticGainControlSwContext::getLevelEstimator() {
- return mLevelEstimator;
-}
-
-RetCode AutomaticGainControlSwContext::setSaturationMargin(int margin) {
- if (margin < 0 || margin > AutomaticGainControlSw::kCapability.maxSaturationMarginMb) {
- LOG(DEBUG) << __func__ << " illegal saturationMargin " << margin;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- mSaturationMargin = margin;
- return RetCode::SUCCESS;
-}
-
-int AutomaticGainControlSwContext::getSaturationMargin() {
- return mSaturationMargin;
-}
-
-} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/Android.bp b/audio/aidl/default/automaticGainControlV1/Android.bp
similarity index 91%
copy from audio/aidl/default/automaticGainControl/Android.bp
copy to audio/aidl/default/automaticGainControlV1/Android.bp
index 17d6416..4ae8e63 100644
--- a/audio/aidl/default/automaticGainControl/Android.bp
+++ b/audio/aidl/default/automaticGainControlV1/Android.bp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -24,14 +24,14 @@
}
cc_library_shared {
- name: "libagcsw",
+ name: "libagc1sw",
defaults: [
"aidlaudioeffectservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_effect_ndk_shared",
],
srcs: [
- "AutomaticGainControlSw.cpp",
+ "AutomaticGainControlV1Sw.cpp",
":effectCommonFile",
],
relative_install_path: "soundfx",
diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp
new file mode 100644
index 0000000..39290b4
--- /dev/null
+++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+#define LOG_TAG "AHAL_AutomaticGainControlV1Sw"
+
+#include <android-base/logging.h>
+
+#include "AutomaticGainControlV1Sw.h"
+
+using aidl::android::hardware::audio::effect::AutomaticGainControlV1Sw;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV1SwImplUUID;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<AutomaticGainControlV1Sw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ *_aidl_return = AutomaticGainControlV1Sw::kDescriptor;
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+const std::string AutomaticGainControlV1Sw::kEffectName = "AutomaticGainControlV1Sw";
+
+const std::vector<Range::AutomaticGainControlV1Range> AutomaticGainControlV1Sw::kRanges = {
+ MAKE_RANGE(AutomaticGainControlV1, targetPeakLevelDbFs, -3100, 0),
+ MAKE_RANGE(AutomaticGainControlV1, maxCompressionGainDb, 0, 9000)};
+
+const Capability AutomaticGainControlV1Sw::kCapability = {
+ .range = AutomaticGainControlV1Sw::kRanges};
+
+const Descriptor AutomaticGainControlV1Sw::kDescriptor = {
+ .common = {.id = {.type = kAutomaticGainControlV1TypeUUID,
+ .uuid = kAutomaticGainControlV1SwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = AutomaticGainControlV1Sw::kEffectName,
+ .implementor = "The Android Open Source Project"},
+ .capability = AutomaticGainControlV1Sw::kCapability};
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::setParameterSpecific(
+ const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::automaticGainControlV1 != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ auto& param = specific.get<Parameter::Specific::automaticGainControlV1>();
+ RETURN_IF(!inRange(param, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
+ auto tag = param.getTag();
+ switch (tag) {
+ case AutomaticGainControlV1::targetPeakLevelDbFs: {
+ RETURN_IF(mContext->setTargetPeakLevel(
+ param.get<AutomaticGainControlV1::targetPeakLevelDbFs>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "targetPeakLevelNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV1::maxCompressionGainDb: {
+ RETURN_IF(mContext->setMaxCompressionGain(
+ param.get<AutomaticGainControlV1::maxCompressionGainDb>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "maxCompressionGainNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV1::enableLimiter: {
+ RETURN_IF(
+ mContext->setEnableLimiter(
+ param.get<AutomaticGainControlV1::enableLimiter>()) != RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "enableLimiterNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV1TagNotSupported");
+ }
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::automaticGainControlV1Tag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ auto specificId = id.get<Parameter::Id::automaticGainControlV1Tag>();
+ auto specificIdTag = specificId.getTag();
+ switch (specificIdTag) {
+ case AutomaticGainControlV1::Id::commonTag:
+ return getParameterAutomaticGainControlV1(
+ specificId.get<AutomaticGainControlV1::Id::commonTag>(), specific);
+ default:
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV1TagNotSupported");
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::getParameterAutomaticGainControlV1(
+ const AutomaticGainControlV1::Tag& tag, Parameter::Specific* specific) {
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+ AutomaticGainControlV1 param;
+ switch (tag) {
+ case AutomaticGainControlV1::targetPeakLevelDbFs: {
+ param.set<AutomaticGainControlV1::targetPeakLevelDbFs>(mContext->getTargetPeakLevel());
+ break;
+ }
+ case AutomaticGainControlV1::maxCompressionGainDb: {
+ param.set<AutomaticGainControlV1::maxCompressionGainDb>(
+ mContext->getMaxCompressionGain());
+ break;
+ }
+ case AutomaticGainControlV1::enableLimiter: {
+ param.set<AutomaticGainControlV1::enableLimiter>(mContext->getEnableLimiter());
+ break;
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV1TagNotSupported");
+ }
+ }
+
+ specific->set<Parameter::Specific::automaticGainControlV1>(param);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV1Sw::createContext(
+ const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ } else {
+ mContext =
+ std::make_shared<AutomaticGainControlV1SwContext>(1 /* statusFmqDepth */, common);
+ }
+ return mContext;
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV1Sw::getContext() {
+ return mContext;
+}
+
+RetCode AutomaticGainControlV1Sw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status AutomaticGainControlV1Sw::effectProcessImpl(float* in, float* out, int samples) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
+ for (int i = 0; i < samples; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, samples, samples};
+}
+
+RetCode AutomaticGainControlV1SwContext::setTargetPeakLevel(int targetPeakLevel) {
+ mTargetPeakLevel = targetPeakLevel;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV1SwContext::getTargetPeakLevel() {
+ return mTargetPeakLevel;
+}
+
+RetCode AutomaticGainControlV1SwContext::setMaxCompressionGain(int maxCompressionGain) {
+ mMaxCompressionGain = maxCompressionGain;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV1SwContext::getMaxCompressionGain() {
+ return mMaxCompressionGain;
+}
+
+RetCode AutomaticGainControlV1SwContext::setEnableLimiter(bool enableLimiter) {
+ mEnableLimiter = enableLimiter;
+ return RetCode::SUCCESS;
+}
+
+bool AutomaticGainControlV1SwContext::getEnableLimiter() {
+ return mEnableLimiter;
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h
new file mode 100644
index 0000000..6ba7328
--- /dev/null
+++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+#pragma once
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class AutomaticGainControlV1SwContext final : public EffectContext {
+ public:
+ AutomaticGainControlV1SwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+
+ RetCode setTargetPeakLevel(int targetPeakLevel);
+ int getTargetPeakLevel();
+ RetCode setMaxCompressionGain(int maxCompressionGainDb);
+ int getMaxCompressionGain();
+ RetCode setEnableLimiter(bool enableLimiter);
+ bool getEnableLimiter();
+
+ private:
+ int mTargetPeakLevel = 0;
+ int mMaxCompressionGain = 0;
+ bool mEnableLimiter = false;
+};
+
+class AutomaticGainControlV1Sw final : public EffectImpl {
+ public:
+ static const std::string kEffectName;
+ static const bool kStrengthSupported;
+ static const Capability kCapability;
+ static const Descriptor kDescriptor;
+ AutomaticGainControlV1Sw() { LOG(DEBUG) << __func__; }
+ ~AutomaticGainControlV1Sw() {
+ cleanUp();
+ LOG(DEBUG) << __func__;
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ std::shared_ptr<EffectContext> getContext() override;
+ RetCode releaseContext() override;
+
+ std::string getEffectName() override { return kEffectName; };
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+
+ private:
+ static const std::vector<Range::AutomaticGainControlV1Range> kRanges;
+ std::shared_ptr<AutomaticGainControlV1SwContext> mContext;
+ ndk::ScopedAStatus getParameterAutomaticGainControlV1(const AutomaticGainControlV1::Tag& tag,
+ Parameter::Specific* specific);
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/Android.bp b/audio/aidl/default/automaticGainControlV2/Android.bp
similarity index 95%
rename from audio/aidl/default/automaticGainControl/Android.bp
rename to audio/aidl/default/automaticGainControlV2/Android.bp
index 17d6416..631cf58 100644
--- a/audio/aidl/default/automaticGainControl/Android.bp
+++ b/audio/aidl/default/automaticGainControlV2/Android.bp
@@ -24,14 +24,14 @@
}
cc_library_shared {
- name: "libagcsw",
+ name: "libagc2sw",
defaults: [
"aidlaudioeffectservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_effect_ndk_shared",
],
srcs: [
- "AutomaticGainControlSw.cpp",
+ "AutomaticGainControlV2Sw.cpp",
":effectCommonFile",
],
relative_install_path: "soundfx",
diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
new file mode 100644
index 0000000..8441f22
--- /dev/null
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <algorithm>
+#include <cstddef>
+#include <memory>
+#define LOG_TAG "AHAL_AutomaticGainControlV2Sw"
+#include <Utils.h>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "AutomaticGainControlV2Sw.h"
+
+using aidl::android::hardware::audio::effect::AutomaticGainControlV2Sw;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV2SwImplUUID;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<AutomaticGainControlV2Sw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ *_aidl_return = AutomaticGainControlV2Sw::kDescriptor;
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+const std::string AutomaticGainControlV2Sw::kEffectName = "AutomaticGainControlV2Sw";
+
+const std::vector<Range::AutomaticGainControlV2Range> AutomaticGainControlV2Sw::kRanges = {
+ MAKE_RANGE(AutomaticGainControlV2, fixedDigitalGainMb, 0, 50000),
+ MAKE_RANGE(AutomaticGainControlV2, saturationMarginMb, 0, 10000)};
+
+const Capability AutomaticGainControlV2Sw::kCapability = {
+ .range = AutomaticGainControlV2Sw::kRanges};
+
+const Descriptor AutomaticGainControlV2Sw::kDescriptor = {
+ .common = {.id = {.type = kAutomaticGainControlV2TypeUUID,
+ .uuid = kAutomaticGainControlV2SwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = AutomaticGainControlV2Sw::kEffectName,
+ .implementor = "The Android Open Source Project"},
+ .capability = AutomaticGainControlV2Sw::kCapability};
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::setParameterSpecific(
+ const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::automaticGainControlV2 != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ auto& param = specific.get<Parameter::Specific::automaticGainControlV2>();
+ RETURN_IF(!inRange(param, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
+ auto tag = param.getTag();
+ switch (tag) {
+ case AutomaticGainControlV2::fixedDigitalGainMb: {
+ RETURN_IF(mContext->setDigitalGain(
+ param.get<AutomaticGainControlV2::fixedDigitalGainMb>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "digitalGainNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV2::levelEstimator: {
+ RETURN_IF(mContext->setLevelEstimator(
+ param.get<AutomaticGainControlV2::levelEstimator>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "levelEstimatorNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV2::saturationMarginMb: {
+ RETURN_IF(mContext->setSaturationMargin(
+ param.get<AutomaticGainControlV2::saturationMarginMb>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "saturationMarginNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV2TagNotSupported");
+ }
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::automaticGainControlV2Tag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ auto specificId = id.get<Parameter::Id::automaticGainControlV2Tag>();
+ auto specificIdTag = specificId.getTag();
+ switch (specificIdTag) {
+ case AutomaticGainControlV2::Id::commonTag:
+ return getParameterAutomaticGainControlV2(
+ specificId.get<AutomaticGainControlV2::Id::commonTag>(), specific);
+ default:
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV2TagNotSupported");
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::getParameterAutomaticGainControlV2(
+ const AutomaticGainControlV2::Tag& tag, Parameter::Specific* specific) {
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+ AutomaticGainControlV2 param;
+ switch (tag) {
+ case AutomaticGainControlV2::fixedDigitalGainMb: {
+ param.set<AutomaticGainControlV2::fixedDigitalGainMb>(mContext->getDigitalGain());
+ break;
+ }
+ case AutomaticGainControlV2::levelEstimator: {
+ param.set<AutomaticGainControlV2::levelEstimator>(mContext->getLevelEstimator());
+ break;
+ }
+ case AutomaticGainControlV2::saturationMarginMb: {
+ param.set<AutomaticGainControlV2::saturationMarginMb>(mContext->getSaturationMargin());
+ break;
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV2TagNotSupported");
+ }
+ }
+
+ specific->set<Parameter::Specific::automaticGainControlV2>(param);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV2Sw::createContext(
+ const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ } else {
+ mContext =
+ std::make_shared<AutomaticGainControlV2SwContext>(1 /* statusFmqDepth */, common);
+ }
+ return mContext;
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV2Sw::getContext() {
+ return mContext;
+}
+
+RetCode AutomaticGainControlV2Sw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status AutomaticGainControlV2Sw::effectProcessImpl(float* in, float* out, int samples) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
+ for (int i = 0; i < samples; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, samples, samples};
+}
+
+RetCode AutomaticGainControlV2SwContext::setDigitalGain(int gain) {
+ mDigitalGain = gain;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV2SwContext::getDigitalGain() {
+ return mDigitalGain;
+}
+
+RetCode AutomaticGainControlV2SwContext::setLevelEstimator(
+ AutomaticGainControlV2::LevelEstimator levelEstimator) {
+ mLevelEstimator = levelEstimator;
+ return RetCode::SUCCESS;
+}
+
+AutomaticGainControlV2::LevelEstimator AutomaticGainControlV2SwContext::getLevelEstimator() {
+ return mLevelEstimator;
+}
+
+RetCode AutomaticGainControlV2SwContext::setSaturationMargin(int margin) {
+ mSaturationMargin = margin;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV2SwContext::getSaturationMargin() {
+ return mSaturationMargin;
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
similarity index 68%
rename from audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
rename to audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
index 2724835..0b50f4d 100644
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
@@ -26,35 +26,35 @@
namespace aidl::android::hardware::audio::effect {
-class AutomaticGainControlSwContext final : public EffectContext {
+class AutomaticGainControlV2SwContext final : public EffectContext {
public:
- AutomaticGainControlSwContext(int statusDepth, const Parameter::Common& common)
+ AutomaticGainControlV2SwContext(int statusDepth, const Parameter::Common& common)
: EffectContext(statusDepth, common) {
LOG(DEBUG) << __func__;
}
RetCode setDigitalGain(int gain);
int getDigitalGain();
- RetCode setLevelEstimator(AutomaticGainControl::LevelEstimator levelEstimator);
- AutomaticGainControl::LevelEstimator getLevelEstimator();
+ RetCode setLevelEstimator(AutomaticGainControlV2::LevelEstimator levelEstimator);
+ AutomaticGainControlV2::LevelEstimator getLevelEstimator();
RetCode setSaturationMargin(int margin);
int getSaturationMargin();
private:
int mDigitalGain = 0;
- AutomaticGainControl::LevelEstimator mLevelEstimator =
- AutomaticGainControl::LevelEstimator::RMS;
+ AutomaticGainControlV2::LevelEstimator mLevelEstimator =
+ AutomaticGainControlV2::LevelEstimator::RMS;
int mSaturationMargin = 0;
};
-class AutomaticGainControlSw final : public EffectImpl {
+class AutomaticGainControlV2Sw final : public EffectImpl {
public:
static const std::string kEffectName;
static const bool kStrengthSupported;
- static const AutomaticGainControl::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
- AutomaticGainControlSw() { LOG(DEBUG) << __func__; }
- ~AutomaticGainControlSw() {
+ AutomaticGainControlV2Sw() { LOG(DEBUG) << __func__; }
+ ~AutomaticGainControlV2Sw() {
cleanUp();
LOG(DEBUG) << __func__;
}
@@ -72,8 +72,9 @@
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
- std::shared_ptr<AutomaticGainControlSwContext> mContext;
- ndk::ScopedAStatus getParameterAutomaticGainControl(const AutomaticGainControl::Tag& tag,
- Parameter::Specific* specific);
+ static const std::vector<Range::AutomaticGainControlV2Range> kRanges;
+ std::shared_ptr<AutomaticGainControlV2SwContext> mContext;
+ ndk::ScopedAStatus getParameterAutomaticGainControlV2(const AutomaticGainControlV2::Tag& tag,
+ Parameter::Specific* specific);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/bassboost/BassBoostSw.cpp b/audio/aidl/default/bassboost/BassBoostSw.cpp
index 0c7ebe1..e50f0a2 100644
--- a/audio/aidl/default/bassboost/BassBoostSw.cpp
+++ b/audio/aidl/default/bassboost/BassBoostSw.cpp
@@ -61,9 +61,10 @@
namespace aidl::android::hardware::audio::effect {
const std::string BassBoostSw::kEffectName = "BassBoostSw";
-const bool BassBoostSw::kStrengthSupported = true;
-const BassBoost::Capability BassBoostSw::kCapability = {.maxStrengthPm = 1000,
- .strengthSupported = kStrengthSupported};
+
+const std::vector<Range::BassBoostRange> BassBoostSw::kRanges = {
+ MAKE_RANGE(BassBoost, strengthPm, 0, 1000)};
+const Capability BassBoostSw::kCapability = {.range = {BassBoostSw::kRanges}};
const Descriptor BassBoostSw::kDescriptor = {
.common = {.id = {.type = kBassBoostTypeUUID,
.uuid = kBassBoostSwImplUUID,
@@ -73,7 +74,7 @@
.volume = Flags::Volume::CTRL},
.name = BassBoostSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::bassBoost>(BassBoostSw::kCapability)};
+ .capability = BassBoostSw::kCapability};
ndk::ScopedAStatus BassBoostSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -87,15 +88,14 @@
RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
auto& bbParam = specific.get<Parameter::Specific::bassBoost>();
+ RETURN_IF(!inRange(bbParam, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = bbParam.getTag();
switch (tag) {
case BassBoost::strengthPm: {
- RETURN_IF(!kStrengthSupported, EX_ILLEGAL_ARGUMENT, "SettingStrengthNotSupported");
-
- RETURN_IF(mContext->setBbStrengthPm(bbParam.get<BassBoost::strengthPm>()) !=
- RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "strengthPmNotSupported");
+ const auto strength = bbParam.get<BassBoost::strengthPm>();
+ RETURN_IF(mContext->setBbStrengthPm(strength) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT,
+ "strengthPmNotSupported");
return ndk::ScopedAStatus::ok();
}
default: {
@@ -173,11 +173,6 @@
}
RetCode BassBoostSwContext::setBbStrengthPm(int strength) {
- if (strength < 0 || strength > BassBoostSw::kCapability.maxStrengthPm) {
- LOG(ERROR) << __func__ << " invalid strength: " << strength;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new strength
mStrength = strength;
return RetCode::SUCCESS;
}
diff --git a/audio/aidl/default/bassboost/BassBoostSw.h b/audio/aidl/default/bassboost/BassBoostSw.h
index 65c01c8..8d183dd 100644
--- a/audio/aidl/default/bassboost/BassBoostSw.h
+++ b/audio/aidl/default/bassboost/BassBoostSw.h
@@ -43,8 +43,7 @@
class BassBoostSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const bool kStrengthSupported;
- static const BassBoost::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
BassBoostSw() { LOG(DEBUG) << __func__; }
~BassBoostSw() {
@@ -65,6 +64,7 @@
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
+ static const std::vector<Range::BassBoostRange> kRanges;
std::shared_ptr<BassBoostSwContext> mContext;
ndk::ScopedAStatus getParameterBassBoost(const BassBoost::Tag& tag,
Parameter::Specific* specific);
diff --git a/audio/aidl/default/downmix/DownmixSw.cpp b/audio/aidl/default/downmix/DownmixSw.cpp
index 7bb958d..0af95d0 100644
--- a/audio/aidl/default/downmix/DownmixSw.cpp
+++ b/audio/aidl/default/downmix/DownmixSw.cpp
@@ -60,17 +60,14 @@
namespace aidl::android::hardware::audio::effect {
const std::string DownmixSw::kEffectName = "DownmixSw";
-const Downmix::Capability DownmixSw::kCapability;
const Descriptor DownmixSw::kDescriptor = {
- .common = {.id = {.type = kDownmixTypeUUID,
- .uuid = kDownmixSwImplUUID,
- .proxy = std::nullopt},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::FIRST,
- .volume = Flags::Volume::CTRL},
- .name = kEffectName,
- .implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::downmix>(kCapability)};
+ .common = {
+ .id = {.type = kDownmixTypeUUID, .uuid = kDownmixSwImplUUID, .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = kEffectName,
+ .implementor = "The Android Open Source Project"}};
ndk::ScopedAStatus DownmixSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
diff --git a/audio/aidl/default/downmix/DownmixSw.h b/audio/aidl/default/downmix/DownmixSw.h
index 51546c1..37c978b 100644
--- a/audio/aidl/default/downmix/DownmixSw.h
+++ b/audio/aidl/default/downmix/DownmixSw.h
@@ -47,7 +47,7 @@
class DownmixSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const Downmix::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
DownmixSw() { LOG(DEBUG) << __func__; }
~DownmixSw() {
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
index 0ffbaa1..da6d0c6 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
@@ -61,8 +61,33 @@
namespace aidl::android::hardware::audio::effect {
const std::string DynamicsProcessingSw::kEffectName = "DynamicsProcessingSw";
-const DynamicsProcessing::Capability DynamicsProcessingSw::kCapability = {.minCutOffFreq = 220,
- .maxCutOffFreq = 20000};
+const DynamicsProcessing::EqBandConfig DynamicsProcessingSw::kEqBandConfigMin =
+ DynamicsProcessing::EqBandConfig({.channel = 0,
+ .band = 0,
+ .enable = false,
+ .cutoffFrequencyHz = 220,
+ .gainDb = std::numeric_limits<float>::min()});
+const DynamicsProcessing::EqBandConfig DynamicsProcessingSw::kEqBandConfigMax =
+ DynamicsProcessing::EqBandConfig({.channel = std::numeric_limits<int>::max(),
+ .band = std::numeric_limits<int>::max(),
+ .enable = true,
+ .cutoffFrequencyHz = 20000,
+ .gainDb = std::numeric_limits<float>::max()});
+const Range::DynamicsProcessingRange DynamicsProcessingSw::kPreEqBandRange = {
+ .min = DynamicsProcessing::make<DynamicsProcessing::preEqBand>(
+ {DynamicsProcessingSw::kEqBandConfigMin}),
+ .max = DynamicsProcessing::make<DynamicsProcessing::preEqBand>(
+ {DynamicsProcessingSw::kEqBandConfigMax})};
+const Range::DynamicsProcessingRange DynamicsProcessingSw::kPostEqBandRange = {
+ .min = DynamicsProcessing::make<DynamicsProcessing::postEqBand>(
+ {DynamicsProcessingSw::kEqBandConfigMin}),
+ .max = DynamicsProcessing::make<DynamicsProcessing::postEqBand>(
+ {DynamicsProcessingSw::kEqBandConfigMax})};
+
+const std::vector<Range::DynamicsProcessingRange> DynamicsProcessingSw::kRanges = {
+ DynamicsProcessingSw::kPreEqBandRange, DynamicsProcessingSw::kPostEqBandRange};
+const Capability DynamicsProcessingSw::kCapability = {.range = DynamicsProcessingSw::kRanges};
+
const Descriptor DynamicsProcessingSw::kDescriptor = {
.common = {.id = {.type = kDynamicsProcessingTypeUUID,
.uuid = kDynamicsProcessingSwImplUUID,
@@ -72,8 +97,7 @@
.volume = Flags::Volume::CTRL},
.name = DynamicsProcessingSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::dynamicsProcessing>(
- DynamicsProcessingSw::kCapability)};
+ .capability = DynamicsProcessingSw::kCapability};
ndk::ScopedAStatus DynamicsProcessingSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -341,7 +365,6 @@
LOG(WARNING) << __func__ << " skip invalid band " << cfg.toString();
ret = RetCode::ERROR_ILLEGAL_PARAMETER;
continue;
- ;
}
targetCfgs[cfg.channel * stage.bandCount + cfg.band] = cfg;
}
@@ -380,7 +403,6 @@
LOG(WARNING) << __func__ << " skip invalid band " << it.toString();
ret = RetCode::ERROR_ILLEGAL_PARAMETER;
continue;
- ;
}
mMbcChBands[it.channel * bandCount + it.band] = it;
}
@@ -462,11 +484,6 @@
return ret;
}
-bool DynamicsProcessingSwContext::validateCutoffFrequency(float freq) {
- return freq >= DynamicsProcessingSw::kCapability.minCutOffFreq &&
- freq <= DynamicsProcessingSw::kCapability.maxCutOffFreq;
-}
-
bool DynamicsProcessingSwContext::validateStageEnablement(
const DynamicsProcessing::StageEnablement& enablement) {
return !enablement.inUse || (enablement.inUse && enablement.bandCount > 0);
@@ -484,7 +501,7 @@
const std::vector<DynamicsProcessing::ChannelConfig>& channelConfig) {
return band.channel >= 0 && band.channel < maxChannel &&
(size_t)band.channel < channelConfig.size() && channelConfig[band.channel].enable &&
- band.band >= 0 && band.band < maxBand && validateCutoffFrequency(band.cutoffFrequencyHz);
+ band.band >= 0 && band.band < maxBand;
}
bool DynamicsProcessingSwContext::validateMbcBandConfig(
@@ -492,8 +509,7 @@
const std::vector<DynamicsProcessing::ChannelConfig>& channelConfig) {
return band.channel >= 0 && band.channel < maxChannel &&
(size_t)band.channel < channelConfig.size() && channelConfig[band.channel].enable &&
- band.band >= 0 && band.band < maxBand &&
- validateCutoffFrequency(band.cutoffFrequencyHz) && band.attackTimeMs >= 0 &&
+ band.band >= 0 && band.band < maxBand && band.attackTimeMs >= 0 &&
band.releaseTimeMs >= 0 && band.ratio >= 0 && band.thresholdDb <= 0 &&
band.kneeWidthDb <= 0 && band.noiseGateThresholdDb <= 0 && band.expanderRatio >= 0;
}
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
index e336df7..3e14cce 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
@@ -86,8 +86,6 @@
std::vector<DynamicsProcessing::EqBandConfig> mPreEqChBands;
std::vector<DynamicsProcessing::EqBandConfig> mPostEqChBands;
std::vector<DynamicsProcessing::MbcBandConfig> mMbcChBands;
-
- bool validateCutoffFrequency(float freq);
bool validateStageEnablement(const DynamicsProcessing::StageEnablement& enablement);
bool validateEngineConfig(const DynamicsProcessing::EngineArchitecture& engine);
bool validateEqBandConfig(const DynamicsProcessing::EqBandConfig& band, int maxChannel,
@@ -104,7 +102,7 @@
class DynamicsProcessingSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const DynamicsProcessing::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
DynamicsProcessingSw() { LOG(DEBUG) << __func__; }
~DynamicsProcessingSw() {
@@ -125,6 +123,11 @@
std::string getEffectName() override { return kEffectName; };
private:
+ static const DynamicsProcessing::EqBandConfig kEqBandConfigMin;
+ static const DynamicsProcessing::EqBandConfig kEqBandConfigMax;
+ static const Range::DynamicsProcessingRange kPreEqBandRange;
+ static const Range::DynamicsProcessingRange kPostEqBandRange;
+ static const std::vector<Range::DynamicsProcessingRange> kRanges;
std::shared_ptr<DynamicsProcessingSwContext> mContext;
ndk::ScopedAStatus getParameterDynamicsProcessing(const DynamicsProcessing::Tag& tag,
Parameter::Specific* specific);
diff --git a/audio/aidl/default/envReverb/EnvReverbSw.cpp b/audio/aidl/default/envReverb/EnvReverbSw.cpp
index 905dba4..46d9016 100644
--- a/audio/aidl/default/envReverb/EnvReverbSw.cpp
+++ b/audio/aidl/default/envReverb/EnvReverbSw.cpp
@@ -60,18 +60,20 @@
namespace aidl::android::hardware::audio::effect {
const std::string EnvReverbSw::kEffectName = "EnvReverbSw";
-const EnvironmentalReverb::Capability EnvReverbSw::kCapability = {.minRoomLevelMb = -6000,
- .maxRoomLevelMb = 0,
- .minRoomHfLevelMb = -4000,
- .maxRoomHfLevelMb = 0,
- .maxDecayTimeMs = 7000,
- .minDecayHfRatioPm = 100,
- .maxDecayHfRatioPm = 2000,
- .minLevelMb = -6000,
- .maxLevelMb = 0,
- .maxDelayMs = 65,
- .maxDiffusionPm = 1000,
- .maxDensityPm = 1000};
+
+const std::vector<Range::EnvironmentalReverbRange> EnvReverbSw::kRanges = {
+ MAKE_RANGE(EnvironmentalReverb, roomLevelMb, -6000, 0),
+ MAKE_RANGE(EnvironmentalReverb, roomHfLevelMb, -4000, 0),
+ MAKE_RANGE(EnvironmentalReverb, decayTimeMs, 0, 7000),
+ MAKE_RANGE(EnvironmentalReverb, decayHfRatioPm, 100, 2000),
+ MAKE_RANGE(EnvironmentalReverb, levelMb, -6000, 0),
+ MAKE_RANGE(EnvironmentalReverb, delayMs, 0, 65),
+ MAKE_RANGE(EnvironmentalReverb, diffusionPm, 0, 1000),
+ MAKE_RANGE(EnvironmentalReverb, densityPm, 0, 1000)};
+
+const Capability EnvReverbSw::kCapability = {
+ .range = Range::make<Range::environmentalReverb>(EnvReverbSw::kRanges)};
+
const Descriptor EnvReverbSw::kDescriptor = {
.common = {.id = {.type = kEnvReverbTypeUUID,
.uuid = kEnvReverbSwImplUUID,
@@ -81,7 +83,7 @@
.volume = Flags::Volume::CTRL},
.name = EnvReverbSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::environmentalReverb>(EnvReverbSw::kCapability)};
+ .capability = EnvReverbSw::kCapability};
ndk::ScopedAStatus EnvReverbSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -94,8 +96,8 @@
"EffectNotSupported");
auto& erParam = specific.get<Parameter::Specific::environmentalReverb>();
+ RETURN_IF(!inRange(erParam, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = erParam.getTag();
-
switch (tag) {
case EnvironmentalReverb::roomLevelMb: {
RETURN_IF(mContext->setErRoomLevel(erParam.get<EnvironmentalReverb::roomLevelMb>()) !=
@@ -262,85 +264,41 @@
}
RetCode EnvReverbSwContext::setErRoomLevel(int roomLevel) {
- if (roomLevel < EnvReverbSw::kCapability.minRoomLevelMb ||
- roomLevel > EnvReverbSw::kCapability.maxRoomLevelMb) {
- LOG(ERROR) << __func__ << " invalid roomLevel: " << roomLevel;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new room level
mRoomLevel = roomLevel;
return RetCode::SUCCESS;
}
RetCode EnvReverbSwContext::setErRoomHfLevel(int roomHfLevel) {
- if (roomHfLevel < EnvReverbSw::kCapability.minRoomHfLevelMb ||
- roomHfLevel > EnvReverbSw::kCapability.maxRoomHfLevelMb) {
- LOG(ERROR) << __func__ << " invalid roomHfLevel: " << roomHfLevel;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new room HF level
mRoomHfLevel = roomHfLevel;
return RetCode::SUCCESS;
}
RetCode EnvReverbSwContext::setErDecayTime(int decayTime) {
- if (decayTime < 0 || decayTime > EnvReverbSw::kCapability.maxDecayTimeMs) {
- LOG(ERROR) << __func__ << " invalid decayTime: " << decayTime;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new decay time
mDecayTime = decayTime;
return RetCode::SUCCESS;
}
RetCode EnvReverbSwContext::setErDecayHfRatio(int decayHfRatio) {
- if (decayHfRatio < EnvReverbSw::kCapability.minDecayHfRatioPm ||
- decayHfRatio > EnvReverbSw::kCapability.maxDecayHfRatioPm) {
- LOG(ERROR) << __func__ << " invalid decayHfRatio: " << decayHfRatio;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new decay HF ratio
mDecayHfRatio = decayHfRatio;
return RetCode::SUCCESS;
}
RetCode EnvReverbSwContext::setErLevel(int level) {
- if (level < EnvReverbSw::kCapability.minLevelMb ||
- level > EnvReverbSw::kCapability.maxLevelMb) {
- LOG(ERROR) << __func__ << " invalid level: " << level;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new level
mLevel = level;
return RetCode::SUCCESS;
}
RetCode EnvReverbSwContext::setErDelay(int delay) {
- if (delay < 0 || delay > EnvReverbSw::kCapability.maxDelayMs) {
- LOG(ERROR) << __func__ << " invalid delay: " << delay;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new delay
mDelay = delay;
return RetCode::SUCCESS;
}
RetCode EnvReverbSwContext::setErDiffusion(int diffusion) {
- if (diffusion < 0 || diffusion > EnvReverbSw::kCapability.maxDiffusionPm) {
- LOG(ERROR) << __func__ << " invalid diffusion: " << diffusion;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new diffusion
mDiffusion = diffusion;
return RetCode::SUCCESS;
}
RetCode EnvReverbSwContext::setErDensity(int density) {
- if (density < 0 || density > EnvReverbSw::kCapability.maxDensityPm) {
- LOG(ERROR) << __func__ << " invalid density: " << density;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new density
mDensity = density;
return RetCode::SUCCESS;
}
diff --git a/audio/aidl/default/envReverb/EnvReverbSw.h b/audio/aidl/default/envReverb/EnvReverbSw.h
index 77f384e..4f11a5c 100644
--- a/audio/aidl/default/envReverb/EnvReverbSw.h
+++ b/audio/aidl/default/envReverb/EnvReverbSw.h
@@ -79,7 +79,7 @@
class EnvReverbSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const EnvironmentalReverb::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
EnvReverbSw() { LOG(DEBUG) << __func__; }
~EnvReverbSw() {
@@ -100,6 +100,7 @@
std::string getEffectName() override { return kEffectName; }
private:
+ static const std::vector<Range::EnvironmentalReverbRange> kRanges;
std::shared_ptr<EnvReverbSwContext> mContext;
ndk::ScopedAStatus getParameterEnvironmentalReverb(const EnvironmentalReverb::Tag& tag,
Parameter::Specific* specific);
diff --git a/audio/aidl/default/equalizer/EqualizerSw.cpp b/audio/aidl/default/equalizer/EqualizerSw.cpp
index 0a6ac34..2814322 100644
--- a/audio/aidl/default/equalizer/EqualizerSw.cpp
+++ b/audio/aidl/default/equalizer/EqualizerSw.cpp
@@ -60,6 +60,7 @@
namespace aidl::android::hardware::audio::effect {
const std::string EqualizerSw::kEffectName = "EqualizerSw";
+
const std::vector<Equalizer::BandFrequency> EqualizerSw::kBandFrequency = {{0, 30000, 120000},
{1, 120001, 460000},
{2, 460001, 1800000},
@@ -69,19 +70,34 @@
{0, "Normal"}, {1, "Classical"}, {2, "Dance"}, {3, "Flat"}, {4, "Folk"},
{5, "Heavy Metal"}, {6, "Hip Hop"}, {7, "Jazz"}, {8, "Pop"}, {9, "Rock"}};
-const Equalizer::Capability EqualizerSw::kEqCap = {.bandFrequencies = kBandFrequency,
- .presets = kPresets};
+/**
+ * Use the same min and max to build a capability represented by Range.
+ */
+const std::vector<Range::EqualizerRange> EqualizerSw::kRanges = {
+ MAKE_RANGE(Equalizer, preset, 0, EqualizerSw::kPresets.size() - 1),
+ MAKE_RANGE(Equalizer, bandLevels,
+ std::vector<Equalizer::BandLevel>{Equalizer::BandLevel(
+ {.index = 0, .levelMb = std::numeric_limits<int>::min()})},
+ std::vector<Equalizer::BandLevel>{
+ Equalizer::BandLevel({.index = EqualizerSwContext::kMaxBandNumber - 1,
+ .levelMb = std::numeric_limits<int>::max()})}),
+ /* capability definition */
+ MAKE_RANGE(Equalizer, bandFrequencies, EqualizerSw::kBandFrequency,
+ EqualizerSw::kBandFrequency),
+ MAKE_RANGE(Equalizer, presets, EqualizerSw::kPresets, EqualizerSw::kPresets),
+ /* centerFreqMh is get only, set invalid range min > max */
+ MAKE_RANGE(Equalizer, centerFreqMh, std::vector<int>({1}), std::vector<int>({0}))};
-const Descriptor EqualizerSw::kDesc = {
- .common = {.id = {.type = kEqualizerTypeUUID,
- .uuid = kEqualizerSwImplUUID,
- .proxy = kEqualizerProxyUUID},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::FIRST,
- .volume = Flags::Volume::CTRL},
- .name = EqualizerSw::kEffectName,
- .implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::equalizer>(EqualizerSw::kEqCap)};
+const Capability EqualizerSw::kEqCap = {.range = EqualizerSw::kRanges};
+const Descriptor EqualizerSw::kDesc = {.common = {.id = {.type = kEqualizerTypeUUID,
+ .uuid = kEqualizerSwImplUUID,
+ .proxy = kEqualizerProxyUUID},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = EqualizerSw::kEffectName,
+ .implementor = "The Android Open Source Project"},
+ .capability = EqualizerSw::kEqCap};
ndk::ScopedAStatus EqualizerSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDesc.toString();
@@ -95,6 +111,7 @@
RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
auto& eqParam = specific.get<Parameter::Specific::equalizer>();
+ RETURN_IF(!inRange(eqParam, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = eqParam.getTag();
switch (tag) {
case Equalizer::preset: {
diff --git a/audio/aidl/default/equalizer/EqualizerSw.h b/audio/aidl/default/equalizer/EqualizerSw.h
index fabcfeb..f8987c7 100644
--- a/audio/aidl/default/equalizer/EqualizerSw.h
+++ b/audio/aidl/default/equalizer/EqualizerSw.h
@@ -34,7 +34,7 @@
}
RetCode setEqPreset(const int& presetIdx) {
- if (presetIdx < 0 || presetIdx >= NUM_OF_PRESETS) {
+ if (presetIdx < 0 || presetIdx >= kMaxPresetNumber) {
return RetCode::ERROR_ILLEGAL_PARAMETER;
}
mPreset = presetIdx;
@@ -43,13 +43,13 @@
int getEqPreset() { return mPreset; }
RetCode setEqBandLevels(const std::vector<Equalizer::BandLevel>& bandLevels) {
- if (bandLevels.size() > NUM_OF_BANDS) {
- LOG(ERROR) << __func__ << " return because size exceed " << NUM_OF_BANDS;
+ if (bandLevels.size() > kMaxBandNumber) {
+ LOG(ERROR) << __func__ << " return because size exceed " << kMaxBandNumber;
return RetCode::ERROR_ILLEGAL_PARAMETER;
}
RetCode ret = RetCode::SUCCESS;
for (auto& it : bandLevels) {
- if (it.index >= NUM_OF_BANDS || it.index < 0) {
+ if (it.index >= kMaxBandNumber || it.index < 0) {
LOG(ERROR) << __func__ << " index illegal, skip: " << it.index << " - "
<< it.levelMb;
ret = RetCode::ERROR_ILLEGAL_PARAMETER;
@@ -62,7 +62,7 @@
std::vector<Equalizer::BandLevel> getEqBandLevels() {
std::vector<Equalizer::BandLevel> bandLevels;
- for (int i = 0; i < NUM_OF_BANDS; i++) {
+ for (int i = 0; i < kMaxBandNumber; i++) {
bandLevels.push_back({i, mBandLevels[i]});
}
return bandLevels;
@@ -71,16 +71,16 @@
std::vector<int> getCenterFreqs() {
return {std::begin(kPresetsFrequencies), std::end(kPresetsFrequencies)};
}
+ static const int kMaxBandNumber = 5;
+ static const int kMaxPresetNumber = 10;
+ static const int kCustomPreset = -1;
private:
- static const int NUM_OF_BANDS = 5;
- static const int NUM_OF_PRESETS = 10;
- static const int PRESET_CUSTOM = -1;
- static constexpr std::array<uint16_t, NUM_OF_BANDS> kPresetsFrequencies = {60, 230, 910, 3600,
- 14000};
+ static constexpr std::array<uint16_t, kMaxBandNumber> kPresetsFrequencies = {60, 230, 910, 3600,
+ 14000};
// preset band level
- int mPreset = PRESET_CUSTOM;
- int32_t mBandLevels[NUM_OF_BANDS] = {3, 0, 0, 0, 3};
+ int mPreset = kCustomPreset;
+ int32_t mBandLevels[kMaxBandNumber] = {3, 0, 0, 0, 3};
// Add equalizer specific context for processing here
};
@@ -88,9 +88,7 @@
class EqualizerSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const std::vector<Equalizer::BandFrequency> kBandFrequency;
- static const std::vector<Equalizer::Preset> kPresets;
- static const Equalizer::Capability kEqCap;
+ static const Capability kEqCap;
static const Descriptor kDesc;
EqualizerSw() { LOG(DEBUG) << __func__; }
@@ -112,6 +110,9 @@
std::string getEffectName() override { return kEffectName; }
private:
+ static const std::vector<Equalizer::BandFrequency> kBandFrequency;
+ static const std::vector<Equalizer::Preset> kPresets;
+ static const std::vector<Range::EqualizerRange> kRanges;
ndk::ScopedAStatus getParameterEqualizer(const Equalizer::Tag& tag,
Parameter::Specific* specific);
std::shared_ptr<EqualizerSwContext> mContext;
diff --git a/audio/aidl/default/automaticGainControl/Android.bp b/audio/aidl/default/extension/Android.bp
similarity index 91%
copy from audio/aidl/default/automaticGainControl/Android.bp
copy to audio/aidl/default/extension/Android.bp
index 17d6416..4e5d352 100644
--- a/audio/aidl/default/automaticGainControl/Android.bp
+++ b/audio/aidl/default/extension/Android.bp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -24,14 +24,14 @@
}
cc_library_shared {
- name: "libagcsw",
+ name: "libextensioneffect",
defaults: [
"aidlaudioeffectservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_effect_ndk_shared",
],
srcs: [
- "AutomaticGainControlSw.cpp",
+ "ExtensionEffect.cpp",
":effectCommonFile",
],
relative_install_path: "soundfx",
diff --git a/audio/aidl/default/extension/ExtensionEffect.cpp b/audio/aidl/default/extension/ExtensionEffect.cpp
new file mode 100644
index 0000000..d2e3ccd
--- /dev/null
+++ b/audio/aidl/default/extension/ExtensionEffect.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2023 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 <algorithm>
+#include <cstddef>
+#include <memory>
+#include <unordered_set>
+
+#define LOG_TAG "AHAL_ExtensionEffect"
+#include <Utils.h>
+#include <aidl/android/hardware/audio/effect/DefaultExtension.h>
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "ExtensionEffect.h"
+
+using aidl::android::hardware::audio::effect::DefaultExtension;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::ExtensionEffect;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kExtensionEffectImplUUID;
+using aidl::android::hardware::audio::effect::kExtensionEffectTypeUUID;
+using aidl::android::hardware::audio::effect::Range;
+using aidl::android::hardware::audio::effect::VendorExtension;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<ExtensionEffect>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
+ if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ *_aidl_return = ExtensionEffect::kDescriptor;
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+const std::string ExtensionEffect::kEffectName = "ExtensionEffectExample";
+
+const Descriptor ExtensionEffect::kDescriptor = {
+ .common = {.id = {.type = kExtensionEffectTypeUUID,
+ .uuid = kExtensionEffectImplUUID,
+ .proxy = std::nullopt},
+ .name = ExtensionEffect::kEffectName,
+ .implementor = "The Android Open Source Project"}};
+
+ndk::ScopedAStatus ExtensionEffect::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus ExtensionEffect::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::vendorEffect != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ auto& vendorEffect = specific.get<Parameter::Specific::vendorEffect>();
+ std::optional<DefaultExtension> defaultExt;
+ RETURN_IF(STATUS_OK != vendorEffect.extension.getParcelable(&defaultExt), EX_ILLEGAL_ARGUMENT,
+ "getParcelableFailed");
+ RETURN_IF(!defaultExt.has_value(), EX_ILLEGAL_ARGUMENT, "parcelableNulld");
+ RETURN_IF(mContext->setParams(defaultExt->bytes) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT,
+ "paramNotSupported");
+
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus ExtensionEffect::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::vendorEffectTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ auto specificId = id.get<Parameter::Id::vendorEffectTag>();
+ VendorExtension extension;
+ DefaultExtension defaultExt;
+ defaultExt.bytes = mContext->getParams(specificId);
+ RETURN_IF(STATUS_OK != extension.extension.setParcelable(defaultExt), EX_ILLEGAL_ARGUMENT,
+ "setParcelableFailed");
+ specific->set<Parameter::Specific::vendorEffect>(extension);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> ExtensionEffect::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ } else {
+ mContext = std::make_shared<ExtensionEffectContext>(1 /* statusFmqDepth */, common);
+ }
+ return mContext;
+}
+
+std::shared_ptr<EffectContext> ExtensionEffect::getContext() {
+ return mContext;
+}
+
+RetCode ExtensionEffect::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status ExtensionEffect::effectProcessImpl(float* in, float* out, int samples) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
+ for (int i = 0; i < samples; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, samples, samples};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h b/audio/aidl/default/extension/ExtensionEffect.h
similarity index 60%
copy from audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
copy to audio/aidl/default/extension/ExtensionEffect.h
index 2724835..399fa83 100644
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
+++ b/audio/aidl/default/extension/ExtensionEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -18,43 +18,38 @@
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <fmq/AidlMessageQueue.h>
-#include <cstdlib>
#include <memory>
+#include <vector>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {
-class AutomaticGainControlSwContext final : public EffectContext {
+class ExtensionEffectContext final : public EffectContext {
public:
- AutomaticGainControlSwContext(int statusDepth, const Parameter::Common& common)
+ ExtensionEffectContext(int statusDepth, const Parameter::Common& common)
: EffectContext(statusDepth, common) {
LOG(DEBUG) << __func__;
}
- RetCode setDigitalGain(int gain);
- int getDigitalGain();
- RetCode setLevelEstimator(AutomaticGainControl::LevelEstimator levelEstimator);
- AutomaticGainControl::LevelEstimator getLevelEstimator();
- RetCode setSaturationMargin(int margin);
- int getSaturationMargin();
+ RetCode setParams(const std::vector<uint8_t>& params) {
+ mParams = params;
+ return RetCode::SUCCESS;
+ }
+ std::vector<uint8_t> getParams(int tag __unused) const { return mParams; }
private:
- int mDigitalGain = 0;
- AutomaticGainControl::LevelEstimator mLevelEstimator =
- AutomaticGainControl::LevelEstimator::RMS;
- int mSaturationMargin = 0;
+ std::vector<uint8_t> mParams;
};
-class AutomaticGainControlSw final : public EffectImpl {
+class ExtensionEffect final : public EffectImpl {
public:
static const std::string kEffectName;
- static const bool kStrengthSupported;
- static const AutomaticGainControl::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
- AutomaticGainControlSw() { LOG(DEBUG) << __func__; }
- ~AutomaticGainControlSw() {
+ ExtensionEffect() { LOG(DEBUG) << __func__; }
+ ~ExtensionEffect() {
cleanUp();
LOG(DEBUG) << __func__;
}
@@ -72,8 +67,6 @@
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
- std::shared_ptr<AutomaticGainControlSwContext> mContext;
- ndk::ScopedAStatus getParameterAutomaticGainControl(const AutomaticGainControl::Tag& tag,
- Parameter::Specific* specific);
+ std::shared_ptr<ExtensionEffectContext> mContext;
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
index 3c3b66f..6037ad2 100644
--- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
@@ -60,8 +60,6 @@
namespace aidl::android::hardware::audio::effect {
const std::string HapticGeneratorSw::kEffectName = "HapticGeneratorSw";
-/* capabilities */
-const HapticGenerator::Capability HapticGeneratorSw::kCapability;
/* Effect descriptor */
const Descriptor HapticGeneratorSw::kDescriptor = {
.common = {.id = {.type = kHapticGeneratorTypeUUID,
@@ -71,9 +69,7 @@
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},
.name = HapticGeneratorSw::kEffectName,
- .implementor = "The Android Open Source Project"},
- .capability =
- Capability::make<Capability::hapticGenerator>(HapticGeneratorSw::kCapability)};
+ .implementor = "The Android Open Source Project"}};
ndk::ScopedAStatus HapticGeneratorSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
index 7159501..428f460 100644
--- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
@@ -58,7 +58,6 @@
class HapticGeneratorSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const HapticGenerator::Capability kCapability;
static const Descriptor kDescriptor;
HapticGeneratorSw() { LOG(DEBUG) << __func__; }
~HapticGeneratorSw() {
diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h
index 1aca1fe..4dd0133 100644
--- a/audio/aidl/default/include/core-impl/Configuration.h
+++ b/audio/aidl/default/include/core-impl/Configuration.h
@@ -22,14 +22,14 @@
#include <aidl/android/hardware/audio/core/AudioPatch.h>
#include <aidl/android/hardware/audio/core/AudioRoute.h>
-#include <aidl/android/hardware/audio/core/MicrophoneInfo.h>
#include <aidl/android/media/audio/common/AudioPort.h>
#include <aidl/android/media/audio/common/AudioPortConfig.h>
+#include <aidl/android/media/audio/common/MicrophoneInfo.h>
namespace aidl::android::hardware::audio::core::internal {
struct Configuration {
- std::vector<MicrophoneInfo> microphones;
+ std::vector<::aidl::android::media::audio::common::MicrophoneInfo> microphones;
std::vector<::aidl::android::media::audio::common::AudioPort> ports;
std::vector<::aidl::android::media::audio::common::AudioPortConfig> portConfigs;
std::vector<::aidl::android::media::audio::common::AudioPortConfig> initialConfigs;
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index fab1c14..8365b34 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -94,7 +94,9 @@
ndk::ScopedAStatus setMasterVolume(float in_volume) override;
ndk::ScopedAStatus getMicMute(bool* _aidl_return) override;
ndk::ScopedAStatus setMicMute(bool in_mute) override;
- ndk::ScopedAStatus getMicrophones(std::vector<MicrophoneInfo>* _aidl_return) override;
+ ndk::ScopedAStatus getMicrophones(
+ std::vector<::aidl::android::media::audio::common::MicrophoneInfo>* _aidl_return)
+ override;
ndk::ScopedAStatus updateAudioMode(
::aidl::android::media::audio::common::AudioMode in_mode) override;
ndk::ScopedAStatus updateScreenRotation(
diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h
index f8c12e6..0d4365a3 100644
--- a/audio/aidl/default/include/core-impl/Stream.h
+++ b/audio/aidl/default/include/core-impl/Stream.h
@@ -32,10 +32,10 @@
#include <aidl/android/hardware/audio/core/BnStreamOut.h>
#include <aidl/android/hardware/audio/core/IStreamCallback.h>
#include <aidl/android/hardware/audio/core/IStreamOutEventCallback.h>
-#include <aidl/android/hardware/audio/core/MicrophoneInfo.h>
#include <aidl/android/hardware/audio/core/StreamDescriptor.h>
#include <aidl/android/media/audio/common/AudioDevice.h>
#include <aidl/android/media/audio/common/AudioOffloadInfo.h>
+#include <aidl/android/media/audio/common/MicrophoneInfo.h>
#include <fmq/AidlMessageQueue.h>
#include <system/thread_defs.h>
#include <utils/Errors.h>
@@ -413,7 +413,8 @@
getStreamCommon(_aidl_return);
}
ndk::ScopedAStatus getActiveMicrophones(
- std::vector<MicrophoneDynamicInfo>* _aidl_return) override;
+ std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return)
+ override;
ndk::ScopedAStatus getMicrophoneDirection(MicrophoneDirection* _aidl_return) override;
ndk::ScopedAStatus setMicrophoneDirection(MicrophoneDirection in_direction) override;
ndk::ScopedAStatus getMicrophoneFieldDimension(float* _aidl_return) override;
@@ -434,7 +435,7 @@
StreamIn(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
StreamContext&& context, const DriverInterface::CreateInstance& createDriver,
const StreamWorkerInterface::CreateInstance& createWorker,
- const std::vector<MicrophoneInfo>& microphones);
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
void createStreamCommon(const std::shared_ptr<StreamIn>& myPtr) {
StreamCommonImpl<
::aidl::android::hardware::audio::common::SinkMetadata>::createStreamCommon(myPtr);
@@ -445,7 +446,8 @@
public:
using CreateInstance = std::function<ndk::ScopedAStatus(
const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones,
std::shared_ptr<StreamIn>* result)>;
};
diff --git a/audio/aidl/default/include/core-impl/StreamStub.h b/audio/aidl/default/include/core-impl/StreamStub.h
index aea9da5..69fd7b3 100644
--- a/audio/aidl/default/include/core-impl/StreamStub.h
+++ b/audio/aidl/default/include/core-impl/StreamStub.h
@@ -43,13 +43,16 @@
public:
static ndk::ScopedAStatus createInstance(
const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones,
std::shared_ptr<StreamIn>* result);
private:
friend class ndk::SharedRefBase;
- StreamInStub(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones);
+ StreamInStub(
+ const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
};
class StreamOutStub final : public StreamOut {
diff --git a/audio/aidl/default/include/core-impl/StreamUsb.h b/audio/aidl/default/include/core-impl/StreamUsb.h
index 8ac1f34..c04dc66 100644
--- a/audio/aidl/default/include/core-impl/StreamUsb.h
+++ b/audio/aidl/default/include/core-impl/StreamUsb.h
@@ -60,18 +60,22 @@
class StreamInUsb final : public StreamIn {
ndk::ScopedAStatus getActiveMicrophones(
- std::vector<MicrophoneDynamicInfo>* _aidl_return) override;
+ std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return)
+ override;
public:
static ndk::ScopedAStatus createInstance(
const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones,
std::shared_ptr<StreamIn>* result);
private:
friend class ndk::SharedRefBase;
- StreamInUsb(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
- StreamContext&& context, const std::vector<MicrophoneInfo>& microphones);
+ StreamInUsb(
+ const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata,
+ StreamContext&& context,
+ const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
};
class StreamOutUsb final : public StreamOut {
diff --git a/audio/aidl/default/include/effect-impl/EffectTypes.h b/audio/aidl/default/include/effect-impl/EffectTypes.h
index b100a2e..fe534d7 100644
--- a/audio/aidl/default/include/effect-impl/EffectTypes.h
+++ b/audio/aidl/default/include/effect-impl/EffectTypes.h
@@ -19,16 +19,18 @@
#include <string>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <aidl/android/hardware/audio/effect/Range.h>
#include <android-base/logging.h>
+#include <system/audio_effects/aidl_effects_utils.h>
typedef binder_exception_t (*EffectCreateFunctor)(
const ::aidl::android::media::audio::common::AudioUuid*,
- std::shared_ptr<aidl::android::hardware::audio::effect::IEffect>*);
+ std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>*);
typedef binder_exception_t (*EffectDestroyFunctor)(
- const std::shared_ptr<aidl::android::hardware::audio::effect::IEffect>&);
+ const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>&);
typedef binder_exception_t (*EffectQueryFunctor)(
const ::aidl::android::media::audio::common::AudioUuid*,
- aidl::android::hardware::audio::effect::Descriptor*);
+ ::aidl::android::hardware::audio::effect::Descriptor*);
struct effect_dl_interface_s {
EffectCreateFunctor createEffectFunc;
@@ -116,6 +118,16 @@
} \
}
+/**
+ * Make a Range::$EffectType$Range.
+ * T: The $EffectType$, Visualizer for example.
+ * Tag: The union tag name in $EffectType$ definition, latencyMs for example.
+ * l: The value of Range::$EffectType$Range.min.
+ * r: The value of Range::$EffectType$Range.max.
+ */
+#define MAKE_RANGE(T, Tag, l, r) \
+ { .min = T::make<T::Tag>(l), .max = T::make<T::Tag>(r) }
+
static inline bool stringToUuid(const char* str,
::aidl::android::media::audio::common::AudioUuid* uuid) {
RETURN_VALUE_IF(!uuid || !str, false, "nullPtr");
diff --git a/audio/aidl/default/include/effect-impl/EffectUUID.h b/audio/aidl/default/include/effect-impl/EffectUUID.h
index 7703091..267f6af 100644
--- a/audio/aidl/default/include/effect-impl/EffectUUID.h
+++ b/audio/aidl/default/include/effect-impl/EffectUUID.h
@@ -45,18 +45,30 @@
0x11e0,
0xa896,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
-// 0xae3c653b-be18-4ab8-8938-418f0a7f06ac
-static const AudioUuid kAutomaticGainControlTypeUUID = {static_cast<int32_t>(0xae3c653b),
- 0xbe18,
- 0x4ab8,
- 0x8938,
- {0x41, 0x8f, 0x0a, 0x7f, 0x06, 0xac}};
+// 0a8abfe0-654c-11e0-ba26-0002a5d5c51b
+static const AudioUuid kAutomaticGainControlV1TypeUUID = {static_cast<int32_t>(0x0a8abfe0),
+ 0x654c,
+ 0x11e0,
+ 0xba26,
+ {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+// aa8130e0-66fc-11e0-bad0-0002a5d5c51b
+static const AudioUuid kAutomaticGainControlV1SwImplUUID = {static_cast<int32_t>(0xaa8130e0),
+ 0x66fc,
+ 0x11e0,
+ 0xbad0,
+ {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+// ae3c653b-be18-4ab8-8938-418f0a7f06ac
+static const AudioUuid kAutomaticGainControlV2TypeUUID = {static_cast<int32_t>(0xae3c653b),
+ 0xbe18,
+ 0x4ab8,
+ 0x8938,
+ {0x41, 0x8f, 0x0a, 0x7f, 0x06, 0xac}};
// 89f38e65-d4d2-4d64-ad0e-2b3e799ea886
-static const AudioUuid kAutomaticGainControlSwImplUUID = {static_cast<int32_t>(0x89f38e65),
- 0xd4d2,
- 0x4d64,
- 0xad0e,
- {0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86}};
+static const AudioUuid kAutomaticGainControlV2SwImplUUID = {static_cast<int32_t>(0x89f38e65),
+ 0xd4d2,
+ 0x4d64,
+ 0xad0e,
+ {0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86}};
// 0634f220-ddd4-11db-a0fc-0002a5d5c51b
static const AudioUuid kBassBoostTypeUUID = {static_cast<int32_t>(0x0634f220),
0xddd4,
@@ -81,12 +93,12 @@
0x4d24,
0xaa88,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
-// fa81862a-588b-11ed-9b6a-0242ac120002
-static const AudioUuid kDownmixTypeUUID = {static_cast<int32_t>(0xfa81862a),
- 0x588b,
- 0x11ed,
- 0x9b6a,
- {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// 381e49cc-a858-4aa2-87f6-e8388e7601b2
+static const AudioUuid kDownmixTypeUUID = {static_cast<int32_t>(0x381e49cc),
+ 0xa858,
+ 0x4aa2,
+ 0x87f6,
+ {0xe8, 0x38, 0x8e, 0x76, 0x01, 0xb2}};
// fa8187ba-588b-11ed-9b6a-0242ac120002
static const AudioUuid kDownmixSwImplUUID = {static_cast<int32_t>(0xfa8187ba),
0x588b,
@@ -299,6 +311,18 @@
0x81f9,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+// fa81dbde-588b-11ed-9b6a-0242ac120002
+static const AudioUuid kExtensionEffectTypeUUID = {static_cast<int32_t>(0xfa81dbde),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa81dd00-588b-11ed-9b6a-0242ac120002
+static const AudioUuid kExtensionEffectImplUUID = {static_cast<int32_t>(0xfa81dd00),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
/**
* @brief A map between effect name and effect type UUID.
* All <name> attribution in effect/effectProxy of audio_effects.xml should be listed in this map.
@@ -306,11 +330,13 @@
*/
static const std::map<const std::string /* effect type */, const AudioUuid&> kUuidNameTypeMap = {
{"acoustic_echo_canceler", kAcousticEchoCancelerTypeUUID},
- {"automatic_gain_control", kAutomaticGainControlTypeUUID},
+ {"automatic_gain_control_v1", kAutomaticGainControlV1TypeUUID},
+ {"automatic_gain_control_v2", kAutomaticGainControlV2TypeUUID},
{"bassboost", kBassBoostTypeUUID},
{"downmix", kDownmixTypeUUID},
{"dynamics_processing", kDynamicsProcessingTypeUUID},
{"equalizer", kEqualizerTypeUUID},
+ {"extensioneffect", kExtensionEffectTypeUUID},
{"haptic_generator", kHapticGeneratorTypeUUID},
{"loudness_enhancer", kLoudnessEnhancerTypeUUID},
{"env_reverb", kEnvReverbTypeUUID},
diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
index 5da70c7..e252f4a 100644
--- a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
+++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
@@ -47,7 +47,6 @@
class LoudnessEnhancerSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const LoudnessEnhancer::Capability kCapability;
static const Descriptor kDescriptor;
LoudnessEnhancerSw() { LOG(DEBUG) << __func__; }
~LoudnessEnhancerSw() {
diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
index 51fe4ea..0ea31ea 100644
--- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
+++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
@@ -60,7 +60,6 @@
namespace aidl::android::hardware::audio::effect {
const std::string NoiseSuppressionSw::kEffectName = "NoiseSuppressionSw";
-const NoiseSuppression::Capability NoiseSuppressionSw::kCapability;
const Descriptor NoiseSuppressionSw::kDescriptor = {
.common = {.id = {.type = kNoiseSuppressionTypeUUID,
.uuid = kNoiseSuppressionSwImplUUID,
@@ -69,9 +68,7 @@
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},
.name = NoiseSuppressionSw::kEffectName,
- .implementor = "The Android Open Source Project"},
- .capability =
- Capability::make<Capability::noiseSuppression>(NoiseSuppressionSw::kCapability)};
+ .implementor = "The Android Open Source Project"}};
ndk::ScopedAStatus NoiseSuppressionSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h
index a851e38..22bf066 100644
--- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h
+++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h
@@ -47,7 +47,6 @@
public:
static const std::string kEffectName;
static const bool kStrengthSupported;
- static const NoiseSuppression::Capability kCapability;
static const Descriptor kDescriptor;
NoiseSuppressionSw() { LOG(DEBUG) << __func__; }
~NoiseSuppressionSw() {
diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.cpp b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
index d038596..2da3ff6 100644
--- a/audio/aidl/default/presetReverb/PresetReverbSw.cpp
+++ b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
@@ -62,12 +62,17 @@
const std::string PresetReverbSw::kEffectName = "PresetReverbSw";
-const std::vector<PresetReverb::Presets> kSupportedPresets{
+const std::vector<PresetReverb::Presets> PresetReverbSw::kSupportedPresets{
ndk::enum_range<PresetReverb::Presets>().begin(),
ndk::enum_range<PresetReverb::Presets>().end()};
-const PresetReverb::Capability PresetReverbSw::kCapability = {.supportedPresets =
- kSupportedPresets};
+const std::vector<Range::PresetReverbRange> PresetReverbSw::kRanges = {
+ MAKE_RANGE(PresetReverb, supportedPresets, PresetReverbSw::kSupportedPresets,
+ PresetReverbSw::kSupportedPresets)};
+
+const Capability PresetReverbSw::kCapability = {
+ .range = Range::make<Range::presetReverb>(PresetReverbSw::kRanges)};
+
const Descriptor PresetReverbSw::kDescriptor = {
.common = {.id = {.type = kPresetReverbTypeUUID,
.uuid = kPresetReverbSwImplUUID,
@@ -77,7 +82,7 @@
.volume = Flags::Volume::CTRL},
.name = PresetReverbSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::presetReverb>(PresetReverbSw::kCapability)};
+ .capability = PresetReverbSw::kCapability};
ndk::ScopedAStatus PresetReverbSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -92,6 +97,7 @@
RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
auto& prParam = specific.get<Parameter::Specific::presetReverb>();
+ RETURN_IF(!inRange(prParam, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = prParam.getTag();
switch (tag) {
diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.h b/audio/aidl/default/presetReverb/PresetReverbSw.h
index eb1d80a..5061475 100644
--- a/audio/aidl/default/presetReverb/PresetReverbSw.h
+++ b/audio/aidl/default/presetReverb/PresetReverbSw.h
@@ -46,7 +46,9 @@
class PresetReverbSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const PresetReverb::Capability kCapability;
+ static const std::vector<PresetReverb::Presets> kSupportedPresets;
+ static const std::vector<Range::PresetReverbRange> kRanges;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
PresetReverbSw() { LOG(DEBUG) << __func__; }
~PresetReverbSw() {
diff --git a/audio/aidl/default/usb/StreamUsb.cpp b/audio/aidl/default/usb/StreamUsb.cpp
index 22e36ac..bd53a0e 100644
--- a/audio/aidl/default/usb/StreamUsb.cpp
+++ b/audio/aidl/default/usb/StreamUsb.cpp
@@ -30,6 +30,8 @@
using aidl::android::media::audio::common::AudioDevice;
using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioOffloadInfo;
+using aidl::android::media::audio::common::MicrophoneDynamicInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
namespace aidl::android::hardware::audio::core {
@@ -239,4 +241,4 @@
},
offloadInfo) {}
-} // namespace aidl::android::hardware::audio::core
\ No newline at end of file
+} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.cpp b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
index 08535bd..5e99cba2 100644
--- a/audio/aidl/default/virtualizer/VirtualizerSw.cpp
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
@@ -32,6 +32,7 @@
using aidl::android::hardware::audio::effect::VirtualizerSw;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceDescription;
+using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
@@ -62,9 +63,20 @@
namespace aidl::android::hardware::audio::effect {
const std::string VirtualizerSw::kEffectName = "VirtualizerSw";
-const bool VirtualizerSw::kStrengthSupported = true;
-const Virtualizer::Capability VirtualizerSw::kCapability = {
- .maxStrengthPm = 1000, .strengthSupported = kStrengthSupported};
+
+const std::vector<Range::VirtualizerRange> VirtualizerSw::kRanges = {
+ MAKE_RANGE(Virtualizer, strengthPm, 0, 1000),
+ /* speakerAngle is get-only, set min > max */
+ MAKE_RANGE(Virtualizer, speakerAngles, {Virtualizer::ChannelAngle({.channel = 1})},
+ {Virtualizer::ChannelAngle({.channel = 0})}),
+ /* device is get-only */
+ MAKE_RANGE(Virtualizer, device,
+ AudioDeviceDescription({.type = AudioDeviceType::IN_DEFAULT}),
+ AudioDeviceDescription({.type = AudioDeviceType::NONE}))};
+
+const Capability VirtualizerSw::kCapability = {
+ .range = Range::make<Range::virtualizer>(VirtualizerSw::kRanges)};
+
const Descriptor VirtualizerSw::kDescriptor = {
.common = {.id = {.type = kVirtualizerTypeUUID,
.uuid = kVirtualizerSwImplUUID,
@@ -74,7 +86,7 @@
.volume = Flags::Volume::CTRL},
.name = VirtualizerSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::virtualizer>(VirtualizerSw::kCapability)};
+ .capability = VirtualizerSw::kCapability};
ndk::ScopedAStatus VirtualizerSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -87,12 +99,11 @@
"EffectNotSupported");
auto& vrParam = specific.get<Parameter::Specific::virtualizer>();
+ RETURN_IF(!inRange(vrParam, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = vrParam.getTag();
switch (tag) {
case Virtualizer::strengthPm: {
- RETURN_IF(!kStrengthSupported, EX_ILLEGAL_ARGUMENT, "SettingStrengthNotSupported");
-
RETURN_IF(mContext->setVrStrength(vrParam.get<Virtualizer::strengthPm>()) !=
RetCode::SUCCESS,
EX_ILLEGAL_ARGUMENT, "setStrengthPmFailed");
@@ -213,11 +224,6 @@
}
RetCode VirtualizerSwContext::setVrStrength(int strength) {
- if (strength < 0 || strength > VirtualizerSw::kCapability.maxStrengthPm) {
- LOG(ERROR) << __func__ << " invalid strength: " << strength;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new strength
mStrength = strength;
return RetCode::SUCCESS;
}
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.h b/audio/aidl/default/virtualizer/VirtualizerSw.h
index 1016ffc..5c5b616 100644
--- a/audio/aidl/default/virtualizer/VirtualizerSw.h
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.h
@@ -51,8 +51,7 @@
class VirtualizerSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const bool kStrengthSupported;
- static const Virtualizer::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
VirtualizerSw() { LOG(DEBUG) << __func__; }
~VirtualizerSw() {
@@ -73,6 +72,7 @@
std::string getEffectName() override { return kEffectName; }
private:
+ static const std::vector<Range::VirtualizerRange> kRanges;
std::shared_ptr<VirtualizerSwContext> mContext;
ndk::ScopedAStatus getParameterVirtualizer(const Virtualizer::Tag& tag,
diff --git a/audio/aidl/default/visualizer/VisualizerSw.cpp b/audio/aidl/default/visualizer/VisualizerSw.cpp
index 614988c..deb3204 100644
--- a/audio/aidl/default/visualizer/VisualizerSw.cpp
+++ b/audio/aidl/default/visualizer/VisualizerSw.cpp
@@ -55,12 +55,15 @@
namespace aidl::android::hardware::audio::effect {
const std::string VisualizerSw::kEffectName = "VisualizerSw";
+
/* capabilities */
-const Visualizer::CaptureSamplesRange VisualizerSwContext::kCaptureSamplesRange = {
- VisualizerSwContext::kMinCaptureSize, VisualizerSwContext::kMaxCaptureSize};
-const Visualizer::Capability VisualizerSw::kCapability = {
- .maxLatencyMs = VisualizerSwContext::kMaxLatencyMs,
- .captureSampleRange = VisualizerSwContext::kCaptureSamplesRange};
+const std::vector<Range::VisualizerRange> VisualizerSw::kRanges = {
+ MAKE_RANGE(Visualizer, latencyMs, 0, VisualizerSwContext::kMaxLatencyMs),
+ MAKE_RANGE(Visualizer, captureSamples, VisualizerSwContext::kMinCaptureSize,
+ VisualizerSwContext::kMaxCaptureSize)};
+
+const Capability VisualizerSw::kCapability = {
+ .range = Range::make<Range::visualizer>(VisualizerSw::kRanges)};
const Descriptor VisualizerSw::kDescriptor = {
.common = {.id = {.type = kVisualizerTypeUUID,
@@ -71,7 +74,7 @@
.volume = Flags::Volume::CTRL},
.name = VisualizerSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::visualizer>(VisualizerSw::kCapability)};
+ .capability = VisualizerSw::kCapability};
ndk::ScopedAStatus VisualizerSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -84,34 +87,33 @@
"EffectNotSupported");
auto& vsParam = specific.get<Parameter::Specific::visualizer>();
+ RETURN_IF(!inRange(vsParam, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = vsParam.getTag();
switch (tag) {
case Visualizer::captureSamples: {
RETURN_IF(mContext->setVsCaptureSize(vsParam.get<Visualizer::captureSamples>()) !=
RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "captureSizeNotSupported");
+ EX_ILLEGAL_ARGUMENT, "setCaptureSizeFailed");
return ndk::ScopedAStatus::ok();
}
case Visualizer::scalingMode: {
RETURN_IF(mContext->setVsScalingMode(vsParam.get<Visualizer::scalingMode>()) !=
RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "scalingModeNotSupported");
+ EX_ILLEGAL_ARGUMENT, "setScalingModeFailed");
return ndk::ScopedAStatus::ok();
}
case Visualizer::measurementMode: {
RETURN_IF(mContext->setVsMeasurementMode(vsParam.get<Visualizer::measurementMode>()) !=
RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "measurementModeNotSupported");
+ EX_ILLEGAL_ARGUMENT, "setMeasurementModeFailed");
return ndk::ScopedAStatus::ok();
}
- case Visualizer::setOnlyParameters: {
- return setSetOnlyParameterVisualizer(vsParam.get<Visualizer::setOnlyParameters>());
- }
- case Visualizer::getOnlyParameters: {
- LOG(ERROR) << __func__ << " unsupported settable getOnlyParam";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "SetofGetOnlyParamsNotSupported");
+ case Visualizer::latencyMs: {
+ RETURN_IF(mContext->setVsLatency(vsParam.get<Visualizer::latencyMs>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setLatencyFailed");
+ return ndk::ScopedAStatus::ok();
}
default: {
LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
@@ -121,18 +123,6 @@
}
}
-ndk::ScopedAStatus VisualizerSw::setSetOnlyParameterVisualizer(
- Visualizer::SetOnlyParameters setOnlyParam) {
- auto tag = setOnlyParam.getTag();
- RETURN_IF(Visualizer::SetOnlyParameters::latencyMs != tag, EX_ILLEGAL_ARGUMENT,
- "SetOnlyParametersTagNotSupported");
- RETURN_IF(
- mContext->setVsLatency(setOnlyParam.get<Visualizer::SetOnlyParameters::latencyMs>()) !=
- RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "latencyNotSupported");
- return ndk::ScopedAStatus::ok();
-}
-
ndk::ScopedAStatus VisualizerSw::getParameterSpecific(const Parameter::Id& id,
Parameter::Specific* specific) {
auto tag = id.getTag();
@@ -142,14 +132,6 @@
switch (vsIdTag) {
case Visualizer::Id::commonTag:
return getParameterVisualizer(vsId.get<Visualizer::Id::commonTag>(), specific);
- case Visualizer::Id::getOnlyParamTag:
- return getGetOnlyParameterVisualizer(vsId.get<Visualizer::Id::getOnlyParamTag>(),
- specific);
- case Visualizer::Id::setOnlyParamTag: {
- LOG(ERROR) << __func__ << " unsupported gettable setOnlyParam";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "GetofSetOnlyParamsNotSupported");
- }
default:
LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
@@ -174,6 +156,18 @@
vsParam.set<Visualizer::measurementMode>(mContext->getVsMeasurementMode());
break;
}
+ case Visualizer::measurement: {
+ vsParam.set<Visualizer::measurement>(mContext->getVsMeasurement());
+ break;
+ }
+ case Visualizer::captureSampleBuffer: {
+ vsParam.set<Visualizer::captureSampleBuffer>(mContext->getVsCaptureSampleBuffer());
+ break;
+ }
+ case Visualizer::latencyMs: {
+ vsParam.set<Visualizer::latencyMs>(mContext->getVsLatency());
+ break;
+ }
default: {
LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
@@ -184,32 +178,6 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus VisualizerSw::getGetOnlyParameterVisualizer(
- const Visualizer::GetOnlyParameters::Tag& tag, Parameter::Specific* specific) {
- Visualizer::GetOnlyParameters getOnlyParam;
- switch (tag) {
- case Visualizer::GetOnlyParameters::measurement: {
- getOnlyParam.set<Visualizer::GetOnlyParameters::measurement>(
- mContext->getVsMeasurement());
- break;
- }
- case Visualizer::GetOnlyParameters::captureSampleBuffer: {
- getOnlyParam.set<Visualizer::GetOnlyParameters::captureSampleBuffer>(
- mContext->getVsCaptureSampleBuffer());
- break;
- }
- default: {
- LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "GetOnlyParameterTagNotSupported");
- }
- }
- Visualizer vsParam;
- vsParam.set<Visualizer::getOnlyParameters>(getOnlyParam);
- specific->set<Parameter::Specific::visualizer>(vsParam);
- return ndk::ScopedAStatus::ok();
-}
-
std::shared_ptr<EffectContext> VisualizerSw::createContext(const Parameter::Common& common) {
if (mContext) {
LOG(DEBUG) << __func__ << " context already exist";
@@ -242,34 +210,21 @@
}
RetCode VisualizerSwContext::setVsCaptureSize(int captureSize) {
- if (captureSize < VisualizerSw::kCapability.captureSampleRange.min ||
- captureSize > VisualizerSw::kCapability.captureSampleRange.max) {
- LOG(ERROR) << __func__ << " invalid captureSize " << captureSize;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new captureSize
mCaptureSize = captureSize;
return RetCode::SUCCESS;
}
RetCode VisualizerSwContext::setVsScalingMode(Visualizer::ScalingMode scalingMode) {
- // TODO : Add implementation to apply new scalingMode
mScalingMode = scalingMode;
return RetCode::SUCCESS;
}
RetCode VisualizerSwContext::setVsMeasurementMode(Visualizer::MeasurementMode measurementMode) {
- // TODO : Add implementation to apply new measurementMode
mMeasurementMode = measurementMode;
return RetCode::SUCCESS;
}
RetCode VisualizerSwContext::setVsLatency(int latency) {
- if (latency < 0 || latency > VisualizerSw::kCapability.maxLatencyMs) {
- LOG(ERROR) << __func__ << " invalid latency " << latency;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to modify latency
mLatency = latency;
return RetCode::SUCCESS;
}
diff --git a/audio/aidl/default/visualizer/VisualizerSw.h b/audio/aidl/default/visualizer/VisualizerSw.h
index e9d46d7..ee7276a 100644
--- a/audio/aidl/default/visualizer/VisualizerSw.h
+++ b/audio/aidl/default/visualizer/VisualizerSw.h
@@ -30,7 +30,6 @@
static const int kMaxCaptureSize = 0x400;
static const int kMaxLatencyMs = 3000;
static const int kMaxCaptureBufSize = 0xffff;
- static const Visualizer::CaptureSamplesRange kCaptureSamplesRange;
VisualizerSwContext(int statusDepth, const Parameter::Common& common)
: EffectContext(statusDepth, common) {
LOG(DEBUG) << __func__;
@@ -48,8 +47,9 @@
Visualizer::MeasurementMode getVsMeasurementMode() const { return mMeasurementMode; }
RetCode setVsLatency(int latency);
+ int getVsLatency() const { return mLatency; }
- Visualizer::GetOnlyParameters::Measurement getVsMeasurement() const { return mMeasurement; }
+ Visualizer::Measurement getVsMeasurement() const { return mMeasurement; }
std::vector<uint8_t> getVsCaptureSampleBuffer() const { return mCaptureSampleBuffer; }
private:
@@ -57,14 +57,14 @@
Visualizer::ScalingMode mScalingMode = Visualizer::ScalingMode::NORMALIZED;
Visualizer::MeasurementMode mMeasurementMode = Visualizer::MeasurementMode::NONE;
int mLatency = 0;
- const Visualizer::GetOnlyParameters::Measurement mMeasurement = {0, 0};
+ const Visualizer::Measurement mMeasurement = {0, 0};
std::vector<uint8_t> mCaptureSampleBuffer;
};
class VisualizerSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const Visualizer::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
VisualizerSw() { LOG(DEBUG) << __func__; }
~VisualizerSw() {
@@ -85,12 +85,9 @@
std::string getEffectName() override { return kEffectName; }
private:
+ static const std::vector<Range::VisualizerRange> kRanges;
std::shared_ptr<VisualizerSwContext> mContext;
-
- ndk::ScopedAStatus setSetOnlyParameterVisualizer(Visualizer::SetOnlyParameters setOnlyParam);
ndk::ScopedAStatus getParameterVisualizer(const Visualizer::Tag& tag,
Parameter::Specific* specific);
- ndk::ScopedAStatus getGetOnlyParameterVisualizer(const Visualizer::GetOnlyParameters::Tag& tag,
- Parameter::Specific* specific);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/volume/VolumeSw.cpp b/audio/aidl/default/volume/VolumeSw.cpp
index 64301dc..796c332 100644
--- a/audio/aidl/default/volume/VolumeSw.cpp
+++ b/audio/aidl/default/volume/VolumeSw.cpp
@@ -60,7 +60,11 @@
namespace aidl::android::hardware::audio::effect {
const std::string VolumeSw::kEffectName = "VolumeSw";
-const Volume::Capability VolumeSw::kCapability = {.minLevelDb = -9600, .maxLevelDb = 0};
+
+const std::vector<Range::VolumeRange> VolumeSw::kRanges = {MAKE_RANGE(Volume, levelDb, -9600, 0)};
+
+const Capability VolumeSw::kCapability = {.range = Range::make<Range::volume>(VolumeSw::kRanges)};
+
const Descriptor VolumeSw::kDescriptor = {
.common = {.id = {.type = kVolumeTypeUUID,
.uuid = kVolumeSwImplUUID,
@@ -70,7 +74,7 @@
.volume = Flags::Volume::CTRL},
.name = VolumeSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::volume>(VolumeSw::kCapability)};
+ .capability = VolumeSw::kCapability};
ndk::ScopedAStatus VolumeSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -83,6 +87,7 @@
"EffectNotSupported");
auto& volParam = specific.get<Parameter::Specific::volume>();
+ RETURN_IF(!inRange(volParam, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = volParam.getTag();
switch (tag) {
@@ -177,11 +182,6 @@
}
RetCode VolumeSwContext::setVolLevel(int level) {
- if (level < VolumeSw::kCapability.minLevelDb || level > VolumeSw::kCapability.maxLevelDb) {
- LOG(ERROR) << __func__ << " invalid level " << level;
- return RetCode::ERROR_ILLEGAL_PARAMETER;
- }
- // TODO : Add implementation to apply new level
mLevel = level;
return RetCode::SUCCESS;
}
diff --git a/audio/aidl/default/volume/VolumeSw.h b/audio/aidl/default/volume/VolumeSw.h
index b6f6077..2dd4324 100644
--- a/audio/aidl/default/volume/VolumeSw.h
+++ b/audio/aidl/default/volume/VolumeSw.h
@@ -49,7 +49,7 @@
class VolumeSw final : public EffectImpl {
public:
static const std::string kEffectName;
- static const Volume::Capability kCapability;
+ static const Capability kCapability;
static const Descriptor kDescriptor;
VolumeSw() { LOG(DEBUG) << __func__; }
~VolumeSw() {
@@ -70,6 +70,7 @@
std::string getEffectName() override { return kEffectName; }
private:
+ static const std::vector<Range::VolumeRange> kRanges;
std::shared_ptr<VolumeSwContext> mContext;
ndk::ScopedAStatus getParameterVolume(const Volume::Tag& tag, Parameter::Specific* specific);
diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp
index f9d12dd..8db8eaf 100644
--- a/audio/aidl/vts/Android.bp
+++ b/audio/aidl/vts/Android.bp
@@ -141,9 +141,15 @@
}
cc_test {
- name: "VtsHalAGCTargetTest",
+ name: "VtsHalAGC1TargetTest",
defaults: ["VtsHalAudioTargetTestDefaults"],
- srcs: ["VtsHalAGCTargetTest.cpp"],
+ srcs: ["VtsHalAGC1TargetTest.cpp"],
+}
+
+cc_test {
+ name: "VtsHalAGC2TargetTest",
+ defaults: ["VtsHalAudioTargetTestDefaults"],
+ srcs: ["VtsHalAGC2TargetTest.cpp"],
}
cc_test {
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 526a012..5ed8e1f 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -19,6 +19,7 @@
#include <algorithm>
#include <memory>
#include <string>
+#include <type_traits>
#include <unordered_map>
#include <vector>
@@ -27,6 +28,7 @@
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
#include <android/binder_auto_utils.h>
#include <fmq/AidlMessageQueue.h>
+#include <system/audio_effects/aidl_effects_utils.h>
#include "AudioHalBinderServiceUtil.h"
#include "EffectFactoryHelper.h"
@@ -37,6 +39,7 @@
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::Parameter;
+using aidl::android::hardware::audio::effect::Range;
using aidl::android::hardware::audio::effect::State;
using aidl::android::hardware::common::fmq::SynchronizedReadWrite;
using aidl::android::media::audio::common::AudioChannelLayout;
@@ -205,4 +208,58 @@
std::unique_ptr<DataMQ> inputMQ;
std::unique_ptr<DataMQ> outputMQ;
};
+
+ template <typename T, Range::Tag tag>
+ static bool isParameterValid(const T& target, const Descriptor& desc) {
+ if (desc.capability.range.getTag() != tag) {
+ return true;
+ }
+ const auto& ranges = desc.capability.range.get<tag>();
+ return inRange(target, ranges);
+ }
+
+ /**
+ * Add to test value set: (min+max)/2, minimum/maximum numeric limits, and min-1/max+1 if
+ * result still in numeric limits after -1/+1.
+ * Only use this when the type of test value is basic type (std::is_arithmetic return true).
+ */
+ template <typename S, typename = std::enable_if_t<std::is_arithmetic_v<S>>>
+ static std::set<S> expandTestValueBasic(std::set<S>& s) {
+ const auto min = *s.begin(), max = *s.rbegin();
+ const auto minLimit = std::numeric_limits<S>::min(),
+ maxLimit = std::numeric_limits<S>::max();
+ if (s.size()) {
+ s.insert(min + (max - min) / 2);
+ if (min != minLimit) {
+ s.insert(min - 1);
+ }
+ if (max != maxLimit) {
+ s.insert(max + 1);
+ }
+ }
+ s.insert(minLimit);
+ s.insert(maxLimit);
+ return s;
+ }
+
+ template <typename T, typename S, Range::Tag R, typename T::Tag tag, typename Functor>
+ static std::set<S> getTestValueSet(
+ std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kFactoryDescList,
+ Functor functor) {
+ std::set<S> result;
+ for (const auto& [_, desc] : kFactoryDescList) {
+ if (desc.capability.range.getTag() == R) {
+ const auto& ranges = desc.capability.range.get<R>();
+ for (const auto& range : ranges) {
+ if (range.min.getTag() == tag) {
+ result.insert(range.min.template get<tag>());
+ }
+ if (range.max.getTag() == tag) {
+ result.insert(range.max.template get<tag>());
+ }
+ }
+ }
+ }
+ return functor(result);
+ }
};
diff --git a/audio/aidl/vts/VtsHalAECTargetTest.cpp b/audio/aidl/vts/VtsHalAECTargetTest.cpp
index c3427c8..39be191 100644
--- a/audio/aidl/vts/VtsHalAECTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAECTargetTest.cpp
@@ -23,16 +23,17 @@
#define LOG_TAG "VtsHalAECParamTest"
#include "EffectHelper.h"
+#include "effect-impl/EffectTypes.h"
using namespace android;
using aidl::android::hardware::audio::effect::AcousticEchoCanceler;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kAcousticEchoCancelerTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
+using aidl::android::hardware::audio::effect::Range;
enum ParamName { PARAM_INSTANCE_NAME, PARAM_ECHO_DELAY, PARAM_MOBILE_MODE };
using AECParamTestParam = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>,
@@ -87,7 +88,8 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(tag, aec, desc);
+ const bool valid =
+ isParameterValid<AcousticEchoCanceler, Range::acousticEchoCanceler>(aec, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -124,54 +126,6 @@
mTags.push_back({AcousticEchoCanceler::mobileMode, aec});
}
- bool isTagInRange(const AcousticEchoCanceler::Tag& tag, const AcousticEchoCanceler& aec,
- const Descriptor& desc) const {
- const AcousticEchoCanceler::Capability& aecCap =
- desc.capability.get<Capability::acousticEchoCanceler>();
- switch (tag) {
- case AcousticEchoCanceler::echoDelayUs: {
- return isEchoDelayInRange(aecCap, aec.get<AcousticEchoCanceler::echoDelayUs>());
- }
- case AcousticEchoCanceler::mobileMode: {
- bool mode = aec.get<AcousticEchoCanceler::mobileMode>();
- return isMobileModeValid(aecCap, mode);
- }
- default:
- return false;
- }
- }
-
- bool isEchoDelayInRange(const AcousticEchoCanceler::Capability& cap, int delay) const {
- return (delay >= 0 && delay <= cap.maxEchoDelayUs);
- }
-
- bool isMobileModeValid(const AcousticEchoCanceler::Capability& cap, bool mode) const {
- if (cap.supportMobileMode) {
- return true;
- } else {
- return mode == false;
- }
- }
-
- static std::unordered_set<int> getEchoDelayTestValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kAcousticEchoCancelerTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::acousticEchoCanceler>()
- .maxEchoDelayUs <
- b.second.capability.get<Capability::acousticEchoCanceler>()
- .maxEchoDelayUs;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxDelay =
- max->second.capability.get<Capability::acousticEchoCanceler>().maxEchoDelayUs;
- return {-1, 0, maxDelay - 1, maxDelay, maxDelay + 1};
- }
static std::unordered_set<bool> getMobileModeValues() { return {true, false}; }
private:
@@ -189,12 +143,20 @@
SetAndGetParameters();
}
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
INSTANTIATE_TEST_SUITE_P(
AECParamTest, AECParamTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kAcousticEchoCancelerTypeUUID)),
- testing::ValuesIn(AECParamTest::getEchoDelayTestValues()),
- testing::ValuesIn(AECParamTest::getMobileModeValues())),
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kAcousticEchoCancelerTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<AcousticEchoCanceler, int,
+ Range::acousticEchoCanceler,
+ AcousticEchoCanceler::echoDelayUs>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<AcousticEchoCanceler, bool,
+ Range::acousticEchoCanceler,
+ AcousticEchoCanceler::mobileMode>(
+ kDescPair, EffectHelper::expandTestValueBasic<bool>))),
[](const testing::TestParamInfo<AECParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
std::string echoDelay = std::to_string(std::get<PARAM_ECHO_DELAY>(info.param));
diff --git a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
new file mode 100644
index 0000000..a6fc1aa
--- /dev/null
+++ b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2023 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 <Utils.h>
+#include <aidl/Vintf.h>
+
+#define LOG_TAG "VtsHalAGC1ParamTest"
+
+#include "EffectHelper.h"
+
+using namespace android;
+
+using aidl::android::hardware::audio::effect::AutomaticGainControlV1;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::IFactory;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV1TypeUUID;
+using aidl::android::hardware::audio::effect::Parameter;
+
+enum ParamName {
+ PARAM_INSTANCE_NAME,
+ PARAM_TARGET_PEAK_LEVEL,
+ PARAM_MAX_COMPRESSION_GAIN,
+ PARAM_ENABLE_LIMITER
+};
+using AGC1ParamTestParam =
+ std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int /* targetPeakLevel */,
+ int /* maxCompressionGain */, bool /* enableLimiter */>;
+
+class AGC1ParamTest : public ::testing::TestWithParam<AGC1ParamTestParam>, public EffectHelper {
+ public:
+ AGC1ParamTest()
+ : mTargetPeakLevel(std::get<PARAM_TARGET_PEAK_LEVEL>(GetParam())),
+ mMaxCompressionGain(std::get<PARAM_MAX_COMPRESSION_GAIN>(GetParam())),
+ mEnableLimiter(std::get<PARAM_ENABLE_LIMITER>(GetParam())) {
+ std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
+ }
+
+ void SetUp() override {
+ ASSERT_NE(nullptr, mFactory);
+ ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
+
+ Parameter::Specific specific = getDefaultParamSpecific();
+ Parameter::Common common = EffectHelper::createParamCommon(
+ 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
+ kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
+ IEffect::OpenEffectReturn ret;
+ ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
+ ASSERT_NE(nullptr, mEffect);
+ }
+
+ void TearDown() override {
+ ASSERT_NO_FATAL_FAILURE(close(mEffect));
+ ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
+ }
+
+ Parameter::Specific getDefaultParamSpecific() {
+ AutomaticGainControlV1 AGC1 =
+ AutomaticGainControlV1::make<AutomaticGainControlV1::targetPeakLevelDbFs>(0);
+ Parameter::Specific specific =
+ Parameter::Specific::make<Parameter::Specific::automaticGainControlV1>(AGC1);
+ return specific;
+ }
+
+ static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
+ std::shared_ptr<IFactory> mFactory;
+ std::shared_ptr<IEffect> mEffect;
+ Descriptor mDescriptor;
+ int mTargetPeakLevel;
+ int mMaxCompressionGain;
+ bool mEnableLimiter;
+
+ void SetAndGetParameters() {
+ for (auto& it : mTags) {
+ auto& tag = it.first;
+ auto& AGC1 = it.second;
+
+ // validate parameter
+ Descriptor desc;
+ ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
+ const bool valid =
+ isParameterValid<AutomaticGainControlV1, Range::automaticGainControlV1>(AGC1,
+ desc);
+ const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
+
+ // set parameter
+ Parameter expectParam;
+ Parameter::Specific specific;
+ specific.set<Parameter::Specific::automaticGainControlV1>(AGC1);
+ expectParam.set<Parameter::specific>(specific);
+ EXPECT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString();
+
+ // only get if parameter in range and set success
+ if (expected == EX_NONE) {
+ Parameter getParam;
+ Parameter::Id id;
+ AutomaticGainControlV1::Id specificId;
+ specificId.set<AutomaticGainControlV1::Id::commonTag>(tag);
+ id.set<Parameter::Id::automaticGainControlV1Tag>(specificId);
+ EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
+
+ EXPECT_EQ(expectParam, getParam) << "\nexpect:" << expectParam.toString()
+ << "\ngetParam:" << getParam.toString();
+ }
+ }
+ }
+
+ void addTargetPeakLevelParam(int targetPeakLevel) {
+ AutomaticGainControlV1 AGC1;
+ AGC1.set<AutomaticGainControlV1::targetPeakLevelDbFs>(targetPeakLevel);
+ mTags.push_back({AutomaticGainControlV1::targetPeakLevelDbFs, AGC1});
+ }
+ void addMaxCompressionGainParam(int maxCompressionGainDb) {
+ AutomaticGainControlV1 AGC1;
+ AGC1.set<AutomaticGainControlV1::maxCompressionGainDb>(maxCompressionGainDb);
+ mTags.push_back({AutomaticGainControlV1::maxCompressionGainDb, AGC1});
+ }
+ void addEnableLimiterParam(bool enableLimiter) {
+ AutomaticGainControlV1 AGC1;
+ AGC1.set<AutomaticGainControlV1::enableLimiter>(enableLimiter);
+ mTags.push_back({AutomaticGainControlV1::enableLimiter, AGC1});
+ }
+
+ private:
+ std::vector<std::pair<AutomaticGainControlV1::Tag, AutomaticGainControlV1>> mTags;
+ void CleanUp() { mTags.clear(); }
+};
+
+TEST_P(AGC1ParamTest, SetAndGetTargetPeakLevelParam) {
+ EXPECT_NO_FATAL_FAILURE(addTargetPeakLevelParam(mTargetPeakLevel));
+ SetAndGetParameters();
+}
+
+TEST_P(AGC1ParamTest, SetAndGetMaxCompressionGain) {
+ EXPECT_NO_FATAL_FAILURE(addMaxCompressionGainParam(mMaxCompressionGain));
+ SetAndGetParameters();
+}
+
+TEST_P(AGC1ParamTest, SetAndGetEnableLimiter) {
+ EXPECT_NO_FATAL_FAILURE(addEnableLimiterParam(mEnableLimiter));
+ SetAndGetParameters();
+}
+
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
+INSTANTIATE_TEST_SUITE_P(
+ AGC1ParamTest, AGC1ParamTest,
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kAutomaticGainControlV1TypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControlV1, int, Range::automaticGainControlV1,
+ AutomaticGainControlV1::targetPeakLevelDbFs>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControlV1, int, Range::automaticGainControlV1,
+ AutomaticGainControlV1::maxCompressionGainDb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::Bool()),
+ [](const testing::TestParamInfo<AGC1ParamTest::ParamType>& info) {
+ auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
+ std::string targetPeakLevel =
+ std::to_string(std::get<PARAM_TARGET_PEAK_LEVEL>(info.param));
+ std::string maxCompressionGain =
+ std::to_string(std::get<PARAM_MAX_COMPRESSION_GAIN>(info.param));
+ std::string enableLimiter = std::to_string(std::get<PARAM_ENABLE_LIMITER>(info.param));
+
+ std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
+ descriptor.common.name + "_UUID_" +
+ descriptor.common.id.uuid.toString() + "_target_peak_level_" +
+ targetPeakLevel + "_max_compression_gain_" + maxCompressionGain +
+ "_enable_limiter_" + enableLimiter;
+ std::replace_if(
+ name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
+ return name;
+ });
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AGC1ParamTest);
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
new file mode 100644
index 0000000..fd3a866
--- /dev/null
+++ b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Utils.h>
+#include <aidl/Vintf.h>
+#include <android/binder_enums.h>
+#include <unordered_set>
+
+#define LOG_TAG "VtsHalAGC2ParamTest"
+
+#include "EffectHelper.h"
+
+using namespace android;
+
+using aidl::android::hardware::audio::effect::AutomaticGainControlV2;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::IFactory;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV2TypeUUID;
+using aidl::android::hardware::audio::effect::Parameter;
+
+enum ParamName {
+ PARAM_INSTANCE_NAME,
+ PARAM_DIGITAL_GAIN,
+ PARAM_SATURATION_MARGIN,
+ PARAM_LEVEL_ESTIMATOR
+};
+using AGC2ParamTestParam =
+ std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int /* gain */,
+ int /* margin */, AutomaticGainControlV2::LevelEstimator>;
+
+class AGC2ParamTest : public ::testing::TestWithParam<AGC2ParamTestParam>, public EffectHelper {
+ public:
+ AGC2ParamTest()
+ : mGain(std::get<PARAM_DIGITAL_GAIN>(GetParam())),
+ mMargin(std::get<PARAM_SATURATION_MARGIN>(GetParam())),
+ mLevelEstimator(std::get<PARAM_LEVEL_ESTIMATOR>(GetParam())) {
+ std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
+ }
+
+ void SetUp() override {
+ ASSERT_NE(nullptr, mFactory);
+ ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
+
+ Parameter::Specific specific = getDefaultParamSpecific();
+ Parameter::Common common = EffectHelper::createParamCommon(
+ 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
+ kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
+ IEffect::OpenEffectReturn ret;
+ ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
+ ASSERT_NE(nullptr, mEffect);
+ }
+
+ void TearDown() override {
+ ASSERT_NO_FATAL_FAILURE(close(mEffect));
+ ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
+ }
+
+ Parameter::Specific getDefaultParamSpecific() {
+ AutomaticGainControlV2 AGC2 =
+ AutomaticGainControlV2::make<AutomaticGainControlV2::fixedDigitalGainMb>(0);
+ Parameter::Specific specific =
+ Parameter::Specific::make<Parameter::Specific::automaticGainControlV2>(AGC2);
+ return specific;
+ }
+
+ static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
+ std::shared_ptr<IFactory> mFactory;
+ std::shared_ptr<IEffect> mEffect;
+ Descriptor mDescriptor;
+ int mGain;
+ int mMargin;
+ AutomaticGainControlV2::LevelEstimator mLevelEstimator;
+
+ void SetAndGetParameters() {
+ for (auto& it : mTags) {
+ auto& tag = it.first;
+ auto& AGC2 = it.second;
+
+ // validate parameter
+ Descriptor desc;
+ ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
+ const bool valid =
+ isParameterValid<AutomaticGainControlV2, Range::automaticGainControlV2>(AGC2,
+ desc);
+ const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
+
+ // set parameter
+ Parameter expectParam;
+ Parameter::Specific specific;
+ specific.set<Parameter::Specific::automaticGainControlV2>(AGC2);
+ expectParam.set<Parameter::specific>(specific);
+ EXPECT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString();
+
+ // only get if parameter in range and set success
+ if (expected == EX_NONE) {
+ Parameter getParam;
+ Parameter::Id id;
+ AutomaticGainControlV2::Id specificId;
+ specificId.set<AutomaticGainControlV2::Id::commonTag>(tag);
+ id.set<Parameter::Id::automaticGainControlV2Tag>(specificId);
+ EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
+
+ EXPECT_EQ(expectParam, getParam) << "\nexpect:" << expectParam.toString()
+ << "\ngetParam:" << getParam.toString();
+ }
+ }
+ }
+
+ void addDigitalGainParam(int gain) {
+ AutomaticGainControlV2 AGC2;
+ AGC2.set<AutomaticGainControlV2::fixedDigitalGainMb>(gain);
+ mTags.push_back({AutomaticGainControlV2::fixedDigitalGainMb, AGC2});
+ }
+ void addSaturationMarginParam(int margin) {
+ AutomaticGainControlV2 AGC2;
+ AGC2.set<AutomaticGainControlV2::saturationMarginMb>(margin);
+ mTags.push_back({AutomaticGainControlV2::saturationMarginMb, AGC2});
+ }
+ void addLevelEstimatorParam(AutomaticGainControlV2::LevelEstimator levelEstimator) {
+ AutomaticGainControlV2 AGC2;
+ AGC2.set<AutomaticGainControlV2::levelEstimator>(levelEstimator);
+ mTags.push_back({AutomaticGainControlV2::levelEstimator, AGC2});
+ }
+
+ static std::set<AutomaticGainControlV2::LevelEstimator> getLevelEstimatorValues() {
+ return {ndk::enum_range<AutomaticGainControlV2::LevelEstimator>().begin(),
+ ndk::enum_range<AutomaticGainControlV2::LevelEstimator>().end()};
+ }
+
+ private:
+ std::vector<std::pair<AutomaticGainControlV2::Tag, AutomaticGainControlV2>> mTags;
+ void CleanUp() { mTags.clear(); }
+};
+
+TEST_P(AGC2ParamTest, SetAndGetDigitalGainParam) {
+ EXPECT_NO_FATAL_FAILURE(addDigitalGainParam(mGain));
+ SetAndGetParameters();
+}
+
+TEST_P(AGC2ParamTest, SetAndGetSaturationMargin) {
+ EXPECT_NO_FATAL_FAILURE(addSaturationMarginParam(mMargin));
+ SetAndGetParameters();
+}
+
+TEST_P(AGC2ParamTest, SetAndGetLevelEstimator) {
+ EXPECT_NO_FATAL_FAILURE(addLevelEstimatorParam(mLevelEstimator));
+ SetAndGetParameters();
+}
+
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
+INSTANTIATE_TEST_SUITE_P(
+ AGC2ParamTest, AGC2ParamTest,
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kAutomaticGainControlV2TypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControlV2, int, Range::automaticGainControlV2,
+ AutomaticGainControlV2::fixedDigitalGainMb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControlV2, int, Range::automaticGainControlV2,
+ AutomaticGainControlV2::saturationMarginMb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(AGC2ParamTest::getLevelEstimatorValues())),
+ [](const testing::TestParamInfo<AGC2ParamTest::ParamType>& info) {
+ auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
+ std::string gain = std::to_string(std::get<PARAM_DIGITAL_GAIN>(info.param));
+ std::string estimator = aidl::android::hardware::audio::effect::toString(
+ std::get<PARAM_LEVEL_ESTIMATOR>(info.param));
+ std::string margin =
+ std::to_string(static_cast<int>(std::get<PARAM_SATURATION_MARGIN>(info.param)));
+
+ std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
+ descriptor.common.name + "_UUID_" +
+ descriptor.common.id.uuid.toString() + "_digital_gain_" + gain +
+ "_level_estimator_" + estimator + "_margin_" + margin;
+ std::replace_if(
+ name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
+ return name;
+ });
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AGC2ParamTest);
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/audio/aidl/vts/VtsHalAGCTargetTest.cpp b/audio/aidl/vts/VtsHalAGCTargetTest.cpp
deleted file mode 100644
index 3448ae2..0000000
--- a/audio/aidl/vts/VtsHalAGCTargetTest.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <Utils.h>
-#include <aidl/Vintf.h>
-#include <android/binder_enums.h>
-#include <unordered_set>
-
-#define LOG_TAG "VtsHalAGCParamTest"
-
-#include "EffectHelper.h"
-
-using namespace android;
-
-using aidl::android::hardware::audio::effect::AutomaticGainControl;
-using aidl::android::hardware::audio::effect::Capability;
-using aidl::android::hardware::audio::effect::Descriptor;
-using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::IFactory;
-using aidl::android::hardware::audio::effect::kAutomaticGainControlTypeUUID;
-using aidl::android::hardware::audio::effect::Parameter;
-
-enum ParamName {
- PARAM_INSTANCE_NAME,
- PARAM_DIGITAL_GAIN,
- PARAM_SATURATION_MARGIN,
- PARAM_LEVEL_ESTIMATOR
-};
-using AGCParamTestParam =
- std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int /* gain */,
- int /* margin */, AutomaticGainControl::LevelEstimator>;
-
-class AGCParamTest : public ::testing::TestWithParam<AGCParamTestParam>, public EffectHelper {
- public:
- AGCParamTest()
- : mGain(std::get<PARAM_DIGITAL_GAIN>(GetParam())),
- mMargin(std::get<PARAM_SATURATION_MARGIN>(GetParam())),
- mLevelEstimator(std::get<PARAM_LEVEL_ESTIMATOR>(GetParam())) {
- std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
- }
-
- void SetUp() override {
- ASSERT_NE(nullptr, mFactory);
- ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
-
- Parameter::Specific specific = getDefaultParamSpecific();
- Parameter::Common common = EffectHelper::createParamCommon(
- 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
- kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
- IEffect::OpenEffectReturn ret;
- ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
- ASSERT_NE(nullptr, mEffect);
- }
-
- void TearDown() override {
- ASSERT_NO_FATAL_FAILURE(close(mEffect));
- ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
- }
-
- Parameter::Specific getDefaultParamSpecific() {
- AutomaticGainControl AGC =
- AutomaticGainControl::make<AutomaticGainControl::fixedDigitalGainMb>(0);
- Parameter::Specific specific =
- Parameter::Specific::make<Parameter::Specific::automaticGainControl>(AGC);
- return specific;
- }
-
- static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
- std::shared_ptr<IFactory> mFactory;
- std::shared_ptr<IEffect> mEffect;
- Descriptor mDescriptor;
- int mGain;
- int mMargin;
- AutomaticGainControl::LevelEstimator mLevelEstimator;
-
- void SetAndGetParameters() {
- for (auto& it : mTags) {
- auto& tag = it.first;
- auto& AGC = it.second;
-
- // validate parameter
- Descriptor desc;
- ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(tag, AGC, desc);
- const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
-
- // set parameter
- Parameter expectParam;
- Parameter::Specific specific;
- specific.set<Parameter::Specific::automaticGainControl>(AGC);
- expectParam.set<Parameter::specific>(specific);
- EXPECT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString();
-
- // only get if parameter in range and set success
- if (expected == EX_NONE) {
- Parameter getParam;
- Parameter::Id id;
- AutomaticGainControl::Id specificId;
- specificId.set<AutomaticGainControl::Id::commonTag>(tag);
- id.set<Parameter::Id::automaticGainControlTag>(specificId);
- EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
-
- EXPECT_EQ(expectParam, getParam) << "\nexpect:" << expectParam.toString()
- << "\ngetParam:" << getParam.toString();
- }
- }
- }
-
- void addDigitalGainParam(int gain) {
- AutomaticGainControl AGC;
- AGC.set<AutomaticGainControl::fixedDigitalGainMb>(gain);
- mTags.push_back({AutomaticGainControl::fixedDigitalGainMb, AGC});
- }
- void addSaturationMarginParam(int margin) {
- AutomaticGainControl AGC;
- AGC.set<AutomaticGainControl::saturationMarginMb>(margin);
- mTags.push_back({AutomaticGainControl::saturationMarginMb, AGC});
- }
- void addLevelEstimatorParam(AutomaticGainControl::LevelEstimator levelEstimator) {
- AutomaticGainControl AGC;
- AGC.set<AutomaticGainControl::levelEstimator>(levelEstimator);
- mTags.push_back({AutomaticGainControl::levelEstimator, AGC});
- }
-
- bool isTagInRange(const AutomaticGainControl::Tag& tag, const AutomaticGainControl& AGC,
- const Descriptor& desc) const {
- const AutomaticGainControl::Capability& AGCCap =
- desc.capability.get<Capability::automaticGainControl>();
- switch (tag) {
- case AutomaticGainControl::fixedDigitalGainMb: {
- auto gain = AGC.get<AutomaticGainControl::fixedDigitalGainMb>();
- return gain >= 0 && gain <= AGCCap.maxFixedDigitalGainMb;
- }
- case AutomaticGainControl::levelEstimator: {
- return true;
- }
- case AutomaticGainControl::saturationMarginMb: {
- auto margin = AGC.get<AutomaticGainControl::saturationMarginMb>();
- return margin >= 0 && margin <= AGCCap.maxSaturationMarginMb;
- }
- default:
- return false;
- }
- }
- static std::unordered_set<int> getDigitalGainValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kAutomaticGainControlTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::automaticGainControl>()
- .maxFixedDigitalGainMb <
- b.second.capability.get<Capability::automaticGainControl>()
- .maxFixedDigitalGainMb;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxGain = max->second.capability.get<Capability::automaticGainControl>()
- .maxFixedDigitalGainMb;
- return {-1, 0, maxGain - 1, maxGain, maxGain + 1};
- }
- static std::unordered_set<int> getSaturationMarginValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kAutomaticGainControlTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::automaticGainControl>()
- .maxSaturationMarginMb <
- b.second.capability.get<Capability::automaticGainControl>()
- .maxSaturationMarginMb;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxMargin = max->second.capability.get<Capability::automaticGainControl>()
- .maxSaturationMarginMb;
- return {-1, 0, maxMargin - 1, maxMargin, maxMargin + 1};
- }
- static std::unordered_set<AutomaticGainControl::LevelEstimator> getLevelEstimatorValues() {
- return {ndk::enum_range<AutomaticGainControl::LevelEstimator>().begin(),
- ndk::enum_range<AutomaticGainControl::LevelEstimator>().end()};
- }
-
- private:
- std::vector<std::pair<AutomaticGainControl::Tag, AutomaticGainControl>> mTags;
- void CleanUp() { mTags.clear(); }
-};
-
-TEST_P(AGCParamTest, SetAndGetDigitalGainParam) {
- EXPECT_NO_FATAL_FAILURE(addDigitalGainParam(mGain));
- SetAndGetParameters();
-}
-
-TEST_P(AGCParamTest, SetAndGetSaturationMargin) {
- EXPECT_NO_FATAL_FAILURE(addSaturationMarginParam(mMargin));
- SetAndGetParameters();
-}
-
-TEST_P(AGCParamTest, SetAndGetLevelEstimator) {
- EXPECT_NO_FATAL_FAILURE(addLevelEstimatorParam(mLevelEstimator));
- SetAndGetParameters();
-}
-
-INSTANTIATE_TEST_SUITE_P(
- AGCParamTest, AGCParamTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kAutomaticGainControlTypeUUID)),
- testing::ValuesIn(AGCParamTest::getDigitalGainValues()),
- testing::ValuesIn(AGCParamTest::getSaturationMarginValues()),
- testing::ValuesIn(AGCParamTest::getLevelEstimatorValues())),
- [](const testing::TestParamInfo<AGCParamTest::ParamType>& info) {
- auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
- std::string gain = std::to_string(std::get<PARAM_DIGITAL_GAIN>(info.param));
- std::string estimator = aidl::android::hardware::audio::effect::toString(
- std::get<PARAM_LEVEL_ESTIMATOR>(info.param));
- std::string margin =
- std::to_string(static_cast<int>(std::get<PARAM_SATURATION_MARGIN>(info.param)));
-
- std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
- descriptor.common.name + "_UUID_" +
- descriptor.common.id.uuid.toString() + "_digital_gain_" + gain +
- "_level_estimator_" + estimator + "_margin_" + margin;
- std::replace_if(
- name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
- return name;
- });
-
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AGCParamTest);
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ABinderProcess_setThreadPoolMaxThreadCount(1);
- ABinderProcess_startThreadPool();
- return RUN_ALL_TESTS();
-}
\ No newline at end of file
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index 90a0cf2..1222fd5 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -65,8 +65,6 @@
using aidl::android::hardware::audio::core::IStreamIn;
using aidl::android::hardware::audio::core::IStreamOut;
using aidl::android::hardware::audio::core::ITelephony;
-using aidl::android::hardware::audio::core::MicrophoneDynamicInfo;
-using aidl::android::hardware::audio::core::MicrophoneInfo;
using aidl::android::hardware::audio::core::ModuleDebug;
using aidl::android::hardware::audio::core::StreamDescriptor;
using aidl::android::hardware::audio::core::VendorParameter;
@@ -95,6 +93,8 @@
using aidl::android::media::audio::common::Boolean;
using aidl::android::media::audio::common::Float;
using aidl::android::media::audio::common::Int;
+using aidl::android::media::audio::common::MicrophoneDynamicInfo;
+using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::Void;
using android::hardware::audio::common::getChannelCount;
using android::hardware::audio::common::isBitPositionFlagSet;
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 88bdd13..947d30e 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -82,7 +82,7 @@
Parameter get;
EXPECT_IS_OK(mEffect->setParameter(set));
EXPECT_IS_OK(mEffect->getParameter(id, &get));
- EXPECT_EQ(set, get) << set.toString() << " vs " << get.toString();
+ EXPECT_EQ(set, get) << set.toString() << "\n vs \n" << get.toString();
}
};
@@ -390,7 +390,7 @@
Parameter::Id id;
id.set<Parameter::Id::commonTag>(Parameter::common);
EXPECT_IS_OK(mEffect->getParameter(id, &get));
- EXPECT_EQ(expect, get) << expect.toString() << " vs " << get.toString();
+ EXPECT_EQ(expect, get) << expect.toString() << "\n vs \n" << get.toString();
ASSERT_NO_FATAL_FAILURE(close(mEffect));
ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
diff --git a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
index d49a865..a1862d2 100644
--- a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
@@ -31,6 +31,7 @@
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kBassBoostTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
+using aidl::android::hardware::audio::effect::Range;
/**
* Here we focus on specific parameter checking, general IEffect interfaces testing performed in
@@ -92,7 +93,7 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(it.first, it.second, desc);
+ const bool valid = isParameterValid<BassBoost, Range::bassBoost>(it.second, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -122,46 +123,6 @@
mTags.push_back({BassBoost::strengthPm, bb});
}
- bool isTagInRange(const BassBoost::Tag& tag, const BassBoost& bb,
- const Descriptor& desc) const {
- const BassBoost::Capability& bbCap = desc.capability.get<Capability::bassBoost>();
- switch (tag) {
- case BassBoost::strengthPm: {
- int strength = bb.get<BassBoost::strengthPm>();
- return isStrengthInRange(bbCap, strength);
- }
- default:
- return false;
- }
- return false;
- }
-
- bool isStrengthInRange(const BassBoost::Capability& cap, int strength) const {
- return cap.strengthSupported && strength >= 0 && strength <= cap.maxStrengthPm;
- }
-
- static std::vector<int> getStrengthTestValues(
- std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kFactoryDescList) {
- const auto max = std::max_element(
- kFactoryDescList.begin(), kFactoryDescList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::bassBoost>().maxStrengthPm <
- b.second.capability.get<Capability::bassBoost>().maxStrengthPm;
- });
- if (max == kFactoryDescList.end()) {
- return {0};
- }
- int maxStrength = max->second.capability.get<Capability::bassBoost>().maxStrengthPm;
- return {std::numeric_limits<int>::min(),
- -1,
- 0,
- maxStrength >> 1,
- maxStrength,
- maxStrength + 1,
- std::numeric_limits<int>::max()};
- }
-
private:
std::vector<std::pair<BassBoost::Tag, BassBoost>> mTags;
void CleanUp() { mTags.clear(); }
@@ -172,14 +133,15 @@
SetAndGetBassBoostParameters();
}
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
INSTANTIATE_TEST_SUITE_P(
BassBoostTest, BassBoostParamTest,
::testing::Combine(
- testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kBassBoostTypeUUID)),
- testing::ValuesIn(BassBoostParamTest::getStrengthTestValues(
- EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kBassBoostTypeUUID)))),
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kBassBoostTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<BassBoost, int, Range::bassBoost,
+ BassBoost::strengthPm>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<BassBoostParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
std::string strength = std::to_string(std::get<PARAM_STRENGTH>(info.param));
diff --git a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
index 8612660..0601cc4 100644
--- a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
@@ -22,7 +22,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::Downmix;
using aidl::android::hardware::audio::effect::IEffect;
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index 9feff91..ece07f0 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -28,7 +28,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::DynamicsProcessing;
using aidl::android::hardware::audio::effect::IEffect;
@@ -82,31 +81,8 @@
}
// utils functions for parameter checking
- bool isParamValid(const DynamicsProcessing::Tag& tag, const DynamicsProcessing& dp,
- const Descriptor& desc);
bool isParamEqual(const DynamicsProcessing::Tag& tag, const DynamicsProcessing& dpRef,
const DynamicsProcessing& dpTest);
-
- bool isEnablementValid(const DynamicsProcessing::StageEnablement& enablement);
- bool isEngineConfigValid(const DynamicsProcessing::EngineArchitecture& cfg);
-
- bool isCutoffFrequencyValid(float freq, const DynamicsProcessing::Capability& cap);
- bool isChannelConfigValid(const std::vector<DynamicsProcessing::ChannelConfig>& cfgs,
- bool stageInUse);
-
- bool isPreEqBandConfigValid(const DynamicsProcessing::Capability& cap,
- const std::vector<DynamicsProcessing::EqBandConfig>& cfgs,
- bool stageInUse, int bandCount);
- bool isPostEqBandConfigValid(const DynamicsProcessing::Capability& cap,
- const std::vector<DynamicsProcessing::EqBandConfig>& cfgs,
- bool stageInUse, int bandCount);
- bool isMbcBandConfigValid(const DynamicsProcessing::Capability& cap,
- const std::vector<DynamicsProcessing::MbcBandConfig>& cfgs,
- bool stageInUse, int bandCount);
- bool isLimiterConfigValid(const std::vector<DynamicsProcessing::LimiterConfig>& cfgs,
- bool stageInUse);
- bool isInputGainValid(const std::vector<DynamicsProcessing::InputGain>& cfgs);
-
bool isEngineConfigEqual(const DynamicsProcessing::EngineArchitecture& refCfg,
const DynamicsProcessing::EngineArchitecture& testCfg);
@@ -201,56 +177,6 @@
{{.channel = -1, .gainDb = 10.f}, {.channel = 0, .gainDb = -10.f}}};
-bool DynamicsProcessingTestHelper::isParamValid(const DynamicsProcessing::Tag& tag,
- const DynamicsProcessing& dp,
- const Descriptor& desc) {
- const DynamicsProcessing::Capability& dpCap =
- desc.capability.get<Capability::dynamicsProcessing>();
- switch (tag) {
- case DynamicsProcessing::engineArchitecture: {
- return isEngineConfigValid(dp.get<DynamicsProcessing::engineArchitecture>());
- }
- case DynamicsProcessing::preEq: {
- return isChannelConfigValid(dp.get<DynamicsProcessing::preEq>(),
- mEngineConfigApplied.preEqStage.inUse);
- }
- case DynamicsProcessing::postEq: {
- return isChannelConfigValid(dp.get<DynamicsProcessing::postEq>(),
- mEngineConfigApplied.postEqStage.inUse);
- }
- case DynamicsProcessing::mbc: {
- return isChannelConfigValid(dp.get<DynamicsProcessing::mbc>(),
- mEngineConfigApplied.mbcStage.inUse);
- }
- case DynamicsProcessing::preEqBand: {
- return isPreEqBandConfigValid(dpCap, dp.get<DynamicsProcessing::preEqBand>(),
- mEngineConfigApplied.preEqStage.inUse,
- mEngineConfigApplied.preEqStage.bandCount);
- }
- case DynamicsProcessing::postEqBand: {
- return isPostEqBandConfigValid(dpCap, dp.get<DynamicsProcessing::postEqBand>(),
- mEngineConfigApplied.postEqStage.inUse,
- mEngineConfigApplied.postEqStage.bandCount);
- }
- case DynamicsProcessing::mbcBand: {
- return isMbcBandConfigValid(dpCap, dp.get<DynamicsProcessing::mbcBand>(),
- mEngineConfigApplied.mbcStage.inUse,
- mEngineConfigApplied.mbcStage.bandCount);
- }
- case DynamicsProcessing::limiter: {
- return isLimiterConfigValid(dp.get<DynamicsProcessing::limiter>(),
- mEngineConfigApplied.limiterInUse);
- }
- case DynamicsProcessing::inputGain: {
- return isInputGainValid(dp.get<DynamicsProcessing::inputGain>());
- }
- case DynamicsProcessing::vendorExtension: {
- return true;
- }
- }
- return true;
-}
-
bool DynamicsProcessingTestHelper::isParamEqual(const DynamicsProcessing::Tag& tag,
const DynamicsProcessing& dpRef,
const DynamicsProcessing& dpTest) {
@@ -304,117 +230,6 @@
}
}
-bool DynamicsProcessingTestHelper::isEnablementValid(
- const DynamicsProcessing::StageEnablement& enablement) {
- return !enablement.inUse || (enablement.inUse && enablement.bandCount > 0);
-}
-
-bool DynamicsProcessingTestHelper::isEngineConfigValid(
- const DynamicsProcessing::EngineArchitecture& cfg) {
- return cfg.preferredProcessingDurationMs >= 0 && isEnablementValid(cfg.preEqStage) &&
- isEnablementValid(cfg.postEqStage) && isEnablementValid(cfg.mbcStage);
-}
-
-bool DynamicsProcessingTestHelper::isChannelConfigValid(
- const std::vector<DynamicsProcessing::ChannelConfig>& cfgs, bool stageInUse) {
- std::unordered_set<int> channelSet;
- if (!stageInUse) return false;
- for (auto cfg : cfgs) {
- if (cfg.channel < 0 || cfg.channel >= mChannelCount || 0 != channelSet.count(cfg.channel)) {
- return false;
- }
- channelSet.insert(cfg.channel);
- }
- return true;
-}
-
-bool DynamicsProcessingTestHelper::isCutoffFrequencyValid(
- float freq, const DynamicsProcessing::Capability& cap) {
- return freq >= cap.minCutOffFreq && freq <= cap.maxCutOffFreq;
-}
-
-bool DynamicsProcessingTestHelper::isPreEqBandConfigValid(
- const DynamicsProcessing::Capability& cap,
- const std::vector<DynamicsProcessing::EqBandConfig>& cfgs, bool stageInUse, int bandCount) {
- std::set<std::pair<int /* channelID */, int /* bandID */>> bandSet;
- if (!stageInUse) return false;
- for (auto cfg : cfgs) {
- if (0 == mPreEqChannelEnable.count(cfg.channel) || cfg.channel < 0 ||
- cfg.channel >= mChannelCount || cfg.band < 0 || cfg.band >= bandCount ||
- !isCutoffFrequencyValid(cfg.cutoffFrequencyHz, cap) ||
- 0 != bandSet.count({cfg.channel, cfg.band})) {
- return false;
- }
- bandSet.insert({cfg.channel, cfg.band});
- }
- return true;
-}
-
-bool DynamicsProcessingTestHelper::isPostEqBandConfigValid(
- const DynamicsProcessing::Capability& cap,
- const std::vector<DynamicsProcessing::EqBandConfig>& cfgs, bool stageInUse, int bandCount) {
- std::set<std::pair<int /* channelID */, int /* bandID */>> bandSet;
- // not able to set/get parameter when stage not in use.
- if (!stageInUse) return false;
- for (auto cfg : cfgs) {
- if (0 == mPostEqChannelEnable.count(cfg.channel) || cfg.channel < 0 ||
- cfg.channel >= mChannelCount || cfg.band < 0 || cfg.band >= bandCount ||
- !isCutoffFrequencyValid(cfg.cutoffFrequencyHz, cap) ||
- 0 != bandSet.count({cfg.channel, cfg.band})) {
- return false;
- }
- bandSet.insert({cfg.channel, cfg.band});
- }
- return true;
-}
-
-bool DynamicsProcessingTestHelper::isMbcBandConfigValid(
- const DynamicsProcessing::Capability& cap,
- const std::vector<DynamicsProcessing::MbcBandConfig>& cfgs, bool stageInUse,
- int bandCount) {
- std::set<std::pair<int /* channelID */, int /* bandID */>> bandSet;
- if (!stageInUse) return false;
- for (auto cfg : cfgs) {
- if (0 == mMbcChannelEnable.count(cfg.channel) || cfg.channel < 0 ||
- cfg.channel >= mChannelCount || cfg.band < 0 || cfg.band >= bandCount ||
- (cfg.attackTimeMs < 0) || cfg.releaseTimeMs < 0 || cfg.ratio < 0 ||
- cfg.thresholdDb > 0 || cfg.kneeWidthDb < 0 || cfg.noiseGateThresholdDb > 0 ||
- cfg.expanderRatio < 0 || !isCutoffFrequencyValid(cfg.cutoffFrequencyHz, cap) ||
- 0 != bandSet.count({cfg.channel, cfg.band})) {
- return false;
- }
- bandSet.insert({cfg.channel, cfg.band});
- }
- return true;
-}
-
-bool DynamicsProcessingTestHelper::isLimiterConfigValid(
- const std::vector<DynamicsProcessing::LimiterConfig>& cfgs, bool stageInUse) {
- std::set<int> channelSet;
- if (!stageInUse) return false;
- for (auto cfg : cfgs) {
- if (0 == mLimiterChannelEnable.count(cfg.channel) || cfg.channel < 0 ||
- cfg.channel >= mChannelCount || cfg.attackTimeMs < 0 || cfg.releaseTimeMs < 0 ||
- cfg.ratio < 0 || cfg.thresholdDb > 0 || 0 != channelSet.count(cfg.channel)) {
- return false;
- }
- channelSet.insert(cfg.channel);
- }
- return true;
-}
-
-bool DynamicsProcessingTestHelper::isInputGainValid(
- const std::vector<DynamicsProcessing::InputGain>& cfgs) {
- std::set<int> channelSet;
- for (auto cfg : cfgs) {
- if (cfg.channel < 0 || cfg.channel >= mChannelCount || 0 != channelSet.count(cfg.channel)) {
- return false;
- }
- channelSet.insert(cfg.channel);
- }
- return true;
-}
-
bool DynamicsProcessingTestHelper::isEngineConfigEqual(
const DynamicsProcessing::EngineArchitecture& ref,
const DynamicsProcessing::EngineArchitecture& test) {
@@ -455,7 +270,8 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isParamValid(tag, dp, desc);
+ const bool valid =
+ isParameterValid<DynamicsProcessing, Range::dynamicsProcessing>(dp, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -463,7 +279,10 @@
Parameter::Specific specific;
specific.set<Parameter::Specific::dynamicsProcessing>(dp);
expectParam.set<Parameter::specific>(specific);
- ASSERT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString();
+ ASSERT_STATUS(expected, mEffect->setParameter(expectParam))
+ << "\n"
+ << expectParam.toString() << "\n"
+ << desc.toString();
// only get if parameter in range and set success
if (expected == EX_NONE) {
diff --git a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
index 82c8757..fea41cb 100644
--- a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
@@ -23,7 +23,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::EnvironmentalReverb;
using aidl::android::hardware::audio::effect::IEffect;
@@ -93,7 +92,8 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(it.first, it.second, desc);
+ const bool valid = isParameterValid<EnvironmentalReverb, Range::environmentalReverb>(
+ it.second, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set
@@ -171,239 +171,6 @@
mTags.push_back({EnvironmentalReverb::bypass, er});
}
- bool isTagInRange(const EnvironmentalReverb::Tag& tag, const EnvironmentalReverb er,
- const Descriptor& desc) const {
- const EnvironmentalReverb::Capability& erCap =
- desc.capability.get<Capability::environmentalReverb>();
- switch (tag) {
- case EnvironmentalReverb::roomLevelMb: {
- int roomLevel = er.get<EnvironmentalReverb::roomLevelMb>();
- return isRoomLevelInRange(erCap, roomLevel);
- }
- case EnvironmentalReverb::roomHfLevelMb: {
- int roomHfLevel = er.get<EnvironmentalReverb::roomHfLevelMb>();
- return isRoomHfLevelInRange(erCap, roomHfLevel);
- }
- case EnvironmentalReverb::decayTimeMs: {
- int decayTime = er.get<EnvironmentalReverb::decayTimeMs>();
- return isDecayTimeInRange(erCap, decayTime);
- }
- case EnvironmentalReverb::decayHfRatioPm: {
- int decayHfRatio = er.get<EnvironmentalReverb::decayHfRatioPm>();
- return isDecayHfRatioInRange(erCap, decayHfRatio);
- }
- case EnvironmentalReverb::levelMb: {
- int level = er.get<EnvironmentalReverb::levelMb>();
- return isLevelInRange(erCap, level);
- }
- case EnvironmentalReverb::delayMs: {
- int delay = er.get<EnvironmentalReverb::delayMs>();
- return isDelayInRange(erCap, delay);
- }
- case EnvironmentalReverb::diffusionPm: {
- int diffusion = er.get<EnvironmentalReverb::diffusionPm>();
- return isDiffusionInRange(erCap, diffusion);
- }
- case EnvironmentalReverb::densityPm: {
- int density = er.get<EnvironmentalReverb::densityPm>();
- return isDensityInRange(erCap, density);
- }
- case EnvironmentalReverb::bypass: {
- return true;
- }
- default:
- return false;
- }
- return false;
- }
-
- bool isRoomLevelInRange(const EnvironmentalReverb::Capability& cap, int roomLevel) const {
- return roomLevel >= cap.minRoomLevelMb && roomLevel <= cap.maxRoomLevelMb;
- }
-
- bool isRoomHfLevelInRange(const EnvironmentalReverb::Capability& cap, int roomHfLevel) const {
- return roomHfLevel >= cap.minRoomHfLevelMb && roomHfLevel <= cap.maxRoomHfLevelMb;
- }
-
- bool isDecayTimeInRange(const EnvironmentalReverb::Capability& cap, int decayTime) const {
- return decayTime >= 0 && decayTime <= cap.maxDecayTimeMs;
- }
-
- bool isDecayHfRatioInRange(const EnvironmentalReverb::Capability& cap, int decayHfRatio) const {
- return decayHfRatio >= cap.minDecayHfRatioPm && decayHfRatio <= cap.maxDecayHfRatioPm;
- }
-
- bool isLevelInRange(const EnvironmentalReverb::Capability& cap, int level) const {
- return level >= cap.minLevelMb && level <= cap.maxLevelMb;
- }
-
- bool isDelayInRange(const EnvironmentalReverb::Capability& cap, int delay) const {
- return delay >= 0 && delay <= cap.maxDelayMs;
- }
-
- bool isDiffusionInRange(const EnvironmentalReverb::Capability& cap, int diffusion) const {
- return diffusion >= 0 && diffusion <= cap.maxDiffusionPm;
- }
-
- bool isDensityInRange(const EnvironmentalReverb::Capability& cap, int density) const {
- return density >= 0 && density <= cap.maxDensityPm;
- }
-
- static std::unordered_set<int> getRoomLevelValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- int minRoomLevelMb = std::numeric_limits<int>::max();
- int maxRoomLevelMb = std::numeric_limits<int>::min();
- for (const auto& it : descList) {
- maxRoomLevelMb = std::max(
- it.second.capability.get<Capability::environmentalReverb>().maxRoomLevelMb,
- maxRoomLevelMb);
- minRoomLevelMb = std::min(
- it.second.capability.get<Capability::environmentalReverb>().minRoomLevelMb,
- minRoomLevelMb);
- }
- return {std::numeric_limits<int>::min(), minRoomLevelMb - 1, minRoomLevelMb,
- (minRoomLevelMb + maxRoomLevelMb) >> 1, maxRoomLevelMb, maxRoomLevelMb + 1,
- std::numeric_limits<int>::max()};
- }
-
- static std::unordered_set<int> getRoomHfLevelValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- int minRoomHfLevelMb = std::numeric_limits<int>::max();
- int maxRoomHfLevelMb = std::numeric_limits<int>::min();
- for (const auto& it : descList) {
- maxRoomHfLevelMb = std::max(
- it.second.capability.get<Capability::environmentalReverb>().maxRoomHfLevelMb,
- maxRoomHfLevelMb);
- minRoomHfLevelMb = std::min(
- it.second.capability.get<Capability::environmentalReverb>().minRoomHfLevelMb,
- minRoomHfLevelMb);
- }
- return {std::numeric_limits<int>::min(),
- minRoomHfLevelMb - 1,
- minRoomHfLevelMb,
- (minRoomHfLevelMb + maxRoomHfLevelMb) >> 1,
- maxRoomHfLevelMb,
- maxRoomHfLevelMb + 1,
- std::numeric_limits<int>::max()};
- }
-
- static std::unordered_set<int> getDecayTimeValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::environmentalReverb>()
- .maxDecayTimeMs <
- b.second.capability.get<Capability::environmentalReverb>()
- .maxDecayTimeMs;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxDecayTimeMs =
- max->second.capability.get<Capability::environmentalReverb>().maxDecayTimeMs;
- return {-1, 0, maxDecayTimeMs >> 1, maxDecayTimeMs - 1, maxDecayTimeMs, maxDecayTimeMs + 1};
- }
-
- static std::unordered_set<int> getDecayHfRatioValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- int minDecayHfRatioPm = std::numeric_limits<int>::max();
- int maxDecayHfRatioPm = std::numeric_limits<int>::min();
- for (const auto& it : descList) {
- maxDecayHfRatioPm = std::max(
- it.second.capability.get<Capability::environmentalReverb>().maxDecayHfRatioPm,
- maxDecayHfRatioPm);
- minDecayHfRatioPm = std::min(
- it.second.capability.get<Capability::environmentalReverb>().minDecayHfRatioPm,
- minDecayHfRatioPm);
- }
- return {std::numeric_limits<int>::min(),
- minDecayHfRatioPm - 1,
- minDecayHfRatioPm,
- (minDecayHfRatioPm + maxDecayHfRatioPm) >> 1,
- maxDecayHfRatioPm,
- maxDecayHfRatioPm + 1,
- std::numeric_limits<int>::max()};
- }
-
- static std::unordered_set<int> getLevelValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- int minLevelMb = std::numeric_limits<int>::max();
- int maxLevelMb = std::numeric_limits<int>::min();
- for (const auto& it : descList) {
- maxLevelMb =
- std::max(it.second.capability.get<Capability::environmentalReverb>().maxLevelMb,
- maxLevelMb);
- minLevelMb =
- std::min(it.second.capability.get<Capability::environmentalReverb>().minLevelMb,
- minLevelMb);
- }
- return {std::numeric_limits<int>::min(), minLevelMb - 1, minLevelMb,
- (minLevelMb + maxLevelMb) >> 1, maxLevelMb, maxLevelMb + 1,
- std::numeric_limits<int>::max()};
- }
-
- static std::unordered_set<int> getDelayValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::environmentalReverb>().maxDelayMs <
- b.second.capability.get<Capability::environmentalReverb>().maxDelayMs;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxDelayMs = max->second.capability.get<Capability::environmentalReverb>().maxDelayMs;
- return {-1, 0, maxDelayMs >> 1, maxDelayMs - 1, maxDelayMs, maxDelayMs + 1};
- }
-
- static std::unordered_set<int> getDiffusionValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::environmentalReverb>()
- .maxDiffusionPm <
- b.second.capability.get<Capability::environmentalReverb>()
- .maxDiffusionPm;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxDiffusionPm =
- max->second.capability.get<Capability::environmentalReverb>().maxDiffusionPm;
- return {-1, 0, maxDiffusionPm >> 1, maxDiffusionPm - 1, maxDiffusionPm, maxDiffusionPm + 1};
- }
-
- static std::unordered_set<int> getDensityValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kEnvReverbTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::environmentalReverb>().maxDensityPm <
- b.second.capability.get<Capability::environmentalReverb>().maxDensityPm;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxDensityPm =
- max->second.capability.get<Capability::environmentalReverb>().maxDensityPm;
- return {-1, 0, maxDensityPm >> 1, maxDensityPm - 1, maxDensityPm, maxDensityPm + 1};
- }
-
private:
std::vector<std::pair<EnvironmentalReverb::Tag, EnvironmentalReverb>> mTags;
void CleanUp() { mTags.clear(); }
@@ -428,11 +195,17 @@
SetAndGetReverbParameters();
}
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
+
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbRoomLevelTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getRoomLevelValues())),
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kEnvReverbTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
+ Range::environmentalReverb,
+ EnvironmentalReverb::roomLevelMb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbRoomLevelTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string roomLevel = std::to_string(std::get<1>(info.param));
@@ -467,9 +240,13 @@
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbRoomHfLevelTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getRoomHfLevelValues())),
+ ::testing::Combine(
+ testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
+ kEnvReverbTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
+ Range::environmentalReverb,
+ EnvironmentalReverb::roomHfLevelMb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbRoomHfLevelTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string roomHfLevel = std::to_string(std::get<1>(info.param));
@@ -504,9 +281,13 @@
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDecayTimeTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getDecayTimeValues())),
+ ::testing::Combine(
+ testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
+ kEnvReverbTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
+ Range::environmentalReverb,
+ EnvironmentalReverb::decayTimeMs>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDecayTimeTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string decayTime = std::to_string(std::get<1>(info.param));
@@ -543,7 +324,10 @@
EnvironmentalReverbTest, EnvironmentalReverbDecayHfRatioTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getDecayHfRatioValues())),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ EnvironmentalReverb, int, Range::environmentalReverb,
+ EnvironmentalReverb::decayHfRatioPm>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDecayHfRatioTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string decayHfRatio = std::to_string(std::get<1>(info.param));
@@ -579,9 +363,13 @@
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbLevelTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getLevelValues())),
+ ::testing::Combine(
+ testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
+ kEnvReverbTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
+ Range::environmentalReverb,
+ EnvironmentalReverb::levelMb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDecayHfRatioTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string level = std::to_string(std::get<1>(info.param));
@@ -616,9 +404,13 @@
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDelayTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getDelayValues())),
+ ::testing::Combine(
+ testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
+ kEnvReverbTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
+ Range::environmentalReverb,
+ EnvironmentalReverb::delayMs>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDelayTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string delay = std::to_string(std::get<1>(info.param));
@@ -653,9 +445,13 @@
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDiffusionTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getDiffusionValues())),
+ ::testing::Combine(
+ testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
+ kEnvReverbTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
+ Range::environmentalReverb,
+ EnvironmentalReverb::diffusionPm>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDiffusionTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string diffusion = std::to_string(std::get<1>(info.param));
@@ -690,9 +486,13 @@
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDensityTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEnvReverbTypeUUID)),
- testing::ValuesIn(EnvironmentalReverbHelper::getDensityValues())),
+ ::testing::Combine(
+ testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
+ kEnvReverbTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
+ Range::environmentalReverb,
+ EnvironmentalReverb::densityPm>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDensityTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string density = std::to_string(std::get<1>(info.param));
diff --git a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
index e11a936..54d00a7 100644
--- a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
@@ -18,6 +18,7 @@
#include <limits>
#include <map>
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -43,7 +44,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::Equalizer;
using aidl::android::hardware::audio::effect::IEffect;
@@ -56,8 +56,9 @@
* testing performed in VtsAudioEfectTargetTest.
*/
-enum ParamName { PARAM_INSTANCE_NAME, PARAM_BAND_LEVEL };
-using EqualizerParamTestParam = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>;
+enum ParamName { PARAM_INSTANCE_NAME, PARAM_PRESET, PARAM_BAND_LEVEL };
+using EqualizerParamTestParam = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int,
+ std::vector<Equalizer::BandLevel>>;
/*
Testing parameter range, assuming the parameter supported by effect is in this range.
@@ -69,7 +70,9 @@
class EqualizerTest : public ::testing::TestWithParam<EqualizerParamTestParam>,
public EffectHelper {
public:
- EqualizerTest() : mBandLevel(std::get<PARAM_BAND_LEVEL>(GetParam())) {
+ EqualizerTest()
+ : mPresetIndex(std::get<PARAM_PRESET>(GetParam())),
+ mBandLevel(std::get<PARAM_BAND_LEVEL>(GetParam())) {
std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
}
@@ -77,48 +80,24 @@
ASSERT_NE(nullptr, mFactory);
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
- Parameter::Specific specific = getDefaultParamSpecific();
Parameter::Common common = EffectHelper::createParamCommon(
0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
IEffect::OpenEffectReturn ret;
- ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
+ ASSERT_NO_FATAL_FAILURE(open(mEffect, common, std::nullopt, &ret, EX_NONE));
ASSERT_NE(nullptr, mEffect);
- ASSERT_NO_FATAL_FAILURE(setTagRange());
}
void TearDown() override {
ASSERT_NO_FATAL_FAILURE(close(mEffect));
ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
}
- std::pair<int, int> setPresetIndexRange(const Equalizer::Capability& cap) const {
- const auto [min, max] =
- std::minmax_element(cap.presets.begin(), cap.presets.end(),
- [](const auto& a, const auto& b) { return a.index < b.index; });
- return {min->index, max->index};
- }
- std::pair<int, int> setBandIndexRange(const Equalizer::Capability& cap) const {
- const auto [min, max] =
- std::minmax_element(cap.bandFrequencies.begin(), cap.bandFrequencies.end(),
- [](const auto& a, const auto& b) { return a.index < b.index; });
- return {min->index, max->index};
- }
- void setTagRange() {
- Descriptor desc;
- ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- Equalizer::Capability& eqCap = desc.capability.get<Capability::equalizer>();
- mPresetIndex = setPresetIndexRange(eqCap);
- mBandIndex = setBandIndexRange(eqCap);
- }
-
static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
std::shared_ptr<IFactory> mFactory;
std::shared_ptr<IEffect> mEffect;
Descriptor mDescriptor;
- std::pair<int, int> mPresetIndex;
- std::pair<int, int> mBandIndex;
- const int mBandLevel;
- Descriptor mDesc;
+ int mPresetIndex;
+ std::vector<Equalizer::BandLevel> mBandLevel;
void SetAndGetEqualizerParameters() {
ASSERT_NE(nullptr, mEffect);
@@ -127,25 +106,22 @@
auto& eq = it.second;
// validate parameter
- const bool valid = isTagInRange(it.first, it.second);
+ const bool valid = isParameterValid<Equalizer, Range::equalizer>(eq, mDescriptor);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set
- Parameter expectParam;
- Parameter::Specific specific;
- specific.set<Parameter::Specific::equalizer>(eq);
- expectParam.set<Parameter::specific>(specific);
+ Parameter::Specific specific =
+ Parameter::Specific::make<Parameter::Specific::equalizer>(eq);
+ Parameter expectParam = Parameter::make<Parameter::specific>(specific);
EXPECT_STATUS(expected, mEffect->setParameter(expectParam))
<< expectParam.toString() << "\n"
- << mDesc.toString();
+ << mDescriptor.toString();
// only get if parameter in range and set success
if (expected == EX_NONE) {
Parameter getParam;
- Parameter::Id id;
- Equalizer::Id eqId;
- eqId.set<Equalizer::Id::commonTag>(tag);
- id.set<Parameter::Id::equalizerTag>(eqId);
+ Equalizer::Id eqId = Equalizer::Id::make<Equalizer::Id::commonTag>(tag);
+ Parameter::Id id = Parameter::Id::make<Parameter::Id::equalizerTag>(eqId);
// if set success, then get should match
EXPECT_STATUS(expected, mEffect->getParameter(id, &getParam));
EXPECT_TRUE(isEqParameterExpected(expectParam, getParam))
@@ -197,140 +173,51 @@
}
void addPresetParam(int preset) {
- Equalizer eq;
- eq.set<Equalizer::preset>(preset);
- mTags.push_back({Equalizer::preset, eq});
+ mTags.push_back({Equalizer::preset, Equalizer::make<Equalizer::preset>(preset)});
}
void addBandLevelsParam(std::vector<Equalizer::BandLevel>& bandLevels) {
- Equalizer eq;
- eq.set<Equalizer::bandLevels>(bandLevels);
- mTags.push_back({Equalizer::bandLevels, eq});
- }
-
- bool isTagInRange(const Equalizer::Tag& tag, const Equalizer& eq) const {
- switch (tag) {
- case Equalizer::preset: {
- int index = eq.get<Equalizer::preset>();
- return index >= mPresetIndex.first && index <= mPresetIndex.second;
- }
- case Equalizer::bandLevels: {
- auto& bandLevel = eq.get<Equalizer::bandLevels>();
- return isBandInRange(bandLevel);
- }
- default:
- return false;
- }
- return false;
- }
-
- bool isBandInRange(const std::vector<Equalizer::BandLevel>& bandLevel) const {
- for (auto& it : bandLevel) {
- if (it.index < mBandIndex.first || it.index > mBandIndex.second) return false;
- }
- return true;
- }
-
- Parameter::Specific getDefaultParamSpecific() {
- Equalizer eq = Equalizer::make<Equalizer::preset>(0);
- Parameter::Specific specific =
- Parameter::Specific::make<Parameter::Specific::equalizer>(eq);
- return specific;
+ mTags.push_back(
+ {Equalizer::bandLevels, Equalizer::make<Equalizer::bandLevels>(bandLevels)});
}
private:
std::vector<std::pair<Equalizer::Tag, Equalizer>> mTags;
- bool validCapabilityTag(Capability& cap) { return cap.getTag() == Capability::equalizer; }
-
void CleanUp() { mTags.clear(); }
};
-TEST_P(EqualizerTest, SetAndGetPresetOutOfLowerBound) {
- addPresetParam(mPresetIndex.second - 1);
- ASSERT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetPresetOutOfUpperBound) {
- addPresetParam(mPresetIndex.second + 1);
+TEST_P(EqualizerTest, SetAndGetParams) {
+ addBandLevelsParam(mBandLevel);
+ addPresetParam(mPresetIndex);
EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
}
-TEST_P(EqualizerTest, SetAndGetPresetAtLowerBound) {
- addPresetParam(mPresetIndex.first);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetPresetAtHigherBound) {
- addPresetParam(mPresetIndex.second);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetPresetInBound) {
- addPresetParam((mPresetIndex.first + mPresetIndex.second) >> 1);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetBandOutOfLowerBound) {
- std::vector<Equalizer::BandLevel> bandLevels{{mBandIndex.first - 1, mBandLevel}};
- addBandLevelsParam(bandLevels);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetBandOutOfUpperBound) {
- std::vector<Equalizer::BandLevel> bandLevels{{mBandIndex.second + 1, mBandLevel}};
- addBandLevelsParam(bandLevels);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetBandAtLowerBound) {
- std::vector<Equalizer::BandLevel> bandLevels{{mBandIndex.first, mBandLevel}};
- addBandLevelsParam(bandLevels);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetBandAtHigherBound) {
- std::vector<Equalizer::BandLevel> bandLevels{{mBandIndex.second, mBandLevel}};
- addBandLevelsParam(bandLevels);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetBandInBound) {
- std::vector<Equalizer::BandLevel> bandLevels{
- {(mBandIndex.first + mBandIndex.second) >> 1, mBandLevel}};
- addBandLevelsParam(bandLevels);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetMultiBands) {
- addPresetParam(mPresetIndex.first);
- std::vector<Equalizer::BandLevel> bandLevels{
- {mBandIndex.first, mBandLevel},
- {mBandIndex.second, mBandLevel},
- {(mBandIndex.first + mBandIndex.second) >> 1, mBandLevel}};
- addBandLevelsParam(bandLevels);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
-TEST_P(EqualizerTest, SetAndGetMultipleParams) {
- std::vector<Equalizer::BandLevel> bandLevels{
- {(mBandIndex.first + mBandIndex.second) >> 1, mBandLevel}};
- addBandLevelsParam(bandLevels);
- addPresetParam((mPresetIndex.first + mPresetIndex.second) >> 1);
- EXPECT_NO_FATAL_FAILURE(SetAndGetEqualizerParameters());
-}
-
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
INSTANTIATE_TEST_SUITE_P(
EqualizerTest, EqualizerTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kEqualizerTypeUUID)),
- testing::ValuesIn(kBandLevels)),
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kEqualizerTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<Equalizer, int, Range::equalizer,
+ Equalizer::preset>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(
+ EffectHelper::getTestValueSet<Equalizer, std::vector<Equalizer::BandLevel>,
+ Range::equalizer, Equalizer::bandLevels>(
+ kDescPair,
+ [](std::set<std::vector<Equalizer::BandLevel>>& bandLevels) {
+ return bandLevels;
+ }))),
[](const testing::TestParamInfo<EqualizerTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
- std::string bandLevel = std::to_string(std::get<PARAM_BAND_LEVEL>(info.param));
+ std::string bandLevel =
+ ::android::internal::ToString(std::get<PARAM_BAND_LEVEL>(info.param));
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
descriptor.common.name + "_UUID_" +
- descriptor.common.id.uuid.toString() + "_bandLevel_" + bandLevel;
+ descriptor.common.id.uuid.toString() + "_preset_" +
+ std::to_string(std::get<PARAM_PRESET>(info.param)) + "_bandLevel_" +
+ bandLevel;
std::replace_if(
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
return name;
diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
index b8ea9c1..6c3016e 100644
--- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
@@ -27,7 +27,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::HapticGenerator;
using aidl::android::hardware::audio::effect::IEffect;
diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
index 305c243..75941ff 100644
--- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
@@ -24,7 +24,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
diff --git a/audio/aidl/vts/VtsHalNSTargetTest.cpp b/audio/aidl/vts/VtsHalNSTargetTest.cpp
index 0b92290..16c79e3 100644
--- a/audio/aidl/vts/VtsHalNSTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalNSTargetTest.cpp
@@ -26,7 +26,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
diff --git a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
index 19d5747..c9c2a31 100644
--- a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
@@ -23,7 +23,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
@@ -84,7 +83,7 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(it.first, it.second, desc);
+ const bool valid = isParameterValid<PresetReverb, Range::presetReverb>(it.second, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -113,27 +112,6 @@
mTags.push_back({PresetReverb::preset, pr});
}
- bool isTagInRange(const PresetReverb::Tag& tag, const PresetReverb& pr,
- const Descriptor& desc) const {
- const PresetReverb::Capability& prCap = desc.capability.get<Capability::presetReverb>();
- switch (tag) {
- case PresetReverb::preset: {
- PresetReverb::Presets preset = pr.get<PresetReverb::preset>();
- return isPresetInRange(prCap, preset);
- }
- default:
- return false;
- }
- return false;
- }
-
- bool isPresetInRange(const PresetReverb::Capability& cap, PresetReverb::Presets preset) const {
- for (auto i : cap.supportedPresets) {
- if (preset == i) return true;
- }
- return false;
- }
-
Parameter::Specific getDefaultParamSpecific() {
PresetReverb pr = PresetReverb::make<PresetReverb::preset>(PresetReverb::Presets::NONE);
Parameter::Specific specific =
diff --git a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
index 090de17..8b0210c 100644
--- a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
@@ -22,7 +22,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
@@ -90,7 +89,7 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(it.first, it.second, desc);
+ const bool valid = isParameterValid<Virtualizer, Range::virtualizer>(it.second, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -120,46 +119,6 @@
mTags.push_back({Virtualizer::strengthPm, vr});
}
- bool isTagInRange(const Virtualizer::Tag& tag, const Virtualizer& vr,
- const Descriptor& desc) const {
- const Virtualizer::Capability& vrCap = desc.capability.get<Capability::virtualizer>();
- switch (tag) {
- case Virtualizer::strengthPm: {
- int strength = vr.get<Virtualizer::strengthPm>();
- return isStrengthInRange(vrCap, strength);
- }
- default:
- return false;
- }
- return false;
- }
-
- bool isStrengthInRange(const Virtualizer::Capability& cap, int strength) const {
- return cap.strengthSupported && strength >= 0 && strength <= cap.maxStrengthPm;
- }
-
- static std::vector<int> getStrengthTestValues(
- std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kFactoryDescList) {
- const auto max = std::max_element(
- kFactoryDescList.begin(), kFactoryDescList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::virtualizer>().maxStrengthPm <
- b.second.capability.get<Capability::virtualizer>().maxStrengthPm;
- });
- if (max == kFactoryDescList.end()) {
- return {0};
- }
- int maxStrength = max->second.capability.get<Capability::virtualizer>().maxStrengthPm;
- return {std::numeric_limits<int>::min(),
- -1,
- 0,
- maxStrength >> 1,
- maxStrength,
- maxStrength + 1,
- std::numeric_limits<int>::max()};
- }
-
private:
std::vector<std::pair<Virtualizer::Tag, Virtualizer>> mTags;
void CleanUp() { mTags.clear(); }
@@ -170,13 +129,15 @@
SetAndGetVirtualizerParameters();
}
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
INSTANTIATE_TEST_SUITE_P(
VirtualizerTest, VirtualizerParamTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kVirtualizerTypeUUID)),
- testing::ValuesIn(VirtualizerParamTest::getStrengthTestValues(
- EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kVirtualizerTypeUUID)))),
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kVirtualizerTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ Virtualizer, int, Range::virtualizer, Virtualizer::strengthPm>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<VirtualizerParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
std::string strength = std::to_string(std::get<PARAM_STRENGTH>(info.param));
diff --git a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
index 242be3f..e2625cb 100644
--- a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
@@ -26,7 +26,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
@@ -64,12 +63,11 @@
ASSERT_NE(nullptr, mFactory);
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
- Parameter::Specific specific = getDefaultParamSpecific();
Parameter::Common common = EffectHelper::createParamCommon(
0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
IEffect::OpenEffectReturn ret;
- ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
+ ASSERT_NO_FATAL_FAILURE(open(mEffect, common, std::nullopt, &ret, EX_NONE));
ASSERT_NE(nullptr, mEffect);
}
@@ -77,13 +75,6 @@
ASSERT_NO_FATAL_FAILURE(close(mEffect));
ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
}
- Parameter::Specific getDefaultParamSpecific() {
- Visualizer vs = Visualizer::make<Visualizer::captureSamples>(
- mDescriptor.capability.get<Capability::visualizer>().captureSampleRange.max);
- Parameter::Specific specific =
- Parameter::Specific::make<Parameter::Specific::visualizer>(vs);
- return specific;
- }
static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
std::shared_ptr<IFactory> mFactory;
@@ -94,7 +85,7 @@
Visualizer::MeasurementMode mMeasurementMode = Visualizer::MeasurementMode::NONE;
int mLatency = 0;
- void SetAndGetCommonParameters() {
+ void SetAndGetParameters() {
for (auto& it : mCommonTags) {
auto& tag = it.first;
auto& vs = it.second;
@@ -102,7 +93,7 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(tag, vs, desc);
+ const bool valid = isParameterValid<Visualizer, Range::visualizer>(vs, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -119,170 +110,39 @@
Visualizer::Id vsId;
vsId.set<Visualizer::Id::commonTag>(tag);
id.set<Parameter::Id::visualizerTag>(vsId);
- EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
-
+ EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam))
+ << " with: " << id.toString();
EXPECT_EQ(expectParam, getParam) << "\nexpect:" << expectParam.toString()
<< "\ngetParam:" << getParam.toString();
}
}
}
- void SetAndGetSetOnlyParameters() {
- for (auto& it : mSetOnlyParamTags) {
- auto& tag = it.first;
- auto& vs = it.second;
-
- // validate parameter
- Descriptor desc;
- ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isSetOnlyParamTagInRange(vs, desc);
- const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
-
- // set parameter
- Parameter expectParam;
- Parameter::Specific specific;
- specific.set<Parameter::Specific::visualizer>(vs);
- expectParam.set<Parameter::specific>(specific);
- ASSERT_STATUS(expected, mEffect->setParameter(expectParam));
-
- // parameter defined in this setOnlyParameter union must be settable via
- // setParameter(), but must not be gettable
- Parameter getParam;
- Parameter::Id id;
- Visualizer::Id vsId;
- vsId.set<Visualizer::Id::setOnlyParamTag>(tag);
- id.set<Parameter::Id::visualizerTag>(vsId);
- EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, mEffect->getParameter(id, &getParam));
- }
- }
-
- void GetandSetGetOnlyParameters() {
- for (auto& tag : mGetOnlyParamTags) {
- // get parameter
- Parameter getParam;
- Parameter::Id id;
- Visualizer::Id vsId;
- vsId.set<Visualizer::Id::getOnlyParamTag>(tag);
- id.set<Parameter::Id::visualizerTag>(vsId);
- ASSERT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
-
- // parameter defined in this getOnlyParameter union must be gettable via
- // getParameter(), but must not be settable
- // set parameter
- ASSERT_STATUS(EX_ILLEGAL_ARGUMENT, mEffect->setParameter(getParam));
- }
- }
-
void addCaptureSizeParam(int captureSize) {
- Visualizer vs;
- vs.set<Visualizer::captureSamples>(captureSize);
- mCommonTags.push_back({Visualizer::captureSamples, vs});
+ mCommonTags.push_back({Visualizer::captureSamples,
+ Visualizer::make<Visualizer::captureSamples>(captureSize)});
}
void addScalingModeParam(Visualizer::ScalingMode scalingMode) {
- Visualizer vs;
- vs.set<Visualizer::scalingMode>(scalingMode);
- mCommonTags.push_back({Visualizer::scalingMode, vs});
+ mCommonTags.push_back(
+ {Visualizer::scalingMode, Visualizer::make<Visualizer::scalingMode>(scalingMode)});
}
void addMeasurementModeParam(Visualizer::MeasurementMode measurementMode) {
- Visualizer vs;
- vs.set<Visualizer::measurementMode>(measurementMode);
- mCommonTags.push_back({Visualizer::measurementMode, vs});
+ mCommonTags.push_back({Visualizer::measurementMode,
+ Visualizer::make<Visualizer::measurementMode>(measurementMode)});
}
void addLatencyParam(int latency) {
- Visualizer vs;
- Visualizer::SetOnlyParameters setOnlyParam;
- setOnlyParam.set<Visualizer::SetOnlyParameters::latencyMs>(latency);
- vs.set<Visualizer::setOnlyParameters>(setOnlyParam);
- mSetOnlyParamTags.push_back({Visualizer::SetOnlyParameters::latencyMs, vs});
+ mCommonTags.push_back(
+ {Visualizer::latencyMs, Visualizer::make<Visualizer::latencyMs>(latency)});
}
- void addMeasurementTag() {
- mGetOnlyParamTags.push_back(Visualizer::GetOnlyParameters::measurement);
- }
-
- void addCaptureBytesTag() {
- mGetOnlyParamTags.push_back(Visualizer::GetOnlyParameters::captureSampleBuffer);
- }
-
- bool isTagInRange(const Visualizer::Tag& tag, const Visualizer& vs,
- const Descriptor& desc) const {
- const Visualizer::Capability& vsCap = desc.capability.get<Capability::visualizer>();
- switch (tag) {
- case Visualizer::captureSamples: {
- int captureSize = vs.get<Visualizer::captureSamples>();
- return captureSize >= vsCap.captureSampleRange.min &&
- captureSize <= vsCap.captureSampleRange.max;
- }
- case Visualizer::scalingMode:
- case Visualizer::measurementMode:
- return true;
- case Visualizer::setOnlyParameters: {
- auto setOnly = vs.get<Visualizer::setOnlyParameters>();
- if (setOnly.getTag() != Visualizer::SetOnlyParameters::latencyMs) {
- return false;
- }
- auto latencyMs = setOnly.get<Visualizer::SetOnlyParameters::latencyMs>();
- return latencyMs >= 0 && latencyMs <= vsCap.maxLatencyMs;
- }
- default:
- return false;
- }
- }
-
- bool isSetOnlyParamTagInRange(const Visualizer& vs, const Descriptor& desc) const {
- const Visualizer::Capability& vsCap = desc.capability.get<Capability::visualizer>();
- if (vs.getTag() != Visualizer::setOnlyParameters) return false;
- Visualizer::SetOnlyParameters setOnlyParam = vs.get<Visualizer::setOnlyParameters>();
- if (setOnlyParam.getTag() != Visualizer::SetOnlyParameters::latencyMs) return false;
- int latency = setOnlyParam.get<Visualizer::SetOnlyParameters::latencyMs>();
- return isLatencyInRange(vsCap, latency);
- }
-
- bool isLatencyInRange(const Visualizer::Capability& cap, int latency) const {
- return (latency >= 0 && latency <= cap.maxLatencyMs);
- }
-
- static std::unordered_set<int> getCaptureSizeValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kVisualizerTypeUUID);
- int minCaptureSize = std::numeric_limits<int>::max();
- int maxCaptureSize = std::numeric_limits<int>::min();
- for (const auto& it : descList) {
- maxCaptureSize = std::max(
- it.second.capability.get<Capability::visualizer>().captureSampleRange.max,
- maxCaptureSize);
- minCaptureSize = std::min(
- it.second.capability.get<Capability ::visualizer>().captureSampleRange.min,
- minCaptureSize);
- }
- return {std::numeric_limits<int>::min(), minCaptureSize - 1, minCaptureSize,
- (minCaptureSize + maxCaptureSize) >> 1, maxCaptureSize, maxCaptureSize + 1,
- std::numeric_limits<int>::max()};
- }
-
- static std::unordered_set<int> getLatencyValues() {
- auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kVisualizerTypeUUID);
- const auto max = std::max_element(
- descList.begin(), descList.end(),
- [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a,
- const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) {
- return a.second.capability.get<Capability::visualizer>().maxLatencyMs <
- b.second.capability.get<Capability::visualizer>().maxLatencyMs;
- });
- if (max == descList.end()) {
- return {0};
- }
- int maxDelay = max->second.capability.get<Capability::visualizer>().maxLatencyMs;
- return {-1, 0, maxDelay >> 1, maxDelay - 1, maxDelay, maxDelay + 1};
- }
static std::unordered_set<Visualizer::MeasurementMode> getMeasurementModeValues() {
return {ndk::enum_range<Visualizer::MeasurementMode>().begin(),
ndk::enum_range<Visualizer::MeasurementMode>().end()};
}
+
static std::unordered_set<Visualizer::ScalingMode> getScalingModeValues() {
return {ndk::enum_range<Visualizer::ScalingMode>().begin(),
ndk::enum_range<Visualizer::ScalingMode>().end()};
@@ -290,53 +150,43 @@
private:
std::vector<std::pair<Visualizer::Tag, Visualizer>> mCommonTags;
- std::vector<std::pair<Visualizer::SetOnlyParameters::Tag, Visualizer>> mSetOnlyParamTags;
- std::vector<Visualizer::GetOnlyParameters::Tag> mGetOnlyParamTags;
- void CleanUp() {
- mCommonTags.clear();
- mSetOnlyParamTags.clear();
- mGetOnlyParamTags.clear();
- }
+ void CleanUp() { mCommonTags.clear(); }
};
TEST_P(VisualizerParamTest, SetAndGetCaptureSize) {
EXPECT_NO_FATAL_FAILURE(addCaptureSizeParam(mCaptureSize));
- SetAndGetCommonParameters();
+ SetAndGetParameters();
}
TEST_P(VisualizerParamTest, SetAndGetScalingMode) {
EXPECT_NO_FATAL_FAILURE(addScalingModeParam(mScalingMode));
- SetAndGetCommonParameters();
+ SetAndGetParameters();
}
TEST_P(VisualizerParamTest, SetAndGetMeasurementMode) {
EXPECT_NO_FATAL_FAILURE(addMeasurementModeParam(mMeasurementMode));
- SetAndGetCommonParameters();
+ SetAndGetParameters();
}
TEST_P(VisualizerParamTest, SetAndGetLatency) {
EXPECT_NO_FATAL_FAILURE(addLatencyParam(mLatency));
- SetAndGetSetOnlyParameters();
+ SetAndGetParameters();
}
-TEST_P(VisualizerParamTest, GetAndSetMeasurement) {
- EXPECT_NO_FATAL_FAILURE(addMeasurementTag());
- GetandSetGetOnlyParameters();
-}
-
-TEST_P(VisualizerParamTest, GetAndSetCaptureBytes) {
- EXPECT_NO_FATAL_FAILURE(addCaptureBytesTag());
- GetandSetGetOnlyParameters();
-}
-
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
INSTANTIATE_TEST_SUITE_P(
VisualizerParamTest, VisualizerParamTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kVisualizerTypeUUID)),
- testing::ValuesIn(VisualizerParamTest::getCaptureSizeValues()),
- testing::ValuesIn(VisualizerParamTest::getScalingModeValues()),
- testing::ValuesIn(VisualizerParamTest::getMeasurementModeValues()),
- testing::ValuesIn(VisualizerParamTest::getLatencyValues())),
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kVisualizerTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<Visualizer, int, Range::visualizer,
+ Visualizer::captureSamples>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(VisualizerParamTest::getScalingModeValues()),
+ testing::ValuesIn(VisualizerParamTest::getMeasurementModeValues()),
+ testing::ValuesIn(EffectHelper::getTestValueSet<Visualizer, int, Range::visualizer,
+ Visualizer::latencyMs>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<VisualizerParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
std::string captureSize = std::to_string(std::get<PARAM_CAPTURE_SIZE>(info.param));
diff --git a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
index 34625e7..44ce146 100644
--- a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
@@ -22,7 +22,6 @@
using namespace android;
-using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
@@ -84,9 +83,7 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- // only set and get parameter if capability is valid
- ASSERT_TRUE(isCapabilityValid(desc));
- const bool valid = isTagInRange(it.first, it.second, desc);
+ const bool valid = isParameterValid<Volume, Range::volume>(it.second, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -123,42 +120,6 @@
mTags.push_back({Volume::mute, vol});
}
- bool isCapabilityValid(const Descriptor& desc) {
- const Volume::Capability& volCap = desc.capability.get<Capability::volume>();
- return (volCap.minLevelDb <= volCap.maxLevelDb);
- }
-
- bool isTagInRange(const Volume::Tag& tag, const Volume& vol, const Descriptor& desc) const {
- const Volume::Capability& volCap = desc.capability.get<Capability::volume>();
- switch (tag) {
- case Volume::levelDb: {
- int level = vol.get<Volume::levelDb>();
- return isLevelInRange(volCap, level);
- }
- case Volume::mute:
- return true;
- default:
- return false;
- }
- }
-
- static std::vector<int> getLevelTestValues(
- std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kFactoryDescList) {
- int minLevelDb = std::numeric_limits<int>::max();
- int maxLevelDb = std::numeric_limits<int>::min();
- for (const auto& it : kFactoryDescList) {
- maxLevelDb =
- std::max(it.second.capability.get<Capability::volume>().maxLevelDb, maxLevelDb);
- minLevelDb = std::min(it.second.capability.get<Capability ::volume>().minLevelDb,
- minLevelDb);
- }
- return {minLevelDb - 1, minLevelDb, -100, maxLevelDb, maxLevelDb + 1};
- }
-
- bool isLevelInRange(const Volume::Capability& volCap, int level) const {
- return level >= volCap.minLevelDb && level <= volCap.maxLevelDb;
- }
-
private:
std::vector<std::pair<Volume::Tag, Volume>> mTags;
void CleanUp() { mTags.clear(); }
@@ -174,14 +135,15 @@
SetAndGetParameters();
}
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
INSTANTIATE_TEST_SUITE_P(
VolumeTest, VolumeParamTest,
::testing::Combine(
- testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kVolumeTypeUUID)),
- testing::ValuesIn(VolumeParamTest::getLevelTestValues(
- EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
- kVolumeTypeUUID))),
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kVolumeTypeUUID)),
+ testing::ValuesIn(
+ EffectHelper::getTestValueSet<Volume, int, Range::volume, Volume::levelDb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
testing::Bool() /* mute */),
[](const testing::TestParamInfo<VolumeParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp
index e79ad75..7b5a932 100644
--- a/audio/common/all-versions/default/service/service.cpp
+++ b/audio/common/all-versions/default/service/service.cpp
@@ -81,9 +81,10 @@
int main(int /* argc */, char* /* argv */ []) {
signal(SIGPIPE, SIG_IGN);
- ::android::ProcessState::initWithDriver("/dev/vndbinder");
- // start a threadpool for vndbinder interactions
- ::android::ProcessState::self()->startThreadPool();
+ if (::android::ProcessState::isVndservicemanagerEnabled()) {
+ ::android::ProcessState::initWithDriver("/dev/vndbinder");
+ ::android::ProcessState::self()->startThreadPool();
+ }
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
index 5583679..1140f9e 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LatencyMode.aidl
@@ -34,7 +34,9 @@
package android.hardware.bluetooth.audio;
@Backing(type="int") @VintfStability
enum LatencyMode {
- UNKNOWN = 0,
- LOW_LATENCY = 1,
- FREE = 2,
+ UNKNOWN,
+ LOW_LATENCY,
+ FREE,
+ DYNAMIC_SPATIAL_AUDIO_SOFTWARE,
+ DYNAMIC_SPATIAL_AUDIO_HARDWARE,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
index 7d53b0c..2945710 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
@@ -41,5 +41,6 @@
char streamHandle;
int audioChannelAllocation;
android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig;
+ char pcmStreamId;
}
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index edb6795..679655c 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -42,5 +42,6 @@
parcelable StreamMap {
char streamHandle;
int audioChannelAllocation;
+ boolean isStreamActive;
}
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
index 0c354f7..ec181c1 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LatencyMode.aidl
@@ -22,4 +22,6 @@
UNKNOWN,
LOW_LATENCY,
FREE,
+ DYNAMIC_SPATIAL_AUDIO_SOFTWARE,
+ DYNAMIC_SPATIAL_AUDIO_HARDWARE
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
index e9a1a0c..16503fb 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl
@@ -35,6 +35,10 @@
*/
int audioChannelAllocation;
LeAudioCodecConfiguration leAudioCodecConfig;
+ /*
+ * Pcm stream id to identify the source for given streamHandle.
+ */
+ char pcmStreamId;
}
CodecType codecType;
BroadcastStreamMap[] streamMap;
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index 0d1e3de..f22f309 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -35,6 +35,10 @@
* Audio Location assigned number.
*/
int audioChannelAllocation;
+ /*
+ * The stream handle status
+ */
+ boolean isStreamActive;
}
CodecType codecType;
StreamMap[] streamMap;
diff --git a/bluetooth/audio/aidl/default/Android.bp b/bluetooth/audio/aidl/default/Android.bp
index cbf23dc..e4c2844 100644
--- a/bluetooth/audio/aidl/default/Android.bp
+++ b/bluetooth/audio/aidl/default/Android.bp
@@ -29,7 +29,7 @@
"libcutils",
"libfmq",
"liblog",
- "android.hardware.bluetooth.audio-V2-ndk",
+ "android.hardware.bluetooth.audio-V3-ndk",
"libbluetooth_audio_session_aidl",
],
}
diff --git a/bluetooth/audio/aidl/default/bluetooth_audio.xml b/bluetooth/audio/aidl/default/bluetooth_audio.xml
index c4b1872..c0bc55e 100644
--- a/bluetooth/audio/aidl/default/bluetooth_audio.xml
+++ b/bluetooth/audio/aidl/default/bluetooth_audio.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.bluetooth.audio</name>
- <version>2</version>
+ <version>3</version>
<fqname>IBluetoothAudioProviderFactory/default</fqname>
</hal>
</manifest>
diff --git a/bluetooth/audio/aidl/vts/Android.bp b/bluetooth/audio/aidl/vts/Android.bp
index 3aed1b3..e03fb58 100644
--- a/bluetooth/audio/aidl/vts/Android.bp
+++ b/bluetooth/audio/aidl/vts/Android.bp
@@ -17,7 +17,7 @@
srcs: ["VtsHalBluetoothAudioTargetTest.cpp"],
shared_libs: [
"android.hardware.audio.common-V1-ndk",
- "android.hardware.bluetooth.audio-V2-ndk",
+ "android.hardware.bluetooth.audio-V3-ndk",
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
"libbase",
diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
index 128ef61..6a913f7 100644
--- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
+++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
@@ -1570,6 +1570,10 @@
le_audio_broadcast_config.streamMap[0]
.leAudioCodecConfig.set<LeAudioCodecConfiguration::lc3Config>(
lc3_config);
+ le_audio_broadcast_config.streamMap[0].streamHandle = 0x0;
+ le_audio_broadcast_config.streamMap[0].pcmStreamId = 0x0;
+ le_audio_broadcast_config.streamMap[0].audioChannelAllocation = 0x1 << 0;
+
DataMQDesc mq_desc;
auto aidl_retval = audio_provider_->startSession(
audio_port_, AudioConfiguration(le_audio_broadcast_config),
diff --git a/bluetooth/audio/utils/Android.bp b/bluetooth/audio/utils/Android.bp
index 70797a7..914d2b2 100644
--- a/bluetooth/audio/utils/Android.bp
+++ b/bluetooth/audio/utils/Android.bp
@@ -55,7 +55,7 @@
"libbinder_ndk",
"libfmq",
"liblog",
- "android.hardware.bluetooth.audio-V2-ndk",
+ "android.hardware.bluetooth.audio-V3-ndk",
"libhidlbase",
"libxml2",
],
@@ -75,7 +75,7 @@
shared_libs: [
"libbase",
"libbinder_ndk",
- "android.hardware.bluetooth.audio-V2-ndk",
+ "android.hardware.bluetooth.audio-V3-ndk",
"libxml2",
],
test_suites: [
diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml
index 8ef0b3a..c898aab 100644
--- a/compatibility_matrices/compatibility_matrix.4.xml
+++ b/compatibility_matrices/compatibility_matrix.4.xml
@@ -171,7 +171,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml
index 12b85c7..c5a1dc2 100644
--- a/compatibility_matrices/compatibility_matrix.5.xml
+++ b/compatibility_matrices/compatibility_matrix.5.xml
@@ -192,7 +192,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.6.xml b/compatibility_matrices/compatibility_matrix.6.xml
index e19d2dd..1c76ee6 100644
--- a/compatibility_matrices/compatibility_matrix.6.xml
+++ b/compatibility_matrices/compatibility_matrix.6.xml
@@ -215,7 +215,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml
index eb649bf..c7b05e8 100644
--- a/compatibility_matrices/compatibility_matrix.8.xml
+++ b/compatibility_matrices/compatibility_matrix.8.xml
@@ -167,7 +167,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.bluetooth.audio</name>
- <version>2</version>
+ <version>3</version>
<interface>
<name>IBluetoothAudioProviderFactory</name>
<instance>default</instance>
diff --git a/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp b/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
index 37ff1b2..2e96f7d 100644
--- a/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
+++ b/secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp
@@ -106,6 +106,15 @@
EXPECT_OK(secure_element_->init(secure_element_callback_));
secure_element_callback_->expectCallbackHistory({true});
+
+ // Check if the basic channel is supported by the bound SE.
+ std::vector<uint8_t> basic_channel_response;
+ auto status =
+ secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response);
+ if (status.isOk()) {
+ basic_channel_supported_ = true;
+ secure_element_->closeChannel(0);
+ }
}
void TearDown() override {
@@ -143,6 +152,7 @@
std::shared_ptr<ISecureElement> secure_element_;
std::shared_ptr<MySecureElementCallback> secure_element_callback_;
+ bool basic_channel_supported_{false};
};
TEST_P(SecureElementAidl, init) {
@@ -159,14 +169,18 @@
LogicalChannelResponse logical_channel_response;
// reset called after init shall succeed.
- EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
+ if (basic_channel_supported_) {
+ EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
+ }
EXPECT_OK(secure_element_->openLogicalChannel(kSelectableAid, 0x00, &logical_channel_response));
EXPECT_OK(secure_element_->reset());
secure_element_callback_->expectCallbackHistory({true, false, true});
// All opened channels must be closed.
- EXPECT_NE(transmit(0), 0x9000);
+ if (basic_channel_supported_) {
+ EXPECT_NE(transmit(0), 0x9000);
+ }
EXPECT_NE(transmit(logical_channel_response.channelNumber), 0x9000);
}
@@ -190,6 +204,10 @@
TEST_P(SecureElementAidl, openBasicChannel) {
std::vector<uint8_t> response;
+ if (!basic_channel_supported_) {
+ return;
+ }
+
// openBasicChannel called with an invalid AID shall fail.
EXPECT_ERR(secure_element_->openBasicChannel(kNonSelectableAid, 0x00, &response));
@@ -199,7 +217,7 @@
EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &response));
EXPECT_GE(response.size(), 2u);
- // tramsmit called on the basic channel should succeed.
+ // transmit called on the basic channel should succeed.
EXPECT_EQ(transmit(0), 0x9000);
// openBasicChannel called a second time shall fail.
@@ -225,7 +243,7 @@
EXPECT_GE(response.channelNumber, 1u);
EXPECT_LE(response.channelNumber, 19u);
- // tramsmit called on the logical channel should succeed.
+ // transmit called on the logical channel should succeed.
EXPECT_EQ(transmit(response.channelNumber), 0x9000);
}
@@ -239,17 +257,19 @@
EXPECT_ERR(secure_element_->closeChannel(1));
// closeChannel called on basic channel closes the basic channel.
- EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
- EXPECT_OK(secure_element_->closeChannel(0));
+ if (basic_channel_supported_) {
+ EXPECT_OK(secure_element_->openBasicChannel(kSelectableAid, 0x00, &basic_channel_response));
+ EXPECT_OK(secure_element_->closeChannel(0));
- // tramsmit called on the basic channel should fail.
- EXPECT_NE(transmit(0), 0x9000);
+ // transmit called on the basic channel should fail.
+ EXPECT_NE(transmit(0), 0x9000);
+ }
// closeChannel called on logical channel closes the logical channel.
EXPECT_OK(secure_element_->openLogicalChannel(kSelectableAid, 0x00, &logical_channel_response));
EXPECT_OK(secure_element_->closeChannel(logical_channel_response.channelNumber));
- // tramsmit called on the basic channel should fail.
+ // transmit called on the logical channel should fail.
EXPECT_NE(transmit(logical_channel_response.channelNumber), 0x9000);
}
diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash
index 404553b..1397c05 100644
--- a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash
+++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash
@@ -1 +1,2 @@
+976674616001f714f4a4df49ee45f548de828524
d285480d2e0002adc0ace80edf34aa725679512e
diff --git a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
index 57ee8cf..de94264 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
@@ -70,7 +70,7 @@
* ; HKDF. See details on use in ProtectedData comments above. The public key data
* ; included in the other field of PartyUInfo / PartyVInfo is encoded as:
* ; - a raw 32-byte public key for X25519
- * ; - uncompressed SEC-1 coordinate data (0x04 || x || y) for P-256
+ * ; - raw coordinate data (x || y) for P-256
* Context = [
* AlgorithmID : 3 ; AES-GCM 256
* PartyUInfo : [
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl
index dfd8686..dff3c4c 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingDevice.aidl
@@ -33,7 +33,7 @@
package android.hardware.thermal;
/* @hide */
-@VintfStability
+@JavaDerive(toString=true) @VintfStability
parcelable CoolingDevice {
android.hardware.thermal.CoolingType type;
String name;
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl
index 3bf08bf..ce70ab8 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/Temperature.aidl
@@ -33,7 +33,7 @@
package android.hardware.thermal;
/* @hide */
-@VintfStability
+@JavaDerive(toString=true) @VintfStability
parcelable Temperature {
android.hardware.thermal.TemperatureType type;
String name;
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl
index c5ca4b9..a384d19 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureThreshold.aidl
@@ -33,7 +33,7 @@
package android.hardware.thermal;
/* @hide */
-@VintfStability
+@JavaDerive(toString=true) @VintfStability
parcelable TemperatureThreshold {
android.hardware.thermal.TemperatureType type;
String name;
diff --git a/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl b/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl
index 1f2360d..0c5c17d 100644
--- a/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl
+++ b/thermal/aidl/android/hardware/thermal/CoolingDevice.aidl
@@ -20,6 +20,7 @@
/* @hide */
@VintfStability
+@JavaDerive(toString=true)
parcelable CoolingDevice {
/**
* This cooling device type, CPU, GPU, BATTERY, and etc.
diff --git a/thermal/aidl/android/hardware/thermal/Temperature.aidl b/thermal/aidl/android/hardware/thermal/Temperature.aidl
index 281d68d..b3f6700 100644
--- a/thermal/aidl/android/hardware/thermal/Temperature.aidl
+++ b/thermal/aidl/android/hardware/thermal/Temperature.aidl
@@ -21,6 +21,7 @@
/* @hide */
@VintfStability
+@JavaDerive(toString=true)
parcelable Temperature {
/**
* This temperature's type.
diff --git a/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl b/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
index 0714c82..94991ae 100644
--- a/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
+++ b/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
@@ -20,6 +20,7 @@
/* @hide */
@VintfStability
+@JavaDerive(toString=true)
parcelable TemperatureThreshold {
/**
* This temperature's type.
diff --git a/tv/hdmi/cec/aidl/OWNERS b/tv/hdmi/OWNERS
similarity index 100%
rename from tv/hdmi/cec/aidl/OWNERS
rename to tv/hdmi/OWNERS
diff --git a/tv/hdmi/connection/aidl/OWNERS b/tv/hdmi/connection/aidl/OWNERS
deleted file mode 100644
index d9c6783..0000000
--- a/tv/hdmi/connection/aidl/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 826094
-include platform/frameworks/base:/core/java/android/hardware/hdmi/OWNERS
\ No newline at end of file
diff --git a/tv/hdmi/earc/aidl/OWNERS b/tv/hdmi/earc/aidl/OWNERS
deleted file mode 100644
index d9c6783..0000000
--- a/tv/hdmi/earc/aidl/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 826094
-include platform/frameworks/base:/core/java/android/hardware/hdmi/OWNERS
\ No newline at end of file
diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp
index 7dc2b7f..c537322 100755
--- a/uwb/aidl/Android.bp
+++ b/uwb/aidl/Android.bp
@@ -18,7 +18,11 @@
backend: {
java: {
sdk_version: "module_Tiramisu",
- enabled: false,
+ enabled: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.uwb",
+ ],
},
ndk: {
apex_available: [