Merge "Remove unused DEBUG_PACKET_FATE capability from StaIfaceCapabilityMask."
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index af3f5a2..e6b0cee 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -223,11 +223,12 @@
],
srcs: [
"android/hardware/audio/effect/AcousticEchoCanceler.aidl",
- "android/hardware/audio/effect/AutomaticGainControl.aidl",
"android/hardware/audio/effect/AutomaticGainControlV1.aidl",
+ "android/hardware/audio/effect/AutomaticGainControlV2.aidl",
"android/hardware/audio/effect/BassBoost.aidl",
"android/hardware/audio/effect/Capability.aidl",
"android/hardware/audio/effect/CommandId.aidl",
+ "android/hardware/audio/effect/DefaultExtension.aidl",
"android/hardware/audio/effect/Descriptor.aidl",
"android/hardware/audio/effect/Downmix.aidl",
"android/hardware/audio/effect/DynamicsProcessing.aidl",
diff --git a/audio/aidl/TEST_MAPPING b/audio/aidl/TEST_MAPPING
index a166e61..3e06595 100644
--- a/audio/aidl/TEST_MAPPING
+++ b/audio/aidl/TEST_MAPPING
@@ -40,7 +40,10 @@
"name": "VtsHalAECTargetTest"
},
{
- "name": "VtsHalAGCTargetTest"
+ "name": "VtsHalAGC1TargetTest"
+ },
+ {
+ "name": "VtsHalAGC2TargetTest"
},
{
"name": "VtsHalNSTargetTest"
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
similarity index 91%
rename from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
rename to audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
index f3dd523..bdb481c 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
@@ -33,15 +33,15 @@
package android.hardware.audio.effect;
@VintfStability
-union AutomaticGainControl {
+union AutomaticGainControlV2 {
android.hardware.audio.effect.VendorExtension vendor;
int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
+ android.hardware.audio.effect.AutomaticGainControlV2.LevelEstimator levelEstimator;
int saturationMarginMb;
@VintfStability
union Id {
int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
+ android.hardware.audio.effect.AutomaticGainControlV2.Tag commonTag;
}
@Backing(type="int") @VintfStability
enum LevelEstimator {
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DefaultExtension.aidl
similarity index 77%
copy from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
copy to audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DefaultExtension.aidl
index f3dd523..f1cf389 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DefaultExtension.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,19 +33,6 @@
package android.hardware.audio.effect;
@VintfStability
-union AutomaticGainControl {
- android.hardware.audio.effect.VendorExtension vendor;
- int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
- int saturationMarginMb;
- @VintfStability
- union Id {
- int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @Backing(type="int") @VintfStability
- enum LevelEstimator {
- RMS = 0,
- PEAK = 1,
- }
+parcelable DefaultExtension {
+ byte[] bytes;
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
index 990d369..0baac3d 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl
@@ -41,7 +41,8 @@
const String EFFECT_TYPE_UUID_EQUALIZER = "0bed4300-ddd6-11db-8f34-0002a5d5c51b";
const String EFFECT_TYPE_UUID_BASS_BOOST = "0634f220-ddd4-11db-a0fc-0002a5d5c51b";
const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b";
- const String EFFECT_TYPE_UUID_AGC = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ const String EFFECT_TYPE_UUID_AGC1 = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ const String EFFECT_TYPE_UUID_AGC2 = "ae3c653b-be18-4ab8-8938-418f0a7f06ac";
const String EFFECT_TYPE_UUID_AEC = "7b491460-8d4d-11e0-bd61-0002a5d5c51b";
const String EFFECT_TYPE_UUID_NS = "58b4b260-8e06-11e0-aa8e-0002a5d5c51b";
const String EFFECT_TYPE_UUID_LOUDNESS_ENHANCER = "fe3199be-aed0-413f-87bb-11260eb63cf1";
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
index 3ba44a0..14aa1e8 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl
@@ -44,7 +44,8 @@
union Id {
int vendorEffectTag;
android.hardware.audio.effect.AcousticEchoCanceler.Id acousticEchoCancelerTag;
- android.hardware.audio.effect.AutomaticGainControl.Id automaticGainControlTag;
+ android.hardware.audio.effect.AutomaticGainControlV1.Id automaticGainControlV1Tag;
+ android.hardware.audio.effect.AutomaticGainControlV2.Id automaticGainControlV2Tag;
android.hardware.audio.effect.BassBoost.Id bassBoostTag;
android.hardware.audio.effect.Downmix.Id downmixTag;
android.hardware.audio.effect.DynamicsProcessing.Id dynamicsProcessingTag;
@@ -75,7 +76,8 @@
union Specific {
android.hardware.audio.effect.VendorExtension vendorEffect;
android.hardware.audio.effect.AcousticEchoCanceler acousticEchoCanceler;
- android.hardware.audio.effect.AutomaticGainControl automaticGainControl;
+ android.hardware.audio.effect.AutomaticGainControlV1 automaticGainControlV1;
+ android.hardware.audio.effect.AutomaticGainControlV2 automaticGainControlV2;
android.hardware.audio.effect.BassBoost bassBoost;
android.hardware.audio.effect.Downmix downmix;
android.hardware.audio.effect.DynamicsProcessing dynamicsProcessing;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
index 14e9cd8..93edc5e 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
@@ -36,8 +36,8 @@
union Range {
android.hardware.audio.effect.Range.VendorExtensionRange[] vendorExtension = {};
android.hardware.audio.effect.Range.AcousticEchoCancelerRange[] acousticEchoCanceler;
- android.hardware.audio.effect.Range.AutomaticGainControlRange[] automaticGainControl;
android.hardware.audio.effect.Range.AutomaticGainControlV1Range[] automaticGainControlV1;
+ android.hardware.audio.effect.Range.AutomaticGainControlV2Range[] automaticGainControlV2;
android.hardware.audio.effect.Range.BassBoostRange[] bassBoost;
android.hardware.audio.effect.Range.DownmixRange[] downmix;
android.hardware.audio.effect.Range.DynamicsProcessingRange[] dynamicsProcessing;
@@ -56,16 +56,16 @@
android.hardware.audio.effect.AcousticEchoCanceler max;
}
@VintfStability
- parcelable AutomaticGainControlRange {
- android.hardware.audio.effect.AutomaticGainControl min;
- android.hardware.audio.effect.AutomaticGainControl max;
- }
- @VintfStability
parcelable AutomaticGainControlV1Range {
android.hardware.audio.effect.AutomaticGainControlV1 min;
android.hardware.audio.effect.AutomaticGainControlV1 max;
}
@VintfStability
+ parcelable AutomaticGainControlV2Range {
+ android.hardware.audio.effect.AutomaticGainControlV2 min;
+ android.hardware.audio.effect.AutomaticGainControlV2 max;
+ }
+ @VintfStability
parcelable BassBoostRange {
android.hardware.audio.effect.BassBoost min;
android.hardware.audio.effect.BassBoost max;
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
similarity index 72%
rename from audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl
rename to audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
index 0c984b5..836d6b8 100644
--- a/audio/aidl/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
@@ -19,28 +19,29 @@
import android.hardware.audio.effect.VendorExtension;
/**
- * Automatic Gain Control (AGC) is an audio pre-processor which automatically normalizes the output
- * of the captured signal by boosting or lowering input from the microphone to match a preset level
- * so that the output signal level is virtually constant. AGC can be used by applications where the
- * input signal dynamic range is not important but where a constant strong capture level is desired.
+ * Automatic Gain Control V2 (AGC2) is an audio pre-processor which automatically normalizes the
+ * output of the captured signal by boosting or lowering input from the microphone to match a preset
+ * level so that the output signal level is virtually constant. AGC can be used by applications
+ * where the input signal dynamic range is not important but where a constant strong capture level
+ * is desired.
*
- * All parameter settings must be inside the range of Capability.Range.automaticGainControl
+ * All parameter settings must be inside the range of Capability.Range.automaticGainControlV2
* definition if the definition for the corresponding parameter tag exist. See more detals about
* Range in Range.aidl.
*/
@VintfStability
-union AutomaticGainControl {
+union AutomaticGainControlV2 {
/**
* Effect parameter tag to identify the parameters for getParameter().
*/
@VintfStability
union Id {
int vendorExtensionTag;
- AutomaticGainControl.Tag commonTag;
+ AutomaticGainControlV2.Tag commonTag;
}
/**
- * Vendor AutomaticGainControl implementation definition for additional parameters.
+ * Vendor AutomaticGainControlV2 implementation definition for additional parameters.
*/
VendorExtension vendor;
diff --git a/audio/aidl/android/hardware/audio/effect/DefaultExtension.aidl b/audio/aidl/android/hardware/audio/effect/DefaultExtension.aidl
new file mode 100644
index 0000000..33e827f
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/DefaultExtension.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+/**
+ * The default extension used for Parameter.Specific.vendorEffect ParcelableHolder.
+ *
+ * The audio framework attach this default extension to the ParcelableHolder in VendorExtension,
+ * and pass though all parameters it received from the client to audio HAL.
+ *
+ * For now it's not possible for vendor to define their own vendor extensions without changing the
+ * audio framework. More specificly, in order to add a customized effect parameter AIDL parcelable,
+ * vendors need to add the logic for conversion between AIDL and effect_param_t for the effect AIDL
+ * in: frameworks/av/media/libaudiohal/impl/effectAidlConversion.
+ *
+ * There is no VTS test cases for the vendor extension effect implementation, however all effect
+ * implementations must support the common parameters defined in Parameter.aidl, so vendor
+ * extension effect implementation still need to support setting and getting of these common
+ * parameters, which is enforced by VTS.
+ */
+@VintfStability
+parcelable DefaultExtension {
+ byte[] bytes;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
index 47c88dc..01ca1c6 100644
--- a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl
@@ -57,9 +57,13 @@
*/
const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b";
/**
- * UUID for Automatic Gain Control (AGC) type.
+ * UUID for Automatic Gain Control V1 (AGC1) type.
*/
- const String EFFECT_TYPE_UUID_AGC = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ const String EFFECT_TYPE_UUID_AGC1 = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b";
+ /**
+ * UUID for Automatic Gain Control V2 (AGC2) type.
+ */
+ const String EFFECT_TYPE_UUID_AGC2 = "ae3c653b-be18-4ab8-8938-418f0a7f06ac";
/**
* UUID for Acoustic Echo Canceler (AEC) type.
*/
diff --git a/audio/aidl/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
index be7144f..9f8874b 100644
--- a/audio/aidl/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
@@ -17,7 +17,8 @@
package android.hardware.audio.effect;
import android.hardware.audio.effect.AcousticEchoCanceler;
-import android.hardware.audio.effect.AutomaticGainControl;
+import android.hardware.audio.effect.AutomaticGainControlV1;
+import android.hardware.audio.effect.AutomaticGainControlV2;
import android.hardware.audio.effect.BassBoost;
import android.hardware.audio.effect.Downmix;
import android.hardware.audio.effect.DynamicsProcessing;
@@ -83,7 +84,8 @@
*
*/
AcousticEchoCanceler.Id acousticEchoCancelerTag;
- AutomaticGainControl.Id automaticGainControlTag;
+ AutomaticGainControlV1.Id automaticGainControlV1Tag;
+ AutomaticGainControlV2.Id automaticGainControlV2Tag;
BassBoost.Id bassBoostTag;
Downmix.Id downmixTag;
DynamicsProcessing.Id dynamicsProcessingTag;
@@ -165,7 +167,8 @@
union Specific {
VendorExtension vendorEffect;
AcousticEchoCanceler acousticEchoCanceler;
- AutomaticGainControl automaticGainControl;
+ AutomaticGainControlV1 automaticGainControlV1;
+ AutomaticGainControlV2 automaticGainControlV2;
BassBoost bassBoost;
Downmix downmix;
DynamicsProcessing dynamicsProcessing;
diff --git a/audio/aidl/android/hardware/audio/effect/Range.aidl b/audio/aidl/android/hardware/audio/effect/Range.aidl
index 30e2359..567320a 100644
--- a/audio/aidl/android/hardware/audio/effect/Range.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Range.aidl
@@ -17,8 +17,8 @@
package android.hardware.audio.effect;
import android.hardware.audio.effect.AcousticEchoCanceler;
-import android.hardware.audio.effect.AutomaticGainControl;
import android.hardware.audio.effect.AutomaticGainControlV1;
+import android.hardware.audio.effect.AutomaticGainControlV2;
import android.hardware.audio.effect.BassBoost;
import android.hardware.audio.effect.Downmix;
import android.hardware.audio.effect.DynamicsProcessing;
@@ -103,18 +103,18 @@
}
@VintfStability
- parcelable AutomaticGainControlRange {
- AutomaticGainControl min;
- AutomaticGainControl max;
- }
-
- @VintfStability
parcelable AutomaticGainControlV1Range {
AutomaticGainControlV1 min;
AutomaticGainControlV1 max;
}
@VintfStability
+ parcelable AutomaticGainControlV2Range {
+ AutomaticGainControlV2 min;
+ AutomaticGainControlV2 max;
+ }
+
+ @VintfStability
parcelable BassBoostRange {
BassBoost min;
BassBoost max;
@@ -203,8 +203,8 @@
*/
VendorExtensionRange[] vendorExtension = {};
AcousticEchoCancelerRange[] acousticEchoCanceler;
- AutomaticGainControlRange[] automaticGainControl;
AutomaticGainControlV1Range[] automaticGainControlV1;
+ AutomaticGainControlV2Range[] automaticGainControlV2;
BassBoostRange[] bassBoost;
DownmixRange[] downmix;
DynamicsProcessingRange[] dynamicsProcessing;
diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp
index fa9eb95..e90fe35 100644
--- a/audio/aidl/default/EffectImpl.cpp
+++ b/audio/aidl/default/EffectImpl.cpp
@@ -107,11 +107,8 @@
"CommonParamNotSupported");
break;
}
- case Parameter::Id::vendorEffectTag: {
- LOG(DEBUG) << __func__ << " noop for vendor tag";
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "vendortagNotSupported");
- }
+ case Parameter::Id::vendorEffectTag:
+ FALLTHROUGH_INTENDED;
default: {
Parameter::Specific specific;
RETURN_IF_ASTATUS_NOT_OK(getParameterSpecific(id, &specific), "SpecParamNotSupported");
diff --git a/audio/aidl/default/audio_effects_config.xml b/audio/aidl/default/audio_effects_config.xml
index 6714a7e..88c4459 100644
--- a/audio/aidl/default/audio_effects_config.xml
+++ b/audio/aidl/default/audio_effects_config.xml
@@ -29,7 +29,8 @@
-->
<libraries>
<library name="aecsw" path="libaecsw.so"/>
- <library name="agcsw" path="libagcsw.so"/>
+ <library name="agc1sw" path="libagc1sw.so"/>
+ <library name="agc2sw" path="libagc2sw.so"/>
<library name="bassboostsw" path="libbassboostsw.so"/>
<library name="bundle" path="libbundleaidl.so"/>
<library name="downmix" path="libdownmixaidl.so"/>
@@ -44,6 +45,7 @@
<library name="virtualizersw" path="libvirtualizersw.so"/>
<library name="visualizer" path="libvisualizeraidl.so"/>
<library name="volumesw" path="libvolumesw.so"/>
+ <library name="extensioneffect" path="libextensioneffect.so"/>
</libraries>
<!-- list of effects to load.
@@ -67,7 +69,8 @@
<effects>
<effect name="acoustic_echo_canceler" library="aecsw" uuid="bb392ec0-8d4d-11e0-a896-0002a5d5c51b"/>
- <effect name="automatic_gain_control" library="agcsw" uuid="89f38e65-d4d2-4d64-ad0e-2b3e799ea886"/>
+ <effect name="automatic_gain_control_v1" library="agc1sw" uuid="aa8130e0-66fc-11e0-bad0-0002a5d5c51b"/>
+ <effect name="automatic_gain_control_v2" library="agc2sw" uuid="89f38e65-d4d2-4d64-ad0e-2b3e799ea886"/>
<effectProxy name="bassboost" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
<libsw library="bassboostsw" uuid="fa8181f2-588b-11ed-9b6a-0242ac120002"/>
<libsw library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/>
@@ -93,6 +96,7 @@
<libsw library="equalizersw" uuid="0bed4300-847d-11df-bb17-0002a5d5c51b"/>
<libsw library="bundle" uuid="ce772f20-847d-11df-bb17-0002a5d5c51b"/>
</effectProxy>
+ <effect name="extensioneffect" library="extensioneffect" uuid="fa81dd00-588b-11ed-9b6a-0242ac120002"/>
</effects>
<!-- Audio pre processor configurations.
diff --git a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp b/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp
deleted file mode 100644
index 30d7910..0000000
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <algorithm>
-#include <cstddef>
-#include <memory>
-#define LOG_TAG "AHAL_AutomaticGainControlSw"
-#include <Utils.h>
-#include <unordered_set>
-
-#include <android-base/logging.h>
-#include <fmq/AidlMessageQueue.h>
-
-#include "AutomaticGainControlSw.h"
-
-using aidl::android::hardware::audio::effect::AutomaticGainControlSw;
-using aidl::android::hardware::audio::effect::Descriptor;
-using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kAutomaticGainControlSwImplUUID;
-using aidl::android::media::audio::common::AudioUuid;
-
-extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
- std::shared_ptr<IEffect>* instanceSpp) {
- if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlSwImplUUID) {
- LOG(ERROR) << __func__ << "uuid not supported";
- return EX_ILLEGAL_ARGUMENT;
- }
- if (instanceSpp) {
- *instanceSpp = ndk::SharedRefBase::make<AutomaticGainControlSw>();
- LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
- return EX_NONE;
- } else {
- LOG(ERROR) << __func__ << " invalid input parameter!";
- return EX_ILLEGAL_ARGUMENT;
- }
-}
-
-extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlSwImplUUID) {
- LOG(ERROR) << __func__ << "uuid not supported";
- return EX_ILLEGAL_ARGUMENT;
- }
- *_aidl_return = AutomaticGainControlSw::kDescriptor;
- return EX_NONE;
-}
-
-namespace aidl::android::hardware::audio::effect {
-
-const std::string AutomaticGainControlSw::kEffectName = "AutomaticGainControlSw";
-
-const std::vector<Range::AutomaticGainControlRange> AutomaticGainControlSw::kRanges = {
- MAKE_RANGE(AutomaticGainControl, fixedDigitalGainMb, 0, 50000),
- MAKE_RANGE(AutomaticGainControl, saturationMarginMb, 0, 10000)};
-
-const Capability AutomaticGainControlSw::kCapability = {.range = AutomaticGainControlSw::kRanges};
-
-const Descriptor AutomaticGainControlSw::kDescriptor = {
- .common = {.id = {.type = kAutomaticGainControlTypeUUID,
- .uuid = kAutomaticGainControlSwImplUUID,
- .proxy = std::nullopt},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::FIRST,
- .volume = Flags::Volume::CTRL},
- .name = AutomaticGainControlSw::kEffectName,
- .implementor = "The Android Open Source Project"},
- .capability = AutomaticGainControlSw::kCapability};
-
-ndk::ScopedAStatus AutomaticGainControlSw::getDescriptor(Descriptor* _aidl_return) {
- LOG(DEBUG) << __func__ << kDescriptor.toString();
- *_aidl_return = kDescriptor;
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus AutomaticGainControlSw::setParameterSpecific(
- const Parameter::Specific& specific) {
- RETURN_IF(Parameter::Specific::automaticGainControl != specific.getTag(), EX_ILLEGAL_ARGUMENT,
- "EffectNotSupported");
- RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
-
- auto& param = specific.get<Parameter::Specific::automaticGainControl>();
- RETURN_IF(!inRange(param, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
- auto tag = param.getTag();
- switch (tag) {
- case AutomaticGainControl::fixedDigitalGainMb: {
- RETURN_IF(mContext->setDigitalGain(
- param.get<AutomaticGainControl::fixedDigitalGainMb>()) !=
- RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "digitalGainNotSupported");
- return ndk::ScopedAStatus::ok();
- }
- case AutomaticGainControl::levelEstimator: {
- RETURN_IF(
- mContext->setLevelEstimator(
- param.get<AutomaticGainControl::levelEstimator>()) != RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "levelEstimatorNotSupported");
- return ndk::ScopedAStatus::ok();
- }
- case AutomaticGainControl::saturationMarginMb: {
- RETURN_IF(mContext->setSaturationMargin(
- param.get<AutomaticGainControl::saturationMarginMb>()) !=
- RetCode::SUCCESS,
- EX_ILLEGAL_ARGUMENT, "saturationMarginNotSupported");
- return ndk::ScopedAStatus::ok();
- }
- default: {
- LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "AutomaticGainControlTagNotSupported");
- }
- }
-}
-
-ndk::ScopedAStatus AutomaticGainControlSw::getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) {
- auto tag = id.getTag();
- RETURN_IF(Parameter::Id::automaticGainControlTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
- auto specificId = id.get<Parameter::Id::automaticGainControlTag>();
- auto specificIdTag = specificId.getTag();
- switch (specificIdTag) {
- case AutomaticGainControl::Id::commonTag:
- return getParameterAutomaticGainControl(
- specificId.get<AutomaticGainControl::Id::commonTag>(), specific);
- default:
- LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "AutomaticGainControlTagNotSupported");
- }
-}
-
-ndk::ScopedAStatus AutomaticGainControlSw::getParameterAutomaticGainControl(
- const AutomaticGainControl::Tag& tag, Parameter::Specific* specific) {
- RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
- AutomaticGainControl param;
- switch (tag) {
- case AutomaticGainControl::fixedDigitalGainMb: {
- param.set<AutomaticGainControl::fixedDigitalGainMb>(mContext->getDigitalGain());
- break;
- }
- case AutomaticGainControl::levelEstimator: {
- param.set<AutomaticGainControl::levelEstimator>(mContext->getLevelEstimator());
- break;
- }
- case AutomaticGainControl::saturationMarginMb: {
- param.set<AutomaticGainControl::saturationMarginMb>(mContext->getSaturationMargin());
- break;
- }
- default: {
- LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
- return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
- EX_ILLEGAL_ARGUMENT, "AutomaticGainControlTagNotSupported");
- }
- }
-
- specific->set<Parameter::Specific::automaticGainControl>(param);
- return ndk::ScopedAStatus::ok();
-}
-
-std::shared_ptr<EffectContext> AutomaticGainControlSw::createContext(
- const Parameter::Common& common) {
- if (mContext) {
- LOG(DEBUG) << __func__ << " context already exist";
- } else {
- mContext = std::make_shared<AutomaticGainControlSwContext>(1 /* statusFmqDepth */, common);
- }
- return mContext;
-}
-
-std::shared_ptr<EffectContext> AutomaticGainControlSw::getContext() {
- return mContext;
-}
-
-RetCode AutomaticGainControlSw::releaseContext() {
- if (mContext) {
- mContext.reset();
- }
- return RetCode::SUCCESS;
-}
-
-// Processing method running in EffectWorker thread.
-IEffect::Status AutomaticGainControlSw::effectProcessImpl(float* in, float* out, int samples) {
- // TODO: get data buffer and process.
- LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
- for (int i = 0; i < samples; i++) {
- *out++ = *in++;
- }
- return {STATUS_OK, samples, samples};
-}
-
-RetCode AutomaticGainControlSwContext::setDigitalGain(int gain) {
- mDigitalGain = gain;
- return RetCode::SUCCESS;
-}
-
-int AutomaticGainControlSwContext::getDigitalGain() {
- return mDigitalGain;
-}
-
-RetCode AutomaticGainControlSwContext::setLevelEstimator(
- AutomaticGainControl::LevelEstimator levelEstimator) {
- mLevelEstimator = levelEstimator;
- return RetCode::SUCCESS;
-}
-
-AutomaticGainControl::LevelEstimator AutomaticGainControlSwContext::getLevelEstimator() {
- return mLevelEstimator;
-}
-
-RetCode AutomaticGainControlSwContext::setSaturationMargin(int margin) {
- mSaturationMargin = margin;
- return RetCode::SUCCESS;
-}
-
-int AutomaticGainControlSwContext::getSaturationMargin() {
- return mSaturationMargin;
-}
-
-} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/Android.bp b/audio/aidl/default/automaticGainControlV1/Android.bp
similarity index 91%
copy from audio/aidl/default/automaticGainControl/Android.bp
copy to audio/aidl/default/automaticGainControlV1/Android.bp
index 17d6416..4ae8e63 100644
--- a/audio/aidl/default/automaticGainControl/Android.bp
+++ b/audio/aidl/default/automaticGainControlV1/Android.bp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,14 +24,14 @@
}
cc_library_shared {
- name: "libagcsw",
+ name: "libagc1sw",
defaults: [
"aidlaudioeffectservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_effect_ndk_shared",
],
srcs: [
- "AutomaticGainControlSw.cpp",
+ "AutomaticGainControlV1Sw.cpp",
":effectCommonFile",
],
relative_install_path: "soundfx",
diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp
new file mode 100644
index 0000000..39290b4
--- /dev/null
+++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AHAL_AutomaticGainControlV1Sw"
+
+#include <android-base/logging.h>
+
+#include "AutomaticGainControlV1Sw.h"
+
+using aidl::android::hardware::audio::effect::AutomaticGainControlV1Sw;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV1SwImplUUID;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<AutomaticGainControlV1Sw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ *_aidl_return = AutomaticGainControlV1Sw::kDescriptor;
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+const std::string AutomaticGainControlV1Sw::kEffectName = "AutomaticGainControlV1Sw";
+
+const std::vector<Range::AutomaticGainControlV1Range> AutomaticGainControlV1Sw::kRanges = {
+ MAKE_RANGE(AutomaticGainControlV1, targetPeakLevelDbFs, -3100, 0),
+ MAKE_RANGE(AutomaticGainControlV1, maxCompressionGainDb, 0, 9000)};
+
+const Capability AutomaticGainControlV1Sw::kCapability = {
+ .range = AutomaticGainControlV1Sw::kRanges};
+
+const Descriptor AutomaticGainControlV1Sw::kDescriptor = {
+ .common = {.id = {.type = kAutomaticGainControlV1TypeUUID,
+ .uuid = kAutomaticGainControlV1SwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = AutomaticGainControlV1Sw::kEffectName,
+ .implementor = "The Android Open Source Project"},
+ .capability = AutomaticGainControlV1Sw::kCapability};
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::setParameterSpecific(
+ const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::automaticGainControlV1 != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ auto& param = specific.get<Parameter::Specific::automaticGainControlV1>();
+ RETURN_IF(!inRange(param, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
+ auto tag = param.getTag();
+ switch (tag) {
+ case AutomaticGainControlV1::targetPeakLevelDbFs: {
+ RETURN_IF(mContext->setTargetPeakLevel(
+ param.get<AutomaticGainControlV1::targetPeakLevelDbFs>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "targetPeakLevelNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV1::maxCompressionGainDb: {
+ RETURN_IF(mContext->setMaxCompressionGain(
+ param.get<AutomaticGainControlV1::maxCompressionGainDb>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "maxCompressionGainNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV1::enableLimiter: {
+ RETURN_IF(
+ mContext->setEnableLimiter(
+ param.get<AutomaticGainControlV1::enableLimiter>()) != RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "enableLimiterNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV1TagNotSupported");
+ }
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::automaticGainControlV1Tag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ auto specificId = id.get<Parameter::Id::automaticGainControlV1Tag>();
+ auto specificIdTag = specificId.getTag();
+ switch (specificIdTag) {
+ case AutomaticGainControlV1::Id::commonTag:
+ return getParameterAutomaticGainControlV1(
+ specificId.get<AutomaticGainControlV1::Id::commonTag>(), specific);
+ default:
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV1TagNotSupported");
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV1Sw::getParameterAutomaticGainControlV1(
+ const AutomaticGainControlV1::Tag& tag, Parameter::Specific* specific) {
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+ AutomaticGainControlV1 param;
+ switch (tag) {
+ case AutomaticGainControlV1::targetPeakLevelDbFs: {
+ param.set<AutomaticGainControlV1::targetPeakLevelDbFs>(mContext->getTargetPeakLevel());
+ break;
+ }
+ case AutomaticGainControlV1::maxCompressionGainDb: {
+ param.set<AutomaticGainControlV1::maxCompressionGainDb>(
+ mContext->getMaxCompressionGain());
+ break;
+ }
+ case AutomaticGainControlV1::enableLimiter: {
+ param.set<AutomaticGainControlV1::enableLimiter>(mContext->getEnableLimiter());
+ break;
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV1TagNotSupported");
+ }
+ }
+
+ specific->set<Parameter::Specific::automaticGainControlV1>(param);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV1Sw::createContext(
+ const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ } else {
+ mContext =
+ std::make_shared<AutomaticGainControlV1SwContext>(1 /* statusFmqDepth */, common);
+ }
+ return mContext;
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV1Sw::getContext() {
+ return mContext;
+}
+
+RetCode AutomaticGainControlV1Sw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status AutomaticGainControlV1Sw::effectProcessImpl(float* in, float* out, int samples) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
+ for (int i = 0; i < samples; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, samples, samples};
+}
+
+RetCode AutomaticGainControlV1SwContext::setTargetPeakLevel(int targetPeakLevel) {
+ mTargetPeakLevel = targetPeakLevel;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV1SwContext::getTargetPeakLevel() {
+ return mTargetPeakLevel;
+}
+
+RetCode AutomaticGainControlV1SwContext::setMaxCompressionGain(int maxCompressionGain) {
+ mMaxCompressionGain = maxCompressionGain;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV1SwContext::getMaxCompressionGain() {
+ return mMaxCompressionGain;
+}
+
+RetCode AutomaticGainControlV1SwContext::setEnableLimiter(bool enableLimiter) {
+ mEnableLimiter = enableLimiter;
+ return RetCode::SUCCESS;
+}
+
+bool AutomaticGainControlV1SwContext::getEnableLimiter() {
+ return mEnableLimiter;
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h
new file mode 100644
index 0000000..6ba7328
--- /dev/null
+++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "effect-impl/EffectImpl.h"
+#include "effect-impl/EffectUUID.h"
+
+namespace aidl::android::hardware::audio::effect {
+
+class AutomaticGainControlV1SwContext final : public EffectContext {
+ public:
+ AutomaticGainControlV1SwContext(int statusDepth, const Parameter::Common& common)
+ : EffectContext(statusDepth, common) {
+ LOG(DEBUG) << __func__;
+ }
+
+ RetCode setTargetPeakLevel(int targetPeakLevel);
+ int getTargetPeakLevel();
+ RetCode setMaxCompressionGain(int maxCompressionGainDb);
+ int getMaxCompressionGain();
+ RetCode setEnableLimiter(bool enableLimiter);
+ bool getEnableLimiter();
+
+ private:
+ int mTargetPeakLevel = 0;
+ int mMaxCompressionGain = 0;
+ bool mEnableLimiter = false;
+};
+
+class AutomaticGainControlV1Sw final : public EffectImpl {
+ public:
+ static const std::string kEffectName;
+ static const bool kStrengthSupported;
+ static const Capability kCapability;
+ static const Descriptor kDescriptor;
+ AutomaticGainControlV1Sw() { LOG(DEBUG) << __func__; }
+ ~AutomaticGainControlV1Sw() {
+ cleanUp();
+ LOG(DEBUG) << __func__;
+ }
+
+ ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) override;
+
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
+ std::shared_ptr<EffectContext> getContext() override;
+ RetCode releaseContext() override;
+
+ std::string getEffectName() override { return kEffectName; };
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+
+ private:
+ static const std::vector<Range::AutomaticGainControlV1Range> kRanges;
+ std::shared_ptr<AutomaticGainControlV1SwContext> mContext;
+ ndk::ScopedAStatus getParameterAutomaticGainControlV1(const AutomaticGainControlV1::Tag& tag,
+ Parameter::Specific* specific);
+};
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/Android.bp b/audio/aidl/default/automaticGainControlV2/Android.bp
similarity index 95%
rename from audio/aidl/default/automaticGainControl/Android.bp
rename to audio/aidl/default/automaticGainControlV2/Android.bp
index 17d6416..631cf58 100644
--- a/audio/aidl/default/automaticGainControl/Android.bp
+++ b/audio/aidl/default/automaticGainControlV2/Android.bp
@@ -24,14 +24,14 @@
}
cc_library_shared {
- name: "libagcsw",
+ name: "libagc2sw",
defaults: [
"aidlaudioeffectservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_effect_ndk_shared",
],
srcs: [
- "AutomaticGainControlSw.cpp",
+ "AutomaticGainControlV2Sw.cpp",
":effectCommonFile",
],
relative_install_path: "soundfx",
diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
new file mode 100644
index 0000000..8441f22
--- /dev/null
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <algorithm>
+#include <cstddef>
+#include <memory>
+#define LOG_TAG "AHAL_AutomaticGainControlV2Sw"
+#include <Utils.h>
+#include <unordered_set>
+
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "AutomaticGainControlV2Sw.h"
+
+using aidl::android::hardware::audio::effect::AutomaticGainControlV2Sw;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV2SwImplUUID;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<AutomaticGainControlV2Sw>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
+ if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ *_aidl_return = AutomaticGainControlV2Sw::kDescriptor;
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+const std::string AutomaticGainControlV2Sw::kEffectName = "AutomaticGainControlV2Sw";
+
+const std::vector<Range::AutomaticGainControlV2Range> AutomaticGainControlV2Sw::kRanges = {
+ MAKE_RANGE(AutomaticGainControlV2, fixedDigitalGainMb, 0, 50000),
+ MAKE_RANGE(AutomaticGainControlV2, saturationMarginMb, 0, 10000)};
+
+const Capability AutomaticGainControlV2Sw::kCapability = {
+ .range = AutomaticGainControlV2Sw::kRanges};
+
+const Descriptor AutomaticGainControlV2Sw::kDescriptor = {
+ .common = {.id = {.type = kAutomaticGainControlV2TypeUUID,
+ .uuid = kAutomaticGainControlV2SwImplUUID,
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = AutomaticGainControlV2Sw::kEffectName,
+ .implementor = "The Android Open Source Project"},
+ .capability = AutomaticGainControlV2Sw::kCapability};
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::setParameterSpecific(
+ const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::automaticGainControlV2 != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ auto& param = specific.get<Parameter::Specific::automaticGainControlV2>();
+ RETURN_IF(!inRange(param, kRanges), EX_ILLEGAL_ARGUMENT, "outOfRange");
+ auto tag = param.getTag();
+ switch (tag) {
+ case AutomaticGainControlV2::fixedDigitalGainMb: {
+ RETURN_IF(mContext->setDigitalGain(
+ param.get<AutomaticGainControlV2::fixedDigitalGainMb>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "digitalGainNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV2::levelEstimator: {
+ RETURN_IF(mContext->setLevelEstimator(
+ param.get<AutomaticGainControlV2::levelEstimator>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "levelEstimatorNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ case AutomaticGainControlV2::saturationMarginMb: {
+ RETURN_IF(mContext->setSaturationMargin(
+ param.get<AutomaticGainControlV2::saturationMarginMb>()) !=
+ RetCode::SUCCESS,
+ EX_ILLEGAL_ARGUMENT, "saturationMarginNotSupported");
+ return ndk::ScopedAStatus::ok();
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV2TagNotSupported");
+ }
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::automaticGainControlV2Tag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ auto specificId = id.get<Parameter::Id::automaticGainControlV2Tag>();
+ auto specificIdTag = specificId.getTag();
+ switch (specificIdTag) {
+ case AutomaticGainControlV2::Id::commonTag:
+ return getParameterAutomaticGainControlV2(
+ specificId.get<AutomaticGainControlV2::Id::commonTag>(), specific);
+ default:
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV2TagNotSupported");
+ }
+}
+
+ndk::ScopedAStatus AutomaticGainControlV2Sw::getParameterAutomaticGainControlV2(
+ const AutomaticGainControlV2::Tag& tag, Parameter::Specific* specific) {
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+ AutomaticGainControlV2 param;
+ switch (tag) {
+ case AutomaticGainControlV2::fixedDigitalGainMb: {
+ param.set<AutomaticGainControlV2::fixedDigitalGainMb>(mContext->getDigitalGain());
+ break;
+ }
+ case AutomaticGainControlV2::levelEstimator: {
+ param.set<AutomaticGainControlV2::levelEstimator>(mContext->getLevelEstimator());
+ break;
+ }
+ case AutomaticGainControlV2::saturationMarginMb: {
+ param.set<AutomaticGainControlV2::saturationMarginMb>(mContext->getSaturationMargin());
+ break;
+ }
+ default: {
+ LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
+ EX_ILLEGAL_ARGUMENT, "AutomaticGainControlV2TagNotSupported");
+ }
+ }
+
+ specific->set<Parameter::Specific::automaticGainControlV2>(param);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV2Sw::createContext(
+ const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ } else {
+ mContext =
+ std::make_shared<AutomaticGainControlV2SwContext>(1 /* statusFmqDepth */, common);
+ }
+ return mContext;
+}
+
+std::shared_ptr<EffectContext> AutomaticGainControlV2Sw::getContext() {
+ return mContext;
+}
+
+RetCode AutomaticGainControlV2Sw::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status AutomaticGainControlV2Sw::effectProcessImpl(float* in, float* out, int samples) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
+ for (int i = 0; i < samples; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, samples, samples};
+}
+
+RetCode AutomaticGainControlV2SwContext::setDigitalGain(int gain) {
+ mDigitalGain = gain;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV2SwContext::getDigitalGain() {
+ return mDigitalGain;
+}
+
+RetCode AutomaticGainControlV2SwContext::setLevelEstimator(
+ AutomaticGainControlV2::LevelEstimator levelEstimator) {
+ mLevelEstimator = levelEstimator;
+ return RetCode::SUCCESS;
+}
+
+AutomaticGainControlV2::LevelEstimator AutomaticGainControlV2SwContext::getLevelEstimator() {
+ return mLevelEstimator;
+}
+
+RetCode AutomaticGainControlV2SwContext::setSaturationMargin(int margin) {
+ mSaturationMargin = margin;
+ return RetCode::SUCCESS;
+}
+
+int AutomaticGainControlV2SwContext::getSaturationMargin() {
+ return mSaturationMargin;
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
similarity index 70%
rename from audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
rename to audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
index 9327410..0b50f4d 100644
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
@@ -26,35 +26,35 @@
namespace aidl::android::hardware::audio::effect {
-class AutomaticGainControlSwContext final : public EffectContext {
+class AutomaticGainControlV2SwContext final : public EffectContext {
public:
- AutomaticGainControlSwContext(int statusDepth, const Parameter::Common& common)
+ AutomaticGainControlV2SwContext(int statusDepth, const Parameter::Common& common)
: EffectContext(statusDepth, common) {
LOG(DEBUG) << __func__;
}
RetCode setDigitalGain(int gain);
int getDigitalGain();
- RetCode setLevelEstimator(AutomaticGainControl::LevelEstimator levelEstimator);
- AutomaticGainControl::LevelEstimator getLevelEstimator();
+ RetCode setLevelEstimator(AutomaticGainControlV2::LevelEstimator levelEstimator);
+ AutomaticGainControlV2::LevelEstimator getLevelEstimator();
RetCode setSaturationMargin(int margin);
int getSaturationMargin();
private:
int mDigitalGain = 0;
- AutomaticGainControl::LevelEstimator mLevelEstimator =
- AutomaticGainControl::LevelEstimator::RMS;
+ AutomaticGainControlV2::LevelEstimator mLevelEstimator =
+ AutomaticGainControlV2::LevelEstimator::RMS;
int mSaturationMargin = 0;
};
-class AutomaticGainControlSw final : public EffectImpl {
+class AutomaticGainControlV2Sw final : public EffectImpl {
public:
static const std::string kEffectName;
static const bool kStrengthSupported;
static const Capability kCapability;
static const Descriptor kDescriptor;
- AutomaticGainControlSw() { LOG(DEBUG) << __func__; }
- ~AutomaticGainControlSw() {
+ AutomaticGainControlV2Sw() { LOG(DEBUG) << __func__; }
+ ~AutomaticGainControlV2Sw() {
cleanUp();
LOG(DEBUG) << __func__;
}
@@ -72,9 +72,9 @@
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
- static const std::vector<Range::AutomaticGainControlRange> kRanges;
- std::shared_ptr<AutomaticGainControlSwContext> mContext;
- ndk::ScopedAStatus getParameterAutomaticGainControl(const AutomaticGainControl::Tag& tag,
- Parameter::Specific* specific);
+ static const std::vector<Range::AutomaticGainControlV2Range> kRanges;
+ std::shared_ptr<AutomaticGainControlV2SwContext> mContext;
+ ndk::ScopedAStatus getParameterAutomaticGainControlV2(const AutomaticGainControlV2::Tag& tag,
+ Parameter::Specific* specific);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/Android.bp b/audio/aidl/default/extension/Android.bp
similarity index 91%
copy from audio/aidl/default/automaticGainControl/Android.bp
copy to audio/aidl/default/extension/Android.bp
index 17d6416..4e5d352 100644
--- a/audio/aidl/default/automaticGainControl/Android.bp
+++ b/audio/aidl/default/extension/Android.bp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,14 +24,14 @@
}
cc_library_shared {
- name: "libagcsw",
+ name: "libextensioneffect",
defaults: [
"aidlaudioeffectservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_effect_ndk_shared",
],
srcs: [
- "AutomaticGainControlSw.cpp",
+ "ExtensionEffect.cpp",
":effectCommonFile",
],
relative_install_path: "soundfx",
diff --git a/audio/aidl/default/extension/ExtensionEffect.cpp b/audio/aidl/default/extension/ExtensionEffect.cpp
new file mode 100644
index 0000000..d2e3ccd
--- /dev/null
+++ b/audio/aidl/default/extension/ExtensionEffect.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <algorithm>
+#include <cstddef>
+#include <memory>
+#include <unordered_set>
+
+#define LOG_TAG "AHAL_ExtensionEffect"
+#include <Utils.h>
+#include <aidl/android/hardware/audio/effect/DefaultExtension.h>
+#include <android-base/logging.h>
+#include <fmq/AidlMessageQueue.h>
+
+#include "ExtensionEffect.h"
+
+using aidl::android::hardware::audio::effect::DefaultExtension;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::ExtensionEffect;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kExtensionEffectImplUUID;
+using aidl::android::hardware::audio::effect::kExtensionEffectTypeUUID;
+using aidl::android::hardware::audio::effect::Range;
+using aidl::android::hardware::audio::effect::VendorExtension;
+using aidl::android::media::audio::common::AudioUuid;
+
+extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
+ std::shared_ptr<IEffect>* instanceSpp) {
+ if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ if (instanceSpp) {
+ *instanceSpp = ndk::SharedRefBase::make<ExtensionEffect>();
+ LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created";
+ return EX_NONE;
+ } else {
+ LOG(ERROR) << __func__ << " invalid input parameter!";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+}
+
+extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
+ if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) {
+ LOG(ERROR) << __func__ << "uuid not supported";
+ return EX_ILLEGAL_ARGUMENT;
+ }
+ *_aidl_return = ExtensionEffect::kDescriptor;
+ return EX_NONE;
+}
+
+namespace aidl::android::hardware::audio::effect {
+
+const std::string ExtensionEffect::kEffectName = "ExtensionEffectExample";
+
+const Descriptor ExtensionEffect::kDescriptor = {
+ .common = {.id = {.type = kExtensionEffectTypeUUID,
+ .uuid = kExtensionEffectImplUUID,
+ .proxy = std::nullopt},
+ .name = ExtensionEffect::kEffectName,
+ .implementor = "The Android Open Source Project"}};
+
+ndk::ScopedAStatus ExtensionEffect::getDescriptor(Descriptor* _aidl_return) {
+ LOG(DEBUG) << __func__ << kDescriptor.toString();
+ *_aidl_return = kDescriptor;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus ExtensionEffect::setParameterSpecific(const Parameter::Specific& specific) {
+ RETURN_IF(Parameter::Specific::vendorEffect != specific.getTag(), EX_ILLEGAL_ARGUMENT,
+ "EffectNotSupported");
+ RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
+
+ auto& vendorEffect = specific.get<Parameter::Specific::vendorEffect>();
+ std::optional<DefaultExtension> defaultExt;
+ RETURN_IF(STATUS_OK != vendorEffect.extension.getParcelable(&defaultExt), EX_ILLEGAL_ARGUMENT,
+ "getParcelableFailed");
+ RETURN_IF(!defaultExt.has_value(), EX_ILLEGAL_ARGUMENT, "parcelableNulld");
+ RETURN_IF(mContext->setParams(defaultExt->bytes) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT,
+ "paramNotSupported");
+
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus ExtensionEffect::getParameterSpecific(const Parameter::Id& id,
+ Parameter::Specific* specific) {
+ auto tag = id.getTag();
+ RETURN_IF(Parameter::Id::vendorEffectTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
+ auto specificId = id.get<Parameter::Id::vendorEffectTag>();
+ VendorExtension extension;
+ DefaultExtension defaultExt;
+ defaultExt.bytes = mContext->getParams(specificId);
+ RETURN_IF(STATUS_OK != extension.extension.setParcelable(defaultExt), EX_ILLEGAL_ARGUMENT,
+ "setParcelableFailed");
+ specific->set<Parameter::Specific::vendorEffect>(extension);
+ return ndk::ScopedAStatus::ok();
+}
+
+std::shared_ptr<EffectContext> ExtensionEffect::createContext(const Parameter::Common& common) {
+ if (mContext) {
+ LOG(DEBUG) << __func__ << " context already exist";
+ } else {
+ mContext = std::make_shared<ExtensionEffectContext>(1 /* statusFmqDepth */, common);
+ }
+ return mContext;
+}
+
+std::shared_ptr<EffectContext> ExtensionEffect::getContext() {
+ return mContext;
+}
+
+RetCode ExtensionEffect::releaseContext() {
+ if (mContext) {
+ mContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
+// Processing method running in EffectWorker thread.
+IEffect::Status ExtensionEffect::effectProcessImpl(float* in, float* out, int samples) {
+ // TODO: get data buffer and process.
+ LOG(DEBUG) << __func__ << " in " << in << " out " << out << " samples " << samples;
+ for (int i = 0; i < samples; i++) {
+ *out++ = *in++;
+ }
+ return {STATUS_OK, samples, samples};
+}
+
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h b/audio/aidl/default/extension/ExtensionEffect.h
similarity index 60%
copy from audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
copy to audio/aidl/default/extension/ExtensionEffect.h
index 9327410..399fa83 100644
--- a/audio/aidl/default/automaticGainControl/AutomaticGainControlSw.h
+++ b/audio/aidl/default/extension/ExtensionEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,43 +18,38 @@
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <fmq/AidlMessageQueue.h>
-#include <cstdlib>
#include <memory>
+#include <vector>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {
-class AutomaticGainControlSwContext final : public EffectContext {
+class ExtensionEffectContext final : public EffectContext {
public:
- AutomaticGainControlSwContext(int statusDepth, const Parameter::Common& common)
+ ExtensionEffectContext(int statusDepth, const Parameter::Common& common)
: EffectContext(statusDepth, common) {
LOG(DEBUG) << __func__;
}
- RetCode setDigitalGain(int gain);
- int getDigitalGain();
- RetCode setLevelEstimator(AutomaticGainControl::LevelEstimator levelEstimator);
- AutomaticGainControl::LevelEstimator getLevelEstimator();
- RetCode setSaturationMargin(int margin);
- int getSaturationMargin();
+ RetCode setParams(const std::vector<uint8_t>& params) {
+ mParams = params;
+ return RetCode::SUCCESS;
+ }
+ std::vector<uint8_t> getParams(int tag __unused) const { return mParams; }
private:
- int mDigitalGain = 0;
- AutomaticGainControl::LevelEstimator mLevelEstimator =
- AutomaticGainControl::LevelEstimator::RMS;
- int mSaturationMargin = 0;
+ std::vector<uint8_t> mParams;
};
-class AutomaticGainControlSw final : public EffectImpl {
+class ExtensionEffect final : public EffectImpl {
public:
static const std::string kEffectName;
- static const bool kStrengthSupported;
static const Capability kCapability;
static const Descriptor kDescriptor;
- AutomaticGainControlSw() { LOG(DEBUG) << __func__; }
- ~AutomaticGainControlSw() {
+ ExtensionEffect() { LOG(DEBUG) << __func__; }
+ ~ExtensionEffect() {
cleanUp();
LOG(DEBUG) << __func__;
}
@@ -72,9 +67,6 @@
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
- static const std::vector<Range::AutomaticGainControlRange> kRanges;
- std::shared_ptr<AutomaticGainControlSwContext> mContext;
- ndk::ScopedAStatus getParameterAutomaticGainControl(const AutomaticGainControl::Tag& tag,
- Parameter::Specific* specific);
+ std::shared_ptr<ExtensionEffectContext> mContext;
};
} // 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 7703091..267f6af 100644
--- a/audio/aidl/default/include/effect-impl/EffectUUID.h
+++ b/audio/aidl/default/include/effect-impl/EffectUUID.h
@@ -45,18 +45,30 @@
0x11e0,
0xa896,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
-// 0xae3c653b-be18-4ab8-8938-418f0a7f06ac
-static const AudioUuid kAutomaticGainControlTypeUUID = {static_cast<int32_t>(0xae3c653b),
- 0xbe18,
- 0x4ab8,
- 0x8938,
- {0x41, 0x8f, 0x0a, 0x7f, 0x06, 0xac}};
+// 0a8abfe0-654c-11e0-ba26-0002a5d5c51b
+static const AudioUuid kAutomaticGainControlV1TypeUUID = {static_cast<int32_t>(0x0a8abfe0),
+ 0x654c,
+ 0x11e0,
+ 0xba26,
+ {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+// aa8130e0-66fc-11e0-bad0-0002a5d5c51b
+static const AudioUuid kAutomaticGainControlV1SwImplUUID = {static_cast<int32_t>(0xaa8130e0),
+ 0x66fc,
+ 0x11e0,
+ 0xbad0,
+ {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+// ae3c653b-be18-4ab8-8938-418f0a7f06ac
+static const AudioUuid kAutomaticGainControlV2TypeUUID = {static_cast<int32_t>(0xae3c653b),
+ 0xbe18,
+ 0x4ab8,
+ 0x8938,
+ {0x41, 0x8f, 0x0a, 0x7f, 0x06, 0xac}};
// 89f38e65-d4d2-4d64-ad0e-2b3e799ea886
-static const AudioUuid kAutomaticGainControlSwImplUUID = {static_cast<int32_t>(0x89f38e65),
- 0xd4d2,
- 0x4d64,
- 0xad0e,
- {0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86}};
+static const AudioUuid kAutomaticGainControlV2SwImplUUID = {static_cast<int32_t>(0x89f38e65),
+ 0xd4d2,
+ 0x4d64,
+ 0xad0e,
+ {0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86}};
// 0634f220-ddd4-11db-a0fc-0002a5d5c51b
static const AudioUuid kBassBoostTypeUUID = {static_cast<int32_t>(0x0634f220),
0xddd4,
@@ -81,12 +93,12 @@
0x4d24,
0xaa88,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
-// fa81862a-588b-11ed-9b6a-0242ac120002
-static const AudioUuid kDownmixTypeUUID = {static_cast<int32_t>(0xfa81862a),
- 0x588b,
- 0x11ed,
- 0x9b6a,
- {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// 381e49cc-a858-4aa2-87f6-e8388e7601b2
+static const AudioUuid kDownmixTypeUUID = {static_cast<int32_t>(0x381e49cc),
+ 0xa858,
+ 0x4aa2,
+ 0x87f6,
+ {0xe8, 0x38, 0x8e, 0x76, 0x01, 0xb2}};
// fa8187ba-588b-11ed-9b6a-0242ac120002
static const AudioUuid kDownmixSwImplUUID = {static_cast<int32_t>(0xfa8187ba),
0x588b,
@@ -299,6 +311,18 @@
0x81f9,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+// fa81dbde-588b-11ed-9b6a-0242ac120002
+static const AudioUuid kExtensionEffectTypeUUID = {static_cast<int32_t>(0xfa81dbde),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
+// fa81dd00-588b-11ed-9b6a-0242ac120002
+static const AudioUuid kExtensionEffectImplUUID = {static_cast<int32_t>(0xfa81dd00),
+ 0x588b,
+ 0x11ed,
+ 0x9b6a,
+ {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
/**
* @brief A map between effect name and effect type UUID.
* All <name> attribution in effect/effectProxy of audio_effects.xml should be listed in this map.
@@ -306,11 +330,13 @@
*/
static const std::map<const std::string /* effect type */, const AudioUuid&> kUuidNameTypeMap = {
{"acoustic_echo_canceler", kAcousticEchoCancelerTypeUUID},
- {"automatic_gain_control", kAutomaticGainControlTypeUUID},
+ {"automatic_gain_control_v1", kAutomaticGainControlV1TypeUUID},
+ {"automatic_gain_control_v2", kAutomaticGainControlV2TypeUUID},
{"bassboost", kBassBoostTypeUUID},
{"downmix", kDownmixTypeUUID},
{"dynamics_processing", kDynamicsProcessingTypeUUID},
{"equalizer", kEqualizerTypeUUID},
+ {"extensioneffect", kExtensionEffectTypeUUID},
{"haptic_generator", kHapticGeneratorTypeUUID},
{"loudness_enhancer", kLoudnessEnhancerTypeUUID},
{"env_reverb", kEnvReverbTypeUUID},
diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp
index f9d12dd..8db8eaf 100644
--- a/audio/aidl/vts/Android.bp
+++ b/audio/aidl/vts/Android.bp
@@ -141,9 +141,15 @@
}
cc_test {
- name: "VtsHalAGCTargetTest",
+ name: "VtsHalAGC1TargetTest",
defaults: ["VtsHalAudioTargetTestDefaults"],
- srcs: ["VtsHalAGCTargetTest.cpp"],
+ srcs: ["VtsHalAGC1TargetTest.cpp"],
+}
+
+cc_test {
+ name: "VtsHalAGC2TargetTest",
+ defaults: ["VtsHalAudioTargetTestDefaults"],
+ srcs: ["VtsHalAGC2TargetTest.cpp"],
}
cc_test {
diff --git a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
new file mode 100644
index 0000000..a6fc1aa
--- /dev/null
+++ b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Utils.h>
+#include <aidl/Vintf.h>
+
+#define LOG_TAG "VtsHalAGC1ParamTest"
+
+#include "EffectHelper.h"
+
+using namespace android;
+
+using aidl::android::hardware::audio::effect::AutomaticGainControlV1;
+using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::IFactory;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV1TypeUUID;
+using aidl::android::hardware::audio::effect::Parameter;
+
+enum ParamName {
+ PARAM_INSTANCE_NAME,
+ PARAM_TARGET_PEAK_LEVEL,
+ PARAM_MAX_COMPRESSION_GAIN,
+ PARAM_ENABLE_LIMITER
+};
+using AGC1ParamTestParam =
+ std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int /* targetPeakLevel */,
+ int /* maxCompressionGain */, bool /* enableLimiter */>;
+
+class AGC1ParamTest : public ::testing::TestWithParam<AGC1ParamTestParam>, public EffectHelper {
+ public:
+ AGC1ParamTest()
+ : mTargetPeakLevel(std::get<PARAM_TARGET_PEAK_LEVEL>(GetParam())),
+ mMaxCompressionGain(std::get<PARAM_MAX_COMPRESSION_GAIN>(GetParam())),
+ mEnableLimiter(std::get<PARAM_ENABLE_LIMITER>(GetParam())) {
+ std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
+ }
+
+ void SetUp() override {
+ ASSERT_NE(nullptr, mFactory);
+ ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
+
+ Parameter::Specific specific = getDefaultParamSpecific();
+ Parameter::Common common = EffectHelper::createParamCommon(
+ 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
+ kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
+ IEffect::OpenEffectReturn ret;
+ ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
+ ASSERT_NE(nullptr, mEffect);
+ }
+
+ void TearDown() override {
+ ASSERT_NO_FATAL_FAILURE(close(mEffect));
+ ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
+ }
+
+ Parameter::Specific getDefaultParamSpecific() {
+ AutomaticGainControlV1 AGC1 =
+ AutomaticGainControlV1::make<AutomaticGainControlV1::targetPeakLevelDbFs>(0);
+ Parameter::Specific specific =
+ Parameter::Specific::make<Parameter::Specific::automaticGainControlV1>(AGC1);
+ return specific;
+ }
+
+ static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
+ std::shared_ptr<IFactory> mFactory;
+ std::shared_ptr<IEffect> mEffect;
+ Descriptor mDescriptor;
+ int mTargetPeakLevel;
+ int mMaxCompressionGain;
+ bool mEnableLimiter;
+
+ void SetAndGetParameters() {
+ for (auto& it : mTags) {
+ auto& tag = it.first;
+ auto& AGC1 = it.second;
+
+ // validate parameter
+ Descriptor desc;
+ ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
+ const bool valid =
+ isParameterValid<AutomaticGainControlV1, Range::automaticGainControlV1>(AGC1,
+ desc);
+ const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
+
+ // set parameter
+ Parameter expectParam;
+ Parameter::Specific specific;
+ specific.set<Parameter::Specific::automaticGainControlV1>(AGC1);
+ expectParam.set<Parameter::specific>(specific);
+ EXPECT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString();
+
+ // only get if parameter in range and set success
+ if (expected == EX_NONE) {
+ Parameter getParam;
+ Parameter::Id id;
+ AutomaticGainControlV1::Id specificId;
+ specificId.set<AutomaticGainControlV1::Id::commonTag>(tag);
+ id.set<Parameter::Id::automaticGainControlV1Tag>(specificId);
+ EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
+
+ EXPECT_EQ(expectParam, getParam) << "\nexpect:" << expectParam.toString()
+ << "\ngetParam:" << getParam.toString();
+ }
+ }
+ }
+
+ void addTargetPeakLevelParam(int targetPeakLevel) {
+ AutomaticGainControlV1 AGC1;
+ AGC1.set<AutomaticGainControlV1::targetPeakLevelDbFs>(targetPeakLevel);
+ mTags.push_back({AutomaticGainControlV1::targetPeakLevelDbFs, AGC1});
+ }
+ void addMaxCompressionGainParam(int maxCompressionGainDb) {
+ AutomaticGainControlV1 AGC1;
+ AGC1.set<AutomaticGainControlV1::maxCompressionGainDb>(maxCompressionGainDb);
+ mTags.push_back({AutomaticGainControlV1::maxCompressionGainDb, AGC1});
+ }
+ void addEnableLimiterParam(bool enableLimiter) {
+ AutomaticGainControlV1 AGC1;
+ AGC1.set<AutomaticGainControlV1::enableLimiter>(enableLimiter);
+ mTags.push_back({AutomaticGainControlV1::enableLimiter, AGC1});
+ }
+
+ private:
+ std::vector<std::pair<AutomaticGainControlV1::Tag, AutomaticGainControlV1>> mTags;
+ void CleanUp() { mTags.clear(); }
+};
+
+TEST_P(AGC1ParamTest, SetAndGetTargetPeakLevelParam) {
+ EXPECT_NO_FATAL_FAILURE(addTargetPeakLevelParam(mTargetPeakLevel));
+ SetAndGetParameters();
+}
+
+TEST_P(AGC1ParamTest, SetAndGetMaxCompressionGain) {
+ EXPECT_NO_FATAL_FAILURE(addMaxCompressionGainParam(mMaxCompressionGain));
+ SetAndGetParameters();
+}
+
+TEST_P(AGC1ParamTest, SetAndGetEnableLimiter) {
+ EXPECT_NO_FATAL_FAILURE(addEnableLimiterParam(mEnableLimiter));
+ SetAndGetParameters();
+}
+
+std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
+INSTANTIATE_TEST_SUITE_P(
+ AGC1ParamTest, AGC1ParamTest,
+ ::testing::Combine(
+ testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, kAutomaticGainControlV1TypeUUID)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControlV1, int, Range::automaticGainControlV1,
+ AutomaticGainControlV1::targetPeakLevelDbFs>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::ValuesIn(EffectHelper::getTestValueSet<
+ AutomaticGainControlV1, int, Range::automaticGainControlV1,
+ AutomaticGainControlV1::maxCompressionGainDb>(
+ kDescPair, EffectHelper::expandTestValueBasic<int>)),
+ testing::Bool()),
+ [](const testing::TestParamInfo<AGC1ParamTest::ParamType>& info) {
+ auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
+ std::string targetPeakLevel =
+ std::to_string(std::get<PARAM_TARGET_PEAK_LEVEL>(info.param));
+ std::string maxCompressionGain =
+ std::to_string(std::get<PARAM_MAX_COMPRESSION_GAIN>(info.param));
+ std::string enableLimiter = std::to_string(std::get<PARAM_ENABLE_LIMITER>(info.param));
+
+ std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
+ descriptor.common.name + "_UUID_" +
+ descriptor.common.id.uuid.toString() + "_target_peak_level_" +
+ targetPeakLevel + "_max_compression_gain_" + maxCompressionGain +
+ "_enable_limiter_" + enableLimiter;
+ std::replace_if(
+ name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
+ return name;
+ });
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AGC1ParamTest);
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/audio/aidl/vts/VtsHalAGCTargetTest.cpp b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
similarity index 69%
rename from audio/aidl/vts/VtsHalAGCTargetTest.cpp
rename to audio/aidl/vts/VtsHalAGC2TargetTest.cpp
index 974c2e7..fd3a866 100644
--- a/audio/aidl/vts/VtsHalAGCTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
@@ -19,17 +19,17 @@
#include <android/binder_enums.h>
#include <unordered_set>
-#define LOG_TAG "VtsHalAGCParamTest"
+#define LOG_TAG "VtsHalAGC2ParamTest"
#include "EffectHelper.h"
using namespace android;
-using aidl::android::hardware::audio::effect::AutomaticGainControl;
+using aidl::android::hardware::audio::effect::AutomaticGainControlV2;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
-using aidl::android::hardware::audio::effect::kAutomaticGainControlTypeUUID;
+using aidl::android::hardware::audio::effect::kAutomaticGainControlV2TypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
enum ParamName {
@@ -38,13 +38,13 @@
PARAM_SATURATION_MARGIN,
PARAM_LEVEL_ESTIMATOR
};
-using AGCParamTestParam =
+using AGC2ParamTestParam =
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int /* gain */,
- int /* margin */, AutomaticGainControl::LevelEstimator>;
+ int /* margin */, AutomaticGainControlV2::LevelEstimator>;
-class AGCParamTest : public ::testing::TestWithParam<AGCParamTestParam>, public EffectHelper {
+class AGC2ParamTest : public ::testing::TestWithParam<AGC2ParamTestParam>, public EffectHelper {
public:
- AGCParamTest()
+ AGC2ParamTest()
: mGain(std::get<PARAM_DIGITAL_GAIN>(GetParam())),
mMargin(std::get<PARAM_SATURATION_MARGIN>(GetParam())),
mLevelEstimator(std::get<PARAM_LEVEL_ESTIMATOR>(GetParam())) {
@@ -70,10 +70,10 @@
}
Parameter::Specific getDefaultParamSpecific() {
- AutomaticGainControl AGC =
- AutomaticGainControl::make<AutomaticGainControl::fixedDigitalGainMb>(0);
+ AutomaticGainControlV2 AGC2 =
+ AutomaticGainControlV2::make<AutomaticGainControlV2::fixedDigitalGainMb>(0);
Parameter::Specific specific =
- Parameter::Specific::make<Parameter::Specific::automaticGainControl>(AGC);
+ Parameter::Specific::make<Parameter::Specific::automaticGainControlV2>(AGC2);
return specific;
}
@@ -83,24 +83,25 @@
Descriptor mDescriptor;
int mGain;
int mMargin;
- AutomaticGainControl::LevelEstimator mLevelEstimator;
+ AutomaticGainControlV2::LevelEstimator mLevelEstimator;
void SetAndGetParameters() {
for (auto& it : mTags) {
auto& tag = it.first;
- auto& AGC = it.second;
+ auto& AGC2 = it.second;
// validate parameter
Descriptor desc;
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
const bool valid =
- isParameterValid<AutomaticGainControl, Range::automaticGainControl>(AGC, desc);
+ isParameterValid<AutomaticGainControlV2, Range::automaticGainControlV2>(AGC2,
+ desc);
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
// set parameter
Parameter expectParam;
Parameter::Specific specific;
- specific.set<Parameter::Specific::automaticGainControl>(AGC);
+ specific.set<Parameter::Specific::automaticGainControlV2>(AGC2);
expectParam.set<Parameter::specific>(specific);
EXPECT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString();
@@ -108,9 +109,9 @@
if (expected == EX_NONE) {
Parameter getParam;
Parameter::Id id;
- AutomaticGainControl::Id specificId;
- specificId.set<AutomaticGainControl::Id::commonTag>(tag);
- id.set<Parameter::Id::automaticGainControlTag>(specificId);
+ AutomaticGainControlV2::Id specificId;
+ specificId.set<AutomaticGainControlV2::Id::commonTag>(tag);
+ id.set<Parameter::Id::automaticGainControlV2Tag>(specificId);
EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
EXPECT_EQ(expectParam, getParam) << "\nexpect:" << expectParam.toString()
@@ -120,62 +121,62 @@
}
void addDigitalGainParam(int gain) {
- AutomaticGainControl AGC;
- AGC.set<AutomaticGainControl::fixedDigitalGainMb>(gain);
- mTags.push_back({AutomaticGainControl::fixedDigitalGainMb, AGC});
+ AutomaticGainControlV2 AGC2;
+ AGC2.set<AutomaticGainControlV2::fixedDigitalGainMb>(gain);
+ mTags.push_back({AutomaticGainControlV2::fixedDigitalGainMb, AGC2});
}
void addSaturationMarginParam(int margin) {
- AutomaticGainControl AGC;
- AGC.set<AutomaticGainControl::saturationMarginMb>(margin);
- mTags.push_back({AutomaticGainControl::saturationMarginMb, AGC});
+ AutomaticGainControlV2 AGC2;
+ AGC2.set<AutomaticGainControlV2::saturationMarginMb>(margin);
+ mTags.push_back({AutomaticGainControlV2::saturationMarginMb, AGC2});
}
- void addLevelEstimatorParam(AutomaticGainControl::LevelEstimator levelEstimator) {
- AutomaticGainControl AGC;
- AGC.set<AutomaticGainControl::levelEstimator>(levelEstimator);
- mTags.push_back({AutomaticGainControl::levelEstimator, AGC});
+ void addLevelEstimatorParam(AutomaticGainControlV2::LevelEstimator levelEstimator) {
+ AutomaticGainControlV2 AGC2;
+ AGC2.set<AutomaticGainControlV2::levelEstimator>(levelEstimator);
+ mTags.push_back({AutomaticGainControlV2::levelEstimator, AGC2});
}
- static std::set<AutomaticGainControl::LevelEstimator> getLevelEstimatorValues() {
- return {ndk::enum_range<AutomaticGainControl::LevelEstimator>().begin(),
- ndk::enum_range<AutomaticGainControl::LevelEstimator>().end()};
+ static std::set<AutomaticGainControlV2::LevelEstimator> getLevelEstimatorValues() {
+ return {ndk::enum_range<AutomaticGainControlV2::LevelEstimator>().begin(),
+ ndk::enum_range<AutomaticGainControlV2::LevelEstimator>().end()};
}
private:
- std::vector<std::pair<AutomaticGainControl::Tag, AutomaticGainControl>> mTags;
+ std::vector<std::pair<AutomaticGainControlV2::Tag, AutomaticGainControlV2>> mTags;
void CleanUp() { mTags.clear(); }
};
-TEST_P(AGCParamTest, SetAndGetDigitalGainParam) {
+TEST_P(AGC2ParamTest, SetAndGetDigitalGainParam) {
EXPECT_NO_FATAL_FAILURE(addDigitalGainParam(mGain));
SetAndGetParameters();
}
-TEST_P(AGCParamTest, SetAndGetSaturationMargin) {
+TEST_P(AGC2ParamTest, SetAndGetSaturationMargin) {
EXPECT_NO_FATAL_FAILURE(addSaturationMarginParam(mMargin));
SetAndGetParameters();
}
-TEST_P(AGCParamTest, SetAndGetLevelEstimator) {
+TEST_P(AGC2ParamTest, SetAndGetLevelEstimator) {
EXPECT_NO_FATAL_FAILURE(addLevelEstimatorParam(mLevelEstimator));
SetAndGetParameters();
}
std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
INSTANTIATE_TEST_SUITE_P(
- AGCParamTest, AGCParamTest,
+ AGC2ParamTest, AGC2ParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, kAutomaticGainControlTypeUUID)),
+ IFactory::descriptor, kAutomaticGainControlV2TypeUUID)),
testing::ValuesIn(EffectHelper::getTestValueSet<
- AutomaticGainControl, int, Range::automaticGainControl,
- AutomaticGainControl::fixedDigitalGainMb>(
+ AutomaticGainControlV2, int, Range::automaticGainControlV2,
+ AutomaticGainControlV2::fixedDigitalGainMb>(
kDescPair, EffectHelper::expandTestValueBasic<int>)),
testing::ValuesIn(EffectHelper::getTestValueSet<
- AutomaticGainControl, int, Range::automaticGainControl,
- AutomaticGainControl::saturationMarginMb>(
+ AutomaticGainControlV2, int, Range::automaticGainControlV2,
+ AutomaticGainControlV2::saturationMarginMb>(
kDescPair, EffectHelper::expandTestValueBasic<int>)),
- testing::ValuesIn(AGCParamTest::getLevelEstimatorValues())),
- [](const testing::TestParamInfo<AGCParamTest::ParamType>& info) {
+ testing::ValuesIn(AGC2ParamTest::getLevelEstimatorValues())),
+ [](const testing::TestParamInfo<AGC2ParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
std::string gain = std::to_string(std::get<PARAM_DIGITAL_GAIN>(info.param));
std::string estimator = aidl::android::hardware::audio::effect::toString(
@@ -192,7 +193,7 @@
return name;
});
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AGCParamTest);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AGC2ParamTest);
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp
index e79ad75..7b5a932 100644
--- a/audio/common/all-versions/default/service/service.cpp
+++ b/audio/common/all-versions/default/service/service.cpp
@@ -81,9 +81,10 @@
int main(int /* argc */, char* /* argv */ []) {
signal(SIGPIPE, SIG_IGN);
- ::android::ProcessState::initWithDriver("/dev/vndbinder");
- // start a threadpool for vndbinder interactions
- ::android::ProcessState::self()->startThreadPool();
+ if (::android::ProcessState::isVndservicemanagerEnabled()) {
+ ::android::ProcessState::initWithDriver("/dev/vndbinder");
+ ::android::ProcessState::self()->startThreadPool();
+ }
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
index 1d2d910..d4ab0f7 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
@@ -179,6 +179,7 @@
{VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ},
{VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE},
@@ -264,7 +265,11 @@
{VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ},
{VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE},
{VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ},
{VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess::READ},
};
} // namespace vehicle
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
index 613636e..d56de3f 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
@@ -179,6 +179,7 @@
{VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE},
@@ -264,7 +265,11 @@
{VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode::ON_CHANGE},
};
} // namespace vehicle
diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
index f83f1c2..caeb266 100644
--- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
@@ -171,6 +171,7 @@
Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE),
@@ -256,7 +257,11 @@
Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE),
- Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE)
+ Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess.READ)
);
}
diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
index f0642fe..0beab94 100644
--- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
@@ -171,6 +171,7 @@
Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE),
@@ -256,7 +257,11 @@
Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
- Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE)
+ Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode.ON_CHANGE)
);
}
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
index 7531589..ff601e0 100644
--- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
@@ -41,6 +41,8 @@
using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand;
using ::aidl::android::hardware::automotive::vehicle::CruiseControlState;
using ::aidl::android::hardware::automotive::vehicle::CruiseControlType;
+using ::aidl::android::hardware::automotive::vehicle::DriverAttentionMonitoringState;
+using ::aidl::android::hardware::automotive::vehicle::DriverAttentionMonitoringWarning;
using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState;
using ::aidl::android::hardware::automotive::vehicle::ErrorState;
using ::aidl::android::hardware::automotive::vehicle::EvConnectorType;
@@ -49,6 +51,8 @@
using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState;
using ::aidl::android::hardware::automotive::vehicle::FuelType;
using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType;
+using ::aidl::android::hardware::automotive::vehicle::HandsOnDetectionDriverState;
+using ::aidl::android::hardware::automotive::vehicle::HandsOnDetectionWarning;
using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand;
using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState;
using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState;
@@ -72,6 +76,7 @@
using ::aidl::android::hardware::automotive::vehicle::VehicleUnit;
using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission;
using ::aidl::android::hardware::automotive::vehicle::WindshieldWipersState;
+using ::aidl::android::hardware::automotive::vehicle::WindshieldWipersSwitch;
using ::android::base::Error;
using ::android::base::Result;
@@ -222,6 +227,8 @@
mConstantParsersByType["FuelType"] = std::make_unique<ConstantParser<FuelType>>();
mConstantParsersByType["WindshieldWipersState"] =
std::make_unique<ConstantParser<WindshieldWipersState>>();
+ mConstantParsersByType["WindshieldWipersSwitch"] =
+ std::make_unique<ConstantParser<WindshieldWipersSwitch>>();
mConstantParsersByType["EmergencyLaneKeepAssistState"] =
std::make_unique<ConstantParser<EmergencyLaneKeepAssistState>>();
mConstantParsersByType["CruiseControlType"] =
@@ -230,6 +237,14 @@
std::make_unique<ConstantParser<CruiseControlState>>();
mConstantParsersByType["CruiseControlCommand"] =
std::make_unique<ConstantParser<CruiseControlCommand>>();
+ mConstantParsersByType["HandsOnDetectionDriverState"] =
+ std::make_unique<ConstantParser<HandsOnDetectionDriverState>>();
+ mConstantParsersByType["HandsOnDetectionWarning"] =
+ std::make_unique<ConstantParser<HandsOnDetectionWarning>>();
+ mConstantParsersByType["DriverAttentionMonitoringState"] =
+ std::make_unique<ConstantParser<DriverAttentionMonitoringState>>();
+ mConstantParsersByType["DriverAttentionMonitoringWarning"] =
+ std::make_unique<ConstantParser<DriverAttentionMonitoringWarning>>();
mConstantParsersByType["ErrorState"] = std::make_unique<ConstantParser<ErrorState>>();
mConstantParsersByType["AutomaticEmergencyBrakingState"] =
std::make_unique<ConstantParser<AutomaticEmergencyBrakingState>>();
diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
index a0e8115..85a7486 100644
--- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
+++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
@@ -2694,6 +2694,47 @@
]
},
{
+ "property": "VehicleProperty::WINDSHIELD_WIPERS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "WindshieldWipersSwitch::OFF"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD",
+ "supportedEnumValues": [
+ "WindshieldWipersSwitch::OFF",
+ "WindshieldWipersSwitch::MIST",
+ "WindshieldWipersSwitch::INTERMITTENT_LEVEL_1",
+ "WindshieldWipersSwitch::INTERMITTENT_LEVEL_2",
+ "WindshieldWipersSwitch::INTERMITTENT_LEVEL_3",
+ "WindshieldWipersSwitch::INTERMITTENT_LEVEL_4",
+ "WindshieldWipersSwitch::INTERMITTENT_LEVEL_5",
+ "WindshieldWipersSwitch::CONTINUOUS_LEVEL_1",
+ "WindshieldWipersSwitch::CONTINUOUS_LEVEL_2",
+ "WindshieldWipersSwitch::CONTINUOUS_LEVEL_3",
+ "WindshieldWipersSwitch::CONTINUOUS_LEVEL_4",
+ "WindshieldWipersSwitch::CONTINUOUS_LEVEL_5",
+ "WindshieldWipersSwitch::AUTO",
+ "WindshieldWipersSwitch::SERVICE"
+ ]
+ },
+ {
+ "areaId": "VehicleAreaWindow::REAR_WINDSHIELD",
+ "supportedEnumValues": [
+ "WindshieldWipersSwitch::OFF",
+ "WindshieldWipersSwitch::INTERMITTENT_LEVEL_1",
+ "WindshieldWipersSwitch::INTERMITTENT_LEVEL_2",
+ "WindshieldWipersSwitch::CONTINUOUS_LEVEL_1",
+ "WindshieldWipersSwitch::CONTINUOUS_LEVEL_2",
+ "WindshieldWipersSwitch::AUTO",
+ "WindshieldWipersSwitch::SERVICE"
+ ]
+ }
+ ]
+ },
+ {
"property": "VehicleProperty::STEERING_WHEEL_DEPTH_POS",
"defaultValue": {
"int32Values": [
@@ -3216,6 +3257,42 @@
}
},
{
+ "property": "VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "HandsOnDetectionDriverState::HANDS_ON"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "ErrorState::NOT_AVAILABLE_DISABLED",
+ "HandsOnDetectionDriverState::HANDS_ON",
+ "HandsOnDetectionDriverState::HANDS_OFF"
+ ]
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HANDS_ON_DETECTION_WARNING",
+ "defaultValue": {
+ "int32Values": [
+ "HandsOnDetectionWarning::NO_WARNING"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "ErrorState::NOT_AVAILABLE_DISABLED",
+ "HandsOnDetectionWarning::NO_WARNING",
+ "HandsOnDetectionWarning::WARNING"
+ ]
+ }
+ ]
+ },
+ {
"property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED",
"defaultValue": {
"int32Values": [
@@ -3224,6 +3301,42 @@
}
},
{
+ "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "DriverAttentionMonitoringState::NOT_DISTRACTED"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "ErrorState::NOT_AVAILABLE_DISABLED",
+ "DriverAttentionMonitoringState::DISTRACTED",
+ "DriverAttentionMonitoringState::NOT_DISTRACTED"
+ ]
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING",
+ "defaultValue": {
+ "int32Values": [
+ "DriverAttentionMonitoringWarning::NO_WARNING"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "supportedEnumValues": [
+ "ErrorState::NOT_AVAILABLE_DISABLED",
+ "DriverAttentionMonitoringWarning::NO_WARNING",
+ "DriverAttentionMonitoringWarning::WARNING"
+ ]
+ }
+ ]
+ },
+ {
"property": "VehicleProperty::INITIAL_USER_INFO"
},
{
diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md
index 093b13d..6e82de5 100644
--- a/automotive/vehicle/aidl/impl/default_config/config/README.md
+++ b/automotive/vehicle/aidl/impl/default_config/config/README.md
@@ -159,6 +159,8 @@
* WindshieldWipersState
+* WindshieldWipersSwitch
+
* Constants
Every constant type except "Constants" corresponds to a enum defined in Vehicle
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
index 3b26aa6..fc0c8db 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
@@ -24,6 +24,8 @@
#include <aidl/android/hardware/automotive/vehicle/CruiseControlType.h>
#include <aidl/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.h>
#include <aidl/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.h>
+#include <aidl/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.h>
+#include <aidl/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.h>
#include <aidl/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.h>
#include <aidl/android/hardware/automotive/vehicle/ErrorState.h>
#include <aidl/android/hardware/automotive/vehicle/EvConnectorType.h>
@@ -36,6 +38,8 @@
#include <aidl/android/hardware/automotive/vehicle/GetValueResult.h>
#include <aidl/android/hardware/automotive/vehicle/GetValueResults.h>
#include <aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.h>
+#include <aidl/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.h>
+#include <aidl/android/hardware/automotive/vehicle/HandsOnDetectionWarning.h>
#include <aidl/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.h>
#include <aidl/android/hardware/automotive/vehicle/LaneCenteringAssistState.h>
#include <aidl/android/hardware/automotive/vehicle/LaneDepartureWarningState.h>
@@ -81,5 +85,6 @@
#include <aidl/android/hardware/automotive/vehicle/VehicleUnit.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleVendorPermission.h>
#include <aidl/android/hardware/automotive/vehicle/WindshieldWipersState.h>
+#include <aidl/android/hardware/automotive/vehicle/WindshieldWipersSwitch.h>
#endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl
similarity index 74%
copy from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
copy to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl
index f3dd523..925f447 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,21 +31,10 @@
// 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 AutomaticGainControl {
- android.hardware.audio.effect.VendorExtension vendor;
- int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
- int saturationMarginMb;
- @VintfStability
- union Id {
- int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @Backing(type="int") @VintfStability
- enum LevelEstimator {
- RMS = 0,
- PEAK = 1,
- }
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum DriverAttentionMonitoringState {
+ OTHER = 0,
+ DISTRACTED = 1,
+ NOT_DISTRACTED = 2,
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl
similarity index 74%
copy from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
copy to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl
index f3dd523..758b251 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,21 +31,10 @@
// 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 AutomaticGainControl {
- android.hardware.audio.effect.VendorExtension vendor;
- int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
- int saturationMarginMb;
- @VintfStability
- union Id {
- int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @Backing(type="int") @VintfStability
- enum LevelEstimator {
- RMS = 0,
- PEAK = 1,
- }
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum DriverAttentionMonitoringWarning {
+ OTHER = 0,
+ NO_WARNING = 1,
+ WARNING = 2,
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl
similarity index 74%
copy from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
copy to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl
index f3dd523..bb390f2 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,21 +31,10 @@
// 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 AutomaticGainControl {
- android.hardware.audio.effect.VendorExtension vendor;
- int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
- int saturationMarginMb;
- @VintfStability
- union Id {
- int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @Backing(type="int") @VintfStability
- enum LevelEstimator {
- RMS = 0,
- PEAK = 1,
- }
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum HandsOnDetectionDriverState {
+ OTHER = 0,
+ HANDS_ON = 1,
+ HANDS_OFF = 2,
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl
similarity index 74%
copy from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
copy to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl
index f3dd523..4ea4d1d 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,21 +31,10 @@
// 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 AutomaticGainControl {
- android.hardware.audio.effect.VendorExtension vendor;
- int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
- int saturationMarginMb;
- @VintfStability
- union Id {
- int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @Backing(type="int") @VintfStability
- enum LevelEstimator {
- RMS = 0,
- PEAK = 1,
- }
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum HandsOnDetectionWarning {
+ OTHER = 0,
+ NO_WARNING = 1,
+ WARNING = 2,
}
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
index bbec4bf..cc06bf3 100644
--- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -177,6 +177,7 @@
WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000) /* 320867268 */,
WINDSHIELD_WIPERS_PERIOD = (((0x0BC5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964421 */,
WINDSHIELD_WIPERS_STATE = (((0x0BC6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964422 */,
+ WINDSHIELD_WIPERS_SWITCH = (((0x0BC7 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964423 */,
STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410016 */,
STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410017 */,
STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410018 */,
@@ -262,5 +263,9 @@
CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */,
CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */,
HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */,
+ HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */,
+ HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */,
DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */,
+ DRIVER_ATTENTION_MONITORING_STATE = (((0x101A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411098 */,
+ DRIVER_ATTENTION_MONITORING_WARNING = (((0x101B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411099 */,
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl
similarity index 74%
copy from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
copy to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl
index f3dd523..6c170fe 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,21 +31,22 @@
// 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 AutomaticGainControl {
- android.hardware.audio.effect.VendorExtension vendor;
- int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
- int saturationMarginMb;
- @VintfStability
- union Id {
- int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @Backing(type="int") @VintfStability
- enum LevelEstimator {
- RMS = 0,
- PEAK = 1,
- }
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum WindshieldWipersSwitch {
+ OTHER = 0,
+ OFF = 1,
+ MIST = 2,
+ INTERMITTENT_LEVEL_1 = 3,
+ INTERMITTENT_LEVEL_2 = 4,
+ INTERMITTENT_LEVEL_3 = 5,
+ INTERMITTENT_LEVEL_4 = 6,
+ INTERMITTENT_LEVEL_5 = 7,
+ CONTINUOUS_LEVEL_1 = 8,
+ CONTINUOUS_LEVEL_2 = 9,
+ CONTINUOUS_LEVEL_3 = 10,
+ CONTINUOUS_LEVEL_4 = 11,
+ CONTINUOUS_LEVEL_5 = 12,
+ AUTO = 13,
+ SERVICE = 14,
}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl
new file mode 100644
index 0000000..7ebf844
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.automotive.vehicle;
+
+/**
+ * Used to enumerate the current driver state of Driver Attention Monitoring.
+ *
+ * This enum could be extended in future releases to include additional feature states.
+ */
+@VintfStability
+@Backing(type="int")
+enum DriverAttentionMonitoringState {
+ /**
+ * This state is used as an alternative for any DriverAttentionMonitoringState value that is
+ * not defined in the platform. Ideally, implementations of
+ * VehicleProperty#DRIVER_ATTENTION_MONITORING_STATE should not use this state. The
+ * framework can use this field to remain backwards compatible if DriverAttentionMonitoringState
+ * is extended to include additional states.
+ */
+ OTHER = 0,
+ /**
+ * The system detects that the driver is distracted.
+ */
+ DISTRACTED = 1,
+ /**
+ * The system detects that the driver is attentive / not distracted.
+ */
+ NOT_DISTRACTED = 2,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl
new file mode 100644
index 0000000..373dd7f
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.automotive.vehicle;
+
+/**
+ * Used to enumerate the current warning state of Driver Attention Monitoring.
+ */
+@VintfStability
+@Backing(type="int")
+enum DriverAttentionMonitoringWarning {
+ /**
+ * This state is used as an alternative for any DriverAttentionMonitoringWarning value that is
+ * defined in the platform. Ideally, implementations of
+ * VehicleProperty#DRIVER_ATTENTION_MONITORING_WARNING should not use this state. The framework
+ * can use this field to remain backwards compatible if DriverAttentionMonitoringWarning is
+ * extended to include additional states.
+ */
+ OTHER = 0,
+ /**
+ * Driver Attention Monitoring is enabled and the driver's current state does not warrant
+ * sending a warning.
+ */
+ NO_WARNING = 1,
+ /**
+ * Driver Attention Monitoring is enabled and the driver has been distracted for too long of a
+ * duration, and the vehicle is sending a warning to the driver as a consequence of this.
+ */
+ WARNING = 2,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl
new file mode 100644
index 0000000..4a36999
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.automotive.vehicle;
+
+/**
+ * Used to enumerate the current driver state of Hands On Detection (HOD).
+ */
+@VintfStability
+@Backing(type="int")
+enum HandsOnDetectionDriverState {
+ /**
+ * This state is used as an alternative for any HandsOnDetectionDriverState value that is not
+ * defined in the platform. Ideally, implementations of
+ * VehicleProperty#HANDS_ON_DETECTION_DRIVER_STATE should not use this state. The framework
+ * can use this field to remain backwards compatible if HandsOnDetectionDriverState is
+ * extended to include additional states.
+ */
+ OTHER = 0,
+ /**
+ * The system detects that the driver has their hands on the steering wheel.
+ */
+ HANDS_ON = 1,
+ /**
+ * The system detects that the driver has their hands off the steering wheel.
+ */
+ HANDS_OFF = 2,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl
new file mode 100644
index 0000000..c1a58ce
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.automotive.vehicle;
+
+/**
+ * Used to enumerate the current warning state of Hands On Detection (HOD).
+ */
+@VintfStability
+@Backing(type="int")
+enum HandsOnDetectionWarning {
+ /**
+ * This state is used as an alternative for any HandsOnDetectionWarning value that is
+ * defined in the platform. Ideally, implementations of
+ * VehicleProperty#HANDS_ON_DETECTION_WARNING should not use this state. The framework
+ * can use this field to remain backwards compatible if HandsOnDetectionWarning is
+ * extended to include additional states.
+ */
+ OTHER = 0,
+ /**
+ * HOD is enabled and the driver's current safety does not warrant sending a warning. This
+ * state is independent of whether the driver actually has their hands on or off the wheel.
+ */
+ NO_WARNING = 1,
+ /**
+ * HOD is enabled and the driver's hands have been off the wheel for too long a duration,
+ * and the vehicle is sending a warning to the driver as a consequence of this.
+ */
+ WARNING = 2,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 68a1e32..473dffc 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -2132,6 +2132,31 @@
0x0BC6 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32,
/**
+ * Windshield wipers switch.
+ *
+ * Represents the position of the switch controlling the windshield wipers. The value of
+ * WINDSHIELD_WIPERS_SWITCH may not match the value of WINDSHIELD_WIPERS_STATE (e.g.
+ * WINDSHIELD_WIPERS_SWITCH = AUTO and WINDSHIELD_WIPERS_STATE = WindshieldWipersState#ON).
+ *
+ * For each supported area ID, the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states in WindshieldWipersSwitch are supported (including OTHER, which is not
+ * recommended).
+ *
+ * This property is defined as read_write, but OEMs have the option to implement it as read
+ * only.
+ *
+ * If this property is implemented as read_write and the OTHER state is listed in the
+ * VehicleAreaConfig#supportedEnumValues array, then OTHER is not a supported value for writing.
+ * It is only a supported value for reading.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
+ * @data_enum WindshieldWipersSwitch
+ */
+ WINDSHIELD_WIPERS_SWITCH =
+ 0x0BC7 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32,
+
+ /**
* Steering wheel depth position
*
* All steering wheel properties' unique ids start from 0x0BE0.
@@ -3947,6 +3972,52 @@
0x1016 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
/**
+ * Hands on detection (HOD) driver state.
+ *
+ * Returns whether the driver's hands are on the steering wheel. Generally, this property should
+ * return a valid state defined in the HandsOnDetectionDriverState or ErrorState. For example,
+ * if the feature is not available due to some temporary state, that information should be
+ * conveyed through ErrorState.
+ *
+ * If the vehicle wants to send a warning to the user because the driver's hands have been off
+ * the steering wheel for too long, the warning should be surfaced through
+ * HANDS_ON_DETECTION_WARNING.
+ *
+ * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states of both HandsOnDetectionDriverState (including OTHER, which is not
+ * recommended) and ErrorState are supported.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
+ * @data_enum HandsOnDetectionDriverState
+ * @data_enum ErrorState
+ */
+ HANDS_ON_DETECTION_DRIVER_STATE =
+ 0x1017 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
+ * Hands on detection (HOD) warning.
+ *
+ * Returns whether a warning is being sent to the driver for having their hands off the wheel
+ * for too long a duration.
+ *
+ * Generally, this property should return a valid state defined in HandsOnDetectionWarning or
+ * ErrorState. For example, if the feature is not available due to some temporary state, that
+ * information should be conveyed through an ErrorState.
+ *
+ * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states of both HandsOnDetectionWarning (including OTHER, which is not recommended)
+ * and ErrorState are supported.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
+ * @data_enum HandsOnDetectionWarning
+ * @data_enum ErrorState
+ */
+ HANDS_ON_DETECTION_WARNING =
+ 0x1018 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
* Enable or disable driver attention monitoring.
*
* Set true to enable driver attention monitoring and false to disable driver attention
@@ -3963,6 +4034,51 @@
DRIVER_ATTENTION_MONITORING_ENABLED =
0x1019 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
+ /**
+ * Driver attention monitoring state.
+ *
+ * Returns whether the driver is currently attentive or distracted. Generally, this property
+ * should return a valid state defined in the DriverAttentionMonitoringState or ErrorState. For
+ * example, if the feature is not available due to some temporary state, that information should
+ * be conveyed through an ErrorState.
+ *
+ * If the vehicle wants to send a warning to the user because the driver has been distracted for
+ * too long, the warning should be surfaced through DRIVER_ATTENTION_MONITORING_WARNING.
+ *
+ * The VehicleAreaConfig#configArray array must define all states from
+ * DriverAttentionMonitoringState (including OTHER, which is not recommended) and ErrorState
+ * that are supported.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
+ * @data_enum DriverAttentionMonitoringState
+ * @data_enum ErrorState
+ */
+ DRIVER_ATTENTION_MONITORING_STATE =
+ 0x101A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
+ * Driver attention monitoring warning.
+ *
+ * Returns whether a warning is being sent to the driver for being distracted for too long a
+ * duration.
+ *
+ * Generally, this property should return a valid state defined in the
+ * DriverAttentionMonitoringWarning or ErrorState. For example, if the feature is not available
+ * due to some temporary state, that information should be conveyed through an ErrorState.
+ *
+ * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+ * unless all states of both DriverAttentionMonitoringWarning (including OTHER, which is not
+ * recommended) and ErrorState are supported.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
+ * @data_enum DriverAttentionMonitoringWarning
+ * @data_enum ErrorState
+ */
+ DRIVER_ATTENTION_MONITORING_WARNING =
+ 0x101B + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
/***************************************************************************
* End of ADAS Properties
**************************************************************************/
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl
new file mode 100644
index 0000000..911d7eb
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.automotive.vehicle;
+
+/**
+ * Used to enumerate the current position of VehicleProperty#WINDSHIELD_WIPERS_SWITCH.
+ */
+@VintfStability
+@Backing(type="int")
+enum WindshieldWipersSwitch {
+
+ /**
+ * This value is used as an alternative for any WindshieldWipersSwitch value that is not defined
+ * in the platform. Ideally, implementations of VehicleProperty#WINDSHIELD_WIPERS_SWITCH should
+ * not use this value. The framework can use this field to remain backwards compatible if
+ * WindshieldWipersSwitch is extended to include additional values.
+ */
+ OTHER = 0,
+ /**
+ * The windshield wipers switch is set to the off position.
+ */
+ OFF = 1,
+ /**
+ * MIST mode performs a single wipe, and then returns to the OFF position.
+ */
+ MIST = 2,
+ /**
+ * INTERMITTENT_LEVEL_* modes performs intermittent wiping. As the level increases, the
+ * intermittent time period decreases.
+ */
+ INTERMITTENT_LEVEL_1 = 3,
+ INTERMITTENT_LEVEL_2 = 4,
+ INTERMITTENT_LEVEL_3 = 5,
+ INTERMITTENT_LEVEL_4 = 6,
+ INTERMITTENT_LEVEL_5 = 7,
+ /**
+ * CONTINUOUS_LEVEL_* modes performs continuous wiping. As the level increases the speed of the
+ * wiping increases as well.
+ */
+ CONTINUOUS_LEVEL_1 = 8,
+ CONTINUOUS_LEVEL_2 = 9,
+ CONTINUOUS_LEVEL_3 = 10,
+ CONTINUOUS_LEVEL_4 = 11,
+ CONTINUOUS_LEVEL_5 = 12,
+ /**
+ * AUTO allows the vehicle to decide the required wiping level based on the exterior weather
+ * conditions.
+ */
+ AUTO = 13,
+ /**
+ * Windshield wipers are set to the service mode.
+ */
+ SERVICE = 14,
+}
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index efbcf47..51cc376 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -540,12 +540,36 @@
VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
}
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionDriverStateConfig) {
+ verifyProperty(VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionWarningConfig) {
+ verifyProperty(VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabledConfig) {
verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED,
VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
}
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringStateConfig) {
+ verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess::READ,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringWarningConfig) {
+ verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING,
+ VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE,
+ VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) {
verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL,
VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE,
@@ -588,6 +612,12 @@
VehicleArea::WINDOW, VehiclePropertyType::INT32);
}
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersSwitchConfig) {
+ verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE,
+ VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+ VehicleArea::WINDOW, VehiclePropertyType::INT32);
+}
+
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) {
verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE,
VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp
index bf5bf63..00d9da0 100644
--- a/camera/device/aidl/Android.bp
+++ b/camera/device/aidl/Android.bp
@@ -28,9 +28,6 @@
sdk_version: "module_current",
enabled: false,
},
- rust: {
- enabled: true,
- }
},
versions_with_info: [
{
diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp
index 19dede0..d7e613e 100644
--- a/camera/provider/aidl/Android.bp
+++ b/camera/provider/aidl/Android.bp
@@ -26,9 +26,6 @@
cpp: {
enabled: false,
},
- rust: {
- enabled: true,
- },
},
versions_with_info: [
{
diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp
index 058ddb5..5772b7f 100644
--- a/common/fmq/aidl/Android.bp
+++ b/common/fmq/aidl/Android.bp
@@ -24,9 +24,14 @@
stability: "vintf",
backend: {
java: {
+ // There is no Java FMQ library, but we support the AIDL type
+ // to allow subsets of interfaces that include it to be used in Java
+ enabled: true,
sdk_version: "module_current",
},
cpp: {
+ // FMQ will not be supported in the cpp backend because the parcelables
+ // are not stable enough for use in shared memory
enabled: false,
},
ndk: {
@@ -38,8 +43,9 @@
min_sdk_version: "29",
},
rust: {
- enabled: true,
- }
+ // FMQ is not supported in the rust backend
+ enabled: false,
+ },
},
frozen: true,
versions: ["1"],
diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
index c470a4a..48e5736 100644
--- a/graphics/mapper/3.0/utils/vts/MapperVts.cpp
+++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
@@ -99,11 +99,7 @@
descriptor, count,
[&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) {
if (tmpError != Error::NONE) {
- if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) {
- GTEST_SKIP() << "Old vendor grallocs may not support P010";
- } else {
- GTEST_FAIL() << "failed to allocate buffers";
- }
+ GTEST_FAIL() << "failed to allocate buffers";
}
ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array";
diff --git a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
index 3b1bfab..997af97 100644
--- a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
+++ b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
@@ -21,6 +21,7 @@
#include <vector>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -330,6 +331,9 @@
* Test IMapper::lockYCbCr. This locks a YCbCr_P010 buffer and verifies that it's initialized.
*/
TEST_P(GraphicsMapperHidlTest, LockYCbCrP010) {
+ if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) {
+ GTEST_SKIP() << "Old vendor grallocs may not support P010";
+ }
auto info = mDummyDescriptorInfo;
info.format = PixelFormat::YCBCR_P010;
diff --git a/graphics/mapper/4.0/utils/vts/MapperVts.cpp b/graphics/mapper/4.0/utils/vts/MapperVts.cpp
index c6c9834..d70c6ef 100644
--- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp
+++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp
@@ -111,11 +111,7 @@
}
if (error != Error::NONE) {
- if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) {
- GTEST_SKIP() << "Old vendor grallocs may not support P010";
- } else {
- GTEST_FAIL() << "failed to allocate buffers";
- }
+ GTEST_FAIL() << "failed to allocate buffers";
}
ASSERT_EQ(count, buffers.size()) << "invalid buffer array";
diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
index 1e7cb8e..e4a84e1 100644
--- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
+++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
@@ -29,12 +29,14 @@
#include <aidlcommonsupport/NativeHandle.h>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <android/sync.h>
#include <gralloctypes/Gralloc4.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
+
#include <mapper-vts/4.0/MapperVts.h>
#include <system/graphics.h>
@@ -998,6 +1000,9 @@
}
TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_P010) {
+ if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) {
+ GTEST_SKIP() << "Old vendor grallocs may not support P010";
+ }
auto info = mDummyDescriptorInfo;
info.format = PixelFormat::YCBCR_P010;
diff --git a/tv/hdmi/cec/aidl/OWNERS b/tv/hdmi/OWNERS
similarity index 100%
rename from tv/hdmi/cec/aidl/OWNERS
rename to tv/hdmi/OWNERS
diff --git a/tv/hdmi/connection/aidl/OWNERS b/tv/hdmi/connection/aidl/OWNERS
deleted file mode 100644
index d9c6783..0000000
--- a/tv/hdmi/connection/aidl/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 826094
-include platform/frameworks/base:/core/java/android/hardware/hdmi/OWNERS
\ No newline at end of file
diff --git a/tv/hdmi/earc/aidl/OWNERS b/tv/hdmi/earc/aidl/OWNERS
deleted file mode 100644
index d9c6783..0000000
--- a/tv/hdmi/earc/aidl/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 826094
-include platform/frameworks/base:/core/java/android/hardware/hdmi/OWNERS
\ No newline at end of file
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
index 6d0ddaa..b27b06f 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
@@ -82,6 +82,7 @@
void stopLoggingToDebugRingBuffer();
void triggerSubsystemRestart();
void enableStaChannelForPeerNetwork(in android.hardware.wifi.IWifiChip.ChannelCategoryMask channelCategoryEnableFlag);
+ void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode);
const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF;
@Backing(type="int") @VintfStability
enum ChipCapabilityMask {
@@ -93,6 +94,7 @@
P2P_RAND_MAC = (1 << 5) /* 32 */,
WIGIG = (1 << 6) /* 64 */,
SET_AFC_CHANNEL_ALLOWANCE = (1 << 7) /* 128 */,
+ T2LM_NEGOTIATION = (1 << 8) /* 256 */,
}
@VintfStability
parcelable ChipConcurrencyCombinationLimit {
@@ -163,4 +165,11 @@
INDOOR_CHANNEL = (1 << 0) /* 1 */,
DFS_CHANNEL = (1 << 1) /* 2 */,
}
+ @Backing(type="int") @VintfStability
+ enum ChipMloMode {
+ DEFAULT = 0,
+ LOW_LATENCY = 1,
+ HIGH_THROUGHPUT = 2,
+ LOW_POWER = 3,
+ }
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
index ed78d35..8c44330 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
@@ -46,6 +46,7 @@
oneway void eventPublishTerminated(in byte sessionId, in android.hardware.wifi.NanStatus status);
oneway void eventSubscribeTerminated(in byte sessionId, in android.hardware.wifi.NanStatus status);
oneway void eventTransmitFollowup(in char id, in android.hardware.wifi.NanStatus status);
+ oneway void eventSuspensionModeChanged(in android.hardware.wifi.NanSuspensionModeChangeInd event);
oneway void notifyCapabilitiesResponse(in char id, in android.hardware.wifi.NanStatus status, in android.hardware.wifi.NanCapabilities capabilities);
oneway void notifyConfigResponse(in char id, in android.hardware.wifi.NanStatus status);
oneway void notifyCreateDataInterfaceResponse(in char id, in android.hardware.wifi.NanStatus status);
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl
index 697e29a..740a140 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl
@@ -42,4 +42,5 @@
android.hardware.wifi.NanDataPathSecurityConfig securityConfig;
byte[] appInfo;
byte[] serviceNameOutOfBand;
+ byte discoverySessionId;
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl
index 5542ff6..0f873b5 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl
@@ -40,4 +40,5 @@
android.hardware.wifi.NanDataPathSecurityConfig securityConfig;
byte[] appInfo;
byte[] serviceNameOutOfBand;
+ byte discoverySessionId;
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl
index 40844cc..ec12eb0 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl
@@ -49,5 +49,7 @@
UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12,
INVALID_PAIRING_ID = 13,
INVALID_BOOTSTRAPPING_ID = 14,
- INVALID_STATE = 15,
+ REDUNDANT_REQUEST = 15,
+ NOT_SUPPORTED = 16,
+ NO_CONNECTION = 17,
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
similarity index 74%
copy from audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
copy to wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
index f3dd523..557fc79 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControl.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,21 +31,8 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.audio.effect;
+package android.hardware.wifi;
@VintfStability
-union AutomaticGainControl {
- android.hardware.audio.effect.VendorExtension vendor;
- int fixedDigitalGainMb;
- android.hardware.audio.effect.AutomaticGainControl.LevelEstimator levelEstimator;
- int saturationMarginMb;
- @VintfStability
- union Id {
- int vendorExtensionTag;
- android.hardware.audio.effect.AutomaticGainControl.Tag commonTag;
- }
- @Backing(type="int") @VintfStability
- enum LevelEstimator {
- RMS = 0,
- PEAK = 1,
- }
+parcelable NanSuspensionModeChangeInd {
+ boolean isSuspended;
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl
index f640861..b5034ea 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl
@@ -34,6 +34,7 @@
package android.hardware.wifi;
@VintfStability
parcelable WifiChipCapabilities {
+ int maxMloAssociationLinkCount;
int maxMloStrLinkCount;
int maxConcurrentTdlsSessionCount;
}
diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
index 8d415fd..de2449e 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
@@ -78,6 +78,10 @@
* for AFC purposes.
*/
SET_AFC_CHANNEL_ALLOWANCE = 1 << 7,
+ /**
+ * Chip supports Tid-To-Link mapping negotiation.
+ */
+ T2LM_NEGOTIATION = 1 << 8,
}
/**
@@ -1115,4 +1119,40 @@
* |WifiStatusCode.FAILURE_UNKNOWN|
*/
void enableStaChannelForPeerNetwork(in ChannelCategoryMask channelCategoryEnableFlag);
+
+ /**
+ * Multi-Link Operation modes.
+ */
+ @VintfStability
+ @Backing(type="int")
+ enum ChipMloMode {
+ /**
+ * Default mode for Multi-Link Operation.
+ */
+ DEFAULT = 0,
+ /**
+ * Low latency mode for Multi-link operation.
+ */
+ LOW_LATENCY = 1,
+ /**
+ * High throughput mode for Multi-link operation.
+ */
+ HIGH_THROUGHPUT = 2,
+ /**
+ * Low power mode for Multi-link operation.
+ */
+ LOW_POWER = 3,
+ }
+
+ /**
+ * Set mode for Multi-Link Operation. Various modes are defined by the enum |ChipMloMode|.
+ *
+ * @param mode MLO mode as defined by the enum |ChipMloMode|
+ * @throws ServiceSpecificException with one of the following values:
+ * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+ * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+ * |WifiStatusCode.ERROR_UNKNOWN|
+ *
+ */
+ void setMloMode(in ChipMloMode mode);
}
diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
index edca1d5..8a61a9c 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
@@ -28,7 +28,7 @@
import android.hardware.wifi.NanPairingConfirmInd;
import android.hardware.wifi.NanPairingRequestInd;
import android.hardware.wifi.NanStatus;
-
+import android.hardware.wifi.NanSuspensionModeChangeInd;
/**
* NAN Response and Asynchronous Event Callbacks.
*
@@ -141,6 +141,13 @@
void eventTransmitFollowup(in char id, in NanStatus status);
/**
+ * Callback indicating that device suspension mode status change
+ *
+ * @param event NanSuspensionModeChangeInd containing event details.
+ */
+ void eventSuspensionModeChanged(in NanSuspensionModeChangeInd event);
+
+ /**
* Callback invoked in response to a capability request
* |IWifiNanIface.getCapabilitiesRequest|.
*
diff --git a/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl b/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl
index 264a873..2f25329 100644
--- a/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl
@@ -69,4 +69,9 @@
* NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites
*/
byte[] serviceNameOutOfBand;
+ /**
+ * ID of an active publish or subscribe discovery session.
+ * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID
+ */
+ byte discoverySessionId;
}
diff --git a/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl b/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl
index 6960e71..e543b7b 100644
--- a/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl
@@ -58,4 +58,9 @@
* NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites
*/
byte[] serviceNameOutOfBand;
+ /**
+ * ID of an active publish or subscribe discovery session.
+ * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID
+ */
+ byte discoverySessionId;
}
diff --git a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl
index d609797..6706839 100644
--- a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl
@@ -79,8 +79,16 @@
* If the bootstrapping id is invalid
*/
INVALID_BOOTSTRAPPING_ID = 14,
- /**
- * If the system is not in a valid state for the given request.
+ /*
+ * If same request is received again
*/
- INVALID_STATE = 15
+ REDUNDANT_REQUEST = 15,
+ /*
+ * If current request is not supported
+ */
+ NOT_SUPPORTED = 16,
+ /*
+ * If no Wifi Aware connection is active
+ */
+ NO_CONNECTION = 17
}
diff --git a/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
new file mode 100644
index 0000000..afabe8c
--- /dev/null
+++ b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi;
+
+/**
+ * Event indication that the device entered or exited the suspension mode
+ */
+@VintfStability
+parcelable NanSuspensionModeChangeInd {
+ /**
+ * Indication whether the device has entered or existed the NAN suspension mode(deep sleep)
+ */
+ boolean isSuspended;
+}
diff --git a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl
index 4e0578b..77b9049 100644
--- a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl
+++ b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl
@@ -22,6 +22,10 @@
@VintfStability
parcelable WifiChipCapabilities {
/**
+ * Maximum number of links supported by the chip for MLO association.
+ */
+ int maxMloAssociationLinkCount;
+ /**
* Maximum number of Simultaneous Transmit and Receive (STR) links used
* in Multi-Link Operation. The maximum number of STR links used can be
* different from the maximum number of radios supported by the chip.
diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp
index fa89852..efd6598 100644
--- a/wifi/aidl/default/aidl_struct_util.cpp
+++ b/wifi/aidl/default/aidl_struct_util.cpp
@@ -1402,6 +1402,12 @@
return NanStatusCode::INVALID_PAIRING_ID;
case legacy_hal::NAN_STATUS_INVALID_BOOTSTRAPPING_ID:
return NanStatusCode::INVALID_BOOTSTRAPPING_ID;
+ case legacy_hal::NAN_STATUS_REDUNDANT_REQUEST:
+ return NanStatusCode::REDUNDANT_REQUEST;
+ case legacy_hal::NAN_STATUS_NOT_SUPPORTED:
+ return NanStatusCode::NOT_SUPPORTED;
+ case legacy_hal::NAN_STATUS_NO_CONNECTION:
+ return NanStatusCode::NO_CONNECTION;
}
CHECK(false);
}
@@ -2072,6 +2078,7 @@
return false;
}
memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len);
+ legacy_request->publish_subscribe_id = static_cast<uint8_t>(aidl_request.discoverySessionId);
return true;
}
@@ -2153,6 +2160,7 @@
return false;
}
memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len);
+ legacy_request->publish_subscribe_id = static_cast<uint8_t>(aidl_request.discoverySessionId);
return true;
}
@@ -3272,6 +3280,8 @@
const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities,
WifiChipCapabilities& aidl_chip_capabilities) {
aidl_chip_capabilities.maxMloStrLinkCount = legacy_chip_capabilities.max_mlo_str_link_count;
+ aidl_chip_capabilities.maxMloAssociationLinkCount =
+ legacy_chip_capabilities.max_mlo_association_link_count;
aidl_chip_capabilities.maxConcurrentTdlsSessionCount =
legacy_chip_capabilities.max_concurrent_tdls_session_count;
return true;
diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp
index fc58c3e..d58a9b0 100644
--- a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp
+++ b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp
@@ -137,6 +137,7 @@
MOCK_METHOD2(notifySuspendResponse, ndk::ScopedAStatus(char16_t, const NanStatus&));
MOCK_METHOD2(notifyResumeResponse, ndk::ScopedAStatus(char16_t, const NanStatus&));
MOCK_METHOD2(notifyTerminatePairingResponse, ndk::ScopedAStatus(char16_t, const NanStatus&));
+ MOCK_METHOD1(eventSuspensionModeChanged, ndk::ScopedAStatus(const NanSuspensionModeChangeInd&));
};
class WifiNanIfaceTest : public Test {
diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp
index 41912b5..b4c2ccd 100644
--- a/wifi/aidl/default/wifi_chip.cpp
+++ b/wifi/aidl/default/wifi_chip.cpp
@@ -26,6 +26,7 @@
#include "aidl_return_util.h"
#include "aidl_struct_util.h"
+#include "wifi_legacy_hal.h"
#include "wifi_status_util.h"
#define P2P_MGMT_DEVICE_PREFIX "p2p-dev-"
@@ -699,6 +700,11 @@
in_channelCategoryEnableFlag);
}
+ndk::ScopedAStatus WifiChip::setMloMode(const ChipMloMode in_mode) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+ &WifiChip::setMloModeInternal, in_mode);
+}
+
void WifiChip::invalidateAndRemoveAllIfaces() {
invalidateAndClearBridgedApAll();
invalidateAndClearAll(ap_ifaces_);
@@ -1956,6 +1962,28 @@
return false;
}
+ndk::ScopedAStatus WifiChip::setMloModeInternal(const WifiChip::ChipMloMode in_mode) {
+ legacy_hal::wifi_mlo_mode mode;
+ switch (in_mode) {
+ case WifiChip::ChipMloMode::DEFAULT:
+ mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_DEFAULT;
+ break;
+ case WifiChip::ChipMloMode::LOW_LATENCY:
+ mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_LOW_LATENCY;
+ break;
+ case WifiChip::ChipMloMode::HIGH_THROUGHPUT:
+ mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_HIGH_THROUGHPUT;
+ break;
+ case WifiChip::ChipMloMode::LOW_POWER:
+ mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_LOW_POWER;
+ break;
+ default:
+ PLOG(ERROR) << "Error: invalid mode: " << toString(in_mode);
+ return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+ }
+ return createWifiStatusFromLegacyError(legacy_hal_.lock()->setMloMode(mode));
+}
+
} // namespace wifi
} // namespace hardware
} // namespace android
diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h
index b552c33..ff4ee9c 100644
--- a/wifi/aidl/default/wifi_chip.h
+++ b/wifi/aidl/default/wifi_chip.h
@@ -150,6 +150,7 @@
ndk::ScopedAStatus enableStaChannelForPeerNetwork(
ChannelCategoryMask in_channelCategoryEnableFlag) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
+ ndk::ScopedAStatus setMloMode(const ChipMloMode in_mode) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -260,6 +261,7 @@
std::pair<WifiRadioCombinationMatrix, ndk::ScopedAStatus>
getSupportedRadioCombinationsMatrixInternal();
std::pair<WifiChipCapabilities, ndk::ScopedAStatus> getWifiChipCapabilitiesInternal();
+ ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode);
void setWeakPtr(std::weak_ptr<WifiChip> ptr);
int32_t chip_id_;
diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp
index 6436fb7..dbf5a68 100644
--- a/wifi/aidl/default/wifi_legacy_hal.cpp
+++ b/wifi/aidl/default/wifi_legacy_hal.cpp
@@ -351,6 +351,15 @@
}
}
+std::function<void(const NanSuspensionModeChangeInd&)>
+ on_nan_event_suspension_mode_change_user_callback;
+void onAsyncNanEventSuspensionModeChange(NanSuspensionModeChangeInd* event) {
+ const auto lock = aidl_sync_util::acquireGlobalLock();
+ if (on_nan_event_suspension_mode_change_user_callback && event) {
+ on_nan_event_suspension_mode_change_user_callback(*event);
+ }
+}
+
std::function<void(const NanPairingRequestInd&)> on_nan_event_pairing_request_user_callback;
void onAsyncNanEventPairingRequest(NanPairingRequestInd* event) {
const auto lock = aidl_sync_util::acquireGlobalLock();
@@ -745,7 +754,7 @@
// Copies wifi_peer_info* to vector<WifiPeerInfo> and returns poiner to next element.
wifi_peer_info* WifiLegacyHal::copyPeerInfo(wifi_peer_info* peer_ptr,
- std::vector<WifiPeerInfo> peers) {
+ std::vector<WifiPeerInfo>& peers) {
WifiPeerInfo peer;
peer.peer_info = *peer_ptr;
if (peer_ptr->num_rate > 0) {
@@ -761,7 +770,7 @@
}
// Copies wifi_link_stat* to vector<LinkStats> and returns poiner to next element.
wifi_link_stat* WifiLegacyHal::copyLinkStat(wifi_link_stat* stat_ptr,
- std::vector<LinkStats> stats) {
+ std::vector<LinkStats>& stats) {
LinkStats linkStat;
linkStat.stat = *stat_ptr;
wifi_peer_info* l_peer_info_stats_ptr = stat_ptr->peer_info;
@@ -1376,6 +1385,8 @@
on_nan_event_range_request_user_callback = user_callbacks.on_event_range_request;
on_nan_event_range_report_user_callback = user_callbacks.on_event_range_report;
on_nan_event_schedule_update_user_callback = user_callbacks.on_event_schedule_update;
+ on_nan_event_suspension_mode_change_user_callback =
+ user_callbacks.on_event_suspension_mode_change;
return global_func_table_.wifi_nan_register_handler(getIfaceHandle(iface_name),
{onAsyncNanNotifyResponse,
@@ -1399,7 +1410,8 @@
onAsyncNanEventPairingRequest,
onAsyncNanEventPairingConfirm,
onAsyncNanEventBootstrappingRequest,
- onAsyncNanEventBootstrappingConfirm});
+ onAsyncNanEventBootstrappingConfirm,
+ onAsyncNanEventSuspensionModeChange});
}
wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, transaction_id id,
@@ -1869,6 +1881,10 @@
channelCategoryEnableFlag);
}
+wifi_error WifiLegacyHal::setMloMode(wifi_mlo_mode mode) {
+ return global_func_table_.wifi_set_mlo_mode(global_handle_, mode);
+}
+
void WifiLegacyHal::invalidate() {
global_handle_ = nullptr;
iface_name_to_handle_.clear();
diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h
index 468d8d7..1d59b17 100644
--- a/wifi/aidl/default/wifi_legacy_hal.h
+++ b/wifi/aidl/default/wifi_legacy_hal.h
@@ -91,6 +91,7 @@
using ::NAN_RESPONSE_SUBSCRIBE_CANCEL;
using ::NAN_RESPONSE_TCA;
using ::NAN_RESPONSE_TRANSMIT_FOLLOWUP;
+using ::NAN_RESUME_REQUEST_RESPONSE;
using ::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
using ::NAN_SECURITY_KEY_INPUT_PMK;
using ::NAN_SERVICE_ACCEPT_POLICY_ALL;
@@ -111,13 +112,17 @@
using ::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID;
using ::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID;
using ::NAN_STATUS_NAN_NOT_ALLOWED;
+using ::NAN_STATUS_NO_CONNECTION;
using ::NAN_STATUS_NO_OTA_ACK;
using ::NAN_STATUS_NO_RESOURCE_AVAILABLE;
+using ::NAN_STATUS_NOT_SUPPORTED;
using ::NAN_STATUS_PROTOCOL_FAILURE;
+using ::NAN_STATUS_REDUNDANT_REQUEST;
using ::NAN_STATUS_SUCCESS;
using ::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED;
using ::NAN_SUBSCRIBE_TYPE_ACTIVE;
using ::NAN_SUBSCRIBE_TYPE_PASSIVE;
+using ::NAN_SUSPEND_REQUEST_RESPONSE;
using ::NAN_TRANSMIT_IN_DW;
using ::NAN_TRANSMIT_IN_FAW;
using ::NAN_TX_PRIORITY_HIGH;
@@ -175,6 +180,7 @@
using ::NanSubscribeTerminatedInd;
using ::NanSubscribeType;
using ::NanSuspendRequest;
+using ::NanSuspensionModeChangeInd;
using ::NanTransmitFollowupInd;
using ::NanTransmitFollowupRequest;
using ::NanTxType;
@@ -312,6 +318,7 @@
using ::WIFI_LOGGER_PACKET_FATE_SUPPORTED;
using ::WIFI_LOGGER_POWER_EVENT_SUPPORTED;
using ::WIFI_LOGGER_WAKE_LOCK_SUPPORTED;
+using ::wifi_mlo_mode;
using ::WIFI_MOTION_EXPECTED;
using ::WIFI_MOTION_NOT_EXPECTED;
using ::wifi_motion_pattern;
@@ -452,6 +459,7 @@
std::function<void(const NanPairingConfirmInd&)> on_event_pairing_confirm;
std::function<void(const NanBootstrappingRequestInd&)> on_event_bootstrapping_request;
std::function<void(const NanBootstrappingConfirmInd&)> on_event_bootstrapping_confirm;
+ std::function<void(const NanSuspensionModeChangeInd&)> on_event_suspension_mode_change;
};
// Full scan results contain IE info and are hence passed by reference, to
@@ -770,6 +778,7 @@
const CachedScanResultsCallbackHandlers& handler);
std::pair<wifi_error, wifi_chip_capabilities> getWifiChipCapabilities();
wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag);
+ wifi_error setMloMode(wifi_mlo_mode mode);
private:
// Retrieve interface handles for all the available interfaces.
@@ -785,8 +794,8 @@
// Handles wifi (error) status of Virtual interface create/delete
wifi_error handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname,
wifi_error status);
- wifi_link_stat* copyLinkStat(wifi_link_stat* stat_ptr, std::vector<LinkStats> stats);
- wifi_peer_info* copyPeerInfo(wifi_peer_info* peer_ptr, std::vector<WifiPeerInfo> peers);
+ wifi_link_stat* copyLinkStat(wifi_link_stat* stat_ptr, std::vector<LinkStats>& stats);
+ wifi_peer_info* copyPeerInfo(wifi_peer_info* peer_ptr, std::vector<WifiPeerInfo>& peers);
// Global function table of legacy HAL.
wifi_hal_fn global_func_table_;
diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp
index 42743df..77d1cb5 100644
--- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp
@@ -177,6 +177,7 @@
populateStubFor(&hal_fn->wifi_nan_suspend_request);
populateStubFor(&hal_fn->wifi_nan_resume_request);
populateStubFor(&hal_fn->wifi_set_scan_mode);
+ populateStubFor(&hal_fn->wifi_set_mlo_mode);
return true;
}
diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp
index 0d53803..8e3a191 100644
--- a/wifi/aidl/default/wifi_nan_iface.cpp
+++ b/wifi/aidl/default/wifi_nan_iface.cpp
@@ -253,6 +253,22 @@
}
break;
}
+ case legacy_hal::NAN_SUSPEND_REQUEST_RESPONSE: {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
+ if (!callback->notifySuspendResponse(id, nanStatus).isOk()) {
+ LOG(ERROR) << "Failed to invoke the callback";
+ }
+ }
+ break;
+ }
+ case legacy_hal::NAN_RESUME_REQUEST_RESPONSE: {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
+ if (!callback->notifyResumeResponse(id, nanStatus).isOk()) {
+ LOG(ERROR) << "Failed to invoke the callback";
+ }
+ }
+ break;
+ }
case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD:
/* fall through */
case legacy_hal::NAN_RESPONSE_TCA:
@@ -581,6 +597,22 @@
}
}
};
+ callback_handlers.on_event_suspension_mode_change =
+ [weak_ptr_this](const legacy_hal::NanSuspensionModeChangeInd& msg) {
+ const auto shared_ptr_this = weak_ptr_this.lock();
+ if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+ LOG(ERROR) << "Callback invoked on an invalid object";
+ return;
+ }
+ NanSuspensionModeChangeInd aidl_struct;
+ aidl_struct.isSuspended = msg.is_suspended;
+
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
+ if (!callback->eventSuspensionModeChanged(aidl_struct).isOk()) {
+ LOG(ERROR) << "Failed to invoke the callback";
+ }
+ }
+ };
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers);
diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp
index d2c3235..bebad7c 100644
--- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp
@@ -55,6 +55,7 @@
using aidl::android::hardware::wifi::NanRespondToDataPathIndicationRequest;
using aidl::android::hardware::wifi::NanStatus;
using aidl::android::hardware::wifi::NanStatusCode;
+using aidl::android::hardware::wifi::NanSuspensionModeChangeInd;
using aidl::android::hardware::wifi::NanTxType;
#define TIMEOUT_PERIOD 10
@@ -124,6 +125,7 @@
EVENT_PAIRING_CONFIRM,
EVENT_BOOTSTRAPPING_REQUEST,
EVENT_BOOTSTRAPPING_CONFIRM,
+ EVENT_SUSPENSION_MODE_CHANGE,
};
// Test code calls this function to wait for data/event callback.
@@ -255,6 +257,13 @@
parent_.notify();
return ndk::ScopedAStatus::ok();
}
+ ::ndk::ScopedAStatus eventSuspensionModeChanged(
+ const NanSuspensionModeChangeInd& event) override {
+ parent_.callback_type_ = EVENT_SUSPENSION_MODE_CHANGE;
+ parent_.nan_suspension_mode_change_ind_ = event;
+ parent_.notify();
+ return ndk::ScopedAStatus::ok();
+ }
::ndk::ScopedAStatus notifyCapabilitiesResponse(
char16_t id, const NanStatus& status,
const NanCapabilities& capabilities) override {
@@ -451,6 +460,7 @@
NanPairingConfirmInd nan_pairing_confirm_ind_;
NanBootstrappingRequestInd nan_bootstrapping_request_ind_;
NanBootstrappingConfirmInd nan_bootstrapping_confirm_ind_;
+ NanSuspensionModeChangeInd nan_suspension_mode_change_ind_;
const char* getInstanceName() { return GetParam().c_str(); }
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl
index 433b3d80..553cbc8 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl
@@ -39,4 +39,5 @@
int maxNumberTxSpatialStreams;
int maxNumberRxSpatialStreams;
android.hardware.wifi.supplicant.LegacyMode legacyMode;
+ boolean apTidToLinkMapNegotiationSupported;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl
index 1718413..4921a67 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl
@@ -44,4 +44,8 @@
* detailed network mode for legacy network
*/
LegacyMode legacyMode;
+ /**
+ * Indicates the AP support for TID-to-link mapping negotiation.
+ */
+ boolean apTidToLinkMapNegotiationSupported;
}