Merge "Disable verbose nlinterceptor log"
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 4e50b7a..e58ae6a 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -148,16 +148,26 @@
name: "android.hardware.audio.effect",
vendor_available: true,
srcs: [
+ "android/hardware/audio/effect/BassBoost.aidl",
"android/hardware/audio/effect/Capability.aidl",
"android/hardware/audio/effect/CommandId.aidl",
"android/hardware/audio/effect/Descriptor.aidl",
+ "android/hardware/audio/effect/Downmix.aidl",
+ "android/hardware/audio/effect/DynamicsProcessing.aidl",
"android/hardware/audio/effect/Equalizer.aidl",
"android/hardware/audio/effect/Flags.aidl",
+ "android/hardware/audio/effect/HapticGenerator.aidl",
"android/hardware/audio/effect/IEffect.aidl",
"android/hardware/audio/effect/IFactory.aidl",
+ "android/hardware/audio/effect/LoudnessEnhancer.aidl",
"android/hardware/audio/effect/Parameter.aidl",
"android/hardware/audio/effect/Processing.aidl",
+ "android/hardware/audio/effect/Reverb.aidl",
"android/hardware/audio/effect/State.aidl",
+ "android/hardware/audio/effect/VendorExtension.aidl",
+ "android/hardware/audio/effect/Virtualizer.aidl",
+ "android/hardware/audio/effect/Visualizer.aidl",
+ "android/hardware/audio/effect/Volume.aidl",
],
imports: [
"android.hardware.common-V2",
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
new file mode 100644
index 0000000..979ebb8
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union BassBoost {
+ android.hardware.audio.effect.VendorExtension vendor;
+ int strengthPm;
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.BassBoost.Tag commonTag;
+ }
+ @VintfStability
+ parcelable Capability {
+ ParcelableHolder extension;
+ 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 11acf5e..06f2bfe 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
@@ -34,10 +34,15 @@
package android.hardware.audio.effect;
@VintfStability
union Capability {
- android.hardware.audio.effect.Capability.VendorEffectCapability vendor;
+ android.hardware.audio.effect.VendorExtension vendorExtension;
+ 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.Equalizer.Capability equalizer;
- @VintfStability
- parcelable VendorEffectCapability {
- ParcelableHolder extension;
- }
+ android.hardware.audio.effect.HapticGenerator.Capability hapticGenerator;
+ android.hardware.audio.effect.LoudnessEnhancer.Capability loudnessEnhancer;
+ android.hardware.audio.effect.Reverb.Capability reverb;
+ android.hardware.audio.effect.Virtualizer.Capability virtualizer;
+ android.hardware.audio.effect.Visualizer.Capability visualizer;
+ android.hardware.audio.effect.Volume.Capability volume;
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
index 4707011..990d369 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
@@ -54,11 +54,11 @@
android.media.audio.common.AudioUuid type;
android.media.audio.common.AudioUuid uuid;
@nullable android.media.audio.common.AudioUuid proxy;
- android.hardware.audio.effect.Flags flags;
}
@VintfStability
parcelable Common {
android.hardware.audio.effect.Descriptor.Identity id;
+ android.hardware.audio.effect.Flags flags;
int cpuLoad;
int memoryUsage;
@utf8InCpp String name;
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
new file mode 100644
index 0000000..76f8ce5
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union Downmix {
+ android.hardware.audio.effect.VendorExtension vendor;
+ android.hardware.audio.effect.Downmix.Type type;
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.Downmix.Tag commonTag;
+ }
+ @VintfStability
+ parcelable Capability {
+ ParcelableHolder extension;
+ }
+ @VintfStability
+ enum Type {
+ STRIP = 0,
+ FOLD = 1,
+ }
+}
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
new file mode 100644
index 0000000..ed4dc80
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union DynamicsProcessing {
+ android.hardware.audio.effect.VendorExtension vendorExtension;
+ android.hardware.audio.effect.DynamicsProcessing.EngineArchitecture engineArchitecture;
+ android.hardware.audio.effect.DynamicsProcessing.BandChannelConfig preEq;
+ android.hardware.audio.effect.DynamicsProcessing.BandChannelConfig postEq;
+ android.hardware.audio.effect.DynamicsProcessing.EqBandConfig preEqBand;
+ android.hardware.audio.effect.DynamicsProcessing.EqBandConfig postEqBand;
+ android.hardware.audio.effect.DynamicsProcessing.BandChannelConfig mbc;
+ android.hardware.audio.effect.DynamicsProcessing.MbcBandConfig mbcBand;
+ android.hardware.audio.effect.DynamicsProcessing.LimiterConfig limiter;
+ float inputGainDb;
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.DynamicsProcessing.Tag commonTag;
+ }
+ @VintfStability
+ parcelable Capability {
+ ParcelableHolder extension;
+ }
+ enum ResolutionPreference {
+ FAVOR_FREQUENCY_RESOLUTION = 0,
+ FAVOR_TIME_RESOLUTION = 1,
+ }
+ @VintfStability
+ parcelable BandEnablement {
+ boolean inUse;
+ int bandCount;
+ }
+ @VintfStability
+ parcelable EngineArchitecture {
+ android.hardware.audio.effect.DynamicsProcessing.ResolutionPreference resolutionPreference = android.hardware.audio.effect.DynamicsProcessing.ResolutionPreference.FAVOR_FREQUENCY_RESOLUTION;
+ float preferredFrameDurationMs;
+ android.hardware.audio.effect.DynamicsProcessing.BandEnablement preEqBand;
+ android.hardware.audio.effect.DynamicsProcessing.BandEnablement postEqBand;
+ android.hardware.audio.effect.DynamicsProcessing.BandEnablement mbcBand;
+ boolean limiterInUse;
+ }
+ @VintfStability
+ parcelable BandChannelConfig {
+ int channel;
+ android.hardware.audio.effect.DynamicsProcessing.BandEnablement enablement;
+ }
+ @VintfStability
+ parcelable EqBandConfig {
+ int channel;
+ int band;
+ boolean enable;
+ float cutoffFrequency;
+ float gain;
+ }
+ @VintfStability
+ parcelable MbcBandConfig {
+ int channel;
+ int band;
+ boolean enable;
+ float cutoffFrequencyHz;
+ float gainDb;
+ float attackTimeMs;
+ float releaseTimeMs;
+ float ratio;
+ float thresholdDb;
+ float kneeWidthDb;
+ float noiseGateThresholdDb;
+ float expanderRatio;
+ float preGainDb;
+ float postGainDb;
+ }
+ @VintfStability
+ parcelable LimiterConfig {
+ int channel;
+ boolean enable;
+ boolean inUse;
+ int linkGroup;
+ float attackTimeMs;
+ float releaseTimeMs;
+ float ratio;
+ float thresholdDb;
+ float postGainDb;
+ }
+}
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 f7af300..d825eac 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
@@ -34,12 +34,13 @@
package android.hardware.audio.effect;
@VintfStability
union Equalizer {
- android.hardware.audio.effect.Equalizer.VendorExtension vendor;
+ android.hardware.audio.effect.VendorExtension vendorExtension;
android.hardware.audio.effect.Equalizer.BandLevel[] bandLevels;
int preset;
@VintfStability
- parcelable VendorExtension {
- ParcelableHolder extension;
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.Equalizer.Tag commonTag;
}
@VintfStability
parcelable Capability {
@@ -50,13 +51,13 @@
@VintfStability
parcelable BandLevel {
int index;
- int level;
+ int levelMb;
}
@VintfStability
parcelable BandFrequency {
int index;
- int min;
- int max;
+ int minMh;
+ int maxMh;
}
@VintfStability
parcelable Preset {
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
new file mode 100644
index 0000000..40a8d72
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union HapticGenerator {
+ android.hardware.audio.effect.VendorExtension vendorExtension;
+ android.hardware.audio.effect.HapticGenerator.HapticScale hapticScale;
+ android.hardware.audio.effect.HapticGenerator.VibratorInformation vibratorInfo;
+ @VintfStability
+ union Id {
+ 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,
+ VERY_LOW = -2,
+ LOW = -1,
+ NONE = 0,
+ HIGH = 1,
+ VERY_HIGH = 2,
+ }
+ @VintfStability
+ parcelable HapticScale {
+ int id;
+ android.hardware.audio.effect.HapticGenerator.VibratorScale scale = android.hardware.audio.effect.HapticGenerator.VibratorScale.MUTE;
+ }
+ @VintfStability
+ parcelable VibratorInformation {
+ float resonantFrequencyHz;
+ float qFactor;
+ float maxAmplitude;
+ }
+}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl
index e5c96f5..8c196e7 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl
@@ -34,7 +34,7 @@
package android.hardware.audio.effect;
@VintfStability
interface IEffect {
- android.hardware.audio.effect.IEffect.OpenEffectReturn open(in android.hardware.audio.effect.Parameter.Common common, in android.hardware.audio.effect.Parameter.Specific specific);
+ android.hardware.audio.effect.IEffect.OpenEffectReturn open(in android.hardware.audio.effect.Parameter.Common common, in @nullable android.hardware.audio.effect.Parameter.Specific specific);
void close();
android.hardware.audio.effect.Descriptor getDescriptor();
void command(in android.hardware.audio.effect.CommandId commandId);
@@ -44,13 +44,13 @@
@FixedSize @VintfStability
parcelable Status {
int status;
- int fmqByteConsumed;
- int fmqByteProduced;
+ int fmqConsumed;
+ int fmqProduced;
}
@VintfStability
parcelable OpenEffectReturn {
android.hardware.common.fmq.MQDescriptor<android.hardware.audio.effect.IEffect.Status,android.hardware.common.fmq.SynchronizedReadWrite> statusMQ;
- android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> inputDataMQ;
- android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> outputDataMQ;
+ android.hardware.common.fmq.MQDescriptor<float,android.hardware.common.fmq.SynchronizedReadWrite> inputDataMQ;
+ android.hardware.common.fmq.MQDescriptor<float,android.hardware.common.fmq.SynchronizedReadWrite> outputDataMQ;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl
index a22c591..5b85d33 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl
@@ -34,7 +34,7 @@
package android.hardware.audio.effect;
@VintfStability
interface IFactory {
- android.hardware.audio.effect.Descriptor.Identity[] queryEffects(in @nullable android.media.audio.common.AudioUuid type, in @nullable android.media.audio.common.AudioUuid implementation);
+ android.hardware.audio.effect.Descriptor.Identity[] queryEffects(in @nullable android.media.audio.common.AudioUuid type, in @nullable android.media.audio.common.AudioUuid implementation, in @nullable android.media.audio.common.AudioUuid proxy);
android.hardware.audio.effect.Processing[] queryProcessing(in @nullable android.hardware.audio.effect.Processing.Type type);
android.hardware.audio.effect.IEffect createEffect(in android.media.audio.common.AudioUuid implUuid);
void destroyEffect(in android.hardware.audio.effect.IEffect handle);
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
new file mode 100644
index 0000000..5c6ca16
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union LoudnessEnhancer {
+ android.hardware.audio.effect.VendorExtension vendor;
+ int gainMb;
+ @VintfStability
+ union Id {
+ 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/Parameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
index 547112a..321c286 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
@@ -35,18 +35,25 @@
@VintfStability
union Parameter {
android.hardware.audio.effect.Parameter.Common common;
- android.media.audio.common.AudioDeviceType device;
+ android.media.audio.common.AudioDeviceDescription deviceDescription;
android.media.audio.common.AudioMode mode;
android.media.audio.common.AudioSource source;
- android.hardware.audio.effect.Parameter.Volume volume;
- boolean offload;
- android.hardware.audio.effect.Parameter.VendorEffectParameter vendorEffect;
+ android.hardware.audio.effect.Parameter.VolumeStereo volumeStereo;
android.hardware.audio.effect.Parameter.Specific specific;
@VintfStability
union Id {
- int commonTag;
- int vendorTag;
- android.hardware.audio.effect.Parameter.Specific.Id specificId;
+ int vendorEffectTag;
+ android.hardware.audio.effect.BassBoost.Id bassBoostTag;
+ android.hardware.audio.effect.Downmix.Id downmixTag;
+ android.hardware.audio.effect.DynamicsProcessing.Id dynamicsProcessingTag;
+ android.hardware.audio.effect.Equalizer.Id equalizerTag;
+ android.hardware.audio.effect.HapticGenerator.Id hapticGeneratorTag;
+ android.hardware.audio.effect.LoudnessEnhancer.Id loudnessEnhancerTag;
+ android.hardware.audio.effect.Reverb.Id reverbTag;
+ android.hardware.audio.effect.Virtualizer.Id virtualizerTag;
+ android.hardware.audio.effect.Visualizer.Id visualizerTag;
+ android.hardware.audio.effect.Volume.Id volumeTag;
+ android.hardware.audio.effect.Parameter.Tag commonTag;
}
@VintfStability
parcelable Common {
@@ -56,21 +63,22 @@
android.media.audio.common.AudioConfig output;
}
@VintfStability
- parcelable Volume {
+ parcelable VolumeStereo {
float left;
float right;
}
@VintfStability
- parcelable VendorEffectParameter {
- ParcelableHolder extension;
- }
- @VintfStability
union Specific {
- android.hardware.audio.effect.Parameter.Specific.Id id;
+ android.hardware.audio.effect.VendorExtension vendorEffect;
+ android.hardware.audio.effect.BassBoost bassBoost;
+ android.hardware.audio.effect.Downmix downmix;
+ android.hardware.audio.effect.DynamicsProcessing dynamicsProcessing;
android.hardware.audio.effect.Equalizer equalizer;
- @VintfStability
- union Id {
- android.hardware.audio.effect.Equalizer.Tag equalizerTag = android.hardware.audio.effect.Equalizer.Tag.vendor;
- }
+ android.hardware.audio.effect.LoudnessEnhancer loudnessEnhancer;
+ android.hardware.audio.effect.HapticGenerator hapticGenerator;
+ android.hardware.audio.effect.Reverb reverb;
+ android.hardware.audio.effect.Virtualizer virtualizer;
+ android.hardware.audio.effect.Visualizer visualizer;
+ android.hardware.audio.effect.Volume volume;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Reverb.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Reverb.aidl
new file mode 100644
index 0000000..8ad4848
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Reverb.aidl
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union Reverb {
+ android.hardware.audio.effect.VendorExtension vendor;
+ int roomLevelMb;
+ int roomHfLevelMb;
+ int decayTimeMs;
+ int decayHfRatioPm;
+ int levelMb;
+ int delayMs;
+ int diffusionPm;
+ int densityPm;
+ boolean bypass;
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.Reverb.Tag commonTag;
+ }
+ @VintfStability
+ parcelable Capability {
+ android.hardware.audio.effect.VendorExtension extension;
+ int maxDecayTimeMs;
+ }
+}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/VendorExtension.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/VendorExtension.aidl
new file mode 100644
index 0000000..b806334
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/VendorExtension.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+parcelable VendorExtension {
+ ParcelableHolder extension;
+}
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
new file mode 100644
index 0000000..d4fb9e0
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union Virtualizer {
+ android.hardware.audio.effect.VendorExtension vendor;
+ int strengthPm;
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.Virtualizer.Tag commonTag;
+ }
+ @VintfStability
+ parcelable Capability {
+ android.hardware.audio.effect.VendorExtension extension;
+ boolean strengthSupported;
+ }
+}
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
new file mode 100644
index 0000000..9ee19f0
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+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;
+ int captureSizeBytes;
+ 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.CaptureSizeRange captureSizeRange;
+ }
+ @VintfStability
+ parcelable CaptureSizeRange {
+ int minBytes;
+ int maxBytes;
+ }
+ @VintfStability
+ enum ScalingMode {
+ NORMALIZED = 0,
+ AS_PLAYED = 1,
+ }
+ @VintfStability
+ enum MeasurementMode {
+ NONE = 0,
+ PEAK_RMS = 1,
+ }
+ @VintfStability
+ union GetOnlyParameters {
+ android.hardware.audio.effect.Visualizer.GetOnlyParameters.Measurement measurement;
+ byte[] captureBytes;
+ @VintfStability
+ parcelable Measurement {
+ int rms;
+ int peak;
+ }
+ }
+ @VintfStability
+ union SetOnlyParameters {
+ int latencyMs;
+ }
+}
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
new file mode 100644
index 0000000..8c836b0
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union Volume {
+ android.hardware.audio.effect.VendorExtension vendor;
+ int levelDb;
+ boolean mute;
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.Volume.Tag commonTag;
+ }
+ @VintfStability
+ parcelable Capability {
+ android.hardware.audio.effect.VendorExtension extension;
+ int maxLevel;
+ }
+}
diff --git a/audio/aidl/android/hardware/audio/effect/BassBoost.aidl b/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
new file mode 100644
index 0000000..810c188
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ */
+@VintfStability
+union BassBoost {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ BassBoost.Tag commonTag;
+ }
+
+ /**
+ * Vendor BassBoost implementation definition for additional parameters.
+ */
+ 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;
+ /**
+ * 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 valid range for strength is [0, 1000].
+ */
+ int strengthPm;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Capability.aidl b/audio/aidl/android/hardware/audio/effect/Capability.aidl
index e792f86..f741f33 100644
--- a/audio/aidl/android/hardware/audio/effect/Capability.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Capability.aidl
@@ -16,7 +16,17 @@
package android.hardware.audio.effect;
+import android.hardware.audio.effect.BassBoost;
+import android.hardware.audio.effect.Downmix;
+import android.hardware.audio.effect.DynamicsProcessing;
import android.hardware.audio.effect.Equalizer;
+import android.hardware.audio.effect.HapticGenerator;
+import android.hardware.audio.effect.LoudnessEnhancer;
+import android.hardware.audio.effect.Reverb;
+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.
@@ -33,14 +43,19 @@
* the ParcelableHolder in each effect capability definition. For example:
* Equalizer.Capability.extension.
*/
- @VintfStability
- parcelable VendorEffectCapability {
- ParcelableHolder extension;
- }
- VendorEffectCapability vendor;
+ VendorExtension vendorExtension;
/**
- * Equalizer capability definition.
+ * Effect capabilities.
*/
+ BassBoost.Capability bassBoost;
+ Downmix.Capability downmix;
+ DynamicsProcessing.Capability dynamicsProcessing;
Equalizer.Capability equalizer;
+ HapticGenerator.Capability hapticGenerator;
+ LoudnessEnhancer.Capability loudnessEnhancer;
+ Reverb.Capability reverb;
+ Virtualizer.Capability virtualizer;
+ Visualizer.Capability visualizer;
+ Volume.Capability volume;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
index 562c249..47c88dc 100644
--- a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
@@ -107,10 +107,6 @@
* implementation is part of a proxy effect.
*/
@nullable AudioUuid proxy;
- /**
- * Capability flags defined for the effect implementation.
- */
- Flags flags;
}
/**
@@ -123,6 +119,10 @@
*/
Identity id;
/**
+ * Capability flags defined for the effect implementation.
+ */
+ Flags flags;
+ /**
* CPU load indication expressed in 0.1 MIPS units as estimated on an ARM9E core (ARMv5TE)
* with 0 WS.
*/
diff --git a/audio/aidl/android/hardware/audio/effect/Downmix.aidl b/audio/aidl/android/hardware/audio/effect/Downmix.aidl
new file mode 100644
index 0000000..ee57baf
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/Downmix.aidl
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ */
+@VintfStability
+union Downmix {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ Downmix.Tag commonTag;
+ }
+
+ /**
+ * Vendor Downmix implementation definition for additional parameters.
+ */
+ 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 {
+ /**
+ * Throw away the extra channels.
+ */
+ STRIP,
+ /**
+ * Mix the extra channels with FL/FR.
+ */
+ FOLD,
+ }
+
+ /**
+ * Type of downmix.
+ */
+ Type type;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl b/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
new file mode 100644
index 0000000..ee5dcad
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ */
+@VintfStability
+union DynamicsProcessing {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ DynamicsProcessing.Tag commonTag;
+ }
+
+ /**
+ * Vendor DynamicsProcessing implementation definition for additional parameters.
+ */
+ 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;
+ }
+
+ /**
+ * Resolution preference definition.
+ */
+ enum ResolutionPreference {
+ /**
+ * Favors frequency domain based implementation.
+ */
+ FAVOR_FREQUENCY_RESOLUTION,
+ /**
+ * Favors tme domain based implementation.
+ */
+ FAVOR_TIME_RESOLUTION,
+ }
+
+ /**
+ * Band enablement configuration.
+ */
+ @VintfStability
+ parcelable BandEnablement {
+ /**
+ * True if multi-band stage is in use.
+ */
+ boolean inUse;
+ /**
+ * Number of bands configured for this stage.
+ */
+ int bandCount;
+ }
+
+ /**
+ * Effect engine configuration. Set the enablement of all stages.
+ */
+ @VintfStability
+ parcelable EngineArchitecture {
+ /**
+ * Resolution preference.
+ */
+ ResolutionPreference resolutionPreference = ResolutionPreference.FAVOR_FREQUENCY_RESOLUTION;
+ /**
+ * Preferred frame duration in milliseconds (ms).
+ */
+ float preferredFrameDurationMs;
+ /**
+ * PreEq stage (Multi-band Equalizer) configuration.
+ */
+ BandEnablement preEqBand;
+ /**
+ * PostEq stage (Multi-band Equalizer) configuration.
+ */
+ BandEnablement postEqBand;
+ /**
+ * MBC stage (Multi-band Compressor) configuration.
+ */
+ BandEnablement mbcBand;
+ /**
+ * True if Limiter stage is in use.
+ */
+ boolean limiterInUse;
+ }
+
+ /**
+ * Band enablement configuration for a specific channel.
+ */
+ @VintfStability
+ parcelable BandChannelConfig {
+ /**
+ * Channel index.
+ */
+ int channel;
+ /**
+ * Channel index.
+ */
+ BandEnablement enablement;
+ }
+
+ /**
+ * Equalizer band configuration for a specific channel and band.
+ */
+ @VintfStability
+ parcelable EqBandConfig {
+ /**
+ * Channel index.
+ */
+ int channel;
+ /**
+ * Band index, must in the range of [0, bandCount-1].
+ */
+ int band;
+ /**
+ * True if EQ stage is enabled.
+ */
+ boolean enable;
+ /**
+ * Topmost frequency number (in Hz) this band will process.
+ */
+ float cutoffFrequency;
+ /**
+ * Gain factor in decibels (dB).
+ */
+ float gain;
+ }
+
+ /**
+ * MBC configuration for a specific channel and band.
+ */
+ @VintfStability
+ parcelable MbcBandConfig {
+ /**
+ * Channel index.
+ */
+ int channel;
+ /**
+ * Band index, must in the range of [0, bandCount-1].
+ */
+ int band;
+ /**
+ * True if MBC stage is enabled.
+ */
+ boolean enable;
+ /**
+ * Topmost frequency number (in Hz) this band will process.
+ */
+ float cutoffFrequencyHz;
+ /**
+ * Gain factor in decibels (dB).
+ */
+ float gainDb;
+ /**
+ * Attack Time for compressor in milliseconds (ms).
+ */
+ float attackTimeMs;
+ /**
+ * Release Time for compressor in milliseconds (ms).
+ */
+ float releaseTimeMs;
+ /**
+ * Compressor ratio (N:1) (input:output).
+ */
+ float ratio;
+ /**
+ * Compressor threshold measured in decibels (dB) from 0 dB Full Scale (dBFS).
+ */
+ float thresholdDb;
+ /**
+ * Width in decibels (dB) around compressor threshold point.
+ */
+ float kneeWidthDb;
+ /**
+ * Noise gate threshold in decibels (dB) from 0 dB Full Scale (dBFS).
+ */
+ float noiseGateThresholdDb;
+ /**
+ * Expander ratio (1:N) (input:output) for signals below the Noise Gate Threshold.
+ */
+ float expanderRatio;
+ /**
+ * Gain applied to the signal BEFORE the compression in dB.
+ */
+ float preGainDb;
+ /**
+ * Gain applied to the signal AFTER compression in dB.
+ */
+ float postGainDb;
+ }
+
+ /**
+ * Limiter configuration for a specific channel.
+ */
+ @VintfStability
+ parcelable LimiterConfig {
+ /**
+ * Channel index.
+ */
+ int channel;
+ /**
+ * True if Limiter stage is enabled.
+ */
+ boolean enable;
+ /**
+ * True if Limiter stage is in use.
+ */
+ boolean inUse;
+ /**
+ * Index of group assigned to this Limiter. Only limiters that share the same linkGroup
+ * index will react together.
+ */
+ int linkGroup;
+ /**
+ * Attack Time for compressor in milliseconds (ms).
+ */
+ float attackTimeMs;
+ /**
+ * Release Time for compressor in milliseconds (ms).
+ */
+ float releaseTimeMs;
+ /**
+ * Compressor ratio (N:1) (input:output).
+ */
+ float ratio;
+ /**
+ * Compressor threshold measured in decibels (dB) from 0 dB Full Scale (dBFS).
+ */
+ float thresholdDb;
+ /**
+ * Gain applied to the signal AFTER compression in dB.
+ */
+ float postGainDb;
+ }
+
+ /**
+ * Effect engine architecture.
+ */
+ EngineArchitecture engineArchitecture;
+ /**
+ * PreEq stage per channel configuration.
+ */
+ BandChannelConfig preEq;
+ /**
+ * PostEq stage per channel configuration.
+ */
+ BandChannelConfig postEq;
+ /**
+ * PreEq stage per band configuration.
+ */
+ EqBandConfig preEqBand;
+ /**
+ * PostEq stage per band configuration.
+ */
+ EqBandConfig postEqBand;
+ /**
+ * MBC stage per channel configuration.
+ */
+ BandChannelConfig mbc;
+ /**
+ * PostEq stage per band configuration.
+ */
+ MbcBandConfig mbcBand;
+ /**
+ * Limiter stage configuration.
+ */
+ LimiterConfig limiter;
+ /**
+ * Input gain factor in decibels (dB). 0 dB means no change in level.
+ */
+ float inputGainDb;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
index 7fe9bb2..79a1c4f 100644
--- a/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
@@ -16,7 +16,7 @@
package android.hardware.audio.effect;
-import android.media.audio.common.AudioProfile;
+import android.hardware.audio.effect.VendorExtension;
/**
* Equalizer specific definitions.
@@ -27,13 +27,18 @@
@VintfStability
union Equalizer {
/**
- * Vendor Equalizer implementation definition for additional parameters.
+ * Effect parameter tag to identify the parameters for getParameter().
*/
@VintfStability
- parcelable VendorExtension {
- ParcelableHolder extension;
+ union Id {
+ int vendorExtensionTag;
+ Equalizer.Tag commonTag;
}
- VendorExtension vendor;
+
+ /**
+ * Vendor Equalizer implementation definition for additional parameters.
+ */
+ VendorExtension vendorExtension;
/**
* Capability MUST be supported by Equalizer implementation.
@@ -58,22 +63,22 @@
}
/**
- * Level setting for each band.
+ * Level setting for each band in millibels.
*/
@VintfStability
parcelable BandLevel {
int index;
- int level;
+ int levelMb;
}
/**
- * Supported minimal and maximal frequency for each band.
+ * Supported minimal and maximal frequency for each band in millihertz.
*/
@VintfStability
parcelable BandFrequency {
int index;
- int min;
- int max;
+ int minMh;
+ int maxMh;
}
/**
diff --git a/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl b/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
new file mode 100644
index 0000000..944155f
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ */
+@VintfStability
+union HapticGenerator {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ HapticGenerator.Tag commonTag;
+ }
+
+ /**
+ * Vendor HapticGenerator implementation definition for additional parameters.
+ */
+ 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 {
+ MUTE = -100,
+ VERY_LOW = -2,
+ LOW = -1,
+ NONE = 0,
+ HIGH = 1,
+ VERY_HIGH = 2,
+ }
+
+ @VintfStability
+ parcelable HapticScale {
+ /**
+ * Audio track ID.
+ */
+ int id;
+ /**
+ * Haptic intensity.
+ */
+ VibratorScale scale = VibratorScale.MUTE;
+ }
+
+ /**
+ * Vibrator information including resonant frequency, Q factor.
+ */
+ @VintfStability
+ parcelable VibratorInformation {
+ /**
+ * Resonant frequency in Hz.
+ */
+ float resonantFrequencyHz;
+ float qFactor;
+ float maxAmplitude;
+ }
+
+ HapticScale hapticScale;
+ VibratorInformation vibratorInfo;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/android/hardware/audio/effect/IEffect.aidl
index 5dd390f..3b957d7 100644
--- a/audio/aidl/android/hardware/audio/effect/IEffect.aidl
+++ b/audio/aidl/android/hardware/audio/effect/IEffect.aidl
@@ -44,13 +44,15 @@
*/
int status;
/**
- * The amount of bytes consumed by the effect instance.
+ * The amount of audio data samples in the floating point format consumed by the effect
+ * instance.
*/
- int fmqByteConsumed;
+ int fmqConsumed;
/**
- * The amount of bytes produced by the effect instance.
+ * The amount of audio data samples in the floating point format produced by the effect
+ * instance.
*/
- int fmqByteProduced;
+ int fmqProduced;
}
/**
@@ -65,11 +67,11 @@
/**
* Message queue for input data buffer.
*/
- MQDescriptor<byte, SynchronizedReadWrite> inputDataMQ;
+ MQDescriptor<float, SynchronizedReadWrite> inputDataMQ;
/**
* Message queue for output data buffer.
*/
- MQDescriptor<byte, SynchronizedReadWrite> outputDataMQ;
+ MQDescriptor<float, SynchronizedReadWrite> outputDataMQ;
}
/**
@@ -79,13 +81,15 @@
* the effect instance must be able to handle all IEffect interface calls.
*
* @param common Parameters which MUST pass from client at open time.
+ * @param specific Effect specific parameters which can optional pass from client at open time.
*
* @throws EX_ILLEGAL_ARGUMENT if the effect instance receive unsupported command.
* @throws a EX_UNSUPPORTED_OPERATION if device capability/resource is not enough or system
* failure happens.
* @note Open an already-opened effect instance should do nothing and should not throw an error.
*/
- OpenEffectReturn open(in Parameter.Common common, in Parameter.Specific specific);
+ OpenEffectReturn open(
+ in Parameter.Common common, in @nullable Parameter.Specific specific);
/**
* Called by the client to close the effect instance, processing thread should be destroyed and
diff --git a/audio/aidl/android/hardware/audio/effect/IFactory.aidl b/audio/aidl/android/hardware/audio/effect/IFactory.aidl
index e56c24f..5943359 100644
--- a/audio/aidl/android/hardware/audio/effect/IFactory.aidl
+++ b/audio/aidl/android/hardware/audio/effect/IFactory.aidl
@@ -39,11 +39,14 @@
* null, used as a filter for effect type UUIDs.
* @param implementation Indicates the particular implementation of the effect in that type.
* This is an optional parameter, pass in null if this parameter is not necessary; if
- * non null, used as a filter for effect type UUIDs.
+ * non null, used as a filter for effect implementation UUIDs.
+ * @param proxy Indicates the proxy UUID filter to query.
+ * This is an optional parameter, pass in null if this parameter is not necessary; if
+ * non null, used as a filter for effect proxy UUIDs.
* @return List of effect identities supported and filtered by type/implementation UUID.
*/
- Descriptor.Identity[] queryEffects(
- in @nullable AudioUuid type, in @nullable AudioUuid implementation);
+ Descriptor.Identity[] queryEffects(in @nullable AudioUuid type,
+ in @nullable AudioUuid implementation, in @nullable AudioUuid proxy);
/**
* Return a list of defined processings, with the optional filter by Processing type.
diff --git a/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl b/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
new file mode 100644
index 0000000..0441f10
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ */
+@VintfStability
+union LoudnessEnhancer {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ LoudnessEnhancer.Tag commonTag;
+ }
+
+ /**
+ * Vendor LoudnessEnhancer implementation definition for additional parameters.
+ */
+ 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.
+ */
+ int gainMb;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
index 739c9ff..e7d3d5e 100644
--- a/audio/aidl/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
@@ -16,9 +16,19 @@
package android.hardware.audio.effect;
+import android.hardware.audio.effect.BassBoost;
+import android.hardware.audio.effect.Downmix;
+import android.hardware.audio.effect.DynamicsProcessing;
import android.hardware.audio.effect.Equalizer;
+import android.hardware.audio.effect.HapticGenerator;
+import android.hardware.audio.effect.LoudnessEnhancer;
+import android.hardware.audio.effect.Reverb;
+import android.hardware.audio.effect.VendorExtension;
+import android.hardware.audio.effect.Virtualizer;
+import android.hardware.audio.effect.Visualizer;
+import android.hardware.audio.effect.Volume;
import android.media.audio.common.AudioConfig;
-import android.media.audio.common.AudioDeviceType;
+import android.media.audio.common.AudioDeviceDescription;
import android.media.audio.common.AudioMode;
import android.media.audio.common.AudioSource;
@@ -28,9 +38,8 @@
* There are three groups of parameters:
* 1. Common parameters are essential parameters, MUST pass to effects at open() interface.
* 2. Parameters defined for a specific effect type.
- * 3. Extension parameters for vendor.
+ * 3. Extension parameters ParcelableHolder can be used for vendor effect definition.
*
- * For all supported parameter, implementation MUST support both set and get.
*/
@VintfStability
union Parameter {
@@ -44,17 +53,38 @@
@VintfStability
union Id {
/**
- * Common parameter tag.
+ * Parameter tag defined for vendor effects. Use int here so there is flexibility for vendor
+ * to define different tag.
*/
- int commonTag;
+ int vendorEffectTag;
/**
- * Vendor defined parameter tag.
+ * Parameter tag defined for nested parameters. Can be used to get any parameter defined in
+ * nested Union structure.
+ *
+ * Example:
+ * To get BassBoost strength in param from effectInstance:
+ * IEffect effectInstance;
+ * Parameter param;
+ * BassBoost::Id bassId = BassBoost::Id::make<BassBoost::Id::tag>(BassBoost::strengthPm);
+ * Parameter::Id id = Parameter::Id::make<Parameter::Id::bassBoostTag>(bassId);
+ * effectInstance.getParameter(id, ¶m);
+ *
*/
- int vendorTag;
+ BassBoost.Id bassBoostTag;
+ Downmix.Id downmixTag;
+ DynamicsProcessing.Id dynamicsProcessingTag;
+ Equalizer.Id equalizerTag;
+ HapticGenerator.Id hapticGeneratorTag;
+ LoudnessEnhancer.Id loudnessEnhancerTag;
+ Reverb.Id reverbTag;
+ Virtualizer.Id virtualizerTag;
+ Visualizer.Id visualizerTag;
+ Volume.Id volumeTag;
/**
- * Specific effect parameter tag.
+ * Non-nested parameter tag. Can be used to get any parameter defined in Union Parameter
+ * directly.
*/
- Specific.Id specificId;
+ Parameter.Tag commonTag;
}
/**
@@ -85,7 +115,7 @@
* Used by audio framework to set the device type to effect engine.
* Effect must implement setParameter(device) if Flags.deviceIndication set to true.
*/
- AudioDeviceType device;
+ AudioDeviceDescription deviceDescription;
/**
* Used by audio framework to set the audio mode to effect engine.
* Effect must implement setParameter(mode) if Flags.audioModeIndication set to true.
@@ -101,7 +131,7 @@
* The volume gain for left and right channel, left and right equals to same value if it's mono.
*/
@VintfStability
- parcelable Volume {
+ parcelable VolumeStereo {
float left;
float right;
}
@@ -109,38 +139,24 @@
* Used by audio framework to delegate volume control to effect engine.
* Effect must implement setParameter(volume) if Flags.volume set to Volume.IND.
*/
- Volume volume;
-
- /**
- * Used by audio framework to delegate offload information to effect engine.
- * Effect must implement setParameter(offload) if Flags.offloadSupported set to true.
- */
- boolean offload;
-
- /**
- * Parameters for vendor extension effect implementation usage.
- */
- @VintfStability
- parcelable VendorEffectParameter {
- ParcelableHolder extension;
- }
- VendorEffectParameter vendorEffect;
+ VolumeStereo volumeStereo;
/**
* Parameters MUST be supported by a Specific type of effect.
*/
@VintfStability
union Specific {
- @VintfStability
- union Id {
- /**
- * Equalizer.Tag to identify the parameters in Equalizer.
- */
- Equalizer.Tag equalizerTag = Equalizer.Tag.vendor;
- }
- Id id;
-
+ VendorExtension vendorEffect;
+ BassBoost bassBoost;
+ Downmix downmix;
+ DynamicsProcessing dynamicsProcessing;
Equalizer equalizer;
+ LoudnessEnhancer loudnessEnhancer;
+ HapticGenerator hapticGenerator;
+ Reverb reverb;
+ Virtualizer virtualizer;
+ Visualizer visualizer;
+ Volume volume;
}
Specific specific;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Reverb.aidl b/audio/aidl/android/hardware/audio/effect/Reverb.aidl
new file mode 100644
index 0000000..f60c2ea
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/Reverb.aidl
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * Reverb specific definitions.
+ *
+ * All parameters defined in union Reverb must be gettable and settable. The capabilities defined in
+ * Reverb.Capability can only acquired with IEffect.getDescriptor() and not settable.
+ */
+@VintfStability
+union Reverb {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ Reverb.Tag commonTag;
+ }
+
+ /**
+ * Vendor Reverb implementation definition for additional parameters.
+ */
+ VendorExtension vendor;
+
+ /**
+ * Capability supported by effect implementation.
+ */
+ @VintfStability
+ parcelable Capability {
+ VendorExtension extension;
+
+ /**
+ * Max decay time supported in millisecond.
+ */
+ int maxDecayTimeMs;
+ }
+
+ /**
+ * Room level apply to the reverb effect in millibels.
+ */
+ int roomLevelMb;
+ /**
+ * Room HF level apply to the reverb effect in millibels.
+ */
+ int roomHfLevelMb;
+ /**
+ * Delay time apply to the reverb effect in milliseconds.
+ */
+ int decayTimeMs;
+ /**
+ * HF decay ratio in permilles.
+ */
+ int decayHfRatioPm;
+ /**
+ * Reverb level in millibels.
+ */
+ int levelMb;
+ /**
+ * Reverb delay in milliseconds.
+ */
+ int delayMs;
+ /**
+ * Diffusion in permilles.
+ */
+ int diffusionPm;
+ /**
+ * Density in permilles.
+ */
+ int densityPm;
+ /**
+ * Bypass reverb and copy input to output if set to true.
+ */
+ boolean bypass;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/VendorExtension.aidl b/audio/aidl/android/hardware/audio/effect/VendorExtension.aidl
new file mode 100644
index 0000000..c60f01a
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/VendorExtension.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+/**
+ * Vendor exntension implementation definition, can be used for additional parameters.
+ */
+@VintfStability
+parcelable VendorExtension {
+ ParcelableHolder extension;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl b/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
new file mode 100644
index 0000000..9d039bc
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ */
+@VintfStability
+union Virtualizer {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ Virtualizer.Tag commonTag;
+ }
+
+ /**
+ * Vendor Virtualizer implementation definition for additional parameters.
+ */
+ VendorExtension vendor;
+
+ /**
+ * 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;
+ /**
+ * 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 valid range for strength is [0, 1000].
+ */
+ int strengthPm;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Visualizer.aidl b/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
new file mode 100644
index 0000000..4c1b71a
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ *
+ */
+@VintfStability
+union Visualizer {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ GetOnlyParameters.Tag getOnlyParamTag;
+ SetOnlyParameters.Tag setOnlyParamTag;
+ Visualizer.Tag commonTag;
+ }
+ Id id;
+
+ /**
+ * Vendor Visualizer implementation definition for additional parameters.
+ */
+ 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.
+ */
+ CaptureSizeRange captureSizeRange;
+ }
+
+ /**
+ * Supported capture size range in bytes.
+ */
+ @VintfStability
+ parcelable CaptureSizeRange {
+ int minBytes;
+ int maxBytes;
+ }
+
+ /**
+ * Type of scaling applied on the captured visualization data.
+ */
+ @VintfStability
+ enum ScalingMode {
+ /**
+ * Defines a capture mode where amplification is applied based on the content of the
+ * captured data. This is the default Visualizer mode, and is suitable for music
+ * visualization.
+ */
+ NORMALIZED = 0,
+ /**
+ * Defines a capture mode where the playback volume will affect (scale) the range of the
+ * captured data. A low playback volume will lead to low sample and fft values, and
+ * vice-versa.
+ */
+ AS_PLAYED,
+ }
+
+ /**
+ * Measurement modes to be performed.
+ */
+ @VintfStability
+ enum MeasurementMode {
+ /**
+ * No measurements are performed.
+ */
+ NONE = 0,
+ /**
+ * Defines a measurement mode which computes the peak and RMS value in mB below the "full
+ * scale", where 0mB is normally the maximum sample value (but see the note below). Minimum
+ * value depends on the resolution of audio samples used by the audio framework. The value
+ * of -9600mB is the minimum value for 16-bit audio systems and -14400mB or below for "high
+ * resolution" systems. Values for peak and RMS can be retrieved with {@link
+ * #getMeasurementPeakRms(MeasurementPeakRms)}.
+ */
+ PEAK_RMS,
+ }
+
+ /**
+ * Any parameter defined in this union must be gettable via getParameter(), but must not
+ * settable.
+ */
+ @VintfStability
+ union GetOnlyParameters {
+ /**
+ * Get the current measurements.
+ */
+ @VintfStability
+ parcelable Measurement {
+ int rms;
+ int peak;
+ }
+ Measurement measurement;
+
+ /**
+ * Gets the latest PCM capture, size of returned vector equals to @c captureSize.
+ */
+ byte[] captureBytes;
+ }
+ GetOnlyParameters getOnlyParameters;
+
+ /**
+ * Any parameter defined in this union must be settable via setParameter(), but must not
+ * gettable.
+ */
+ @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;
+
+ /**
+ * Current capture size in bytes. The capture size must be a power of 2 in the range
+ * Capability.captureSizeRange.
+ */
+ int captureSizeBytes;
+ /**
+ * Visualizer capture mode
+ */
+ ScalingMode scalingMode;
+ /**
+ * Visualizer measurement mode.
+ */
+ MeasurementMode measurementMode;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Volume.aidl b/audio/aidl/android/hardware/audio/effect/Volume.aidl
new file mode 100644
index 0000000..a3ce2f6
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/Volume.aidl
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * 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.
+ */
+@VintfStability
+union Volume {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ Volume.Tag commonTag;
+ }
+
+ /**
+ * Vendor Volume implementation definition for additional parameters.
+ */
+ 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;
+
+ /**
+ * Volume strength supported in dB.
+ */
+ int maxLevel;
+ }
+
+ /**
+ * Current level in dB.
+ */
+ int levelDb;
+ /**
+ * Mute volume if true, when volume set to mute, the current level still saved and take effect
+ * when unmute.
+ */
+ boolean mute;
+}
diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp
index e64b90c..d34d68c 100644
--- a/audio/aidl/default/Android.bp
+++ b/audio/aidl/default/Android.bp
@@ -68,10 +68,20 @@
],
vendor: true,
shared_libs: [
+ "libaudioaidlcommon",
"libbase",
"libbinder_ndk",
+ "libcutils",
+ "libfmq",
+ "liblog",
+ "libutils",
+ "android.hardware.common-V2-ndk",
+ "android.hardware.common.fmq-V1-ndk",
"android.hardware.audio.effect-V1-ndk",
- "libequalizer",
+ ],
+ header_libs: [
+ "libaudioaidl_headers",
+ "libsystem_headers",
],
cflags: [
"-Wall",
@@ -81,24 +91,12 @@
],
}
-cc_library_static {
- name: "libaudioeffectserviceexampleimpl",
- defaults: ["aidlaudioeffectservice_defaults"],
- export_include_dirs: ["include"],
- srcs: [
- "EffectFactory.cpp",
- ],
- header_libs: [
- "libsystem_headers",
- ],
- visibility: [
- ":__subpackages__",
- ],
-}
-
filegroup {
name: "effectCommonFile",
- srcs: ["EffectThread.cpp"],
+ srcs: [
+ "EffectThread.cpp",
+ "EffectImpl.cpp",
+ ],
}
cc_binary {
@@ -107,10 +105,21 @@
init_rc: ["android.hardware.audio.effect.service-aidl.example.rc"],
vintf_fragments: ["android.hardware.audio.effect.service-aidl.xml"],
defaults: ["aidlaudioeffectservice_defaults"],
- static_libs: [
- "libaudioeffectserviceexampleimpl",
+ shared_libs: [
+ "libbassboostsw",
+ "libdynamicsprocessingsw",
+ "libequalizersw",
+ "libhapticgeneratorsw",
+ "libloudnessenhancersw",
+ "libreverbsw",
+ "libvirtualizersw",
+ "libvisualizersw",
+ "libvolumesw",
],
- srcs: ["EffectMain.cpp"],
+ srcs: [
+ "EffectMain.cpp",
+ "EffectFactory.cpp",
+ ],
}
cc_library_headers {
diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp
index 8e107a2..e03dda3 100644
--- a/audio/aidl/default/EffectFactory.cpp
+++ b/audio/aidl/default/EffectFactory.cpp
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
#include <dlfcn.h>
+#include "effect-impl/EffectTypes.h"
#include "effect-impl/EffectUUID.h"
#include "effectFactory-impl/EffectFactory.h"
@@ -26,27 +27,21 @@
namespace aidl::android::hardware::audio::effect {
Factory::Factory() {
- std::function<void(void*)> dlClose = [](void* handle) -> void {
- if (handle && dlclose(handle)) {
- LOG(ERROR) << "dlclose failed " << dlerror();
- }
- };
- // TODO: implement this with audio_effect.xml.
- auto libHandle =
- std::unique_ptr<void, decltype(dlClose)>{dlopen("libequalizer.so", RTLD_LAZY), dlClose};
- if (!libHandle) {
- LOG(ERROR) << __func__ << ": dlopen failed, err: " << dlerror();
- return;
- }
-
- LOG(DEBUG) << __func__ << " dlopen uuid: " << EqualizerSwImplUUID.toString() << " handle "
- << libHandle;
- mEffectLibMap.insert({EqualizerSwImplUUID, std::make_pair(std::move(libHandle), nullptr)});
-
- Descriptor::Identity id;
- id.type = EqualizerTypeUUID;
- id.uuid = EqualizerSwImplUUID;
- mIdentityList.push_back(id);
+ // TODO: get list of library UUID and name from audio_effect.xml.
+ openEffectLibrary(EqualizerTypeUUID, EqualizerSwImplUUID, std::nullopt, "libequalizersw.so");
+ openEffectLibrary(EqualizerTypeUUID, EqualizerBundleImplUUID, std::nullopt, "libbundleaidl.so");
+ openEffectLibrary(BassBoostTypeUUID, BassBoostSwImplUUID, std::nullopt, "libbassboostsw.so");
+ openEffectLibrary(DynamicsProcessingTypeUUID, DynamicsProcessingSwImplUUID, std::nullopt,
+ "libdynamicsprocessingsw.so");
+ openEffectLibrary(HapticGeneratorTypeUUID, HapticGeneratorSwImplUUID, std::nullopt,
+ "libhapticgeneratorsw.so");
+ openEffectLibrary(LoudnessEnhancerTypeUUID, LoudnessEnhancerSwImplUUID, std::nullopt,
+ "libloudnessenhancersw.so");
+ openEffectLibrary(ReverbTypeUUID, ReverbSwImplUUID, std::nullopt, "libreverbsw.so");
+ openEffectLibrary(VirtualizerTypeUUID, VirtualizerSwImplUUID, std::nullopt,
+ "libvirtualizersw.so");
+ openEffectLibrary(VisualizerTypeUUID, VisualizerSwImplUUID, std::nullopt, "libvisualizersw.so");
+ openEffectLibrary(VolumeTypeUUID, VolumeSwImplUUID, std::nullopt, "libvolumesw.so");
}
Factory::~Factory() {
@@ -64,12 +59,16 @@
ndk::ScopedAStatus Factory::queryEffects(const std::optional<AudioUuid>& in_type_uuid,
const std::optional<AudioUuid>& in_impl_uuid,
+ const std::optional<AudioUuid>& in_proxy_uuid,
std::vector<Descriptor::Identity>* _aidl_return) {
- std::copy_if(mIdentityList.begin(), mIdentityList.end(), std::back_inserter(*_aidl_return),
- [&](auto& desc) {
- return (!in_type_uuid.has_value() || in_type_uuid.value() == desc.type) &&
- (!in_impl_uuid.has_value() || in_impl_uuid.value() == desc.uuid);
- });
+ std::copy_if(
+ mIdentityList.begin(), mIdentityList.end(), std::back_inserter(*_aidl_return),
+ [&](auto& desc) {
+ return (!in_type_uuid.has_value() || in_type_uuid.value() == desc.type) &&
+ (!in_impl_uuid.has_value() || in_impl_uuid.value() == desc.uuid) &&
+ (!in_proxy_uuid.has_value() ||
+ (desc.proxy.has_value() && in_proxy_uuid.value() == desc.proxy.value()));
+ });
return ndk::ScopedAStatus::ok();
}
@@ -96,43 +95,37 @@
ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid,
std::shared_ptr<IEffect>* _aidl_return) {
LOG(DEBUG) << __func__ << ": UUID " << in_impl_uuid.toString();
- if (in_impl_uuid == EqualizerSwImplUUID) {
- if (mEffectLibMap.count(in_impl_uuid)) {
- auto& lib = mEffectLibMap[in_impl_uuid];
- // didn't do dlsym yet
- if (nullptr == lib.second) {
- void* libHandle = lib.first.get();
- struct effect_interface_s intf = {
- .createEffectFunc = (EffectCreateFunctor)dlsym(libHandle, "createEffect"),
- .destroyEffectFunc =
- (EffectDestroyFunctor)dlsym(libHandle, "destroyEffect")};
- auto dlInterface = std::make_unique<struct effect_interface_s>(intf);
- if (!dlInterface->createEffectFunc || !dlInterface->destroyEffectFunc) {
- LOG(ERROR) << __func__
- << ": create or destroy symbol not exist in library: " << libHandle
- << "!";
- return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED);
- }
- lib.second = std::move(dlInterface);
- }
-
- auto& libInterface = lib.second;
- std::shared_ptr<IEffect> effectSp;
- RETURN_IF_BINDER_EXCEPTION(libInterface->createEffectFunc(&effectSp));
- if (!effectSp) {
- LOG(ERROR) << __func__ << ": library created null instance without return error!";
+ if (mEffectLibMap.count(in_impl_uuid)) {
+ auto& lib = mEffectLibMap[in_impl_uuid];
+ // didn't do dlsym yet
+ if (nullptr == lib.second) {
+ void* libHandle = lib.first.get();
+ auto dlInterface = std::make_unique<struct effect_dl_interface_s>();
+ dlInterface->createEffectFunc = (EffectCreateFunctor)dlsym(libHandle, "createEffect");
+ dlInterface->destroyEffectFunc =
+ (EffectDestroyFunctor)dlsym(libHandle, "destroyEffect");
+ if (!dlInterface->createEffectFunc || !dlInterface->destroyEffectFunc) {
+ LOG(ERROR) << __func__
+ << ": create or destroy symbol not exist in library: " << libHandle
+ << " with dlerror: " << dlerror();
return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED);
}
- *_aidl_return = effectSp;
- mEffectUuidMap[std::weak_ptr<IEffect>(effectSp)] = in_impl_uuid;
- LOG(DEBUG) << __func__ << ": instance " << effectSp.get() << " created successfully";
- return ndk::ScopedAStatus::ok();
- } else {
- LOG(ERROR) << __func__ << ": library doesn't exist";
- return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ lib.second = std::move(dlInterface);
}
+
+ auto& libInterface = lib.second;
+ std::shared_ptr<IEffect> effectSp;
+ RETURN_IF_BINDER_EXCEPTION(libInterface->createEffectFunc(&in_impl_uuid, &effectSp));
+ if (!effectSp) {
+ LOG(ERROR) << __func__ << ": library created null instance without return error!";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED);
+ }
+ *_aidl_return = effectSp;
+ mEffectUuidMap[std::weak_ptr<IEffect>(effectSp)] = in_impl_uuid;
+ LOG(DEBUG) << __func__ << ": instance " << effectSp.get() << " created successfully";
+ return ndk::ScopedAStatus::ok();
} else {
- LOG(ERROR) << __func__ << ": UUID not supported";
+ LOG(ERROR) << __func__ << ": library doesn't exist";
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
return ndk::ScopedAStatus::ok();
@@ -179,4 +172,34 @@
return status;
}
+void Factory::openEffectLibrary(const AudioUuid& type, const AudioUuid& impl,
+ const std::optional<AudioUuid>& proxy, const std::string& libName) {
+ std::function<void(void*)> dlClose = [](void* handle) -> void {
+ if (handle && dlclose(handle)) {
+ LOG(ERROR) << "dlclose failed " << dlerror();
+ }
+ };
+
+ auto libHandle =
+ std::unique_ptr<void, decltype(dlClose)>{dlopen(libName.c_str(), RTLD_LAZY), dlClose};
+ if (!libHandle) {
+ LOG(ERROR) << __func__ << ": dlopen failed, err: " << dlerror();
+ return;
+ }
+
+ LOG(DEBUG) << __func__ << " dlopen lib:" << libName << " for uuid:\ntype:" << type.toString()
+ << "\nimpl:" << impl.toString()
+ << "\nproxy:" << (proxy.has_value() ? proxy.value().toString() : "null")
+ << "\nhandle:" << libHandle;
+ mEffectLibMap.insert({impl, std::make_pair(std::move(libHandle), nullptr)});
+
+ Descriptor::Identity id;
+ id.type = type;
+ id.uuid = impl;
+ if (proxy.has_value()) {
+ id.proxy = proxy.value();
+ }
+ mIdentityList.push_back(id);
+}
+
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp
new file mode 100644
index 0000000..2754bb6
--- /dev/null
+++ b/audio/aidl/default/EffectImpl.cpp
@@ -0,0 +1,256 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AHAL_EffectImpl"
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectTypes.h"
+#include "include/effect-impl/EffectTypes.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus EffectImpl::open(const Parameter::Common& common,
+ const std::optional<Parameter::Specific>& specific,
+ OpenEffectReturn* ret) {
+ LOG(DEBUG) << __func__;
+ {
+ std::lock_guard lg(mMutex);
+ RETURN_OK_IF(mState != State::INIT);
+ mContext = createContext(common);
+ RETURN_IF(!mContext, EX_ILLEGAL_ARGUMENT, "createContextFailed");
+ setContext(mContext);
+ }
+
+ RETURN_IF_ASTATUS_NOT_OK(setParameterCommon(common), "setCommParamErr");
+ if (specific.has_value()) {
+ RETURN_IF_ASTATUS_NOT_OK(setParameterSpecific(specific.value()), "setSpecParamErr");
+ }
+
+ RETURN_IF(createThread(LOG_TAG) != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
+ "FailedToCreateWorker");
+
+ {
+ std::lock_guard lg(mMutex);
+ mContext->dupeFmq(ret);
+ mState = State::IDLE;
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus EffectImpl::close() {
+ std::lock_guard lg(mMutex);
+ RETURN_OK_IF(mState == State::INIT);
+ RETURN_IF(mState == State::PROCESSING, EX_ILLEGAL_STATE, "closeAtProcessing");
+
+ // stop the worker thread, ignore the return code
+ RETURN_IF(destroyThread() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
+ "FailedToDestroyWorker");
+ RETURN_IF(releaseContext() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
+ "FailedToCreateWorker");
+ mState = State::INIT;
+ LOG(DEBUG) << __func__;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) {
+ LOG(DEBUG) << __func__ << " with: " << param.toString();
+
+ auto tag = param.getTag();
+ switch (tag) {
+ case Parameter::common:
+ case Parameter::deviceDescription:
+ case Parameter::mode:
+ case Parameter::source:
+ FALLTHROUGH_INTENDED;
+ case Parameter::volumeStereo:
+ return setParameterCommon(param);
+ case Parameter::specific: {
+ return setParameterSpecific(param.get<Parameter::specific>());
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupportedParameterTag " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "ParameterNotSupported");
+ }
+ }
+}
+
+ndk::ScopedAStatus EffectImpl::getParameter(const Parameter::Id& id, Parameter* param) {
+ LOG(DEBUG) << __func__ << id.toString();
+ auto tag = id.getTag();
+ switch (tag) {
+ case Parameter::Id::commonTag: {
+ RETURN_IF_ASTATUS_NOT_OK(getParameterCommon(id.get<Parameter::Id::commonTag>(), param),
+ "CommonParamNotSupported");
+ break;
+ }
+ case Parameter::Id::vendorEffectTag: {
+ LOG(DEBUG) << __func__ << " noop for vendor tag";
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "vendortagNotSupported");
+ }
+ default: {
+ Parameter::Specific specific;
+ RETURN_IF_ASTATUS_NOT_OK(getParameterSpecific(id, &specific), "SpecParamNotSupported");
+ param->set<Parameter::specific>(specific);
+ break;
+ }
+ }
+ LOG(DEBUG) << __func__ << param->toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus EffectImpl::setParameterCommon(const Parameter& param) {
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+ auto tag = param.getTag();
+ switch (tag) {
+ case Parameter::common:
+ RETURN_IF(mContext->setCommon(param.get<Parameter::common>()) != RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setCommFailed");
+ break;
+ case Parameter::deviceDescription:
+ RETURN_IF(mContext->setOutputDevice(param.get<Parameter::deviceDescription>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setDeviceFailed");
+ break;
+ case Parameter::mode:
+ RETURN_IF(mContext->setAudioMode(param.get<Parameter::mode>()) != RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setModeFailed");
+ break;
+ case Parameter::source:
+ RETURN_IF(mContext->setAudioSource(param.get<Parameter::source>()) != RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setSourceFailed");
+ break;
+ case Parameter::volumeStereo:
+ RETURN_IF(mContext->setVolumeStereo(param.get<Parameter::volumeStereo>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setVolumeStereoFailed");
+ break;
+ default: {
+ LOG(ERROR) << __func__ << " unsupportedParameterTag " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "commonParamNotSupported");
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus EffectImpl::getParameterCommon(const Parameter::Tag& tag, Parameter* param) {
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+ switch (tag) {
+ case Parameter::common: {
+ param->set<Parameter::common>(mContext->getCommon());
+ break;
+ }
+ case Parameter::deviceDescription: {
+ param->set<Parameter::deviceDescription>(mContext->getOutputDevice());
+ break;
+ }
+ case Parameter::mode: {
+ param->set<Parameter::mode>(mContext->getAudioMode());
+ break;
+ }
+ case Parameter::source: {
+ param->set<Parameter::source>(mContext->getAudioSource());
+ break;
+ }
+ case Parameter::volumeStereo: {
+ param->set<Parameter::volumeStereo>(mContext->getVolumeStereo());
+ break;
+ }
+ default: {
+ LOG(DEBUG) << __func__ << " unsupported tag " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "tagNotSupported");
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus EffectImpl::getState(State* state) {
+ std::lock_guard lg(mMutex);
+ *state = mState;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus EffectImpl::command(CommandId command) {
+ std::lock_guard lg(mMutex);
+ LOG(DEBUG) << __func__ << ": receive command: " << toString(command) << " at state "
+ << toString(mState);
+ RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "CommandStateError");
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ switch (command) {
+ case CommandId::START:
+ RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "instanceNotOpen");
+ RETURN_OK_IF(mState == State::PROCESSING);
+ RETURN_IF_ASTATUS_NOT_OK(commandStart(), "commandStartFailed");
+ mState = State::PROCESSING;
+ startThread();
+ return ndk::ScopedAStatus::ok();
+ case CommandId::STOP:
+ RETURN_OK_IF(mState == State::IDLE);
+ mState = State::IDLE;
+ RETURN_IF_ASTATUS_NOT_OK(commandStop(), "commandStopFailed");
+ stopThread();
+ return ndk::ScopedAStatus::ok();
+ case CommandId::RESET:
+ RETURN_OK_IF(mState == State::IDLE);
+ mState = State::IDLE;
+ RETURN_IF_ASTATUS_NOT_OK(commandStop(), "commandStopFailed");
+ stopThread();
+ mContext->resetBuffer();
+ return ndk::ScopedAStatus::ok();
+ default:
+ LOG(ERROR) << __func__ << " instance still processing";
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "CommandIdNotSupported");
+ }
+ LOG(DEBUG) << __func__ << " transfer to state: " << toString(mState);
+ return ndk::ScopedAStatus::ok();
+}
+
+void EffectImpl::cleanUp() {
+ command(CommandId::STOP);
+ close();
+}
+
+IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size_t produced) {
+ IEffect::Status ret;
+ ret.status = status;
+ ret.fmqConsumed = consumed;
+ ret.fmqProduced = produced;
+ return ret;
+}
+
+// A placeholder processing implementation to copy samples from input to output
+IEffect::Status EffectImpl::effectProcessImpl(float* in, float* out, int processSamples) {
+ // lock before access context/parameters
+ std::lock_guard lg(mMutex);
+ IEffect::Status status = {EX_NULL_POINTER, 0, 0};
+ RETURN_VALUE_IF(!mContext, status, "nullContext");
+ auto frameSize = mContext->getInputFrameSize();
+ RETURN_VALUE_IF(0 == frameSize, status, "frameSizeIs0");
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << processSamples
+ << " frames " << processSamples * sizeof(float) / frameSize;
+ for (int i = 0; i < processSamples; i++) {
+ *out++ = *in++;
+ }
+ LOG(DEBUG) << __func__ << " done processing " << processSamples << " samples";
+ return {STATUS_OK, processSamples, processSamples};
+}
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/bassboost/Android.bp b/audio/aidl/default/bassboost/Android.bp
new file mode 100644
index 0000000..f22eb95
--- /dev/null
+++ b/audio/aidl/default/bassboost/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libbassboostsw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "BassBoostSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/bassboost/BassBoostSw.cpp b/audio/aidl/default/bassboost/BassBoostSw.cpp
new file mode 100644
index 0000000..3c39824
--- /dev/null
+++ b/audio/aidl/default/bassboost/BassBoostSw.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_BassBoostSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "BassBoostSw.h"
+
+using aidl::android::hardware::audio::effect::BassBoostSw;
+using aidl::android::hardware::audio::effect::BassBoostSwImplUUID;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != BassBoostSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<BassBoostSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus BassBoostSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BassBoostSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::bassBoost != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::bassBoost>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BassBoostSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::bassBoostTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::bassBoost>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> BassBoostSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<BassBoostSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode BassBoostSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status BassBoostSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/bassboost/BassBoostSw.h b/audio/aidl/default/bassboost/BassBoostSw.h
new file mode 100644
index 0000000..b44e968
--- /dev/null
+++ b/audio/aidl/default/bassboost/BassBoostSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class BassBoostSwContext : public EffectContext {
+ public:
+ BassBoostSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class BassBoostSw : public EffectImpl {
+ public:
+ BassBoostSw() { LOG(DEBUG) << __func__; }
+ ~BassBoostSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<BassBoostSwContext> mContext;
+ /* capabilities */
+ const BassBoost::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = BassBoostTypeUUID,
+ .uuid = BassBoostSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "BassBoostSw"},
+ .capability = Capability::make<Capability::bassBoost>(kCapability)};
+
+ /* parameters */
+ BassBoost mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/dynamicProcessing/Android.bp b/audio/aidl/default/dynamicProcessing/Android.bp
new file mode 100644
index 0000000..3697ba3
--- /dev/null
+++ b/audio/aidl/default/dynamicProcessing/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libdynamicsprocessingsw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "DynamicsProcessingSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
new file mode 100644
index 0000000..52403e1
--- /dev/null
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_DynamicsProcessingSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "DynamicsProcessingSw.h"
+
+using aidl::android::hardware::audio::effect::DynamicsProcessingSw;
+using aidl::android::hardware::audio::effect::DynamicsProcessingSwImplUUID;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != DynamicsProcessingSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<DynamicsProcessingSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus DynamicsProcessingSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus DynamicsProcessingSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::dynamicsProcessing != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::dynamicsProcessing>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus DynamicsProcessingSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::dynamicsProcessingTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::dynamicsProcessing>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> DynamicsProcessingSw::createContext(
+ const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<DynamicsProcessingSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode DynamicsProcessingSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status DynamicsProcessingSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
new file mode 100644
index 0000000..ef94e32
--- /dev/null
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class DynamicsProcessingSwContext : public EffectContext {
+ public:
+ DynamicsProcessingSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class DynamicsProcessingSw : public EffectImpl {
+ public:
+ DynamicsProcessingSw() { LOG(DEBUG) << __func__; }
+ ~DynamicsProcessingSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<DynamicsProcessingSwContext> mContext;
+ /* capabilities */
+ const DynamicsProcessing::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = DynamicsProcessingTypeUUID,
+ .uuid = DynamicsProcessingSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "DynamicsProcessingSw"},
+ .capability = Capability::make<Capability::dynamicsProcessing>(kCapability)};
+
+ /* parameters */
+ DynamicsProcessing mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/equalizer/Android.bp b/audio/aidl/default/equalizer/Android.bp
index 2a2ddbc..69d7450 100644
--- a/audio/aidl/default/equalizer/Android.bp
+++ b/audio/aidl/default/equalizer/Android.bp
@@ -24,15 +24,9 @@
}
cc_library_shared {
- name: "libequalizer",
- vendor: true,
- shared_libs: [
- "libaudioaidlcommon",
- "libbase",
- "android.hardware.common-V2-ndk",
- ],
+ name: "libequalizersw",
defaults: [
- "aidlaudioservice_defaults",
+ "aidlaudioeffectservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_effect_ndk_shared",
],
@@ -40,12 +34,6 @@
"Equalizer.cpp",
":effectCommonFile",
],
- cflags: [
- "-Wall",
- "-Wextra",
- "-Werror",
- "-Wthread-safety",
- ],
visibility: [
"//hardware/interfaces/audio/aidl/default",
],
diff --git a/audio/aidl/default/equalizer/Equalizer.cpp b/audio/aidl/default/equalizer/Equalizer.cpp
index 43fa206..0e07d39 100644
--- a/audio/aidl/default/equalizer/Equalizer.cpp
+++ b/audio/aidl/default/equalizer/Equalizer.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <cstddef>
#define LOG_TAG "AHAL_EqualizerSw"
#include <Utils.h>
#include <algorithm>
@@ -24,11 +25,18 @@
#include "equalizer-impl/EqualizerSw.h"
-using android::hardware::audio::common::getFrameSizeInBytes;
+using aidl::android::hardware::audio::effect::EqualizerSw;
+using aidl::android::hardware::audio::effect::EqualizerSwImplUUID;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::media::audio::common::AudioUuid;
-namespace aidl::android::hardware::audio::effect {
-
-extern "C" binder_exception_t createEffect(std::shared_ptr<IEffect>* instanceSpp) {
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != EqualizerSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
if (instanceSpp) {
*instanceSpp = ndk::SharedRefBase::make<EqualizerSw>();
LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
@@ -51,212 +59,39 @@
return EX_NONE;
}
-ndk::ScopedAStatus EqualizerSw::open(const Parameter::Common& common,
- const Parameter::Specific& specific,
- OpenEffectReturn* _aidl_return) {
- LOG(DEBUG) << __func__;
- if (mState != State::INIT) {
- LOG(WARNING) << __func__ << " eq already open";
- return ndk::ScopedAStatus::ok();
- }
-
- // Set essential parameters before create worker thread.
- setCommonParameter(common);
- setSpecificParameter(specific);
-
- LOG(DEBUG) << " common: " << common.toString() << " specific " << specific.toString();
-
- auto& input = common.input;
- auto& output = common.output;
- size_t inputFrameSize = getFrameSizeInBytes(input.base.format, input.base.channelMask);
- size_t outputFrameSize = getFrameSizeInBytes(output.base.format, output.base.channelMask);
- mContext = std::make_shared<EqualizerSwContext>(1, input.frameCount * inputFrameSize,
- output.frameCount * outputFrameSize);
- if (!mContext) {
- LOG(ERROR) << __func__ << " created EqualizerSwContext failed";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_UNSUPPORTED_OPERATION,
- "FailedToCreateFmq");
- }
- setContext(mContext);
-
- // create the worker thread
- if (RetCode::SUCCESS != createThread(LOG_TAG)) {
- LOG(ERROR) << __func__ << " created worker thread failed";
- mContext.reset();
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_UNSUPPORTED_OPERATION,
- "FailedToCreateWorker");
- }
-
- _aidl_return->statusMQ = mContext->getStatusFmq()->dupeDesc();
- _aidl_return->inputDataMQ = mContext->getInputDataFmq()->dupeDesc();
- _aidl_return->outputDataMQ = mContext->getOutputDataFmq()->dupeDesc();
- mState = State::IDLE;
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus EqualizerSw::close() {
- if (mState == State::INIT) {
- LOG(WARNING) << __func__ << " instance already closed";
- return ndk::ScopedAStatus::ok();
- } else if (mState == State::PROCESSING) {
- LOG(ERROR) << __func__ << " instance still processing";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_STATE,
- "EqInstanceProcessing");
- }
-
- // stop the worker thread
- mState = State::INIT;
- destroyThread();
- mContext.reset();
-
- LOG(DEBUG) << __func__;
- return ndk::ScopedAStatus::ok();
-}
+namespace aidl::android::hardware::audio::effect {
ndk::ScopedAStatus EqualizerSw::getDescriptor(Descriptor* _aidl_return) {
- LOG(DEBUG) << __func__ << mDesc.toString();
- *_aidl_return = mDesc;
+ LOG(DEBUG) << __func__ << kDesc.toString();
+ *_aidl_return = kDesc;
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus EqualizerSw::command(CommandId in_commandId) {
- LOG(DEBUG) << __func__ << ": receive command:" << toString(in_commandId);
- if (mState == State::INIT) {
- LOG(ERROR) << __func__ << ": instance not open yet";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_STATE,
- "CommandStateError");
- }
- switch (in_commandId) {
- case CommandId::START:
- // start processing.
- mState = State::PROCESSING;
- startThread();
- LOG(DEBUG) << __func__ << " state: " << toString(mState);
- return ndk::ScopedAStatus::ok();
- case CommandId::STOP:
- // stop processing.
- mState = State::IDLE;
- stopThread();
- LOG(DEBUG) << __func__ << " state: " << toString(mState);
- return ndk::ScopedAStatus::ok();
- case CommandId::RESET:
- // TODO: reset buffer status.
- mState = State::IDLE;
- stopThread();
- LOG(DEBUG) << __func__ << " state: " << toString(mState);
- return ndk::ScopedAStatus::ok();
- default:
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "CommandIdNotSupported");
- }
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus EqualizerSw::setParameter(const Parameter& in_param) {
- if (mState == State::INIT) {
- LOG(ERROR) << __func__ << ": instance not open yet";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_STATE, "StateError");
- }
- LOG(DEBUG) << __func__ << " with: " << in_param.toString();
- auto tag = in_param.getTag();
- switch (tag) {
- case Parameter::common: {
- return setCommonParameter(in_param.get<Parameter::common>());
- }
- case Parameter::specific: {
- return setSpecificParameter(in_param.get<Parameter::specific>());
- }
- default:
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "ParameterNotSupported");
- }
-}
-
-ndk::ScopedAStatus EqualizerSw::getParameter(const Parameter::Id& in_paramId,
- Parameter* _aidl_return) {
- LOG(DEBUG) << __func__ << in_paramId.toString();
- auto tag = in_paramId.getTag();
- switch (tag) {
- case Parameter::Id::commonTag: {
- _aidl_return->set<Parameter::common>(mCommonParam);
- LOG(DEBUG) << __func__ << " get: " << _aidl_return->toString();
- return ndk::ScopedAStatus::ok();
- }
- case Parameter::Id::specificId: {
- auto& id = in_paramId.get<Parameter::Id::specificId>();
- Parameter::Specific specific;
- ndk::ScopedAStatus status = getSpecificParameter(id, &specific);
- if (!status.isOk()) {
- LOG(ERROR) << __func__
- << " getSpecificParameter error: " << status.getDescription();
- return status;
- }
- _aidl_return->set<Parameter::specific>(specific);
- LOG(DEBUG) << __func__ << _aidl_return->toString();
- return ndk::ScopedAStatus::ok();
- }
- case Parameter::Id::vendorTag: {
- LOG(DEBUG) << __func__ << " noop for vendor tag now";
- return ndk::ScopedAStatus::ok();
- }
- }
- LOG(ERROR) << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "Parameter:IdNotSupported");
-}
-
-ndk::ScopedAStatus EqualizerSw::getState(State* _aidl_return) {
- *_aidl_return = mState;
- return ndk::ScopedAStatus::ok();
-}
-
-/// Private methods.
-ndk::ScopedAStatus EqualizerSw::setCommonParameter(const Parameter::Common& common) {
- mCommonParam = common;
- LOG(DEBUG) << __func__ << " set: " << mCommonParam.toString();
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus EqualizerSw::setSpecificParameter(const Parameter::Specific& specific) {
- if (Parameter::Specific::equalizer != specific.getTag()) {
- LOG(ERROR) << " unsupported effect: " << specific.toString();
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "EffectNotSupported");
- }
+ndk::ScopedAStatus EqualizerSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::equalizer != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
auto& eqParam = specific.get<Parameter::Specific::equalizer>();
auto tag = eqParam.getTag();
switch (tag) {
- case Equalizer::bandLevels: {
- auto& bandLevels = eqParam.get<Equalizer::bandLevels>();
- const auto& [minItem, maxItem] = std::minmax_element(
- bandLevels.begin(), bandLevels.end(),
- [](const auto& a, const auto& b) { return a.index < b.index; });
- if (bandLevels.size() >= NUM_OF_BANDS || minItem->index < 0 ||
- maxItem->index >= NUM_OF_BANDS) {
- LOG(ERROR) << " bandLevels " << bandLevels.size() << "minIndex " << minItem->index
- << "maxIndex " << maxItem->index << " illegal ";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "ExceedMaxBandNum");
- }
- mBandLevels = bandLevels;
- return ndk::ScopedAStatus::ok();
- }
case Equalizer::preset: {
- int preset = eqParam.get<Equalizer::preset>();
- if (preset < 0 || preset >= NUM_OF_PRESETS) {
- LOG(ERROR) << " preset: " << preset << " invalid";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "ExceedMaxBandNum");
- }
- mPreset = preset;
- LOG(DEBUG) << __func__ << " preset set to " << mPreset;
+ RETURN_IF(mContext->setEqPreset(eqParam.get<Equalizer::preset>()) != RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setBandLevelsFailed");
return ndk::ScopedAStatus::ok();
}
- case Equalizer::vendor: {
- LOG(DEBUG) << __func__ << " noop for vendor tag now";
+ case Equalizer::bandLevels: {
+ RETURN_IF(mContext->setEqBandLevels(eqParam.get<Equalizer::bandLevels>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "setBandLevelsFailed");
return ndk::ScopedAStatus::ok();
}
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "EqTagNotSupported");
+ }
}
LOG(ERROR) << __func__ << " unsupported eq param tag: " << toString(tag);
@@ -264,59 +99,72 @@
"ParamNotSupported");
}
-ndk::ScopedAStatus EqualizerSw::getSpecificParameter(Parameter::Specific::Id id,
+ndk::ScopedAStatus EqualizerSw::getParameterSpecific(const Parameter::Id& id,
Parameter::Specific* specific) {
- Equalizer eqParam;
auto tag = id.getTag();
- if (tag != Parameter::Specific::Id::equalizerTag) {
- LOG(ERROR) << " invalid tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "UnsupportedTag");
+ RETURN_IF(Parameter::Id::equalizerTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ auto eqId = id.get<Parameter::Id::equalizerTag>();
+ auto eqIdTag = eqId.getTag();
+ switch (eqIdTag) {
+ case Equalizer::Id::commonTag:
+ return getParameterEqualizer(eqId.get<Equalizer::Id::commonTag>(), specific);
+ default:
+ LOG(ERROR) << __func__ << " tag " << toString(eqIdTag) << " not supported";
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "EqualizerTagNotSupported");
}
- auto eqTag = id.get<Parameter::Specific::Id::equalizerTag>();
- switch (eqTag) {
+}
+
+ndk::ScopedAStatus EqualizerSw::getParameterEqualizer(const Equalizer::Tag& tag,
+ Parameter::Specific* specific) {
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ Equalizer eqParam;
+ switch (tag) {
case Equalizer::bandLevels: {
- eqParam.set<Equalizer::bandLevels>(mBandLevels);
- specific->set<Parameter::Specific::equalizer>(eqParam);
- return ndk::ScopedAStatus::ok();
+ eqParam.set<Equalizer::bandLevels>(mContext->getEqBandLevels());
+ break;
}
case Equalizer::preset: {
- eqParam.set<Equalizer::preset>(mPreset);
- LOG(DEBUG) << __func__ << " preset " << mPreset;
- specific->set<Parameter::Specific::equalizer>(eqParam);
- return ndk::ScopedAStatus::ok();
+ eqParam.set<Equalizer::preset>(mContext->getEqPreset());
+ break;
}
- case Equalizer::vendor: {
- LOG(DEBUG) << __func__ << " noop for vendor tag now";
- return ndk::ScopedAStatus::ok();
+ default: {
+ LOG(ERROR) << __func__ << " not handled tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
+ "unsupportedTag");
}
}
- LOG(ERROR) << __func__ << " unsupported eq param: " << toString(eqTag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "ParamNotSupported");
+
+ specific->set<Parameter::Specific::equalizer>(eqParam);
+ return ndk::ScopedAStatus::ok();
}
-void EqualizerSw::cleanUp() {
- if (State::PROCESSING == mState) {
- command(CommandId::STOP);
+std::shared_ptr<EffectContext> EqualizerSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
}
- if (State::INIT != mState) {
- close();
- }
+ mContext = std::make_shared<EqualizerSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
}
-IEffect::Status EqualizerSw::status(binder_status_t status, size_t consumed, size_t produced) {
- IEffect::Status ret;
- ret.status = status;
- ret.fmqByteConsumed = consumed;
- ret.fmqByteProduced = produced;
- return ret;
+RetCode EqualizerSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
}
// Processing method running in EffectWorker thread.
-IEffect::Status EqualizerSw::effectProcessImpl() {
+IEffect::Status EqualizerSw::effectProcessImpl(float* in, float* out, int process) {
// TODO: get data buffer and process.
- return status(STATUS_OK, mContext->availableToRead(), mContext->availableToWrite());
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
}
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/hapticGenerator/Android.bp b/audio/aidl/default/hapticGenerator/Android.bp
new file mode 100644
index 0000000..a632130
--- /dev/null
+++ b/audio/aidl/default/hapticGenerator/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libhapticgeneratorsw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "HapticGeneratorSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
new file mode 100644
index 0000000..90675c2
--- /dev/null
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_HapticGeneratorSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "HapticGeneratorSw.h"
+
+using aidl::android::hardware::audio::effect::HapticGeneratorSw;
+using aidl::android::hardware::audio::effect::HapticGeneratorSwImplUUID;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != HapticGeneratorSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<HapticGeneratorSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus HapticGeneratorSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus HapticGeneratorSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::hapticGenerator != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::hapticGenerator>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus HapticGeneratorSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::hapticGeneratorTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::hapticGenerator>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> HapticGeneratorSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<HapticGeneratorSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode HapticGeneratorSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status HapticGeneratorSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
new file mode 100644
index 0000000..95a8d99
--- /dev/null
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class HapticGeneratorSwContext : public EffectContext {
+ public:
+ HapticGeneratorSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class HapticGeneratorSw : public EffectImpl {
+ public:
+ HapticGeneratorSw() { LOG(DEBUG) << __func__; }
+ ~HapticGeneratorSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<HapticGeneratorSwContext> mContext;
+ /* capabilities */
+ const HapticGenerator::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = HapticGeneratorTypeUUID,
+ .uuid = HapticGeneratorSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "HapticGeneratorSw"},
+ .capability = Capability::make<Capability::hapticGenerator>(kCapability)};
+
+ /* parameters */
+ HapticGenerator mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/effect-impl/EffectContext.h b/audio/aidl/default/include/effect-impl/EffectContext.h
index 36492ec..f608e12 100644
--- a/audio/aidl/default/include/effect-impl/EffectContext.h
+++ b/audio/aidl/default/include/effect-impl/EffectContext.h
@@ -15,6 +15,10 @@
*/
#pragma once
+#include <Utils.h>
+#include <android-base/logging.h>
+#include <utils/Log.h>
+#include <cstddef>
#include <cstdint>
#include <memory>
#include <utility>
@@ -22,6 +26,7 @@
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <fmq/AidlMessageQueue.h>
+#include "EffectTypes.h"
namespace aidl::android::hardware::audio::effect {
@@ -31,35 +36,122 @@
IEffect::Status, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
StatusMQ;
typedef ::android::AidlMessageQueue<
- int8_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
+ float, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
DataMQ;
- EffectContext(size_t statusDepth, size_t inBufferSize, size_t outBufferSize) {
+ EffectContext(size_t statusDepth, const Parameter::Common& common) {
+ mSessionId = common.session;
+ auto& input = common.input;
+ auto& output = common.output;
+
+ LOG_ALWAYS_FATAL_IF(
+ input.base.format.pcm != aidl::android::media::audio::common::PcmType::FLOAT_32_BIT,
+ "inputFormatNotFloat");
+ LOG_ALWAYS_FATAL_IF(output.base.format.pcm !=
+ aidl::android::media::audio::common::PcmType::FLOAT_32_BIT,
+ "outputFormatNotFloat");
+ mInputFrameSize = ::android::hardware::audio::common::getFrameSizeInBytes(
+ input.base.format, input.base.channelMask);
+ mOutputFrameSize = ::android::hardware::audio::common::getFrameSizeInBytes(
+ output.base.format, output.base.channelMask);
+ // in/outBuffer size in float (FMQ data format defined for DataMQ)
+ size_t inBufferSizeInFloat = input.frameCount * mInputFrameSize / sizeof(float);
+ size_t outBufferSizeInFloat = output.frameCount * mOutputFrameSize / sizeof(float);
+
mStatusMQ = std::make_shared<StatusMQ>(statusDepth, true /*configureEventFlagWord*/);
- mInputMQ = std::make_shared<DataMQ>(inBufferSize);
- mOutputMQ = std::make_shared<DataMQ>(outBufferSize);
+ mInputMQ = std::make_shared<DataMQ>(inBufferSizeInFloat);
+ mOutputMQ = std::make_shared<DataMQ>(outBufferSizeInFloat);
if (!mStatusMQ->isValid() || !mInputMQ->isValid() || !mOutputMQ->isValid()) {
LOG(ERROR) << __func__ << " created invalid FMQ";
}
- mWorkBuffer.reserve(std::max(inBufferSize, outBufferSize));
- };
+ mWorkBuffer.reserve(std::max(inBufferSizeInFloat, outBufferSizeInFloat));
+ }
+ virtual ~EffectContext() {}
- std::shared_ptr<StatusMQ> getStatusFmq() { return mStatusMQ; };
- std::shared_ptr<DataMQ> getInputDataFmq() { return mInputMQ; };
- std::shared_ptr<DataMQ> getOutputDataFmq() { return mOutputMQ; };
+ std::shared_ptr<StatusMQ> getStatusFmq() { return mStatusMQ; }
+ std::shared_ptr<DataMQ> getInputDataFmq() { return mInputMQ; }
+ std::shared_ptr<DataMQ> getOutputDataFmq() { return mOutputMQ; }
- int8_t* getWorkBuffer() { return static_cast<int8_t*>(mWorkBuffer.data()); };
+ float* getWorkBuffer() { return static_cast<float*>(mWorkBuffer.data()); }
// TODO: update with actual available size
- size_t availableToRead() { return mWorkBuffer.capacity(); };
- size_t availableToWrite() { return mWorkBuffer.capacity(); };
+ size_t availableToRead() { return mWorkBuffer.capacity(); }
+ size_t availableToWrite() { return mWorkBuffer.capacity(); }
+
+ // reset buffer status by abandon all data and status in FMQ
+ void resetBuffer() {
+ auto buffer = getWorkBuffer();
+ std::vector<IEffect::Status> status(mStatusMQ->availableToRead());
+ mInputMQ->read(buffer, mInputMQ->availableToRead());
+ mOutputMQ->read(buffer, mOutputMQ->availableToRead());
+ mStatusMQ->read(status.data(), mStatusMQ->availableToRead());
+ }
+
+ void dupeFmq(IEffect::OpenEffectReturn* effectRet) {
+ if (effectRet) {
+ effectRet->statusMQ = getStatusFmq()->dupeDesc();
+ effectRet->inputDataMQ = getInputDataFmq()->dupeDesc();
+ effectRet->outputDataMQ = getOutputDataFmq()->dupeDesc();
+ }
+ }
+ size_t getInputFrameSize() { return mInputFrameSize; }
+ size_t getOutputFrameSize() { return mOutputFrameSize; }
+ int getSessionId() { return mSessionId; }
+
+ virtual RetCode setOutputDevice(
+ const aidl::android::media::audio::common::AudioDeviceDescription& device) {
+ mOutputDevice = device;
+ return RetCode::SUCCESS;
+ }
+ virtual aidl::android::media::audio::common::AudioDeviceDescription getOutputDevice() {
+ return mOutputDevice;
+ }
+
+ virtual RetCode setAudioMode(const aidl::android::media::audio::common::AudioMode& mode) {
+ mMode = mode;
+ return RetCode::SUCCESS;
+ }
+ virtual aidl::android::media::audio::common::AudioMode getAudioMode() { return mMode; }
+
+ virtual RetCode setAudioSource(const aidl::android::media::audio::common::AudioSource& source) {
+ mSource = source;
+ return RetCode::SUCCESS;
+ }
+ virtual aidl::android::media::audio::common::AudioSource getAudioSource() { return mSource; }
+
+ virtual RetCode setVolumeStereo(const Parameter::VolumeStereo& volumeStereo) {
+ mVolumeStereo = volumeStereo;
+ return RetCode::SUCCESS;
+ }
+ virtual Parameter::VolumeStereo getVolumeStereo() { return mVolumeStereo; }
+
+ virtual RetCode setCommon(const Parameter::Common& common) {
+ mCommon = common;
+ LOG(ERROR) << __func__ << mCommon.toString();
+ return RetCode::SUCCESS;
+ }
+ virtual Parameter::Common getCommon() {
+ LOG(ERROR) << __func__ << mCommon.toString();
+ return mCommon;
+ }
+
+ protected:
+ // common parameters
+ int mSessionId = INVALID_AUDIO_SESSION_ID;
+ size_t mInputFrameSize, mOutputFrameSize;
+ Parameter::Common mCommon;
+ aidl::android::media::audio::common::AudioDeviceDescription mOutputDevice;
+ aidl::android::media::audio::common::AudioMode mMode;
+ aidl::android::media::audio::common::AudioSource mSource;
+ Parameter::VolumeStereo mVolumeStereo;
private:
+ // fmq and buffers
std::shared_ptr<StatusMQ> mStatusMQ;
std::shared_ptr<DataMQ> mInputMQ;
std::shared_ptr<DataMQ> mOutputMQ;
// TODO handle effect process input and output
// work buffer set by effect instances, the access and update are in same thread
- std::vector<int8_t> mWorkBuffer;
+ std::vector<float> mWorkBuffer;
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/effect-impl/EffectImpl.h b/audio/aidl/default/include/effect-impl/EffectImpl.h
new file mode 100644
index 0000000..cb395b7
--- /dev/null
+++ b/audio/aidl/default/include/effect-impl/EffectImpl.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+#include <mutex>
+
+#include "EffectTypes.h"
+#include "effect-impl/EffectContext.h"
+#include "effect-impl/EffectTypes.h"
+#include "effect-impl/EffectWorker.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class EffectImpl : public BnEffect, public EffectWorker {
+ public:
+ EffectImpl() { LOG(DEBUG) << __func__; }
+ ~EffectImpl() {
+ cleanUp();
+ LOG(DEBUG) << __func__;
+ }
+
+ /**
+ * Each effect implementation CAN override these methods if necessary
+ * If you would like implement IEffect::open completely, override EffectImpl::open(), if you
+ * want to keep most of EffectImpl logic but have a little customize, try override openImpl().
+ * openImpl() will be called at the beginning of EffectImpl::open() without lock protection.
+ *
+ * Same for closeImpl().
+ */
+ virtual ndk::ScopedAStatus open(const Parameter::Common& common,
+ const std::optional<Parameter::Specific>& specific,
+ OpenEffectReturn* ret) override;
+ virtual ndk::ScopedAStatus close() override;
+ virtual ndk::ScopedAStatus command(CommandId id) override;
+ virtual ndk::ScopedAStatus commandStart() { return ndk::ScopedAStatus::ok(); }
+ virtual ndk::ScopedAStatus commandStop() { return ndk::ScopedAStatus::ok(); }
+ virtual ndk::ScopedAStatus commandReset() { return ndk::ScopedAStatus::ok(); }
+
+ virtual ndk::ScopedAStatus getState(State* state) override;
+ virtual ndk::ScopedAStatus setParameter(const Parameter& param) override;
+ virtual ndk::ScopedAStatus getParameter(const Parameter::Id& id, Parameter* param) override;
+ virtual IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+
+ virtual ndk::ScopedAStatus setParameterCommon(const Parameter& param);
+ virtual ndk::ScopedAStatus getParameterCommon(const Parameter::Tag& tag, Parameter* param);
+
+ /* Methods MUST be implemented by each effect instances */
+ virtual ndk::ScopedAStatus getDescriptor(Descriptor* desc) = 0;
+ virtual ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) = 0;
+ virtual ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) = 0;
+ virtual std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) = 0;
+ virtual RetCode releaseContext() = 0;
+
+ protected:
+ /*
+ * Lock is required if effectProcessImpl (which is running in an independent thread) needs to
+ * access state and parameters.
+ */
+ std::mutex mMutex;
+ State mState GUARDED_BY(mMutex) = State::INIT;
+
+ IEffect::Status status(binder_status_t status, size_t consumed, size_t produced);
+
+ private:
+ void cleanUp();
+ std::shared_ptr<EffectContext> mContext GUARDED_BY(mMutex);
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/effect-impl/EffectTypes.h b/audio/aidl/default/include/effect-impl/EffectTypes.h
index 46cfc0c..edce26b 100644
--- a/audio/aidl/default/include/effect-impl/EffectTypes.h
+++ b/audio/aidl/default/include/effect-impl/EffectTypes.h
@@ -18,6 +18,19 @@
#include <ostream>
#include <string>
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+
+typedef binder_exception_t (*EffectCreateFunctor)(
+ const ::aidl::android::media::audio::common::AudioUuid*,
+ std::shared_ptr<aidl::android::hardware::audio::effect::IEffect>*);
+typedef binder_exception_t (*EffectDestroyFunctor)(
+ const std::shared_ptr<aidl::android::hardware::audio::effect::IEffect>&);
+
+struct effect_dl_interface_s {
+ EffectCreateFunctor createEffectFunc;
+ EffectDestroyFunctor destroyEffectFunc;
+};
+
namespace aidl::android::hardware::audio::effect {
enum class RetCode {
@@ -26,9 +39,12 @@
ERROR_THREAD, /* Effect thread error */
ERROR_NULL_POINTER, /* NULL pointer */
ERROR_ALIGNMENT_ERROR, /* Memory alignment error */
- ERROR_BLOCK_SIZE_EXCEED /* Maximum block size exceeded */
+ ERROR_BLOCK_SIZE_EXCEED, /* Maximum block size exceeded */
+ ERROR_EFFECT_LIB_ERROR
};
+static const int INVALID_AUDIO_SESSION_ID = -1;
+
inline std::ostream& operator<<(std::ostream& out, const RetCode& code) {
switch (code) {
case RetCode::SUCCESS:
@@ -43,9 +59,46 @@
return out << "ERROR_ALIGNMENT_ERROR";
case RetCode::ERROR_BLOCK_SIZE_EXCEED:
return out << "ERROR_BLOCK_SIZE_EXCEED";
+ case RetCode::ERROR_EFFECT_LIB_ERROR:
+ return out << "ERROR_EFFECT_LIB_ERROR";
}
return out << "EnumError: " << code;
}
+#define RETURN_IF_ASTATUS_NOT_OK(status, message) \
+ do { \
+ const ::ndk::ScopedAStatus curr_status = (status); \
+ if (!curr_status.isOk()) { \
+ LOG(ERROR) << __func__ << ":" << __LINE__ \
+ << "return with status: " << curr_status.getDescription() << (message); \
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage( \
+ curr_status.getExceptionCode(), (message)); \
+ } \
+ } while (0)
+
+#define RETURN_IF(expr, exception, message) \
+ do { \
+ if (expr) { \
+ LOG(ERROR) << __func__ << ":" << __LINE__ << " return with expr " << #expr; \
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage((exception), (message)); \
+ } \
+ } while (0)
+
+#define RETURN_OK_IF(expr) \
+ do { \
+ if (expr) { \
+ LOG(INFO) << __func__ << ":" << __LINE__ << " return with expr " << #expr; \
+ return ndk::ScopedAStatus::ok(); \
+ } \
+ } while (0)
+
+#define RETURN_VALUE_IF(expr, ret, log) \
+ do { \
+ if (expr) { \
+ LOG(ERROR) << __func__ << ":" << __LINE__ << " return with expr " << #expr << (log); \
+ return ret; \
+ } \
+ } while (0)
+
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/effect-impl/EffectUUID.h b/audio/aidl/default/include/effect-impl/EffectUUID.h
index 48b7137..767cf6c 100644
--- a/audio/aidl/default/include/effect-impl/EffectUUID.h
+++ b/audio/aidl/default/include/effect-impl/EffectUUID.h
@@ -46,11 +46,124 @@
0xbb17,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
-// Visualizer type UUID.
-static const AudioUuid VisualizerTypeUUID = {static_cast<int32_t>(0x1d4033c0),
- 0x8557,
- 0x11df,
- 0x9f2d,
- {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+// Equalizer bundle implementation UUID.
+static const AudioUuid EqualizerBundleImplUUID = {static_cast<int32_t>(0xce772f20),
+ 0x847d,
+ 0x11df,
+ 0xbb17,
+ {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+
+// fa8184a4-588b-11ed-9b6a-0242ac120002
+static const AudioUuid BassBoostTypeUUID = {static_cast<int32_t>(0xfa8184a4),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa8181f2-588b-11ed-9b6a-0242ac120002
+static const AudioUuid BassBoostSwImplUUID = {static_cast<int32_t>(0xfa8181f2),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa81862a-588b-11ed-9b6a-0242ac120002
+static const AudioUuid DownmixTypeUUID = {static_cast<int32_t>(0xfa81862a),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa8187ba-588b-11ed-9b6a-0242ac120002
+static const AudioUuid DownmixSwImplUUID = {static_cast<int32_t>(0xfa8187ba),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa818954-588b-11ed-9b6a-0242ac120002
+static const AudioUuid DynamicsProcessingTypeUUID = {static_cast<int32_t>(0xfa818954),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa818d78-588b-11ed-9b6a-0242ac120002
+static const AudioUuid DynamicsProcessingSwImplUUID = {static_cast<int32_t>(0xfa818d78),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa818f62-588b-11ed-9b6a-0242ac120002
+static const AudioUuid HapticGeneratorTypeUUID = {static_cast<int32_t>(0xfa818f62),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa819110-588b-11ed-9b6a-0242ac120002
+static const AudioUuid HapticGeneratorSwImplUUID = {static_cast<int32_t>(0xfa819110),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+
+// fa8194a8-588b-11ed-9b6a-0242ac120002
+static const AudioUuid LoudnessEnhancerTypeUUID = {static_cast<int32_t>(0xfa8194a8),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa819610-588b-11ed-9b6a-0242ac120002
+static const AudioUuid LoudnessEnhancerSwImplUUID = {static_cast<int32_t>(0xfa819610),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa819886-588b-11ed-9b6a-0242ac120002
+static const AudioUuid ReverbTypeUUID = {static_cast<int32_t>(0xfa819886),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa8199c6-588b-11ed-9b6a-0242ac120002
+static const AudioUuid ReverbSwImplUUID = {static_cast<int32_t>(0xfa8199c6),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+
+// fa819af2-588b-11ed-9b6a-0242ac120002
+static const AudioUuid VirtualizerTypeUUID = {static_cast<int32_t>(0xfa819af2),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa819d86-588b-11ed-9b6a-0242ac120002
+static const AudioUuid VirtualizerSwImplUUID = {static_cast<int32_t>(0xfa819d86),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+
+// fa819f3e-588b-11ed-9b6a-0242ac120002
+static const AudioUuid VisualizerTypeUUID = {static_cast<int32_t>(0xfa819f3e),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa81a0f6-588b-11ed-9b6a-0242ac120002
+static const AudioUuid VisualizerSwImplUUID = {static_cast<int32_t>(0xfa81a0f6),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+
+// fa81a2b8-588b-11ed-9b6a-0242ac120002
+static const AudioUuid VolumeTypeUUID = {static_cast<int32_t>(0xfa81a2b8),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa81a718-588b-11ed-9b6a-0242ac120002
+static const AudioUuid VolumeSwImplUUID = {static_cast<int32_t>(0xfa81a718),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/effect-impl/EffectWorker.h b/audio/aidl/default/include/effect-impl/EffectWorker.h
index 0fe69ff..a297937 100644
--- a/audio/aidl/default/include/effect-impl/EffectWorker.h
+++ b/audio/aidl/default/include/effect-impl/EffectWorker.h
@@ -36,34 +36,33 @@
// handle FMQ and call effect implemented virtual function
void process() override {
- if (!mContext) {
- LOG(ERROR) << __func__ << " invalid context!";
- return;
- }
+ RETURN_VALUE_IF(!mContext, void(), "nullContext");
std::shared_ptr<EffectContext::StatusMQ> statusMQ = mContext->getStatusFmq();
std::shared_ptr<EffectContext::DataMQ> inputMQ = mContext->getInputDataFmq();
std::shared_ptr<EffectContext::DataMQ> outputMQ = mContext->getOutputDataFmq();
// Only this worker will read from input data MQ and write to output data MQ.
- auto readSize = inputMQ->availableToRead(), writeSize = outputMQ->availableToWrite();
- if (readSize && writeSize) {
- LOG(DEBUG) << __func__ << " available to read " << readSize << " available to write "
- << writeSize;
+ auto readSamples = inputMQ->availableToRead(), writeSamples = outputMQ->availableToWrite();
+ if (readSamples && writeSamples) {
+ auto processSamples = std::min(readSamples, writeSamples);
+ LOG(DEBUG) << __func__ << " available to read " << readSamples << " available to write "
+ << writeSamples << " process " << processSamples;
+
auto buffer = mContext->getWorkBuffer();
- inputMQ->read(buffer, readSize);
- IEffect::Status status = effectProcessImpl();
- writeSize = std::min((int32_t)writeSize, status.fmqByteProduced);
- outputMQ->write(buffer, writeSize);
+ inputMQ->read(buffer, processSamples);
+
+ IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples);
+ outputMQ->write(buffer, status.fmqProduced);
statusMQ->writeBlocking(&status, 1);
- LOG(DEBUG) << __func__ << " done processing, effect consumed " << status.fmqByteConsumed
- << " produced " << status.fmqByteProduced;
+ LOG(DEBUG) << __func__ << " done processing, effect consumed " << status.fmqConsumed
+ << " produced " << status.fmqProduced;
} else {
// TODO: maybe add some sleep here to avoid busy waiting
}
}
// must implement by each effect implementation
- virtual IEffect::Status effectProcessImpl() = 0;
+ virtual IEffect::Status effectProcessImpl(float* in, float* out, int processSamples) = 0;
private:
// make sure the context only set once.
diff --git a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h
index 6195d8a..d50bd63 100644
--- a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h
+++ b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h
@@ -34,12 +34,14 @@
*
* @param in_type Type UUID.
* @param in_instance Instance UUID.
+ * @param in_proxy Proxy UUID.
* @param out_descriptor List of identities .
* @return ndk::ScopedAStatus
*/
ndk::ScopedAStatus queryEffects(
const std::optional<::aidl::android::media::audio::common::AudioUuid>& in_type,
const std::optional<::aidl::android::media::audio::common::AudioUuid>& in_instance,
+ const std::optional<::aidl::android::media::audio::common::AudioUuid>& in_proxy,
std::vector<Descriptor::Identity>* out_descriptor) override;
/**
@@ -79,16 +81,9 @@
// List of effect descriptors supported by the devices.
std::vector<Descriptor::Identity> mIdentityList;
- typedef binder_exception_t (*EffectCreateFunctor)(std::shared_ptr<IEffect>*);
- typedef binder_exception_t (*EffectDestroyFunctor)(const std::shared_ptr<IEffect>&);
- struct effect_interface_s {
- EffectCreateFunctor createEffectFunc;
- EffectDestroyFunctor destroyEffectFunc;
- };
-
std::map<aidl::android::media::audio::common::AudioUuid /* implementationUUID */,
std::pair<std::unique_ptr<void, std::function<void(void*)>> /* dlHandle */,
- std::unique_ptr<struct effect_interface_s>>>
+ std::unique_ptr<struct effect_dl_interface_s>>>
mEffectLibMap;
std::map<std::weak_ptr<IEffect>, aidl::android::media::audio::common::AudioUuid,
std::owner_less<>>
@@ -96,5 +91,10 @@
ndk::ScopedAStatus destroyEffectImpl(const std::shared_ptr<IEffect>& in_handle);
void cleanupEffectMap();
+ void openEffectLibrary(
+ const ::aidl::android::media::audio::common::AudioUuid& type,
+ const ::aidl::android::media::audio::common::AudioUuid& impl,
+ const std::optional<::aidl::android::media::audio::common::AudioUuid>& proxy,
+ const std::string& libName);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/equalizer-impl/EqualizerSw.h b/audio/aidl/default/include/equalizer-impl/EqualizerSw.h
index aa3a727..dad03e1 100644
--- a/audio/aidl/default/include/equalizer-impl/EqualizerSw.h
+++ b/audio/aidl/default/include/equalizer-impl/EqualizerSw.h
@@ -21,85 +21,104 @@
#include <cstdlib>
#include <memory>
-#include "effect-impl/EffectContext.h"
-#include "effect-impl/EffectTypes.h"
+#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
-#include "effect-impl/EffectWorker.h"
namespace aidl::android::hardware::audio::effect {
class EqualizerSwContext : public EffectContext {
public:
- EqualizerSwContext(int statusDepth, int inBufferSize, int outBufferSize)
- : EffectContext(statusDepth, inBufferSize, outBufferSize) {
+ EqualizerSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
LOG(DEBUG) << __func__;
}
+ RetCode setEqPreset(const int& presetIdx) {
+ if (presetIdx < 0 || presetIdx >= NUM_OF_PRESETS) {
+ return RetCode::ERROR_ILLEGAL_PARAMETER;
+ }
+ mPreset = presetIdx;
+ return RetCode::SUCCESS;
+ }
+ 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;
+ return RetCode::ERROR_ILLEGAL_PARAMETER;
+ }
+ RetCode ret = RetCode::SUCCESS;
+ for (auto& it : bandLevels) {
+ if (it.index >= NUM_OF_BANDS || it.index < 0) {
+ LOG(ERROR) << __func__ << " index illegal, skip: " << it.index << " - "
+ << it.levelMb;
+ ret = RetCode::ERROR_ILLEGAL_PARAMETER;
+ }
+ mBandLevels[it.index] = it.levelMb;
+ }
+ return ret;
+ }
+
+ std::vector<Equalizer::BandLevel> getEqBandLevels() {
+ std::vector<Equalizer::BandLevel> bandLevels;
+ for (int i = 0; i < NUM_OF_BANDS; i++) {
+ bandLevels.push_back({i, mBandLevels[i]});
+ }
+ return bandLevels;
+ }
+
private:
+ static const int NUM_OF_BANDS = 5;
+ static const int NUM_OF_PRESETS = 10;
+ static const int PRESET_CUSTOM = -1;
+ // preset band level
+ int mPreset = PRESET_CUSTOM;
+ int32_t mBandLevels[NUM_OF_BANDS] = {3, 0, 0, 0, 3};
+
// Add equalizer specific context for processing here
};
-class EqualizerSw : public BnEffect, EffectWorker {
+class EqualizerSw : public EffectImpl {
public:
- EqualizerSw() {
- Equalizer::Capability eqCap = {.bandFrequencies = mBandFrequency, .presets = mPresets};
- mDesc.capability.set<Capability::equalizer>(eqCap);
- LOG(DEBUG) << __func__;
- };
+ EqualizerSw() { LOG(DEBUG) << __func__; }
~EqualizerSw() {
- cleanUp();
LOG(DEBUG) << __func__;
- };
- ndk::ScopedAStatus open(const Parameter::Common& common, const Parameter::Specific& specific,
- OpenEffectReturn* _aidl_return) override;
- ndk::ScopedAStatus close() override;
+ releaseContext();
+ }
+
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
-
- ndk::ScopedAStatus getState(State* _aidl_return) override;
- ndk::ScopedAStatus command(CommandId in_commandId) override;
- ndk::ScopedAStatus setParameter(const Parameter& in_param) override;
- ndk::ScopedAStatus getParameter(const Parameter::Id& in_paramId,
- Parameter* _aidl_return) override;
-
- IEffect::Status effectProcessImpl() override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
private:
- // Effect descriptor.
- Descriptor mDesc = {.common = {.id = {.type = EqualizerTypeUUID, .uuid = EqualizerSwImplUUID}}};
-
- // Parameters.
- Parameter::Common mCommonParam;
- Equalizer mEqualizerParam; // TODO: the equalizer parameter needs to update
-
- // Instance state INIT by default.
- State mState = State::INIT;
-
- int mPreset = PRESET_CUSTOM; // the current preset
+ std::shared_ptr<EqualizerSwContext> mContext;
+ /* capabilities */
const std::vector<Equalizer::BandFrequency> mBandFrequency = {{0, 30000, 120000},
{1, 120001, 460000},
{2, 460001, 1800000},
{3, 1800001, 7000000},
{4, 7000001, 20000000}};
- // preset band level
- std::vector<Equalizer::BandLevel> mBandLevels = {{0, 3}, {1, 0}, {2, 0}, {3, 0}, {4, 3}};
// presets supported by the device
const std::vector<Equalizer::Preset> mPresets = {
{0, "Normal"}, {1, "Classical"}, {2, "Dance"}, {3, "Flat"}, {4, "Folk"},
{5, "Heavy Metal"}, {6, "Hip Hop"}, {7, "Jazz"}, {8, "Pop"}, {9, "Rock"}};
- static const int NUM_OF_BANDS = 5;
- static const int NUM_OF_PRESETS = 10;
- static const int PRESET_CUSTOM = -1;
- // Equalizer worker context
- std::shared_ptr<EqualizerSwContext> mContext;
+ const Equalizer::Capability kEqCap = {.bandFrequencies = mBandFrequency, .presets = mPresets};
+ // Effect descriptor.
+ const Descriptor kDesc = {.common = {.id = {.type = EqualizerTypeUUID,
+ .uuid = EqualizerSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "EqualizerSw"},
+ .capability = Capability::make<Capability::equalizer>(kEqCap)};
- ndk::ScopedAStatus setCommonParameter(const Parameter::Common& common_param);
- ndk::ScopedAStatus setSpecificParameter(const Parameter::Specific& specific);
- ndk::ScopedAStatus getSpecificParameter(Parameter::Specific::Id id,
- Parameter::Specific* specific);
-
- void cleanUp();
-
- IEffect::Status status(binder_status_t status, size_t consumed, size_t produced);
+ ndk::ScopedAStatus getParameterEqualizer(const Equalizer::Tag& tag,
+ Parameter::Specific* specific);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/loudnessEnhancer/Android.bp b/audio/aidl/default/loudnessEnhancer/Android.bp
new file mode 100644
index 0000000..3a0ac73
--- /dev/null
+++ b/audio/aidl/default/loudnessEnhancer/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libloudnessenhancersw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "LoudnessEnhancerSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
new file mode 100644
index 0000000..51645c7
--- /dev/null
+++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_LoudnessEnhancerSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "LoudnessEnhancerSw.h"
+
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::LoudnessEnhancerSw;
+using aidl::android::hardware::audio::effect::LoudnessEnhancerSwImplUUID;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != LoudnessEnhancerSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<LoudnessEnhancerSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus LoudnessEnhancerSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus LoudnessEnhancerSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::loudnessEnhancer != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::loudnessEnhancer>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus LoudnessEnhancerSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::loudnessEnhancerTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::loudnessEnhancer>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> LoudnessEnhancerSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<LoudnessEnhancerSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode LoudnessEnhancerSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status LoudnessEnhancerSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
new file mode 100644
index 0000000..7d4bb52
--- /dev/null
+++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class LoudnessEnhancerSwContext : public EffectContext {
+ public:
+ LoudnessEnhancerSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class LoudnessEnhancerSw : public EffectImpl {
+ public:
+ LoudnessEnhancerSw() { LOG(DEBUG) << __func__; }
+ ~LoudnessEnhancerSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<LoudnessEnhancerSwContext> mContext;
+ /* capabilities */
+ const LoudnessEnhancer::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = LoudnessEnhancerTypeUUID,
+ .uuid = LoudnessEnhancerSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "LoudnessEnhancerSw"},
+ .capability = Capability::make<Capability::loudnessEnhancer>(kCapability)};
+
+ /* parameters */
+ LoudnessEnhancer mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/reverb/Android.bp b/audio/aidl/default/reverb/Android.bp
new file mode 100644
index 0000000..955038c
--- /dev/null
+++ b/audio/aidl/default/reverb/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libreverbsw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "ReverbSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/reverb/ReverbSw.cpp b/audio/aidl/default/reverb/ReverbSw.cpp
new file mode 100644
index 0000000..639f1a2
--- /dev/null
+++ b/audio/aidl/default/reverb/ReverbSw.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_ReverbSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "ReverbSw.h"
+
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::ReverbSw;
+using aidl::android::hardware::audio::effect::ReverbSwImplUUID;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != ReverbSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<ReverbSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus ReverbSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus ReverbSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::reverb != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::reverb>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus ReverbSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::reverbTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::reverb>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> ReverbSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<ReverbSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode ReverbSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status ReverbSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/reverb/ReverbSw.h b/audio/aidl/default/reverb/ReverbSw.h
new file mode 100644
index 0000000..9457ab3
--- /dev/null
+++ b/audio/aidl/default/reverb/ReverbSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class ReverbSwContext : public EffectContext {
+ public:
+ ReverbSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class ReverbSw : public EffectImpl {
+ public:
+ ReverbSw() { LOG(DEBUG) << __func__; }
+ ~ReverbSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<ReverbSwContext> mContext;
+ /* capabilities */
+ const Reverb::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = ReverbTypeUUID,
+ .uuid = ReverbSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "ReverbSw"},
+ .capability = Capability::make<Capability::reverb>(kCapability)};
+
+ /* parameters */
+ Reverb mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/virtualizer/Android.bp b/audio/aidl/default/virtualizer/Android.bp
new file mode 100644
index 0000000..ba38f5c
--- /dev/null
+++ b/audio/aidl/default/virtualizer/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libvirtualizersw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "VirtualizerSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.cpp b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
new file mode 100644
index 0000000..ccb7b4b
--- /dev/null
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_VirtualizerSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "VirtualizerSw.h"
+
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::hardware::audio::effect::VirtualizerSw;
+using aidl::android::hardware::audio::effect::VirtualizerSwImplUUID;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != VirtualizerSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<VirtualizerSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus VirtualizerSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VirtualizerSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::virtualizer != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::virtualizer>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VirtualizerSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::virtualizerTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::virtualizer>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> VirtualizerSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<VirtualizerSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode VirtualizerSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status VirtualizerSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.h b/audio/aidl/default/virtualizer/VirtualizerSw.h
new file mode 100644
index 0000000..86f442d
--- /dev/null
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class VirtualizerSwContext : public EffectContext {
+ public:
+ VirtualizerSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class VirtualizerSw : public EffectImpl {
+ public:
+ VirtualizerSw() { LOG(DEBUG) << __func__; }
+ ~VirtualizerSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<VirtualizerSwContext> mContext;
+ /* capabilities */
+ const Virtualizer::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = VirtualizerTypeUUID,
+ .uuid = VirtualizerSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "VirtualizerSw"},
+ .capability = Capability::make<Capability::virtualizer>(kCapability)};
+
+ /* parameters */
+ Virtualizer mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/visualizer/Android.bp b/audio/aidl/default/visualizer/Android.bp
new file mode 100644
index 0000000..5041be8
--- /dev/null
+++ b/audio/aidl/default/visualizer/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libvisualizersw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "VisualizerSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/visualizer/VisualizerSw.cpp b/audio/aidl/default/visualizer/VisualizerSw.cpp
new file mode 100644
index 0000000..5a24f18
--- /dev/null
+++ b/audio/aidl/default/visualizer/VisualizerSw.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_VisualizerSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "VisualizerSw.h"
+
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::hardware::audio::effect::VisualizerSw;
+using aidl::android::hardware::audio::effect::VisualizerSwImplUUID;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != VisualizerSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<VisualizerSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus VisualizerSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VisualizerSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::visualizer != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::visualizer>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VisualizerSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::visualizerTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::visualizer>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> VisualizerSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<VisualizerSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode VisualizerSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status VisualizerSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/visualizer/VisualizerSw.h b/audio/aidl/default/visualizer/VisualizerSw.h
new file mode 100644
index 0000000..e9baece
--- /dev/null
+++ b/audio/aidl/default/visualizer/VisualizerSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class VisualizerSwContext : public EffectContext {
+ public:
+ VisualizerSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class VisualizerSw : public EffectImpl {
+ public:
+ VisualizerSw() { LOG(DEBUG) << __func__; }
+ ~VisualizerSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<VisualizerSwContext> mContext;
+ /* capabilities */
+ const Visualizer::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = VisualizerTypeUUID,
+ .uuid = VisualizerSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "VisualizerSw"},
+ .capability = Capability::make<Capability::visualizer>(kCapability)};
+
+ /* parameters */
+ Visualizer mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/volume/Android.bp b/audio/aidl/default/volume/Android.bp
new file mode 100644
index 0000000..505ee67
--- /dev/null
+++ b/audio/aidl/default/volume/Android.bp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // 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"],
+}
+
+cc_library_shared {
+ name: "libvolumesw",
+ defaults: [
+ "aidlaudioeffectservice_defaults",
+ "latest_android_media_audio_common_types_ndk_shared",
+ "latest_android_hardware_audio_effect_ndk_shared",
+ ],
+ srcs: [
+ "VolumeSw.cpp",
+ ":effectCommonFile",
+ ],
+ visibility: [
+ "//hardware/interfaces/audio/aidl/default",
+ ],
+}
diff --git a/audio/aidl/default/volume/VolumeSw.cpp b/audio/aidl/default/volume/VolumeSw.cpp
new file mode 100644
index 0000000..e2f42d7
--- /dev/null
+++ b/audio/aidl/default/volume/VolumeSw.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstddef>
+#define LOG_TAG "AHAL_VolumeSw"
+#include <Utils.h>
+#include <algorithm>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "VolumeSw.h"
+
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::State;
+using aidl::android::hardware::audio::effect::VolumeSw;
+using aidl::android::hardware::audio::effect::VolumeSwImplUUID;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != VolumeSwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<VolumeSw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
+ if (!instanceSp) {
+ return EX_NONE;
+ }
+ State state;
+ ndk::ScopedAStatus status = instanceSp->getState(&state);
+ if (!status.isOk() || State::INIT != state) {
+ LOG(ERROR) << __func__ << " instance " << instanceSp.get()
+ << " in state: " << toString(state) << ", status: " << status.getDescription();
+ return EX_ILLEGAL_STATE;
+ }
+ LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed";
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+ndk::ScopedAStatus VolumeSw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VolumeSw::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::volume != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ std::lock_guard lg(mMutex);
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ mSpecificParam = specific.get<Parameter::Specific::volume>();
+ LOG(DEBUG) << __func__ << " success with: " << specific.toString();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VolumeSw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::volumeTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ specific->set<Parameter::Specific::volume>(mSpecificParam);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> VolumeSw::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ return mContext;
+ }
+ mContext = std::make_shared<VolumeSwContext>(1 /* statusFmqDepth */, common);
+ return mContext;
+}
+
+RetCode VolumeSw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status VolumeSw::effectProcessImpl(float* in, float* out, int process) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " process " << process;
+ for (int i = 0; i < process; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, process, process};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/volume/VolumeSw.h b/audio/aidl/default/volume/VolumeSw.h
new file mode 100644
index 0000000..b0d2aa7
--- /dev/null
+++ b/audio/aidl/default/volume/VolumeSw.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
+#include <cstdlib>
+#include <memory>
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class VolumeSwContext : public EffectContext {
+ public:
+ VolumeSwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+ // TODO: add specific context here
+};
+
+class VolumeSw : public EffectImpl {
+ public:
+ VolumeSw() { LOG(DEBUG) << __func__; }
+ ~VolumeSw() {
+ LOG(DEBUG) << __func__;
+ releaseContext();
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ RetCode releaseContext() override;
+
+ private:
+ std::shared_ptr<VolumeSwContext> mContext;
+ /* capabilities */
+ const Volume::Capability kCapability;
+ /* Effect descriptor */
+ const Descriptor kDescriptor = {
+ .common = {.id = {.type = VolumeTypeUUID,
+ .uuid = VolumeSwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = "VolumeSw"},
+ .capability = Capability::make<Capability::volume>(kCapability)};
+
+ /* parameters */
+ Volume mSpecificParam;
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h
index 63efae0..d58fcf2 100644
--- a/audio/aidl/vts/EffectFactoryHelper.h
+++ b/audio/aidl/vts/EffectFactoryHelper.h
@@ -53,9 +53,10 @@
void QueryEffects(const std::optional<AudioUuid>& in_type,
const std::optional<AudioUuid>& in_instance,
+ const std::optional<AudioUuid>& in_proxy,
std::vector<Descriptor::Identity>* _aidl_return) {
ASSERT_NE(mEffectFactory, nullptr);
- EXPECT_IS_OK(mEffectFactory->queryEffects(in_type, in_instance, _aidl_return));
+ EXPECT_IS_OK(mEffectFactory->queryEffects(in_type, in_instance, in_proxy, _aidl_return));
mIds = *_aidl_return;
}
@@ -85,9 +86,10 @@
ASSERT_NE(mEffectFactory, nullptr);
if (type == EffectNullUuid) {
- EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, &ids));
+ EXPECT_IS_OK(
+ mEffectFactory->queryEffects(std::nullopt, std::nullopt, std::nullopt, &ids));
} else {
- EXPECT_IS_OK(mEffectFactory->queryEffects(type, std::nullopt, &ids));
+ EXPECT_IS_OK(mEffectFactory->queryEffects(type, std::nullopt, std::nullopt, &ids));
}
for (const auto& id : ids) {
ASSERT_EQ(id.type, type);
@@ -121,7 +123,8 @@
void QueryAndCreateAllEffects() {
ASSERT_NE(mEffectFactory, nullptr);
- EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, &mCompleteIds));
+ EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, std::nullopt,
+ &mCompleteIds));
for (const auto& id : mCompleteIds) {
std::shared_ptr<IEffect> effect;
EXPECT_IS_OK(mEffectFactory->createEffect(id.uuid, &effect));
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index c58ed13..623ac37 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -49,7 +49,7 @@
using aidl::android::media::audio::common::PcmType;
const AudioFormatDescription DefaultFormat = {
- .type = AudioFormatType::PCM, .pcm = PcmType::INT_16_BIT, .encoding = ""};
+ .type = AudioFormatType::PCM, .pcm = PcmType::FLOAT_32_BIT, .encoding = ""};
class EffectHelper {
public:
@@ -59,6 +59,7 @@
void OpenEffects(const AudioUuid& type = EffectNullUuid) {
auto open = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
IEffect::OpenEffectReturn ret;
EXPECT_IS_OK(effect->open(mCommon, mSpecific, &ret));
EffectParam params;
@@ -72,6 +73,7 @@
void CloseEffects(const binder_status_t status = EX_NONE) {
auto close = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
EXPECT_STATUS(status, effect->close());
};
@@ -97,6 +99,7 @@
void GetEffectDescriptors() {
auto get = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
Descriptor desc;
EXPECT_IS_OK(effect->getDescriptor(&desc));
mEffectDescriptors.push_back(std::move(desc));
@@ -106,6 +109,7 @@
void CommandEffects(CommandId command) {
auto close = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
EXPECT_IS_OK(effect->command(command));
};
EXPECT_NO_FATAL_FAILURE(ForEachEffect(close));
@@ -113,6 +117,7 @@
void CommandEffectsExpectStatus(CommandId command, const binder_status_t status) {
auto func = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
EXPECT_STATUS(status, effect->command(command));
};
EXPECT_NO_FATAL_FAILURE(ForEachEffect(func));
@@ -120,6 +125,7 @@
void ExpectState(State expected) {
auto get = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
State state = State::INIT;
EXPECT_IS_OK(effect->getState(&state));
EXPECT_EQ(expected, state);
@@ -129,6 +135,7 @@
void SetParameter() {
auto func = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
Parameter param;
param.set<Parameter::common>(mCommon);
EXPECT_IS_OK(effect->setParameter(param));
@@ -138,9 +145,10 @@
void VerifyParameters() {
auto func = [&](const std::shared_ptr<IEffect>& effect) {
+ ASSERT_NE(effect, nullptr);
Parameter paramCommonGet = Parameter(), paramCommonExpect = Parameter();
Parameter::Id id;
- id.set<Parameter::Id::commonTag>(0);
+ id.set<Parameter::Id::commonTag>(Parameter::common);
paramCommonExpect.set<Parameter::common>(mCommon);
EXPECT_IS_OK(effect->getParameter(id, ¶mCommonGet));
EXPECT_EQ(paramCommonExpect, paramCommonGet)
@@ -151,8 +159,9 @@
void QueryEffects(const std::optional<AudioUuid>& in_type,
const std::optional<AudioUuid>& in_instance,
+ const std::optional<AudioUuid>& in_proxy,
std::vector<Descriptor::Identity>* _aidl_return) {
- mFactoryHelper.QueryEffects(in_type, in_instance, _aidl_return);
+ mFactoryHelper.QueryEffects(in_type, in_instance, in_proxy, _aidl_return);
}
template <typename Functor>
@@ -173,7 +182,7 @@
}
}
- static const size_t mWriteMQSize = 0x400;
+ static const size_t mWriteMQBytes = 0x400;
enum class IO : char { INPUT = 0, OUTPUT = 1, INOUT = 2 };
@@ -204,7 +213,7 @@
mCommon.output.frameCount = frameCount;
}
}
- void initParamCommon(int session = -1, int ioHandle = -1, int iSampleRate = 48000,
+ void initParamCommon(int session = 0, int ioHandle = -1, int iSampleRate = 48000,
int oSampleRate = 48000, long iFrameCount = 0x100,
long oFrameCount = 0x100) {
mCommon.session = session;
@@ -215,9 +224,12 @@
input.base.sampleRate = iSampleRate;
input.base.channelMask = mInputChannelLayout;
input.frameCount = iFrameCount;
+ input.base.format = DefaultFormat;
output.base.sampleRate = oSampleRate;
output.base.channelMask = mOutputChannelLayout;
+ output.base.format = DefaultFormat;
output.frameCount = oFrameCount;
+ output.base.format = DefaultFormat;
inputFrameSize = android::hardware::audio::common::getFrameSizeInBytes(
input.base.format, input.base.channelMask);
outputFrameSize = android::hardware::audio::common::getFrameSizeInBytes(
@@ -227,45 +239,45 @@
void setSpecific(Parameter::Specific& specific) { mSpecific = specific; }
// usually this function only call once.
- void PrepareInputData(size_t s = mWriteMQSize) {
- size_t maxInputSize = s;
+ void PrepareInputData(size_t bytes = mWriteMQBytes) {
+ size_t maxInputBytes = mWriteMQBytes;
for (auto& it : mEffectParams) {
auto& mq = it.inputMQ;
EXPECT_NE(nullptr, mq);
EXPECT_TRUE(mq->isValid());
- const size_t bytesToWrite = mq->availableToWrite();
+ const size_t bytesToWrite = mq->availableToWrite() * sizeof(float);
EXPECT_EQ(inputFrameSize * mCommon.input.frameCount, bytesToWrite);
EXPECT_NE(0UL, bytesToWrite);
- EXPECT_TRUE(s <= bytesToWrite);
- maxInputSize = std::max(maxInputSize, bytesToWrite);
+ EXPECT_TRUE(bytes <= bytesToWrite);
+ maxInputBytes = std::max(maxInputBytes, bytesToWrite);
}
- mInputBuffer.resize(maxInputSize);
+ mInputBuffer.resize(maxInputBytes / sizeof(float));
std::fill(mInputBuffer.begin(), mInputBuffer.end(), 0x5a);
}
- void writeToFmq(size_t s = mWriteMQSize) {
+ void writeToFmq(size_t bytes = mWriteMQBytes) {
for (auto& it : mEffectParams) {
auto& mq = it.inputMQ;
EXPECT_NE(nullptr, mq);
- const size_t bytesToWrite = mq->availableToWrite();
+ const size_t bytesToWrite = mq->availableToWrite() * sizeof(float);
EXPECT_NE(0Ul, bytesToWrite);
- EXPECT_TRUE(s <= bytesToWrite);
- EXPECT_TRUE(mq->write(mInputBuffer.data(), s));
+ EXPECT_TRUE(bytes <= bytesToWrite);
+ EXPECT_TRUE(mq->write(mInputBuffer.data(), bytes / sizeof(float)));
}
}
- void readFromFmq(size_t expectSize = mWriteMQSize) {
+ void readFromFmq(size_t expectBytes = mWriteMQBytes) {
for (auto& it : mEffectParams) {
IEffect::Status status{};
auto& statusMq = it.statusMQ;
EXPECT_NE(nullptr, statusMq);
EXPECT_TRUE(statusMq->readBlocking(&status, 1));
EXPECT_EQ(STATUS_OK, status.status);
- EXPECT_EQ(expectSize, (unsigned)status.fmqByteProduced);
+ EXPECT_EQ(expectBytes, (unsigned)status.fmqProduced * sizeof(float));
auto& outputMq = it.outputMQ;
EXPECT_NE(nullptr, outputMq);
- EXPECT_EQ(expectSize, outputMq->availableToRead());
+ EXPECT_EQ(expectBytes, outputMq->availableToRead() * sizeof(float));
}
}
@@ -287,16 +299,16 @@
AudioChannelLayout::LAYOUT_STEREO);
Parameter::Common mCommon;
- Parameter::Specific mSpecific;
+ std::optional<Parameter::Specific> mSpecific = std::nullopt;
size_t inputFrameSize, outputFrameSize;
- std::vector<int8_t> mInputBuffer; // reuse same buffer for all effects testing
+ std::vector<float> mInputBuffer; // reuse same buffer for all effects testing
typedef ::android::AidlMessageQueue<
IEffect::Status, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
StatusMQ;
typedef ::android::AidlMessageQueue<
- int8_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
+ float, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
DataMQ;
class EffectParam {
diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
index da8ca37..d30dff4 100644
--- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
@@ -66,13 +66,13 @@
TEST_P(EffectFactoryTest, QueriedDescriptorList) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
EXPECT_NE(descriptors.size(), 0UL);
}
TEST_P(EffectFactoryTest, DescriptorUUIDNotNull) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
// TODO: Factory eventually need to return the full list of MUST supported AOSP effects.
for (auto& desc : descriptors) {
EXPECT_NE(desc.type, EffectNullUuid);
@@ -82,19 +82,19 @@
TEST_P(EffectFactoryTest, QueriedDescriptorNotExistType) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(EffectNullUuid, std::nullopt, &descriptors);
+ mFactory.QueryEffects(EffectNullUuid, std::nullopt, std::nullopt, &descriptors);
EXPECT_EQ(descriptors.size(), 0UL);
}
TEST_P(EffectFactoryTest, QueriedDescriptorNotExistInstance) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, EffectNullUuid, &descriptors);
+ mFactory.QueryEffects(std::nullopt, EffectNullUuid, std::nullopt, &descriptors);
EXPECT_EQ(descriptors.size(), 0UL);
}
TEST_P(EffectFactoryTest, CreateAndDestroyOnce) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
auto numIds = mFactory.GetEffectIds().size();
EXPECT_NE(numIds, 0UL);
@@ -108,7 +108,7 @@
TEST_P(EffectFactoryTest, CreateAndDestroyRepeat) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
auto numIds = mFactory.GetEffectIds().size();
EXPECT_NE(numIds, 0UL);
@@ -128,7 +128,7 @@
TEST_P(EffectFactoryTest, CreateMultipleInstanceOfSameEffect) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
auto numIds = mFactory.GetEffectIds().size();
EXPECT_NE(numIds, 0UL);
@@ -167,7 +167,7 @@
TEST_P(EffectFactoryTest, CreateAndRemoveReference) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
auto numIds = mFactory.GetEffectIds().size();
EXPECT_NE(numIds, 0UL);
@@ -182,7 +182,7 @@
TEST_P(EffectFactoryTest, CreateRemoveReferenceAndCreateDestroy) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
auto numIds = mFactory.GetEffectIds().size();
EXPECT_NE(numIds, 0UL);
@@ -203,7 +203,7 @@
TEST_P(EffectFactoryTest, CreateRestartAndCreateDestroy) {
std::vector<Descriptor::Identity> descriptors;
- mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors);
+ mFactory.QueryEffects(std::nullopt, std::nullopt, std::nullopt, &descriptors);
auto numIds = mFactory.GetEffectIds().size();
auto& effectMap = mFactory.GetEffectMap();
mFactory.CreateEffects();
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 7ed1f01..3ea67bc 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -59,7 +59,6 @@
CreateEffects();
initParamCommonFormat();
initParamCommon();
- // initParamSpecific();
}
void TearDown() override {
@@ -105,8 +104,9 @@
Descriptor desc;
std::vector<Descriptor::Identity> idList;
EXPECT_IS_OK(effect->getDescriptor(&desc));
- QueryEffects(desc.common.id.type, desc.common.id.uuid, &idList);
- EXPECT_EQ(idList.size(), 1UL);
+ QueryEffects(desc.common.id.type, desc.common.id.uuid, desc.common.id.proxy, &idList);
+ // Must have at least one instance.
+ EXPECT_NE(idList.size(), 0UL);
};
ForEachEffect(checker);
@@ -117,7 +117,7 @@
auto vec = GetCompleteEffectIdList();
std::unordered_set<Descriptor::Identity, decltype(stringHash)> idSet(0, stringHash);
for (auto it : vec) {
- EXPECT_EQ(idSet.count(it), 0UL);
+ EXPECT_EQ(idSet.count(it), 0UL) << it.toString();
idSet.insert(it);
}
}
@@ -256,7 +256,8 @@
// open effects, destroy without close, expect to get EX_ILLEGAL_STATE status.
CreateEffects();
OpenEffects();
- DestroyEffects(EX_ILLEGAL_STATE, 1);
+ auto vec = GetCompleteEffectIdList();
+ DestroyEffects(EX_ILLEGAL_STATE, vec.size());
CloseEffects();
}
@@ -310,9 +311,11 @@
CloseEffects();
}
+// TODO: need a way to support setting different sessionId to different effect instances
+#if 0
// Multiple instances of same implementation running.
-TEST_P(AudioEffectTest, MultipleInstancesRunning) {
- CreateEffects(3);
+TEST_P(AudioEffectTest, MultipleInstancesRunningWithDiffSessionId) {
+ CreateEffects();
ExpectState(State::INIT);
OpenEffects();
ExpectState(State::IDLE);
@@ -327,15 +330,16 @@
VerifyParameters();
CloseEffects();
}
+#endif
// Send data to effects and expect it to consume by check statusMQ.
TEST_P(AudioEffectTest, ExpectEffectsToConsumeDataInMQ) {
OpenEffects();
- PrepareInputData(mWriteMQSize);
+ PrepareInputData(mWriteMQBytes);
CommandEffects(CommandId::START);
- writeToFmq(mWriteMQSize);
- readFromFmq(mWriteMQSize);
+ writeToFmq(mWriteMQBytes);
+ readFromFmq(mWriteMQBytes);
ExpectState(State::PROCESSING);
CommandEffects(CommandId::STOP);
diff --git a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
index 3b9699b..4162551 100644
--- a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
@@ -58,16 +58,26 @@
* Here we focus on specific parameter checking, general IEffect interfaces testing performed in
* VtsAudioEfectTargetTest.
*/
-using EqualizerParamTestParam = std::tuple<int, int, int>;
+enum ParamName { PARAM_INSTANCE_NAME, PARAM_PRESET_INDEX, PARAM_BAND_INDEX, PARAM_BAND_LEVEL };
+using EqualizerParamTestParam = std::tuple<std::string, int, int, int>;
+
+/*
+Testing parameter range, assuming the parameter supported by effect is in this range.
+This range is verified with IEffect.getDescriptor(), for any index supported vts expect EX_NONE
+from IEffect.setParameter(), otherwise expect EX_ILLEGAL_ARGUMENT.
+*/
+constexpr std::pair<int, int> kPresetIndexRange = {-1, 10}; // valid range [0, 9]
+constexpr std::pair<int, int> kBandIndexRange = {-1, 5}; // valid range [0, 4]
+constexpr std::pair<int, int> kBandLevelRange = {-5, 5}; // needs update with implementation
class EqualizerParamTest : public ::testing::TestWithParam<EqualizerParamTestParam>,
public EffectHelper {
public:
EqualizerParamTest()
- : EffectHelper(android::getAidlHalInstanceNames(IFactory::descriptor)[0]),
- mParamPresetIndex(std::get<0 /* kPresetIndexRange */>(GetParam())),
- mParamBandIndex(std::get<1 /* kBandIndexRange */>(GetParam())),
- mParamBandLevel(std::get<2 /* kBandLevelRange */>(GetParam())) {}
+ : EffectHelper(std::get<PARAM_INSTANCE_NAME>(GetParam())),
+ mParamPresetIndex(std::get<PARAM_PRESET_INDEX>(GetParam())),
+ mParamBandIndex(std::get<PARAM_BAND_INDEX>(GetParam())),
+ mParamBandLevel(std::get<PARAM_BAND_LEVEL>(GetParam())) {}
void SetUp() override {
CreateEffectsWithUUID(EqualizerTypeUUID);
@@ -85,9 +95,9 @@
CleanUp();
}
- const int mParamPresetIndex;
- const int mParamBandIndex;
- const int mParamBandLevel;
+ int mParamPresetIndex = 0;
+ int mParamBandIndex = 0;
+ int mParamBandLevel = 0;
void SetAndGetEqualizerParameters() {
auto functor = [&](const std::shared_ptr<IEffect>& effect) {
@@ -109,22 +119,57 @@
EXPECT_STATUS(expected, effect->setParameter(expectParam))
<< expectParam.toString();
- // get
+ // only get if parameter in range and set success
if (expected == EX_NONE) {
Parameter getParam;
- Parameter::Specific::Id id;
- id.set<Parameter::Specific::Id::equalizerTag>(tag);
+ Parameter::Id id;
+ Equalizer::Id eqId;
+ eqId.set<Equalizer::Id::commonTag>(tag);
+ id.set<Parameter::Id::equalizerTag>(eqId);
// if set success, then get should match
EXPECT_STATUS(expected, effect->getParameter(id, &getParam));
- EXPECT_EQ(expectParam, getParam) << "\n"
- << expectParam.toString() << "\n"
- << getParam.toString();
+ EXPECT_TRUE(isEqParameterExpected(expectParam, getParam));
}
}
};
EXPECT_NO_FATAL_FAILURE(ForEachEffect(functor));
}
+ bool isEqParameterExpected(const Parameter& expect, const Parameter& target) {
+ // if parameter same, then for sure matched
+ if (expect == target) return true;
+
+ // if not, see if target include the expect parameter, and others all default (0).
+ /*
+ This is verify the case of client setParameter to a single bandLevel ({3, -1} for
+ example), and return of getParameter must be [{0, 0}, {1, 0}, {2, 0}, {3, -1}, {4, 0}]
+ */
+ EXPECT_EQ(expect.getTag(), Parameter::specific);
+ EXPECT_EQ(target.getTag(), Parameter::specific);
+
+ Parameter::Specific expectSpec = expect.get<Parameter::specific>(),
+ targetSpec = target.get<Parameter::specific>();
+ EXPECT_EQ(expectSpec.getTag(), Parameter::Specific::equalizer);
+ EXPECT_EQ(targetSpec.getTag(), Parameter::Specific::equalizer);
+
+ Equalizer expectEq = expectSpec.get<Parameter::Specific::equalizer>(),
+ targetEq = targetSpec.get<Parameter::Specific::equalizer>();
+ EXPECT_EQ(expectEq.getTag(), targetEq.getTag());
+
+ auto eqTag = targetEq.getTag();
+ switch (eqTag) {
+ case Equalizer::bandLevels: {
+ auto expectBl = expectEq.get<Equalizer::bandLevels>();
+ auto targetBl = targetEq.get<Equalizer::bandLevels>();
+ return std::includes(targetBl.begin(), targetBl.end(), expectBl.begin(),
+ expectBl.end());
+ }
+ default:
+ return false;
+ }
+ return false;
+ }
+
void addPresetParam(int preset) {
Equalizer eq;
eq.set<Equalizer::preset>(preset);
@@ -179,7 +224,6 @@
}
private:
- Equalizer::VendorExtension mVendorExtension;
std::vector<std::pair<Equalizer::Tag, std::unique_ptr<Equalizer>>> mTags;
bool validCapabilityTag(Capability& cap) { return cap.getTag() == Capability::equalizer; }
@@ -201,29 +245,34 @@
}
TEST_P(EqualizerParamTest, SetAndGetSingleBand) {
- Equalizer::BandLevel bandLevel = {mParamBandIndex, mParamBandLevel};
std::vector<Equalizer::BandLevel> bandLevels;
+ Equalizer::BandLevel bandLevel = {mParamBandIndex, mParamBandLevel};
bandLevels.push_back(bandLevel);
EXPECT_NO_FATAL_FAILURE(addBandLevelsParam(bandLevels));
SetAndGetEqualizerParameters();
}
-/**
- Testing preset index range with [-10, 10], assuming the min/max preset index supported by
-effect is in this range.
- This range is verified with IEffect.getDescriptor(): for any index supported vts expect EX_NONE
-from IEffect.setParameter(), otherwise expect EX_ILLEGAL_ARGUMENT.
- */
-constexpr std::pair<int, int> kPresetIndexRange = {-1, 10}; // valid range [0, 9]
-constexpr std::pair<int, int> kBandIndexRange = {-1, 5}; // valid range [0, 4]
-constexpr std::pair<int, int> kBandLevelRange = {-5, 5}; // needs update with implementation
-
INSTANTIATE_TEST_SUITE_P(
EqualizerTest, EqualizerParamTest,
- ::testing::Combine(testing::Range(kPresetIndexRange.first, kPresetIndexRange.second),
- testing::Range(kBandIndexRange.first, kBandIndexRange.second),
- testing::Range(kBandLevelRange.first, kBandLevelRange.second)));
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EqualizerTest);
+ ::testing::Combine(
+ testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)),
+ testing::Range(kPresetIndexRange.first, kPresetIndexRange.second),
+ testing::Range(kBandIndexRange.first, kBandIndexRange.second),
+ testing::Range(kBandLevelRange.first, kBandLevelRange.second)),
+ [](const testing::TestParamInfo<EqualizerParamTest::ParamType>& info) {
+ std::string instance = std::get<PARAM_INSTANCE_NAME>(info.param);
+ std::string presetIdx = std::to_string(std::get<PARAM_PRESET_INDEX>(info.param));
+ std::string bandIdx = std::to_string(std::get<PARAM_BAND_INDEX>(info.param));
+ std::string bandLevel = std::to_string(std::get<PARAM_BAND_LEVEL>(info.param));
+
+ std::string name = instance + "_presetIndex" + presetIdx + "_bandIndex" + bandIdx +
+ "_bandLevel" + bandLevel;
+ std::replace_if(
+ name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
+ return name;
+ });
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EqualizerParamTest);
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
diff --git a/automotive/remoteaccess/test_grpc_server/README.md b/automotive/remoteaccess/test_grpc_server/README.md
index 42e2c94..28035de 100644
--- a/automotive/remoteaccess/test_grpc_server/README.md
+++ b/automotive/remoteaccess/test_grpc_server/README.md
@@ -41,7 +41,7 @@
pending tasks through the 'ServerWriter'. If no task is pending, then it must
block and wait for a new task to arrive.
- If one task data is failed to be sent through the channel, it likely means
+ If one task data fails to be sent through the channel, it likely means
the other side (Application processor) is shutting down or has closed the
channel. The wakeup client must put the task back to the pending queue and
wait for a new 'GetRemoteTasks' request to retry sending the task.
@@ -62,7 +62,7 @@
'WakeupRequired' will be set to true and this wakeup client must try to wake
up the device again to execute the pending tasks.
-* Every pending task has a timeout: 'KTaskTimeoutInMs'. If the pending task
+* Every pending task has a timeout: 'kTaskTimeoutInMs'. If the pending task
is not delivered to remote access HAL before the timeout (through
GetRemoteTasks), the task timed out and a warning message is logged.
@@ -73,7 +73,11 @@
## How to build the test wakeup client
-* Under android root: `make -j TestWakeupClientServer`
+* Under android root: `source build/envsetup.sh`
+
+* `lunch sdk_car_x86_64-userdebug`
+
+* `make -j TestWakeupClientServer`
## How to push the test wakeup client to a TCU which runs Android.
@@ -81,7 +85,7 @@
`adb root`
- `adb remount`
+ `adb remount` (remount might take a while)
`adb reboot`
@@ -89,7 +93,7 @@
`adb remount`
-* Under android root: `cd out/target/product/[product_name]`
+* Under android root: `cd $ANDROID_PRODUCT_OUT`
* `adb push vendor/bin/TestWakeupClientServer /vendor/bin`
@@ -99,24 +103,24 @@
* `/vendor/bin/TestWakeupClientServer`
-## How to build and test the test wakeup client using one gcar emulator.
+## How to build and test the test wakeup client using one car emulator.
-In this test setup we will use one google car emulator
-(gcar_emu_x86_64-userdebug). We assume both the TCU and the remote access HAL
+In this test setup we will use one car emulator
+(sdk_car_x86_64-userdebug). We assume both the TCU and the remote access HAL
runs on the same Android system, and they communicate through local loopback
interface.
* Under android root, `source build/envsetup.sh`
-* `lunch gcar_emu_x86_64-userdebug`
+* `lunch sdk_car_x86_64-userdebug`
* `m -j`
* Run the emulator, the '-read-only' flag is required to run multiple instances:
- `aae emulator run -read-only`
+ `emulator -writable-system -read-only`
-* The android lunch target: gcar_emu_x86_64-userdebug and
+* The android lunch target: sdk_car_x86_64-userdebug and
cf_x86_64_auto-userdebug already contains the default remote access HAL. For
other lunch target, you can add the default remote access HAL by adding
'android.hardware.automotive.remoteaccess@V1-default-service' to
@@ -132,7 +136,7 @@
`adb root`
- `adb remount`
+ `adb remount` (remount might take a while)
`adb reboot`
@@ -142,50 +146,52 @@
* `make -j TestWakeupClientServer`
-* `cd out/target/product/emulator_car64_x86_64/`
-
-* `adb push vendor/bin/TestWakeupClientServer /vendor/bin`
+* `adb push $ANDROID_PRODUCT_OUT/vendor/bin/TestWakeupClientServer /vendor/bin`
* `adb shell`
-* `su`
+* `emulator_car_x86_64:/ # su`
-* `/vendor/bin/TestWakeupClientServer`
+* `emulator_car_x86_64:/ # /vendor/bin/TestWakeupClientServer`
-* Remote access HAL should start by default when the gcar emulator starts. Now
+* Remote access HAL should start by default when the car emulator starts. Now
the test wake up client should also be running and generating fake tasks.
- Start a new adb shell session by
+ Start a new session under android root
+
+ `source build/envsetup.sh`
+
+ `lunch sdk_car_x86_64-userdebug`
`adb shell`
- `su`
+ `emulator_car_x86_64:/ # su`
* Issue the command to start a simple debug callback that will capture all the
received tasks at the remote access HAL side:
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --start-debug-callback`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --start-debug-callback`
* Issue the following debug command to remote access HAL to establish the
communication channel between it and the test wakeup client. This command
also notifies that wakeup is not required:
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 1 0`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 1 0`
* Wait for a while, issue the following command to show the received fake tasks:
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task`
You should expect to see some received tasks printed out.
* Simulate the Application Processor is shutting down by issuing the following
command:
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 0 0`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 0 0`
* Wait for a while, issue the following command to show received tasks again:
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task`
You should expect to see no new tasks received since remote access HAL already
closed the communication channel.
@@ -193,47 +199,49 @@
* Simulate the Application Processor is already shutdown and wake up is required
now:
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 0 1`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 0 1`
Now you should expect to see the test wakeup client printing out messages
that it is trying to wake up application processor.
* Simulate the Application Processor is waken up:
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 1 0`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 1 0`
* A new communication channel should have been established and all pending
non-expired tasks should be delivered to the remote access HAL.
- `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task`
+ `emulator_car_x86_64:/ # dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task`
* Now you can issue `ctrl c` on the first adb shell to stop the test wakeup
client.
-## How to build and test the test wakeup client using two gcar emulators.
+* After the test, you can use `ctrl D` to exit the adb shell.
-In this test case, we are going to use two gcar emulators, one as the
+## How to build and test the test wakeup client using two car emulators.
+
+In this test case, we are going to use two car emulators, one as the
Application Processor, one as the TCU.
* Change the IP address to allow IP communication between different emulator
instances. For detail about why we change it this way, see [interconnecting
emulator instance](https://developer.android.com/studio/run/emulator-networking#connecting).
- Change 'DGRPC_SERVICE_ADDRESS' in `test_grpc_server/Android.bp` to
+ Change 'DGRPC_SERVICE_ADDRESS' in `[android_root]/hardware/interfaces/automotive/remoteaccess/test_grpc_server/impl/Android.bp` to
`10.0.2.15:50051`.
- Change `DGRPC_SERVICE_ADDRESS` in 'hal/defaut/Android.bp' to
+ Change `DGRPC_SERVICE_ADDRESS` in '[android_root]/hardware/interfaces/automotive/remoteaccess/hal/defaut/Android.bp' to
`10.0.2.2:50051`.
* Under android root: `source build/envsetup.sh`
-* `lunch gcar_emu_x86_64-userdebug`
+* `lunch sdk_car_x86_64-userdebug`
* `m -j`
-* Start one gcar emulator as TCU
+* Start one car emulator as TCU
- `aae emulator run -read-only`
+ `emulator -writable-system -read-only`
* Start a new shell session. Connect to the emulator's console,
see [Start and stop a console session](https://developer.android.com/studio/run/emulator-console#console-session)
@@ -242,17 +250,23 @@
`telnet localhost 5554`
* `auth auth_token` where auth_token must match the contents of the
- `.emulator_console_auth_token` file.
+ `~/.emulator_console_auth_token` file.
* `redir add tcp:50051:50051`
-* Exit the telnet session
+* Exit the telnet session using 'ctrl-C'
- Make the target device writable:
+ Make the target device writable:
+
+ Under android root:
+
+ `source build/envsetup.sh`
+
+ `lunch sdk_car_x86_64-userdebug`
`adb root`
- `adb remount`
+ `adb remount` (remount might take a while)
`adb reboot`
@@ -262,25 +276,35 @@
* `make -j TestWakeupClientServer`
-* `cd out/target/product/emulator_car64_x86_64/`
-
-* `adb push vendor/bin/TestWakeupClientServer /vendor/bin`
+* `adb push $ANDROID_PRODUCT_OUT/vendor/bin/TestWakeupClientServer /vendor/bin`
* `adb shell`
-* `su`
+* `emulator_car_x86_64:/ # su`
-* `/vendor/bin/TestWakeupClientServer`
+* `emulator_car_x86_64:/ # /vendor/bin/TestWakeupClientServer`
-* Start a new shell, start another gcar emulator as the Application Processor:
+* Start a new shell under android root, start another car emulator as the Application Processor:
- `aae emulator run -read-only`
+ `source build/envsetup.sh`
+
+ `lunch sdk_car_x86_64-userdebug`
+
+ `emulator -writable-system -read-only`
+
+* Open a new shell under android root:
+
+ `source build/envsetup.sh`
+
+ `lunch sdk_car_x86_64-userdebug`
* Connect to adb shell for the application processor:
`adb -s emulator-5556 shell`
- `su`
+ `emulator_car_x86_64:/ # su`
-* Follow the test instructions for one gcar emulator using the 'dumpsys'
+* Follow the test instructions for one car emulator using the 'dumpsys'
commands.
+
+* After the test, you can use `ctrl D` to exit the adb shell.
diff --git a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h
index 61c1ad3..12bd93b 100644
--- a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h
+++ b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h
@@ -81,6 +81,7 @@
void waitForTask();
void stopWait();
void handleTaskTimeout();
+ bool isEmpty();
private:
std::thread mCheckTaskTimeoutThread;
@@ -117,6 +118,8 @@
std::thread mThread;
// A variable to notify server is stopping.
std::condition_variable mServerStoppedCv;
+ // Whether wakeup AP is required for executing tasks.
+ std::atomic<bool> mWakeupRequired = false;
std::mutex mLock;
bool mServerStopped GUARDED_BY(mLock);
@@ -126,6 +129,8 @@
TaskQueue mTaskQueue;
void fakeTaskGenerateLoop();
+
+ void wakeupApplicationProcessor();
};
} // namespace remoteaccess
diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
index f64ac10..795265f 100644
--- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
+++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
@@ -125,6 +125,11 @@
mTasksNotEmptyCv.notify_all();
}
+bool TaskQueue::isEmpty() {
+ std::lock_guard<std::mutex> lockGuard(mLock);
+ return mTasks.size() == 0 || mStopped;
+}
+
void TaskQueue::checkForTestTimeoutLoop() {
Looper::setForThread(mLooper);
@@ -179,6 +184,11 @@
// from it. Here we simulate receiving one remote task every {kTaskIntervalInMs}ms.
while (true) {
mTaskQueue.add(mFakeTaskGenerator.generateTask());
+ printf("Received a new task\n");
+ if (mWakeupRequired) {
+ wakeupApplicationProcessor();
+ }
+
printf("Sleeping for %d seconds until next task\n", kTaskIntervalInMs);
std::unique_lock lk(mLock);
@@ -224,9 +234,21 @@
Status TestWakeupClientServiceImpl::NotifyWakeupRequired(ServerContext* context,
const NotifyWakeupRequiredRequest* request,
NotifyWakeupRequiredResponse* response) {
+ if (request->iswakeuprequired() && !mWakeupRequired && !mTaskQueue.isEmpty()) {
+ // If wakeup is now required and previously not required, this means we have finished
+ // shutting down the device. If there are still pending tasks, try waking up AP again
+ // to finish executing those tasks.
+ wakeupApplicationProcessor();
+ }
+ mWakeupRequired = request->iswakeuprequired();
return Status::OK;
}
+void TestWakeupClientServiceImpl::wakeupApplicationProcessor() {
+ printf("Waking up application processor...\n");
+ // TODO(b/254547153): Send can bus message using socket CAN once we know what the message is.
+}
+
} // namespace remoteaccess
} // namespace automotive
} // namespace hardware
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 557061a..017f6ef 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -387,22 +387,6 @@
mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
}
- // register a new callback; make sure it receives the
- // flash-on callback.
- std::shared_ptr<TorchProviderCb> cb2 = ndk::SharedRefBase::make<TorchProviderCb>(this);
- ret = mProvider->setCallback(cb2);
- ASSERT_TRUE(ret.isOk());
- ASSERT_NE(cb2, nullptr);
- {
- std::unique_lock<std::mutex> l(mTorchLock);
- while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kTorchTimeoutSec);
- ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout));
- }
- ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus);
- }
-
ret = device->setTorchMode(false);
ASSERT_TRUE(ret.isOk());
{
diff --git a/cas/aidl/Android.bp b/cas/aidl/Android.bp
index 0dfc0ce..32f12b1 100644
--- a/cas/aidl/Android.bp
+++ b/cas/aidl/Android.bp
@@ -14,6 +14,15 @@
* 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.cas",
vendor_available: true,
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 15f20d2..dc87c63 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -204,7 +204,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl" optional="true" updatable-via-apex="true">
<name>android.hardware.drm</name>
<version>1</version>
<interface>
@@ -506,6 +506,16 @@
<instance>slot3</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true">
+ <name>android.hardware.radio.ims</name>
+ <version>1</version>
+ <interface>
+ <name>IRadioIms</name>
+ <instance>slot1</instance>
+ <instance>slot2</instance>
+ <instance>slot3</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="true">
<name>android.hardware.radio</name>
<version>1.2</version>
@@ -514,6 +524,14 @@
<instance>slot1</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true">
+ <name>android.hardware.radio.ims.media</name>
+ <version>1</version>
+ <interface>
+ <name>IImsMedia</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="true">
<name>android.hardware.renderscript</name>
<version>1.0</version>
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 7bae45e..128ef49 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
@@ -39,4 +39,5 @@
HDR10 = 2,
HLG = 3,
HDR10_PLUS = 4,
+ DOLBY_VISION_4K30 = 5,
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
index f543780..407b54f 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
@@ -39,4 +39,8 @@
* Device supports HDR10+
*/
HDR10_PLUS = 4,
+ /**
+ * If present, indicates that device supports Dolby Vision only up to 4k30hz graphics mode
+ */
+ DOLBY_VISION_4K30 = 5,
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl
index 6eba887..0e2d72b 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl
@@ -42,4 +42,5 @@
AUTO_LOW_LATENCY_MODE = 5,
SUSPEND = 6,
DISPLAY_IDLE_TIMER = 7,
+ MULTI_THREADED_PRESENT = 8,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
index f4b2984..7154d74 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
@@ -80,4 +80,20 @@
* IComposerCallback.onVsyncIdle.
*/
DISPLAY_IDLE_TIMER = 7,
+ /**
+ * Indicates that both the composer HAL implementation and the given display
+ * support calling executeCommands concurrently from separate threads.
+ * executeCommands for a particular display will never run concurrently to
+ * any other executeCommands for the same display. In addition, the
+ * CommandResultPayload must only reference displays included in the
+ * DisplayCommands passed to executeCommands. Displays referenced from
+ * separate threads must have minimal interference with one another. If a
+ * HWC-managed display has this capability, SurfaceFlinger can run
+ * executeCommands for this display concurrently with other displays with the
+ * same capability.
+ * @see IComposerClient.executeCommands
+ * @see DisplayCommand.presentDisplay
+ * @see DisplayCommand.validateDisplay
+ */
+ MULTI_THREADED_PRESENT = 8,
}
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h
index 34cda6a..b50b84b 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h
@@ -18,6 +18,7 @@
#include <aidl/android/hardware/graphics/composer3/CommandResultPayload.h>
#include <aidl/android/hardware/graphics/composer3/IComposerClient.h>
+#include <android-base/logging.h>
#include <inttypes.h>
#include <string.h>
@@ -26,8 +27,6 @@
#include <memory>
#include <vector>
-#include "Util.h"
-
namespace aidl::android::hardware::graphics::composer3::impl {
class ComposerServiceWriter {
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 78dce63..ed8a06c 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -2170,6 +2170,20 @@
}
}
+TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) {
+ std::vector<VtsDisplay*> displays;
+ for (auto& display : mDisplays) {
+ if (hasDisplayCapability(display.getDisplayId(),
+ DisplayCapability::MULTI_THREADED_PRESENT)) {
+ displays.push_back(&display);
+ }
+ }
+ if (displays.size() <= 1u) {
+ return;
+ }
+ // TODO(b/251842321): Try to present on multiple threads.
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest);
INSTANTIATE_TEST_SUITE_P(
PerInstance, GraphicsComposerAidlCommandTest,
diff --git a/identity/aidl/aidl_api/android.hardware.identity/current/android/hardware/identity/B237048744.aidl b/identity/aidl/aidl_api/android.hardware.identity/current/android/hardware/identity/B237048744.aidl
new file mode 100644
index 0000000..7fee851
--- /dev/null
+++ b/identity/aidl/aidl_api/android.hardware.identity/current/android/hardware/identity/B237048744.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2020 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.identity;
+@VintfStability
+enum B237048744 {
+ V5 = 0,
+}
diff --git a/identity/aidl/android/hardware/identity/B237048744.aidl b/identity/aidl/android/hardware/identity/B237048744.aidl
new file mode 100644
index 0000000..24b16c0
--- /dev/null
+++ b/identity/aidl/android/hardware/identity/B237048744.aidl
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2020 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.identity;
+
+@VintfStability
+enum B237048744 {
+ V5 /* bump only includes import changes */,
+}
diff --git a/ir/aidl/default/Android.bp b/ir/aidl/default/Android.bp
index a4fb439..a8096c2 100644
--- a/ir/aidl/default/Android.bp
+++ b/ir/aidl/default/Android.bp
@@ -36,6 +36,7 @@
"liblog",
"libutils",
"android.hardware.ir-V1-ndk",
+ "libhardware"
],
srcs: ["main.cpp"],
diff --git a/ir/aidl/default/android.hardware.ir-service.example.rc b/ir/aidl/default/android.hardware.ir-service.example.rc
index 56def64..d27f282 100644
--- a/ir/aidl/default/android.hardware.ir-service.example.rc
+++ b/ir/aidl/default/android.hardware.ir-service.example.rc
@@ -1,4 +1,4 @@
service vendor.ir-default /vendor/bin/hw/android.hardware.ir-service.example
class hal
- user nobody
- group nobody
+ user system
+ group system
diff --git a/ir/aidl/default/main.cpp b/ir/aidl/default/main.cpp
index 7c4a816..92376fc 100644
--- a/ir/aidl/default/main.cpp
+++ b/ir/aidl/default/main.cpp
@@ -15,49 +15,77 @@
*/
#include <aidl/android/hardware/ir/BnConsumerIr.h>
+#include <aidl/android/hardware/ir/ConsumerIrFreqRange.h>
#include <android-base/logging.h>
#include <android/binder_interface_utils.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
+#include <hardware/consumerir.h>
#include <numeric>
+#include <log/log.h>
+
+using ::aidl::android::hardware::ir::ConsumerIrFreqRange;
+
namespace aidl::android::hardware::ir {
-const std::vector<ConsumerIrFreqRange> kSupportedFreqs = {
- {2000, 4000},
- {10000, 30000},
-};
-
class ConsumerIr : public BnConsumerIr {
+ public:
+ ConsumerIr();
+ private:
::ndk::ScopedAStatus getCarrierFreqs(std::vector<ConsumerIrFreqRange>* _aidl_return) override;
::ndk::ScopedAStatus transmit(int32_t in_carrierFreqHz,
const std::vector<int32_t>& in_pattern) override;
+ consumerir_device_t *mDevice = nullptr;
};
-::ndk::ScopedAStatus ConsumerIr::getCarrierFreqs(std::vector<ConsumerIrFreqRange>* _aidl_return) {
- *_aidl_return = kSupportedFreqs;
- return ::ndk::ScopedAStatus::ok();
+ConsumerIr::ConsumerIr() {
+ const hw_module_t *hw_module = NULL;
+
+ int ret = hw_get_module(CONSUMERIR_HARDWARE_MODULE_ID, &hw_module);
+ if (ret != 0) {
+ ALOGE("hw_get_module %s failed: %d", CONSUMERIR_HARDWARE_MODULE_ID, ret);
+ return;
+ }
+ ret = hw_module->methods->open(hw_module, CONSUMERIR_TRANSMITTER, (hw_device_t **) &mDevice);
+ if (ret < 0) {
+ // note - may want to make this a fatal error - otherwise the service will crash when it's used
+ ALOGE("Can't open consumer IR transmitter, error: %d", ret);
+ // in case it's modified
+ mDevice = nullptr;
+ }
}
-bool isSupportedFreq(int32_t freq) {
- for (const auto& range : kSupportedFreqs) {
- if (freq >= range.minHz && freq <= range.maxHz) return true;
+::ndk::ScopedAStatus ConsumerIr::getCarrierFreqs(std::vector<ConsumerIrFreqRange>* _aidl_return) {
+ int32_t len = mDevice->get_num_carrier_freqs(mDevice);
+ if (len < 0) {
+ (*_aidl_return).clear();
+ return ::ndk::ScopedAStatus::ok();
}
- return false;
+
+ consumerir_freq_range_t *rangeAr = new consumerir_freq_range_t[len];
+ bool success = (mDevice->get_carrier_freqs(mDevice, len, rangeAr) >= 0);
+ if (!success) {
+ (*_aidl_return).clear();
+ return ::ndk::ScopedAStatus::ok();
+ }
+
+ (*_aidl_return).resize(len);
+ for (int32_t i = 0; i < len; i++) {
+ (*_aidl_return)[i].minHz = static_cast<uint32_t>(rangeAr[i].min);
+ (*_aidl_return)[i].maxHz = static_cast<uint32_t>(rangeAr[i].max);
+ }
+ return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus ConsumerIr::transmit(int32_t in_carrierFreqHz,
const std::vector<int32_t>& in_pattern) {
- if (isSupportedFreq(in_carrierFreqHz)) {
- // trasmit the pattern, each integer is number of microseconds in an
- // alternating on/off state.
- usleep(std::accumulate(in_pattern.begin(), in_pattern.end(), 0));
+ if (in_carrierFreqHz > 0) {
+ mDevice->transmit(mDevice, in_carrierFreqHz, in_pattern.data(), in_pattern.size());
return ::ndk::ScopedAStatus::ok();
} else {
- // unsupported operation
return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
- return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::ir
diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp
index 613f31b..8911aea 100644
--- a/radio/aidl/Android.bp
+++ b/radio/aidl/Android.bp
@@ -203,3 +203,37 @@
],
}
+
+aidl_interface {
+ name: "android.hardware.radio.ims.media",
+ vendor_available: true,
+ srcs: ["android/hardware/radio/ims/media/*.aidl"],
+ stability: "vintf",
+ imports: ["android.hardware.radio-V1",
+ "android.hardware.radio.data-V1"],
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ sdk_version: "module_current",
+ },
+ },
+}
+
+aidl_interface {
+ name: "android.hardware.radio.ims",
+ vendor_available: true,
+ srcs: ["android/hardware/radio/ims/*.aidl"],
+ stability: "vintf",
+ imports: ["android.hardware.radio-V1"],
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ sdk_version: "module_current",
+ },
+ },
+}
+
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
new file mode 100644
index 0000000..5179169
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum AmrMode {
+ AMR_MODE_0 = 1 << 0,
+ AMR_MODE_1 = 1 << 1,
+ AMR_MODE_2 = 1 << 2,
+ AMR_MODE_3 = 1 << 3,
+ AMR_MODE_4 = 1 << 4,
+ AMR_MODE_5 = 1 << 5,
+ AMR_MODE_6 = 1 << 6,
+ AMR_MODE_7 = 1 << 7,
+ AMR_MODE_8 = 1 << 8,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl
new file mode 100644
index 0000000..36edb7f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable AmrParams {
+ android.hardware.radio.ims.media.AmrMode amrMode;
+ boolean octetAligned;
+ int maxRedundancyMillis;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
new file mode 100644
index 0000000..711ac19
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable AnbrBitrate {
+ int uplinkBps;
+ int downlinkBps;
+ const int INVALID_ANBR_BITRATE = -1;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl
new file mode 100644
index 0000000..fff6e1c
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable CallQuality {
+ int downlinkCallQualityLevel;
+ int uplinkCallQualityLevel;
+ int callDuration;
+ int numRtpPacketsTransmitted;
+ int numRtpPacketsReceived;
+ int numRtpPacketsTransmittedLost;
+ int numRtpPacketsNotReceived;
+ int averageRelativeJitter;
+ int maxRelativeJitter;
+ int averageRoundTripTime;
+ int codecType;
+ boolean rtpInactivityDetected;
+ boolean rxSilenceDetected;
+ boolean txSilenceDetected;
+ int numVoiceFrames;
+ int numNoDataFrames;
+ int numDroppedRtpPackets;
+ long minPlayoutDelayMillis;
+ long maxPlayoutDelayMillis;
+ int numRtpSidPacketsReceived;
+ int numRtpDuplicatePackets;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl
new file mode 100644
index 0000000..3da2dbd
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.radio.ims.media;
+@VintfStability
+parcelable CodecParams {
+ android.hardware.radio.ims.media.CodecType codecType;
+ byte rxPayloadTypeNumber;
+ byte txPayloadTypeNumber;
+ byte samplingRateKHz;
+ boolean dtxEnabled;
+ android.hardware.radio.ims.media.CodecSpecificParams codecSpecificParams;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl
new file mode 100644
index 0000000..08e3f0f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+union CodecSpecificParams {
+ android.hardware.radio.ims.media.AmrParams amr;
+ android.hardware.radio.ims.media.EvsParams evs;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
new file mode 100644
index 0000000..56d2800
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum CodecType {
+ AMR = 1,
+ AMR_WB = 2,
+ EVS = 4,
+ PCMA = 8,
+ PCMU = 16,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl
new file mode 100644
index 0000000..5523fd8
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable DtmfParams {
+ byte rxPayloadTypeNumber;
+ byte txPayloadTypeNumber;
+ byte samplingRateKHz;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
new file mode 100644
index 0000000..eb31175
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum EvsBandwidth {
+ NONE = 0,
+ NARROW_BAND = 1,
+ WIDE_BAND = 2,
+ SUPER_WIDE_BAND = 4,
+ FULL_BAND = 8,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
new file mode 100644
index 0000000..a067357
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum EvsMode {
+ EVS_MODE_0 = 1 << 0,
+ EVS_MODE_1 = 1 << 1,
+ EVS_MODE_2 = 1 << 2,
+ EVS_MODE_3 = 1 << 3,
+ EVS_MODE_4 = 1 << 4,
+ EVS_MODE_5 = 1 << 5,
+ EVS_MODE_6 = 1 << 6,
+ EVS_MODE_7 = 1 << 7,
+ EVS_MODE_8 = 1 << 8,
+ EVS_MODE_9 = 1 << 9,
+ EVS_MODE_10 = 1 << 10,
+ EVS_MODE_11 = 1 << 11,
+ EVS_MODE_12 = 1 << 12,
+ EVS_MODE_13 = 1 << 13,
+ EVS_MODE_14 = 1 << 14,
+ EVS_MODE_15 = 1 << 15,
+ EVS_MODE_16 = 1 << 16,
+ EVS_MODE_17 = 1 << 17,
+ EVS_MODE_18 = 1 << 18,
+ EVS_MODE_19 = 1 << 19,
+ EVS_MODE_20 = 1 << 20,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl
new file mode 100644
index 0000000..735eb08
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.radio.ims.media;
+@VintfStability
+parcelable EvsParams {
+ android.hardware.radio.ims.media.EvsBandwidth bandwidth;
+ android.hardware.radio.ims.media.EvsMode evsMode;
+ byte channelAwareMode;
+ boolean useHeaderFullOnly;
+ boolean useEvsModeSwitch;
+ byte codecModeRequest;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl
new file mode 100644
index 0000000..30793e5
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+interface IImsMedia {
+ oneway void setListener(in android.hardware.radio.ims.media.IImsMediaListener mediaListener);
+ oneway void openSession(int sessionId, in android.hardware.radio.ims.media.LocalEndPoint localEndPoint, in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void closeSession(int sessionId);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl
new file mode 100644
index 0000000..40f7107
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+interface IImsMediaListener {
+ oneway void onOpenSessionSuccess(int sessionId, android.hardware.radio.ims.media.IImsMediaSession session);
+ oneway void onOpenSessionFailure(int sessionId, android.hardware.radio.ims.media.RtpError error);
+ oneway void onSessionClosed(int sessionId);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl
new file mode 100644
index 0000000..ea9f3a4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// 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.radio.ims.media;
+@VintfStability
+interface IImsMediaSession {
+ oneway void setListener(in android.hardware.radio.ims.media.IImsMediaSessionListener sessionListener);
+ oneway void modifySession(in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void sendDtmf(char dtmfDigit, int duration);
+ oneway void startDtmf(char dtmfDigit);
+ oneway void stopDtmf();
+ oneway void sendHeaderExtension(in List<android.hardware.radio.ims.media.RtpHeaderExtension> extensions);
+ oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
new file mode 100644
index 0000000..f03b29e
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.radio.ims.media;
+@VintfStability
+interface IImsMediaSessionListener {
+ oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error);
+ oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void onHeaderExtensionReceived(in List<android.hardware.radio.ims.media.RtpHeaderExtension> extensions);
+ oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType);
+ oneway void notifyPacketLoss(int packetLossPercentage);
+ oneway void notifyJitter(int jitter);
+ oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void onDtmfReceived(char dtmfDigit);
+ oneway void onCallQualityChanged(in android.hardware.radio.ims.media.CallQuality callQuality);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl
new file mode 100644
index 0000000..6ec5156
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable LocalEndPoint {
+ ParcelFileDescriptor rtpFd;
+ ParcelFileDescriptor rtcpFd;
+ int modemId;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
new file mode 100644
index 0000000..d90b2a4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum MediaDirection {
+ NO_FLOW = 0,
+ SEND_ONLY = 1,
+ RECEIVE_ONLY = 2,
+ SEND_RECEIVE = 3,
+ INACTIVE = 4,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl
new file mode 100644
index 0000000..1a290d4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum MediaProtocolType {
+ RTP = 0,
+ RTCP = 1,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
new file mode 100644
index 0000000..a448bac
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.radio.ims.media;
+@VintfStability
+parcelable MediaQualityThreshold {
+ int rtpInactivityTimerMillis;
+ int rtcpInactivityTimerMillis;
+ int rtpPacketLossDurationMillis;
+ int rtpPacketLossRate;
+ int jitterDurationMillis;
+ int rtpJitterMillis;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl
new file mode 100644
index 0000000..6a76d85
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.radio.ims.media;
+@VintfStability
+parcelable RtcpConfig {
+ String canonicalName;
+ int transmitPort;
+ int transmitIntervalSec;
+ int rtcpXrBlocks;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
new file mode 100644
index 0000000..2eefe6f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// 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.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum RtcpXrReportBlockType {
+ RTCPXR_NONE = 0,
+ RTCPXR_LOSS_RLE_REPORT_BLOCK = 1,
+ RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 2,
+ RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 4,
+ RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 8,
+ RTCPXR_DLRR_REPORT_BLOCK = 16,
+ RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 32,
+ RTCPXR_VOIP_METRICS_REPORT_BLOCK = 64,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl
new file mode 100644
index 0000000..35357d1
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtpAddress {
+ String ipAddress;
+ int portNumber;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
new file mode 100644
index 0000000..ad8b86c
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.radio.ims.media;
+@VintfStability
+parcelable RtpConfig {
+ android.hardware.radio.ims.media.MediaDirection direction;
+ android.hardware.radio.AccessNetwork accessNetwork;
+ android.hardware.radio.ims.media.RtpAddress remoteAddress;
+ android.hardware.radio.ims.media.RtpSessionParams sessionParams;
+ android.hardware.radio.ims.media.RtcpConfig rtcpConfig;
+ android.hardware.radio.ims.media.AnbrBitrate anbrBitrateParams;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl
new file mode 100644
index 0000000..41b0aeb
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// 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.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum RtpError {
+ NONE = 0,
+ INVALID_PARAM = 1,
+ NOT_READY = 2,
+ NO_MEMORY = 3,
+ NO_RESOURCES = 4,
+ PORT_UNAVAILABLE = 5,
+ NOT_SUPPORTED = 6,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
new file mode 100644
index 0000000..83b8a31
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtpHeaderExtension {
+ int localId;
+ byte[] data;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl
new file mode 100644
index 0000000..13a7487
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtpSessionParams {
+ byte pTimeMillis;
+ int maxPtimeMillis;
+ byte dscp;
+ android.hardware.radio.ims.media.DtmfParams dtmfParams;
+ android.hardware.radio.ims.media.CodecParams codecParams;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl
new file mode 100644
index 0000000..030479f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@JavaDerive(toString=true) @VintfStability
+parcelable ConnectionFailureInfo {
+ android.hardware.radio.ims.ConnectionFailureInfo.ConnectionFailureReason failureReason;
+ int causeCode;
+ int waitTimeMillis;
+ @Backing(type="int") @VintfStability
+ enum ConnectionFailureReason {
+ REASON_ACCESS_DENIED = 1,
+ REASON_NAS_FAILURE = 2,
+ REASON_RACH_FAILURE = 3,
+ REASON_RLC_FAILURE = 4,
+ REASON_RRC_REJECT = 5,
+ REASON_RRC_TIMEOUT = 6,
+ REASON_NO_SERVICE = 7,
+ REASON_PDN_NOT_AVAILABLE = 8,
+ REASON_RF_BUSY = 9,
+ REASON_UNSPECIFIED = 65535,
+ }
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl
new file mode 100644
index 0000000..ebea903
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum EpsFallbackReason {
+ NO_NETWORK_TRIGGER = 1,
+ NO_NETWORK_RESPONSE = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl
new file mode 100644
index 0000000..ee5c572
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@VintfStability
+interface IRadioIms {
+ oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls);
+ oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration);
+ oneway void startImsTraffic(int serial, in String token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType);
+ oneway void stopImsTraffic(int serial, in String token);
+ oneway void triggerEpsFallback(int serial, in android.hardware.radio.ims.EpsFallbackReason reason);
+ oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication);
+ oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl
new file mode 100644
index 0000000..63f29f3
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@VintfStability
+interface IRadioImsIndication {
+ oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, in String token, in android.hardware.radio.ims.ConnectionFailureInfo info);
+ oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsStreamType mediaType, in android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond);
+ oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsDeregistrationReason reason);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl
new file mode 100644
index 0000000..d4fd23f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@VintfStability
+interface IRadioImsResponse {
+ oneway void setSrvccCallInfoResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void startImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info, in @nullable android.hardware.radio.ims.ConnectionFailureInfo failureInfo);
+ oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void triggerEpsFallbackResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl
new file mode 100644
index 0000000..b04e559
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsDeregistrationReason {
+ REASON_SIM_REMOVED = 1,
+ REASON_SIM_REFRESH = 2,
+ REASON_ALLOWED_NETWORK_TYPES_CHANGED = 3,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl
new file mode 100644
index 0000000..1c4c12a
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@JavaDerive(toString=true) @VintfStability
+parcelable ImsRegistration {
+ android.hardware.radio.ims.ImsRegistrationState regState;
+ android.hardware.radio.AccessNetwork accessNetworkType;
+ android.hardware.radio.ims.SuggestedAction suggestedAction;
+ int capabilities;
+ const int IMS_MMTEL_CAPABILITY_NONE = 0;
+ const int IMS_MMTEL_CAPABILITY_VOICE = 1;
+ const int IMS_MMTEL_CAPABILITY_VIDEO = 2;
+ const int IMS_MMTEL_CAPABILITY_SMS = 4;
+ const int IMS_RCS_CAPABILITIES = 8;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl
new file mode 100644
index 0000000..664f561
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsRegistrationState {
+ NOT_REGISTERED = 0,
+ REGISTERED = 1,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl
new file mode 100644
index 0000000..cf2e4f1
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsStreamDirection {
+ UPLINK = 1,
+ DOWNLINK = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl
new file mode 100644
index 0000000..10c477f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @VintfStability
+enum ImsStreamType {
+ AUDIO = 1,
+ VIDEO = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl
new file mode 100644
index 0000000..f7654b4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsTrafficType {
+ EMERGENCY = 0,
+ EMERGENCY_SMS = 1,
+ VOICE = 2,
+ VIDEO = 3,
+ SMS = 4,
+ REGISTRATION = 5,
+ UT_XCAP = 6,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl
new file mode 100644
index 0000000..a8b7cfc
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@JavaDerive(toString=true) @VintfStability
+parcelable SrvccCall {
+ int index;
+ android.hardware.radio.ims.SrvccCall.CallType callType;
+ int callState;
+ android.hardware.radio.ims.SrvccCall.CallSubState callSubstate;
+ android.hardware.radio.ims.SrvccCall.ToneType ringbackToneType;
+ boolean isMpty;
+ boolean isMT;
+ String number;
+ int numPresentation;
+ String name;
+ int namePresentation;
+ @Backing(type="int") @VintfStability
+ enum CallType {
+ NORMAL = 0,
+ EMERGENCY = 1,
+ }
+ @Backing(type="int") @VintfStability
+ enum CallSubState {
+ NONE = 0,
+ PREALERTING = 1,
+ }
+ @Backing(type="int") @VintfStability
+ enum ToneType {
+ NONE = 0,
+ LOCAL = 1,
+ NETWORK = 2,
+ }
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl
new file mode 100644
index 0000000..da19774
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum SuggestedAction {
+ NONE = 0,
+ TRIGGER_PLMN_BLOCK = 1,
+ TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl
index dfbf881..93df3a4 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl
@@ -36,4 +36,13 @@
parcelable EutranRegistrationInfo {
android.hardware.radio.network.LteVopsInfo lteVopsInfo;
android.hardware.radio.network.NrIndicators nrIndicators;
+ android.hardware.radio.network.EutranRegistrationInfo.AttachResultType lteAttachResultType;
+ int extraInfo;
+ const int EXTRA_CSFB_NOT_PREFERRED = 1;
+ const int EXTRA_SMS_ONLY = 2;
+ enum AttachResultType {
+ NONE = 0,
+ EPS_ONLY = 1,
+ COMBINED = 2,
+ }
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl
index e6e7999..711c9ac 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl
@@ -44,4 +44,5 @@
NOT_REG_MT_SEARCHING_OP_EM = 12,
REG_DENIED_EM = 13,
UNKNOWN_EM = 14,
+ REG_EM = 20,
}
diff --git a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl
new file mode 100644
index 0000000..70faa1e
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable ConnectionFailureInfo {
+
+ @VintfStability
+ @Backing(type="int")
+ enum ConnectionFailureReason {
+ /** Access class check failed */
+ REASON_ACCESS_DENIED = 1,
+ /** 3GPP Non-access stratum failure */
+ REASON_NAS_FAILURE = 2,
+ /** Random access failure */
+ REASON_RACH_FAILURE = 3,
+ /** Radio link failure */
+ REASON_RLC_FAILURE = 4,
+ /** Radio connection establishment rejected by network */
+ REASON_RRC_REJECT = 5,
+ /** Radio connection establishment timed out */
+ REASON_RRC_TIMEOUT = 6,
+ /** Device currently not in service */
+ REASON_NO_SERVICE = 7,
+ /** The PDN is no more active */
+ REASON_PDN_NOT_AVAILABLE = 8,
+ /** Radio resource is busy with another subscription */
+ REASON_RF_BUSY = 9,
+ REASON_UNSPECIFIED = 0xFFFF,
+ }
+
+ /**
+ * Values are REASON_* constants
+ */
+ ConnectionFailureReason failureReason;
+
+ /**
+ * Failure cause code from network or modem specific to the failure
+ */
+ int causeCode;
+
+ /**
+ * Retry wait time provided by network in milliseconds
+ */
+ int waitTimeMillis;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl
new file mode 100644
index 0000000..670638b
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum EpsFallbackReason {
+ /**
+ * If VoNR is not supported and EPS fallback is not triggered by network then UE initiated EPS
+ * fallback would be triggered by IMS stack with this reason. The modem shall locally release
+ * the 5G NR SA RRC connection and acquire the LTE network and perform a tracking area update
+ * procedure. After the EPS fallback procedure is completed, the call setup for voice will
+ * be established.
+ */
+ NO_NETWORK_TRIGGER = 1,
+
+ /**
+ * If the UE doesn't receive any response for SIP INVITE within a certain time in 5G NR SA,
+ * UE initiated EPS fallback will be triggered with this reason. The modem shall reset its data
+ * buffer of IMS PDUs to prevent the ghost call. After the EPS fallback procedure is completed,
+ * the VoLTE call will be established.
+ */
+ NO_NETWORK_RESPONSE = 2,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl
new file mode 100644
index 0000000..76b1f03
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.ims.EpsFallbackReason;
+import android.hardware.radio.ims.ImsRegistration;
+import android.hardware.radio.ims.ImsStreamDirection;
+import android.hardware.radio.ims.ImsTrafficType;
+import android.hardware.radio.ims.IRadioImsIndication;
+import android.hardware.radio.ims.IRadioImsResponse;
+import android.hardware.radio.ims.SrvccCall;
+import android.hardware.radio.ims.ImsStreamDirection;
+import android.hardware.radio.ims.ImsStreamType;
+
+/**
+ * This interface is used by IMS telephony layer to talk to cellular radio.
+ * All the functions have minimum one parameter:
+ * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
+ * duration of a method call. If clients provide colliding serials (including passing the same
+ * serial to different methods), multiple responses (one for each method call) must still be served.
+ * setResponseFunctions must work with IRadioImsResponse and IRadioImsIndication.
+ */
+@VintfStability
+oneway interface IRadioIms {
+ /**
+ * Provides a list of SRVCC call information to radio.
+ *
+ * @param serial Serial number of request
+ * @param srvccCalls the list of calls
+ *
+ * Response function is IRadioImsResponse.setSrvccCallInfoResponse()
+ */
+ void setSrvccCallInfo(int serial, in SrvccCall[] srvccCalls);
+
+ /**
+ * Update the IMS registration information to the radio.
+ *
+ * This information shall be used by radio to implement following carrier requirements:
+ * 1) Graceful IMS PDN disconnection on cellular when NAS is about to perform detach
+ * eg. SIM removal or SIM refresh
+ * 2) Block PLMN or RAT based on the IMS registration failure reason
+ *
+ * @param serial Serial number of request
+ * @param imsRegistration IMS registration information
+ *
+ * Response function is IRadioImsResponse.updateImsRegistrationInfoResponse()
+ */
+ void updateImsRegistrationInfo(int serial, in ImsRegistration imsRegistration);
+
+ /**
+ * IMS stack notifies the NAS and RRC layers of the radio that the upcoming IMS traffic is
+ * for the service mentioned in the ImsTrafficType. If this API is not
+ * explicitly invoked and IMS module sends traffic on IMS PDN then the radio
+ * shall treat type as background data traffic type.
+ * This API shall be used by modem
+ * 1. To set the appropriate establishment cause in RRC connection request.
+ * 2. To prioritize RF resources in case of DSDS. The service priority is
+ * EMERGENCY > EMERGENCY SMS > VOICE > VIDEO > SMS > REGISTRATION > Ut/XCAP. The RF
+ * shall be prioritized to the subscription which handles higher priority service.
+ * When both subscriptions are handling the same type of service then RF shall be
+ * prioritized to the voice preferred sub.
+ * 3. To evaluate the overall access barring in the case of ACB, ACB-Skp/SCM and UAC.
+ * The response {@link IRadioImsResponse#startImsTrafficResponse()} with success shall
+ * be sent by modem upon access class is allowed and RF resource is allotted. Otherwise
+ * the same API shall be invoked with appropriate {@link ConnectionFailureInfo}. Further
+ * if RRC connection setup fails then {@link IRadioImsIndication#onConnectionSetupFailure()}
+ * shall be invoked by modem with appropriate {@link ConnectionFailureInfo}.
+ *
+ * @param serial Serial number of request
+ * @param token A nonce to identify the request
+ * @param imsTrafficType IMS traffic type like registration, voice, and video
+ * @param accessNetworkType The type of the radio access network used
+ *
+ * Response function is IRadioImsResponse.startImsTrafficResponse()
+ */
+ void startImsTraffic(int serial, in String token,
+ ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType);
+
+ /**
+ * Indicates IMS traffic has been stopped.
+ * For all IMS traffic, notified with startImsTraffic, IMS service shall notify
+ * stopImsTraffic when it completes the traffic specified by the token.
+ *
+ * @param serial Serial number of request
+ * @param token The token assigned by startImsTraffic()
+ *
+ * Response function is IRadioImsResponse.stopImsTrafficResponse()
+ */
+ void stopImsTraffic(int serial, in String token);
+
+ /**
+ * Triggers the UE initiated EPS fallback when a MO voice call failed to establish on 5G NR
+ * network and network didn't initiate a fallback.
+ *
+ * @param serial Serial number of request
+ * @param reason Specifies the reason that causes EPS fallback
+ *
+ * Response function is IRadioImsResponse.triggerEpsFallbackResponse()
+ */
+ void triggerEpsFallback(int serial, in EpsFallbackReason reason);
+
+ /**
+ * Set response functions for IMS radio requests and indications.
+ *
+ * @param radioImsResponse Object containing response functions
+ * @param radioImsIndication Object containing radio indications
+ */
+ void setResponseFunctions(in IRadioImsResponse radioImsResponse,
+ in IRadioImsIndication radioImsIndication);
+
+ /**
+ * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114.
+ * This API triggers radio to send ANBRQ message
+ * to the access network to query the desired bitrate.
+ *
+ * @param serial Serial number of request
+ * @param mediaType Media type is used to identify media stream such as audio or video
+ * @param direction Direction of this packet stream (e.g. uplink or downlink)
+ * @param bitsPerSecond The bit rate requested by the opponent UE
+ *
+ * Response function is IRadioImsResponse.sendAnbrQueryResponse()
+ */
+ void sendAnbrQuery(int serial, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl
new file mode 100644
index 0000000..82773f2
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+import android.hardware.radio.RadioIndicationType;
+import android.hardware.radio.ims.ConnectionFailureInfo;
+import android.hardware.radio.ims.ImsDeregistrationReason;
+import android.hardware.radio.ims.ImsStreamDirection;
+import android.hardware.radio.ims.ImsStreamType;
+
+/**
+ * Interface declaring unsolicited radio indications for ims APIs.
+ */
+@VintfStability
+oneway interface IRadioImsIndication {
+ /**
+ * Fired by radio when any IMS traffic is not sent to network due to any failure
+ * on cellular networks. IMS service shall call stopImsTraffic when receiving
+ * this indication.
+ *
+ * @param type Type of radio indication
+ * @param token The token of startImsTraffic() associated with this indication
+ * @param info Connection failure information
+ */
+ void onConnectionSetupFailure(
+ in RadioIndicationType type, in String token, in ConnectionFailureInfo info);
+
+ /**
+ * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114.
+ * Notifies the bit rate received from the network via ANBR message
+ *
+ * @param type Type of radio indication
+ * @param mediaType Media type is used to identify media stream such as audio or video
+ * @param direction Direction of this packet stream (e.g. uplink or downlink)
+ * @param bitsPerSecond The recommended bit rate for the UE
+ * for a specific logical channel and a specific direction by NW
+ */
+ void notifyAnbr(in RadioIndicationType type, in ImsStreamType mediaType,
+ in ImsStreamDirection direction, int bitsPerSecond);
+
+ /**
+ * Requests IMS stack to perform graceful IMS deregistration before radio performing
+ * network detach in the events of SIM remove, refresh or and so on. The radio waits for
+ * the IMS deregistration, which will be notified by telephony via
+ * {@link IRadioIms#updateImsRegistrationInfo()}, or a certain timeout interval to start
+ * the network detach procedure.
+ *
+ * @param type Type of radio indication
+ * @param reason the reason why the deregistration is triggered
+ */
+ void triggerImsDeregistration(in RadioIndicationType type, in ImsDeregistrationReason reason);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl
new file mode 100644
index 0000000..351e748
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+import android.hardware.radio.RadioResponseInfo;
+import android.hardware.radio.ims.ConnectionFailureInfo;
+
+/**
+ * Interface declaring response functions to solicited radio requests for ims APIs.
+ */
+@VintfStability
+oneway interface IRadioImsResponse {
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void setSrvccCallInfoResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void updateImsRegistrationInfoResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param failureInfo Information about failure in detail
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void startImsTrafficResponse(in RadioResponseInfo info,
+ in @nullable ConnectionFailureInfo failureInfo);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void stopImsTrafficResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void triggerEpsFallbackResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void sendAnbrQueryResponse(in RadioResponseInfo info);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl
new file mode 100644
index 0000000..eac8db4
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsDeregistrationReason {
+ /**
+ * Radio shall send this reason to IMS stack to perform graceful de-registration
+ * due to SIM card is removed.
+ */
+ REASON_SIM_REMOVED = 1,
+ /**
+ * Radio shall send this reason to IMS stack to perform graceful de-registration
+ * due to SIM refresh that needs a NAS detach and re-attach.
+ */
+ REASON_SIM_REFRESH = 2,
+ /**
+ * Radio shall send this reason to IMS stack to perform graceful de-registration
+ * due to allowed network types bitmask changed that results in NAS detach.
+ */
+ REASON_ALLOWED_NETWORK_TYPES_CHANGED = 3,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl
new file mode 100644
index 0000000..662f9e9
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.ims.ImsRegistrationState;
+import android.hardware.radio.ims.SuggestedAction;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable ImsRegistration {
+ /** Default value */
+ const int IMS_MMTEL_CAPABILITY_NONE = 0;
+ /** IMS voice */
+ const int IMS_MMTEL_CAPABILITY_VOICE = 1 << 0;
+ /** IMS video */
+ const int IMS_MMTEL_CAPABILITY_VIDEO = 1 << 1;
+ /** IMS SMS */
+ const int IMS_MMTEL_CAPABILITY_SMS = 1 << 2;
+ /** IMS RCS */
+ const int IMS_RCS_CAPABILITIES = 1 << 3;
+
+ /** Indicates the current IMS registration state. */
+ ImsRegistrationState regState;
+
+ /**
+ * Indicates the type of the radio access network where IMS is registered.
+ */
+ AccessNetwork accessNetworkType;
+
+ /** Indicates the expected action for the radio to do. */
+ SuggestedAction suggestedAction;
+
+ /**
+ * Values are bitwise ORs of IMS_MMTEL_CAPABILITY_* constants and IMS_RCS_CAPABILITIES.
+ * IMS capability such as VOICE, VIDEO, SMS and RCS.
+ */
+ int capabilities;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl
new file mode 100644
index 0000000..fd5c0fa
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsRegistrationState {
+ /** IMS is not registered */
+ NOT_REGISTERED,
+
+ /** IMS is successfully registered */
+ REGISTERED,
+}
\ No newline at end of file
diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl
new file mode 100644
index 0000000..c0cea32
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsStreamDirection {
+ /** DIRECTION_UPLINK - From UE to Network **/
+ UPLINK = 1,
+ /** DIRECTION_DOWNLINK - From Network to UE **/
+ DOWNLINK = 2,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl
new file mode 100644
index 0000000..c12a0c1
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@Backing(type="int")
+enum ImsStreamType {
+ /** Media Stream Type - Audio **/
+ AUDIO = 1,
+ /** Media Stream Type - Video **/
+ VIDEO = 2,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl
new file mode 100644
index 0000000..5a824c0
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsTrafficType {
+ /** Emergency call */
+ EMERGENCY,
+
+ /** Emergency SMS */
+ EMERGENCY_SMS,
+
+ /** Voice call */
+ VOICE,
+
+ /** Video call */
+ VIDEO,
+
+ /** SMS over IMS */
+ SMS,
+
+ /** IMS registration and subscription for reg event package (signaling) */
+ REGISTRATION,
+
+ /** Ut/XCAP (XML Configuration Access Protocol) */
+ UT_XCAP
+}
\ No newline at end of file
diff --git a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl
new file mode 100644
index 0000000..38e6cdb
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable SrvccCall {
+
+ @VintfStability
+ @Backing(type="int")
+ enum CallType {
+ NORMAL,
+ EMERGENCY,
+ }
+
+ @VintfStability
+ @Backing(type="int")
+ enum CallSubState {
+ NONE,
+ /** Pre-alerting state. Applicable for MT calls only */
+ PREALERTING,
+ }
+
+ @VintfStability
+ @Backing(type="int")
+ enum ToneType {
+ NONE,
+ LOCAL,
+ NETWORK,
+ }
+
+ /** Connection index */
+ int index;
+
+ /** The type of the call */
+ CallType callType;
+
+ /** Values are android.hardware.radio.voice.Call.STATE_* constants */
+ int callState;
+
+ /** The substate of the call */
+ CallSubState callSubstate;
+
+ /** The type of the ringback tone */
+ ToneType ringbackToneType;
+
+ /** true if is mpty call */
+ boolean isMpty;
+
+ /** true if call is mobile terminated */
+ boolean isMT;
+
+ /** Remote party nummber */
+ String number;
+
+ /** Values are android.hardware.radio.voice.Call.PRESENTATION_* constants */
+ int numPresentation;
+
+ /** Remote party name */
+ String name;
+
+ /** Values are android.hardware.radio.voice.Call.PRESENTATION_* constants */
+ int namePresentation;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl
new file mode 100644
index 0000000..2d12ed6
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum SuggestedAction {
+ /** Default value */
+ NONE,
+ /**
+ * Indicates that the IMS registration is failed with fatal error such as 403 or 404
+ * on all P-CSCF addresses. The radio shall block the current PLMN or disable
+ * the RAT as per the carrier requirements.
+ */
+ TRIGGER_PLMN_BLOCK,
+ /**
+ * Indicates that the IMS registration on current PLMN failed multiple times.
+ * The radio shall block the current PLMN or disable the RAT during EPS or 5GS mobility
+ * management timer value as per the carrier requirements.
+ */
+ TRIGGER_PLMN_BLOCK_WITH_TIMEOUT,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl
new file mode 100644
index 0000000..66d8ef0
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+/** AMR codec mode to represent the bit rate. See 3ggp Specs 26.976 & 26.071 */
+@VintfStability
+@Backing(type="int")
+enum AmrMode {
+ /** 4.75 kbps for AMR / 6.6 kbps for AMR-WB */
+ AMR_MODE_0 = 1 << 0,
+ /** 5.15 kbps for AMR / 8.855 kbps for AMR-WB */
+ AMR_MODE_1 = 1 << 1,
+ /** 5.9 kbps for AMR / 12.65 kbps for AMR-WB */
+ AMR_MODE_2 = 1 << 2,
+ /** 6.7 kbps for AMR / 14.25 kbps for AMR-WB */
+ AMR_MODE_3 = 1 << 3,
+ /** 7.4 kbps for AMR / 15.85 kbps for AMR-WB */
+ AMR_MODE_4 = 1 << 4,
+ /** 7.95 kbps for AMR / 18.25 kbps for AMR-WB */
+ AMR_MODE_5 = 1 << 5,
+ /** 10.2 kbps for AMR / 19.85 kbps for AMR-WB */
+ AMR_MODE_6 = 1 << 6,
+ /** 12.2 kbps for AMR / 23.05 kbps for AMR-WB */
+ AMR_MODE_7 = 1 << 7,
+ /** Silence frame for AMR / 23.85 kbps for AMR-WB */
+ AMR_MODE_8 = 1 << 8,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl
new file mode 100644
index 0000000..4ed3a24
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.AmrMode;
+
+@VintfStability
+parcelable AmrParams {
+ /** mode-set: AMR codec mode to represent the bit rate */
+ AmrMode amrMode;
+ /**
+ * octet-align: If it's set to true then all fields in the AMR/AMR-WB header
+ * shall be aligned to octet boundaries by adding padding bits.
+ */
+ boolean octetAligned;
+ /**
+ * max-red: It’s the maximum duration in milliseconds that elapses between the
+ * primary (first) transmission of a frame and any redundant transmission that
+ * the sender will use. This parameter allows a receiver to have a bounded delay
+ * when redundancy is used. Allowed values are between 0 (no redundancy will be
+ * used) and 65535. If the parameter is omitted, no limitation on the use of
+ * redundancy is present. See RFC 4867
+ */
+ int maxRedundancyMillis;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
new file mode 100644
index 0000000..61239d0
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+parcelable AnbrBitrate {
+ /** default value to represent NOT_SET */
+ const int INVALID_ANBR_BITRATE = -1;
+
+ /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */
+ int uplinkBps;
+ /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */
+ int downlinkBps;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl
new file mode 100644
index 0000000..a8f7b16
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+parcelable CallQuality {
+ /**
+ * downlink CallQualityLevel for a given ongoing call
+ * this value corresponds to the CALL_QUALITY_* constants in {@link CallQuality}
+ */
+ int downlinkCallQualityLevel;
+ /**
+ * uplink CallQualityLevel for a given ongoing call
+ * this value corresponds to the CALL_QUALITY_* constants in {@link CallQuality}
+ */
+ int uplinkCallQualityLevel;
+ /** the call duration in milliseconds */
+ int callDuration;
+ /** RTP packets sent to network */
+ int numRtpPacketsTransmitted;
+ /** RTP packets received from network */
+ int numRtpPacketsReceived;
+ /** RTP packets which were lost in network and never transmitted */
+ int numRtpPacketsTransmittedLost;
+ /** RTP packets which were lost in network and never received */
+ int numRtpPacketsNotReceived;
+ /** average relative jitter in milliseconds */
+ int averageRelativeJitter;
+ /** maximum relative jitter in milliseconds */
+ int maxRelativeJitter;
+ /** average round trip delay in milliseconds */
+ int averageRoundTripTime;
+ /**
+ * the codec type. This value corresponds to the AUDIO_QUALITY_* constants in
+ * {@link ImsStreamMediaProfile}
+ */
+ int codecType;
+ /** True if no incoming RTP is received for a continuous duration of 4 seconds */
+ boolean rtpInactivityDetected;
+ /**
+ * True if only silence RTP packets are received for 20 seconds
+ * immediately after call is connected
+ */
+ boolean rxSilenceDetected;
+ /**
+ * True if only silence RTP packets are sent for 20 seconds
+ * immediately after call is connected
+ */
+ boolean txSilenceDetected;
+ /** the number of Voice frames sent by jitter buffer to audio */
+ int numVoiceFrames;
+ /** the number of no-data frames sent by jitter buffer to audio */
+ int numNoDataFrames;
+ /** the number of RTP voice packets dropped by jitter buffer */
+ int numDroppedRtpPackets;
+ /** the minimum playout delay in the reporting interval in milliseconds */
+ long minPlayoutDelayMillis;
+ /** the maximum playout delay in the reporting interval in milliseconds */
+ long maxPlayoutDelayMillis;
+ /**
+ * the total number of RTP SID (Silence Insertion Descriptor) packets
+ * received by this device for an ongoing call
+ */
+ int numRtpSidPacketsReceived;
+ /**
+ * the total number of RTP duplicate packets received by this device
+ * for an ongoing call
+ */
+ int numRtpDuplicatePackets;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl
new file mode 100644
index 0000000..0aa5505
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.CodecSpecificParams;
+import android.hardware.radio.ims.media.CodecType;
+
+@VintfStability
+parcelable CodecParams {
+ /** Negotiated codec type */
+ CodecType codecType;
+ /**
+ * Static or dynamic payload type number negotiated through the SDP for
+ * the incoming RTP packets. This value shall be matched with the PT value
+ * of the incoming RTP header. Values 0 to 127, see RFC 3551 section 6
+ */
+ byte rxPayloadTypeNumber;
+ /**
+ * Static or dynamic payload type number negotiated through the SDP for
+ * the outgoing RTP packets. This value shall be set to the PT value
+ * of the outgoing RTP header. Values 0 to 127, see RFC 3551 section 6
+ */
+ byte txPayloadTypeNumber;
+ /** Sampling rate in kHz*/
+ byte samplingRateKHz;
+ /** dtx: Whether discontinuous transmission is enabled or not */
+ boolean dtxEnabled;
+ /** Codec specific parameters */
+ CodecSpecificParams codecSpecificParams;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl
new file mode 100644
index 0000000..4410c81
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.AmrParams;
+import android.hardware.radio.ims.media.EvsParams;
+
+@VintfStability
+union CodecSpecificParams {
+ AmrParams amr;
+ EvsParams evs;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl
new file mode 100644
index 0000000..31218e3
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum CodecType {
+ /** Adaptive Multi-Rate */
+ AMR = 1 << 0,
+ /** Adaptive Multi-Rate Wide Band */
+ AMR_WB = 1 << 1,
+ /** Enhanced Voice Services */
+ EVS = 1 << 2,
+ /** G.711 A-law i.e. Pulse Code Modulation using A-law */
+ PCMA = 1 << 3,
+ /** G.711 μ-law i.e. Pulse Code Modulation using μ-law */
+ PCMU = 1 << 4,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl
new file mode 100644
index 0000000..a7dcb0d
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+parcelable DtmfParams {
+ /**
+ * Dynamic payload type number to be used for DTMF RTP packets received.
+ * The values is in the range from 96 to 127 chosen during the session
+ * establishment. The PT value of the RTP header of all DTMF packets shall be
+ * set with this value.
+ */
+ byte rxPayloadTypeNumber;
+
+ /**
+ * Dynamic payload type number to be used for DTMF RTP packets sent.
+ * The values is in the range from 96 to 127 chosen during the session
+ * establishment. The PT value of the RTP header of all DTMF packets shall be set
+ * with this value.
+ */
+ byte txPayloadTypeNumber;
+
+ /** Sampling rate in kHz */
+ byte samplingRateKHz;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl
new file mode 100644
index 0000000..8278514
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+/** EVS Speech codec bandwidths, See 3gpp spec 26.441 Table 1 */
+@VintfStability
+@Backing(type="int")
+enum EvsBandwidth {
+ NONE = 0,
+ NARROW_BAND = 1 << 0,
+ WIDE_BAND = 1 << 1,
+ SUPER_WIDE_BAND = 1 << 2,
+ FULL_BAND = 1 << 3,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl
new file mode 100644
index 0000000..95bd6c7
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+/** EVS codec mode to represent the bit rate. See 3ggp Spec 26.952 Table 5.1 */
+@VintfStability
+@Backing(type="int")
+enum EvsMode {
+ /** 6.6 kbps for EVS AMR-WB IO */
+ EVS_MODE_0 = 1 << 0,
+ /** 8.855 kbps for AMR-WB IO */
+ EVS_MODE_1 = 1 << 1,
+ /** 12.65 kbps for AMR-WB IO */
+ EVS_MODE_2 = 1 << 2,
+ /** 14.25 kbps for AMR-WB IO */
+ EVS_MODE_3 = 1 << 3,
+ /** 15.85 kbps for AMR-WB IO */
+ EVS_MODE_4 = 1 << 4,
+ /** 18.25 kbps for AMR-WB IO */
+ EVS_MODE_5 = 1 << 5,
+ /** 19.85 kbps for AMR-WB IO */
+ EVS_MODE_6 = 1 << 6,
+ /** 23.05 kbps for AMR-WB IO */
+ EVS_MODE_7 = 1 << 7,
+ /** 23.85 kbps for AMR-WB IO */
+ EVS_MODE_8 = 1 << 8,
+ /** 5.9 kbps for EVS primary */
+ EVS_MODE_9 = 1 << 9,
+ /** 7.2 kbps for EVS primary */
+ EVS_MODE_10 = 1 << 10,
+ /** 8.0 kbps for EVS primary */
+ EVS_MODE_11 = 1 << 11,
+ /** 9.6 kbps for EVS primary */
+ EVS_MODE_12 = 1 << 12,
+ /** 13.2 kbps for EVS primary */
+ EVS_MODE_13 = 1 << 13,
+ /** 16.4 kbps for EVS primary */
+ EVS_MODE_14 = 1 << 14,
+ /** 24.4 kbps for EVS primary */
+ EVS_MODE_15 = 1 << 15,
+ /** 32.0 kbps for EVS primary */
+ EVS_MODE_16 = 1 << 16,
+ /** 48.0 kbps for EVS primary */
+ EVS_MODE_17 = 1 << 17,
+ /** 64.0 kbps for EVS primary */
+ EVS_MODE_18 = 1 << 18,
+ /** 96.0 kbps for EVS primary */
+ EVS_MODE_19 = 1 << 19,
+ /** 128.0 kbps for EVS primary */
+ EVS_MODE_20 = 1 << 20,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl
new file mode 100644
index 0000000..d138c83
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.EvsBandwidth;
+import android.hardware.radio.ims.media.EvsMode;
+
+@VintfStability
+parcelable EvsParams {
+ /** EVS codec bandwidth */
+ EvsBandwidth bandwidth;
+
+ /** mode-set: EVS codec mode to represent the bit rate */
+ EvsMode evsMode;
+ /**
+ * ch-aw-recv: Channel aware mode for the receive direction. Permissible values
+ * are -1, 0, 2, 3, 5, and 7. If -1, channel-aware mode is disabled in the
+ * session for the receive direction. If 0 or not present, partial redundancy
+ * (channel-aware mode) is not used at the start of the session for the receive
+ * direction. If positive (2, 3, 5, or 7), partial redundancy (channel-aware
+ * mode) is used at the start of the session for the receive direction using the
+ * value as the offset, See 3GPP TS 26.445 section 4.4.5
+ */
+ byte channelAwareMode;
+ /**
+ * hf-only: Header full only is used for the outgoing and incoming packets.
+ * If it's true then the session shall support header full format only else the
+ * session could support both header full format and compact format.
+ */
+ boolean useHeaderFullOnly;
+ /**
+ * evs-mode-switch: Used for switching between EVS Primary mode and EVS AMR-WB IO mode,
+ * If this value is true, the codec operates in AMR-WB IO mode
+ */
+ boolean useEvsModeSwitch;
+ /**
+ * cmr: Codec mode request is used to request the speech codec encoder of the
+ * other party to set the frame type index of speech mode via RTP header, See
+ * 3GPP TS 26.445 section A.3. Allowed values are -1, 0 and 1.
+ */
+ byte codecModeRequest;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl
new file mode 100644
index 0000000..ecf1370
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.IImsMediaListener;
+import android.hardware.radio.ims.media.LocalEndPoint;
+import android.hardware.radio.ims.media.RtpConfig;
+import android.hardware.radio.ims.media.RtpError;
+
+/**
+ * This interface is used by IMS media framework to talk to RTP stack located in another processor.
+ */
+@VintfStability
+oneway interface IImsMedia {
+
+ /**
+ * Set the listener functions for receiving notifications from the RTP stack.
+ *
+ * @param mediaListener Object containing listener methods
+ */
+ void setListener(in IImsMediaListener mediaListener);
+
+ /**
+ * Opens a RTP session for the local end point with the associated initial remote configuration
+ * if there is a valid RtpConfig passed. It starts the media flow if the media direction in the
+ * RtpConfig is set to any value other than NO_MEDIA_FLOW. If the open session is successful
+ * then the implementation shall return a new IImsMediaSession binder connection for this
+ * session using IImsMediaListener#onOpenSessionSuccess() API. If the open session is failed
+ * then the implementation shall return the error using IImsMediaListener#onOpenSessionFailure()
+ *
+ * @param sessionId unique identifier of the session
+ * @param localEndPoint provides IP address, port and logical modem id for local RTP endpoint
+ * @param config provides remote end point info and codec details. This could be null initially
+ * and the application may update this later using modifySession() API.
+ */
+ void openSession(int sessionId, in LocalEndPoint localEndPoint, in RtpConfig config);
+
+ /**
+ * Close the RTP session including cleanup of all the resources associated with the session.
+ * This shall also close the session specific binder connection opened as part of openSession().
+ *
+ * @param sessionId identifier for the rtp session that needs to be closed
+ */
+ void closeSession(int sessionId);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl
new file mode 100644
index 0000000..228acb7
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.IImsMediaSession;
+import android.hardware.radio.ims.media.RtpError;
+
+/**
+ * Interface declaring listener functions for unsolicited IMS media notifications.
+ */
+@VintfStability
+oneway interface IImsMediaListener {
+ /**
+ * Fired when a IImsMedia#openSession() API is successful.
+ *
+ * @param sessionId identifier of the session
+ * @param session new IImsMediaSession binder connection to be used for the session
+ * specific operations
+ */
+ void onOpenSessionSuccess(int sessionId, IImsMediaSession session);
+
+ /**
+ * Fired when IImsMedia#openSession() API failed to create a new session.
+ *
+ * @param sessionId identifier of the session
+ * @param error one of the following RTP error code
+ * RtpError :INVALID_PARAM
+ * RtpError :INTERNAL_ERR
+ * RtpError :NO_MEMORY
+ * RtpError :NO_RESOURCES
+ * RtpError :PORT_UNAVAILABLE
+ */
+ void onOpenSessionFailure(int sessionId, RtpError error);
+
+ /**
+ * Fired when IImsMedia#closeSession() API handled.
+ *
+ * @param sessionId identifier of the session
+ */
+ void onSessionClosed(int sessionId);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl
new file mode 100644
index 0000000..a8d2161
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.IImsMediaSessionListener;
+import android.hardware.radio.ims.media.MediaProtocolType;
+import android.hardware.radio.ims.media.MediaQualityThreshold;
+import android.hardware.radio.ims.media.RtpConfig;
+import android.hardware.radio.ims.media.RtpError;
+import android.hardware.radio.ims.media.RtpHeaderExtension;
+
+/**
+ * Session specific interface used by IMS media framework to talk to the vendor RTP stack.
+ */
+@VintfStability
+oneway interface IImsMediaSession {
+ /**
+ * Set the listener functions to receive IMS media session specific notifications.
+ *
+ * @param sessionListener Object containing notification methods
+ */
+ void setListener(in IImsMediaSessionListener sessionListener);
+
+ /**
+ * Modifies the configuration of the RTP session. It can be used to pause/resume
+ * the media stream by changing the value of the MediaDirection.
+ *
+ * @param config provides remote end point info and codec details
+ */
+ void modifySession(in RtpConfig config);
+
+ /**
+ * Send DTMF digit until the duration expires.
+ *
+ * @param dtmfDigit single char having one of 12 values: 0-9, *, #
+ * @param duration of the key press in milliseconds.
+ */
+ void sendDtmf(char dtmfDigit, int duration);
+
+ /**
+ * Start sending DTMF digit until the stopDtmf() API is received.
+ * If the implementation is currently sending a DTMF tone for which
+ * stopDtmf() is not received yet, then that digit must be stopped first
+ *
+ * @param dtmfDigit single char having one of 12 values: 0-9, *, #
+ */
+ void startDtmf(char dtmfDigit);
+
+ /**
+ * Stop sending the last DTMF digit started by startDtmf().
+ * stopDtmf() without preceding startDtmf() must be ignored.
+ */
+ void stopDtmf();
+
+ /**
+ * Send RTP header extension to the other party in the next RTP packet.
+ *
+ * @param extensions data to be transmitted via RTP header extension
+ */
+ void sendHeaderExtension(in List<RtpHeaderExtension> extensions);
+
+ /**
+ * Sets the media quality threshold parameters of the session to get
+ * media quality notifications.
+ *
+ * @param threshold media quality thresholds for various quality parameters
+ */
+ void setMediaQualityThreshold(in MediaQualityThreshold threshold);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
new file mode 100644
index 0000000..d40da64
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.CallQuality;
+import android.hardware.radio.ims.media.MediaProtocolType;
+import android.hardware.radio.ims.media.RtpConfig;
+import android.hardware.radio.ims.media.RtpError;
+import android.hardware.radio.ims.media.RtpHeaderExtension;
+
+/**
+ * Interface declaring listener functions for unsolicited IMS media notifications per session.
+ */
+@VintfStability
+oneway interface IImsMediaSessionListener {
+ /**
+ * Notifies the result of IImsMediaSession#modifySession() API.
+ *
+ * @param config The RTP config passed in IImsMediaSession#modifySession() API
+ * @param error RtpError.NONE in case of success else one of the following
+ * RtpError :INVALID_PARAM
+ * RtpError :INTERNAL_ERR
+ * RtpError :NO_MEMORY
+ * RtpError :NO_RESOURCES
+ */
+ void onModifySessionResponse(in RtpConfig config, RtpError error);
+
+ /**
+ * Indicates when the first Rtp media packet is received by the UE during ring
+ * back, call hold or early media scenarios. This is sent only if the packet is
+ * received on the active remote configuration.
+ *
+ * In case of early media scenarios, the implementation shall play the RTP
+ * packets from the most recently added config.
+ *
+ * @param config The remote config where the media is received
+ */
+ void onFirstMediaPacketReceived(in RtpConfig config);
+
+ /**
+ * RTP header extension received from the other party
+ *
+ * @param extensions content of the received RTP header extension
+ */
+ void onHeaderExtensionReceived(in List<RtpHeaderExtension> extensions);
+
+ /**
+ * Notifies media inactivity observed as per thresholds set by
+ * setMediaQualityThreshold() API
+ *
+ * @param packetType either RTP or RTCP
+ */
+ void notifyMediaInactivity(MediaProtocolType packetType);
+
+ /**
+ * Notifies RTP packet loss observed as per thresholds set by
+ * setMediaQualityThreshold() API
+ *
+ * @param packetLossPercentage percentage of packet loss calculated over the duration
+ */
+ void notifyPacketLoss(int packetLossPercentage);
+
+ /**
+ * Notifies RTP jitter observed as per thresholds set by
+ * IImsMediaSession#setMediaQualityThreshold() API
+ *
+ * @param jitter jitter of the RTP packets in milliseconds calculated over the duration
+ */
+ void notifyJitter(int jitter);
+
+ /**
+ * The modem RTP stack fires this API to query whether the desired bitrate mentioned
+ * in the RtpConfig is currently available on the NW or not using ANBRQ message.
+ * See 3GPP TS 26.114.
+ *
+ * @param config containing desired bitrate and direction
+ */
+ void triggerAnbrQuery(in RtpConfig config);
+
+ /**
+ * Notifies the received DTMF digit from the other party
+ *
+ * @param dtmfDigit single char having one of 12 values: 0-9, *, #
+ */
+ void onDtmfReceived(char dtmfDigit);
+
+ /**
+ * Notifies when a change to call quality has occurred
+ *
+ * @param CallQuality The call quality statistics of ongoing call since last report
+ */
+ void onCallQualityChanged(in CallQuality callQuality);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl
new file mode 100644
index 0000000..2bd48c6
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.os.ParcelFileDescriptor;
+
+@VintfStability
+parcelable LocalEndPoint {
+ /** Socket file descriptor for RTP traffic */
+ ParcelFileDescriptor rtpFd;
+ /** Socket file descriptor for RTCP traffic */
+ ParcelFileDescriptor rtcpFd;
+ /** The logical modem ID, returned by IRadioConfig.getPhoneCapability() */
+ int modemId;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
new file mode 100644
index 0000000..9f04d8e
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum MediaDirection {
+ /**
+ * No RTP/RTCP flow in either direction. The implementation
+ * may release the audio resource. Eg. SRVCC.
+ */
+ NO_FLOW = 0,
+ /** Device sends outgoing RTP and drops incoming RTP */
+ SEND_ONLY = 1,
+ /** Device receives the downlink RTP and does not transmit any uplink RTP */
+ RECEIVE_ONLY = 2,
+ /** Device sends and receive RTP in both directions */
+ SEND_RECEIVE = 3,
+ /** No RTP flow however RTCP continues to flow. Eg. HOLD */
+ INACTIVE = 4,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl
new file mode 100644
index 0000000..325c6fa
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum MediaProtocolType {
+ /** Real Time Protocol, see RFC 3550 */
+ RTP = 0,
+ /** Real Time Control Protocol, see RFC 3550 */
+ RTCP = 1,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
new file mode 100644
index 0000000..946bd5c
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+parcelable MediaQualityThreshold {
+ /** Timer in milliseconds for monitoring RTP inactivity */
+ int rtpInactivityTimerMillis;
+ /** Timer in milliseconds for monitoring RTCP inactivity */
+ int rtcpInactivityTimerMillis;
+ /** Duration in milliseconds for monitoring the RTP packet loss rate */
+ int rtpPacketLossDurationMillis;
+ /**
+ * Packet loss rate in percentage of (total number of packets lost) /
+ * (total number of packets expected) during rtpPacketLossDurationMs
+ */
+ int rtpPacketLossRate;
+ /** Duration in milliseconds for monitoring the jitter for RTP traffic */
+ int jitterDurationMillis;
+ /** RTP jitter threshold in milliseconds */
+ int rtpJitterMillis;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl
new file mode 100644
index 0000000..98bbfc6
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+parcelable RtcpConfig {
+ /** Canonical name that will be sent to all session participants */
+ String canonicalName;
+ /** Port for sending outgoing RTCP packets */
+ int transmitPort;
+ /** Transmit interval in seconds. Value 0 indicates that RTCP reports should not be reported */
+ int transmitIntervalSec;
+ /** Bitmask of RTCP-XR blocks to enable as in RtcpXrReportBlockType */
+ int rtcpXrBlocks;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
new file mode 100644
index 0000000..7f6839a
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+/** RTP Control Protocol Extended Reports (RTCP XR) Blocks, See RFC 3611 section 4 */
+
+@VintfStability
+@Backing(type="int")
+enum RtcpXrReportBlockType {
+ /** Disable RTCP XR */
+ RTCPXR_NONE = 0,
+ /** Loss RLE Report Block */
+ RTCPXR_LOSS_RLE_REPORT_BLOCK = 1 << 0,
+ /** Duplicate RLE Report Block */
+ RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 1 << 1,
+ /** Packet Receipt Times Report Block */
+ RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 1 << 2,
+ /** Receiver Reference Time Report Block */
+ RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 1 << 3,
+ /** DLRR Report Block */
+ RTCPXR_DLRR_REPORT_BLOCK = 1 << 4,
+ /** Statistics Summary Report Block */
+ RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 1 << 5,
+ /** VoIP Metrics Report Block */
+ RTCPXR_VOIP_METRICS_REPORT_BLOCK = 1 << 6,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl
new file mode 100644
index 0000000..2db73a3
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+parcelable RtpAddress {
+ /** Point to point IP address */
+ String ipAddress;
+ /** UDP port number used for the RTP traffic */
+ int portNumber;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
new file mode 100644
index 0000000..d0d849e
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.ims.media.AnbrBitrate;
+import android.hardware.radio.ims.media.MediaDirection;
+import android.hardware.radio.ims.media.RtcpConfig;
+import android.hardware.radio.ims.media.RtpAddress;
+import android.hardware.radio.ims.media.RtpSessionParams;
+
+@VintfStability
+parcelable RtpConfig {
+ /** Media flow direction */
+ MediaDirection direction;
+ /** Radio Access Network */
+ AccessNetwork accessNetwork;
+ /** IP address and port number of the other party for RTP media */
+ RtpAddress remoteAddress;
+ /** Negotiated session parameters */
+ RtpSessionParams sessionParams;
+ /** RTCP configuration */
+ RtcpConfig rtcpConfig;
+ /**
+ * ANBR Bitrate parameters. This is set to valid only when its triggered,
+ * otherwise it shall be set to NULL.
+ *
+ * This would be used in the following two cases
+ * - IImsMediaSession#modifySession(RtpConfig) - When RAN wants to change the bit
+ * rate via ANBR MAC layer signaling, ImsStack would set the values and direction
+ * and pass it in the modifySession(). The underlying RTP stack shall adapt to
+ * the changed bitrate.
+ *
+ * - IImsMediaSessionListener#triggerAnbrQuery(RtpConfig) - When the vendor RTP
+ * stack receives a request for bitrate increase from the peer terminal via CMR,
+ * RTCP-APP or TMMBR, it triggers ANBRQ by setting the desired bitrate and the
+ * direction of the stream.
+ */
+ AnbrBitrate anbrBitrateParams;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl
new file mode 100644
index 0000000..11a3468
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum RtpError {
+ /** Success */
+ NONE = 0,
+ /** Invalid parameters passed in the request */
+ INVALID_PARAM = 1,
+ /** The RTP stack is not ready to handle the request */
+ NOT_READY = 2,
+ /** Unable to handle the request due to memory allocation failure */
+ NO_MEMORY = 3,
+ /** Unable to handle the request due to no sufficient resources such as audio, codec */
+ NO_RESOURCES = 4,
+ /** The requested port number is not available */
+ PORT_UNAVAILABLE = 5,
+ /** The request is not supported by the implementation */
+ NOT_SUPPORTED = 6,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
new file mode 100644
index 0000000..76b13dc
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+/** RTP Header Extensions, see RFC 8285 */
+@VintfStability
+parcelable RtpHeaderExtension {
+ /** Local identifier */
+ int localId;
+ /** Extension data bytes */
+ byte[] data;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl
new file mode 100644
index 0000000..f93c52c
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims.media;
+
+import android.hardware.radio.ims.media.CodecParams;
+import android.hardware.radio.ims.media.DtmfParams;
+
+@VintfStability
+parcelable RtpSessionParams {
+ /**
+ * ptime: Recommended length of time in milliseconds represented by the media
+ * in each packet, see RFC 4566
+ */
+ byte pTimeMillis;
+ /**
+ * maxptime: Maximum amount of media that can be encapsulated in each packet
+ * represented in milliseconds, see RFC 4566
+ */
+ int maxPtimeMillis;
+ /** dscp: Differentiated Services Field Code Point value, see RFC 2474 */
+ byte dscp;
+ /** DTMF payload and clock rate */
+ DtmfParams dtmfParams;
+ /** Negotiated codec parameters */
+ CodecParams codecParams;
+}
diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl
index c9563ac..b986944 100644
--- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl
+++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl
@@ -22,6 +22,21 @@
@VintfStability
@JavaDerive(toString=true)
parcelable EutranRegistrationInfo {
+ enum AttachResultType {
+ /** Default value. */
+ NONE,
+ /** LTE is attached with eps only. */
+ EPS_ONLY,
+ /** LTE combined EPS and IMSI attach. */
+ COMBINED,
+ }
+
+ /** LTE combined attach with CSFB not preferred */
+ const int EXTRA_CSFB_NOT_PREFERRED = 1 << 0;
+
+ /** LTE combined attach for SMS only */
+ const int EXTRA_SMS_ONLY = 1 << 1;
+
/**
* Network capabilities for voice over PS services. This info is valid only on LTE network and
* must be present when device is camped on LTE. VopsInfo must be empty when device is camped
@@ -33,4 +48,13 @@
* be empty.
*/
NrIndicators nrIndicators;
+
+ /**
+ * The type of network attachment. This info is valid only on LTE network and must be present
+ * when device has attached to the network.
+ */
+ AttachResultType lteAttachResultType;
+
+ /** Values are bitwise ORs of EXTRA_* constants */
+ int extraInfo;
}
diff --git a/radio/aidl/android/hardware/radio/network/RegState.aidl b/radio/aidl/android/hardware/radio/network/RegState.aidl
index 3f13783..bdba4c4 100644
--- a/radio/aidl/android/hardware/radio/network/RegState.aidl
+++ b/radio/aidl/android/hardware/radio/network/RegState.aidl
@@ -65,4 +65,10 @@
* Same as UNKNOWN but indicates that emergency calls are enabled
*/
UNKNOWN_EM = 14,
+ /**
+ * Emergency attached in EPS or in 5GS.
+ * Reference: 3GPP TS 24.301 9.9.3.11 EPS attach type.
+ * Reference: 3GPP TS 24.501 9.11.3.6 5GS registration result.
+ */
+ REG_EM = 20,
}
diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp
index f79e045..0ceaec4 100644
--- a/radio/aidl/compat/libradiocompat/Android.bp
+++ b/radio/aidl/compat/libradiocompat/Android.bp
@@ -37,6 +37,7 @@
"android.hardware.radio.config@1.2",
"android.hardware.radio.config@1.3",
"android.hardware.radio.data-V1-ndk",
+ "android.hardware.radio.ims-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
"android.hardware.radio.network-V2-ndk",
@@ -69,6 +70,9 @@
"data/RadioResponse-data.cpp",
"data/RadioData.cpp",
"data/structs.cpp",
+ "ims/RadioIndication-ims.cpp",
+ "ims/RadioResponse-ims.cpp",
+ "ims/RadioIms.cpp",
"messaging/RadioIndication-messaging.cpp",
"messaging/RadioMessaging.cpp",
"messaging/RadioResponse-messaging.cpp",
diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp
new file mode 100644
index 0000000..3a07f84
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <libradiocompat/RadioIms.h>
+
+#include "commonStructs.h"
+#include "debug.h"
+
+#include "collections.h"
+
+#define RADIO_MODULE "Ims"
+
+namespace android::hardware::radio::compat {
+
+using ::ndk::ScopedAStatus;
+namespace aidl = ::aidl::android::hardware::radio::ims;
+constexpr auto ok = &ScopedAStatus::ok;
+
+std::shared_ptr<aidl::IRadioImsResponse> RadioIms::respond() {
+ return mCallbackManager->response().imsCb();
+}
+
+ScopedAStatus RadioIms::setSrvccCallInfo(
+ int32_t serial, const std::vector<aidl::SrvccCall>& /*srvccCalls*/) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " setSrvccCallInfo is unsupported by HIDL HALs";
+ return ok();
+}
+ScopedAStatus RadioIms::updateImsRegistrationInfo(
+ int32_t serial, const aidl::ImsRegistration& /*imsRegistration*/) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " updateImsRegistrationInfo is unsupported by HIDL HALs";
+ return ok();
+}
+ScopedAStatus RadioIms::startImsTraffic(
+ int32_t serial, const std::string& /*token*/, aidl::ImsTrafficType /*imsTrafficType*/,
+ ::aidl::android::hardware::radio::AccessNetwork /*accessNetworkType*/) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " startImsTraffic is unsupported by HIDL HALs";
+ return ok();
+}
+ScopedAStatus RadioIms::stopImsTraffic(int32_t serial, const std::string& /*token*/) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " stopImsTraffic is unsupported by HIDL HALs";
+ return ok();
+}
+ScopedAStatus RadioIms::triggerEpsFallback(int32_t serial, aidl::EpsFallbackReason /*reason*/) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " triggerEpsFallback is unsupported by HIDL HALs";
+ return ok();
+}
+ScopedAStatus RadioIms::sendAnbrQuery(
+ int32_t serial, aidl::ImsStreamType /*mediaType*/, aidl::ImsStreamDirection /*direction*/,
+ int32_t /*bitsPerSecond*/) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " sendAnbrQuery is unsupported by HIDL HALs";
+ return ok();
+}
+
+ScopedAStatus RadioIms::setResponseFunctions(
+ const std::shared_ptr<aidl::IRadioImsResponse>& response,
+ const std::shared_ptr<aidl::IRadioImsIndication>& indication) {
+ LOG_CALL << response << ' ' << indication;
+ mCallbackManager->setResponseFunctions(response, indication);
+ return ok();
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp
new file mode 100644
index 0000000..10109b8
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <libradiocompat/RadioIndication.h>
+
+#include "commonStructs.h"
+#include "debug.h"
+
+#include "collections.h"
+
+#define RADIO_MODULE "ImsIndication"
+
+namespace android::hardware::radio::compat {
+
+using ::aidl::android::hardware::radio::RadioTechnology;
+namespace aidl = ::aidl::android::hardware::radio::ims;
+
+void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioImsIndication> imsCb) {
+ mImsCb = imsCb;
+}
+
+std::shared_ptr<aidl::IRadioImsIndication> RadioIndication::imsCb() {
+ return mImsCb.get();
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp
new file mode 100644
index 0000000..831a0ae
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <libradiocompat/RadioResponse.h>
+
+#include "commonStructs.h"
+#include "debug.h"
+
+#include "collections.h"
+
+#define RADIO_MODULE "ImsResponse"
+
+namespace android::hardware::radio::compat {
+
+namespace aidl = ::aidl::android::hardware::radio::ims;
+
+void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioImsResponse> imsCb) {
+ mImsCb = imsCb;
+}
+
+std::shared_ptr<aidl::IRadioImsResponse> RadioResponse::imsCb() {
+ return mImsCb.get();
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h
new file mode 100644
index 0000000..eaf6e0f
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "RadioCompatBase.h"
+
+#include <aidl/android/hardware/radio/ims/BnRadioIms.h>
+
+namespace android::hardware::radio::compat {
+
+class RadioIms : public RadioCompatBase, public aidl::android::hardware::radio::ims::BnRadioIms {
+ ::ndk::ScopedAStatus setSrvccCallInfo(
+ int32_t serial,
+ const std::vector<::aidl::android::hardware::radio::ims::SrvccCall>& srvccCalls)
+ override;
+ ::ndk::ScopedAStatus updateImsRegistrationInfo(
+ int32_t serial,
+ const ::aidl::android::hardware::radio::ims::ImsRegistration& imsRegistration) override;
+ ::ndk::ScopedAStatus startImsTraffic(
+ int32_t serial, const std::string& token,
+ ::aidl::android::hardware::radio::ims::ImsTrafficType imsTrafficType,
+ ::aidl::android::hardware::radio::AccessNetwork accessNetworkType) override;
+ ::ndk::ScopedAStatus stopImsTraffic(int32_t serial, const std::string& token) override;
+ ::ndk::ScopedAStatus triggerEpsFallback(
+ int32_t serial,
+ ::aidl::android::hardware::radio::ims::EpsFallbackReason reason) override;
+ ::ndk::ScopedAStatus sendAnbrQuery(
+ int32_t serial, ::aidl::android::hardware::radio::ims::ImsStreamType mediaType,
+ ::aidl::android::hardware::radio::ims::ImsStreamDirection direction,
+ int32_t bitsPerSecond) override;
+ ::ndk::ScopedAStatus setResponseFunctions(
+ const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse>&
+ radioImsResponse,
+ const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication>&
+ radioImsIndication) override;
+
+ protected:
+ std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> respond();
+
+ public:
+ using RadioCompatBase::RadioCompatBase;
+};
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
index 6cfd59c..f042456 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
@@ -19,6 +19,7 @@
#include "GuaranteedCallback.h"
#include <aidl/android/hardware/radio/data/IRadioDataIndication.h>
+#include <aidl/android/hardware/radio/ims/IRadioImsIndication.h>
#include <aidl/android/hardware/radio/messaging/IRadioMessagingIndication.h>
#include <aidl/android/hardware/radio/modem/IRadioModemIndication.h>
#include <aidl/android/hardware/radio/network/IRadioNetworkIndication.h>
@@ -55,6 +56,10 @@
::aidl::android::hardware::radio::voice::IRadioVoiceIndication,
::aidl::android::hardware::radio::voice::IRadioVoiceIndicationDefault, true>
mVoiceCb;
+ GuaranteedCallback< //
+ ::aidl::android::hardware::radio::ims::IRadioImsIndication,
+ ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true>
+ mImsCb;
// IRadioIndication @ 1.0
Return<void> radioStateChanged(V1_0::RadioIndicationType type,
@@ -220,6 +225,8 @@
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb);
+ void setResponseFunction(
+ std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb);
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb();
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
@@ -228,6 +235,7 @@
std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> networkCb();
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb();
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb();
+ std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb();
};
} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
index 1f82dd1..22451ae 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
@@ -19,6 +19,7 @@
#include "GuaranteedCallback.h"
#include <aidl/android/hardware/radio/data/IRadioDataResponse.h>
+#include <aidl/android/hardware/radio/ims/IRadioImsResponse.h>
#include <aidl/android/hardware/radio/messaging/IRadioMessagingResponse.h>
#include <aidl/android/hardware/radio/modem/IRadioModemResponse.h>
#include <aidl/android/hardware/radio/network/IRadioNetworkResponse.h>
@@ -49,6 +50,9 @@
GuaranteedCallback<::aidl::android::hardware::radio::voice::IRadioVoiceResponse,
::aidl::android::hardware::radio::voice::IRadioVoiceResponseDefault>
mVoiceCb;
+ GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse,
+ ::aidl::android::hardware::radio::ims::IRadioImsResponseDefault>
+ mImsCb;
// IRadioResponse @ 1.0
Return<void> getIccCardStatusResponse(const V1_0::RadioResponseInfo& info,
@@ -440,6 +444,8 @@
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb);
+ void setResponseFunction(
+ std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb);
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb();
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse>
@@ -448,6 +454,7 @@
std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> networkCb();
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb();
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb();
+ std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb();
};
} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp
index 4dbaef4..d16773e 100644
--- a/radio/aidl/compat/service/Android.bp
+++ b/radio/aidl/compat/service/Android.bp
@@ -40,6 +40,7 @@
"android.hardware.radio.config@1.2",
"android.hardware.radio.config@1.3",
"android.hardware.radio.data-V1-ndk",
+ "android.hardware.radio.ims-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
"android.hardware.radio.network-V2-ndk",
diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp
index 0d4bb3e..bb992c9 100644
--- a/radio/aidl/vts/Android.bp
+++ b/radio/aidl/vts/Android.bp
@@ -41,6 +41,9 @@
"radio_data_indication.cpp",
"radio_data_response.cpp",
"radio_data_test.cpp",
+ "radio_ims_indication.cpp",
+ "radio_ims_response.cpp",
+ "radio_ims_test.cpp",
"radio_messaging_indication.cpp",
"radio_messaging_response.cpp",
"radio_messaging_test.cpp",
@@ -66,6 +69,7 @@
"android.hardware.radio-V1-ndk",
"android.hardware.radio.config-V1-ndk",
"android.hardware.radio.data-V1-ndk",
+ "android.hardware.radio.ims-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
"android.hardware.radio.network-V2-ndk",
diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
index 1ebc6af..67a2672 100644
--- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp
+++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
@@ -18,6 +18,7 @@
#include "radio_config_utils.h"
#include "radio_data_utils.h"
+#include "radio_ims_utils.h"
#include "radio_messaging_utils.h"
#include "radio_modem_utils.h"
#include "radio_network_utils.h"
@@ -65,6 +66,12 @@
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioVoice::descriptor)),
android::PrintInstanceNameToString);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioImsTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioImsTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioIms::descriptor)),
+ android::PrintInstanceNameToString);
+
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
ABinderProcess_setThreadPoolMaxThreadCount(1);
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h
index 47976b9..4ed6b3f 100644
--- a/radio/aidl/vts/radio_aidl_hal_utils.h
+++ b/radio/aidl/vts/radio_aidl_hal_utils.h
@@ -67,6 +67,8 @@
static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
+static constexpr const char* FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims";
+
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
#define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2
diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp
new file mode 100644
index 0000000..f382de0
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_indication.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_ims_utils.h"
+
+RadioImsIndication::RadioImsIndication(RadioServiceTest& parent) : parent_ims(parent) {}
+
+ndk::ScopedAStatus RadioImsIndication::onConnectionSetupFailure(RadioIndicationType /*type*/,
+ const std::string& /*token*/, const ConnectionFailureInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/,
+ ImsStreamType /*mediaType*/, ImsStreamDirection /*direction*/, int /*bitsPerSecond*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsIndication::triggerImsDeregistration(RadioIndicationType /*type*/,
+ ImsDeregistrationReason /*reason*/) {
+ return ndk::ScopedAStatus::ok();
+}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp
new file mode 100644
index 0000000..9d8db4a
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_response.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_ims_utils.h"
+
+RadioImsResponse::RadioImsResponse(RadioServiceTest& parent) : parent_ims(parent) {}
+
+ndk::ScopedAStatus RadioImsResponse::setSrvccCallInfoResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::updateImsRegistrationInfoResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::startImsTrafficResponse(const RadioResponseInfo& info,
+ const std::optional<ConnectionFailureInfo>& response) {
+ rspInfo = info;
+ startImsTrafficResp = response;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::stopImsTrafficResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::triggerEpsFallbackResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp
new file mode 100644
index 0000000..e5cbeb4
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_test.cpp
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_ims_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioImsTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_ims = IRadioIms::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_ims.get());
+
+ radioRsp_ims = ndk::SharedRefBase::make<RadioImsResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_ims.get());
+
+ count_ = 0;
+
+ radioInd_ims = ndk::SharedRefBase::make<RadioImsIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_ims.get());
+
+ radio_ims->setResponseFunctions(radioRsp_ims, radioInd_ims);
+
+ // Assert IRadioConfig exists before testing
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
+}
+
+/*
+ * Test IRadioIms.setSrvccCallInfo() for the response returned.
+ */
+TEST_P(RadioImsTest, setSrvccCallInfo) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping setSrvccCallInfo because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running setSrvccCallInfo because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ SrvccCall srvccCall;
+
+ ndk::ScopedAStatus res =
+ radio_ims->setSrvccCallInfo(serial, { srvccCall });
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("setSrvccCallInfo, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.updateImsRegistrationInfo() for the response returned.
+ */
+TEST_P(RadioImsTest, updateImsRegistrationInfo) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping updateImsRegistrationInfo because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running updateImsRegistrationInfo because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ImsRegistration regInfo;
+ regInfo.regState = ImsRegistrationState::NOT_REGISTERED;
+ regInfo.accessNetworkType = AccessNetwork::EUTRAN;
+ regInfo.suggestedAction = SuggestedAction::NONE;
+ regInfo.capabilities = ImsRegistration::IMS_MMTEL_CAPABILITY_NONE;
+
+ ndk::ScopedAStatus res =
+ radio_ims->updateImsRegistrationInfo(serial, regInfo);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("updateImsRegistrationInfo, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.startImsTraffic() for the response returned.
+ */
+TEST_P(RadioImsTest, startImsTraffic) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping startImsTraffic because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running startImsTraffic because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->startImsTraffic(serial, std::string("1"),
+ ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("startImsTraffic, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.stopImsTraffic() for the response returned.
+ */
+TEST_P(RadioImsTest, stopImsTraffic) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping stopImsTraffic because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running stopImsTraffic because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->stopImsTraffic(serial, std::string("2"));
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("stopImsTraffic, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.triggerEpsFallback() for the response returned.
+ */
+TEST_P(RadioImsTest, triggerEpsFallback) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping triggerEpsFallback because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running triggerEpsFallback because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->triggerEpsFallback(serial, EpsFallbackReason::NO_NETWORK_TRIGGER);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("triggerEpsFallback, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.sendAnbrQuery() for the response returned.
+ */
+TEST_P(RadioImsTest, sendAnbrQuery) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping sendAnbrQuery because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running sendAnbrQuery because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->sendAnbrQuery(serial, ImsStreamType::AUDIO, ImsStreamDirection::UPLINK, 13200);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("sendAnbrQuery, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+void RadioImsTest::verifyError(RadioError resp) {
+ switch (resp) {
+ case RadioError::NONE:
+ case RadioError::RADIO_NOT_AVAILABLE:
+ case RadioError::INVALID_STATE:
+ case RadioError::NO_MEMORY:
+ case RadioError::SYSTEM_ERR:
+ case RadioError::MODEM_ERR:
+ case RadioError::INTERNAL_ERR:
+ case RadioError::INVALID_ARGUMENTS:
+ case RadioError::REQUEST_NOT_SUPPORTED:
+ case RadioError::NO_RESOURCES:
+ SUCCEED();
+ break;
+ default:
+ FAIL();
+ break;
+ }
+}
diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h
new file mode 100644
index 0000000..c981ebc
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_utils.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/ims/BnRadioImsIndication.h>
+#include <aidl/android/hardware/radio/ims/BnRadioImsResponse.h>
+#include <aidl/android/hardware/radio/ims/IRadioIms.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::ims;
+
+class RadioImsTest;
+
+/* Callback class for radio ims response */
+class RadioImsResponse : public BnRadioImsResponse {
+ protected:
+ RadioServiceTest& parent_ims;
+
+ public:
+ RadioImsResponse(RadioServiceTest& parent_ims);
+ virtual ~RadioImsResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ std::optional<ConnectionFailureInfo> startImsTrafficResp;
+
+ virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus startImsTrafficResponse(
+ const RadioResponseInfo& info,
+ const std::optional<ConnectionFailureInfo>& response) override;
+
+ virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override;
+};
+
+/* Callback class for radio ims indication */
+class RadioImsIndication : public BnRadioImsIndication {
+ protected:
+ RadioServiceTest& parent_ims;
+
+ public:
+ RadioImsIndication(RadioServiceTest& parent_ims);
+ virtual ~RadioImsIndication() = default;
+
+ virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type,
+ const std::string& token, const ConnectionFailureInfo& info) override;
+
+ virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType,
+ ImsStreamDirection direction, int bitsPerSecond) override;
+
+ virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type,
+ ImsDeregistrationReason reason) override;
+};
+
+// The main test class for Radio AIDL Ims.
+class RadioImsTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
+ protected:
+ virtual void verifyError(RadioError resp);
+
+ public:
+ virtual void SetUp() override;
+
+ /* radio ims service handle */
+ std::shared_ptr<IRadioIms> radio_ims;
+ /* radio ims response handle */
+ std::shared_ptr<RadioImsResponse> radioRsp_ims;
+ /* radio ims indication handle */
+ std::shared_ptr<RadioImsIndication> radioInd_ims;
+};
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index 7c98d4c..31f4aca 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -1499,11 +1499,12 @@
// Check for access technology specific info
AccessTechnologySpecificInfo info = radioRsp_network->dataRegResp.accessTechnologySpecificInfo;
RadioTechnology rat = radioRsp_network->dataRegResp.rat;
+
// TODO: add logic for cdmaInfo
if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) {
ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo);
} else if (rat == RadioTechnology::NR) {
- ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo);
+ ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo);
}
}
diff --git a/security/keymint/TEST_MAPPING b/security/keymint/TEST_MAPPING
new file mode 100644
index 0000000..9ce5e9b
--- /dev/null
+++ b/security/keymint/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit": [
+ {
+ "name": "VtsHalRemotelyProvisionedComponentTargetTest"
+ }
+ ]
+}