Merge "Modify based on the vendor feedback"
diff --git a/audio/aidl/TEST_MAPPING b/audio/aidl/TEST_MAPPING
index 6a545c1..a166e61 100644
--- a/audio/aidl/TEST_MAPPING
+++ b/audio/aidl/TEST_MAPPING
@@ -13,9 +13,6 @@
"name": "VtsHalDownmixTargetTest"
},
{
- "name": "VtsHalDynamicsProcessingTargetTest"
- },
- {
"name": "VtsHalEnvironmentalReverbTargetTest"
},
{
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/AutomaticGainControl.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
index 39068d5..f3dd523 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/AutomaticGainControl.aidl
@@ -43,12 +43,6 @@
int vendorExtensionTag;
android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
}
- @VintfStability
- parcelable Capability {
- ParcelableHolder extension;
- int maxFixedDigitalGainMb;
- int maxSaturationMarginMb;
- }
@Backing(type="int") @VintfStability
enum LevelEstimator {
RMS = 0,
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/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.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/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..14e9cd8 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.AutomaticGainControlRange[] automaticGainControl;
+ android.hardware.audio.effect.Range.AutomaticGainControlV1Range[] automaticGainControlV1;
+ 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 AutomaticGainControlRange {
+ android.hardware.audio.effect.AutomaticGainControl min;
+ android.hardware.audio.effect.AutomaticGainControl max;
}
@VintfStability
- parcelable Long {
- long min;
- long max;
+ parcelable AutomaticGainControlV1Range {
+ android.hardware.audio.effect.AutomaticGainControlV1 min;
+ android.hardware.audio.effect.AutomaticGainControlV1 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/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
index e82a564..0c984b5 100644
--- a/audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl
@@ -24,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 AutomaticGainControl must be gettable and settable. The
- * capabilities defined in AutomaticGainControl.Capability can only acquired with
- * IEffect.getDescriptor() and not settable.
+ * All parameter settings must be inside the range of Capability.Range.automaticGainControl
+ * definition if the definition for the corresponding parameter tag exist. See more detals about
+ * Range in Range.aidl.
*/
@VintfStability
union AutomaticGainControl {
@@ -44,26 +44,6 @@
*/
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 {
@@ -75,7 +55,6 @@
/**
* The AGC fixed digital gain in millibel.
- * Must never be negative, and not larger than maxFixedDigitalGainMb in capability.
*/
int fixedDigitalGainMb;
/*
@@ -84,7 +63,6 @@
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/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/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..be7144f 100644
--- a/audio/aidl/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
@@ -44,6 +44,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 {
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..30e2359 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.AutomaticGainControl;
+import android.hardware.audio.effect.AutomaticGainControlV1;
+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 AutomaticGainControlRange {
+ AutomaticGainControl min;
+ AutomaticGainControl max;
+ }
+
+ @VintfStability
+ parcelable AutomaticGainControlV1Range {
+ AutomaticGainControlV1 min;
+ AutomaticGainControlV1 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;
+ AutomaticGainControlRange[] automaticGainControl;
+ AutomaticGainControlV1Range[] automaticGainControlV1;
+ 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/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp
index 403a4b9..fa9eb95 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:
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/automaticGainControl/AutomaticGainControlSw.cpp b/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp
index 8c706ef..30d7910 100644
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp
+++ b/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp
@@ -60,8 +60,13 @@
namespace aidl::android::hardware::audio::effect {
const std::string AutomaticGainControlSw::kEffectName = "AutomaticGainControlSw";
-const AutomaticGainControl::Capability AutomaticGainControlSw::kCapability = {
- .maxFixedDigitalGainMb = 50000, .maxSaturationMarginMb = 10000};
+
+const std::vector<Range::AutomaticGainControlRange> AutomaticGainControlSw::kRanges = {
+ MAKE_RANGE(AutomaticGainControl, fixedDigitalGainMb, 0, 50000),
+ MAKE_RANGE(AutomaticGainControl, saturationMarginMb, 0, 10000)};
+
+const Capability AutomaticGainControlSw::kCapability = {.range = AutomaticGainControlSw::kRanges};
+
const Descriptor AutomaticGainControlSw::kDescriptor = {
.common = {.id = {.type = kAutomaticGainControlTypeUUID,
.uuid = kAutomaticGainControlSwImplUUID,
@@ -71,8 +76,7 @@
.volume = Flags::Volume::CTRL},
.name = AutomaticGainControlSw::kEffectName,
.implementor = "The Android Open Source Project"},
- .capability = Capability::make<Capability::automaticGainControl>(
- AutomaticGainControlSw::kCapability)};
+ .capability = AutomaticGainControlSw::kCapability};
ndk::ScopedAStatus AutomaticGainControlSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();
@@ -87,8 +91,8 @@
RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
auto& param = specific.get<Parameter::Specific::automaticGainControl>();
+ RETURN_IF(!inRange(param, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
auto tag = param.getTag();
-
switch (tag) {
case AutomaticGainControl::fixedDigitalGainMb: {
RETURN_IF(mContext->setDigitalGain(
@@ -196,10 +200,6 @@
}
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;
}
@@ -219,10 +219,6 @@
}
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;
}
diff --git a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h b/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
index 2724835..9327410 100644
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
+++ b/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
@@ -51,7 +51,7 @@
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() {
@@ -72,6 +72,7 @@
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
+ static const std::vector<Range::AutomaticGainControlRange> kRanges;
std::shared_ptr<AutomaticGainControlSwContext> mContext;
ndk::ScopedAStatus getParameterAutomaticGainControl(const AutomaticGainControl::Tag& tag,
Parameter::Specific* specific);
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/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/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/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/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/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/VtsHalAGCTargetTest.cpp b/audio/aidl/vts/VtsHalAGCTargetTest.cpp
index 3448ae2..974c2e7 100644
--- a/audio/aidl/vts/VtsHalAGCTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAGCTargetTest.cpp
@@ -26,7 +26,6 @@
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;
@@ -94,7 +93,8 @@
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
- const bool valid = isTagInRange(tag, AGC, desc);
+ const bool valid =
+ isParameterValid<AutomaticGainControl, Range::automaticGainControl>(AGC, desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
@@ -135,65 +135,7 @@
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() {
+ static std::set<AutomaticGainControl::LevelEstimator> getLevelEstimatorValues() {
return {ndk::enum_range<AutomaticGainControl::LevelEstimator>().begin(),
ndk::enum_range<AutomaticGainControl::LevelEstimator>().end()};
}
@@ -218,13 +160,21 @@
SetAndGetParameters();
}
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
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())),
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kAutomaticGainControlTypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControl, int, Range::automaticGainControl,
+ AutomaticGainControl::fixedDigitalGainMb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControl, int, Range::automaticGainControl,
+ AutomaticGainControl::saturationMarginMb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ 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));
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/automotive/ivn_android_device/aidl/Android.bp b/automotive/ivn_android_device/aidl/Android.bp
new file mode 100644
index 0000000..95a0c73
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/Android.bp
@@ -0,0 +1,44 @@
+// 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 {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+aidl_interface {
+ name: "android.hardware.automotive.ivn",
+ vendor_available: true,
+ srcs: [
+ "android/hardware/automotive/ivn/*.aidl",
+ ],
+ frozen: false,
+ stability: "vintf",
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ sdk_version: "module_current",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
+ },
+ },
+}
diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/ConnectProtocol.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/ConnectProtocol.aidl
new file mode 100644
index 0000000..80d7a2a
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/ConnectProtocol.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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.ivn;
+@Backing(type="int") @VintfStability
+enum ConnectProtocol {
+ TCP_IP = 0,
+}
diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/EndpointInfo.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/EndpointInfo.aidl
new file mode 100644
index 0000000..5693520
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/EndpointInfo.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.ivn;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable EndpointInfo {
+ android.hardware.automotive.ivn.ConnectProtocol connectProtocol;
+ String ipAddress;
+ int portNumber;
+ android.hardware.automotive.ivn.HardwareIdentifiers hardwareId;
+}
diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/HardwareIdentifiers.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/HardwareIdentifiers.aidl
new file mode 100644
index 0000000..1a8b21d
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/HardwareIdentifiers.aidl
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.ivn;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable HardwareIdentifiers {
+ @nullable String brandName;
+ @nullable String deviceName;
+ @nullable String productName;
+ @nullable String manufacturerName;
+ @nullable String modelName;
+ @nullable String serialNumber;
+}
diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl
new file mode 100644
index 0000000..a04d829
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.ivn;
+@VintfStability
+interface IIvnAndroidDevice {
+ int getMyDeviceId();
+ int[] getOtherDeviceIds();
+ int getDeviceIdForOccupantZone(int zoneId);
+ android.hardware.automotive.ivn.OccupantZoneInfo[] getOccupantZonesForDevice(int androidDeviceId);
+ android.hardware.automotive.ivn.EndpointInfo getMyEndpointInfo();
+ android.hardware.automotive.ivn.EndpointInfo getEndpointInfoForDevice(int androidDeviceId);
+}
diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantType.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantType.aidl
new file mode 100644
index 0000000..6dd0c07
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantType.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.ivn;
+@Backing(type="int") @VintfStability
+enum OccupantType {
+ DRIVER = 1,
+ FRONT_PASSENGER = 2,
+ REAR_PASSENGER = 3,
+}
diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantZoneInfo.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantZoneInfo.aidl
new file mode 100644
index 0000000..41108e9
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantZoneInfo.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.ivn;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable OccupantZoneInfo {
+ int zoneId;
+ android.hardware.automotive.ivn.OccupantType occupantType;
+ int seat;
+}
diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/ConnectProtocol.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/ConnectProtocol.aidl
new file mode 100644
index 0000000..9f621b3
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/ConnectProtocol.aidl
@@ -0,0 +1,26 @@
+/*
+ * 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.automotive.ivn;
+
+/**
+ * Connect protocol for In-vehicle network Android device.
+ */
+@VintfStability
+@Backing(type="int")
+enum ConnectProtocol {
+ TCP_IP = 0,
+}
diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/EndpointInfo.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/EndpointInfo.aidl
new file mode 100644
index 0000000..32f6971
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/EndpointInfo.aidl
@@ -0,0 +1,50 @@
+/*
+ * 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.automotive.ivn;
+
+import android.hardware.automotive.ivn.ConnectProtocol;
+import android.hardware.automotive.ivn.HardwareIdentifiers;
+
+/**
+ * Network endpoint information for an Android instance running on a difference device.
+ *
+ * The device is in the same vehicle as this device.
+ */
+@JavaDerive(equals=true, toString=true)
+@VintfStability
+parcelable EndpointInfo {
+ /**
+ * The connection protocol. Only supports TCP/IP for now.
+ */
+ ConnectProtocol connectProtocol;
+ /**
+ * The IP address.
+ */
+ String ipAddress;
+ /**
+ * The port number exposed for connecting.
+ */
+ int portNumber;
+ /**
+ * Hardware identifiers.
+ *
+ * The hardware identifiers for the endpoint as defined in [Attestation Hardware Identifiers]
+ * {@link
+ * https://source.android.com/docs/security/features/keystore/attestation#hardware-identifiers}
+ */
+ HardwareIdentifiers hardwareId;
+}
diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/HardwareIdentifiers.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/HardwareIdentifiers.aidl
new file mode 100644
index 0000000..ffa09e6
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/HardwareIdentifiers.aidl
@@ -0,0 +1,65 @@
+/*
+ * 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.automotive.ivn;
+
+/**
+ * Hardware Identifiers for an Android device.
+ *
+ * <p>These identifiers are embedded in the ID attestation certificate and are
+ * used to restrict what devices this device can connect to. All fields are
+ * optional but at least one of the fields must be specified.
+ */
+@JavaDerive(equals=true, toString=true)
+@VintfStability
+parcelable HardwareIdentifiers {
+ /**
+ * Optional brand name, as returned by {@code Build.BRAND} in Android.
+ *
+ * If unspecified, we assume the other device has the same brand name as this device.
+ */
+ @nullable String brandName;
+ /**
+ * Optional brand name, as returned by {@code Build.DEVICE} in Android.
+ *
+ * If unspecified, we assume the other device has the same device name as this device.
+ */
+ @nullable String deviceName;
+ /**
+ * Optional model name, as returned by {@code Build.PRODUCT} in Android.
+ *
+ * If unspecified, we assume the other device has the same product name as this device.
+ */
+ @nullable String productName;
+ /**
+ * Optional manufacturer name, as returned by {@code Build.MANUFACTURER} in Android.
+ *
+ * If unspecified, we assume the other device has the same manufacturer name as this device.
+ */
+ @nullable String manufacturerName;
+ /**
+ * Optional model name, as returned by {@code Build.MODEL} in Android.
+ *
+ * If unspecified, we assume the other device has the same model name as this device.
+ */
+ @nullable String modelName;
+ /**
+ * Optional serial number.
+ *
+ * If unspecified, we allow the endpoint to have any serial number.
+ */
+ @nullable String serialNumber;
+}
diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl
new file mode 100644
index 0000000..107b7a6
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl
@@ -0,0 +1,81 @@
+/*
+ * 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.automotive.ivn;
+
+import android.hardware.automotive.ivn.EndpointInfo;
+import android.hardware.automotive.ivn.OccupantZoneInfo;
+
+/**
+ * Interface for In-Vehicle Network(IVN) Android devices.
+ *
+ * This is used in a multi-zone multi-SoC environment where there are multiple
+ * SoCs running Android in a vehicle. Each support one or multiple occupant
+ * zones. E.g., one SoC for front passenger, one SoC for backseat left-zone
+ * and middle/right zone passengers.
+ */
+@VintfStability
+interface IIvnAndroidDevice {
+ /**
+ * Returns the unique ID for this Android device.
+ *
+ * <p>This ID has to be unique among all the android devices in the whole vehicle. It is usually
+ * a hard-coded value, e.g. serial number.
+ *
+ * @return an ID representing this device.
+ */
+ int getMyDeviceId();
+
+ /**
+ * Returns a list of unique IDs for other IVN Android devices.
+ *
+ * The returned list does not contain the current Android device ID. This list is usually
+ * pre-configured for this HAL, either hard-coded or read from configuration file.
+ *
+ * @return A list of IDs representing connected Android devices.
+ */
+ int[] getOtherDeviceIds();
+
+ /**
+ * Returns the Android device ID for a specified occupant zone.
+ *
+ * @pararm zoneID the occupant zone ID returned from {@link android.car.CarOccupantZoneManager}.
+ * @return an ID representing an Android device.
+ */
+ int getDeviceIdForOccupantZone(int zoneId);
+
+ /**
+ * Returns all the occupant zones supported for a specified IVN Android device.
+ *
+ * @param androidDeviceId the android device ID.
+ * @return A list of supported occupant zone info.
+ */
+ OccupantZoneInfo[] getOccupantZonesForDevice(int androidDeviceId);
+
+ /**
+ * Returns the connection endpoint info for this android device.
+ *
+ * @return The endpoint info.
+ */
+ EndpointInfo getMyEndpointInfo();
+
+ /**
+ * Returns the connection endpoint info for the specified IVN Android device.
+ *
+ * @return The endpoint info.
+ */
+ EndpointInfo getEndpointInfoForDevice(int androidDeviceId);
+}
diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantType.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantType.aidl
new file mode 100644
index 0000000..72542a7
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantType.aidl
@@ -0,0 +1,39 @@
+/*
+ * 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.automotive.ivn;
+
+/**
+ * Occupant type.
+ *
+ * This enum might be extended in the future.
+ */
+@VintfStability
+@Backing(type="int")
+enum OccupantType {
+ /**
+ * Represents the driver. There can be one or zero driver for the system. Zero driver situation
+ * can happen if the system is configured to support only passengers.
+ */
+ DRIVER = 1,
+ /**
+ * Represents front passengers who sit in front side of car. Most cars will have only
+ * one passenger of this type but this can be multiple.
+ */
+ FRONT_PASSENGER = 2,
+ /** Represents passengers in rear seats. There can be multiple passengers of this type. */
+ REAR_PASSENGER = 3,
+}
diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantZoneInfo.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantZoneInfo.aidl
new file mode 100644
index 0000000..af45444
--- /dev/null
+++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantZoneInfo.aidl
@@ -0,0 +1,50 @@
+/*
+ * 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.automotive.ivn;
+
+import android.hardware.automotive.ivn.OccupantType;
+
+/**
+ * Represents an occupant zone in a car.
+ *
+ * <p>Each occupant does not necessarily represent single person but it is for mapping to one
+ * set of displays. For example, for display located in center rear seat, both left and right
+ * side passengers may use it but it is abstracted as a single occupant zone.</p>
+ */
+@JavaDerive(equals=true, toString=true)
+@VintfStability
+parcelable OccupantZoneInfo {
+ /**
+ * This is an unique id to distinguish each occupant zone.
+ *
+ * <p>This can be helpful to distinguish different zones when {@link #occupantType} and
+ * {@link #seat} are the same for multiple occupant / passenger zones.</p>
+ *
+ * <p>This id will remain the same for the same zone across configuration changes like
+ * user switching or display changes</p>
+ */
+ int zoneId;
+ /** Represents type of passenger */
+ OccupantType occupantType;
+ /**
+ * Represents seat assigned for the occupant. In some system, this can have value of
+ * {@code VehicleAreaSeat#SEAT_UNKNOWN}.
+ *
+ * <p>This might be one of {@code VehicleAreaSeat} or a combination of {@code VehicleAreaSeat}.
+ */
+ int seat;
+}
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
index 1b61fb3..1d2d910 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
@@ -258,7 +258,11 @@
{VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE},
{VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ},
{VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE},
- {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE},
{VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE},
};
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
index f073a6f..613636e 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
@@ -258,7 +258,11 @@
{VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
- {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
};
diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
index b0970a9..f83f1c2 100644
--- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
@@ -250,7 +250,11 @@
Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess.WRITE),
Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE),
- Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE)
);
diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
index 20322a6..f0642fe 100644
--- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
@@ -250,7 +250,11 @@
Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
- Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE)
);
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
index 0111c6b..7531589 100644
--- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
@@ -38,6 +38,10 @@
using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState;
using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState;
using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty;
+using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand;
+using ::aidl::android::hardware::automotive::vehicle::CruiseControlState;
+using ::aidl::android::hardware::automotive::vehicle::CruiseControlType;
+using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState;
using ::aidl::android::hardware::automotive::vehicle::ErrorState;
using ::aidl::android::hardware::automotive::vehicle::EvConnectorType;
using ::aidl::android::hardware::automotive::vehicle::EvsServiceState;
@@ -218,6 +222,14 @@
mConstantParsersByType["FuelType"] = std::make_unique<ConstantParser<FuelType>>();
mConstantParsersByType["WindshieldWipersState"] =
std::make_unique<ConstantParser<WindshieldWipersState>>();
+ mConstantParsersByType["EmergencyLaneKeepAssistState"] =
+ std::make_unique<ConstantParser<EmergencyLaneKeepAssistState>>();
+ mConstantParsersByType["CruiseControlType"] =
+ std::make_unique<ConstantParser<CruiseControlType>>();
+ mConstantParsersByType["CruiseControlState"] =
+ std::make_unique<ConstantParser<CruiseControlState>>();
+ mConstantParsersByType["CruiseControlCommand"] =
+ std::make_unique<ConstantParser<CruiseControlCommand>>();
mConstantParsersByType["ErrorState"] = std::make_unique<ConstantParser<ErrorState>>();
mConstantParsersByType["AutomaticEmergencyBrakingState"] =
std::make_unique<ConstantParser<AutomaticEmergencyBrakingState>>();
diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
index 4329625..a0e8115 100644
--- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
+++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
@@ -3113,7 +3113,32 @@
}
},
{
- "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED",
+ "property": "VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "EmergencyLaneKeepAssistState::ENABLED"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "ErrorState::NOT_AVAILABLE_SAFETY",
+ "ErrorState::NOT_AVAILABLE_SPEED_HIGH",
+ "ErrorState::NOT_AVAILABLE_SPEED_LOW",
+ "ErrorState::NOT_AVAILABLE_DISABLED",
+ "EmergencyLaneKeepAssistState::ENABLED",
+ "EmergencyLaneKeepAssistState::WARNING_LEFT",
+ "EmergencyLaneKeepAssistState::WARNING_RIGHT",
+ "EmergencyLaneKeepAssistState::ACTIVATED_STEER_LEFT",
+ "EmergencyLaneKeepAssistState::ACTIVATED_STEER_RIGHT",
+ "EmergencyLaneKeepAssistState::USER_OVERRIDE"
+ ]
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::CRUISE_CONTROL_ENABLED",
"defaultValue": {
"int32Values": [
1
@@ -3121,6 +3146,68 @@
}
},
{
+ "property": "VehicleProperty::CRUISE_CONTROL_TYPE",
+ "defaultValue": {
+ "int32Values": [
+ "CruiseControlType::STANDARD"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "ErrorState::NOT_AVAILABLE_SAFETY",
+ "ErrorState::NOT_AVAILABLE_SPEED_HIGH",
+ "ErrorState::NOT_AVAILABLE_SPEED_LOW",
+ "ErrorState::NOT_AVAILABLE_DISABLED",
+ "CruiseControlType::STANDARD",
+ "CruiseControlType::ADAPTIVE",
+ "CruiseControlType::PREDICTIVE"
+ ]
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::CRUISE_CONTROL_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "CruiseControlState::ENABLED"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "ErrorState::NOT_AVAILABLE_SAFETY",
+ "ErrorState::NOT_AVAILABLE_SPEED_HIGH",
+ "ErrorState::NOT_AVAILABLE_SPEED_LOW",
+ "ErrorState::NOT_AVAILABLE_DISABLED",
+ "CruiseControlState::ENABLED",
+ "CruiseControlState::ACTIVATED",
+ "CruiseControlState::USER_OVERRIDE",
+ "CruiseControlState::SUSPENDED",
+ "CruiseControlState::FORCED_DEACTIVATION_WARNING"
+ ]
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::CRUISE_CONTROL_COMMAND",
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "CruiseControlCommand::ACTIVATE",
+ "CruiseControlCommand::SUSPEND",
+ "CruiseControlCommand::INCREASE_TARGET_SPEED",
+ "CruiseControlCommand::DECREASE_TARGET_SPEED",
+ "CruiseControlCommand::INCREASE_TARGET_TIME_GAP",
+ "CruiseControlCommand::DECREASE_TARGET_TIME_GAP"
+ ]
+ }
+ ]
+ },
+ {
"property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED",
"defaultValue": {
"int32Values": [
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
index a7a1dc7..3b26aa6 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
@@ -19,8 +19,12 @@
#include <aidl/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.h>
#include <aidl/android/hardware/automotive/vehicle/BlindSpotWarningState.h>
+#include <aidl/android/hardware/automotive/vehicle/CruiseControlCommand.h>
+#include <aidl/android/hardware/automotive/vehicle/CruiseControlState.h>
+#include <aidl/android/hardware/automotive/vehicle/CruiseControlType.h>
#include <aidl/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.h>
#include <aidl/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.h>
+#include <aidl/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.h>
#include <aidl/android/hardware/automotive/vehicle/ErrorState.h>
#include <aidl/android/hardware/automotive/vehicle/EvConnectorType.h>
#include <aidl/android/hardware/automotive/vehicle/EvStoppingMode.h>
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl
new file mode 100644
index 0000000..d6a104d
--- /dev/null
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum CruiseControlCommand {
+ ACTIVATE = 1,
+ SUSPEND = 2,
+ INCREASE_TARGET_SPEED = 3,
+ DECREASE_TARGET_SPEED = 4,
+ INCREASE_TARGET_TIME_GAP = 5,
+ DECREASE_TARGET_TIME_GAP = 6,
+}
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlState.aidl
new file mode 100644
index 0000000..ddaffa3
--- /dev/null
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlState.aidl
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum CruiseControlState {
+ OTHER = 0,
+ ENABLED = 1,
+ ACTIVATED = 2,
+ USER_OVERRIDE = 3,
+ SUSPENDED = 4,
+ FORCED_DEACTIVATION_WARNING = 5,
+}
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlType.aidl
new file mode 100644
index 0000000..aab9dfe
--- /dev/null
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlType.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum CruiseControlType {
+ OTHER = 0,
+ STANDARD = 1,
+ ADAPTIVE = 2,
+ PREDICTIVE = 3,
+}
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl
new file mode 100644
index 0000000..078acde1
--- /dev/null
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum EmergencyLaneKeepAssistState {
+ OTHER = 0,
+ ENABLED = 1,
+ WARNING_LEFT = 2,
+ WARNING_RIGHT = 3,
+ ACTIVATED_STEER_LEFT = 4,
+ ACTIVATED_STEER_RIGHT = 5,
+ USER_OVERRIDE = 6,
+}
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 509b53b..bbec4bf 100644
--- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -256,7 +256,11 @@
LANE_CENTERING_ASSIST_COMMAND = (((0x100B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411083 */,
LANE_CENTERING_ASSIST_STATE = (((0x100C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411084 */,
EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */,
- ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */,
+ EMERGENCY_LANE_KEEP_ASSIST_STATE = (((0x100E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411086 */,
+ CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */,
+ CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */,
+ CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */,
+ CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */,
HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */,
DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */,
}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl
new file mode 100644
index 0000000..18e1405
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl
@@ -0,0 +1,62 @@
+/*
+ * 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.automotive.vehicle;
+
+/**
+ * Used to enumerate the Cruise Control (CC) commands.
+ *
+ * This enum could be extended in future releases to include additional feature states.
+ */
+@VintfStability
+@Backing(type="int")
+enum CruiseControlCommand {
+ /**
+ * Activate cruise control, which means CC takes control of maintaining the vehicle's target
+ * speed without the driver having to keep their foot on the accelerator. The target speed for
+ * CC is generally set to the vehicle's speed at the time of activation.
+ */
+ ACTIVATE = 1,
+ /**
+ * Suspend cruise control, but still keep it enabled. Once CC is activated again, the
+ * target speed should resume to the previous setting.
+ */
+ SUSPEND = 2,
+ /**
+ * Increase the target speed when CC is activated. The increment value should be decided by the
+ * OEM. The updated value can be read from CRUISE_CONTROL_TARGET_SPEED.
+ */
+ INCREASE_TARGET_SPEED = 3,
+ /**
+ * Decrease the target speed when CC is activated. The decrement value should be decided by the
+ * OEM. The updated value can be read from CRUISE_CONTROL_TARGET_SPEED.
+ */
+ DECREASE_TARGET_SPEED = 4,
+ /**
+ * Increase the target time gap or distance from the vehicle ahead when adaptive/predictive CC
+ * is activated. The increment value should be decided by the OEM. The updated value can be read
+ * from ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP. Setting this command on a standard CC vehicle
+ * should return StatusCode.NOT_AVAILABLE.
+ */
+ INCREASE_TARGET_TIME_GAP = 5,
+ /**
+ * Decrease the target time gap or distance from the vehicle ahead when adaptive/predictive CC
+ * is activated. The decrement value should be decided by the 0EM. The updated value can be read
+ * from ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP. Setting this command on a standard CC vehicle
+ * should return StatusCode.NOT_AVAILABLE.
+ */
+ DECREASE_TARGET_TIME_GAP = 6,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlState.aidl
new file mode 100644
index 0000000..0e55e00
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlState.aidl
@@ -0,0 +1,67 @@
+/*
+ * 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.automotive.vehicle;
+
+/**
+ * Used to enumerate the current state of Cruise Control (CC).
+ *
+ * This enum could be extended in future releases to include additional feature states.
+ */
+@VintfStability
+@Backing(type="int")
+enum CruiseControlState {
+ /**
+ * This state is used as an alternative for any CruiseControlState value that is not defined in
+ * the platform. Ideally, implementations of VehicleProperty#CRUISE_CONTROL_STATE should not use
+ * this state. The framework can use this field to remain backwards compatible if
+ * CruiseControlState is extended to include additional states.
+ */
+ OTHER = 0,
+ /**
+ * CC is enabled but the ADAS system is not actively controlling the vehicle's speed.
+ */
+ ENABLED = 1,
+ /**
+ * CC is enabled and activated, so the ADAS system is actively controlling the vehicle's speed.
+ */
+ ACTIVATED = 2,
+ /**
+ * Most CC implementations allow the driver to override CC. This means that the car has
+ * determined it should maintain a certain speed and/or maintain a certain distance from a
+ * leading vehicle, but the driver decides to take over and do something else. This is often
+ * done for safety reasons and to ensure that the driver can always take control of the vehicle.
+ * This state should be set when the user is actively overriding the CC system.
+ */
+ USER_OVERRIDE = 3,
+ /**
+ * Suspended state indicates CC is enabled and was activated, but now is suspended. This could
+ * be caused by the user tapping the brakes while CC is ACTIVATED or the user using the
+ * VehicleProperty#CRUISE_CONTROL_COMMAND to suspend CC. Once CC is suspended, the CC system
+ * gives control of the vehicle back to the driver, but saves the target speed and/or target
+ * time gap settings in case CC is resumed. This state can also be used when adaptive/predictive
+ * CC slows to a stop and needs a user signal to start again.
+ */
+ SUSPENDED = 4,
+ /**
+ * When CC is in the ACTIVATED state but may potentially need to deactivate because of external
+ * conditions (e.g. roads curvature is too extreme, the driver does not have their hands on the
+ * steering wheel for a long period of time, or the driver is not paying attention), then the
+ * ADAS system will notify the driver of a potential need to deactivate and give control back to
+ * the driver.
+ */
+ FORCED_DEACTIVATION_WARNING = 5,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlType.aidl
new file mode 100644
index 0000000..2367b82
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlType.aidl
@@ -0,0 +1,53 @@
+/*
+ * 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.automotive.vehicle;
+
+/**
+ * Used to enumerate the current type of Cruise Control (CC).
+ *
+ * This enum could be extended in future releases to include additional feature states.
+ */
+@VintfStability
+@Backing(type="int")
+enum CruiseControlType {
+ /**
+ * This state is used as an alternative for any CruiseControlType value that is not defined in
+ * the platform. Ideally, implementations of VehicleProperty#CRUISE_CONTROL_TYPE should not use
+ * this state. The framework can use this field to remain backwards compatible if
+ * CruiseControlType is extended to include additional types.
+ */
+ OTHER = 0,
+ /**
+ * Standard cruise control is when a system in the vehicle automatically maintains a set speed
+ * without the driver having to keep their foot on the accelerator. This version of cruise
+ * control does not include automatic acceleration and deceleration to maintain a set time gap
+ * from a vehicle ahead.
+ */
+ STANDARD = 1,
+ /**
+ * Adaptive cruise control is when a system in the vehicle automatically accelerates and
+ * decelerates to maintain a set speed and/or a set time gap from a vehicle ahead.
+ */
+ ADAPTIVE = 2,
+ /**
+ * Predictive cruise control is a version of adaptive cruise control that also considers road
+ * topography, road curvature, speed limit and traffic signs, etc. to actively adjust braking,
+ * acceleration, gear shifting, etc. for the vehicle. This feature is often used to optimize
+ * fuel consumption.
+ */
+ PREDICTIVE = 3,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl
new file mode 100644
index 0000000..302b9af
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl
@@ -0,0 +1,70 @@
+/*
+ * 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.automotive.vehicle;
+
+/**
+ * Used by emergency lane keep assist to enumerate state.
+ *
+ * This enum could be extended in future releases to include additional feature states.
+ */
+@VintfStability
+@Backing(type="int")
+enum EmergencyLaneKeepAssistState {
+ /**
+ * This state is used as an alternative for any EmergencyLaneKeepAssistState value that is not
+ * defined in the platform. Ideally, implementations of
+ * VehicleProperty#EMERGENCY_LANE_KEEP_ASSIST_STATE should not use this state. The framework can
+ * use this field to remain backwards compatible if EmergencyLaneKeepAssistState is extended to
+ * include additional states.
+ */
+ OTHER = 0,
+ /**
+ * ELKA is enabled and monitoring safety, but no safety event is detected and steering assist is
+ * not activated.
+ */
+ ENABLED = 1,
+ /**
+ * ELKA is enabled and a safety event is detected. Vehicle is sending out a warning to the
+ * driver indicating that there is a dangerous maneuver on the left side of the vehicle.
+ */
+ WARNING_LEFT = 2,
+ /**
+ * ELKA is enabled and a safety event is detected. Vehicle is sending out a warning to the
+ * driver indicating that there is a dangerous maneuver on the right side of the vehicle.
+ */
+ WARNING_RIGHT = 3,
+ /**
+ * ELKA is enabled and currently has steering assist applied to the vehicle. Steering assist
+ * nudges the vehicle towards the left, which generally means the steering wheel turns counter
+ * clockwise. This is usually in response to the driver making an unsafe right lane change.
+ */
+ ACTIVATED_STEER_LEFT = 4,
+ /**
+ * ELKA is enabled and currently has steering assist applied to the vehicle. Steering assist
+ * nudges the vehicle towards the right, which generally means the steering wheel turns
+ * clockwise. This is usually in response to the driver making an unsafe left lane change.
+ */
+ ACTIVATED_STEER_RIGHT = 5,
+ /**
+ * Many safety feature implementations allow the driver to override said feature. This means
+ * that the car has determined it should take some action, but a user decides to take over and
+ * do something else. This is often done for safety reasons and to ensure that the driver can
+ * always take control of the vehicle. This state should be set when the user is currently
+ * overriding ELKA.
+ */
+ USER_OVERRIDE = 6,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 349e8bd..68a1e32 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -3833,13 +3833,33 @@
0x100D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
/**
- * Enable or disable adaptive cruise control (ACC).
+ * Emergency Lane Keep Assist (ELKA) state.
*
- * Set true to enable ACC and false to disable ACC. When ACC is enabled, the ADAS system in the
- * vehicle should be turned on and waiting for an activation signal from the driver. Once the
- * feature is activated, the ADAS system in the car should be accelerating and braking in a way
- * that allows the vehicle to maintain a set speed and to maintain a set distance gap from a
- * leading vehicle.
+ * Returns the current state of ELKA. Generally, this property should return a valid state
+ * defined in the EmergencyLaneKeepAssistState or ErrorState. For example, if the feature is not
+ * available due to some temporary state, that information should be conveyed through
+ * ErrorState.
+ *
+ * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states of EmergencyLaneKeepAssistState (including OTHER, which is not recommended)
+ * and ErrorState are supported.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
+ * @data_enum EmergencyLaneKeepAssistState
+ * @data_enum ErrorState
+ */
+ EMERGENCY_LANE_KEEP_ASSIST_STATE =
+ 0x100E + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
+ * Enable or disable cruise control (CC).
+ *
+ * Set true to enable CC and false to disable CC. This property is shared by all forms of
+ * CruiseControlType(s).
+ *
+ * When CC is enabled, the ADAS system in the vehicle should be turned on and responding to
+ * commands.
*
* This property is defined as read_write, but OEMs have the option to implement it as read
* only.
@@ -3847,10 +3867,70 @@
* @change_mode VehiclePropertyChangeMode.ON_CHANGE
* @access VehiclePropertyAccess.READ_WRITE
*/
- ADAPTIVE_CRUISE_CONTROL_ENABLED =
+ CRUISE_CONTROL_ENABLED =
0x100F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
/**
+ * Current type of Cruise Control (CC).
+ *
+ * When CRUISE_CONTROL_ENABLED is true, this property returns the type of CC that is currently
+ * enabled (for example, standard CC, adaptive CC, predictive CC, etc.). Generally, this
+ * property should return a valid state defined in the CruiseControlType or ErrorState. For
+ * example, if the feature is not available due to some temporary state, that information should
+ * be conveyed through ErrorState.
+ *
+ * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states of CruiseControlType (including OTHER, which is not recommended) and
+ * ErrorState are supported.
+ *
+ * Trying to write CruiseControlType#OTHER or an ErrorState to this property will throw an
+ * IllegalArgumentException.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
+ * @data_enum CruiseControlType
+ * @data_enum ErrorState
+ */
+ CRUISE_CONTROL_TYPE =
+ 0x1010 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
+ * Current state of Cruise Control (CC).
+ *
+ * This property returns the current state of CC. Generally, this property should return a valid
+ * state defined in the CruiseControlState or ErrorState. For example, if the feature is not
+ * available due to some temporary state, that information should be conveyed through
+ * ErrorState.
+ *
+ * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states of CruiseControlState (including OTHER, which is not recommended) and
+ * ErrorState are supported.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
+ * @data_enum CruiseControlState
+ * @data_enum ErrorState
+ */
+ CRUISE_CONTROL_STATE =
+ 0x1011 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
+ * Write Cruise Control (CC) commands.
+ *
+ * See CruiseControlCommand for the details about each supported command.
+ *
+ * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states of CruiseControlState are supported. Any unsupported commands sent through
+ * this property should return StatusCode.INVALID_ARG.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
+ * @data_enum CruiseControlCommand
+ */
+ CRUISE_CONTROL_COMMAND =
+ 0x1012 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
* Enable or disable hands on detection (HOD).
*
* Set true to enable HOD and false to disable HOD. When HOD is enabled, a system inside the
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index b2567e9..efbcf47 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -504,10 +504,34 @@
VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
}
-TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlEnabledConfig) {
- verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED,
- VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
- VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistStateConfig) {
+ verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) {
+ verifyProperty(VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
+}
+
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTypeConfig) {
+ verifyProperty(VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) {
+ verifyProperty(VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) {
+ verifyProperty(VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::INT32);
}
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) {
diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml
index c9cf6ef..104a463 100644
--- a/compatibility_matrices/compatibility_matrix.8.xml
+++ b/compatibility_matrices/compatibility_matrix.8.xml
@@ -108,7 +108,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl" optional="true">
<name>android.hardware.automotive.remoteaccess</name>
<interface>
<name>IRemoteAccess</name>
@@ -116,6 +116,13 @@
</interface>
</hal>
<hal format="aidl" optional="true">
+ <name>android.hardware.automotive.ivn</name>
+ <interface>
+ <name>IIvnAndroidDevice</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <hal format="aidl" optional="true">
<name>android.hardware.biometrics.face</name>
<version>3</version>
<interface>
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl
index 128ef49..71927b6 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl
@@ -35,6 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum Hdr {
+ INVALID = 0,
DOLBY_VISION = 1,
HDR10 = 2,
HLG = 3,
diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
index 407b54f..6107c4c 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
@@ -24,6 +24,10 @@
@Backing(type="int")
enum Hdr {
/**
+ * Invalid HDR type
+ */
+ INVALID = 0,
+ /**
* Device supports Dolby Vision HDR
*/
DOLBY_VISION = 1,
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
index af82b83..cb85a88 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -77,7 +77,7 @@
void setIdleTimerEnabled(long display, int timeoutMs);
android.hardware.graphics.composer3.OverlayProperties getOverlaySupport();
android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities();
- void setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy);
+ android.hardware.graphics.common.Hdr setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy);
void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled);
const int EX_BAD_CONFIG = 1;
const int EX_BAD_DISPLAY = 2;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index fe6483e..4e77f86 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -17,6 +17,7 @@
package android.hardware.graphics.composer3;
import android.hardware.graphics.common.DisplayDecorationSupport;
+import android.hardware.graphics.common.Hdr;
import android.hardware.graphics.common.HdrConversionCapability;
import android.hardware.graphics.common.HdrConversionStrategy;
import android.hardware.graphics.common.Transform;
@@ -844,12 +845,13 @@
/**
* Sets the of HDR conversion strategy.
*
- *
+ * @return the chosen HDR type in case HdrConversionStrategy has autoAllowedHdrTypes set. In
+ * other cases, return HDR type INVALID.
* @exception EX_UNSUPPORTED when not supported by the underlying HAL
*
* @see getHdrConversionCapabilities
*/
- void setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy);
+ Hdr setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy);
/*
* Sets either the callback for the refresh rate change is enabled or disabled
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp
index 2e2b193..e03ef25 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.cpp
+++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp
@@ -344,9 +344,11 @@
hdrConversionCapability};
}
-ScopedAStatus VtsComposerClient::setHdrConversionStrategy(
+std::pair<ScopedAStatus, common::Hdr> VtsComposerClient::setHdrConversionStrategy(
const common::HdrConversionStrategy& conversionStrategy) {
- return mComposerClient->setHdrConversionStrategy(conversionStrategy);
+ common::Hdr preferredHdrOutputType;
+ return {mComposerClient->setHdrConversionStrategy(conversionStrategy, &preferredHdrOutputType),
+ preferredHdrOutputType};
}
std::pair<ScopedAStatus, common::Transform> VtsComposerClient::getDisplayPhysicalOrientation(
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h
index aee46d2..81a62b3 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.h
+++ b/graphics/composer/aidl/vts/VtsComposerClient.h
@@ -166,7 +166,8 @@
std::pair<ScopedAStatus, std::vector<common::HdrConversionCapability>>
getHdrConversionCapabilities();
- ScopedAStatus setHdrConversionStrategy(const common::HdrConversionStrategy& conversionStrategy);
+ std::pair<ScopedAStatus, common::Hdr> setHdrConversionStrategy(
+ const common::HdrConversionStrategy& conversionStrategy);
std::pair<ScopedAStatus, common::Transform> getDisplayPhysicalOrientation(int64_t display);
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 55e0a13..70c4e4c 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -637,8 +637,10 @@
}
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::passthrough>(true);
- const auto& status = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
+ const auto& [status, preferredHdrOutputType] =
+ mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
EXPECT_TRUE(status.isOk());
+ EXPECT_EQ(common::Hdr::INVALID, preferredHdrOutputType);
}
TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) {
@@ -652,9 +654,10 @@
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::forceHdrConversion>(
conversionCapability.outputType->hdr);
- const auto& statusSet =
+ const auto& [statusSet, preferredHdrOutputType] =
mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
- EXPECT_TRUE(status.isOk());
+ EXPECT_TRUE(statusSet.isOk());
+ EXPECT_EQ(common::Hdr::INVALID, preferredHdrOutputType);
}
}
}
@@ -674,8 +677,10 @@
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::autoAllowedHdrTypes>(
autoHdrTypes);
- const auto& statusSet = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
- EXPECT_TRUE(status.isOk());
+ const auto& [statusSet, preferredHdrOutputType] =
+ mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
+ EXPECT_TRUE(statusSet.isOk());
+ EXPECT_NE(common::Hdr::INVALID, preferredHdrOutputType);
}
TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode_BadDisplay) {
diff --git a/tv/README.md b/tv/README.md
new file mode 100644
index 0000000..9a1c381
--- /dev/null
+++ b/tv/README.md
@@ -0,0 +1,8 @@
+# TV-related HIDL and AIDL HALs
+
+This directory bundles TV-related HALs in HIDL (legacy) and AIDL.
+
+- The 'tuner' directory contains the Tuner HIDL and AIDL HALs.
+- The 'input' directory contains the TV Input HIDL and AIDL HALs.
+- The 'cec' directory contains the CEC HIDL HAL.
+- The 'hdmi' directory contains the HDMI-related AIDL HALs, which includes the CEC AIDL HAL.
diff --git a/tv/hdmi/README.md b/tv/hdmi/README.md
new file mode 100644
index 0000000..183a3d0
--- /dev/null
+++ b/tv/hdmi/README.md
@@ -0,0 +1,11 @@
+# HDMI-related AIDL HALs for Android devices
+
+This directory bundles 3 HDMI-related AIDL HALs: HDMI Connection HAL, CEC HAL and eARC HAL.
+
+The HDMI Connection HAL contains general APIs for the HDMI Connection. These methods are required by
+the CEC and the eARC implementation. Therefore, devices that implement CEC need to support the HDMI
+Connection HAL and the CEC HAL. Devices that implement eARC need to support the HDMI Connection HAL
+and the eARC HAL.
+
+Other Android HALs are related to HDMI as well, but not included in this directory for historical
+reasons, e.g. Display HAL and TV Input HAL.
diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl
index 08dc1ee..4f7e247 100644
--- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl
+++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl
@@ -34,7 +34,7 @@
package android.hardware.tv.hdmi.cec;
@Backing(type="byte") @VintfStability
enum CecDeviceType {
- INACTIVE = -1,
+ INACTIVE = (-1) /* -1 */,
TV = 0,
RECORDER = 1,
TUNER = 3,
diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl
index 31ca895..20472f0 100644
--- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl
+++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl
@@ -34,78 +34,78 @@
package android.hardware.tv.hdmi.cec;
@Backing(type="int") @VintfStability
enum CecMessageType {
- FEATURE_ABORT = 0,
- IMAGE_VIEW_ON = 4,
- TUNER_STEP_INCREMENT = 5,
- TUNER_STEP_DECREMENT = 6,
- TUNER_DEVICE_STATUS = 7,
- GIVE_TUNER_DEVICE_STATUS = 8,
- RECORD_ON = 9,
- RECORD_STATUS = 10,
- RECORD_OFF = 11,
- TEXT_VIEW_ON = 13,
- RECORD_TV_SCREEN = 15,
- GIVE_DECK_STATUS = 26,
- DECK_STATUS = 27,
- SET_MENU_LANGUAGE = 50,
- CLEAR_ANALOG_TIMER = 51,
- SET_ANALOG_TIMER = 52,
- TIMER_STATUS = 53,
- STANDBY = 54,
- PLAY = 65,
- DECK_CONTROL = 66,
- TIMER_CLEARED_STATUS = 67,
- USER_CONTROL_PRESSED = 68,
- USER_CONTROL_RELEASED = 69,
- GIVE_OSD_NAME = 70,
- SET_OSD_NAME = 71,
- SET_OSD_STRING = 100,
- SET_TIMER_PROGRAM_TITLE = 103,
- SYSTEM_AUDIO_MODE_REQUEST = 112,
- GIVE_AUDIO_STATUS = 113,
- SET_SYSTEM_AUDIO_MODE = 114,
- REPORT_AUDIO_STATUS = 122,
- GIVE_SYSTEM_AUDIO_MODE_STATUS = 125,
- SYSTEM_AUDIO_MODE_STATUS = 126,
- ROUTING_CHANGE = 128,
- ROUTING_INFORMATION = 129,
- ACTIVE_SOURCE = 130,
- GIVE_PHYSICAL_ADDRESS = 131,
- REPORT_PHYSICAL_ADDRESS = 132,
- REQUEST_ACTIVE_SOURCE = 133,
- SET_STREAM_PATH = 134,
- DEVICE_VENDOR_ID = 135,
- VENDOR_COMMAND = 137,
- VENDOR_REMOTE_BUTTON_DOWN = 138,
- VENDOR_REMOTE_BUTTON_UP = 139,
- GIVE_DEVICE_VENDOR_ID = 140,
- MENU_REQUEST = 141,
- MENU_STATUS = 142,
- GIVE_DEVICE_POWER_STATUS = 143,
- REPORT_POWER_STATUS = 144,
- GET_MENU_LANGUAGE = 145,
- SELECT_ANALOG_SERVICE = 146,
- SELECT_DIGITAL_SERVICE = 147,
- SET_DIGITAL_TIMER = 151,
- CLEAR_DIGITAL_TIMER = 153,
- SET_AUDIO_RATE = 154,
- INACTIVE_SOURCE = 157,
- CEC_VERSION = 158,
- GET_CEC_VERSION = 159,
- VENDOR_COMMAND_WITH_ID = 160,
- CLEAR_EXTERNAL_TIMER = 161,
- SET_EXTERNAL_TIMER = 162,
- REPORT_SHORT_AUDIO_DESCRIPTOR = 163,
- REQUEST_SHORT_AUDIO_DESCRIPTOR = 164,
- INITIATE_ARC = 192,
- REPORT_ARC_INITIATED = 193,
- REPORT_ARC_TERMINATED = 194,
- REQUEST_ARC_INITIATION = 195,
- REQUEST_ARC_TERMINATION = 196,
- TERMINATE_ARC = 197,
- ABORT = 255,
- GIVE_FEATURES = 165,
- REPORT_FEATURES = 166,
- REQUEST_CURRENT_LATENCY = 167,
- REPORT_CURRENT_LATENCY = 168,
+ FEATURE_ABORT = 0x00,
+ IMAGE_VIEW_ON = 0x04,
+ TUNER_STEP_INCREMENT = 0x05,
+ TUNER_STEP_DECREMENT = 0x06,
+ TUNER_DEVICE_STATUS = 0x07,
+ GIVE_TUNER_DEVICE_STATUS = 0x08,
+ RECORD_ON = 0x09,
+ RECORD_STATUS = 0x0A,
+ RECORD_OFF = 0x0B,
+ TEXT_VIEW_ON = 0x0D,
+ RECORD_TV_SCREEN = 0x0F,
+ GIVE_DECK_STATUS = 0x1A,
+ DECK_STATUS = 0x1B,
+ SET_MENU_LANGUAGE = 0x32,
+ CLEAR_ANALOG_TIMER = 0x33,
+ SET_ANALOG_TIMER = 0x34,
+ TIMER_STATUS = 0x35,
+ STANDBY = 0x36,
+ PLAY = 0x41,
+ DECK_CONTROL = 0x42,
+ TIMER_CLEARED_STATUS = 0x43,
+ USER_CONTROL_PRESSED = 0x44,
+ USER_CONTROL_RELEASED = 0x45,
+ GIVE_OSD_NAME = 0x46,
+ SET_OSD_NAME = 0x47,
+ SET_OSD_STRING = 0x64,
+ SET_TIMER_PROGRAM_TITLE = 0x67,
+ SYSTEM_AUDIO_MODE_REQUEST = 0x70,
+ GIVE_AUDIO_STATUS = 0x71,
+ SET_SYSTEM_AUDIO_MODE = 0x72,
+ REPORT_AUDIO_STATUS = 0x7A,
+ GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D,
+ SYSTEM_AUDIO_MODE_STATUS = 0x7E,
+ ROUTING_CHANGE = 0x80,
+ ROUTING_INFORMATION = 0x81,
+ ACTIVE_SOURCE = 0x82,
+ GIVE_PHYSICAL_ADDRESS = 0x83,
+ REPORT_PHYSICAL_ADDRESS = 0x84,
+ REQUEST_ACTIVE_SOURCE = 0x85,
+ SET_STREAM_PATH = 0x86,
+ DEVICE_VENDOR_ID = 0x87,
+ VENDOR_COMMAND = 0x89,
+ VENDOR_REMOTE_BUTTON_DOWN = 0x8A,
+ VENDOR_REMOTE_BUTTON_UP = 0x8B,
+ GIVE_DEVICE_VENDOR_ID = 0x8C,
+ MENU_REQUEST = 0x8D,
+ MENU_STATUS = 0x8E,
+ GIVE_DEVICE_POWER_STATUS = 0x8F,
+ REPORT_POWER_STATUS = 0x90,
+ GET_MENU_LANGUAGE = 0x91,
+ SELECT_ANALOG_SERVICE = 0x92,
+ SELECT_DIGITAL_SERVICE = 0x93,
+ SET_DIGITAL_TIMER = 0x97,
+ CLEAR_DIGITAL_TIMER = 0x99,
+ SET_AUDIO_RATE = 0x9A,
+ INACTIVE_SOURCE = 0x9D,
+ CEC_VERSION = 0x9E,
+ GET_CEC_VERSION = 0x9F,
+ VENDOR_COMMAND_WITH_ID = 0xA0,
+ CLEAR_EXTERNAL_TIMER = 0xA1,
+ SET_EXTERNAL_TIMER = 0xA2,
+ REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3,
+ REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4,
+ INITIATE_ARC = 0xC0,
+ REPORT_ARC_INITIATED = 0xC1,
+ REPORT_ARC_TERMINATED = 0xC2,
+ REQUEST_ARC_INITIATION = 0xC3,
+ REQUEST_ARC_TERMINATION = 0xC4,
+ TERMINATE_ARC = 0xC5,
+ ABORT = 0xFF,
+ GIVE_FEATURES = 0xA5,
+ REPORT_FEATURES = 0xA6,
+ REQUEST_CURRENT_LATENCY = 0xA7,
+ REPORT_CURRENT_LATENCY = 0xA8,
}
diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
index 0881489..c6060d1 100644
--- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
+++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
@@ -41,7 +41,7 @@
int getPhysicalAddress();
int getVendorId();
android.hardware.tv.hdmi.cec.SendMessageResult sendMessage(in android.hardware.tv.hdmi.cec.CecMessage message);
- void setCallback(in android.hardware.tv.hdmi.cec.IHdmiCecCallback callback);
+ void setCallback(in @nullable android.hardware.tv.hdmi.cec.IHdmiCecCallback callback);
void setLanguage(in String language);
void enableWakeupByOtp(in boolean value);
void enableCec(in boolean value);
diff --git a/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl b/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
index 577c377..578d924 100644
--- a/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
+++ b/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl
@@ -77,7 +77,7 @@
* plugged off and on again. It is advised to call getPhysicalAddress to get
* the updated address when hot plug event takes place.
*
- * @param out addr Physical address of this device.
+ * @return Physical address of this device.
*/
int getPhysicalAddress();
@@ -116,7 +116,7 @@
* previously registered callback must be replaced with this one.
* setCallback(null) should deregister the callback.
*/
- void setCallback(in IHdmiCecCallback callback);
+ void setCallback(in @nullable IHdmiCecCallback callback);
/**
* Passes the updated language information of Android system. Contains
diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
index 1d2ef4a..6bec7e5 100644
--- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
+++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
@@ -24,10 +24,16 @@
@VintfStability
parcelable HdmiPortInfo {
HdmiPortType type;
- int portId; // Output ports should start from 1 which corresponds to HDMI "port 1".
+ int portId; // For devices with input ports (e.g. TV Panels), input ports should start from 1
+ // which corresponds to HDMI "port 1".
+
+ // In the following, 'supported' refers to having the necessary hardware and firmware on the
+ // device to support CEC/ARC/eARC on this port.
boolean cecSupported;
- boolean arcSupported;
+ boolean arcSupported; // If true, cecSupported has to be true as well. ARC cannot be supported
+ // without CEC support.
boolean eArcSupported;
+
// The physical address of the device connected to this port, valid range is 0x0000 to 0xFFFF
// (ref Sec 8.7.2 of HDMI 1.4b).
int physicalAddress;
diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl
index 6c7a438..ee6cc89 100644
--- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl
+++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl
@@ -56,6 +56,11 @@
* hotplug signal). When set to {@code HDMI_HPD_STATUS_BIT} the HAL should use the HDP status
* bit.
*
+ * This is only relevant to TV Panel devices that support eARC TX. While eARC TX is connected,
+ * the framework calls this method to set the HPD signal to {@code HDMI_HPD_STATUS_BIT}.
+ *
+ * For all other device types, this method can be stubbed.
+ *
* @param signal The HPD signal type to use.
* @param portId id of the port on which the HPD signal should be set.
*
@@ -70,6 +75,12 @@
/**
* Get the current signal the HAL is using for HPD
*
+ * This is only relevant to TV Panel devices that support eARC TX. While eARC TX is connected,
+ * this method returns {@code HDMI_HPD_STATUS_BIT}.
+ *
+ * For all other device types, this method can be stubbed by always returning
+ * {@code HDMI_HPD_PHYSICAL}.
+ *
* @param portId id of the port of which the current HPD signal is queried.
*/
HpdSignal getHpdSignal(in int portId);
diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
index 29d4ea9..6dcbd8d 100644
--- a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
+++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
@@ -34,8 +34,8 @@
package android.hardware.tv.hdmi.earc;
@Backing(type="byte") @VintfStability
enum IEArcStatus {
- STATUS_IDLE = 0,
- STATUS_EARC_PENDING = 1,
- STATUS_ARC_PENDING = 2,
- STATUS_EARC_CONNECTED = 3,
+ IDLE = 0,
+ EARC_PENDING = 1,
+ ARC_PENDING = 2,
+ EARC_CONNECTED = 3,
}
diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl
index a2dde6a..d9fb29c 100644
--- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl
+++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl
@@ -20,7 +20,7 @@
import android.hardware.tv.hdmi.earc.IEArcStatus;
/**
- * eARC HAL interface definition
+ * eARC HAL interface definition. This is only relevant to TV Panels that implement eARC TX.
*/
@VintfStability
interface IEArc {
@@ -64,10 +64,11 @@
IEArcStatus getState(in int portId);
/**
- * Getter for the most recent capabilities reported by the device connected to port.
+ * Getter for the most recent audio capabilities reported by the device connected to port.
*
* @param portId The port ID on which the device is connected.
- * @return The raw, unparsed audio capabilities
+ * @return a byte array containing the raw, unparsed audio capabilities (Ref "Section 9.5.3.6 -
+ * eARC RX Capabilities Data Structure" in HDMI 2.1 specification).
*/
byte[] getLastReportedAudioCapabilities(in int portId);
}
diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl
index a11924b..ea77c54 100644
--- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl
+++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl
@@ -34,9 +34,9 @@
/**
* The callback function that must be called by the eARC driver and HAL implementation to
* notify the Android framework of the audio capabilities reported by the connected device. On
- * every state change to {@code STATUS_EARC_CONNECTED}, the driver shall read the capabilities
- * reported by the eARC RX. The onStateChange callback shall always be invoked first and the
- * onCapabilitiesReported callback shall be invoked second.
+ * every state change to {@code IEArcStatus::EARC_CONNECTED}, the driver shall read the
+ * capabilities reported by the eARC RX. The onStateChange callback shall always be invoked
+ * first and the onCapabilitiesReported callback shall be invoked second.
* @param rawCapabilities The raw unparsed audio capabilities (Ref "Section 9.5.3.6 - eARC RX
* Capabilities Data Structure" in HDMI 2.1 specification).
* @param portId The port ID for which the audio capabilities are being reported
diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
index de1aaf1..5407434 100644
--- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
+++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl
@@ -22,8 +22,8 @@
@VintfStability
@Backing(type="byte")
enum IEArcStatus {
- STATUS_IDLE = 0,
- STATUS_EARC_PENDING = 1,
- STATUS_ARC_PENDING = 2,
- STATUS_EARC_CONNECTED = 3,
+ IDLE = 0,
+ EARC_PENDING = 1,
+ ARC_PENDING = 2,
+ EARC_CONNECTED = 3,
}
diff --git a/tv/hdmi/earc/aidl/default/EArcMock.cpp b/tv/hdmi/earc/aidl/default/EArcMock.cpp
index a3ccabf..0e92fbd 100644
--- a/tv/hdmi/earc/aidl/default/EArcMock.cpp
+++ b/tv/hdmi/earc/aidl/default/EArcMock.cpp
@@ -109,7 +109,7 @@
mCallback = nullptr;
mCapabilities.resize(mTotalPorts);
mPortStatus.resize(mTotalPorts);
- mPortStatus[0] = IEArcStatus::STATUS_IDLE;
+ mPortStatus[0] = IEArcStatus::IDLE;
mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(serviceDied));
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
index cabe167..1c23223 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
@@ -59,6 +59,9 @@
oneway void onNetworkAdded(in int id);
oneway void onNetworkNotFound(in byte[] ssid);
oneway void onNetworkRemoved(in int id);
+ /**
+ * @deprecated use onPmkSaCacheAdded() instead.
+ */
oneway void onPmkCacheAdded(in long expirationTimeInSec, in byte[] serializedEntry);
/**
* @deprecated This callback is deprecated from AIDL v2, newer HAL should call onSupplicantStateChanged()
@@ -75,6 +78,7 @@
oneway void onBssFrequencyChanged(in int frequencyMhz);
oneway void onSupplicantStateChanged(in android.hardware.wifi.supplicant.SupplicantStateChangeData stateChangeData);
oneway void onQosPolicyResponseForScs(in android.hardware.wifi.supplicant.QosPolicyScsResponseStatus[] qosPolicyScsResponseStatus);
+ oneway void onPmkSaCacheAdded(in android.hardware.wifi.supplicant.PmkSaCacheData pmkSaData);
@Backing(type="int") @VintfStability
enum MloLinkInfoChangeReason {
TID_TO_LINK_MAP = 0,
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl
index f30ca94..8783c40 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl
@@ -38,4 +38,6 @@
byte[] staLinkMacAddress;
byte tidsUplinkMap;
byte tidsDownlinkMap;
+ @nullable byte[] apLinkMacAddress;
+ int frequencyMHz;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl
index 14fcb91..cd98f7f 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl
@@ -35,4 +35,6 @@
@VintfStability
parcelable MloLinksInfo {
android.hardware.wifi.supplicant.MloLink[] links;
+ int apMloLinkId;
+ @nullable byte[] apMldMacAddress;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl
new file mode 100644
index 0000000..436d0c0
--- /dev/null
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// 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.wifi.supplicant;
+@VintfStability
+parcelable PmkSaCacheData {
+ byte[] bssid;
+ long expirationTimeInSec;
+ byte[] serializedEntry;
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
index 398bb36..17a220d 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl
@@ -30,6 +30,7 @@
import android.hardware.wifi.supplicant.DppStatusErrorCode;
import android.hardware.wifi.supplicant.Hs20AnqpData;
import android.hardware.wifi.supplicant.OsuMethod;
+import android.hardware.wifi.supplicant.PmkSaCacheData;
import android.hardware.wifi.supplicant.QosPolicyData;
import android.hardware.wifi.supplicant.QosPolicyScsResponseStatus;
import android.hardware.wifi.supplicant.StaIfaceCallbackState;
@@ -248,6 +249,8 @@
/**
* Indicates pairwise master key (PMK) cache added event.
*
+ * @deprecated use onPmkSaCacheAdded() instead.
+ *
* @param expirationTimeInSec expiration time in seconds
* @param serializedEntry is serialized PMK cache entry, the content is
* opaque for the framework and depends on the native implementation.
@@ -392,4 +395,12 @@
* @param qosPolicyScsResponseStatus[] status for each SCS id.
*/
void onQosPolicyResponseForScs(in QosPolicyScsResponseStatus[] qosPolicyScsResponseStatus);
+
+ /**
+ * Indicates pairwise master key (PMK) cache added event.
+ *
+ * @param pmkSaData PMKSA cache entry added details.
+ *
+ */
+ void onPmkSaCacheAdded(in PmkSaCacheData pmkSaData);
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl
index 7608e0a..ed6528c 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl
@@ -58,4 +58,12 @@
*/
byte tidsUplinkMap;
byte tidsDownlinkMap;
+ /**
+ * AP Link MAC Address
+ */
+ @nullable byte[/* 6 */] apLinkMacAddress;
+ /**
+ * Frequency on which the link operates in MHz.
+ */
+ int frequencyMHz;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl
index 2f14717..d954d16 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl
@@ -28,4 +28,12 @@
* List of MLO links
*/
MloLink[] links;
+ /**
+ * The MLO link-id for the access point. It is the link-id used for association.
+ */
+ int apMloLinkId;
+ /**
+ * AP MLD MAC address.
+ */
+ @nullable byte[/* 6 */] apMldMacAddress;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl
new file mode 100644
index 0000000..bc28ff5
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl
@@ -0,0 +1,37 @@
+/*
+ * 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.wifi.supplicant;
+
+/**
+ * Details of the PMKSA cache entry that was added in supplicant.
+ */
+@VintfStability
+parcelable PmkSaCacheData {
+ /**
+ * BSSID of the access point to which the station is associated.
+ */
+ byte[/* 6 */] bssid;
+ /**
+ * PMK expiration time in seconds.
+ */
+ long expirationTimeInSec;
+ /**
+ * Serialized PMK cache entry.
+ * The content is opaque for the framework and depends on the native implementation.
+ */
+ byte[] serializedEntry;
+}
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp
index d0daf96..5d00485 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp
@@ -234,6 +234,11 @@
override {
return ndk::ScopedAStatus::ok();
}
+ ::ndk::ScopedAStatus onPmkSaCacheAdded(
+ const ::aidl::android::hardware::wifi::supplicant::PmkSaCacheData& /* pmkSaData */)
+ override {
+ return ndk::ScopedAStatus::ok();
+ }
};
class SupplicantStaIfaceAidlTest : public testing::TestWithParam<std::string> {