Merge "Added info to HAL docs to answer Q1 from Ford pending questions." into udc-dev
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index bb48ecd..515787e 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -114,6 +114,7 @@
"android/hardware/audio/core/AudioRoute.aidl",
"android/hardware/audio/core/IBluetooth.aidl",
"android/hardware/audio/core/IBluetoothA2dp.aidl",
+ "android/hardware/audio/core/IBluetoothLe.aidl",
"android/hardware/audio/core/IConfig.aidl",
"android/hardware/audio/core/IModule.aidl",
"android/hardware/audio/core/IStreamCallback.aidl",
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
similarity index 82%
rename from radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl
rename to audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
index 315359d..2068daf 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.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,11 +31,11 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.satellite;
-@Backing(type="int") @JavaDerive(toString=true) @VintfStability
-enum SatelliteFeature {
- SOS_SMS = 0,
- EMERGENCY_SMS = 1,
- SMS = 2,
- LOCATION_SHARING = 3,
+package android.hardware.audio.core;
+@VintfStability
+interface IBluetoothLe {
+ boolean isEnabled();
+ void setEnabled(boolean enabled);
+ boolean supportsOffloadReconfiguration();
+ void reconfigureOffload(in android.hardware.audio.core.VendorParameter[] parameters);
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
index f18d6a5..e14e9c0 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
@@ -38,6 +38,7 @@
@nullable android.hardware.audio.core.ITelephony getTelephony();
@nullable android.hardware.audio.core.IBluetooth getBluetooth();
@nullable android.hardware.audio.core.IBluetoothA2dp getBluetoothA2dp();
+ @nullable android.hardware.audio.core.IBluetoothLe getBluetoothLe();
android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData);
void disconnectExternalDevice(int portId);
android.hardware.audio.core.AudioPatch[] getAudioPatches();
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl
index f0bf100..65a2ee4 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl
@@ -35,6 +35,7 @@
@VintfStability
interface IStreamCommon {
void close();
+ void prepareToClose();
void updateHwAvSyncId(int hwAvSyncId);
android.hardware.audio.core.VendorParameter[] getVendorParameters(in @utf8InCpp String[] ids);
void setVendorParameters(in android.hardware.audio.core.VendorParameter[] parameters, boolean async);
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl
index 1ec7dad..16367c0 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AcousticEchoCanceler.aidl
@@ -39,7 +39,7 @@
boolean mobileMode;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.AcousticEchoCanceler.Tag commonTag;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
index 57d4418..e69e2bd 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -40,7 +40,7 @@
boolean enableLimiter;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.AutomaticGainControlV1.Tag commonTag;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
index bdb481c..46ffcaf 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV2.aidl
@@ -40,7 +40,7 @@
int saturationMarginMb;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.AutomaticGainControlV2.Tag commonTag;
}
@Backing(type="int") @VintfStability
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl
index d09fe54..c248ce8 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/BassBoost.aidl
@@ -38,7 +38,7 @@
int strengthPm;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.BassBoost.Tag commonTag;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl
index 45a1f28..ce0a7df 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Downmix.aidl
@@ -38,7 +38,7 @@
android.hardware.audio.effect.Downmix.Type type;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.Downmix.Tag commonTag;
}
@VintfStability
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl
index 3e20e33..04f627d 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/DynamicsProcessing.aidl
@@ -34,7 +34,7 @@
package android.hardware.audio.effect;
@VintfStability
union DynamicsProcessing {
- android.hardware.audio.effect.VendorExtension vendorExtension;
+ android.hardware.audio.effect.VendorExtension vendor;
android.hardware.audio.effect.DynamicsProcessing.EngineArchitecture engineArchitecture;
android.hardware.audio.effect.DynamicsProcessing.ChannelConfig[] preEq;
android.hardware.audio.effect.DynamicsProcessing.ChannelConfig[] postEq;
@@ -46,7 +46,7 @@
android.hardware.audio.effect.DynamicsProcessing.InputGain[] inputGain;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.DynamicsProcessing.Tag commonTag;
}
enum ResolutionPreference {
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl
index c12ebb8..00b7d1a 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/EnvironmentalReverb.aidl
@@ -48,7 +48,7 @@
boolean bypass;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.EnvironmentalReverb.Tag commonTag;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl
index 3e3539f..80f7c7e 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl
@@ -34,7 +34,7 @@
package android.hardware.audio.effect;
@VintfStability
union Equalizer {
- android.hardware.audio.effect.VendorExtension vendorExtension;
+ android.hardware.audio.effect.VendorExtension vendor;
android.hardware.audio.effect.Equalizer.BandLevel[] bandLevels;
int preset;
int[] centerFreqMh;
@@ -42,7 +42,7 @@
android.hardware.audio.effect.Equalizer.Preset[] presets;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.Equalizer.Tag commonTag;
}
@VintfStability
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl
index a7dc265..8addab7 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/HapticGenerator.aidl
@@ -34,12 +34,12 @@
package android.hardware.audio.effect;
@VintfStability
union HapticGenerator {
- android.hardware.audio.effect.VendorExtension vendorExtension;
+ android.hardware.audio.effect.VendorExtension vendor;
android.hardware.audio.effect.HapticGenerator.HapticScale[] hapticScales;
android.hardware.audio.effect.HapticGenerator.VibratorInformation vibratorInfo;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.HapticGenerator.Tag commonTag;
}
@Backing(type="int") @VintfStability
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl
index 774f45f..fc276d6 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/LoudnessEnhancer.aidl
@@ -38,7 +38,7 @@
int gainMb;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.LoudnessEnhancer.Tag commonTag;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
index f1a3449..7f30fe2 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -39,7 +39,7 @@
android.hardware.audio.effect.NoiseSuppression.Type type;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.NoiseSuppression.Tag commonTag;
}
@Backing(type="int") @VintfStability
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 14aa1e8..b50a2f1 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
@@ -42,7 +42,7 @@
android.hardware.audio.effect.Parameter.Specific specific;
@VintfStability
union Id {
- int vendorEffectTag;
+ android.hardware.audio.effect.VendorExtension vendorEffectTag;
android.hardware.audio.effect.AcousticEchoCanceler.Id acousticEchoCancelerTag;
android.hardware.audio.effect.AutomaticGainControlV1.Id automaticGainControlV1Tag;
android.hardware.audio.effect.AutomaticGainControlV2.Id automaticGainControlV2Tag;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl
index 148f79d..26d96b5 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/PresetReverb.aidl
@@ -49,7 +49,7 @@
}
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.PresetReverb.Tag commonTag;
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl
index e9611e4..6092b14 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Virtualizer.aidl
@@ -40,7 +40,7 @@
android.media.audio.common.AudioDeviceDescription device;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.Virtualizer.Tag commonTag;
android.hardware.audio.effect.Virtualizer.SpeakerAnglesPayload speakerAnglesPayload;
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl
index d1b1b3e..7d319da 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Visualizer.aidl
@@ -44,7 +44,7 @@
android.hardware.audio.effect.Visualizer.MeasurementMode measurementMode;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.Visualizer.Tag commonTag;
}
@VintfStability
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl
index c2b2df7..8227118 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Volume.aidl
@@ -39,7 +39,7 @@
boolean mute;
@VintfStability
union Id {
- int vendorExtensionTag;
+ android.hardware.audio.effect.VendorExtension vendorExtensionTag;
android.hardware.audio.effect.Volume.Tag commonTag;
}
}
diff --git a/audio/aidl/android/hardware/audio/core/IBluetooth.aidl b/audio/aidl/android/hardware/audio/core/IBluetooth.aidl
index 21ac8e2..7fa2e24 100644
--- a/audio/aidl/android/hardware/audio/core/IBluetooth.aidl
+++ b/audio/aidl/android/hardware/audio/core/IBluetooth.aidl
@@ -25,6 +25,9 @@
* and the SCO Link. This interface is optional to implement and provide by the
* vendor. It needs to be provided only if the device actually supports BT SCO
* or HFP.
+ *
+ * Each of IBluetooth* interfaces is independent of each other. The HAL module
+ * can provide any combination of them.
*/
@VintfStability
interface IBluetooth {
diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
index dc4b8d0..a690ca4 100644
--- a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
+++ b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
@@ -24,8 +24,8 @@
* the vendor. It needs to be provided only if the device actually supports BT
* A2DP.
*
- * This interface is separate from IBluetooth interface which manages SCO & HFP.
- * The HAL module can handle both SCO and A2DP profiles or only one of them.
+ * Each of IBluetooth* interfaces is independent of each other. The HAL module
+ * can provide any combination of them.
*/
@VintfStability
interface IBluetoothA2dp {
@@ -55,7 +55,7 @@
/**
* Indicates whether the module supports reconfiguration of offloaded codecs.
*
- * Offloaded coded implementations may need to be reconfigured when the
+ * Offloaded codec implementations may need to be reconfigured when the
* active A2DP device changes. This method indicates whether the HAL module
* supports the reconfiguration event. The result returned from this method
* must not change over time.
@@ -67,11 +67,11 @@
/**
* Instructs the HAL module to reconfigure offloaded codec.
*
- * Offloaded coded implementations may need to be reconfigured when the
+ * Offloaded codec implementations may need to be reconfigured when the
* active A2DP device changes. This method is a notification for the HAL
* module to commence reconfiguration.
*
- * Note that 'EX_UNSUPPORTED_OPERATION' may only be thrown when
+ * Note that 'EX_UNSUPPORTED_OPERATION' must be thrown if and only if
* 'supportsOffloadReconfiguration' returns 'false'.
*
* @param parameter Optional vendor-specific parameters, can be left empty.
diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl
new file mode 100644
index 0000000..444ff68
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl
@@ -0,0 +1,82 @@
+/*
+ * 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.core;
+
+import android.hardware.audio.core.VendorParameter;
+
+/**
+ * An instance of IBluetoothLe manages settings for the LE (Low Energy)
+ * profiles. This interface is optional to implement by the vendor. It needs to
+ * be provided only if the device actually supports BT LE.
+ *
+ * Each of IBluetooth* interfaces is independent of each other. The HAL module
+ * can provide any combination of them.
+ */
+@VintfStability
+interface IBluetoothLe {
+ /**
+ * Whether BT LE is enabled.
+ *
+ * Returns the current state of LE support. The client might need to
+ * disable (suspend) LE when another profile (for example, SCO) is
+ * activated.
+ *
+ * @return Whether BT LE is enabled.
+ */
+ boolean isEnabled();
+
+ /**
+ * Enable or disable LE.
+ *
+ * Sets the current state of LE support. The client might need to
+ * disable (suspend) LE when another Bluetooth profile (for example, SCO) is
+ * activated.
+ *
+ * @param enabled Whether BT LE must be enabled or suspended.
+ * @throws EX_ILLEGAL_STATE If there was an error performing the operation.
+ */
+ void setEnabled(boolean enabled);
+
+ /**
+ * Indicates whether the module supports reconfiguration of offloaded codecs.
+ *
+ * Offloaded codec implementations may need to be reconfigured when the
+ * active LE device changes. This method indicates whether the HAL module
+ * supports the reconfiguration event. The result returned from this method
+ * must not change over time.
+ *
+ * @return Whether reconfiguration offload of offloaded codecs is supported.
+ */
+ boolean supportsOffloadReconfiguration();
+
+ /**
+ * Instructs the HAL module to reconfigure offloaded codec.
+ *
+ * Offloaded codec implementations may need to be reconfigured when the
+ * active LE device changes. This method is a notification for the HAL
+ * module to commence reconfiguration.
+ *
+ * Note that 'EX_UNSUPPORTED_OPERATION' must be thrown if and only if
+ * 'supportsOffloadReconfiguration' returns 'false'.
+ *
+ * @param parameter Optional vendor-specific parameters, can be left empty.
+ * @throws EX_ILLEGAL_STATE If there was an error performing the operation,
+ * or the operation can not be commenced in the current state.
+ * @throws EX_UNSUPPORTED_OPERATION If the module does not support codec reconfiguration.
+ */
+ void reconfigureOffload(in VendorParameter[] parameters);
+}
diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index 080d826..7830501 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -22,6 +22,7 @@
import android.hardware.audio.core.AudioRoute;
import android.hardware.audio.core.IBluetooth;
import android.hardware.audio.core.IBluetoothA2dp;
+import android.hardware.audio.core.IBluetoothLe;
import android.hardware.audio.core.IStreamCallback;
import android.hardware.audio.core.IStreamIn;
import android.hardware.audio.core.IStreamOut;
@@ -118,6 +119,20 @@
@nullable IBluetoothA2dp getBluetoothA2dp();
/**
+ * Retrieve the interface to control Bluetooth LE.
+ *
+ * If the HAL module supports LE Profile functionality for Bluetooth, it
+ * must return an instance of the IBluetoothLe interface. The same
+ * instance must be returned during the lifetime of the HAL module. If the
+ * HAL module does not support BT LE, a null must be returned, without
+ * throwing any errors.
+ *
+ * @return An instance of the IBluetoothLe interface implementation.
+ * @throws EX_ILLEGAL_STATE If there was an error creating an instance.
+ */
+ @nullable IBluetoothLe getBluetoothLe();
+
+ /**
* Set a device port of an external device into connected state.
*
* This method is used to inform the HAL module that an external device has
@@ -842,7 +857,7 @@
AudioMMapPolicyInfo[] getMmapPolicyInfos(AudioMMapPolicyType mmapPolicyType);
/**
- * Indicates if this module supports variable latency control for instance
+ * Indicates if this module supports variable latency control, for instance,
* over Bluetooth A2DP or LE Audio links.
*
* If supported, all instances of IStreamOut interface returned by this module must
diff --git a/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl b/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl
index 533ef67..543d9e2 100644
--- a/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl
+++ b/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl
@@ -44,6 +44,33 @@
void close();
/**
+ * Notify the stream that it is about to be closed.
+ *
+ * This is a notification sent by the client to indicate that it intends to
+ * close the stream "soon" (the actual time period is unspecified). The
+ * purpose of this notification is to allow the stream implementation to
+ * unblock the I/O thread. This is useful for HAL modules that act as
+ * proxies to other subsystems, examples are "bluetooth" and "r_submix"
+ * modules. In such modules the I/O thread might get blocked on a read or
+ * write operation to the external subsystem. Thus, calling 'close' directly
+ * will stall, as it will try to send the 'Command.halReservedExit' on the
+ * I/O thread which is blocked and is not reading commands from the FMQ. The
+ * HAL implementation must initiate unblocking as a result of receiving the
+ * 'prepareToClose' notification.
+ *
+ * This operation must be handled by the HAL module in an "asynchronous"
+ * manner, returning control back as quick as possible.
+ *
+ * Since this operation does not have any effects observable from the client
+ * side, the HAL module must be able to handle multiple calls of this method
+ * without throwing any errors. The only case when this method is allowed
+ * to throw is when the stream has been closed.
+ *
+ * @throws EX_ILLEGAL_STATE If the stream is closed.
+ */
+ void prepareToClose();
+
+ /**
* Update the HW AV Sync identifier for the stream.
*
* The argument to this method must be one of the identifiers previously
diff --git a/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl b/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl
index 49377d6..bf1f8a2 100644
--- a/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl
+++ b/audio/aidl/android/hardware/audio/effect/AcousticEchoCanceler.aidl
@@ -33,7 +33,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
AcousticEchoCanceler.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
index 9b2feff..e7bf99d 100644
--- a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -35,7 +35,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
AutomaticGainControlV1.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
index 836d6b8..8f2afdc 100644
--- a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV2.aidl
@@ -36,7 +36,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
AutomaticGainControlV2.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/BassBoost.aidl b/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
index d734825..479db96 100644
--- a/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
+++ b/audio/aidl/android/hardware/audio/effect/BassBoost.aidl
@@ -32,7 +32,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
BassBoost.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Downmix.aidl b/audio/aidl/android/hardware/audio/effect/Downmix.aidl
index f90e339..90fd4c7 100644
--- a/audio/aidl/android/hardware/audio/effect/Downmix.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Downmix.aidl
@@ -31,7 +31,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
Downmix.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl b/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
index 486d4f4..5aea211 100644
--- a/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
+++ b/audio/aidl/android/hardware/audio/effect/DynamicsProcessing.aidl
@@ -32,14 +32,14 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
DynamicsProcessing.Tag commonTag;
}
/**
* Vendor DynamicsProcessing implementation definition for additional parameters.
*/
- VendorExtension vendorExtension;
+ VendorExtension vendor;
/**
* Resolution preference definition.
diff --git a/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl b/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl
index 95d1ff6..1d58e50 100644
--- a/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl
+++ b/audio/aidl/android/hardware/audio/effect/EnvironmentalReverb.aidl
@@ -33,7 +33,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
EnvironmentalReverb.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
index 2bce151..e727f70 100644
--- a/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl
@@ -31,14 +31,14 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
Equalizer.Tag commonTag;
}
/**
* Vendor Equalizer implementation definition for additional parameters.
*/
- VendorExtension vendorExtension;
+ VendorExtension vendor;
/**
* Level setting for each band in millibels.
diff --git a/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl b/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
index a8e4564..3cc5acb 100644
--- a/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
+++ b/audio/aidl/android/hardware/audio/effect/HapticGenerator.aidl
@@ -33,14 +33,14 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
HapticGenerator.Tag commonTag;
}
/**
* Vendor HapticGenerator implementation definition for additional parameters.
*/
- VendorExtension vendorExtension;
+ VendorExtension vendor;
@VintfStability
@Backing(type="int")
diff --git a/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl b/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
index a7cbe8d..23e1e5a 100644
--- a/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/LoudnessEnhancer.aidl
@@ -32,7 +32,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
LoudnessEnhancer.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
index 6c2fb5f..c6bcc43 100644
--- a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -35,7 +35,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
NoiseSuppression.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
index 9f8874b..229c621 100644
--- a/audio/aidl/android/hardware/audio/effect/Parameter.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl
@@ -66,10 +66,10 @@
@VintfStability
union Id {
/**
- * Parameter tag defined for vendor effects. Use int here so there is flexibility for vendor
- * to define different tag.
+ * Parameter tag defined for vendor effects. Use VendorExtension here so it's possible to
+ * pass customized information.
*/
- int vendorEffectTag;
+ VendorExtension vendorEffectTag;
/**
* Parameter tag defined for nested parameters. Can be used to get any parameter defined in
* nested Union structure.
diff --git a/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl b/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl
index 87c78b0..a36da2c 100644
--- a/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl
+++ b/audio/aidl/android/hardware/audio/effect/PresetReverb.aidl
@@ -68,7 +68,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
PresetReverb.Tag commonTag;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl b/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
index 37ea2a4..1dbb509 100644
--- a/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Virtualizer.aidl
@@ -34,7 +34,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
Virtualizer.Tag commonTag;
SpeakerAnglesPayload speakerAnglesPayload;
}
diff --git a/audio/aidl/android/hardware/audio/effect/Visualizer.aidl b/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
index 8f2faaa..0b37546 100644
--- a/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Visualizer.aidl
@@ -33,7 +33,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
Visualizer.Tag commonTag;
}
Id id;
diff --git a/audio/aidl/android/hardware/audio/effect/Volume.aidl b/audio/aidl/android/hardware/audio/effect/Volume.aidl
index 4a76703..15cfdd2 100644
--- a/audio/aidl/android/hardware/audio/effect/Volume.aidl
+++ b/audio/aidl/android/hardware/audio/effect/Volume.aidl
@@ -31,7 +31,7 @@
*/
@VintfStability
union Id {
- int vendorExtensionTag;
+ VendorExtension vendorExtensionTag;
Volume.Tag commonTag;
}
diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h
index d87bbd4..2cf862c 100644
--- a/audio/aidl/common/include/Utils.h
+++ b/audio/aidl/common/include/Utils.h
@@ -19,6 +19,7 @@
#include <algorithm>
#include <array>
#include <initializer_list>
+#include <regex>
#include <type_traits>
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
@@ -29,7 +30,7 @@
#include <aidl/android/media/audio/common/AudioOutputFlags.h>
#include <aidl/android/media/audio/common/PcmType.h>
-namespace android::hardware::audio::common {
+namespace aidl::android::hardware::audio::common {
// Some values are reserved for use by the system code only.
// HALs must not accept or emit values outside from the provided list.
@@ -133,6 +134,18 @@
kValidAudioModes.end();
}
+static inline bool maybeVendorExtension(const std::string& s) {
+ // Only checks whether the string starts with the "vendor prefix".
+ static const std::string vendorPrefix = "VX_";
+ return s.size() > vendorPrefix.size() && s.substr(0, vendorPrefix.size()) == vendorPrefix;
+}
+
+static inline bool isVendorExtension(const std::string& s) {
+ // Must be the same as defined in {Playback|Record}TrackMetadata.aidl
+ static const std::regex vendorExtension("VX_[A-Z0-9]{3,}_[_A-Z0-9]+");
+ return std::regex_match(s.begin(), s.end(), vendorExtension);
+}
+
// The helper functions defined below are only applicable to the case when an enum type
// specifies zero-based bit positions, not bit masks themselves. This is why instantiation
// is restricted to certain enum types.
@@ -163,4 +176,4 @@
return result;
}
-} // namespace android::hardware::audio::common
+} // namespace aidl::android::hardware::audio::common
diff --git a/audio/aidl/common/tests/utils_tests.cpp b/audio/aidl/common/tests/utils_tests.cpp
index d7f1a5d..1b8b8df 100644
--- a/audio/aidl/common/tests/utils_tests.cpp
+++ b/audio/aidl/common/tests/utils_tests.cpp
@@ -26,13 +26,13 @@
#define LOG_TAG "Utils_Test"
#include <log/log.h>
+using aidl::android::hardware::audio::common::getChannelCount;
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
+using aidl::android::hardware::audio::common::getPcmSampleSizeInBytes;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::getChannelCount;
-using android::hardware::audio::common::getFrameSizeInBytes;
-using android::hardware::audio::common::getPcmSampleSizeInBytes;
TEST(UtilsTest, ChannelCountOddCases) {
using Tag = AudioChannelLayout::Tag;
diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp
index 93362c6..8bacbb3 100644
--- a/audio/aidl/default/Android.bp
+++ b/audio/aidl/default/Android.bp
@@ -13,6 +13,7 @@
shared_libs: [
"libalsautilsv2",
"libaudioaidlcommon",
+ "libaudioutils",
"libbase",
"libbinder_ndk",
"libcutils",
@@ -54,12 +55,13 @@
],
}
-cc_library_static {
+cc_library {
name: "libaudioserviceexampleimpl",
defaults: [
"aidlaudioservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_core_ndk_shared",
+ "latest_android_hardware_audio_core_sounddose_ndk_shared",
],
export_include_dirs: ["include"],
srcs: [
diff --git a/audio/aidl/default/Bluetooth.cpp b/audio/aidl/default/Bluetooth.cpp
index bd9a864..c32b538 100644
--- a/audio/aidl/default/Bluetooth.cpp
+++ b/audio/aidl/default/Bluetooth.cpp
@@ -105,4 +105,29 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus BluetoothLe::isEnabled(bool* _aidl_return) {
+ *_aidl_return = mEnabled;
+ LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothLe::setEnabled(bool in_enabled) {
+ mEnabled = in_enabled;
+ LOG(DEBUG) << __func__ << ": " << mEnabled;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothLe::supportsOffloadReconfiguration(bool* _aidl_return) {
+ *_aidl_return = true;
+ LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothLe::reconfigureOffload(
+ const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& in_parameters
+ __unused) {
+ LOG(DEBUG) << __func__ << ": " << ::android::internal::ToString(in_parameters);
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp
index a72be24..e1e1f79 100644
--- a/audio/aidl/default/Configuration.cpp
+++ b/audio/aidl/default/Configuration.cpp
@@ -25,6 +25,7 @@
#include "core-impl/Configuration.h"
+using aidl::android::hardware::audio::common::makeBitPositionFlagMask;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceDescription;
using aidl::android::media::audio::common::AudioDeviceType;
@@ -42,7 +43,6 @@
using aidl::android::media::audio::common::Int;
using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::makeBitPositionFlagMask;
namespace aidl::android::hardware::audio::core::internal {
diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp
index 024c0ea..4f8fb3c 100644
--- a/audio/aidl/default/EffectThread.cpp
+++ b/audio/aidl/default/EffectThread.cpp
@@ -34,13 +34,14 @@
};
RetCode EffectThread::createThread(std::shared_ptr<EffectContext> context, const std::string& name,
- const int priority) {
+ int priority, int sleepUs /* kSleepTimeUs */) {
if (mThread.joinable()) {
LOG(WARNING) << __func__ << " thread already created, no-op";
return RetCode::SUCCESS;
}
mName = name;
mPriority = priority;
+ mSleepTimeUs = sleepUs;
{
std::lock_guard lg(mThreadMutex);
mThreadContext = std::move(context);
@@ -134,7 +135,7 @@
LOG(DEBUG) << __func__ << " done processing, effect consumed " << status.fmqConsumed
<< " produced " << status.fmqProduced;
} else {
- // TODO: maybe add some sleep here to avoid busy waiting
+ usleep(mSleepTimeUs);
}
}
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index c4f3844..984b9a1 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -34,6 +34,9 @@
#include "core-impl/Telephony.h"
#include "core-impl/utils.h"
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
+using aidl::android::hardware::audio::common::isBitPositionFlagSet;
+using aidl::android::hardware::audio::common::isValidAudioMode;
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::hardware::audio::core::sounddose::ISoundDose;
@@ -57,9 +60,6 @@
using aidl::android::media::audio::common::Int;
using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::getFrameSizeInBytes;
-using android::hardware::audio::common::isBitPositionFlagSet;
-using android::hardware::audio::common::isValidAudioMode;
namespace aidl::android::hardware::audio::core {
@@ -396,6 +396,15 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Module::getBluetoothLe(std::shared_ptr<IBluetoothLe>* _aidl_return) {
+ if (!mBluetoothLe) {
+ mBluetoothLe = ndk::SharedRefBase::make<BluetoothLe>();
+ }
+ *_aidl_return = mBluetoothLe.getPtr();
+ LOG(DEBUG) << __func__ << ": returning instance of IBluetoothLe: " << _aidl_return->get();
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdAndAdditionalData,
AudioPort* _aidl_return) {
const int32_t templateId = in_templateIdAndAdditionalData.id;
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index 193c793..77b0601 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -25,6 +25,8 @@
#include "core-impl/Stream.h"
using aidl::android::hardware::audio::common::AudioOffloadMetadata;
+using aidl::android::hardware::audio::common::getChannelCount;
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::media::audio::common::AudioDevice;
@@ -34,8 +36,6 @@
using aidl::android::media::audio::common::AudioPlaybackRate;
using aidl::android::media::audio::common::MicrophoneDynamicInfo;
using aidl::android::media::audio::common::MicrophoneInfo;
-using android::hardware::audio::common::getChannelCount;
-using android::hardware::audio::common::getFrameSizeInBytes;
namespace aidl::android::hardware::audio::core {
@@ -660,6 +660,16 @@
}
template <class Metadata>
+ndk::ScopedAStatus StreamCommonImpl<Metadata>::prepareToClose() {
+ LOG(DEBUG) << __func__;
+ if (!isClosed()) {
+ return ndk::ScopedAStatus::ok();
+ }
+ LOG(ERROR) << __func__ << ": stream was closed";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+}
+
+template <class Metadata>
void StreamCommonImpl<Metadata>::stopWorker() {
if (auto commandMQ = mContext.getCommandMQ(); commandMQ != nullptr) {
LOG(DEBUG) << __func__ << ": asking the worker to exit...";
diff --git a/audio/aidl/default/StreamStub.cpp b/audio/aidl/default/StreamStub.cpp
index 0ed9357..2467320 100644
--- a/audio/aidl/default/StreamStub.cpp
+++ b/audio/aidl/default/StreamStub.cpp
@@ -14,8 +14,11 @@
* limitations under the License.
*/
+#include <cmath>
+
#define LOG_TAG "AHAL_Stream"
#include <android-base/logging.h>
+#include <audio_utils/clock.h>
#include "core-impl/Module.h"
#include "core-impl/StreamStub.h"
@@ -29,31 +32,42 @@
namespace aidl::android::hardware::audio::core {
DriverStub::DriverStub(const StreamContext& context, bool isInput)
- : mFrameSizeBytes(context.getFrameSize()), mIsInput(isInput) {}
+ : mFrameSizeBytes(context.getFrameSize()),
+ mSampleRate(context.getSampleRate()),
+ mIsAsynchronous(!!context.getAsyncCallback()),
+ mIsInput(isInput) {}
::android::status_t DriverStub::init() {
- usleep(1000);
+ usleep(500);
return ::android::OK;
}
::android::status_t DriverStub::drain(StreamDescriptor::DrainMode) {
- usleep(1000);
+ usleep(500);
return ::android::OK;
}
::android::status_t DriverStub::flush() {
- usleep(1000);
+ usleep(500);
return ::android::OK;
}
::android::status_t DriverStub::pause() {
- usleep(1000);
+ usleep(500);
return ::android::OK;
}
::android::status_t DriverStub::transfer(void* buffer, size_t frameCount, size_t* actualFrameCount,
int32_t* latencyMs) {
- usleep(3000);
+ static constexpr float kMicrosPerSecond = MICROS_PER_SECOND;
+ static constexpr float kScaleFactor = .8f;
+ if (mIsAsynchronous) {
+ usleep(500);
+ } else {
+ const size_t delayUs = static_cast<size_t>(
+ std::roundf(kScaleFactor * frameCount * kMicrosPerSecond / mSampleRate));
+ usleep(delayUs);
+ }
if (mIsInput) {
uint8_t* byteBuffer = static_cast<uint8_t*>(buffer);
for (size_t i = 0; i < frameCount * mFrameSizeBytes; ++i) {
@@ -66,12 +80,13 @@
}
::android::status_t DriverStub::standby() {
- usleep(1000);
+ usleep(500);
return ::android::OK;
}
::android::status_t DriverStub::setConnectedDevices(
const std::vector<AudioDevice>& connectedDevices __unused) {
+ usleep(500);
return ::android::OK;
}
diff --git a/audio/aidl/default/Telephony.cpp b/audio/aidl/default/Telephony.cpp
index ad22470..bf05a8d 100644
--- a/audio/aidl/default/Telephony.cpp
+++ b/audio/aidl/default/Telephony.cpp
@@ -22,10 +22,10 @@
#include "core-impl/Telephony.h"
+using aidl::android::hardware::audio::common::isValidAudioMode;
using aidl::android::media::audio::common::AudioMode;
using aidl::android::media::audio::common::Boolean;
using aidl::android::media::audio::common::Float;
-using android::hardware::audio::common::isValidAudioMode;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
index f5af81e..561f9a3 100644
--- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
+++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
@@ -17,10 +17,9 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_AcousticEchoCancelerSw"
-#include <Utils.h>
#include <unordered_set>
+#define LOG_TAG "AHAL_AcousticEchoCancelerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
index 8441f22..50712a4 100644
--- a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
@@ -17,10 +17,8 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_AutomaticGainControlV2Sw"
-#include <Utils.h>
-#include <unordered_set>
+#define LOG_TAG "AHAL_AutomaticGainControlV2Sw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/bassboost/BassBoostSw.cpp b/audio/aidl/default/bassboost/BassBoostSw.cpp
index e50f0a2..fb5374f 100644
--- a/audio/aidl/default/bassboost/BassBoostSw.cpp
+++ b/audio/aidl/default/bassboost/BassBoostSw.cpp
@@ -17,10 +17,8 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_BassBoostSw"
-#include <Utils.h>
-#include <unordered_set>
+#define LOG_TAG "AHAL_BassBoostSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/downmix/DownmixSw.cpp b/audio/aidl/default/downmix/DownmixSw.cpp
index 0af95d0..81a4c89 100644
--- a/audio/aidl/default/downmix/DownmixSw.cpp
+++ b/audio/aidl/default/downmix/DownmixSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_DownmixSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_DownmixSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
index da6d0c6..1dda6d1 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
@@ -14,13 +14,12 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_DynamicsProcessingSw"
-#include <Utils.h>
#include <algorithm>
+#include <cstddef>
#include <set>
#include <unordered_set>
+#define LOG_TAG "AHAL_DynamicsProcessingSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
@@ -170,7 +169,7 @@
EX_ILLEGAL_ARGUMENT, "inputGainCfgFailed");
return ndk::ScopedAStatus::ok();
}
- case DynamicsProcessing::vendorExtension: {
+ case DynamicsProcessing::vendor: {
LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
EX_ILLEGAL_ARGUMENT, "DynamicsProcessingTagNotSupported");
@@ -237,7 +236,7 @@
dpParam.set<DynamicsProcessing::inputGain>(mContext->getInputGainCfgs());
break;
}
- case DynamicsProcessing::vendorExtension: {
+ case DynamicsProcessing::vendor: {
LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
EX_ILLEGAL_ARGUMENT, "DynamicsProcessingTagNotSupported");
@@ -282,8 +281,8 @@
RetCode DynamicsProcessingSwContext::setCommon(const Parameter::Common& common) {
mCommon = common;
- mChannelCount =
- ::android::hardware::audio::common::getChannelCount(common.input.base.channelMask);
+ mChannelCount = ::aidl::android::hardware::audio::common::getChannelCount(
+ common.input.base.channelMask);
resizeChannels();
resizeBands();
LOG(INFO) << __func__ << mCommon.toString();
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
index 3e14cce..769f9ef 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
@@ -16,10 +16,13 @@
#pragma once
-#include <aidl/android/hardware/audio/effect/BnEffect.h>
-#include <fmq/AidlMessageQueue.h>
#include <cstdlib>
#include <memory>
+#include <vector>
+
+#include <Utils.h>
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
@@ -30,7 +33,7 @@
public:
DynamicsProcessingSwContext(int statusDepth, const Parameter::Common& common)
: EffectContext(statusDepth, common),
- mChannelCount(::android::hardware::audio::common::getChannelCount(
+ mChannelCount(::aidl::android::hardware::audio::common::getChannelCount(
common.input.base.channelMask)),
mPreEqChCfgs(mChannelCount, {.channel = kInvalidChannelId}),
mPostEqChCfgs(mChannelCount, {.channel = kInvalidChannelId}),
diff --git a/audio/aidl/default/envReverb/EnvReverbSw.cpp b/audio/aidl/default/envReverb/EnvReverbSw.cpp
index 15373fe..29288ca 100644
--- a/audio/aidl/default/envReverb/EnvReverbSw.cpp
+++ b/audio/aidl/default/envReverb/EnvReverbSw.cpp
@@ -14,12 +14,11 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_EnvReverbSw"
-#include <Utils.h>
#include <algorithm>
+#include <cstddef>
#include <unordered_set>
+#define LOG_TAG "AHAL_EnvReverbSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/equalizer/EqualizerSw.cpp b/audio/aidl/default/equalizer/EqualizerSw.cpp
index 8cfe82e..0fa7a11 100644
--- a/audio/aidl/default/equalizer/EqualizerSw.cpp
+++ b/audio/aidl/default/equalizer/EqualizerSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_EqualizerSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_EqualizerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/extension/ExtensionEffect.cpp b/audio/aidl/default/extension/ExtensionEffect.cpp
index d2e3ccd..db1e4a4 100644
--- a/audio/aidl/default/extension/ExtensionEffect.cpp
+++ b/audio/aidl/default/extension/ExtensionEffect.cpp
@@ -19,9 +19,8 @@
#include <memory>
#include <unordered_set>
-#define LOG_TAG "AHAL_ExtensionEffect"
-#include <Utils.h>
#include <aidl/android/hardware/audio/effect/DefaultExtension.h>
+#define LOG_TAG "AHAL_ExtensionEffect"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
@@ -88,7 +87,7 @@
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(!defaultExt.has_value(), EX_ILLEGAL_ARGUMENT, "parcelableNull");
RETURN_IF(mContext->setParams(defaultExt->bytes) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT,
"paramNotSupported");
@@ -99,10 +98,15 @@
Parameter::Specific* specific) {
auto tag = id.getTag();
RETURN_IF(Parameter::Id::vendorEffectTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag");
- auto specificId = id.get<Parameter::Id::vendorEffectTag>();
+ auto extensionId = id.get<Parameter::Id::vendorEffectTag>();
+ std::optional<DefaultExtension> defaultIdExt;
+ RETURN_IF(STATUS_OK != extensionId.extension.getParcelable(&defaultIdExt), EX_ILLEGAL_ARGUMENT,
+ "getIdParcelableFailed");
+ RETURN_IF(!defaultIdExt.has_value(), EX_ILLEGAL_ARGUMENT, "parcelableIdNull");
+
VendorExtension extension;
DefaultExtension defaultExt;
- defaultExt.bytes = mContext->getParams(specificId);
+ defaultExt.bytes = mContext->getParams(defaultIdExt->bytes);
RETURN_IF(STATUS_OK != extension.extension.setParcelable(defaultExt), EX_ILLEGAL_ARGUMENT,
"setParcelableFailed");
specific->set<Parameter::Specific::vendorEffect>(extension);
diff --git a/audio/aidl/default/extension/ExtensionEffect.h b/audio/aidl/default/extension/ExtensionEffect.h
index 399fa83..f432d40 100644
--- a/audio/aidl/default/extension/ExtensionEffect.h
+++ b/audio/aidl/default/extension/ExtensionEffect.h
@@ -37,7 +37,7 @@
mParams = params;
return RetCode::SUCCESS;
}
- std::vector<uint8_t> getParams(int tag __unused) const { return mParams; }
+ std::vector<uint8_t> getParams(std::vector<uint8_t> id __unused) const { return mParams; }
private:
std::vector<uint8_t> mParams;
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
index 6037ad2..944f715 100644
--- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_HapticGeneratorSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_HapticGeneratorSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/include/core-impl/Bluetooth.h b/audio/aidl/default/include/core-impl/Bluetooth.h
index e2f48ba..10e9045 100644
--- a/audio/aidl/default/include/core-impl/Bluetooth.h
+++ b/audio/aidl/default/include/core-impl/Bluetooth.h
@@ -18,6 +18,7 @@
#include <aidl/android/hardware/audio/core/BnBluetooth.h>
#include <aidl/android/hardware/audio/core/BnBluetoothA2dp.h>
+#include <aidl/android/hardware/audio/core/BnBluetoothLe.h>
namespace aidl::android::hardware::audio::core {
@@ -48,4 +49,19 @@
bool mEnabled = false;
};
+class BluetoothLe : public BnBluetoothLe {
+ public:
+ BluetoothLe() = default;
+
+ private:
+ ndk::ScopedAStatus isEnabled(bool* _aidl_return) override;
+ ndk::ScopedAStatus setEnabled(bool in_enabled) override;
+ ndk::ScopedAStatus supportsOffloadReconfiguration(bool* _aidl_return) override;
+ ndk::ScopedAStatus reconfigureOffload(
+ const std::vector<::aidl::android::hardware::audio::core::VendorParameter>&
+ in_parameters) override;
+
+ bool mEnabled = false;
+};
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index c35025f..2cbda7d 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -72,6 +72,7 @@
ndk::ScopedAStatus getTelephony(std::shared_ptr<ITelephony>* _aidl_return) override;
ndk::ScopedAStatus getBluetooth(std::shared_ptr<IBluetooth>* _aidl_return) override;
ndk::ScopedAStatus getBluetoothA2dp(std::shared_ptr<IBluetoothA2dp>* _aidl_return) override;
+ ndk::ScopedAStatus getBluetoothLe(std::shared_ptr<IBluetoothLe>* _aidl_return) override;
ndk::ScopedAStatus connectExternalDevice(
const ::aidl::android::media::audio::common::AudioPort& in_templateIdAndAdditionalData,
::aidl::android::media::audio::common::AudioPort* _aidl_return) override;
@@ -164,7 +165,7 @@
bool isMmapSupported();
// This value is used for all AudioPatches.
- static constexpr int32_t kMinimumStreamBufferSizeFrames = 16;
+ static constexpr int32_t kMinimumStreamBufferSizeFrames = 256;
// The maximum stream buffer size is 1 GiB = 2 ** 30 bytes;
static constexpr int32_t kMaximumStreamBufferSizeBytes = 1 << 30;
@@ -175,6 +176,7 @@
ChildInterface<ITelephony> mTelephony;
ChildInterface<IBluetooth> mBluetooth;
ChildInterface<IBluetoothA2dp> mBluetoothA2dp;
+ ChildInterface<IBluetoothLe> mBluetoothLe;
// ids of ports created at runtime via 'connectExternalDevice'.
std::set<int32_t> mConnectedDevicePorts;
Streams mStreams;
diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h
index e9b1fbb..65680df 100644
--- a/audio/aidl/default/include/core-impl/Stream.h
+++ b/audio/aidl/default/include/core-impl/Stream.h
@@ -294,6 +294,7 @@
struct StreamCommonInterface {
virtual ~StreamCommonInterface() = default;
virtual ndk::ScopedAStatus close() = 0;
+ virtual ndk::ScopedAStatus prepareToClose() = 0;
virtual ndk::ScopedAStatus updateHwAvSyncId(int32_t in_hwAvSyncId) = 0;
virtual ndk::ScopedAStatus getVendorParameters(const std::vector<std::string>& in_ids,
std::vector<VendorParameter>* _aidl_return) = 0;
@@ -318,6 +319,11 @@
return delegate != nullptr ? delegate->close()
: ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
+ ndk::ScopedAStatus prepareToClose() override {
+ auto delegate = mDelegate.lock();
+ return delegate != nullptr ? delegate->prepareToClose()
+ : ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
ndk::ScopedAStatus updateHwAvSyncId(int32_t in_hwAvSyncId) override {
auto delegate = mDelegate.lock();
return delegate != nullptr ? delegate->updateHwAvSyncId(in_hwAvSyncId)
@@ -359,6 +365,7 @@
class StreamCommonImpl : public StreamCommonInterface {
public:
ndk::ScopedAStatus close() override;
+ ndk::ScopedAStatus prepareToClose() override;
ndk::ScopedAStatus updateHwAvSyncId(int32_t in_hwAvSyncId) override;
ndk::ScopedAStatus getVendorParameters(const std::vector<std::string>& in_ids,
std::vector<VendorParameter>* _aidl_return) override;
diff --git a/audio/aidl/default/include/core-impl/StreamStub.h b/audio/aidl/default/include/core-impl/StreamStub.h
index 69fd7b3..df0182c 100644
--- a/audio/aidl/default/include/core-impl/StreamStub.h
+++ b/audio/aidl/default/include/core-impl/StreamStub.h
@@ -36,6 +36,8 @@
private:
const size_t mFrameSizeBytes;
+ const int mSampleRate;
+ const bool mIsAsynchronous;
const bool mIsInput;
};
diff --git a/audio/aidl/default/include/effect-impl/EffectContext.h b/audio/aidl/default/include/effect-impl/EffectContext.h
index 2ab0ade..8b4a7d2 100644
--- a/audio/aidl/default/include/effect-impl/EffectContext.h
+++ b/audio/aidl/default/include/effect-impl/EffectContext.h
@@ -15,10 +15,10 @@
*/
#pragma once
-#include <Utils.h>
#include <memory>
#include <vector>
+#include <Utils.h>
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
@@ -46,9 +46,9 @@
LOG_ALWAYS_FATAL_IF(output.base.format.pcm !=
aidl::android::media::audio::common::PcmType::FLOAT_32_BIT,
"outputFormatNotFloat");
- mInputFrameSize = ::android::hardware::audio::common::getFrameSizeInBytes(
+ mInputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
input.base.format, input.base.channelMask);
- mOutputFrameSize = ::android::hardware::audio::common::getFrameSizeInBytes(
+ mOutputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
output.base.format, output.base.channelMask);
// in/outBuffer size in float (FMQ data format defined for DataMQ)
size_t inBufferSizeInFloat = input.frameCount * mInputFrameSize / sizeof(float);
diff --git a/audio/aidl/default/include/effect-impl/EffectThread.h b/audio/aidl/default/include/effect-impl/EffectThread.h
index 9b1a75b..f9c6a31 100644
--- a/audio/aidl/default/include/effect-impl/EffectThread.h
+++ b/audio/aidl/default/include/effect-impl/EffectThread.h
@@ -35,7 +35,7 @@
// called by effect implementation.
RetCode createThread(std::shared_ptr<EffectContext> context, const std::string& name,
- const int priority = ANDROID_PRIORITY_URGENT_AUDIO);
+ int priority = ANDROID_PRIORITY_URGENT_AUDIO, int sleepUs = kSleepTimeUs);
RetCode destroyThread();
RetCode startThread();
RetCode stopThread();
@@ -72,7 +72,8 @@
virtual void process_l() REQUIRES(mThreadMutex);
private:
- const int kMaxTaskNameLen = 15;
+ static constexpr int kMaxTaskNameLen = 15;
+ static constexpr int kSleepTimeUs = 2000; // in micro-second
std::mutex mThreadMutex;
std::condition_variable mCv;
bool mExit GUARDED_BY(mThreadMutex) = false;
@@ -80,6 +81,7 @@
std::shared_ptr<EffectContext> mThreadContext GUARDED_BY(mThreadMutex);
std::thread mThread;
int mPriority;
+ int mSleepTimeUs = kSleepTimeUs; // sleep time in micro-second
std::string mName;
RetCode handleStartStop(bool stop);
diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
index da02076..f115cc5 100644
--- a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
+++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_LoudnessEnhancerSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_LoudnessEnhancerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/main.cpp b/audio/aidl/default/main.cpp
index a861f9d..af71aa8 100644
--- a/audio/aidl/default/main.cpp
+++ b/audio/aidl/default/main.cpp
@@ -41,6 +41,9 @@
// android::base::SetMinimumLogSeverity(::android::base::VERBOSE);
ABinderProcess_setThreadPoolMaxThreadCount(16);
+ // Guaranteed log for b/210919187 and logd_integration_test
+ LOG(INFO) << "Init for Audio AIDL HAL";
+
// Make the default config service
auto config = ndk::SharedRefBase::make<Config>();
const std::string configName = std::string() + Config::descriptor + "/default";
diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
index 0ea31ea..ba39b16 100644
--- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
+++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
@@ -17,10 +17,8 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_NoiseSuppressionSw"
-#include <Utils.h>
-#include <unordered_set>
+#define LOG_TAG "AHAL_NoiseSuppressionSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.cpp b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
index 2da3ff6..14546a4 100644
--- a/audio/aidl/default/presetReverb/PresetReverbSw.cpp
+++ b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_PresetReverbSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_PresetReverbSw"
#include <android-base/logging.h>
#include <android/binder_enums.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/usb/ModuleUsb.cpp b/audio/aidl/default/usb/ModuleUsb.cpp
index 511ba74..80b0a5b 100644
--- a/audio/aidl/default/usb/ModuleUsb.cpp
+++ b/audio/aidl/default/usb/ModuleUsb.cpp
@@ -30,6 +30,7 @@
#include "alsa_device_profile.h"
}
+using aidl::android::hardware::audio::common::isUsbInputDeviceType;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioDeviceDescription;
@@ -40,7 +41,6 @@
using aidl::android::media::audio::common::AudioPortConfig;
using aidl::android::media::audio::common::AudioPortExt;
using aidl::android::media::audio::common::AudioProfile;
-using android::hardware::audio::common::isUsbInputDeviceType;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/usb/StreamUsb.cpp b/audio/aidl/default/usb/StreamUsb.cpp
index d6f757c..fbfe0f1 100644
--- a/audio/aidl/default/usb/StreamUsb.cpp
+++ b/audio/aidl/default/usb/StreamUsb.cpp
@@ -28,6 +28,7 @@
#include "alsa_device_profile.h"
}
+using aidl::android::hardware::audio::common::getChannelCount;
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::media::audio::common::AudioDevice;
@@ -38,7 +39,6 @@
using aidl::android::media::audio::common::MicrophoneInfo;
using android::OK;
using android::status_t;
-using android::hardware::audio::common::getChannelCount;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/usb/UsbAlsaUtils.cpp b/audio/aidl/default/usb/UsbAlsaUtils.cpp
index 3c79e1d..3a74c2a 100644
--- a/audio/aidl/default/usb/UsbAlsaUtils.cpp
+++ b/audio/aidl/default/usb/UsbAlsaUtils.cpp
@@ -24,11 +24,11 @@
#include "UsbAlsaUtils.h"
#include "core-impl/utils.h"
+using aidl::android::hardware::audio::common::getChannelCount;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::getChannelCount;
namespace aidl::android::hardware::audio::core::usb {
@@ -178,4 +178,4 @@
return findValueOrDefault(getAudioFormatDescriptorToPcmFormatMap(), aidl, PCM_FORMAT_INVALID);
}
-} // namespace aidl::android::hardware::audio::core::usb
\ No newline at end of file
+} // namespace aidl::android::hardware::audio::core::usb
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.cpp b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
index d75e4e0..c5a0e8d 100644
--- a/audio/aidl/default/virtualizer/VirtualizerSw.cpp
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
@@ -14,12 +14,11 @@
* limitations under the License.
*/
+#include <algorithm>
#include <cstddef>
+
#define LOG_TAG "AHAL_VirtualizerSw"
#include <Utils.h>
-#include <algorithm>
-#include <unordered_set>
-
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
@@ -170,7 +169,7 @@
ndk::ScopedAStatus VirtualizerSw::getSpeakerAngles(const Virtualizer::SpeakerAnglesPayload payload,
Parameter::Specific* specific) {
std::vector<Virtualizer::ChannelAngle> angles;
- const auto chNum = ::android::hardware::audio::common::getChannelCount(payload.layout);
+ const auto chNum = ::aidl::android::hardware::audio::common::getChannelCount(payload.layout);
if (chNum == 1) {
angles = {{.channel = (int32_t)AudioChannelLayout::CHANNEL_FRONT_LEFT,
.azimuthDegree = 0,
diff --git a/audio/aidl/default/volume/VolumeSw.cpp b/audio/aidl/default/volume/VolumeSw.cpp
index 796c332..44cac44 100644
--- a/audio/aidl/default/volume/VolumeSw.cpp
+++ b/audio/aidl/default/volume/VolumeSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_VolumeSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_VolumeSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 5ed8e1f..a128f7c 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -23,11 +23,13 @@
#include <unordered_map>
#include <vector>
+#include <Utils.h>
#include <aidl/android/hardware/audio/effect/IEffect.h>
#include <aidl/android/hardware/audio/effect/IFactory.h>
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
#include <android/binder_auto_utils.h>
#include <fmq/AidlMessageQueue.h>
+#include <gtest/gtest.h>
#include <system/audio_effects/aidl_effects_utils.h>
#include "AudioHalBinderServiceUtil.h"
@@ -134,7 +136,7 @@
static void allocateInputData(const Parameter::Common common, std::unique_ptr<DataMQ>& mq,
std::vector<float>& buffer) {
ASSERT_NE(mq, nullptr);
- auto frameSize = android::hardware::audio::common::getFrameSizeInBytes(
+ auto frameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
common.input.base.format, common.input.base.channelMask);
const size_t floatsToWrite = mq->availableToWrite();
ASSERT_NE(0UL, floatsToWrite);
diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp
index b07edb7..8c448a8 100644
--- a/audio/aidl/vts/ModuleConfig.cpp
+++ b/audio/aidl/vts/ModuleConfig.cpp
@@ -27,6 +27,7 @@
using namespace android;
using namespace std::chrono_literals;
+using aidl::android::hardware::audio::common::isBitPositionFlagSet;
using aidl::android::hardware::audio::core::IModule;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceType;
@@ -43,7 +44,6 @@
using aidl::android::media::audio::common::AudioProfile;
using aidl::android::media::audio::common::AudioUsage;
using aidl::android::media::audio::common::Int;
-using android::hardware::audio::common::isBitPositionFlagSet;
// static
std::optional<AudioOffloadInfo> ModuleConfig::generateOffloadInfoIfNeeded(
diff --git a/audio/aidl/vts/TestUtils.h b/audio/aidl/vts/TestUtils.h
index 4c1d42c..72ca56f 100644
--- a/audio/aidl/vts/TestUtils.h
+++ b/audio/aidl/vts/TestUtils.h
@@ -21,7 +21,7 @@
#include <iostream>
#include <android/binder_auto_utils.h>
-#include <gtest/gtest_pred_impl.h>
+#include <gtest/gtest.h>
namespace android::hardware::audio::common::testing {
diff --git a/audio/aidl/vts/VtsHalAECTargetTest.cpp b/audio/aidl/vts/VtsHalAECTargetTest.cpp
index 39be191..2d36cbb 100644
--- a/audio/aidl/vts/VtsHalAECTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAECTargetTest.cpp
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#include <Utils.h>
-#include <aidl/Vintf.h>
#include <algorithm>
#include <string>
#include <unordered_set>
+#include <aidl/Vintf.h>
#define LOG_TAG "VtsHalAECParamTest"
+#include <android-base/logging.h>
#include "EffectHelper.h"
#include "effect-impl/EffectTypes.h"
@@ -177,4 +177,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
index a6fc1aa..15a9374 100644
--- a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-#include <Utils.h>
#include <aidl/Vintf.h>
-
#define LOG_TAG "VtsHalAGC1ParamTest"
+#include <android-base/logging.h>
#include "EffectHelper.h"
diff --git a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
index fd3a866..140537e 100644
--- a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <Utils.h>
#include <aidl/Vintf.h>
-#include <android/binder_enums.h>
-#include <unordered_set>
-
#define LOG_TAG "VtsHalAGC2ParamTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
#include "EffectHelper.h"
@@ -200,4 +198,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
index e7f5817..e5e06eb 100644
--- a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
@@ -1,17 +1,32 @@
+/*
+ * 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 <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
-#define LOG_TAG "VtsHalAudioCore.Config"
-
-#include <Utils.h>
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/audio/core/IConfig.h>
#include <aidl/android/media/audio/common/AudioFlag.h>
#include <aidl/android/media/audio/common/AudioProductStrategyType.h>
+#define LOG_TAG "VtsHalAudioCore.Config"
+#include <android-base/logging.h>
#include "AudioHalBinderServiceUtil.h"
#include "TestUtils.h"
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index 1e0c900..5d522a3 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -54,6 +54,10 @@
using namespace android;
using aidl::android::hardware::audio::common::AudioOffloadMetadata;
+using aidl::android::hardware::audio::common::getChannelCount;
+using aidl::android::hardware::audio::common::isBitPositionFlagSet;
+using aidl::android::hardware::audio::common::isTelephonyDeviceType;
+using aidl::android::hardware::audio::common::isValidAudioMode;
using aidl::android::hardware::audio::common::PlaybackTrackMetadata;
using aidl::android::hardware::audio::common::RecordTrackMetadata;
using aidl::android::hardware::audio::common::SinkMetadata;
@@ -62,6 +66,7 @@
using aidl::android::hardware::audio::core::AudioRoute;
using aidl::android::hardware::audio::core::IBluetooth;
using aidl::android::hardware::audio::core::IBluetoothA2dp;
+using aidl::android::hardware::audio::core::IBluetoothLe;
using aidl::android::hardware::audio::core::IModule;
using aidl::android::hardware::audio::core::IStreamCommon;
using aidl::android::hardware::audio::core::IStreamIn;
@@ -99,10 +104,6 @@
using aidl::android::media::audio::common::MicrophoneDynamicInfo;
using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::Void;
-using android::hardware::audio::common::getChannelCount;
-using android::hardware::audio::common::isBitPositionFlagSet;
-using android::hardware::audio::common::isTelephonyDeviceType;
-using android::hardware::audio::common::isValidAudioMode;
using android::hardware::audio::common::StreamLogic;
using android::hardware::audio::common::StreamWorker;
using ndk::enum_range;
@@ -1070,6 +1071,8 @@
std::shared_ptr<IStreamCommon> common;
ndk::ScopedAStatus status = stream->getStreamCommon(&common);
if (!status.isOk()) return status;
+ status = common->prepareToClose();
+ if (!status.isOk()) return status;
return common->close();
}
@@ -2109,6 +2112,59 @@
}
}
+class AudioCoreBluetoothLe : public AudioCoreModuleBase,
+ public testing::TestWithParam<std::string> {
+ public:
+ void SetUp() override {
+ ASSERT_NO_FATAL_FAILURE(SetUpImpl(GetParam()));
+ ASSERT_IS_OK(module->getBluetoothLe(&bluetooth));
+ }
+
+ void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownImpl()); }
+
+ std::shared_ptr<IBluetoothLe> bluetooth;
+};
+
+TEST_P(AudioCoreBluetoothLe, SameInstance) {
+ if (bluetooth == nullptr) {
+ GTEST_SKIP() << "BluetoothLe is not supported";
+ }
+ std::shared_ptr<IBluetoothLe> bluetooth2;
+ EXPECT_IS_OK(module->getBluetoothLe(&bluetooth2));
+ ASSERT_NE(nullptr, bluetooth2.get());
+ EXPECT_EQ(bluetooth->asBinder(), bluetooth2->asBinder())
+ << "getBluetoothLe must return the same interface instance across invocations";
+}
+
+TEST_P(AudioCoreBluetoothLe, Enabled) {
+ if (bluetooth == nullptr) {
+ GTEST_SKIP() << "BluetoothLe is not supported";
+ }
+ // Since enabling LE may require having an actual device connection,
+ // limit testing to setting back the current value.
+ bool enabled;
+ ASSERT_IS_OK(bluetooth->isEnabled(&enabled));
+ EXPECT_IS_OK(bluetooth->setEnabled(enabled))
+ << "setEnabled without actual state change must not fail";
+}
+
+TEST_P(AudioCoreBluetoothLe, OffloadReconfiguration) {
+ if (bluetooth == nullptr) {
+ GTEST_SKIP() << "BluetoothLe is not supported";
+ }
+ bool isSupported;
+ ASSERT_IS_OK(bluetooth->supportsOffloadReconfiguration(&isSupported));
+ bool isSupported2;
+ ASSERT_IS_OK(bluetooth->supportsOffloadReconfiguration(&isSupported2));
+ EXPECT_EQ(isSupported, isSupported2);
+ if (isSupported) {
+ static const auto kStatuses = {EX_NONE, EX_ILLEGAL_STATE};
+ EXPECT_STATUS(kStatuses, bluetooth->reconfigureOffload({}));
+ } else {
+ EXPECT_STATUS(EX_UNSUPPORTED_OPERATION, bluetooth->reconfigureOffload({}));
+ }
+}
+
class AudioCoreTelephony : public AudioCoreModuleBase, public testing::TestWithParam<std::string> {
public:
void SetUp() override {
@@ -2302,6 +2358,26 @@
<< "when closing the stream twice";
}
+ void PrepareToCloseTwice() {
+ const auto portConfig = moduleConfig->getSingleConfigForMixPort(IOTraits<Stream>::is_input);
+ if (!portConfig.has_value()) {
+ GTEST_SKIP() << "No mix port for attached devices";
+ }
+ std::shared_ptr<IStreamCommon> heldStreamCommon;
+ {
+ WithStream<Stream> stream(portConfig.value());
+ ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames));
+ std::shared_ptr<IStreamCommon> streamCommon;
+ ASSERT_IS_OK(stream.get()->getStreamCommon(&streamCommon));
+ heldStreamCommon = streamCommon;
+ EXPECT_IS_OK(streamCommon->prepareToClose());
+ EXPECT_IS_OK(streamCommon->prepareToClose())
+ << "when calling prepareToClose second time";
+ }
+ EXPECT_STATUS(EX_ILLEGAL_STATE, heldStreamCommon->prepareToClose())
+ << "when calling prepareToClose on a closed stream";
+ }
+
void OpenAllConfigs() {
const auto allPortConfigs =
moduleConfig->getPortConfigsForMixPorts(IOTraits<Stream>::is_input);
@@ -2597,6 +2673,7 @@
}
TEST_IN_AND_OUT_STREAM(CloseTwice);
+TEST_IN_AND_OUT_STREAM(PrepareToCloseTwice);
TEST_IN_AND_OUT_STREAM(GetStreamCommon);
TEST_IN_AND_OUT_STREAM(OpenAllConfigs);
TEST_IN_AND_OUT_STREAM(OpenInvalidBufferSize);
@@ -3520,6 +3597,10 @@
testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
android::PrintInstanceNameToString);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothA2dp);
+INSTANTIATE_TEST_SUITE_P(AudioCoreBluetoothLeTest, AudioCoreBluetoothLe,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
+ android::PrintInstanceNameToString);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothLe);
INSTANTIATE_TEST_SUITE_P(AudioCoreTelephonyTest, AudioCoreTelephony,
testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
android::PrintInstanceNameToString);
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 947d30e..df66bd3 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -21,7 +21,6 @@
#include <string>
#include <vector>
-#include <Utils.h>
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/audio/effect/IEffect.h>
diff --git a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
index a1862d2..824bd9f 100644
--- a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalBassBoostTest"
-
-#include <Utils.h>
-#include <aidl/Vintf.h>
#include <limits.h>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalBassBoostTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
index 0601cc4..bd3b76b 100644
--- a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalDownmixTargetTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalDownmixTargetTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index ece07f0..0b05b17 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-#include <aidl/Vintf.h>
-
-#define LOG_TAG "VtsHalDynamicsProcessingTest"
-
#include <set>
#include <string>
-#include <unordered_map>
#include <unordered_set>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalDynamicsProcessingTest"
+#include <android-base/logging.h>
+
#include <Utils.h>
+
#include "EffectHelper.h"
using namespace android;
@@ -45,7 +45,7 @@
int32_t channelLayOut = AudioChannelLayout::LAYOUT_STEREO) {
std::tie(mFactory, mDescriptor) = pair;
mChannelLayout = channelLayOut;
- mChannelCount = ::android::hardware::audio::common::getChannelCount(
+ mChannelCount = ::aidl::android::hardware::audio::common::getChannelCount(
AudioChannelLayout::make<AudioChannelLayout::layoutMask>(mChannelLayout));
}
@@ -224,7 +224,7 @@
dpRef.get<DynamicsProcessing::inputGain>(),
dpTest.get<DynamicsProcessing::inputGain>());
}
- case DynamicsProcessing::vendorExtension: {
+ case DynamicsProcessing::vendor: {
return false;
}
}
diff --git a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
index fea41cb..a2deb7c 100644
--- a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalEnvironmentalReverbTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
-#include <unordered_set>
+#define LOG_TAG "VtsHalEnvironmentalReverbTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
index 54d00a7..9beb0a7 100644
--- a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
@@ -22,10 +22,11 @@
#include <string>
#include <vector>
-#define LOG_TAG "VtsHalEqualizerTest"
-
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
+#include <aidl/android/hardware/audio/effect/IEffect.h>
+#include <aidl/android/hardware/audio/effect/IFactory.h>
+#define LOG_TAG "VtsHalEqualizerTest"
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android/binder_interface_utils.h>
@@ -33,10 +34,6 @@
#include <android/binder_process.h>
#include <gtest/gtest.h>
-#include <Utils.h>
-#include <aidl/android/hardware/audio/effect/IEffect.h>
-#include <aidl/android/hardware/audio/effect/IFactory.h>
-
#include "AudioHalBinderServiceUtil.h"
#include "EffectHelper.h"
#include "TestUtils.h"
diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
index 6c3016e..32ebc4f 100644
--- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalHapticGeneratorTargetTest"
-
-#include <Utils.h>
-#include <aidl/Vintf.h>
-#include <android/binder_enums.h>
#include <map>
#include <utility>
#include <vector>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalHapticGeneratorTargetTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
index 75941ff..5faf7f4 100644
--- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#include <aidl/Vintf.h>
#include <string>
+#include <aidl/Vintf.h>
#define LOG_TAG "VtsHalLoudnessEnhancerTest"
+#include <android-base/logging.h>
-#include <Utils.h>
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalNSTargetTest.cpp b/audio/aidl/vts/VtsHalNSTargetTest.cpp
index 16c79e3..4fcda6b 100644
--- a/audio/aidl/vts/VtsHalNSTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalNSTargetTest.cpp
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include <Utils.h>
-#include <aidl/Vintf.h>
-#include <android/binder_enums.h>
#include <unordered_set>
-#define LOG_TAG "VtsHalNSParamTest"
-
+#include <aidl/Vintf.h>
#include <aidl/android/hardware/audio/effect/NoiseSuppression.h>
+#define LOG_TAG "VtsHalNSParamTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
@@ -171,4 +171,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
index c9c2a31..7bce9c3 100644
--- a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalPresetReverbTargetTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalPresetReverbTargetTest"
+#include <android-base/logging.h>
#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
index 8b0210c..84b980f 100644
--- a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalVirtualizerTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalVirtualizerTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
index e2625cb..e273824 100644
--- a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-#include <aidl/Vintf.h>
-
-#define LOG_TAG "VtsHalVisualizerTest"
-
-#include <Utils.h>
-#include <android/binder_enums.h>
#include <unordered_set>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalVisualizerTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
@@ -213,4 +212,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
index 44ce146..fbd10a8 100644
--- a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalVolumeTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalVolumeTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h
index ad9dee2..844a651 100644
--- a/audio/common/all-versions/default/HidlUtils.h
+++ b/audio/common/all-versions/default/HidlUtils.h
@@ -81,7 +81,7 @@
#endif
#if MAJOR_VERSION >= 7
- static constexpr char sAudioTagSeparator = ';';
+ static constexpr char sAudioTagSeparator = AUDIO_ATTRIBUTES_TAGS_SEPARATOR;
static status_t audioChannelMaskFromHal(audio_channel_mask_t halChannelMask, bool isInput,
AudioChannelMask* channelMask);
diff --git a/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp b/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
index 624538b..37c863b 100644
--- a/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
+++ b/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
@@ -169,8 +169,8 @@
__dir_stream& operator=(const __dir_stream&) = delete;
__dir_stream(__dir_stream&& other) noexcept : __stream_(other.__stream_),
- __root_(move(other.__root_)),
- __entry_(move(other.__entry_)) {
+ __root_(std::move(other.__root_)),
+ __entry_(std::move(other.__entry_)) {
other.__stream_ = nullptr;
}
@@ -252,7 +252,7 @@
error_code m_ec;
if (!__imp_->advance(m_ec)) {
- path root = move(__imp_->__root_);
+ path root = std::move(__imp_->__root_);
__imp_.reset();
if (m_ec)
err.report(m_ec, "at root \"%s\"", root);
@@ -286,7 +286,7 @@
__imp_ = make_shared<__shared_imp>();
__imp_->__options_ = opt;
- __imp_->__stack_.push(move(new_s));
+ __imp_->__stack_.push(std::move(new_s));
}
void recursive_directory_iterator::__pop(error_code* ec) {
@@ -340,7 +340,7 @@
}
if (m_ec) {
- path root = move(stack.top().__root_);
+ path root = std::move(stack.top().__root_);
__imp_.reset();
err.report(m_ec, "at root \"%s\"", root);
} else {
@@ -374,7 +374,7 @@
if (!skip_rec) {
__dir_stream new_it(curr_it.__entry_.path(), __imp_->__options_, m_ec);
if (new_it.good()) {
- __imp_->__stack_.push(move(new_it));
+ __imp_->__stack_.push(std::move(new_it));
return true;
}
}
@@ -385,7 +385,7 @@
if (ec)
ec->clear();
} else {
- path at_ent = move(curr_it.__entry_.__p_);
+ path at_ent = std::move(curr_it.__entry_.__p_);
__imp_.reset();
err.report(m_ec, "attempting recursion into \"%s\"", at_ent);
}
diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp
index dbe0314..bf6c0be 100644
--- a/automotive/evs/aidl/impl/default/Android.bp
+++ b/automotive/evs/aidl/impl/default/Android.bp
@@ -24,13 +24,56 @@
cc_binary {
name: "android.hardware.automotive.evs-aidl-default-service",
defaults: ["EvsHalDefaults"],
- local_include_dirs: ["include"],
- vintf_fragments: ["evs-default-service.xml"],
+ vintf_fragments: ["manifest_evs-default-service.xml"],
init_rc: ["evs-default-service.rc"],
vendor: true,
relative_install_path: "hw",
- srcs: ["src/*.cpp"],
- shared_libs: [
- "libbinder_ndk",
+ cflags: [
+ "-DGL_GLEXT_PROTOTYPES",
+ "-DEGL_EGLEXT_PROTOTYPES",
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-Wthread-safety",
],
+ srcs: [
+ ":libgui_frame_event_aidl",
+ "src/*.cpp"
+ ],
+ shared_libs: [
+ "android.hardware.graphics.bufferqueue@1.0",
+ "android.hardware.graphics.bufferqueue@2.0",
+ "android.hidl.token@1.0-utils",
+ "libEGL",
+ "libGLESv2",
+ "libbase",
+ "libbinder_ndk",
+ "libbufferqueueconverter",
+ "libcamera_metadata",
+ "libhardware_legacy",
+ "libhidlbase",
+ "liblog",
+ "libnativewindow",
+ "libtinyxml2",
+ "libui",
+ "libutils",
+ "libyuv",
+ ],
+ static_libs: [
+ "android.frameworks.automotive.display-V1-ndk",
+ "android.hardware.automotive.evs-V1-ndk",
+ "android.hardware.common-V2-ndk",
+ "libaidlcommonsupport",
+ "libcutils",
+ ],
+ local_include_dirs: ["include"],
+ include_dirs: ["frameworks/native/include/"],
+ required: ["evs_mock_hal_configuration.xml"],
+}
+
+prebuilt_etc {
+ name: "evs_mock_hal_configuration.xml",
+ soc_specific: true,
+ src: "resources/evs_mock_configuration.xml",
+ sub_dir: "automotive/evs",
}
diff --git a/automotive/evs/aidl/impl/default/evs-default-service.rc b/automotive/evs/aidl/impl/default/evs-default-service.rc
index ea8e689..3da41ff 100644
--- a/automotive/evs/aidl/impl/default/evs-default-service.rc
+++ b/automotive/evs/aidl/impl/default/evs-default-service.rc
@@ -1,5 +1,8 @@
service vendor.evs-hal-default /vendor/bin/hw/android.hardware.automotive.evs-aidl-default-service
class early_hal
- user automotive_evs
- group automotive_evs
+ priority -20
+ user graphics
+ group automotive_evs camera
+ onrestart restart cardisplayproxyd
+ onrestart restart evsmanagerd
disabled
diff --git a/automotive/evs/aidl/impl/default/evs-default-service.xml b/automotive/evs/aidl/impl/default/evs-default-service.xml
deleted file mode 100644
index 96ff9f6..0000000
--- a/automotive/evs/aidl/impl/default/evs-default-service.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="device">
- <hal format="aidl">
- <name>android.hardware.automotive.evs</name>
- <transport>hwbinder</transport>
- <version>1</version>
- <interface>
- <name>IEvsEnumerator</name>
- <instance>hw/0</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/automotive/evs/aidl/impl/default/include/ConfigManager.h b/automotive/evs/aidl/impl/default/include/ConfigManager.h
new file mode 100644
index 0000000..1d5fe77
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/include/ConfigManager.h
@@ -0,0 +1,384 @@
+/*
+ * 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 "ConfigManagerUtil.h"
+
+#include <aidl/android/hardware/automotive/evs/CameraParam.h>
+#include <aidl/android/hardware/graphics/common/PixelFormat.h>
+#include <android-base/logging.h>
+#include <system/camera_metadata.h>
+
+#include <tinyxml2.h>
+
+#include <string>
+#include <string_view>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+/*
+ * Please note that this is different from what is defined in
+ * libhardware/modules/camera/3_4/metadata/types.h; this has one additional
+ * field to store a framerate.
+ */
+typedef struct {
+ int id;
+ int width;
+ int height;
+ ::aidl::android::hardware::graphics::common::PixelFormat format;
+ int type;
+ int framerate;
+} StreamConfiguration;
+
+class ConfigManager final {
+ public:
+ static std::unique_ptr<ConfigManager> Create();
+ ConfigManager(const ConfigManager&) = delete;
+ ConfigManager& operator=(const ConfigManager&) = delete;
+
+ /* Camera device's capabilities and metadata */
+ class CameraInfo {
+ public:
+ CameraInfo() : characteristics(nullptr) {}
+
+ virtual ~CameraInfo();
+
+ /* Allocate memory for camera_metadata_t */
+ bool allocate(size_t entry_cap, size_t data_cap) {
+ if (characteristics != nullptr) {
+ LOG(ERROR) << "Camera metadata is already allocated";
+ return false;
+ }
+
+ characteristics = allocate_camera_metadata(entry_cap, data_cap);
+ return characteristics != nullptr;
+ }
+
+ /*
+ * List of supported controls that the primary client can program.
+ * Paraemters are stored with its valid range
+ */
+ std::unordered_map<::aidl::android::hardware::automotive::evs::CameraParam,
+ std::tuple<int32_t, int32_t, int32_t>>
+ controls;
+
+ /*
+ * List of supported output stream configurations.
+ */
+ std::unordered_map<int32_t, StreamConfiguration> streamConfigurations;
+
+ /*
+ * Internal storage for camera metadata. Each entry holds a pointer to
+ * data and number of elements
+ */
+ std::unordered_map<camera_metadata_tag_t, std::pair<void*, size_t>> cameraMetadata;
+
+ /* Camera module characteristics */
+ camera_metadata_t* characteristics;
+ };
+
+ class CameraGroupInfo : public CameraInfo {
+ public:
+ CameraGroupInfo() {}
+
+ /* ID of member camera devices */
+ std::unordered_set<std::string> devices;
+
+ /* The capture operation of member camera devices are synchronized */
+ int32_t synchronized = 0;
+ };
+
+ class SystemInfo {
+ public:
+ /* number of available cameras */
+ int32_t numCameras = 0;
+ };
+
+ class DisplayInfo {
+ public:
+ /*
+ * List of supported input stream configurations.
+ */
+ std::unordered_map<int32_t, StreamConfiguration> streamConfigurations;
+ };
+
+ /*
+ * Return system information
+ *
+ * @return SystemInfo
+ * Constant reference of SystemInfo.
+ */
+ const SystemInfo& getSystemInfo() {
+ std::unique_lock<std::mutex> lock(mConfigLock);
+ mConfigCond.wait(lock, [this] { return mIsReady; });
+ return mSystemInfo;
+ }
+
+ /*
+ * Return a list of camera identifiers
+ *
+ * This function assumes that it is not being called frequently.
+ *
+ * @return std::vector<std::string>
+ * A vector that contains unique camera device identifiers.
+ */
+ std::vector<std::string> getCameraIdList() {
+ std::unique_lock<std::mutex> lock(mConfigLock);
+ mConfigCond.wait(lock, [this] { return mIsReady; });
+
+ std::vector<std::string> aList;
+ aList.reserve(mCameraInfo.size());
+ for (auto&& v : mCameraInfo) {
+ aList.push_back(v.first);
+ }
+
+ return aList;
+ }
+
+ /*
+ * Return a list of camera group identifiers
+ *
+ * This function assumes that it is not being called frequently.
+ *
+ * @return std::vector<std::string>
+ * A vector that contains unique camera device identifiers.
+ */
+ std::vector<std::string> getCameraGroupIdList() {
+ std::unique_lock<std::mutex> lock(mConfigLock);
+ mConfigCond.wait(lock, [this] { return mIsReady; });
+
+ std::vector<std::string> aList;
+ aList.reserve(mCameraGroups.size());
+ for (auto&& v : mCameraGroups) {
+ aList.push_back(v.first);
+ }
+
+ return aList;
+ }
+
+ /*
+ * Return a pointer to the camera group
+ *
+ * @return CameraGroup
+ * A pointer to a camera group identified by a given id.
+ */
+ std::unique_ptr<CameraGroupInfo>& getCameraGroupInfo(const std::string& gid) {
+ std::unique_lock<std::mutex> lock(mConfigLock);
+ mConfigCond.wait(lock, [this] { return mIsReady; });
+
+ return mCameraGroups[gid];
+ }
+
+ /*
+ * Return a camera metadata
+ *
+ * @param cameraId
+ * Unique camera node identifier in string
+ *
+ * @return unique_ptr<CameraInfo>
+ * A pointer to CameraInfo that is associated with a given camera
+ * ID. This returns a null pointer if this does not recognize a
+ * given camera identifier.
+ */
+ std::unique_ptr<CameraInfo>& getCameraInfo(const std::string& cameraId) noexcept {
+ std::unique_lock<std::mutex> lock(mConfigLock);
+ mConfigCond.wait(lock, [this] { return mIsReady; });
+
+ return mCameraInfo[cameraId];
+ }
+
+ /*
+ * Tell whether the configuration data is ready to be used
+ *
+ * @return bool
+ * True if configuration data is ready to be consumed.
+ */
+ bool isReady() const { return mIsReady; }
+
+ private:
+ /* Constructors */
+ ConfigManager() : mBinaryFilePath("") {}
+
+ static std::string_view sConfigDefaultPath;
+ static std::string_view sConfigOverridePath;
+
+ /* System configuration */
+ SystemInfo mSystemInfo;
+
+ /* Internal data structure for camera device information */
+ std::unordered_map<std::string, std::unique_ptr<CameraInfo>> mCameraInfo;
+
+ /* Internal data structure for camera device information */
+ std::unordered_map<std::string, std::unique_ptr<DisplayInfo>> mDisplayInfo;
+
+ /* Camera groups are stored in <groud id, CameraGroup> hash map */
+ std::unordered_map<std::string, std::unique_ptr<CameraGroupInfo>> mCameraGroups;
+
+ /*
+ * Camera positions are stored in <position, camera id set> hash map.
+ * The position must be one of front, rear, left, and right.
+ */
+ std::unordered_map<std::string, std::unordered_set<std::string>> mCameraPosition;
+
+ /* Configuration data lock */
+ mutable std::mutex mConfigLock;
+
+ /*
+ * This condition is signalled when it completes a configuration data
+ * preparation.
+ */
+ std::condition_variable mConfigCond;
+
+ /* A path to a binary configuration file */
+ const char* mBinaryFilePath;
+
+ /* Configuration data readiness */
+ bool mIsReady = false;
+
+ /*
+ * Parse a given EVS configuration file and store the information
+ * internally.
+ *
+ * @return bool
+ * True if it completes parsing a file successfully.
+ */
+ bool readConfigDataFromXML() noexcept;
+
+ /*
+ * read the information of the vehicle
+ *
+ * @param aSysElem
+ * A pointer to "system" XML element.
+ */
+ void readSystemInfo(const tinyxml2::XMLElement* const aSysElem);
+
+ /*
+ * read the information of camera devices
+ *
+ * @param aCameraElem
+ * A pointer to "camera" XML element that may contain multiple
+ * "device" elements.
+ */
+ void readCameraInfo(const tinyxml2::XMLElement* const aCameraElem);
+
+ /*
+ * read display device information
+ *
+ * @param aDisplayElem
+ * A pointer to "display" XML element that may contain multiple
+ * "device" elements.
+ */
+ void readDisplayInfo(const tinyxml2::XMLElement* const aDisplayElem);
+
+ /*
+ * read camera device information
+ *
+ * @param aCamera
+ * A pointer to CameraInfo that will be completed by this
+ * method.
+ * aDeviceElem
+ * A pointer to "device" XML element that contains camera module
+ * capability info and its characteristics.
+ *
+ * @return bool
+ * Return false upon any failure in reading and processing camera
+ * device information.
+ */
+ bool readCameraDeviceInfo(CameraInfo* aCamera, const tinyxml2::XMLElement* aDeviceElem);
+
+ /*
+ * read camera metadata
+ *
+ * @param aCapElem
+ * A pointer to "cap" XML element.
+ * @param aCamera
+ * A pointer to CameraInfo that is being filled by this method.
+ * @param dataSize
+ * Required size of memory to store camera metadata found in this
+ * method. This is calculated in this method and returned to the
+ * caller for camera_metadata allocation.
+ *
+ * @return size_t
+ * Number of camera metadata entries
+ */
+ size_t readCameraCapabilities(const tinyxml2::XMLElement* const aCapElem, CameraInfo* aCamera,
+ size_t& dataSize);
+
+ /*
+ * read camera metadata
+ *
+ * @param aParamElem
+ * A pointer to "characteristics" XML element.
+ * @param aCamera
+ * A pointer to CameraInfo that is being filled by this method.
+ * @param dataSize
+ * Required size of memory to store camera metadata found in this
+ * method.
+ *
+ * @return size_t
+ * Number of camera metadata entries
+ */
+ size_t readCameraMetadata(const tinyxml2::XMLElement* const aParamElem, CameraInfo* aCamera,
+ size_t& dataSize);
+
+ /*
+ * construct camera_metadata_t from camera capabilities and metadata
+ *
+ * @param aCamera
+ * A pointer to CameraInfo that is being filled by this method.
+ * @param totalEntries
+ * Number of camera metadata entries to be added.
+ * @param totalDataSize
+ * Sum of sizes of camera metadata entries to be added.
+ *
+ * @return bool
+ * False if either it fails to allocate memory for camera metadata
+ * or its size is not large enough to add all found camera metadata
+ * entries.
+ */
+ bool constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries,
+ const size_t totalDataSize);
+
+ /*
+ * Read configuration data from the binary file
+ *
+ * @return bool
+ * True if it succeeds to read configuration data from a binary
+ * file.
+ */
+ bool readConfigDataFromBinary();
+
+ /*
+ * Store configuration data to the file
+ *
+ * @return bool
+ * True if it succeeds to serialize mCameraInfo to the file.
+ */
+ bool writeConfigDataToBinary();
+
+ /*
+ * debugging method to print out all XML elements and their attributes in
+ * logcat message.
+ *
+ * @param aNode
+ * A pointer to the root XML element to navigate.
+ * @param prefix
+ * A prefix to XML string.
+ */
+ void printElementNames(const tinyxml2::XMLElement* aNode, const std::string& prefix = "") const;
+};
diff --git a/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h b/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h
new file mode 100644
index 0000000..32b50d3
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/automotive/evs/CameraParam.h>
+#include <aidl/android/hardware/graphics/common/PixelFormat.h>
+#include <android-base/macros.h>
+#include <system/camera_metadata.h>
+
+#include <string>
+#include <utility>
+
+class ConfigManagerUtil final {
+ public:
+ /**
+ * Convert a given string into V4L2_CID_*
+ */
+ static bool convertToEvsCameraParam(
+ const std::string& id,
+ ::aidl::android::hardware::automotive::evs::CameraParam& camParam);
+ /**
+ * Convert a given string into android.hardware.graphics.common.PixelFormat
+ */
+ static bool convertToPixelFormat(const std::string& in,
+ ::aidl::android::hardware::graphics::common::PixelFormat& out);
+ /**
+ * Convert a given string into corresponding camera metadata data tag defined in
+ * system/media/camera/include/system/camera_metadata_tags.h
+ */
+ static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag);
+ /**
+ * Convert a given string into a floating value array
+ */
+ static float* convertFloatArray(const char* sz, const char* vals, size_t& count,
+ const char delimiter = ',');
+ /**
+ * Trim a string
+ */
+ static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v");
+
+ /**
+ * Convert a given string to corresponding camera capabilities
+ */
+ static bool convertToCameraCapability(
+ const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap);
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ConfigManagerUtil);
+};
diff --git a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h
deleted file mode 100644
index 03a578d..0000000
--- a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h
+++ /dev/null
@@ -1,66 +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.
- */
-
-#ifndef android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_
-#define android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_
-
-#include <aidl/android/hardware/automotive/evs/BnEvsEnumerator.h>
-
-namespace aidl::android::hardware::automotive::evs::implementation {
-
-class DefaultEvsEnumerator final
- : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator {
- ::ndk::ScopedAStatus isHardware(bool* flag) override;
- ::ndk::ScopedAStatus openCamera(
- const std::string& cameraId,
- const ::aidl::android::hardware::automotive::evs::Stream& streamConfig,
- std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>* obj) override;
- ::ndk::ScopedAStatus closeCamera(
- const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>& obj)
- override;
- ::ndk::ScopedAStatus getCameraList(
- std::vector<::aidl::android::hardware::automotive::evs::CameraDesc>* list) override;
- ::ndk::ScopedAStatus getStreamList(
- const ::aidl::android::hardware::automotive::evs::CameraDesc& desc,
- std::vector<::aidl::android::hardware::automotive::evs::Stream>* _aidl_return) override;
- ::ndk::ScopedAStatus openDisplay(
- int32_t displayId,
- std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>* obj) override;
- ::ndk::ScopedAStatus closeDisplay(
- const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& obj)
- override;
- ::ndk::ScopedAStatus getDisplayIdList(std::vector<uint8_t>* list) override;
- ::ndk::ScopedAStatus getDisplayState(
- ::aidl::android::hardware::automotive::evs::DisplayState* state) override;
- ::ndk::ScopedAStatus registerStatusCallback(
- const std::shared_ptr<
- ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback>&
- callback) override;
- ::ndk::ScopedAStatus openUltrasonicsArray(
- const std::string& id,
- std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>* obj)
- override;
- ::ndk::ScopedAStatus closeUltrasonicsArray(
- const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>&
- arr) override;
- ::ndk::ScopedAStatus getUltrasonicsArrayList(
- std::vector<::aidl::android::hardware::automotive::evs::UltrasonicsArrayDesc>* list)
- override;
-};
-
-} // namespace aidl::android::hardware::automotive::evs::implementation
-
-#endif // android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_
diff --git a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h
new file mode 100644
index 0000000..b11dd3e
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h
@@ -0,0 +1,134 @@
+/*
+ * 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 "ConfigManager.h"
+#include "EvsGlDisplay.h"
+#include "EvsMockCamera.h"
+
+#include <aidl/android/frameworks/automotive/display/ICarDisplayProxy.h>
+#include <aidl/android/hardware/automotive/evs/BnEvsEnumerator.h>
+#include <aidl/android/hardware/automotive/evs/CameraDesc.h>
+#include <aidl/android/hardware/automotive/evs/DeviceStatusType.h>
+#include <aidl/android/hardware/automotive/evs/IEvsCamera.h>
+#include <aidl/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.h>
+#include <aidl/android/hardware/automotive/evs/Stream.h>
+#include <utils/Thread.h>
+
+#include <atomic>
+#include <mutex>
+#include <optional>
+#include <thread>
+#include <unordered_map>
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator {
+ public:
+ // Methods from ::aidl::android::hardware::automotive::evs::IEvsEnumerator
+ ndk::ScopedAStatus isHardware(bool* flag) override;
+ ndk::ScopedAStatus openCamera(const std::string& cameraId, const evs::Stream& streamConfig,
+ std::shared_ptr<evs::IEvsCamera>* obj) override;
+ ndk::ScopedAStatus closeCamera(const std::shared_ptr<evs::IEvsCamera>& obj) override;
+ ndk::ScopedAStatus getCameraList(std::vector<evs::CameraDesc>* _aidl_return) override;
+ ndk::ScopedAStatus getStreamList(const evs::CameraDesc& desc,
+ std::vector<evs::Stream>* _aidl_return) override;
+ ndk::ScopedAStatus openDisplay(int32_t displayId,
+ std::shared_ptr<evs::IEvsDisplay>* obj) override;
+ ndk::ScopedAStatus closeDisplay(const std::shared_ptr<evs::IEvsDisplay>& obj) override;
+ ndk::ScopedAStatus getDisplayIdList(std::vector<uint8_t>* list) override;
+ ndk::ScopedAStatus getDisplayState(evs::DisplayState* state) override;
+ ndk::ScopedAStatus registerStatusCallback(
+ const std::shared_ptr<evs::IEvsEnumeratorStatusCallback>& callback) override;
+ ndk::ScopedAStatus openUltrasonicsArray(
+ const std::string& id, std::shared_ptr<evs::IEvsUltrasonicsArray>* obj) override;
+ ndk::ScopedAStatus closeUltrasonicsArray(
+ const std::shared_ptr<evs::IEvsUltrasonicsArray>& obj) override;
+ ndk::ScopedAStatus getUltrasonicsArrayList(
+ std::vector<evs::UltrasonicsArrayDesc>* list) override;
+
+ // Implementation details
+ EvsEnumerator(const std::shared_ptr<
+ ::aidl::android::frameworks::automotive::display::ICarDisplayProxy>&
+ proxyService);
+
+ void notifyDeviceStatusChange(const std::string_view& deviceName, evs::DeviceStatusType type);
+
+ private:
+ struct CameraRecord {
+ evs::CameraDesc desc;
+ std::weak_ptr<EvsMockCamera> activeInstance;
+
+ CameraRecord(const char* cameraId) : desc() { desc.id = cameraId; }
+ };
+
+ class ActiveDisplays {
+ public:
+ struct DisplayInfo {
+ int32_t id{-1};
+ std::weak_ptr<EvsGlDisplay> displayWeak;
+ uintptr_t internalDisplayRawAddr;
+ };
+
+ std::optional<DisplayInfo> popDisplay(int32_t id);
+
+ std::optional<DisplayInfo> popDisplay(const std::shared_ptr<IEvsDisplay>& display);
+
+ std::unordered_map<int32_t, DisplayInfo> getAllDisplays();
+
+ bool tryInsert(int32_t id, const std::shared_ptr<EvsGlDisplay>& display);
+
+ private:
+ std::mutex mMutex;
+ std::unordered_map<int32_t, DisplayInfo> mIdToDisplay GUARDED_BY(mMutex);
+ std::unordered_map<uintptr_t, int32_t> mDisplayToId GUARDED_BY(mMutex);
+ };
+
+ bool checkPermission();
+ void closeCamera_impl(const std::shared_ptr<evs::IEvsCamera>& pCamera,
+ const std::string& cameraId);
+
+ static bool qualifyCaptureDevice(const char* deviceName);
+ static CameraRecord* findCameraById(const std::string& cameraId);
+ static void enumerateCameras();
+ static bool addCaptureDevice(const std::string& deviceName);
+ static bool removeCaptureDevice(const std::string& deviceName);
+ // Enumerate available displays and return an id of the internal display
+ static uint64_t enumerateDisplays();
+
+ static ActiveDisplays& mutableActiveDisplays();
+
+ // NOTE: All members values are static so that all clients operate on the same state
+ // That is to say, this is effectively a singleton despite the fact that HIDL
+ // constructs a new instance for each client.
+ // Because our server has a single thread in the thread pool, these values are
+ // never accessed concurrently despite potentially having multiple instance objects
+ // using them.
+ static std::unordered_map<std::string, CameraRecord> sCameraList;
+ // Object destructs if client dies.
+ static std::mutex sLock; // Mutex on shared camera device list.
+ static std::condition_variable sCameraSignal; // Signal on camera device addition.
+ static std::unique_ptr<ConfigManager> sConfigManager; // ConfigManager
+ static std::shared_ptr<::aidl::android::frameworks::automotive::display::ICarDisplayProxy>
+ sDisplayProxy;
+ static std::unordered_map<uint8_t, uint64_t> sDisplayPortList;
+
+ uint64_t mInternalDisplayId;
+ std::shared_ptr<evs::IEvsEnumeratorStatusCallback> mCallback;
+};
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h
new file mode 100644
index 0000000..ceabd9e
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h
@@ -0,0 +1,89 @@
+/*
+ * 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 "GlWrapper.h"
+
+#include <aidl/android/frameworks/automotive/display/ICarDisplayProxy.h>
+#include <aidl/android/hardware/automotive/evs/BnEvsDisplay.h>
+#include <aidl/android/hardware/automotive/evs/BufferDesc.h>
+#include <aidl/android/hardware/automotive/evs/DisplayDesc.h>
+#include <aidl/android/hardware/automotive/evs/DisplayState.h>
+
+#include <thread>
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+class EvsGlDisplay final : public BnEvsDisplay {
+ public:
+ // Methods from ::aidl::android::hardware::automotive::evs::IEvsDisplay
+ // follow.
+ ndk::ScopedAStatus getDisplayInfo(evs::DisplayDesc* _aidl_return) override;
+ ndk::ScopedAStatus getDisplayState(evs::DisplayState* _aidl_return) override;
+ ndk::ScopedAStatus getTargetBuffer(evs::BufferDesc* _aidl_return) override;
+ ndk::ScopedAStatus returnTargetBufferForDisplay(const evs::BufferDesc& buffer) override;
+ ndk::ScopedAStatus setDisplayState(evs::DisplayState state) override;
+
+ // Implementation details
+ EvsGlDisplay(const std::shared_ptr<automotivedisplay::ICarDisplayProxy>& service,
+ uint64_t displayId);
+ virtual ~EvsGlDisplay() override;
+
+ // This gets called if another caller "steals" ownership of the display
+ void forceShutdown();
+
+ private:
+ // A graphics buffer into which we'll store images. This member variable
+ // will be protected by semaphores.
+ struct BufferRecord {
+ ::aidl::android::hardware::graphics::common::HardwareBufferDescription description;
+ buffer_handle_t handle;
+ int fingerprint;
+ } mBuffer;
+
+ // State of a rendering thread
+ enum RenderThreadStates {
+ STOPPED = 0,
+ STOPPING = 1,
+ RUN = 2,
+ };
+
+ uint64_t mDisplayId;
+ evs::DisplayDesc mInfo;
+ evs::DisplayState mRequestedState GUARDED_BY(mLock) = evs::DisplayState::NOT_VISIBLE;
+ std::shared_ptr<automotivedisplay::ICarDisplayProxy> mDisplayProxy;
+
+ GlWrapper mGlWrapper;
+ mutable std::mutex mLock;
+
+ // This tells us whether or not our buffer is in use. Protected by
+ // semaphores.
+ bool mBufferBusy = false;
+
+ // Variables to synchronize a rendering thread w/ main and binder threads
+ std::thread mRenderThread;
+ RenderThreadStates mState GUARDED_BY(mLock) = STOPPED;
+ bool mBufferReady = false;
+ void renderFrames();
+ bool initializeGlContextLocked() REQUIRES(mLock);
+
+ std::condition_variable mBufferReadyToUse;
+ std::condition_variable mBufferReadyToRender;
+ std::condition_variable mBufferDone;
+};
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h
new file mode 100644
index 0000000..46d47e7
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h
@@ -0,0 +1,152 @@
+/*
+ * 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 "ConfigManager.h"
+
+#include <aidl/android/hardware/automotive/evs/BnEvsCamera.h>
+#include <aidl/android/hardware/automotive/evs/BufferDesc.h>
+#include <aidl/android/hardware/automotive/evs/CameraDesc.h>
+#include <aidl/android/hardware/automotive/evs/CameraParam.h>
+#include <aidl/android/hardware/automotive/evs/EvsResult.h>
+#include <aidl/android/hardware/automotive/evs/IEvsCameraStream.h>
+#include <aidl/android/hardware/automotive/evs/IEvsDisplay.h>
+#include <aidl/android/hardware/automotive/evs/ParameterRange.h>
+#include <aidl/android/hardware/automotive/evs/Stream.h>
+// #include <android-base/result.h>
+#include <android/hardware_buffer.h>
+#include <ui/GraphicBuffer.h>
+
+#include <functional>
+#include <thread>
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+class EvsMockCamera : public evs::BnEvsCamera {
+ // This prevents constructors from direct access while it allows this class to
+ // be instantiated via ndk::SharedRefBase::make<>.
+ private:
+ struct Sigil {
+ explicit Sigil() = default;
+ };
+
+ public:
+ // Methods from ::android::hardware::automotive::evs::IEvsCamera follow.
+ ndk::ScopedAStatus doneWithFrame(const std::vector<evs::BufferDesc>& buffers) override;
+ ndk::ScopedAStatus forcePrimaryClient(
+ const std::shared_ptr<evs::IEvsDisplay>& display) override;
+ ndk::ScopedAStatus getCameraInfo(evs::CameraDesc* _aidl_return) override;
+ ndk::ScopedAStatus getExtendedInfo(int32_t opaqueIdentifier,
+ std::vector<uint8_t>* value) override;
+ ndk::ScopedAStatus getIntParameter(evs::CameraParam id, std::vector<int32_t>* value) override;
+ ndk::ScopedAStatus getIntParameterRange(evs::CameraParam id,
+ evs::ParameterRange* _aidl_return) override;
+ ndk::ScopedAStatus getParameterList(std::vector<evs::CameraParam>* _aidl_return) override;
+ ndk::ScopedAStatus getPhysicalCameraInfo(const std::string& deviceId,
+ evs::CameraDesc* _aidl_return) override;
+ ndk::ScopedAStatus importExternalBuffers(const std::vector<evs::BufferDesc>& buffers,
+ int32_t* _aidl_return) override;
+ ndk::ScopedAStatus pauseVideoStream() override;
+ ndk::ScopedAStatus resumeVideoStream() override;
+ ndk::ScopedAStatus setExtendedInfo(int32_t opaqueIdentifier,
+ const std::vector<uint8_t>& opaqueValue) override;
+ ndk::ScopedAStatus setIntParameter(evs::CameraParam id, int32_t value,
+ std::vector<int32_t>* effectiveValue) override;
+ ndk::ScopedAStatus setPrimaryClient() override;
+ ndk::ScopedAStatus setMaxFramesInFlight(int32_t bufferCount) override;
+ ndk::ScopedAStatus startVideoStream(
+ const std::shared_ptr<evs::IEvsCameraStream>& receiver) override;
+ ndk::ScopedAStatus stopVideoStream() override;
+ ndk::ScopedAStatus unsetPrimaryClient() override;
+
+ static std::shared_ptr<EvsMockCamera> Create(const char* deviceName);
+ static std::shared_ptr<EvsMockCamera> Create(
+ const char* deviceName, std::unique_ptr<ConfigManager::CameraInfo>& camInfo,
+ const evs::Stream* streamCfg = nullptr);
+ EvsMockCamera(const EvsMockCamera&) = delete;
+ EvsMockCamera& operator=(const EvsMockCamera&) = delete;
+
+ virtual ~EvsMockCamera() override;
+ void shutdown();
+
+ const evs::CameraDesc& getDesc() { return mDescription; }
+
+ // Constructors
+ EvsMockCamera(Sigil sigil, const char* deviceName,
+ std::unique_ptr<ConfigManager::CameraInfo>& camInfo);
+
+ private:
+ // These three functions are expected to be called while mAccessLock is held
+ bool setAvailableFrames_Locked(unsigned bufferCount);
+ unsigned increaseAvailableFrames_Locked(unsigned numToAdd);
+ unsigned decreaseAvailableFrames_Locked(unsigned numToRemove);
+
+ void generateFrames();
+ void fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc);
+ void returnBufferLocked(const uint32_t bufferId);
+ ndk::ScopedAStatus stopVideoStream_impl();
+
+ CameraDesc mDescription = {}; // The properties of this camera
+
+ std::thread mCaptureThread; // The thread we'll use to synthesize frames
+
+ // The callback used to deliver each frame
+ std::shared_ptr<evs::IEvsCameraStream> mStream;
+
+ // Horizontal pixel count in the buffers
+ uint32_t mWidth = 0;
+ // Vertical pixel count in the buffers
+ uint32_t mHeight = 0;
+ // Values from android_pixel_format_t
+ uint32_t mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
+ // Values from from Gralloc.h
+ uint64_t mUsage =
+ GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_OFTEN;
+ // Bytes per line in the buffers
+ uint32_t mStride = 0;
+
+ struct BufferRecord {
+ buffer_handle_t handle;
+ bool inUse;
+
+ explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false){};
+ };
+
+ std::vector<BufferRecord> mBuffers; // Graphics buffers to transfer images
+ unsigned mFramesAllowed; // How many buffers are we currently using
+ unsigned mFramesInUse; // How many buffers are currently outstanding
+
+ enum StreamStateValues {
+ STOPPED,
+ RUNNING,
+ STOPPING,
+ DEAD,
+ };
+ StreamStateValues mStreamState;
+
+ // Synchronization necessary to deconflict mCaptureThread from the main service thread
+ std::mutex mAccessLock;
+
+ // Static camera module information
+ std::unique_ptr<ConfigManager::CameraInfo>& mCameraInfo;
+
+ // For the extended info
+ std::unordered_map<uint32_t, std::vector<uint8_t>> mExtInfo;
+ std::unordered_map<CameraParam, int32_t> mParams;
+};
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/include/GlWrapper.h b/automotive/evs/aidl/impl/default/include/GlWrapper.h
new file mode 100644
index 0000000..adb250c
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/include/GlWrapper.h
@@ -0,0 +1,79 @@
+/*
+ * 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 <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
+#include <aidl/android/frameworks/automotive/display/ICarDisplayProxy.h>
+#include <aidl/android/hardware/automotive/evs/BufferDesc.h>
+#include <android-base/logging.h>
+#include <bufferqueueconverter/BufferQueueConverter.h>
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+namespace automotivedisplay = ::aidl::android::frameworks::automotive::display;
+
+class GlWrapper {
+ public:
+ GlWrapper() : mSurfaceHolder(::android::SurfaceHolderUniquePtr(nullptr, nullptr)) {}
+ bool initialize(const std::shared_ptr<automotivedisplay::ICarDisplayProxy>& svc,
+ uint64_t displayId);
+ void shutdown();
+
+ bool updateImageTexture(
+ buffer_handle_t handle,
+ const ::aidl::android::hardware::graphics::common::HardwareBufferDescription&
+ description);
+ void renderImageToScreen();
+
+ void showWindow(const std::shared_ptr<automotivedisplay::ICarDisplayProxy>& svc,
+ uint64_t displayId);
+ void hideWindow(const std::shared_ptr<automotivedisplay::ICarDisplayProxy>& svc,
+ uint64_t displayId);
+
+ unsigned getWidth() { return mWidth; };
+ unsigned getHeight() { return mHeight; };
+
+ private:
+ ::android::sp<::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer>
+ mGfxBufferProducer;
+
+ EGLDisplay mDisplay;
+ EGLSurface mSurface;
+ EGLContext mContext;
+
+ unsigned mWidth = 0;
+ unsigned mHeight = 0;
+
+ EGLImageKHR mKHRimage = EGL_NO_IMAGE_KHR;
+
+ GLuint mTextureMap = 0;
+ GLuint mShaderProgram = 0;
+
+ // Opaque handle for a native hardware buffer defined in
+ // frameworks/native/opengl/include/EGL/eglplatform.h
+ ANativeWindow* mWindow;
+
+ // Pointer to a Surface wrapper.
+ ::android::SurfaceHolderUniquePtr mSurfaceHolder;
+};
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml b/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml
new file mode 100644
index 0000000..8480651
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml
@@ -0,0 +1,6 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.automotive.evs</name>
+ <fqname>IEvsEnumerator/hw/0</fqname>
+ </hal>
+</manifest>
diff --git a/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml
new file mode 100644
index 0000000..6cbc18e
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml
@@ -0,0 +1,68 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<!-- Exterior View System Example Configuration
+
+ Android Automotive axes are used to define coordinates.
+ See https://source.android.com/devices/sensors/sensor-types#auto_axes
+
+ Use evs_configuration.dtd with xmllint tool, to validate XML configuration file
+-->
+
+<configuration>
+ <!-- system configuration -->
+ <system>
+ <!-- number of cameras available to EVS -->
+ <num_cameras value='1'/>
+ </system>
+
+ <!-- camera information -->
+ <camera>
+ <!-- camera device starts -->
+ <device id='/dev/video10' position='rear'>
+ <caps>
+ <!-- list of supported controls -->
+ <supported_controls>
+ <control name='BRIGHTNESS' min='0' max='255'/>
+ <control name='CONTRAST' min='0' max='255'/>
+ </supported_controls>
+
+ <stream id='0' width='640' height='360' format='RGBA_8888' framerate='30'/>
+ </caps>
+
+ <!-- list of parameters -->
+ <characteristics>
+ <!-- Camera intrinsic calibration matrix. See
+ https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#LENS_INTRINSIC_CALIBRATION
+ -->
+ <parameter
+ name='LENS_INTRINSIC_CALIBRATION'
+ type='float'
+ size='5'
+ value='0.0,0.0,0.0,0.0,0.0'
+ />
+ </characteristics>
+ </device>
+ </camera>
+ <display>
+ <device id='display0' position='driver'>
+ <caps>
+ <!-- list of supported inpu stream configurations -->
+ <stream id='0' width='1280' height='720' format='RGBA_8888' framerate='30'/>
+ </caps>
+ </device>
+ </display>
+</configuration>
+
diff --git a/automotive/evs/aidl/impl/default/src/ConfigManager.cpp b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp
new file mode 100644
index 0000000..da791ed
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp
@@ -0,0 +1,992 @@
+/*
+ * 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 "ConfigManager.h"
+
+#include <android-base/parseint.h>
+#include <hardware/gralloc.h>
+#include <utils/SystemClock.h>
+
+#include <fstream>
+#include <sstream>
+#include <string_view>
+#include <thread>
+
+namespace {
+
+using ::aidl::android::hardware::automotive::evs::CameraParam;
+using ::aidl::android::hardware::graphics::common::PixelFormat;
+using ::tinyxml2::XMLAttribute;
+using ::tinyxml2::XMLDocument;
+using ::tinyxml2::XMLElement;
+
+} // namespace
+
+std::string_view ConfigManager::sConfigDefaultPath =
+ "/vendor/etc/automotive/evs/evs_mock_hal_configuration.xml";
+std::string_view ConfigManager::sConfigOverridePath =
+ "/vendor/etc/automotive/evs/evs_configuration_override.xml";
+
+void ConfigManager::printElementNames(const XMLElement* rootElem, const std::string& prefix) const {
+ const XMLElement* curElem = rootElem;
+
+ while (curElem != nullptr) {
+ LOG(VERBOSE) << "[ELEM] " << prefix << curElem->Name();
+ const XMLAttribute* curAttr = curElem->FirstAttribute();
+ while (curAttr) {
+ LOG(VERBOSE) << "[ATTR] " << prefix << curAttr->Name() << ": " << curAttr->Value();
+ curAttr = curAttr->Next();
+ }
+
+ /* recursively go down to descendants */
+ printElementNames(curElem->FirstChildElement(), prefix + "\t");
+
+ curElem = curElem->NextSiblingElement();
+ }
+}
+
+void ConfigManager::readCameraInfo(const XMLElement* const aCameraElem) {
+ if (aCameraElem == nullptr) {
+ LOG(WARNING) << "XML file does not have required camera element";
+ return;
+ }
+
+ const XMLElement* curElem = aCameraElem->FirstChildElement();
+ while (curElem != nullptr) {
+ if (!strcmp(curElem->Name(), "group")) {
+ /* camera group identifier */
+ const char* id = curElem->FindAttribute("id")->Value();
+
+ /* create a camera group to be filled */
+ CameraGroupInfo* aCamera = new CameraGroupInfo();
+
+ /* read camera device information */
+ if (!readCameraDeviceInfo(aCamera, curElem)) {
+ LOG(WARNING) << "Failed to read a camera information of " << id;
+ delete aCamera;
+ continue;
+ }
+
+ /* camera group synchronization */
+ const char* sync = curElem->FindAttribute("synchronized")->Value();
+ if (!strcmp(sync, "CALIBRATED")) {
+ aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED;
+ } else if (!strcmp(sync, "APPROXIMATE")) {
+ aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE;
+ } else {
+ aCamera->synchronized = 0; // Not synchronized
+ }
+
+ /* add a group to hash map */
+ mCameraGroups.insert_or_assign(id, std::unique_ptr<CameraGroupInfo>(aCamera));
+ } else if (!std::strcmp(curElem->Name(), "device")) {
+ /* camera unique identifier */
+ const char* id = curElem->FindAttribute("id")->Value();
+
+ /* camera mount location */
+ const char* pos = curElem->FindAttribute("position")->Value();
+
+ /* create a camera device to be filled */
+ CameraInfo* aCamera = new CameraInfo();
+
+ /* read camera device information */
+ if (!readCameraDeviceInfo(aCamera, curElem)) {
+ LOG(WARNING) << "Failed to read a camera information of " << id;
+ delete aCamera;
+ continue;
+ }
+
+ /* store read camera module information */
+ mCameraInfo.insert_or_assign(id, std::unique_ptr<CameraInfo>(aCamera));
+
+ /* assign a camera device to a position group */
+ mCameraPosition[pos].insert(id);
+ } else {
+ /* ignore other device types */
+ LOG(DEBUG) << "Unknown element " << curElem->Name() << " is ignored";
+ }
+
+ curElem = curElem->NextSiblingElement();
+ }
+}
+
+bool ConfigManager::readCameraDeviceInfo(CameraInfo* aCamera, const XMLElement* aDeviceElem) {
+ if (aCamera == nullptr || aDeviceElem == nullptr) {
+ return false;
+ }
+
+ /* size information to allocate camera_metadata_t */
+ size_t totalEntries = 0;
+ size_t totalDataSize = 0;
+
+ /* read device capabilities */
+ totalEntries +=
+ readCameraCapabilities(aDeviceElem->FirstChildElement("caps"), aCamera, totalDataSize);
+
+ /* read camera metadata */
+ totalEntries += readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"), aCamera,
+ totalDataSize);
+
+ /* construct camera_metadata_t */
+ if (!constructCameraMetadata(aCamera, totalEntries, totalDataSize)) {
+ LOG(WARNING) << "Either failed to allocate memory or "
+ << "allocated memory was not large enough";
+ }
+
+ return true;
+}
+
+size_t ConfigManager::readCameraCapabilities(const XMLElement* const aCapElem, CameraInfo* aCamera,
+ size_t& dataSize) {
+ if (aCapElem == nullptr || aCamera == nullptr) {
+ return 0;
+ }
+
+ std::string token;
+ const XMLElement* curElem = nullptr;
+
+ /* a list of supported camera parameters/controls */
+ curElem = aCapElem->FirstChildElement("supported_controls");
+ if (curElem != nullptr) {
+ const XMLElement* ctrlElem = curElem->FirstChildElement("control");
+ while (ctrlElem != nullptr) {
+ const char* nameAttr = ctrlElem->FindAttribute("name")->Value();
+ int32_t minVal = INT32_MIN, maxVal = INT32_MAX;
+ if (!android::base::ParseInt(ctrlElem->FindAttribute("min")->Value(), &minVal)) {
+ LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("min")->Value();
+ }
+
+ if (!android::base::ParseInt(ctrlElem->FindAttribute("max")->Value(), &maxVal)) {
+ LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("max")->Value();
+ }
+
+ int32_t stepVal = 1;
+ const XMLAttribute* stepAttr = ctrlElem->FindAttribute("step");
+ if (stepAttr != nullptr) {
+ if (!android::base::ParseInt(stepAttr->Value(), &stepVal)) {
+ LOG(WARNING) << "Failed to parse " << stepAttr->Value();
+ }
+ }
+
+ CameraParam aParam;
+ if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr, aParam)) {
+ aCamera->controls.insert_or_assign(
+ aParam, std::move(std::make_tuple(minVal, maxVal, stepVal)));
+ }
+
+ ctrlElem = ctrlElem->NextSiblingElement("control");
+ }
+ }
+
+ /* a list of camera stream configurations */
+ curElem = aCapElem->FirstChildElement("stream");
+ while (curElem != nullptr) {
+ /* read 5 attributes */
+ const XMLAttribute* idAttr = curElem->FindAttribute("id");
+ const XMLAttribute* widthAttr = curElem->FindAttribute("width");
+ const XMLAttribute* heightAttr = curElem->FindAttribute("height");
+ const XMLAttribute* fmtAttr = curElem->FindAttribute("format");
+ const XMLAttribute* fpsAttr = curElem->FindAttribute("framerate");
+
+ int32_t id = -1;
+ int32_t framerate = 0;
+ if (!android::base::ParseInt(idAttr->Value(), &id)) {
+ LOG(WARNING) << "Failed to parse " << idAttr->Value();
+ }
+ if (fpsAttr != nullptr) {
+ if (!android::base::ParseInt(fpsAttr->Value(), &framerate)) {
+ LOG(WARNING) << "Failed to parse " << fpsAttr->Value();
+ }
+ }
+
+ PixelFormat format = PixelFormat::UNSPECIFIED;
+ if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) {
+ StreamConfiguration cfg = {
+ .id = id,
+ .format = format,
+ .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,
+ .framerate = framerate,
+ };
+
+ if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) ||
+ !android::base::ParseInt(heightAttr->Value(), &cfg.height)) {
+ LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and "
+ << heightAttr->Value();
+ }
+ aCamera->streamConfigurations.insert_or_assign(id, cfg);
+ }
+
+ curElem = curElem->NextSiblingElement("stream");
+ }
+
+ dataSize = calculate_camera_metadata_entry_data_size(
+ get_camera_metadata_tag_type(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS),
+ aCamera->streamConfigurations.size() * sizeof(StreamConfiguration));
+
+ /* a single camera metadata entry contains multiple stream configurations */
+ return dataSize > 0 ? 1 : 0;
+}
+
+size_t ConfigManager::readCameraMetadata(const XMLElement* const aParamElem, CameraInfo* aCamera,
+ size_t& dataSize) {
+ if (aParamElem == nullptr || aCamera == nullptr) {
+ return 0;
+ }
+
+ const XMLElement* curElem = aParamElem->FirstChildElement("parameter");
+ size_t numEntries = 0;
+ camera_metadata_tag_t tag;
+ while (curElem != nullptr) {
+ if (ConfigManagerUtil::convertToMetadataTag(curElem->FindAttribute("name")->Value(), tag)) {
+ switch (tag) {
+ case ANDROID_LENS_DISTORTION:
+ case ANDROID_LENS_POSE_ROTATION:
+ case ANDROID_LENS_POSE_TRANSLATION:
+ case ANDROID_LENS_INTRINSIC_CALIBRATION: {
+ /* float[] */
+ size_t count = 0;
+ void* data = ConfigManagerUtil::convertFloatArray(
+ curElem->FindAttribute("size")->Value(),
+ curElem->FindAttribute("value")->Value(), count);
+
+ aCamera->cameraMetadata.insert_or_assign(tag, std::make_pair(data, count));
+
+ ++numEntries;
+ dataSize += calculate_camera_metadata_entry_data_size(
+ get_camera_metadata_tag_type(tag), count);
+
+ break;
+ }
+
+ case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: {
+ camera_metadata_enum_android_request_available_capabilities_t* data =
+ new camera_metadata_enum_android_request_available_capabilities_t[1];
+ if (ConfigManagerUtil::convertToCameraCapability(
+ curElem->FindAttribute("value")->Value(), *data)) {
+ aCamera->cameraMetadata.insert_or_assign(tag,
+ std::make_pair((void*)data, 1));
+
+ ++numEntries;
+ dataSize += calculate_camera_metadata_entry_data_size(
+ get_camera_metadata_tag_type(tag), 1);
+ }
+ break;
+ }
+
+ case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: {
+ /* a comma-separated list of physical camera devices */
+ size_t len = strlen(curElem->FindAttribute("value")->Value());
+ char* data = new char[len + 1];
+ memcpy(data, curElem->FindAttribute("value")->Value(), len * sizeof(char));
+
+ /* replace commas with null char */
+ char* p = data;
+ while (*p != '\0') {
+ if (*p == ',') {
+ *p = '\0';
+ }
+ ++p;
+ }
+
+ aCamera->cameraMetadata.insert_or_assign(tag,
+ std::make_pair((void*)data, len + 1));
+
+ ++numEntries;
+ dataSize += calculate_camera_metadata_entry_data_size(
+ get_camera_metadata_tag_type(tag), len);
+ break;
+ }
+
+ /* TODO(b/140416878): add vendor-defined/custom tag support */
+ default:
+ LOG(WARNING) << "Parameter " << curElem->FindAttribute("name")->Value()
+ << " is not supported";
+ break;
+ }
+ } else {
+ LOG(WARNING) << "Unsupported metadata tag " << curElem->FindAttribute("name")->Value()
+ << " is found.";
+ }
+
+ curElem = curElem->NextSiblingElement("parameter");
+ }
+
+ return numEntries;
+}
+
+bool ConfigManager::constructCameraMetadata(CameraInfo* aCamera, size_t totalEntries,
+ size_t totalDataSize) {
+ if (aCamera == nullptr || !aCamera->allocate(totalEntries, totalDataSize)) {
+ LOG(ERROR) << "Failed to allocate memory for camera metadata";
+ return false;
+ }
+
+ const size_t numStreamConfigs = aCamera->streamConfigurations.size();
+ std::unique_ptr<int32_t[]> data(new int32_t[sizeof(StreamConfiguration) * numStreamConfigs]);
+ int32_t* ptr = data.get();
+ for (auto& cfg : aCamera->streamConfigurations) {
+ memcpy(ptr, &cfg.second, sizeof(StreamConfiguration));
+ ptr += sizeof(StreamConfiguration);
+ }
+ int32_t err = add_camera_metadata_entry(
+ aCamera->characteristics, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, data.get(),
+ numStreamConfigs * sizeof(StreamConfiguration));
+
+ if (err) {
+ LOG(ERROR) << "Failed to add stream configurations to metadata, ignored";
+ return false;
+ }
+
+ bool success = true;
+ for (auto& [tag, entry] : aCamera->cameraMetadata) {
+ /* try to add new camera metadata entry */
+ int32_t err =
+ add_camera_metadata_entry(aCamera->characteristics, tag, entry.first, entry.second);
+ if (err) {
+ LOG(ERROR) << "Failed to add an entry with a tag, " << std::hex << tag;
+
+ /* may exceed preallocated capacity */
+ LOG(ERROR) << "Camera metadata has "
+ << get_camera_metadata_entry_count(aCamera->characteristics) << " / "
+ << get_camera_metadata_entry_capacity(aCamera->characteristics)
+ << " entries and "
+ << get_camera_metadata_data_count(aCamera->characteristics) << " / "
+ << get_camera_metadata_data_capacity(aCamera->characteristics)
+ << " bytes are filled.";
+ LOG(ERROR) << "\tCurrent metadata entry requires "
+ << calculate_camera_metadata_entry_data_size(tag, entry.second) << " bytes.";
+
+ success = false;
+ }
+ }
+
+ LOG(VERBOSE) << "Camera metadata has "
+ << get_camera_metadata_entry_count(aCamera->characteristics) << " / "
+ << get_camera_metadata_entry_capacity(aCamera->characteristics) << " entries and "
+ << get_camera_metadata_data_count(aCamera->characteristics) << " / "
+ << get_camera_metadata_data_capacity(aCamera->characteristics)
+ << " bytes are filled.";
+ return success;
+}
+
+void ConfigManager::readSystemInfo(const XMLElement* const aSysElem) {
+ if (aSysElem == nullptr) {
+ return;
+ }
+
+ /*
+ * Please note that this function assumes that a given system XML element
+ * and its child elements follow DTD. If it does not, it will cause a
+ * segmentation fault due to the failure of finding expected attributes.
+ */
+
+ /* read number of cameras available in the system */
+ const XMLElement* xmlElem = aSysElem->FirstChildElement("num_cameras");
+ if (xmlElem != nullptr) {
+ if (!android::base::ParseInt(xmlElem->FindAttribute("value")->Value(),
+ &mSystemInfo.numCameras)) {
+ LOG(WARNING) << "Failed to parse " << xmlElem->FindAttribute("value")->Value();
+ }
+ }
+}
+
+void ConfigManager::readDisplayInfo(const XMLElement* const aDisplayElem) {
+ if (aDisplayElem == nullptr) {
+ LOG(WARNING) << "XML file does not have required camera element";
+ return;
+ }
+
+ const XMLElement* curDev = aDisplayElem->FirstChildElement("device");
+ while (curDev != nullptr) {
+ const char* id = curDev->FindAttribute("id")->Value();
+ std::unique_ptr<DisplayInfo> dpy(new DisplayInfo());
+ if (dpy == nullptr) {
+ LOG(ERROR) << "Failed to allocate memory for DisplayInfo";
+ return;
+ }
+
+ const XMLElement* cap = curDev->FirstChildElement("caps");
+ if (cap != nullptr) {
+ const XMLElement* curStream = cap->FirstChildElement("stream");
+ while (curStream != nullptr) {
+ /* read 4 attributes */
+ const XMLAttribute* idAttr = curStream->FindAttribute("id");
+ const XMLAttribute* widthAttr = curStream->FindAttribute("width");
+ const XMLAttribute* heightAttr = curStream->FindAttribute("height");
+ const XMLAttribute* fmtAttr = curStream->FindAttribute("format");
+
+ int32_t id = -1;
+ if (!android::base::ParseInt(idAttr->Value(), &id)) {
+ LOG(WARNING) << "Failed to parse " << idAttr->Value();
+ }
+ PixelFormat format = PixelFormat::UNSPECIFIED;
+ if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) {
+ StreamConfiguration cfg = {
+ .id = id,
+ .format = format,
+ .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT,
+ };
+ if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) ||
+ !android::base::ParseInt(heightAttr->Value(), &cfg.height)) {
+ LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and "
+ << heightAttr->Value();
+ }
+ dpy->streamConfigurations.insert_or_assign(id, cfg);
+ }
+
+ curStream = curStream->NextSiblingElement("stream");
+ }
+ }
+
+ mDisplayInfo.insert_or_assign(id, std::move(dpy));
+ curDev = curDev->NextSiblingElement("device");
+ }
+
+ return;
+}
+
+bool ConfigManager::readConfigDataFromXML() noexcept {
+ XMLDocument xmlDoc;
+
+ const int64_t parsingStart = android::elapsedRealtimeNano();
+
+ /* load and parse a configuration file */
+ xmlDoc.LoadFile(sConfigOverridePath.data());
+ if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) {
+ xmlDoc.LoadFile(sConfigDefaultPath.data());
+ if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) {
+ LOG(ERROR) << "Failed to load and/or parse a configuration file, " << xmlDoc.ErrorStr();
+ return false;
+ }
+ }
+
+ /* retrieve the root element */
+ const XMLElement* rootElem = xmlDoc.RootElement();
+ if (std::strcmp(rootElem->Name(), "configuration") != 0) {
+ LOG(ERROR) << "A configuration file is not in the required format. "
+ << "See /etc/automotive/evs/evs_configuration.dtd";
+ return false;
+ }
+
+ std::unique_lock<std::mutex> lock(mConfigLock);
+
+ /*
+ * parse camera information; this needs to be done before reading system
+ * information
+ */
+ readCameraInfo(rootElem->FirstChildElement("camera"));
+
+ /* parse system information */
+ readSystemInfo(rootElem->FirstChildElement("system"));
+
+ /* parse display information */
+ readDisplayInfo(rootElem->FirstChildElement("display"));
+
+ /* configuration data is ready to be consumed */
+ mIsReady = true;
+
+ /* notify that configuration data is ready */
+ lock.unlock();
+ mConfigCond.notify_all();
+
+ const int64_t parsingEnd = android::elapsedRealtimeNano();
+ LOG(INFO) << "Parsing configuration file takes " << std::scientific
+ << (double)(parsingEnd - parsingStart) / 1000000.0 << " ms.";
+
+ return true;
+}
+
+bool ConfigManager::readConfigDataFromBinary() {
+ /* Temporary buffer to hold configuration data read from a binary file */
+ char mBuffer[1024];
+
+ std::fstream srcFile;
+ const int64_t readStart = android::elapsedRealtimeNano();
+
+ srcFile.open(mBinaryFilePath, std::fstream::in | std::fstream::binary);
+ if (!srcFile) {
+ LOG(ERROR) << "Failed to open a source binary file, " << mBinaryFilePath;
+ return false;
+ }
+
+ std::unique_lock<std::mutex> lock(mConfigLock);
+ mIsReady = false;
+
+ /* read configuration data into the internal buffer */
+ srcFile.read(mBuffer, sizeof(mBuffer));
+ LOG(VERBOSE) << __FUNCTION__ << ": " << srcFile.gcount() << " bytes are read.";
+ char* p = mBuffer;
+ size_t sz = 0;
+
+ /* read number of camera group information entries */
+ const size_t ngrps = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+
+ /* read each camera information entry */
+ for (size_t cidx = 0; cidx < ngrps; ++cidx) {
+ /* read camera identifier */
+ std::string cameraId = *(reinterpret_cast<std::string*>(p));
+ p += sizeof(std::string);
+
+ /* size of camera_metadata_t */
+ const size_t num_entry = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+ const size_t num_data = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+
+ /* create CameraInfo and add it to hash map */
+ std::unique_ptr<ConfigManager::CameraGroupInfo> aCamera;
+ if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) {
+ LOG(ERROR) << "Failed to create new CameraInfo object";
+ mCameraInfo.clear();
+ return false;
+ }
+
+ /* controls */
+ typedef struct {
+ CameraParam cid;
+ int32_t min;
+ int32_t max;
+ int32_t step;
+ } CameraCtrl;
+ sz = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+ CameraCtrl* ptr = reinterpret_cast<CameraCtrl*>(p);
+ for (size_t idx = 0; idx < sz; ++idx) {
+ CameraCtrl temp = *ptr++;
+ aCamera->controls.insert_or_assign(
+ temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step)));
+ }
+ p = reinterpret_cast<char*>(ptr);
+
+ /* stream configurations */
+ sz = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+ int32_t* i32_ptr = reinterpret_cast<int32_t*>(p);
+ for (size_t idx = 0; idx < sz; ++idx) {
+ const int32_t id = *i32_ptr++;
+
+ StreamConfiguration temp;
+ memcpy(&temp, i32_ptr, sizeof(StreamConfiguration));
+ i32_ptr += sizeof(StreamConfiguration);
+ aCamera->streamConfigurations.insert_or_assign(id, temp);
+ }
+ p = reinterpret_cast<char*>(i32_ptr);
+
+ /* synchronization */
+ aCamera->synchronized = *(reinterpret_cast<int32_t*>(p));
+ p += sizeof(int32_t);
+
+ for (size_t idx = 0; idx < num_entry; ++idx) {
+ /* Read camera metadata entries */
+ camera_metadata_tag_t tag = *reinterpret_cast<camera_metadata_tag_t*>(p);
+ p += sizeof(camera_metadata_tag_t);
+ const size_t count = *reinterpret_cast<size_t*>(p);
+ p += sizeof(size_t);
+
+ const int32_t type = get_camera_metadata_tag_type(tag);
+ switch (type) {
+ case TYPE_BYTE: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(uint8_t);
+ break;
+ }
+ case TYPE_INT32: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(int32_t);
+ break;
+ }
+ case TYPE_FLOAT: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(float);
+ break;
+ }
+ case TYPE_INT64: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(int64_t);
+ break;
+ }
+ case TYPE_DOUBLE: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(double);
+ break;
+ }
+ case TYPE_RATIONAL:
+ p += count * sizeof(camera_metadata_rational_t);
+ break;
+ default:
+ LOG(WARNING) << "Type " << type << " is unknown; "
+ << "data may be corrupted.";
+ break;
+ }
+ }
+
+ mCameraInfo.insert_or_assign(cameraId, std::move(aCamera));
+ }
+
+ /* read number of camera information entries */
+ const size_t ncams = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+
+ /* read each camera information entry */
+ for (size_t cidx = 0; cidx < ncams; ++cidx) {
+ /* read camera identifier */
+ std::string cameraId = *(reinterpret_cast<std::string*>(p));
+ p += sizeof(std::string);
+
+ /* size of camera_metadata_t */
+ const size_t num_entry = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+ const size_t num_data = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+
+ /* create CameraInfo and add it to hash map */
+ std::unique_ptr<ConfigManager::CameraInfo> aCamera;
+ if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) {
+ LOG(ERROR) << "Failed to create new CameraInfo object";
+ mCameraInfo.clear();
+ return false;
+ }
+
+ /* controls */
+ typedef struct {
+ CameraParam cid;
+ int32_t min;
+ int32_t max;
+ int32_t step;
+ } CameraCtrl;
+ sz = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+ CameraCtrl* ptr = reinterpret_cast<CameraCtrl*>(p);
+ for (size_t idx = 0; idx < sz; ++idx) {
+ CameraCtrl temp = *ptr++;
+ aCamera->controls.insert_or_assign(
+ temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step)));
+ }
+ p = reinterpret_cast<char*>(ptr);
+
+ /* stream configurations */
+ sz = *(reinterpret_cast<size_t*>(p));
+ p += sizeof(size_t);
+ int32_t* i32_ptr = reinterpret_cast<int32_t*>(p);
+ for (size_t idx = 0; idx < sz; ++idx) {
+ const int32_t id = *i32_ptr++;
+
+ StreamConfiguration temp;
+ memcpy(&temp, i32_ptr, sizeof(StreamConfiguration));
+ i32_ptr += sizeof(StreamConfiguration);
+ aCamera->streamConfigurations.insert_or_assign(id, temp);
+ }
+ p = reinterpret_cast<char*>(i32_ptr);
+
+ for (size_t idx = 0; idx < num_entry; ++idx) {
+ /* Read camera metadata entries */
+ camera_metadata_tag_t tag = *reinterpret_cast<camera_metadata_tag_t*>(p);
+ p += sizeof(camera_metadata_tag_t);
+ const size_t count = *reinterpret_cast<size_t*>(p);
+ p += sizeof(size_t);
+
+ const int32_t type = get_camera_metadata_tag_type(tag);
+ switch (type) {
+ case TYPE_BYTE: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(uint8_t);
+ break;
+ }
+ case TYPE_INT32: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(int32_t);
+ break;
+ }
+ case TYPE_FLOAT: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(float);
+ break;
+ }
+ case TYPE_INT64: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(int64_t);
+ break;
+ }
+ case TYPE_DOUBLE: {
+ add_camera_metadata_entry(aCamera->characteristics, tag, p, count);
+ p += count * sizeof(double);
+ break;
+ }
+ case TYPE_RATIONAL:
+ p += count * sizeof(camera_metadata_rational_t);
+ break;
+ default:
+ LOG(WARNING) << "Type " << type << " is unknown; "
+ << "data may be corrupted.";
+ break;
+ }
+ }
+
+ mCameraInfo.insert_or_assign(cameraId, std::move(aCamera));
+ }
+
+ mIsReady = true;
+
+ /* notify that configuration data is ready */
+ lock.unlock();
+ mConfigCond.notify_all();
+
+ int64_t readEnd = android::elapsedRealtimeNano();
+ LOG(INFO) << __FUNCTION__ << " takes " << std::scientific
+ << (double)(readEnd - readStart) / 1000000.0 << " ms.";
+
+ return true;
+}
+
+bool ConfigManager::writeConfigDataToBinary() {
+ std::fstream outFile;
+
+ const int64_t writeStart = android::elapsedRealtimeNano();
+
+ outFile.open(mBinaryFilePath, std::fstream::out | std::fstream::binary);
+ if (!outFile) {
+ LOG(ERROR) << "Failed to open a destination binary file, " << mBinaryFilePath;
+ return false;
+ }
+
+ /* lock a configuration data while it's being written to the filesystem */
+ std::lock_guard<std::mutex> lock(mConfigLock);
+
+ /* write camera group information */
+ size_t sz = mCameraGroups.size();
+ outFile.write(reinterpret_cast<const char*>(&sz), sizeof(size_t));
+ for (auto&& [camId, camInfo] : mCameraGroups) {
+ LOG(INFO) << "Storing camera group " << camId;
+
+ /* write a camera identifier string */
+ outFile.write(reinterpret_cast<const char*>(&camId), sizeof(std::string));
+
+ /* controls */
+ sz = camInfo->controls.size();
+ outFile.write(reinterpret_cast<const char*>(&sz), sizeof(size_t));
+ for (auto&& [ctrl, range] : camInfo->controls) {
+ outFile.write(reinterpret_cast<const char*>(&ctrl), sizeof(CameraParam));
+ outFile.write(reinterpret_cast<const char*>(&std::get<0>(range)), sizeof(int32_t));
+ outFile.write(reinterpret_cast<const char*>(&std::get<1>(range)), sizeof(int32_t));
+ outFile.write(reinterpret_cast<const char*>(&std::get<2>(range)), sizeof(int32_t));
+ }
+
+ /* stream configurations */
+ sz = camInfo->streamConfigurations.size();
+ outFile.write(reinterpret_cast<const char*>(&sz), sizeof(size_t));
+ for (auto&& [sid, cfg] : camInfo->streamConfigurations) {
+ outFile.write(reinterpret_cast<const char*>(sid), sizeof(int32_t));
+ outFile.write(reinterpret_cast<const char*>(&cfg), sizeof(cfg));
+ }
+
+ /* synchronization */
+ outFile.write(reinterpret_cast<const char*>(&camInfo->synchronized), sizeof(int32_t));
+
+ /* size of camera_metadata_t */
+ size_t num_entry = 0;
+ size_t num_data = 0;
+ if (camInfo->characteristics != nullptr) {
+ num_entry = get_camera_metadata_entry_count(camInfo->characteristics);
+ num_data = get_camera_metadata_data_count(camInfo->characteristics);
+ }
+ outFile.write(reinterpret_cast<const char*>(&num_entry), sizeof(size_t));
+ outFile.write(reinterpret_cast<const char*>(&num_data), sizeof(size_t));
+
+ /* write each camera metadata entry */
+ if (num_entry > 0) {
+ camera_metadata_entry_t entry;
+ for (size_t idx = 0; idx < num_entry; ++idx) {
+ if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) {
+ LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx;
+ outFile.close();
+ return false;
+ }
+
+ outFile.write(reinterpret_cast<const char*>(&entry.tag), sizeof(entry.tag));
+ outFile.write(reinterpret_cast<const char*>(&entry.count), sizeof(entry.count));
+
+ int32_t type = get_camera_metadata_tag_type(entry.tag);
+ switch (type) {
+ case TYPE_BYTE:
+ outFile.write(reinterpret_cast<const char*>(entry.data.u8),
+ sizeof(uint8_t) * entry.count);
+ break;
+ case TYPE_INT32:
+ outFile.write(reinterpret_cast<const char*>(entry.data.i32),
+ sizeof(int32_t) * entry.count);
+ break;
+ case TYPE_FLOAT:
+ outFile.write(reinterpret_cast<const char*>(entry.data.f),
+ sizeof(float) * entry.count);
+ break;
+ case TYPE_INT64:
+ outFile.write(reinterpret_cast<const char*>(entry.data.i64),
+ sizeof(int64_t) * entry.count);
+ break;
+ case TYPE_DOUBLE:
+ outFile.write(reinterpret_cast<const char*>(entry.data.d),
+ sizeof(double) * entry.count);
+ break;
+ case TYPE_RATIONAL:
+ [[fallthrough]];
+ default:
+ LOG(WARNING) << "Type " << type << " is not supported.";
+ break;
+ }
+ }
+ }
+ }
+
+ /* write camera device information */
+ sz = mCameraInfo.size();
+ outFile.write(reinterpret_cast<const char*>(&sz), sizeof(size_t));
+ for (auto&& [camId, camInfo] : mCameraInfo) {
+ LOG(INFO) << "Storing camera " << camId;
+
+ /* write a camera identifier string */
+ outFile.write(reinterpret_cast<const char*>(&camId), sizeof(std::string));
+
+ /* controls */
+ sz = camInfo->controls.size();
+ outFile.write(reinterpret_cast<const char*>(&sz), sizeof(size_t));
+ for (auto& [ctrl, range] : camInfo->controls) {
+ outFile.write(reinterpret_cast<const char*>(&ctrl), sizeof(CameraParam));
+ outFile.write(reinterpret_cast<const char*>(&std::get<0>(range)), sizeof(int32_t));
+ outFile.write(reinterpret_cast<const char*>(&std::get<1>(range)), sizeof(int32_t));
+ outFile.write(reinterpret_cast<const char*>(&std::get<2>(range)), sizeof(int32_t));
+ }
+
+ /* stream configurations */
+ sz = camInfo->streamConfigurations.size();
+ outFile.write(reinterpret_cast<const char*>(&sz), sizeof(size_t));
+ for (auto&& [sid, cfg] : camInfo->streamConfigurations) {
+ outFile.write(reinterpret_cast<const char*>(sid), sizeof(int32_t));
+ outFile.write(reinterpret_cast<const char*>(&cfg), sizeof(cfg));
+ }
+
+ /* size of camera_metadata_t */
+ size_t num_entry = 0;
+ size_t num_data = 0;
+ if (camInfo->characteristics != nullptr) {
+ num_entry = get_camera_metadata_entry_count(camInfo->characteristics);
+ num_data = get_camera_metadata_data_count(camInfo->characteristics);
+ }
+ outFile.write(reinterpret_cast<const char*>(&num_entry), sizeof(size_t));
+ outFile.write(reinterpret_cast<const char*>(&num_data), sizeof(size_t));
+
+ /* write each camera metadata entry */
+ if (num_entry > 0) {
+ camera_metadata_entry_t entry;
+ for (size_t idx = 0; idx < num_entry; ++idx) {
+ if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) {
+ LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx;
+ outFile.close();
+ return false;
+ }
+
+ outFile.write(reinterpret_cast<const char*>(&entry.tag), sizeof(entry.tag));
+ outFile.write(reinterpret_cast<const char*>(&entry.count), sizeof(entry.count));
+
+ int32_t type = get_camera_metadata_tag_type(entry.tag);
+ switch (type) {
+ case TYPE_BYTE:
+ outFile.write(reinterpret_cast<const char*>(entry.data.u8),
+ sizeof(uint8_t) * entry.count);
+ break;
+ case TYPE_INT32:
+ outFile.write(reinterpret_cast<const char*>(entry.data.i32),
+ sizeof(int32_t) * entry.count);
+ break;
+ case TYPE_FLOAT:
+ outFile.write(reinterpret_cast<const char*>(entry.data.f),
+ sizeof(float) * entry.count);
+ break;
+ case TYPE_INT64:
+ outFile.write(reinterpret_cast<const char*>(entry.data.i64),
+ sizeof(int64_t) * entry.count);
+ break;
+ case TYPE_DOUBLE:
+ outFile.write(reinterpret_cast<const char*>(entry.data.d),
+ sizeof(double) * entry.count);
+ break;
+ case TYPE_RATIONAL:
+ [[fallthrough]];
+ default:
+ LOG(WARNING) << "Type " << type << " is not supported.";
+ break;
+ }
+ }
+ }
+ }
+
+ outFile.close();
+ int64_t writeEnd = android::elapsedRealtimeNano();
+ LOG(INFO) << __FUNCTION__ << " takes " << std::scientific
+ << (double)(writeEnd - writeStart) / 1000000.0 << " ms.";
+
+ return true;
+}
+
+std::unique_ptr<ConfigManager> ConfigManager::Create() {
+ std::unique_ptr<ConfigManager> cfgMgr(new ConfigManager());
+
+ /*
+ * Read a configuration from XML file
+ *
+ * If this is too slow, ConfigManager::readConfigDataFromBinary() and
+ * ConfigManager::writeConfigDataToBinary()can serialize CameraInfo object
+ * to the filesystem and construct CameraInfo instead; this was
+ * evaluated as 10x faster.
+ */
+ if (!cfgMgr->readConfigDataFromXML()) {
+ return nullptr;
+ } else {
+ return cfgMgr;
+ }
+}
+
+ConfigManager::CameraInfo::~CameraInfo() {
+ free_camera_metadata(characteristics);
+
+ for (auto&& [tag, val] : cameraMetadata) {
+ switch (tag) {
+ case ANDROID_LENS_DISTORTION:
+ case ANDROID_LENS_POSE_ROTATION:
+ case ANDROID_LENS_POSE_TRANSLATION:
+ case ANDROID_LENS_INTRINSIC_CALIBRATION: {
+ delete[] reinterpret_cast<float*>(val.first);
+ break;
+ }
+
+ case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: {
+ delete[] reinterpret_cast<
+ camera_metadata_enum_android_request_available_capabilities_t*>(val.first);
+ break;
+ }
+
+ case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: {
+ delete[] reinterpret_cast<char*>(val.first);
+ break;
+ }
+
+ default:
+ LOG(WARNING) << "Tag " << std::hex << tag << " is not supported. "
+ << "Data may be corrupted?";
+ break;
+ }
+ }
+}
diff --git a/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp b/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp
new file mode 100644
index 0000000..e5fe6ef
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp
@@ -0,0 +1,155 @@
+/*
+ * 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 "ConfigManagerUtil.h"
+
+#include <android-base/logging.h>
+#include <android-base/parsedouble.h>
+#include <android-base/parseint.h>
+#include <linux/videodev2.h>
+
+#include <sstream>
+#include <string>
+
+#include <system/graphics-base-v1.0.h>
+
+using ::aidl::android::hardware::automotive::evs::CameraParam;
+using ::aidl::android::hardware::graphics::common::PixelFormat;
+
+bool ConfigManagerUtil::convertToEvsCameraParam(const std::string& id, CameraParam& camParam) {
+ std::string trimmed = ConfigManagerUtil::trimString(id);
+ bool success = true;
+
+ if (!trimmed.compare("BRIGHTNESS")) {
+ camParam = CameraParam::BRIGHTNESS;
+ } else if (!trimmed.compare("CONTRAST")) {
+ camParam = CameraParam::CONTRAST;
+ } else if (!trimmed.compare("AUTOGAIN")) {
+ camParam = CameraParam::AUTOGAIN;
+ } else if (!trimmed.compare("GAIN")) {
+ camParam = CameraParam::GAIN;
+ } else if (!trimmed.compare("AUTO_WHITE_BALANCE")) {
+ camParam = CameraParam::AUTO_WHITE_BALANCE;
+ } else if (!trimmed.compare("WHITE_BALANCE_TEMPERATURE")) {
+ camParam = CameraParam::WHITE_BALANCE_TEMPERATURE;
+ } else if (!trimmed.compare("SHARPNESS")) {
+ camParam = CameraParam::SHARPNESS;
+ } else if (!trimmed.compare("AUTO_EXPOSURE")) {
+ camParam = CameraParam::AUTO_EXPOSURE;
+ } else if (!trimmed.compare("ABSOLUTE_EXPOSURE")) {
+ camParam = CameraParam::ABSOLUTE_EXPOSURE;
+ } else if (!trimmed.compare("ABSOLUTE_FOCUS")) {
+ camParam = CameraParam::ABSOLUTE_FOCUS;
+ } else if (!trimmed.compare("AUTO_FOCUS")) {
+ camParam = CameraParam::AUTO_FOCUS;
+ } else if (!trimmed.compare("ABSOLUTE_ZOOM")) {
+ camParam = CameraParam::ABSOLUTE_ZOOM;
+ } else {
+ success = false;
+ }
+
+ return success;
+}
+
+bool ConfigManagerUtil::convertToPixelFormat(const std::string& in, PixelFormat& out) {
+ std::string trimmed = ConfigManagerUtil::trimString(in);
+ bool success = true;
+
+ if (!trimmed.compare("RGBA_8888")) {
+ out = PixelFormat::RGBA_8888;
+ } else if (!trimmed.compare("YCRCB_420_SP")) {
+ out = PixelFormat::YCRCB_420_SP;
+ } else if (!trimmed.compare("YCBCR_422_I")) {
+ out = PixelFormat::YCBCR_422_I;
+ } else {
+ out = PixelFormat::UNSPECIFIED;
+ success = false;
+ }
+
+ return success;
+}
+
+bool ConfigManagerUtil::convertToMetadataTag(const char* name, camera_metadata_tag& aTag) {
+ if (!std::strcmp(name, "LENS_DISTORTION")) {
+ aTag = ANDROID_LENS_DISTORTION;
+ } else if (!std::strcmp(name, "LENS_INTRINSIC_CALIBRATION")) {
+ aTag = ANDROID_LENS_INTRINSIC_CALIBRATION;
+ } else if (!std::strcmp(name, "LENS_POSE_ROTATION")) {
+ aTag = ANDROID_LENS_POSE_ROTATION;
+ } else if (!std::strcmp(name, "LENS_POSE_TRANSLATION")) {
+ aTag = ANDROID_LENS_POSE_TRANSLATION;
+ } else if (!std::strcmp(name, "REQUEST_AVAILABLE_CAPABILITIES")) {
+ aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES;
+ } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA_PHYSICAL_IDS")) {
+ aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+bool ConfigManagerUtil::convertToCameraCapability(
+ const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap) {
+ if (!std::strcmp(name, "DEPTH_OUTPUT")) {
+ cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT;
+ } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA")) {
+ cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA;
+ } else if (!std::strcmp(name, "MONOCHROME")) {
+ cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME;
+ } else if (!std::strcmp(name, "SECURE_IMAGE_DATA")) {
+ cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+float* ConfigManagerUtil::convertFloatArray(const char* sz, const char* vals, size_t& count,
+ const char delimiter) {
+ std::string size_string(sz);
+ std::string value_string(vals);
+
+ if (!android::base::ParseUint(size_string, &count)) {
+ LOG(ERROR) << "Failed to parse " << size_string;
+ return nullptr;
+ }
+ float* result = new float[count];
+ std::stringstream values(value_string);
+
+ int32_t idx = 0;
+ std::string token;
+ while (getline(values, token, delimiter)) {
+ if (!android::base::ParseFloat(token, &result[idx++])) {
+ LOG(WARNING) << "Failed to parse " << token;
+ }
+ }
+
+ return result;
+}
+
+std::string ConfigManagerUtil::trimString(const std::string& src, const std::string& ws) {
+ const auto s = src.find_first_not_of(ws);
+ if (s == std::string::npos) {
+ return "";
+ }
+
+ const auto e = src.find_last_not_of(ws);
+ const auto r = e - s + 1;
+
+ return src.substr(s, r);
+}
diff --git a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp
deleted file mode 100644
index 5a81d05..0000000
--- a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp
+++ /dev/null
@@ -1,93 +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.
- */
-
-// TODO(b/203661081): Remove below lines to disable compiler warnings.
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-parameter"
-
-#define LOG_TAG "DefaultEvsEnumerator"
-
-#include <DefaultEvsEnumerator.h>
-
-namespace aidl::android::hardware::automotive::evs::implementation {
-
-using ::ndk::ScopedAStatus;
-
-ScopedAStatus DefaultEvsEnumerator::isHardware(bool* flag) {
- // This returns true always.
- *flag = true;
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::openCamera(const std::string& cameraId,
- const Stream& streamConfig,
- std::shared_ptr<IEvsCamera>* obj) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::closeCamera(const std::shared_ptr<IEvsCamera>& obj) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::getCameraList(std::vector<CameraDesc>* list) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::getStreamList(const CameraDesc& desc,
- std::vector<Stream>* _aidl_return) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::openDisplay(int32_t displayId,
- std::shared_ptr<IEvsDisplay>* obj) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::closeDisplay(const std::shared_ptr<IEvsDisplay>& state) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::getDisplayIdList(std::vector<uint8_t>* list) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::getDisplayState(DisplayState* state) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::registerStatusCallback(
- const std::shared_ptr<IEvsEnumeratorStatusCallback>& callback) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::openUltrasonicsArray(
- const std::string& id, std::shared_ptr<IEvsUltrasonicsArray>* obj) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::closeUltrasonicsArray(
- const std::shared_ptr<IEvsUltrasonicsArray>& obj) {
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus DefaultEvsEnumerator::getUltrasonicsArrayList(
- std::vector<UltrasonicsArrayDesc>* list) {
- return ScopedAStatus::ok();
-}
-
-} // namespace aidl::android::hardware::automotive::evs::implementation
-
-#pragma clang diagnostic pop
diff --git a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp
new file mode 100644
index 0000000..6e2405d
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp
@@ -0,0 +1,552 @@
+/*
+ * 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 "EvsEnumerator.h"
+
+#include "ConfigManager.h"
+#include "EvsGlDisplay.h"
+#include "EvsMockCamera.h"
+
+#include <aidl/android/hardware/automotive/evs/EvsResult.h>
+#include <aidl/android/hardware/graphics/common/BufferUsage.h>
+#include <aidl/android/hardware/graphics/common/PixelFormat.h>
+#include <cutils/android_filesystem_config.h>
+
+#include <set>
+#include <string_view>
+
+namespace {
+
+using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy;
+using ::aidl::android::hardware::graphics::common::BufferUsage;
+using ::ndk::ScopedAStatus;
+using std::chrono_literals::operator""s;
+
+// Constants
+constexpr std::chrono::seconds kEnumerationTimeout = 10s;
+constexpr uint64_t kInvalidDisplayId = std::numeric_limits<uint64_t>::max();
+const std::set<uid_t> kAllowedUids = {AID_AUTOMOTIVE_EVS, AID_SYSTEM, AID_ROOT};
+
+} // namespace
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+// NOTE: All members values are static so that all clients operate on the same state
+// That is to say, this is effectively a singleton despite the fact that HIDL
+// constructs a new instance for each client.
+std::unordered_map<std::string, EvsEnumerator::CameraRecord> EvsEnumerator::sCameraList;
+std::mutex EvsEnumerator::sLock;
+std::condition_variable EvsEnumerator::sCameraSignal;
+std::unique_ptr<ConfigManager> EvsEnumerator::sConfigManager;
+std::shared_ptr<ICarDisplayProxy> EvsEnumerator::sDisplayProxy;
+std::unordered_map<uint8_t, uint64_t> EvsEnumerator::sDisplayPortList;
+
+EvsEnumerator::ActiveDisplays& EvsEnumerator::mutableActiveDisplays() {
+ static ActiveDisplays active_displays;
+ return active_displays;
+}
+
+EvsEnumerator::EvsEnumerator(const std::shared_ptr<ICarDisplayProxy>& proxyService) {
+ LOG(DEBUG) << "EvsEnumerator is created.";
+
+ if (!sConfigManager) {
+ /* loads and initializes ConfigManager in a separate thread */
+ sConfigManager = ConfigManager::Create();
+ }
+
+ if (!sDisplayProxy) {
+ /* sets a car-window service handle */
+ sDisplayProxy = proxyService;
+ }
+
+ // Enumerate existing devices
+ enumerateCameras();
+ mInternalDisplayId = enumerateDisplays();
+}
+
+bool EvsEnumerator::checkPermission() {
+ const auto uid = AIBinder_getCallingUid();
+ if (kAllowedUids.find(uid) == kAllowedUids.end()) {
+ LOG(ERROR) << "EVS access denied: "
+ << "pid = " << AIBinder_getCallingPid() << ", uid = " << uid;
+ return false;
+ }
+
+ return true;
+}
+
+void EvsEnumerator::enumerateCameras() {
+ if (!sConfigManager) {
+ return;
+ }
+
+ for (auto id : sConfigManager->getCameraIdList()) {
+ CameraRecord rec(id.data());
+ std::unique_ptr<ConfigManager::CameraInfo>& pInfo = sConfigManager->getCameraInfo(id);
+ if (pInfo) {
+ uint8_t* ptr = reinterpret_cast<uint8_t*>(pInfo->characteristics);
+ const size_t len = get_camera_metadata_size(pInfo->characteristics);
+ rec.desc.metadata.insert(rec.desc.metadata.end(), ptr, ptr + len);
+ }
+ sCameraList.insert_or_assign(id, std::move(rec));
+ }
+}
+
+uint64_t EvsEnumerator::enumerateDisplays() {
+ LOG(INFO) << __FUNCTION__ << ": Starting display enumeration";
+ uint64_t internalDisplayId = kInvalidDisplayId;
+ if (!sDisplayProxy) {
+ LOG(ERROR) << "ICarDisplayProxy is not available!";
+ return internalDisplayId;
+ }
+
+ std::vector<int64_t> displayIds;
+ if (auto status = sDisplayProxy->getDisplayIdList(&displayIds); !status.isOk()) {
+ LOG(ERROR) << "Failed to retrieve a display id list"
+ << ::android::statusToString(status.getStatus());
+ return internalDisplayId;
+ }
+
+ if (displayIds.size() > 0) {
+ // The first entry of the list is the internal display. See
+ // SurfaceFlinger::getPhysicalDisplayIds() implementation.
+ internalDisplayId = displayIds[0];
+ for (const auto& id : displayIds) {
+ const auto port = id & 0xFF;
+ LOG(INFO) << "Display " << std::hex << id << " is detected on the port, " << port;
+ sDisplayPortList.insert_or_assign(port, id);
+ }
+ }
+
+ LOG(INFO) << "Found " << sDisplayPortList.size() << " displays";
+ return internalDisplayId;
+}
+
+// Methods from ::android::hardware::automotive::evs::IEvsEnumerator follow.
+ScopedAStatus EvsEnumerator::getCameraList(std::vector<CameraDesc>* _aidl_return) {
+ LOG(DEBUG) << __FUNCTION__;
+ if (!checkPermission()) {
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::PERMISSION_DENIED));
+ }
+
+ {
+ std::unique_lock<std::mutex> lock(sLock);
+ if (sCameraList.size() < 1) {
+ // No qualified device has been found. Wait until new device is ready,
+ // for 10 seconds.
+ if (!sCameraSignal.wait_for(lock, kEnumerationTimeout,
+ [] { return sCameraList.size() > 0; })) {
+ LOG(DEBUG) << "Timer expired. No new device has been added.";
+ }
+ }
+ }
+
+ // Build up a packed array of CameraDesc for return
+ _aidl_return->resize(sCameraList.size());
+ unsigned i = 0;
+ for (const auto& [key, cam] : sCameraList) {
+ (*_aidl_return)[i++] = cam.desc;
+ }
+
+ if (sConfigManager) {
+ // Adding camera groups that represent logical camera devices
+ auto camGroups = sConfigManager->getCameraGroupIdList();
+ for (auto&& id : camGroups) {
+ if (sCameraList.find(id) != sCameraList.end()) {
+ // Already exists in the _aidl_return
+ continue;
+ }
+
+ std::unique_ptr<ConfigManager::CameraGroupInfo>& tempInfo =
+ sConfigManager->getCameraGroupInfo(id);
+ CameraRecord cam(id.data());
+ if (tempInfo) {
+ uint8_t* ptr = reinterpret_cast<uint8_t*>(tempInfo->characteristics);
+ const size_t len = get_camera_metadata_size(tempInfo->characteristics);
+ cam.desc.metadata.insert(cam.desc.metadata.end(), ptr, ptr + len);
+ }
+
+ sCameraList.insert_or_assign(id, cam);
+ _aidl_return->push_back(cam.desc);
+ }
+ }
+
+ // Send back the results
+ LOG(DEBUG) << "Reporting " << sCameraList.size() << " cameras available";
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::getStreamList(const CameraDesc& desc,
+ std::vector<Stream>* _aidl_return) {
+ using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat;
+
+ camera_metadata_t* pMetadata = const_cast<camera_metadata_t*>(
+ reinterpret_cast<const camera_metadata_t*>(desc.metadata.data()));
+ camera_metadata_entry_t streamConfig;
+ if (!find_camera_metadata_entry(pMetadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,
+ &streamConfig)) {
+ const unsigned numStreamConfigs = streamConfig.count / sizeof(StreamConfiguration);
+ _aidl_return->resize(numStreamConfigs);
+ const StreamConfiguration* pCurrentConfig =
+ reinterpret_cast<StreamConfiguration*>(streamConfig.data.i32);
+ for (unsigned i = 0; i < numStreamConfigs; ++i, ++pCurrentConfig) {
+ // Build ::aidl::android::hardware::automotive::evs::Stream from
+ // StreamConfiguration.
+ Stream current = {
+ .id = pCurrentConfig->id,
+ .streamType =
+ pCurrentConfig->type ==
+ ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT
+ ? StreamType::INPUT
+ : StreamType::OUTPUT,
+ .width = pCurrentConfig->width,
+ .height = pCurrentConfig->height,
+ .format = static_cast<AidlPixelFormat>(pCurrentConfig->format),
+ .usage = BufferUsage::CAMERA_INPUT,
+ .rotation = Rotation::ROTATION_0,
+ };
+
+ (*_aidl_return)[i] = current;
+ }
+ }
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::openCamera(const std::string& id, const Stream& cfg,
+ std::shared_ptr<IEvsCamera>* obj) {
+ LOG(DEBUG) << __FUNCTION__;
+ if (!checkPermission()) {
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::PERMISSION_DENIED));
+ }
+
+ // Is this a recognized camera id?
+ CameraRecord* pRecord = findCameraById(id);
+ if (!pRecord) {
+ LOG(ERROR) << id << " does not exist!";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+
+ // Has this camera already been instantiated by another caller?
+ std::shared_ptr<EvsMockCamera> pActiveCamera = pRecord->activeInstance.lock();
+ if (pActiveCamera) {
+ LOG(WARNING) << "Killing previous camera because of new caller";
+ closeCamera(pActiveCamera);
+ }
+
+ // Construct a camera instance for the caller
+ if (!sConfigManager) {
+ pActiveCamera = EvsMockCamera::Create(id.data());
+ } else {
+ pActiveCamera = EvsMockCamera::Create(id.data(), sConfigManager->getCameraInfo(id), &cfg);
+ }
+
+ pRecord->activeInstance = pActiveCamera;
+ if (!pActiveCamera) {
+ LOG(ERROR) << "Failed to create new EvsMockCamera object for " << id;
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::UNDERLYING_SERVICE_ERROR));
+ }
+
+ *obj = pActiveCamera;
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::closeCamera(const std::shared_ptr<IEvsCamera>& cameraObj) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ if (!cameraObj) {
+ LOG(ERROR) << "Ignoring call to closeCamera with null camera ptr";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+
+ // Get the camera id so we can find it in our list
+ CameraDesc desc;
+ auto status = cameraObj->getCameraInfo(&desc);
+ if (!status.isOk()) {
+ LOG(ERROR) << "Failed to read a camera descriptor";
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::UNDERLYING_SERVICE_ERROR));
+ }
+ auto cameraId = desc.id;
+ closeCamera_impl(cameraObj, cameraId);
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::openDisplay(int32_t id, std::shared_ptr<IEvsDisplay>* displayObj) {
+ LOG(DEBUG) << __FUNCTION__;
+ if (!checkPermission()) {
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::PERMISSION_DENIED));
+ }
+
+ auto& displays = mutableActiveDisplays();
+
+ if (auto existing_display_search = displays.popDisplay(id)) {
+ // If we already have a display active, then we need to shut it down so we can
+ // give exclusive access to the new caller.
+ std::shared_ptr<EvsGlDisplay> pActiveDisplay = existing_display_search->displayWeak.lock();
+ if (pActiveDisplay) {
+ LOG(WARNING) << "Killing previous display because of new caller";
+ pActiveDisplay->forceShutdown();
+ }
+ }
+
+ // Create a new display interface and return it
+ uint64_t targetDisplayId = mInternalDisplayId;
+ auto it = sDisplayPortList.find(id);
+ if (it != sDisplayPortList.end()) {
+ targetDisplayId = it->second;
+ } else {
+ LOG(WARNING) << "No display is available on the port " << static_cast<int32_t>(id)
+ << ". The main display " << mInternalDisplayId << " will be used instead";
+ }
+
+ // Create a new display interface and return it.
+ std::shared_ptr<EvsGlDisplay> pActiveDisplay =
+ ndk::SharedRefBase::make<EvsGlDisplay>(sDisplayProxy, targetDisplayId);
+
+ if (auto insert_result = displays.tryInsert(id, pActiveDisplay); !insert_result) {
+ LOG(ERROR) << "Display ID " << id << " has been used by another caller.";
+ pActiveDisplay->forceShutdown();
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::RESOURCE_BUSY));
+ }
+
+ LOG(DEBUG) << "Returning new EvsGlDisplay object " << pActiveDisplay.get();
+ *displayObj = pActiveDisplay;
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::closeDisplay(const std::shared_ptr<IEvsDisplay>& obj) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ auto& displays = mutableActiveDisplays();
+ const auto display_search = displays.popDisplay(obj);
+
+ if (!display_search) {
+ LOG(WARNING) << "Ignoring close of previously orphaned display - why did a client steal?";
+ return ScopedAStatus::ok();
+ }
+
+ auto pActiveDisplay = display_search->displayWeak.lock();
+
+ if (!pActiveDisplay) {
+ LOG(ERROR) << "Somehow a display is being destroyed "
+ << "when the enumerator didn't know one existed";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+
+ pActiveDisplay->forceShutdown();
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::getDisplayState(DisplayState* state) {
+ LOG(DEBUG) << __FUNCTION__;
+ if (!checkPermission()) {
+ *state = DisplayState::DEAD;
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::PERMISSION_DENIED));
+ }
+
+ // TODO(b/262779341): For now we can just return the state of the 1st display. Need to update
+ // the API later.
+
+ const auto& all_displays = mutableActiveDisplays().getAllDisplays();
+
+ // Do we still have a display object we think should be active?
+ if (all_displays.empty()) {
+ *state = DisplayState::NOT_OPEN;
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+
+ std::shared_ptr<IEvsDisplay> pActiveDisplay = all_displays.begin()->second.displayWeak.lock();
+ if (pActiveDisplay) {
+ return pActiveDisplay->getDisplayState(state);
+ } else {
+ *state = DisplayState::NOT_OPEN;
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+}
+
+ScopedAStatus EvsEnumerator::getDisplayIdList(std::vector<uint8_t>* list) {
+ std::vector<uint8_t>& output = *list;
+ if (sDisplayPortList.size() > 0) {
+ output.resize(sDisplayPortList.size());
+ unsigned i = 0;
+ output[i++] = mInternalDisplayId & 0xFF;
+ for (const auto& [port, id] : sDisplayPortList) {
+ if (mInternalDisplayId != id) {
+ output[i++] = port;
+ }
+ }
+ }
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::isHardware(bool* flag) {
+ *flag = true;
+ return ScopedAStatus::ok();
+}
+
+void EvsEnumerator::notifyDeviceStatusChange(const std::string_view& deviceName,
+ DeviceStatusType type) {
+ std::lock_guard lock(sLock);
+ if (!mCallback) {
+ return;
+ }
+
+ std::vector<DeviceStatus> status{{.id = std::string(deviceName), .status = type}};
+ if (!mCallback->deviceStatusChanged(status).isOk()) {
+ LOG(WARNING) << "Failed to notify a device status change, name = " << deviceName
+ << ", type = " << static_cast<int>(type);
+ }
+}
+
+ScopedAStatus EvsEnumerator::registerStatusCallback(
+ const std::shared_ptr<IEvsEnumeratorStatusCallback>& callback) {
+ std::lock_guard lock(sLock);
+ if (mCallback) {
+ LOG(INFO) << "Replacing an existing device status callback";
+ }
+ mCallback = callback;
+ return ScopedAStatus::ok();
+}
+
+void EvsEnumerator::closeCamera_impl(const std::shared_ptr<IEvsCamera>& pCamera,
+ const std::string& cameraId) {
+ // Find the named camera
+ CameraRecord* pRecord = findCameraById(cameraId);
+
+ // Is the display being destroyed actually the one we think is active?
+ if (!pRecord) {
+ LOG(ERROR) << "Asked to close a camera whose name isn't recognized";
+ } else {
+ std::shared_ptr<EvsMockCamera> pActiveCamera = pRecord->activeInstance.lock();
+ if (!pActiveCamera) {
+ LOG(WARNING) << "Somehow a camera is being destroyed "
+ << "when the enumerator didn't know one existed";
+ } else if (pActiveCamera != pCamera) {
+ // This can happen if the camera was aggressively reopened,
+ // orphaning this previous instance
+ LOG(WARNING) << "Ignoring close of previously orphaned camera "
+ << "- why did a client steal?";
+ } else {
+ // Shutdown the active camera
+ pActiveCamera->shutdown();
+ }
+ }
+
+ return;
+}
+
+EvsEnumerator::CameraRecord* EvsEnumerator::findCameraById(const std::string& cameraId) {
+ // Find the named camera
+ auto found = sCameraList.find(cameraId);
+ if (found != sCameraList.end()) {
+ // Found a match!
+ return &found->second;
+ }
+
+ // We didn't find a match
+ return nullptr;
+}
+
+std::optional<EvsEnumerator::ActiveDisplays::DisplayInfo> EvsEnumerator::ActiveDisplays::popDisplay(
+ int32_t id) {
+ std::lock_guard lck(mMutex);
+ const auto search = mIdToDisplay.find(id);
+ if (search == mIdToDisplay.end()) {
+ return std::nullopt;
+ }
+ const auto display_info = search->second;
+ mIdToDisplay.erase(search);
+ mDisplayToId.erase(display_info.internalDisplayRawAddr);
+ return display_info;
+}
+
+std::optional<EvsEnumerator::ActiveDisplays::DisplayInfo> EvsEnumerator::ActiveDisplays::popDisplay(
+ const std::shared_ptr<IEvsDisplay>& display) {
+ const auto display_ptr_val = reinterpret_cast<uintptr_t>(display.get());
+ std::lock_guard lck(mMutex);
+ const auto display_to_id_search = mDisplayToId.find(display_ptr_val);
+ if (display_to_id_search == mDisplayToId.end()) {
+ LOG(ERROR) << "Unknown display.";
+ return std::nullopt;
+ }
+ const auto id = display_to_id_search->second;
+ const auto id_to_display_search = mIdToDisplay.find(id);
+ mDisplayToId.erase(display_to_id_search);
+ if (id_to_display_search == mIdToDisplay.end()) {
+ LOG(ERROR) << "No correspsonding ID for the display, probably orphaned.";
+ return std::nullopt;
+ }
+ const auto display_info = id_to_display_search->second;
+ mIdToDisplay.erase(id);
+ return display_info;
+}
+
+std::unordered_map<int32_t, EvsEnumerator::ActiveDisplays::DisplayInfo>
+EvsEnumerator::ActiveDisplays::getAllDisplays() {
+ std::lock_guard lck(mMutex);
+ auto id_to_display_map_copy = mIdToDisplay;
+ return id_to_display_map_copy;
+}
+
+bool EvsEnumerator::ActiveDisplays::tryInsert(int32_t id,
+ const std::shared_ptr<EvsGlDisplay>& display) {
+ std::lock_guard lck(mMutex);
+ const auto display_ptr_val = reinterpret_cast<uintptr_t>(display.get());
+
+ auto id_to_display_insert_result =
+ mIdToDisplay.emplace(id, DisplayInfo{
+ .id = id,
+ .displayWeak = display,
+ .internalDisplayRawAddr = display_ptr_val,
+ });
+ if (!id_to_display_insert_result.second) {
+ return false;
+ }
+ auto display_to_id_insert_result = mDisplayToId.emplace(display_ptr_val, id);
+ if (!display_to_id_insert_result.second) {
+ mIdToDisplay.erase(id);
+ return false;
+ }
+ return true;
+}
+
+ScopedAStatus EvsEnumerator::getUltrasonicsArrayList(
+ [[maybe_unused]] std::vector<UltrasonicsArrayDesc>* list) {
+ // TODO(b/149874793): Add implementation for EVS Manager and Sample driver
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::openUltrasonicsArray(
+ [[maybe_unused]] const std::string& id,
+ [[maybe_unused]] std::shared_ptr<IEvsUltrasonicsArray>* obj) {
+ // TODO(b/149874793): Add implementation for EVS Manager and Sample driver
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsEnumerator::closeUltrasonicsArray(
+ [[maybe_unused]] const std::shared_ptr<IEvsUltrasonicsArray>& obj) {
+ // TODO(b/149874793): Add implementation for EVS Manager and Sample driver
+ return ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp
new file mode 100644
index 0000000..e5f8e4c
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp
@@ -0,0 +1,417 @@
+/*
+ * 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 "EvsGlDisplay.h"
+
+#include <aidl/android/hardware/automotive/evs/EvsResult.h>
+#include <aidl/android/hardware/graphics/common/BufferUsage.h>
+#include <aidl/android/hardware/graphics/common/PixelFormat.h>
+#include <aidlcommonsupport/NativeHandle.h>
+#include <android-base/thread_annotations.h>
+#include <linux/time.h>
+#include <ui/DisplayMode.h>
+#include <ui/DisplayState.h>
+#include <ui/GraphicBufferAllocator.h>
+#include <ui/GraphicBufferMapper.h>
+#include <utils/SystemClock.h>
+
+#include <chrono>
+
+namespace {
+
+using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy;
+using ::aidl::android::hardware::graphics::common::BufferUsage;
+using ::aidl::android::hardware::graphics::common::PixelFormat;
+using ::android::base::ScopedLockAssertion;
+using ::ndk::ScopedAStatus;
+
+constexpr auto kTimeout = std::chrono::seconds(1);
+
+bool debugFirstFrameDisplayed = false;
+
+int generateFingerPrint(buffer_handle_t handle) {
+ return static_cast<int>(reinterpret_cast<long>(handle) & 0xFFFFFFFF);
+}
+
+} // namespace
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+EvsGlDisplay::EvsGlDisplay(const std::shared_ptr<ICarDisplayProxy>& pDisplayProxy,
+ uint64_t displayId)
+ : mDisplayId(displayId), mDisplayProxy(pDisplayProxy) {
+ LOG(DEBUG) << "EvsGlDisplay instantiated";
+
+ // Set up our self description
+ // NOTE: These are arbitrary values chosen for testing
+ mInfo.id = std::to_string(displayId);
+ mInfo.vendorFlags = 3870;
+
+ // Start a thread to render images on this display
+ {
+ std::lock_guard lock(mLock);
+ mState = RUN;
+ }
+ mRenderThread = std::thread([this]() { renderFrames(); });
+}
+
+EvsGlDisplay::~EvsGlDisplay() {
+ LOG(DEBUG) << "EvsGlDisplay being destroyed";
+ forceShutdown();
+}
+
+/**
+ * This gets called if another caller "steals" ownership of the display
+ */
+void EvsGlDisplay::forceShutdown() {
+ LOG(DEBUG) << "EvsGlDisplay forceShutdown";
+ {
+ std::lock_guard lock(mLock);
+
+ // If the buffer isn't being held by a remote client, release it now as an
+ // optimization to release the resources more quickly than the destructor might
+ // get called.
+ if (mBuffer.handle != nullptr) {
+ // Report if we're going away while a buffer is outstanding
+ if (mBufferBusy || mState == RUN) {
+ LOG(ERROR) << "EvsGlDisplay going down while client is holding a buffer";
+ }
+ mState = STOPPING;
+ }
+
+ // Put this object into an unrecoverable error state since somebody else
+ // is going to own the display now.
+ mRequestedState = DisplayState::DEAD;
+ }
+ mBufferReadyToRender.notify_all();
+
+ if (mRenderThread.joinable()) {
+ mRenderThread.join();
+ }
+}
+
+/**
+ * Initialize GL in the context of a caller's thread and prepare a graphic
+ * buffer to use.
+ */
+bool EvsGlDisplay::initializeGlContextLocked() {
+ // Initialize our display window
+ // NOTE: This will cause the display to become "VISIBLE" before a frame is actually
+ // returned, which is contrary to the spec and will likely result in a black frame being
+ // (briefly) shown.
+ if (!mGlWrapper.initialize(mDisplayProxy, mDisplayId)) {
+ // Report the failure
+ LOG(ERROR) << "Failed to initialize GL display";
+ return false;
+ }
+
+ // Assemble the buffer description we'll use for our render target
+ static_assert(::aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888 ==
+ static_cast<::aidl::android::hardware::graphics::common::PixelFormat>(
+ HAL_PIXEL_FORMAT_RGBA_8888));
+ mBuffer.description = {
+ .width = static_cast<int>(mGlWrapper.getWidth()),
+ .height = static_cast<int>(mGlWrapper.getHeight()),
+ .layers = 1,
+ .format = PixelFormat::RGBA_8888,
+ // FIXME: Below line is not using
+ // ::aidl::android::hardware::graphics::common::BufferUsage because
+ // BufferUsage enum does not support a bitwise-OR operation; they
+ // should be BufferUsage::GPU_RENDER_TARGET |
+ // BufferUsage::COMPOSER_OVERLAY
+ .usage = static_cast<BufferUsage>(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER),
+ };
+
+ ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get());
+ uint32_t stride = static_cast<uint32_t>(mBuffer.description.stride);
+ buffer_handle_t handle = nullptr;
+ const ::android::status_t result =
+ alloc.allocate(mBuffer.description.width, mBuffer.description.height,
+ static_cast<::android::PixelFormat>(mBuffer.description.format),
+ mBuffer.description.layers,
+ static_cast<uint64_t>(mBuffer.description.usage), &handle, &stride,
+ /* requestorName= */ "EvsGlDisplay");
+ mBuffer.description.stride = stride;
+ mBuffer.fingerprint = generateFingerPrint(mBuffer.handle);
+ if (result != ::android::NO_ERROR) {
+ LOG(ERROR) << "Error " << result << " allocating " << mBuffer.description.width << " x "
+ << mBuffer.description.height << " graphics buffer.";
+ mGlWrapper.shutdown();
+ return false;
+ }
+
+ mBuffer.handle = handle;
+ if (mBuffer.handle == nullptr) {
+ LOG(ERROR) << "We didn't get a buffer handle back from the allocator";
+ mGlWrapper.shutdown();
+ return false;
+ }
+
+ LOG(DEBUG) << "Allocated new buffer " << mBuffer.handle << " with stride "
+ << mBuffer.description.stride;
+ return true;
+}
+
+/**
+ * This method runs in a separate thread and renders the contents of the buffer.
+ */
+void EvsGlDisplay::renderFrames() {
+ {
+ std::lock_guard lock(mLock);
+
+ if (!initializeGlContextLocked()) {
+ LOG(ERROR) << "Failed to initialize GL context";
+ return;
+ }
+
+ // Display buffer is ready.
+ mBufferBusy = false;
+ }
+ mBufferReadyToUse.notify_all();
+
+ while (true) {
+ {
+ std::unique_lock lock(mLock);
+ ScopedLockAssertion lock_assertion(mLock);
+ mBufferReadyToRender.wait(
+ lock, [this]() REQUIRES(mLock) { return mBufferReady || mState != RUN; });
+ if (mState != RUN) {
+ LOG(DEBUG) << "A rendering thread is stopping";
+ break;
+ }
+ mBufferReady = false;
+ }
+
+ // Update the texture contents with the provided data
+ if (!mGlWrapper.updateImageTexture(mBuffer.handle, mBuffer.description)) {
+ LOG(WARNING) << "Failed to update the image texture";
+ continue;
+ }
+
+ // Put the image on the screen
+ mGlWrapper.renderImageToScreen();
+ if (!debugFirstFrameDisplayed) {
+ LOG(DEBUG) << "EvsFirstFrameDisplayTiming start time: " << ::android::elapsedRealtime()
+ << " ms.";
+ debugFirstFrameDisplayed = true;
+ }
+
+ // Mark current frame is consumed.
+ {
+ std::lock_guard lock(mLock);
+ mBufferBusy = false;
+ }
+ mBufferDone.notify_all();
+ }
+
+ LOG(DEBUG) << "A rendering thread is stopped.";
+
+ // Drop the graphics buffer we've been using
+ ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get());
+ alloc.free(mBuffer.handle);
+ mBuffer.handle = nullptr;
+
+ mGlWrapper.hideWindow(mDisplayProxy, mDisplayId);
+ mGlWrapper.shutdown();
+
+ std::lock_guard lock(mLock);
+ mState = STOPPED;
+}
+
+/**
+ * Returns basic information about the EVS display provided by the system.
+ * See the description of the DisplayDesc structure for details.
+ */
+ScopedAStatus EvsGlDisplay::getDisplayInfo(DisplayDesc* _aidl_return) {
+ if (!mDisplayProxy) {
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::UNDERLYING_SERVICE_ERROR));
+ }
+
+ ::aidl::android::frameworks::automotive::display::DisplayDesc proxyDisplay;
+ auto status = mDisplayProxy->getDisplayInfo(mDisplayId, &proxyDisplay);
+ if (!status.isOk()) {
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::UNDERLYING_SERVICE_ERROR));
+ }
+
+ _aidl_return->width = proxyDisplay.width;
+ _aidl_return->height = proxyDisplay.height;
+ _aidl_return->orientation = static_cast<Rotation>(proxyDisplay.orientation);
+ _aidl_return->id = mInfo.id; // FIXME: what should be ID here?
+ _aidl_return->vendorFlags = mInfo.vendorFlags;
+ return ::ndk::ScopedAStatus::ok();
+}
+
+/**
+ * Clients may set the display state to express their desired state.
+ * The HAL implementation must gracefully accept a request for any state
+ * while in any other state, although the response may be to ignore the request.
+ * The display is defined to start in the NOT_VISIBLE state upon initialization.
+ * The client is then expected to request the VISIBLE_ON_NEXT_FRAME state, and
+ * then begin providing video. When the display is no longer required, the client
+ * is expected to request the NOT_VISIBLE state after passing the last video frame.
+ */
+ScopedAStatus EvsGlDisplay::setDisplayState(DisplayState state) {
+ LOG(DEBUG) << __FUNCTION__;
+ std::lock_guard lock(mLock);
+
+ if (mRequestedState == DisplayState::DEAD) {
+ // This object no longer owns the display -- it's been superceeded!
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+
+ // Ensure we recognize the requested state so we don't go off the rails
+ static constexpr ::ndk::enum_range<DisplayState> kDisplayStateRange;
+ if (std::find(kDisplayStateRange.begin(), kDisplayStateRange.end(), state) ==
+ kDisplayStateRange.end()) {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+
+ switch (state) {
+ case DisplayState::NOT_VISIBLE:
+ mGlWrapper.hideWindow(mDisplayProxy, mDisplayId);
+ break;
+ case DisplayState::VISIBLE:
+ mGlWrapper.showWindow(mDisplayProxy, mDisplayId);
+ break;
+ default:
+ break;
+ }
+
+ // Record the requested state
+ mRequestedState = state;
+
+ return ScopedAStatus::ok();
+}
+
+/**
+ * The HAL implementation should report the actual current state, which might
+ * transiently differ from the most recently requested state. Note, however, that
+ * the logic responsible for changing display states should generally live above
+ * the device layer, making it undesirable for the HAL implementation to
+ * spontaneously change display states.
+ */
+ScopedAStatus EvsGlDisplay::getDisplayState(DisplayState* _aidl_return) {
+ LOG(DEBUG) << __FUNCTION__;
+ std::lock_guard lock(mLock);
+ *_aidl_return = mRequestedState;
+ return ScopedAStatus::ok();
+}
+
+/**
+ * This call returns a handle to a frame buffer associated with the display.
+ * This buffer may be locked and written to by software and/or GL. This buffer
+ * must be returned via a call to returnTargetBufferForDisplay() even if the
+ * display is no longer visible.
+ */
+ScopedAStatus EvsGlDisplay::getTargetBuffer(BufferDesc* _aidl_return) {
+ LOG(DEBUG) << __FUNCTION__;
+ std::unique_lock lock(mLock);
+ ScopedLockAssertion lock_assertion(mLock);
+ if (mRequestedState == DisplayState::DEAD) {
+ LOG(ERROR) << "Rejecting buffer request from object that lost ownership of the display.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+
+ // If we don't already have a buffer, allocate one now
+ // mBuffer.memHandle is a type of buffer_handle_t, which is equal to
+ // native_handle_t*.
+ mBufferReadyToUse.wait(lock, [this]() REQUIRES(mLock) { return !mBufferBusy; });
+
+ // Do we have a frame available?
+ if (mBufferBusy) {
+ // This means either we have a 2nd client trying to compete for buffers
+ // (an unsupported mode of operation) or else the client hasn't returned
+ // a previously issued buffer yet (they're behaving badly).
+ // NOTE: We have to make the callback even if we have nothing to provide
+ LOG(ERROR) << "getTargetBuffer called while no buffers available.";
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::BUFFER_NOT_AVAILABLE));
+ }
+
+ // Mark our buffer as busy
+ mBufferBusy = true;
+
+ // Send the buffer to the client
+ LOG(VERBOSE) << "Providing display buffer handle " << mBuffer.handle;
+
+ BufferDesc bufferDescToSend = {
+ .buffer =
+ {
+ .handle = std::move(::android::dupToAidl(mBuffer.handle)),
+ .description = mBuffer.description,
+ },
+ .pixelSizeBytes = 4, // RGBA_8888 is 4-byte-per-pixel format
+ .bufferId = mBuffer.fingerprint,
+ };
+ *_aidl_return = std::move(bufferDescToSend);
+
+ return ScopedAStatus::ok();
+}
+
+/**
+ * This call tells the display that the buffer is ready for display.
+ * The buffer is no longer valid for use by the client after this call.
+ */
+ScopedAStatus EvsGlDisplay::returnTargetBufferForDisplay(const BufferDesc& buffer) {
+ LOG(VERBOSE) << __FUNCTION__;
+ std::unique_lock lock(mLock);
+ ScopedLockAssertion lock_assertion(mLock);
+
+ // Nobody should call us with a null handle
+ if (buffer.buffer.handle.fds.size() < 1) {
+ LOG(ERROR) << __FUNCTION__ << " called without a valid buffer handle.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+ if (buffer.bufferId != mBuffer.fingerprint) {
+ LOG(ERROR) << "Got an unrecognized frame returned.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+ if (!mBufferBusy) {
+ LOG(ERROR) << "A frame was returned with no outstanding frames.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+
+ // If we've been displaced by another owner of the display, then we can't do anything else
+ if (mRequestedState == DisplayState::DEAD) {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+
+ // If we were waiting for a new frame, this is it!
+ if (mRequestedState == DisplayState::VISIBLE_ON_NEXT_FRAME) {
+ mRequestedState = DisplayState::VISIBLE;
+ mGlWrapper.showWindow(mDisplayProxy, mDisplayId);
+ }
+
+ // Validate we're in an expected state
+ if (mRequestedState != DisplayState::VISIBLE) {
+ // Not sure why a client would send frames back when we're not visible.
+ LOG(WARNING) << "Got a frame returned while not visible - ignoring.";
+ return ScopedAStatus::ok();
+ }
+ mBufferReady = true;
+ mBufferReadyToRender.notify_all();
+
+ if (!mBufferDone.wait_for(lock, kTimeout, [this]() REQUIRES(mLock) { return !mBufferBusy; })) {
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::UNDERLYING_SERVICE_ERROR));
+ }
+
+ return ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp
new file mode 100644
index 0000000..4b46a5a
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp
@@ -0,0 +1,642 @@
+/*
+ * 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 "EvsMockCamera.h"
+#include "ConfigManager.h"
+#include "EvsEnumerator.h"
+
+#include <aidlcommonsupport/NativeHandle.h>
+#include <ui/GraphicBufferAllocator.h>
+#include <ui/GraphicBufferMapper.h>
+#include <utils/SystemClock.h>
+
+#include <memory>
+
+namespace {
+
+using ::aidl::android::hardware::graphics::common::BufferUsage;
+using ::ndk::ScopedAStatus;
+
+// Arbitrary limit on number of graphics buffers allowed to be allocated
+// Safeguards against unreasonable resource consumption and provides a testable limit
+constexpr unsigned kMaxBuffersInFlight = 100;
+
+// Minimum number of buffers to run a video stream
+constexpr int kMinimumBuffersInFlight = 1;
+
+// Colors for the colorbar test pattern in ABGR format
+constexpr uint32_t kColors[] = {
+ 0xFFFFFFFF, // white
+ 0xFF00FFFF, // yellow
+ 0xFFFFFF00, // cyan
+ 0xFF00FF00, // green
+ 0xFFFF00FF, // fuchsia
+ 0xFF0000FF, // red
+ 0xFFFF0000, // blue
+ 0xFF000000, // black
+};
+constexpr size_t kNumColors = sizeof(kColors) / sizeof(kColors[0]);
+
+} // namespace
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+EvsMockCamera::EvsMockCamera([[maybe_unused]] Sigil sigil, const char* id,
+ std::unique_ptr<ConfigManager::CameraInfo>& camInfo)
+ : mFramesAllowed(0), mFramesInUse(0), mStreamState(STOPPED), mCameraInfo(camInfo) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ /* set a camera id */
+ mDescription.id = id;
+
+ /* set camera metadata */
+ if (camInfo) {
+ uint8_t* ptr = reinterpret_cast<uint8_t*>(camInfo->characteristics);
+ const size_t len = get_camera_metadata_size(camInfo->characteristics);
+ mDescription.metadata.insert(mDescription.metadata.end(), ptr, ptr + len);
+ }
+}
+
+EvsMockCamera::~EvsMockCamera() {
+ LOG(DEBUG) << __FUNCTION__;
+ shutdown();
+}
+
+// This gets called if another caller "steals" ownership of the camera
+void EvsMockCamera::shutdown() {
+ LOG(DEBUG) << __FUNCTION__;
+
+ // Make sure our output stream is cleaned up
+ // (It really should be already)
+ stopVideoStream_impl();
+
+ // Claim the lock while we work on internal state
+ std::lock_guard lock(mAccessLock);
+
+ // Drop all the graphics buffers we've been using
+ if (mBuffers.size() > 0) {
+ ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get());
+ for (auto&& rec : mBuffers) {
+ if (rec.inUse) {
+ LOG(WARNING) << "WARNING: releasing a buffer remotely owned.";
+ }
+ alloc.free(rec.handle);
+ rec.handle = nullptr;
+ }
+ mBuffers.clear();
+ }
+
+ // Put this object into an unrecoverable error state since somebody else
+ // is going to own the underlying camera now
+ mStreamState = DEAD;
+}
+
+// Methods from ::aidl::android::hardware::automotive::evs::IEvsCamera follow.
+ScopedAStatus EvsMockCamera::getCameraInfo(CameraDesc* _aidl_return) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ // Send back our self description
+ *_aidl_return = mDescription;
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::setMaxFramesInFlight(int32_t bufferCount) {
+ LOG(DEBUG) << __FUNCTION__ << ", bufferCount = " << bufferCount;
+ ;
+
+ std::lock_guard lock(mAccessLock);
+
+ // If we've been displaced by another owner of the camera, then we can't do anything else
+ if (mStreamState == DEAD) {
+ LOG(ERROR) << "Ignoring setMaxFramesInFlight call when camera has been lost.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+
+ // We cannot function without at least one video buffer to send data
+ if (bufferCount < 1) {
+ LOG(ERROR) << "Ignoring setMaxFramesInFlight with less than one buffer requested.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+
+ // Update our internal state
+ if (!setAvailableFrames_Locked(bufferCount)) {
+ LOG(ERROR) << "Failed to adjust the maximum number of frames in flight.";
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::BUFFER_NOT_AVAILABLE));
+ }
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::startVideoStream(const std::shared_ptr<IEvsCameraStream>& cb) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ if (!cb) {
+ LOG(ERROR) << "A given stream callback is invalid.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ }
+
+ std::lock_guard lock(mAccessLock);
+
+ // If we've been displaced by another owner of the camera, then we can't do anything else
+ if (mStreamState == DEAD) {
+ LOG(ERROR) << "Ignoring startVideoStream call when camera has been lost.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
+ }
+
+ if (mStreamState != STOPPED) {
+ LOG(ERROR) << "Ignoring startVideoStream call when a stream is already running.";
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::STREAM_ALREADY_RUNNING));
+ }
+
+ // If the client never indicated otherwise, configure ourselves for a single streaming buffer
+ if (mFramesAllowed < kMinimumBuffersInFlight &&
+ !setAvailableFrames_Locked(kMinimumBuffersInFlight)) {
+ LOG(ERROR) << "Failed to start stream because we couldn't get a graphics buffer";
+ return ScopedAStatus::fromServiceSpecificError(
+ static_cast<int>(EvsResult::BUFFER_NOT_AVAILABLE));
+ }
+
+ // Record the user's callback for use when we have a frame ready
+ mStream = cb;
+
+ // Start the frame generation thread
+ mStreamState = RUNNING;
+ mCaptureThread = std::thread([this]() { generateFrames(); });
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::doneWithFrame(const std::vector<BufferDesc>& list) {
+ std::lock_guard lock(mAccessLock);
+ for (const auto& desc : list) {
+ returnBufferLocked(desc.bufferId);
+ }
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::stopVideoStream() {
+ LOG(DEBUG) << __FUNCTION__;
+ return stopVideoStream_impl();
+}
+
+ScopedAStatus EvsMockCamera::stopVideoStream_impl() {
+ std::unique_lock lock(mAccessLock);
+
+ if (mStreamState != RUNNING) {
+ // Safely return here because a stream is not running.
+ return ScopedAStatus::ok();
+ }
+
+ // Tell the GenerateFrames loop we want it to stop
+ mStreamState = STOPPING;
+
+ // Block outside the mutex until the "stop" flag has been acknowledged
+ // We won't send any more frames, but the client might still get some already in flight
+ LOG(DEBUG) << "Waiting for stream thread to end...";
+ lock.unlock();
+ if (mCaptureThread.joinable()) {
+ mCaptureThread.join();
+ }
+ lock.lock();
+
+ mStreamState = STOPPED;
+ mStream = nullptr;
+ LOG(DEBUG) << "Stream marked STOPPED.";
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::getExtendedInfo(int32_t opaqueIdentifier,
+ std::vector<uint8_t>* opaqueValue) {
+ const auto it = mExtInfo.find(opaqueIdentifier);
+ if (it == mExtInfo.end()) {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::INVALID_ARG));
+ } else {
+ *opaqueValue = mExtInfo[opaqueIdentifier];
+ }
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::setExtendedInfo(int32_t opaqueIdentifier,
+ const std::vector<uint8_t>& opaqueValue) {
+ mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue);
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::getPhysicalCameraInfo([[maybe_unused]] const std::string& id,
+ CameraDesc* _aidl_return) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ // This method works exactly same as getCameraInfo() in EVS HW module.
+ *_aidl_return = mDescription;
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::pauseVideoStream() {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::NOT_SUPPORTED));
+}
+
+ScopedAStatus EvsMockCamera::resumeVideoStream() {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::NOT_SUPPORTED));
+}
+
+ScopedAStatus EvsMockCamera::setPrimaryClient() {
+ /* Because EVS HW module reference implementation expects a single client at
+ * a time, this returns a success code always.
+ */
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::forcePrimaryClient(const std::shared_ptr<IEvsDisplay>&) {
+ /* Because EVS HW module reference implementation expects a single client at
+ * a time, this returns a success code always.
+ */
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::unsetPrimaryClient() {
+ /* Because EVS HW module reference implementation expects a single client at
+ * a time, there is no chance that this is called by the secondary client and
+ * therefore returns a success code always.
+ */
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::getParameterList(std::vector<CameraParam>* _aidl_return) {
+ if (mCameraInfo) {
+ _aidl_return->resize(mCameraInfo->controls.size());
+ auto idx = 0;
+ for (auto& [name, range] : mCameraInfo->controls) {
+ (*_aidl_return)[idx++] = name;
+ }
+ }
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus EvsMockCamera::getIntParameterRange([[maybe_unused]] CameraParam id,
+ [[maybe_unused]] ParameterRange* _aidl_return) {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::NOT_SUPPORTED));
+}
+
+ScopedAStatus EvsMockCamera::setIntParameter(
+ [[maybe_unused]] CameraParam id, [[maybe_unused]] int32_t value,
+ [[maybe_unused]] std::vector<int32_t>* effectiveValue) {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::NOT_SUPPORTED));
+}
+
+ScopedAStatus EvsMockCamera::getIntParameter([[maybe_unused]] CameraParam id,
+ [[maybe_unused]] std::vector<int32_t>* value) {
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::NOT_SUPPORTED));
+}
+
+ScopedAStatus EvsMockCamera::importExternalBuffers(
+ [[maybe_unused]] const std::vector<BufferDesc>& buffers,
+ [[maybe_unused]] int32_t* _aidl_return) {
+ LOG(DEBUG) << "This implementation does not support an external buffer import.";
+ return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::NOT_SUPPORTED));
+}
+
+bool EvsMockCamera::setAvailableFrames_Locked(unsigned bufferCount) {
+ if (bufferCount < 1) {
+ LOG(ERROR) << "Ignoring request to set buffer count to zero";
+ return false;
+ }
+ if (bufferCount > kMaxBuffersInFlight) {
+ LOG(ERROR) << "Rejecting buffer request in excess of internal limit";
+ return false;
+ }
+
+ // Is an increase required?
+ if (mFramesAllowed < bufferCount) {
+ // An increase is required
+ auto needed = bufferCount - mFramesAllowed;
+ LOG(INFO) << "Allocating " << needed << " buffers for camera frames";
+
+ auto added = increaseAvailableFrames_Locked(needed);
+ if (added != needed) {
+ // If we didn't add all the frames we needed, then roll back to the previous state
+ LOG(ERROR) << "Rolling back to previous frame queue size";
+ decreaseAvailableFrames_Locked(added);
+ return false;
+ }
+ } else if (mFramesAllowed > bufferCount) {
+ // A decrease is required
+ auto framesToRelease = mFramesAllowed - bufferCount;
+ LOG(INFO) << "Returning " << framesToRelease << " camera frame buffers";
+
+ auto released = decreaseAvailableFrames_Locked(framesToRelease);
+ if (released != framesToRelease) {
+ // This shouldn't happen with a properly behaving client because the client
+ // should only make this call after returning sufficient outstanding buffers
+ // to allow a clean resize.
+ LOG(ERROR) << "Buffer queue shrink failed -- too many buffers currently in use?";
+ }
+ }
+
+ return true;
+}
+
+unsigned EvsMockCamera::increaseAvailableFrames_Locked(unsigned numToAdd) {
+ // Acquire the graphics buffer allocator
+ ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get());
+
+ unsigned added = 0;
+ while (added < numToAdd) {
+ unsigned pixelsPerLine = 0;
+ buffer_handle_t memHandle = nullptr;
+ auto result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, &memHandle,
+ &pixelsPerLine, 0, "EvsMockCamera");
+ if (result != ::android::NO_ERROR) {
+ LOG(ERROR) << "Error " << result << " allocating " << mWidth << " x " << mHeight
+ << " graphics buffer";
+ break;
+ }
+ if (memHandle == nullptr) {
+ LOG(ERROR) << "We didn't get a buffer handle back from the allocator";
+ break;
+ }
+ if (mStride > 0) {
+ if (mStride != pixelsPerLine) {
+ LOG(ERROR) << "We did not expect to get buffers with different strides!";
+ }
+ } else {
+ // Gralloc defines stride in terms of pixels per line
+ mStride = pixelsPerLine;
+ }
+
+ // Find a place to store the new buffer
+ auto stored = false;
+ for (auto&& rec : mBuffers) {
+ if (rec.handle == nullptr) {
+ // Use this existing entry
+ rec.handle = memHandle;
+ rec.inUse = false;
+ stored = true;
+ break;
+ }
+ }
+ if (!stored) {
+ // Add a BufferRecord wrapping this handle to our set of available buffers
+ mBuffers.push_back(BufferRecord(memHandle));
+ }
+
+ ++mFramesAllowed;
+ ++added;
+ }
+
+ return added;
+}
+
+unsigned EvsMockCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) {
+ // Acquire the graphics buffer allocator
+ ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get());
+
+ unsigned removed = 0;
+ for (auto&& rec : mBuffers) {
+ // Is this record not in use, but holding a buffer that we can free?
+ if ((rec.inUse == false) && (rec.handle != nullptr)) {
+ // Release buffer and update the record so we can recognize it as "empty"
+ alloc.free(rec.handle);
+ rec.handle = nullptr;
+
+ --mFramesAllowed;
+ ++removed;
+
+ if (removed == numToRemove) {
+ break;
+ }
+ }
+ }
+
+ return removed;
+}
+
+// This is the asynchronous frame generation thread that runs in parallel with the
+// main serving thread. There is one for each active camera instance.
+void EvsMockCamera::generateFrames() {
+ LOG(DEBUG) << "Frame generation loop started.";
+
+ unsigned idx = 0;
+ while (true) {
+ bool timeForFrame = false;
+ const nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC);
+
+ // Lock scope for updating shared state
+ {
+ std::lock_guard lock(mAccessLock);
+
+ if (mStreamState != RUNNING) {
+ // Break out of our main thread loop
+ break;
+ }
+
+ // Are we allowed to issue another buffer?
+ if (mFramesInUse >= mFramesAllowed) {
+ // Can't do anything right now -- skip this frame
+ LOG(WARNING) << "Skipped a frame because too many are in flight.";
+ } else {
+ // Identify an available buffer to fill
+ for (idx = 0; idx < mBuffers.size(); idx++) {
+ if (!mBuffers[idx].inUse) {
+ if (mBuffers[idx].handle != nullptr) {
+ // Found an available record, so stop looking
+ break;
+ }
+ }
+ }
+ if (idx >= mBuffers.size()) {
+ // This shouldn't happen since we already checked mFramesInUse vs mFramesAllowed
+ ALOGE("Failed to find an available buffer slot\n");
+ } else {
+ // We're going to make the frame busy
+ mBuffers[idx].inUse = true;
+ mFramesInUse++;
+ timeForFrame = true;
+ }
+ }
+ }
+
+ if (timeForFrame) {
+ using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat;
+
+ // Assemble the buffer description we'll transmit below
+ buffer_handle_t memHandle = mBuffers[idx].handle;
+ BufferDesc newBuffer = {
+ .buffer =
+ {
+ .description =
+ {
+ .width = static_cast<int32_t>(mWidth),
+ .height = static_cast<int32_t>(mHeight),
+ .layers = 1,
+ .format = static_cast<AidlPixelFormat>(mFormat),
+ .usage = static_cast<BufferUsage>(mUsage),
+ .stride = static_cast<int32_t>(mStride),
+ },
+ .handle = ::android::dupToAidl(memHandle),
+ },
+ .bufferId = static_cast<int32_t>(idx),
+ .deviceId = mDescription.id,
+ .timestamp = static_cast<int64_t>(::android::elapsedRealtimeNano() *
+ 1e+3), // timestamps is in microseconds
+ };
+
+ // Write test data into the image buffer
+ fillMockFrame(memHandle, reinterpret_cast<const AHardwareBuffer_Desc*>(
+ &newBuffer.buffer.description));
+
+ // Issue the (asynchronous) callback to the client -- can't be holding the lock
+ auto flag = false;
+ if (mStream) {
+ std::vector<BufferDesc> frames;
+ frames.push_back(std::move(newBuffer));
+ flag = mStream->deliverFrame(frames).isOk();
+ }
+
+ if (flag) {
+ LOG(DEBUG) << "Delivered " << memHandle << ", id = " << mBuffers[idx].handle;
+ } else {
+ // This can happen if the client dies and is likely unrecoverable.
+ // To avoid consuming resources generating failing calls, we stop sending
+ // frames. Note, however, that the stream remains in the "STREAMING" state
+ // until cleaned up on the main thread.
+ LOG(ERROR) << "Frame delivery call failed in the transport layer.";
+
+ // Since we didn't actually deliver it, mark the frame as available
+ std::lock_guard<std::mutex> lock(mAccessLock);
+ mBuffers[idx].inUse = false;
+ mFramesInUse--;
+ }
+ }
+
+ // We arbitrarily choose to generate frames at 15 fps to ensure we pass the 10fps test
+ // requirement
+ static const int kTargetFrameRate = 15;
+ static const nsecs_t kTargetFrameIntervalUs = 1000 * 1000 / kTargetFrameRate;
+ const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
+ const nsecs_t elapsedTimeUs = (now - startTime) / 1000;
+ const nsecs_t sleepDurationUs = kTargetFrameIntervalUs - elapsedTimeUs;
+ if (sleepDurationUs > 0) {
+ usleep(sleepDurationUs);
+ }
+ }
+
+ // If we've been asked to stop, send an event to signal the actual end of stream
+ EvsEventDesc event = {
+ .aType = EvsEventType::STREAM_STOPPED,
+ };
+ if (!mStream->notify(event).isOk()) {
+ ALOGE("Error delivering end of stream marker");
+ }
+
+ return;
+}
+
+void EvsMockCamera::fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc) {
+ // Lock our output buffer for writing
+ uint32_t* pixels = nullptr;
+ ::android::GraphicBufferMapper& mapper = ::android::GraphicBufferMapper::get();
+ mapper.lock(handle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER,
+ ::android::Rect(pDesc->width, pDesc->height), (void**)&pixels);
+
+ // If we failed to lock the pixel buffer, we're about to crash, but log it first
+ if (!pixels) {
+ ALOGE("Camera failed to gain access to image buffer for writing");
+ return;
+ }
+
+ // Fill in the test pixels; the colorbar in ABGR format
+ for (unsigned row = 0; row < pDesc->height; row++) {
+ for (unsigned col = 0; col < pDesc->width; col++) {
+ const uint32_t index = col * kNumColors / pDesc->width;
+ pixels[col] = kColors[index];
+ }
+ // Point to the next row
+ // NOTE: stride retrieved from gralloc is in units of pixels
+ pixels = pixels + pDesc->stride;
+ }
+
+ // Release our output buffer
+ mapper.unlock(handle);
+}
+
+void EvsMockCamera::returnBufferLocked(const uint32_t bufferId) {
+ if (bufferId >= mBuffers.size()) {
+ ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", bufferId,
+ mBuffers.size() - 1);
+ return;
+ }
+
+ if (!mBuffers[bufferId].inUse) {
+ ALOGE("ignoring doneWithFrame called on frame %d which is already free", bufferId);
+ return;
+ }
+
+ // Mark the frame as available
+ mBuffers[bufferId].inUse = false;
+ mFramesInUse--;
+
+ // If this frame's index is high in the array, try to move it down
+ // to improve locality after mFramesAllowed has been reduced.
+ if (bufferId >= mFramesAllowed) {
+ // Find an empty slot lower in the array (which should always exist in this case)
+ for (auto&& rec : mBuffers) {
+ if (rec.handle == nullptr) {
+ rec.handle = mBuffers[bufferId].handle;
+ mBuffers[bufferId].handle = nullptr;
+ break;
+ }
+ }
+ }
+}
+
+std::shared_ptr<EvsMockCamera> EvsMockCamera::Create(const char* deviceName) {
+ std::unique_ptr<ConfigManager::CameraInfo> nullCamInfo = nullptr;
+
+ return Create(deviceName, nullCamInfo);
+}
+
+std::shared_ptr<EvsMockCamera> EvsMockCamera::Create(
+ const char* deviceName, std::unique_ptr<ConfigManager::CameraInfo>& camInfo,
+ [[maybe_unused]] const Stream* streamCfg) {
+ std::shared_ptr<EvsMockCamera> c =
+ ndk::SharedRefBase::make<EvsMockCamera>(Sigil{}, deviceName, camInfo);
+ if (!c) {
+ LOG(ERROR) << "Failed to instantiate EvsMockCamera.";
+ return nullptr;
+ }
+
+ // Use the first resolution from the list for the testing
+ // TODO(b/214835237): Uses a given Stream configuration to choose the best
+ // stream configuration.
+ auto it = camInfo->streamConfigurations.begin();
+ c->mWidth = it->second.width;
+ c->mHeight = it->second.height;
+ c->mDescription.vendorFlags = 0xFFFFFFFF; // Arbitrary test value
+
+ c->mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
+ c->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
+ GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
+
+ return c;
+}
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/src/GlWrapper.cpp b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp
new file mode 100644
index 0000000..0ee5ecb
--- /dev/null
+++ b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp
@@ -0,0 +1,465 @@
+/*
+ * 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 "GlWrapper.h"
+
+#include <aidl/android/frameworks/automotive/display/DisplayDesc.h>
+#include <aidl/android/hardware/graphics/common/HardwareBufferDescription.h>
+#include <aidlcommonsupport/NativeHandle.h>
+#include <ui/DisplayMode.h>
+#include <ui/DisplayState.h>
+#include <ui/GraphicBuffer.h>
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+
+#include <utility>
+
+namespace {
+
+using ::aidl::android::frameworks::automotive::display::DisplayDesc;
+using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy;
+using ::aidl::android::frameworks::automotive::display::Rotation;
+using ::aidl::android::hardware::common::NativeHandle;
+using ::aidl::android::hardware::graphics::common::HardwareBufferDescription;
+using ::android::GraphicBuffer;
+using ::android::sp;
+
+constexpr const char vertexShaderSource[] =
+ "attribute vec4 pos; \n"
+ "attribute vec2 tex; \n"
+ "varying vec2 uv; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = pos; \n"
+ " uv = tex; \n"
+ "} \n";
+
+constexpr const char pixelShaderSource[] =
+ "precision mediump float; \n"
+ "uniform sampler2D tex; \n"
+ "varying vec2 uv; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = texture2D(tex, uv);\n"
+ "} \n";
+
+const char* getEGLError(void) {
+ switch (eglGetError()) {
+ case EGL_SUCCESS:
+ return "EGL_SUCCESS";
+ case EGL_NOT_INITIALIZED:
+ return "EGL_NOT_INITIALIZED";
+ case EGL_BAD_ACCESS:
+ return "EGL_BAD_ACCESS";
+ case EGL_BAD_ALLOC:
+ return "EGL_BAD_ALLOC";
+ case EGL_BAD_ATTRIBUTE:
+ return "EGL_BAD_ATTRIBUTE";
+ case EGL_BAD_CONTEXT:
+ return "EGL_BAD_CONTEXT";
+ case EGL_BAD_CONFIG:
+ return "EGL_BAD_CONFIG";
+ case EGL_BAD_CURRENT_SURFACE:
+ return "EGL_BAD_CURRENT_SURFACE";
+ case EGL_BAD_DISPLAY:
+ return "EGL_BAD_DISPLAY";
+ case EGL_BAD_SURFACE:
+ return "EGL_BAD_SURFACE";
+ case EGL_BAD_MATCH:
+ return "EGL_BAD_MATCH";
+ case EGL_BAD_PARAMETER:
+ return "EGL_BAD_PARAMETER";
+ case EGL_BAD_NATIVE_PIXMAP:
+ return "EGL_BAD_NATIVE_PIXMAP";
+ case EGL_BAD_NATIVE_WINDOW:
+ return "EGL_BAD_NATIVE_WINDOW";
+ case EGL_CONTEXT_LOST:
+ return "EGL_CONTEXT_LOST";
+ default:
+ return "Unknown error";
+ }
+}
+
+// Given shader source, load and compile it
+GLuint loadShader(GLenum type, const char* shaderSrc) {
+ // Create the shader object
+ GLuint shader = glCreateShader(type);
+ if (shader == 0) {
+ return 0;
+ }
+
+ // Load and compile the shader
+ glShaderSource(shader, 1, &shaderSrc, nullptr);
+ glCompileShader(shader);
+
+ // Verify the compilation worked as expected
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+ if (!compiled) {
+ LOG(ERROR) << "Error compiling shader";
+
+ GLint size = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &size);
+ if (size > 0) {
+ // Get and report the error message
+ char* infoLog = (char*)malloc(size);
+ glGetShaderInfoLog(shader, size, nullptr, infoLog);
+ LOG(ERROR) << " msg:" << std::endl << infoLog;
+ free(infoLog);
+ }
+
+ glDeleteShader(shader);
+ return 0;
+ }
+
+ return shader;
+}
+
+// Create a program object given vertex and pixels shader source
+GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) {
+ GLuint program = glCreateProgram();
+ if (program == 0) {
+ LOG(ERROR) << "Failed to allocate program object";
+ return 0;
+ }
+
+ // Compile the shaders and bind them to this program
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, vtxSrc);
+ if (vertexShader == 0) {
+ LOG(ERROR) << "Failed to load vertex shader";
+ glDeleteProgram(program);
+ return 0;
+ }
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pxlSrc);
+ if (pixelShader == 0) {
+ LOG(ERROR) << "Failed to load pixel shader";
+ glDeleteProgram(program);
+ glDeleteShader(vertexShader);
+ return 0;
+ }
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, pixelShader);
+
+ glBindAttribLocation(program, 0, "pos");
+ glBindAttribLocation(program, 1, "tex");
+
+ // Link the program
+ glLinkProgram(program);
+ GLint linked = 0;
+ glGetProgramiv(program, GL_LINK_STATUS, &linked);
+ if (!linked) {
+ LOG(ERROR) << "Error linking program";
+ GLint size = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &size);
+ if (size > 0) {
+ // Get and report the error message
+ char* infoLog = (char*)malloc(size);
+ glGetProgramInfoLog(program, size, nullptr, infoLog);
+ LOG(ERROR) << " msg: " << infoLog;
+ free(infoLog);
+ }
+
+ glDeleteProgram(program);
+ glDeleteShader(vertexShader);
+ glDeleteShader(pixelShader);
+ return 0;
+ }
+
+ return program;
+}
+
+::android::sp<HGraphicBufferProducer> convertNativeHandleToHGBP(const NativeHandle& aidlHandle) {
+ native_handle_t* handle = ::android::dupFromAidl(aidlHandle);
+ if (handle->numFds != 0 || handle->numInts < std::ceil(sizeof(size_t) / sizeof(int))) {
+ LOG(ERROR) << "Invalid native handle";
+ return nullptr;
+ }
+ ::android::hardware::hidl_vec<uint8_t> halToken;
+ halToken.setToExternal(reinterpret_cast<uint8_t*>(const_cast<int*>(&(handle->data[1]))),
+ handle->data[0]);
+ ::android::sp<HGraphicBufferProducer> hgbp =
+ HGraphicBufferProducer::castFrom(::android::retrieveHalInterface(halToken));
+ return std::move(hgbp);
+}
+
+} // namespace
+
+namespace aidl::android::hardware::automotive::evs::implementation {
+
+// Main entry point
+bool GlWrapper::initialize(const std::shared_ptr<ICarDisplayProxy>& pWindowProxy,
+ uint64_t displayId) {
+ LOG(DEBUG) << __FUNCTION__;
+
+ if (!pWindowProxy) {
+ LOG(ERROR) << "Could not get ICarDisplayProxy.";
+ return false;
+ }
+
+ DisplayDesc displayDesc;
+ auto status = pWindowProxy->getDisplayInfo(displayId, &displayDesc);
+ if (!status.isOk()) {
+ LOG(ERROR) << "Failed to read the display information";
+ return false;
+ }
+
+ mWidth = displayDesc.width;
+ mHeight = displayDesc.height;
+ if ((displayDesc.orientation != Rotation::ROTATION_0) &&
+ (displayDesc.orientation != Rotation::ROTATION_180)) {
+ std::swap(mWidth, mHeight);
+ }
+ LOG(INFO) << "Display resolution is " << mWidth << "x" << mHeight;
+
+ NativeHandle aidlHandle;
+ status = pWindowProxy->getHGraphicBufferProducer(displayId, &aidlHandle);
+ if (!status.isOk()) {
+ LOG(ERROR) << "Failed to get IGraphicBufferProducer from ICarDisplayProxy.";
+ return false;
+ }
+
+ mGfxBufferProducer = convertNativeHandleToHGBP(aidlHandle);
+ if (!mGfxBufferProducer) {
+ LOG(ERROR) << "Failed to convert a NativeHandle to HGBP.";
+ return false;
+ }
+
+ mSurfaceHolder = getSurfaceFromHGBP(mGfxBufferProducer);
+ if (mSurfaceHolder == nullptr) {
+ LOG(ERROR) << "Failed to get a Surface from HGBP.";
+ return false;
+ }
+
+ mWindow = getNativeWindow(mSurfaceHolder.get());
+ if (mWindow == nullptr) {
+ LOG(ERROR) << "Failed to get a native window from Surface.";
+ return false;
+ }
+
+ // Set up our OpenGL ES context associated with the default display
+ mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (mDisplay == EGL_NO_DISPLAY) {
+ LOG(ERROR) << "Failed to get egl display";
+ return false;
+ }
+
+ EGLint major = 2;
+ EGLint minor = 0;
+ if (!eglInitialize(mDisplay, &major, &minor)) {
+ LOG(ERROR) << "Failed to initialize EGL: " << getEGLError();
+ return false;
+ }
+
+ const EGLint config_attribs[] = {
+ // clang-format off
+ // Tag Value
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_DEPTH_SIZE, 0,
+ EGL_NONE
+ // clang-format on
+ };
+
+ // Pick the default configuration without constraints (is this good enough?)
+ EGLConfig egl_config = {0};
+ EGLint numConfigs = -1;
+ eglChooseConfig(mDisplay, config_attribs, &egl_config, 1, &numConfigs);
+ if (numConfigs != 1) {
+ LOG(ERROR) << "Didn't find a suitable format for our display window, " << getEGLError();
+ return false;
+ }
+
+ // Create the EGL render target surface
+ mSurface = eglCreateWindowSurface(mDisplay, egl_config, mWindow, nullptr);
+ if (mSurface == EGL_NO_SURFACE) {
+ LOG(ERROR) << "eglCreateWindowSurface failed, " << getEGLError();
+ return false;
+ }
+
+ // Create the EGL context
+ // NOTE: Our shader is (currently at least) written to require version 3, so this
+ // is required.
+ const EGLint context_attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE};
+ mContext = eglCreateContext(mDisplay, egl_config, EGL_NO_CONTEXT, context_attribs);
+ if (mContext == EGL_NO_CONTEXT) {
+ LOG(ERROR) << "Failed to create OpenGL ES Context: " << getEGLError();
+ return false;
+ }
+
+ // Activate our render target for drawing
+ if (!eglMakeCurrent(mDisplay, mSurface, mSurface, mContext)) {
+ LOG(ERROR) << "Failed to make the OpenGL ES Context current: " << getEGLError();
+ return false;
+ }
+
+ // Create the shader program for our simple pipeline
+ mShaderProgram = buildShaderProgram(vertexShaderSource, pixelShaderSource);
+ if (!mShaderProgram) {
+ LOG(ERROR) << "Failed to build shader program: " << getEGLError();
+ return false;
+ }
+
+ // Create a GL texture that will eventually wrap our externally created texture surface(s)
+ glGenTextures(1, &mTextureMap);
+ if (mTextureMap <= 0) {
+ LOG(ERROR) << "Didn't get a texture handle allocated: " << getEGLError();
+ return false;
+ }
+
+ // Turn off mip-mapping for the created texture surface
+ // (the inbound camera imagery doesn't have MIPs)
+ glBindTexture(GL_TEXTURE_2D, mTextureMap);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ return true;
+}
+
+void GlWrapper::shutdown() {
+ // Drop our device textures
+ if (mKHRimage != EGL_NO_IMAGE_KHR) {
+ eglDestroyImageKHR(mDisplay, mKHRimage);
+ mKHRimage = EGL_NO_IMAGE_KHR;
+ }
+
+ // Release all GL resources
+ if (eglGetCurrentContext() == mContext) {
+ eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ }
+ eglDestroySurface(mDisplay, mSurface);
+ eglDestroyContext(mDisplay, mContext);
+ eglTerminate(mDisplay);
+ mSurface = EGL_NO_SURFACE;
+ mContext = EGL_NO_CONTEXT;
+ mDisplay = EGL_NO_DISPLAY;
+
+ // Release the window
+ mSurfaceHolder = nullptr;
+}
+
+void GlWrapper::showWindow(const std::shared_ptr<ICarDisplayProxy>& pWindowProxy, uint64_t id) {
+ if (pWindowProxy) {
+ pWindowProxy->showWindow(id);
+ } else {
+ LOG(ERROR) << "ICarDisplayProxy is not available.";
+ }
+}
+
+void GlWrapper::hideWindow(const std::shared_ptr<ICarDisplayProxy>& pWindowProxy, uint64_t id) {
+ if (pWindowProxy) {
+ pWindowProxy->hideWindow(id);
+ } else {
+ LOG(ERROR) << "ICarDisplayProxy is not available.";
+ }
+}
+
+bool GlWrapper::updateImageTexture(buffer_handle_t handle,
+ const HardwareBufferDescription& description) {
+ if (mKHRimage != EGL_NO_IMAGE_KHR) {
+ return true;
+ }
+
+ // Create a temporary GraphicBuffer to wrap the provided handle.
+ sp<GraphicBuffer> pGfxBuffer =
+ new GraphicBuffer(description.width, description.height,
+ static_cast<::android::PixelFormat>(description.format),
+ description.layers, static_cast<uint32_t>(description.usage),
+ description.stride, const_cast<native_handle_t*>(handle),
+ /* keepOwnership= */ false);
+ if (!pGfxBuffer) {
+ LOG(ERROR) << "Failed to allocate GraphicBuffer to wrap our native handle";
+ return false;
+ }
+
+ // Get a GL compatible reference to the graphics buffer we've been given
+ EGLint eglImageAttributes[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
+ EGLClientBuffer cbuf = static_cast<EGLClientBuffer>(pGfxBuffer->getNativeBuffer());
+ mKHRimage = eglCreateImageKHR(mDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, cbuf,
+ eglImageAttributes);
+ if (mKHRimage == EGL_NO_IMAGE_KHR) {
+ LOG(ERROR) << "Error creating EGLImage: " << getEGLError();
+ return false;
+ }
+
+ // Update the texture handle we already created to refer to this gralloc buffer
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTextureMap);
+ glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(mKHRimage));
+
+ return true;
+}
+
+void GlWrapper::renderImageToScreen() {
+ // Set the viewport
+ glViewport(0, 0, mWidth, mHeight);
+
+ // Clear the color buffer
+ glClearColor(0.1f, 0.5f, 0.1f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Select our screen space simple texture shader
+ glUseProgram(mShaderProgram);
+
+ // Bind the texture and assign it to the shader's sampler
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTextureMap);
+ GLint sampler = glGetUniformLocation(mShaderProgram, "tex");
+ glUniform1i(sampler, 0);
+
+ // We want our image to show up opaque regardless of alpha values
+ glDisable(GL_BLEND);
+
+ // Draw a rectangle on the screen
+ GLfloat vertsCarPos[] = {
+ // clang-format off
+ -0.8, 0.8, 0.0f, // left top in window space
+ 0.8, 0.8, 0.0f, // right top
+ -0.8, -0.8, 0.0f, // left bottom
+ 0.8, -0.8, 0.0f // right bottom
+ // clang-format on
+ };
+
+ // NOTE: We didn't flip the image in the texture, so V=0 is actually the top of the image
+ GLfloat vertsCarTex[] = {
+ // clang-format off
+ 0.0f, 0.0f, // left top
+ 1.0f, 0.0f, // right top
+ 0.0f, 1.0f, // left bottom
+ 1.0f, 1.0f // right bottom
+ // clang-format on
+ };
+ glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertsCarPos);
+ glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, vertsCarTex);
+ glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(1);
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ // Clean up and flip the rendered result to the front so it is visible
+ glDisableVertexAttribArray(0);
+ glDisableVertexAttribArray(1);
+
+ glFinish();
+
+ if (eglSwapBuffers(mDisplay, mSurface) == EGL_FALSE) {
+ LOG(WARNING) << "Failed to swap EGL buffers, " << getEGLError();
+ }
+}
+
+} // namespace aidl::android::hardware::automotive::evs::implementation
diff --git a/automotive/evs/aidl/impl/default/src/service.cpp b/automotive/evs/aidl/impl/default/src/service.cpp
index 0a0913f..7532d87 100644
--- a/automotive/evs/aidl/impl/default/src/service.cpp
+++ b/automotive/evs/aidl/impl/default/src/service.cpp
@@ -14,38 +14,75 @@
* limitations under the License.
*/
-#define LOG_TAG "EvsService"
-
-#include <DefaultEvsEnumerator.h>
+#include "EvsEnumerator.h"
+#include "EvsGlDisplay.h"
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <utils/Log.h>
-using ::aidl::android::hardware::automotive::evs::implementation::DefaultEvsEnumerator;
+#include <unistd.h>
-int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
- std::shared_ptr<DefaultEvsEnumerator> vhal = ndk::SharedRefBase::make<DefaultEvsEnumerator>();
+#include <atomic>
+#include <cstdlib>
+#include <string_view>
- ALOGI("Registering as service...");
- binder_exception_t err =
- AServiceManager_addService(vhal->asBinder().get(), "android.hardware.automotive.evs");
+namespace {
+
+using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy;
+using ::aidl::android::hardware::automotive::evs::implementation::EvsEnumerator;
+
+constexpr std::string_view kDisplayServiceInstanceName = "/default";
+constexpr std::string_view kHwInstanceName = "/hw/0";
+constexpr int kNumBinderThreads = 1;
+
+} // namespace
+
+int main() {
+ LOG(INFO) << "EVS Hardware Enumerator service is starting";
+
+ const std::string displayServiceInstanceName =
+ std::string(ICarDisplayProxy::descriptor) + std::string(kDisplayServiceInstanceName);
+ if (!AServiceManager_isDeclared(displayServiceInstanceName.data())) {
+ // TODO: We may just want to disable EVS display.
+ LOG(ERROR) << displayServiceInstanceName << " is required.";
+ return EXIT_FAILURE;
+ }
+
+ std::shared_ptr<ICarDisplayProxy> displayService = ICarDisplayProxy::fromBinder(
+ ::ndk::SpAIBinder(AServiceManager_waitForService(displayServiceInstanceName.data())));
+ if (!displayService) {
+ LOG(ERROR) << "Cannot use " << displayServiceInstanceName << ". Exiting.";
+ return EXIT_FAILURE;
+ }
+
+ // Register our service -- if somebody is already registered by our name,
+ // they will be killed (their thread pool will throw an exception).
+ std::shared_ptr<EvsEnumerator> service =
+ ndk::SharedRefBase::make<EvsEnumerator>(displayService);
+ if (!service) {
+ LOG(ERROR) << "Failed to instantiate the service";
+ return EXIT_FAILURE;
+ }
+
+ const std::string instanceName =
+ std::string(EvsEnumerator::descriptor) + std::string(kHwInstanceName);
+ auto err = AServiceManager_addService(service->asBinder().get(), instanceName.data());
if (err != EX_NONE) {
- ALOGE("failed to register android.hardware.automotive.evs service, exception: %d", err);
- return 1;
+ LOG(ERROR) << "Failed to register " << instanceName << ", exception = " << err;
+ return EXIT_FAILURE;
}
- if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) {
- ALOGE("%s", "failed to set thread pool max thread count");
- return 1;
+ if (!ABinderProcess_setThreadPoolMaxThreadCount(kNumBinderThreads)) {
+ LOG(ERROR) << "Failed to set thread pool";
+ return EXIT_FAILURE;
}
+
ABinderProcess_startThreadPool();
-
- ALOGI("Evs Service Ready");
+ LOG(INFO) << "EVS Hardware Enumerator is ready";
ABinderProcess_joinThreadPool();
-
- ALOGI("Evs Service Exiting");
-
- return 0;
+ // In normal operation, we don't expect the thread pool to exit
+ LOG(INFO) << "EVS Hardware Enumerator is shutting down";
+ return EXIT_SUCCESS;
}
diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp
new file mode 100644
index 0000000..113b14e
--- /dev/null
+++ b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp
@@ -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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_defaults {
+ name: "BindToDeviceSocketMutatorDefaults",
+ static_libs: [
+ "android.hardware.automotive.can@libnetdevice",
+ "libnl++",
+ ],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libgrpc++",
+ ],
+ cflags: [
+ "-Wno-unused-parameter",
+ ],
+}
+
+cc_library {
+ name: "BindToDeviceSocketMutatorLib",
+ vendor_available: true,
+ srcs: ["src/*"],
+ export_include_dirs: ["include"],
+ defaults: ["BindToDeviceSocketMutatorDefaults"],
+}
diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h b/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h
new file mode 100644
index 0000000..bafcc65
--- /dev/null
+++ b/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h
@@ -0,0 +1,35 @@
+/*
+ * 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 <grpc++/grpc++.h>
+#include <src/core/lib/iomgr/socket_mutator.h>
+#include <string>
+
+namespace android::hardware::automotive::remoteaccess {
+
+class BindToDeviceSocketMutator final : public grpc_socket_mutator {
+ public:
+ BindToDeviceSocketMutator(const std::string_view& interface_name);
+
+ bool mutateFd(int fd);
+
+ private:
+ std::string mIfname;
+};
+
+} // namespace android::hardware::automotive::remoteaccess
diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp b/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp
new file mode 100644
index 0000000..c6a96de
--- /dev/null
+++ b/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp
@@ -0,0 +1,57 @@
+/*
+ * 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 "BindToDeviceSocketMutator.h"
+
+#include <android-base/logging.h>
+#include <errno.h>
+#include <sys/socket.h>
+
+namespace android::hardware::automotive::remoteaccess {
+
+bool BindToDeviceSocketMutator::mutateFd(int fd) {
+ int ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, mIfname.c_str(), mIfname.size());
+ if (ret != 0) {
+ PLOG(ERROR) << "Can't bind socket to interface " << mIfname;
+ return false;
+ }
+ return true;
+}
+
+bool bind_to_device_mutator_mutate_fd(int fd, grpc_socket_mutator* mutator) {
+ BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator;
+ return bsm->mutateFd(fd);
+}
+
+int bind_to_device_mutator_compare(grpc_socket_mutator* a, grpc_socket_mutator* b) {
+ return ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0));
+}
+
+void bind_to_device_mutator_destroy(grpc_socket_mutator* mutator) {
+ BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator;
+ delete bsm;
+}
+
+grpc_socket_mutator_vtable bind_to_device_mutator_vtable = {bind_to_device_mutator_mutate_fd,
+ bind_to_device_mutator_compare,
+ bind_to_device_mutator_destroy};
+
+BindToDeviceSocketMutator::BindToDeviceSocketMutator(const std::string_view& interface_name) {
+ mIfname = interface_name;
+ grpc_socket_mutator_init(this, &bind_to_device_mutator_vtable);
+}
+
+} // namespace android::hardware::automotive::remoteaccess
diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp
index f27b8f8..0155667 100644
--- a/automotive/remoteaccess/hal/default/Android.bp
+++ b/automotive/remoteaccess/hal/default/Android.bp
@@ -22,22 +22,27 @@
name: "remote-access-hal-defaults",
vendor: true,
relative_install_path: "hw",
- srcs: ["src/RemoteAccessImpl.cpp"],
+ srcs: [
+ "src/RemoteAccessImpl.cpp",
+ ],
whole_static_libs: [
"RemoteAccessService",
],
+ static_libs: [
+ "BindToDeviceSocketMutatorLib",
+ ],
shared_libs: [
- "libbase",
"libbinder_ndk",
- "liblog",
"libutils",
- "libgrpc++",
"libprotobuf-cpp-full",
],
defaults: [
"vhalclient_defaults",
+ "BindToDeviceSocketMutatorDefaults",
],
cflags: [
+ // This is already included in BindToDeviceSocketMutatorDefaults but
+ // might be overridden by vhalclient_defaults.
"-Wno-unused-parameter",
],
}
@@ -59,6 +64,7 @@
init_rc: ["remoteaccess-tcu-test-service.rc"],
cflags: [
"-DGRPC_SERVICE_ADDRESS=\"10.10.10.1:50051\"",
+ "-DGRPC_SERVICE_IFNAME=\"eth1\"",
],
}
diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp
index 8720c2f..d525141 100644
--- a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp
+++ b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp
@@ -18,45 +18,60 @@
#include "RemoteAccessService.h"
+#include "BindToDeviceSocketMutator.h"
+
+#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <grpcpp/create_channel.h>
+#include <libnetdevice/libnetdevice.h>
#include <stdlib.h>
-#include <utils/Log.h>
constexpr char SERVICE_NAME[] = "android.hardware.automotive.remoteaccess.IRemoteAccess/default";
int main(int /* argc */, char* /* argv */[]) {
- ALOGI("Registering RemoteAccessService as service...");
+ LOG(INFO) << "Registering RemoteAccessService as service...";
#ifndef GRPC_SERVICE_ADDRESS
- ALOGE("GRPC_SERVICE_ADDRESS is not defined, exiting");
+ LOG(ERROR) << "GRPC_SERVICE_ADDRESS is not defined, exiting";
exit(1);
#endif
- auto channel = grpc::CreateChannel(GRPC_SERVICE_ADDRESS, grpc::InsecureChannelCredentials());
+ grpc::ChannelArguments grpcargs = {};
+
+#ifdef GRPC_SERVICE_IFNAME
+ grpcargs.SetSocketMutator(
+ new android::hardware::automotive::remoteaccess::BindToDeviceSocketMutator(
+ GRPC_SERVICE_IFNAME));
+ LOG(DEBUG) << "GRPC_SERVICE_IFNAME specified as: " << GRPC_SERVICE_IFNAME;
+ LOG(INFO) << "Waiting for interface: " << GRPC_SERVICE_IFNAME;
+ android::netdevice::waitFor({GRPC_SERVICE_IFNAME},
+ android::netdevice::WaitCondition::PRESENT_AND_UP);
+ LOG(INFO) << "Waiting for interface: " << GRPC_SERVICE_IFNAME << " done";
+#endif
+ auto channel = grpc::CreateCustomChannel(GRPC_SERVICE_ADDRESS,
+ grpc::InsecureChannelCredentials(), grpcargs);
auto clientStub = android::hardware::automotive::remoteaccess::WakeupClient::NewStub(channel);
auto service = ndk::SharedRefBase::make<
android::hardware::automotive::remoteaccess::RemoteAccessService>(clientStub.get());
binder_exception_t err = AServiceManager_addService(service->asBinder().get(), SERVICE_NAME);
if (err != EX_NONE) {
- ALOGE("failed to register android.hardware.automotive.remote.IRemoteAccess service, "
- "exception: %d",
- err);
+ LOG(ERROR) << "failed to register android.hardware.automotive.remote.IRemoteAccess service"
+ << ", exception: " << err;
exit(1);
}
if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) {
- ALOGE("%s", "failed to set thread pool max thread count");
+ LOG(ERROR) << "failed to set thread pool max thread count";
exit(1);
}
ABinderProcess_startThreadPool();
- ALOGI("RemoteAccess service Ready");
+ LOG(INFO) << "RemoteAccess service Ready";
ABinderProcess_joinThreadPool();
- ALOGW("Should not reach here");
+ LOG(ERROR) << "Should not reach here";
return 0;
}
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
index d1762c5..c8a36b8 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
@@ -268,6 +268,7 @@
{VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE},
{VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ},
{VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess::READ},
{VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE},
{VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ},
{VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ},
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
index 587d8f3..bea5002 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
@@ -268,6 +268,7 @@
{VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE},
{VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode::CONTINUOUS},
{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},
diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
index 165c1bf..ee214ef 100644
--- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
@@ -260,6 +260,7 @@
Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE),
Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ),
diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
index 7814a44..d3cf71e 100644
--- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
@@ -260,6 +260,7 @@
Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE),
Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode.CONTINUOUS),
Map.entry(VehicleProperty.HANDS_ON_DETECTION_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),
diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
index b6d987e..fe7f0cb 100644
--- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
+++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
@@ -1329,22 +1329,26 @@
},
{
"property": "VehicleProperty::SEAT_OCCUPANCY",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleSeatOccupancyState::VACANT"
+ ]
+ },
"areas": [
{
- "defaultValue": {
- "int32Values": [
- "VehicleSeatOccupancyState::VACANT"
- ]
- },
"areaId": "Constants::SEAT_1_LEFT"
},
{
- "defaultValue": {
- "int32Values": [
- "VehicleSeatOccupancyState::VACANT"
- ]
- },
"areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -1854,7 +1858,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -1867,7 +1883,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
],
"configArray": [
@@ -1918,7 +1946,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -1931,7 +1971,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -1944,7 +1996,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -1957,7 +2021,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -1970,7 +2046,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -1983,7 +2071,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -2009,7 +2109,27 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL",
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": 1,
+ "maxInt32Value": 7
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": 1,
+ "maxInt32Value": 7
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": 1,
+ "maxInt32Value": 7
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": 1,
+ "maxInt32Value": 7
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
"minInt32Value": 1,
"maxInt32Value": 7
}
@@ -2024,7 +2144,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -2043,7 +2175,19 @@
},
"areas": [
{
- "areaId": "Constants::HVAC_ALL"
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
@@ -2064,6 +2208,21 @@
"areaId": "Constants::SEAT_1_RIGHT",
"minInt32Value": 0,
"maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
}
],
"comment": "0 is off and +ve values indicate ventilation level."
@@ -2101,6 +2260,21 @@
"areaId": "Constants::SEAT_1_RIGHT",
"minInt32Value": -2,
"maxInt32Value": 2
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -2,
+ "maxInt32Value": 2
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -2,
+ "maxInt32Value": 2
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -2,
+ "maxInt32Value": 2
}
],
"comment": "+ve values for heating and -ve for cooling"
@@ -2122,45 +2296,59 @@
},
{
"property": "VehicleProperty::HVAC_TEMPERATURE_CURRENT",
+ "defaultValue": {
+ "floatValues": [
+ 19.1
+ ]
+ },
"areas": [
{
- "defaultValue": {
- "floatValues": [
- 17.3
- ]
- },
- "areaId": 49
+ "areaId": "Constants::SEAT_1_LEFT"
},
{
- "defaultValue": {
- "floatValues": [
- 19.1
- ]
- },
- "areaId": 68
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
}
]
},
{
"property": "VehicleProperty::HVAC_TEMPERATURE_SET",
+ "defaultValue": {
+ "floatValues": [
+ 17.0
+ ]
+ },
"areas": [
{
- "defaultValue": {
- "floatValues": [
- 16.0
- ]
- },
- "areaId": 49,
+ "areaId": "Constants::SEAT_1_LEFT",
"minFloatValue": 16.0,
"maxFloatValue": 28.0
},
{
- "defaultValue": {
- "floatValues": [
- 20.0
- ]
- },
- "areaId": 68,
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minFloatValue": 16.0,
+ "maxFloatValue": 28.0
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minFloatValue": 16.0,
+ "maxFloatValue": 28.0
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minFloatValue": 16.0,
+ "maxFloatValue": 28.0
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
"minFloatValue": 16.0,
"maxFloatValue": 28.0
}
@@ -3288,6 +3476,23 @@
]
},
{
+ "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE",
+ "defaultValue": {
+ "int32Values": [
+ 100000
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "minInt32Value": 0,
+ "maxInt32Value": 200000
+ }
+ ],
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
"property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED",
"defaultValue": {
"int32Values": [
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
index 956c7c0..6fd2367 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
@@ -194,7 +194,7 @@
const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
ValueResultType getEchoReverseBytes(
const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
- bool isHvacPropAndHvacNotAvailable(int32_t propId) const;
+ bool isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const;
std::unordered_map<int32_t, ConfigDeclaration> loadConfigDeclarations();
@@ -236,7 +236,7 @@
const aidl::android::hardware::automotive::vehicle::SetValueRequest& request);
std::string genFakeDataCommand(const std::vector<std::string>& options);
- void sendHvacPropertiesCurrentValues();
+ void sendHvacPropertiesCurrentValues(int32_t areaId);
static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp(
aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action,
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
index 00ebdda..78c21e9 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
@@ -15,6 +15,7 @@
*/
#define LOG_TAG "FakeVehicleHardware"
+#define ATRACE_TAG ATRACE_TAG_HAL
#define FAKE_VEHICLEHARDWARE_DEBUG false // STOPSHIP if true.
#include "FakeVehicleHardware.h"
@@ -33,6 +34,7 @@
#include <android-base/strings.h>
#include <utils/Log.h>
#include <utils/SystemClock.h>
+#include <utils/Trace.h>
#include <dirent.h>
#include <inttypes.h>
@@ -296,16 +298,27 @@
return {};
}
-bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId) const {
+bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const {
std::unordered_set<int32_t> powerProps(std::begin(HVAC_POWER_PROPERTIES),
std::end(HVAC_POWER_PROPERTIES));
if (powerProps.count(propId)) {
- auto hvacPowerOnResult =
- mServerSidePropStore->readValue(toInt(VehicleProperty::HVAC_POWER_ON), HVAC_ALL);
-
- if (hvacPowerOnResult.ok() && hvacPowerOnResult.value()->value.int32Values.size() == 1 &&
- hvacPowerOnResult.value()->value.int32Values[0] == 0) {
- return true;
+ auto hvacPowerOnResults =
+ mServerSidePropStore->readValuesForProperty(toInt(VehicleProperty::HVAC_POWER_ON));
+ if (!hvacPowerOnResults.ok()) {
+ ALOGW("failed to get HVAC_POWER_ON 0x%x, error: %s",
+ toInt(VehicleProperty::HVAC_POWER_ON), getErrorMsg(hvacPowerOnResults).c_str());
+ return false;
+ }
+ auto& hvacPowerOnValues = hvacPowerOnResults.value();
+ for (size_t j = 0; j < hvacPowerOnValues.size(); j++) {
+ auto hvacPowerOnValue = std::move(hvacPowerOnValues[j]);
+ if ((hvacPowerOnValue->areaId & areaId) == areaId) {
+ if (hvacPowerOnValue->value.int32Values.size() == 1 &&
+ hvacPowerOnValue->value.int32Values[0] == 0) {
+ return true;
+ }
+ break;
+ }
}
}
return false;
@@ -367,7 +380,7 @@
return getUserHalProp(value);
}
- if (isHvacPropAndHvacNotAvailable(propId)) {
+ if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) {
*isSpecialValue = true;
return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available";
}
@@ -417,7 +430,7 @@
return std::move(gotValue);
}
-void FakeVehicleHardware::sendHvacPropertiesCurrentValues() {
+void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId) {
for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
int powerPropId = HVAC_POWER_PROPERTIES[i];
auto powerPropResults = mServerSidePropStore->readValuesForProperty(powerPropId);
@@ -429,11 +442,13 @@
auto& powerPropValues = powerPropResults.value();
for (size_t j = 0; j < powerPropValues.size(); j++) {
auto powerPropValue = std::move(powerPropValues[j]);
- powerPropValue->status = VehiclePropertyStatus::AVAILABLE;
- powerPropValue->timestamp = elapsedRealtimeNano();
- // This will trigger a property change event for the current hvac property value.
- mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true,
- VehiclePropertyStore::EventMode::ALWAYS);
+ if ((powerPropValue->areaId & areaId) == powerPropValue->areaId) {
+ powerPropValue->status = VehiclePropertyStatus::AVAILABLE;
+ powerPropValue->timestamp = elapsedRealtimeNano();
+ // This will trigger a property change event for the current hvac property value.
+ mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true,
+ VehiclePropertyStore::EventMode::ALWAYS);
+ }
}
}
}
@@ -453,10 +468,10 @@
value.value.int32Values[0] == 1) {
// If we are turning HVAC power on, send current hvac property values through on change
// event.
- sendHvacPropertiesCurrentValues();
+ sendHvacPropertiesCurrentValues(value.areaId);
}
- if (isHvacPropAndHvacNotAvailable(propId)) {
+ if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) {
*isSpecialValue = true;
return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available";
}
@@ -1628,11 +1643,15 @@
std::unordered_map<std::shared_ptr<const GetValuesCallback>, std::vector<GetValueResult>>
callbackToResults;
for (const auto& rwc : mRequests.flush()) {
+ ATRACE_BEGIN("FakeVehicleHardware:handleGetValueRequest");
auto result = mHardware->handleGetValueRequest(rwc.request);
+ ATRACE_END();
callbackToResults[rwc.callback].push_back(std::move(result));
}
for (const auto& [callback, results] : callbackToResults) {
+ ATRACE_BEGIN("FakeVehicleHardware:call get value result callback");
(*callback)(std::move(results));
+ ATRACE_END();
}
}
@@ -1642,11 +1661,15 @@
std::unordered_map<std::shared_ptr<const SetValuesCallback>, std::vector<SetValueResult>>
callbackToResults;
for (const auto& rwc : mRequests.flush()) {
+ ATRACE_BEGIN("FakeVehicleHardware:handleSetValueRequest");
auto result = mHardware->handleSetValueRequest(rwc.request);
+ ATRACE_END();
callbackToResults[rwc.callback].push_back(std::move(result));
}
for (const auto& [callback, results] : callbackToResults) {
+ ATRACE_BEGIN("FakeVehicleHardware:call set value result callback");
(*callback)(std::move(results));
+ ATRACE_END();
}
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
index f3593aa..93a63ad 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
@@ -1147,67 +1147,100 @@
}
TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) {
- StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
- .areaId = HVAC_ALL,
- .value.int32Values = {0}});
+ int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT};
+ for (int areaId : seatAreaIds) {
+ StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .areaId = areaId,
+ .value.int32Values = {0}});
- ASSERT_EQ(status, StatusCode::OK);
+ ASSERT_EQ(status, StatusCode::OK);
- for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
- int powerPropId = HVAC_POWER_PROPERTIES[i];
- auto getValueResult = getValue(VehiclePropValue{
- .prop = powerPropId,
- .areaId = HVAC_ALL,
- });
+ for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
+ int powerPropId = HVAC_POWER_PROPERTIES[i];
+ for (int powerDependentAreaId : seatAreaIds) {
+ auto getValueResult = getValue(VehiclePropValue{
+ .prop = powerPropId,
+ .areaId = powerDependentAreaId,
+ });
- EXPECT_FALSE(getValueResult.ok());
- EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE);
+ if (areaId == powerDependentAreaId) {
+ EXPECT_FALSE(getValueResult.ok());
+ EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE);
+ } else {
+ EXPECT_TRUE(getValueResult.ok());
+ }
+ }
+ }
+
+ // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence
+ // on this value from any power dependent property values other than those with the same
+ // areaId.
+ setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .areaId = areaId,
+ .value.int32Values = {1}});
}
}
TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) {
- StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
- .areaId = HVAC_ALL,
- .value.int32Values = {0}});
+ int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT};
+ for (int areaId : seatAreaIds) {
+ StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .areaId = areaId,
+ .value.int32Values = {0}});
- ASSERT_EQ(status, StatusCode::OK);
+ ASSERT_EQ(status, StatusCode::OK);
- for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
- int powerPropId = HVAC_POWER_PROPERTIES[i];
- status = setValue(VehiclePropValue{
- .prop = powerPropId,
- .areaId = HVAC_ALL,
- });
+ for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
+ int powerPropId = HVAC_POWER_PROPERTIES[i];
+ for (int powerDependentAreaId : seatAreaIds) {
+ StatusCode status = setValue(VehiclePropValue{.prop = powerPropId,
+ .areaId = powerDependentAreaId,
+ .value.int32Values = {1}});
- EXPECT_EQ(status, StatusCode::NOT_AVAILABLE);
+ if (areaId == powerDependentAreaId) {
+ EXPECT_EQ(status, StatusCode::NOT_AVAILABLE);
+ } else {
+ EXPECT_EQ(status, StatusCode::OK);
+ }
+ }
+ }
+
+ // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence
+ // on this value from any power dependent property values other than those with the same
+ // areaId.
+ setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .areaId = areaId,
+ .value.int32Values = {1}});
}
}
TEST_F(FakeVehicleHardwareTest, testHvacPowerOnSendCurrentHvacPropValues) {
- StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
- .areaId = HVAC_ALL,
- .value.int32Values = {0}});
+ int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT};
+ for (int areaId : seatAreaIds) {
+ StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .areaId = areaId,
+ .value.int32Values = {0}});
- ASSERT_EQ(status, StatusCode::OK);
+ ASSERT_EQ(status, StatusCode::OK);
- clearChangedProperties();
+ clearChangedProperties();
+ setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .areaId = areaId,
+ .value.int32Values = {1}});
- status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
- .areaId = HVAC_ALL,
- .value.int32Values = {1}});
+ auto events = getChangedProperties();
+ // If we turn HVAC power on, we expect to receive one property event for every HVAC prop
+ // areas plus one event for HVAC_POWER_ON.
+ std::vector<int32_t> changedPropIds;
+ for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
+ changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]);
+ }
+ changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON));
- auto events = getChangedProperties();
- // If we turn HVAC power on, we expect to receive one property event for every HVAC prop areas
- // plus one event for HVAC_POWER_ON.
- std::vector<int32_t> changedPropIds;
- for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
- changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]);
- }
- changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON));
- ASSERT_EQ(events.size(), changedPropIds.size());
- for (const auto& event : events) {
- EXPECT_EQ(event.areaId, HVAC_ALL);
- EXPECT_THAT(event.prop, AnyOfArray(changedPropIds));
+ for (const auto& event : events) {
+ EXPECT_EQ(event.areaId, areaId);
+ EXPECT_THAT(event.prop, AnyOfArray(changedPropIds));
+ }
}
}
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto
index b16daa8..749ad6a 100644
--- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto
@@ -18,9 +18,33 @@
package android.hardware.automotive.vehicle.proto;
+import "android/hardware/automotive/vehicle/StatusCode.proto";
import "android/hardware/automotive/vehicle/VehiclePropValue.proto";
message VehiclePropValueRequest {
- int32 request_id = 1;
+ int64 request_id = 1;
VehiclePropValue value = 2;
};
+
+message SetValueResult {
+ int64 request_id = 1;
+ StatusCode status = 2;
+};
+
+message GetValueResult {
+ int64 request_id = 1;
+ StatusCode status = 2;
+ VehiclePropValue value = 3;
+};
+
+message VehiclePropValueRequests {
+ repeated VehiclePropValueRequest requests = 1;
+};
+
+message SetValueResults {
+ repeated SetValueResult results = 1;
+};
+
+message GetValueResults {
+ repeated GetValueResult results = 1;
+};
diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
index 4a4e023..a7ac1b4 100644
--- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
@@ -15,6 +15,7 @@
*/
#define LOG_TAG "DefaultVehicleHal"
+#define ATRACE_TAG ATRACE_TAG_HAL
#include <DefaultVehicleHal.h>
@@ -28,6 +29,7 @@
#include <private/android_filesystem_config.h>
#include <utils/Log.h>
#include <utils/SystemClock.h>
+#include <utils/Trace.h>
#include <inttypes.h>
#include <set>
@@ -350,6 +352,7 @@
ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback,
const GetValueRequests& requests) {
+ ATRACE_CALL();
if (callback == nullptr) {
return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER);
}
@@ -436,6 +439,7 @@
ScopedAStatus DefaultVehicleHal::setValues(const CallbackType& callback,
const SetValueRequests& requests) {
+ ATRACE_CALL();
if (callback == nullptr) {
return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER);
}
diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
index 36fa5e6..05e569a 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
@@ -671,8 +671,8 @@
}
TEST_F(DefaultVehicleHalTest, testGetValuesFinishBeforeTimeout) {
- // timeout: 0.1s
- int64_t timeout = 100000000;
+ // timeout: 1s
+ int64_t timeout = 1000000000;
setTimeout(timeout);
GetValueRequests requests;
@@ -681,17 +681,15 @@
ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok());
- // The response would be returned after 0.05s.
- getHardware()->setSleepTime(timeout / 2);
+ // The response would be returned after 0.01s.
+ getHardware()->setSleepTime(timeout / 100);
getHardware()->addGetValueResponses(expectedResults);
auto status = getClient()->getValues(getCallbackClient(), requests);
ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage();
- // Wait for the response.
- std::this_thread::sleep_for(std::chrono::nanoseconds(timeout));
-
+ ASSERT_TRUE(getCallback()->waitForGetValueResults(1, timeout)) << "no results in callback";
auto maybeGetValueResults = getCallback()->nextGetValueResults();
ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback";
EXPECT_EQ(maybeGetValueResults.value().payloads, expectedResults) << "results mismatch";
@@ -699,8 +697,8 @@
}
TEST_F(DefaultVehicleHalTest, testGetValuesFinishAfterTimeout) {
- // timeout: 0.1s
- int64_t timeout = 100000000;
+ // timeout: 0.01s
+ int64_t timeout = 10000000;
setTimeout(timeout);
GetValueRequests requests;
@@ -709,17 +707,14 @@
ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok());
- // The response would be returned after 0.2s.
- getHardware()->setSleepTime(timeout * 2);
+ // The response would be returned after 0.1s.
+ getHardware()->setSleepTime(timeout * 10);
getHardware()->addGetValueResponses(expectedResults);
auto status = getClient()->getValues(getCallbackClient(), requests);
ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage();
- // Wait for the response.
- std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5));
-
for (size_t i = 0; i < expectedResults.size(); i++) {
expectedResults[i] = {
.requestId = expectedResults[i].requestId,
@@ -728,6 +723,8 @@
};
}
+ ASSERT_TRUE(getCallback()->waitForGetValueResults(1, timeout * 100))
+ << "no results in callback";
auto maybeGetValueResults = getCallback()->nextGetValueResults();
ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback";
ASSERT_THAT(maybeGetValueResults.value().payloads, UnorderedElementsAreArray(expectedResults))
@@ -960,8 +957,8 @@
}
TEST_F(DefaultVehicleHalTest, testSetValuesFinishBeforeTimeout) {
- // timeout: 0.1s
- int64_t timeout = 100000000;
+ // timeout: 1s
+ int64_t timeout = 1000000000;
setTimeout(timeout);
SetValueRequests requests;
@@ -970,17 +967,15 @@
ASSERT_TRUE(setValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok());
- // The response would be returned after 0.05s.
- getHardware()->setSleepTime(timeout / 2);
+ // The response would be returned after 0.01s.
+ getHardware()->setSleepTime(timeout / 100);
getHardware()->addSetValueResponses(expectedResults);
auto status = getClient()->setValues(getCallbackClient(), requests);
ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage();
- // Wait for the response.
- std::this_thread::sleep_for(std::chrono::nanoseconds(timeout));
-
+ ASSERT_TRUE(getCallback()->waitForSetValueResults(1, timeout)) << "no set value results";
auto maybeSetValueResults = getCallback()->nextSetValueResults();
ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback";
EXPECT_EQ(maybeSetValueResults.value().payloads, expectedResults) << "results mismatch";
@@ -988,8 +983,8 @@
}
TEST_F(DefaultVehicleHalTest, testSetValuesFinishAfterTimeout) {
- // timeout: 0.1s
- int64_t timeout = 100000000;
+ // timeout: 0.01s
+ int64_t timeout = 10000000;
setTimeout(timeout);
SetValueRequests requests;
@@ -998,17 +993,14 @@
ASSERT_TRUE(setValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok());
- // The response would be returned after 0.2s.
- getHardware()->setSleepTime(timeout * 2);
+ // The response would be returned after 0.1s.
+ getHardware()->setSleepTime(timeout * 10);
getHardware()->addSetValueResponses(expectedResults);
auto status = getClient()->setValues(getCallbackClient(), requests);
ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage();
- // Wait for the response.
- std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5));
-
for (size_t i = 0; i < expectedResults.size(); i++) {
expectedResults[i] = {
.requestId = expectedResults[i].requestId,
@@ -1016,6 +1008,7 @@
};
}
+ ASSERT_TRUE(getCallback()->waitForSetValueResults(1, timeout * 100)) << "no set value results";
auto maybeSetValueResults = getCallback()->nextSetValueResults();
ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback";
ASSERT_THAT(maybeSetValueResults.value().payloads, UnorderedElementsAreArray(expectedResults))
@@ -1456,7 +1449,7 @@
std::vector<SubscribeOptions> options = {
{
.propId = GLOBAL_CONTINUOUS_PROP,
- .sampleRate = 20.0,
+ .sampleRate = 100.0,
},
};
@@ -1469,16 +1462,20 @@
ASSERT_TRUE(status.isOk()) << "unsubscribe failed: " << status.getMessage();
+ // Wait for the last events to come.
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+
// Clear existing events.
while (getCallback()->nextOnPropertyEventResults().has_value()) {
// Do nothing.
}
- // Wait for a while, make sure no new events are generated.
+ // Wait for a while, make sure no new events are generated. If still subscribed, this should
+ // generate around 10 events.
std::this_thread::sleep_for(std::chrono::milliseconds(100));
- ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value())
- << "No property event should be generated after unsubscription";
+ ASSERT_EQ(getCallback()->countOnPropertyEventResults(), 0u)
+ << "Property event generation must stop after unsubscription";
}
class SubscribeInvalidOptionsTest
diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp
index 0e46357..f51ce5c 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp
@@ -16,6 +16,9 @@
#include "MockVehicleCallback.h"
+#include <android-base/thread_annotations.h>
+#include <chrono>
+
namespace android {
namespace hardware {
namespace automotive {
@@ -27,6 +30,7 @@
using ::aidl::android::hardware::automotive::vehicle::SetValueResults;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues;
+using ::android::base::ScopedLockAssertion;
using ::ndk::ScopedAStatus;
using ::ndk::ScopedFileDescriptor;
@@ -46,21 +50,35 @@
} // namespace
ScopedAStatus MockVehicleCallback::onGetValues(const GetValueResults& results) {
- std::scoped_lock<std::mutex> lockGuard(mLock);
- return storeResults(results, &mGetValueResults);
+ ScopedAStatus result;
+ {
+ std::scoped_lock<std::mutex> lockGuard(mLock);
+ result = storeResults(results, &mGetValueResults);
+ }
+ mCond.notify_all();
+ return result;
}
ScopedAStatus MockVehicleCallback::onSetValues(const SetValueResults& results) {
- std::scoped_lock<std::mutex> lockGuard(mLock);
- return storeResults(results, &mSetValueResults);
+ ScopedAStatus result;
+ {
+ std::scoped_lock<std::mutex> lockGuard(mLock);
+ result = storeResults(results, &mSetValueResults);
+ }
+ mCond.notify_all();
+ return result;
}
ScopedAStatus MockVehicleCallback::onPropertyEvent(const VehiclePropValues& results,
int32_t sharedMemoryFileCount) {
- std::scoped_lock<std::mutex> lockGuard(mLock);
-
- mSharedMemoryFileCount = sharedMemoryFileCount;
- return storeResults(results, &mOnPropertyEventResults);
+ ScopedAStatus result;
+ {
+ std::scoped_lock<std::mutex> lockGuard(mLock);
+ mSharedMemoryFileCount = sharedMemoryFileCount;
+ result = storeResults(results, &mOnPropertyEventResults);
+ }
+ mCond.notify_all();
+ return result;
}
ScopedAStatus MockVehicleCallback::onPropertySetError(const VehiclePropErrors&) {
@@ -87,6 +105,22 @@
return mOnPropertyEventResults.size();
}
+bool MockVehicleCallback::waitForSetValueResults(size_t size, size_t timeoutInNano) {
+ std::unique_lock lk(mLock);
+ return mCond.wait_for(lk, std::chrono::nanoseconds(timeoutInNano), [this, size] {
+ ScopedLockAssertion lockAssertion(mLock);
+ return mSetValueResults.size() >= size;
+ });
+}
+
+bool MockVehicleCallback::waitForGetValueResults(size_t size, size_t timeoutInNano) {
+ std::unique_lock lk(mLock);
+ return mCond.wait_for(lk, std::chrono::nanoseconds(timeoutInNano), [this, size] {
+ ScopedLockAssertion lockAssertion(mLock);
+ return mGetValueResults.size() >= size;
+ });
+}
+
} // namespace vehicle
} // namespace automotive
} // namespace hardware
diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h
index 0faaa1f..f17b273 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h
+++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h
@@ -22,6 +22,7 @@
#include <aidl/android/hardware/automotive/vehicle/BnVehicleCallback.h>
#include <android-base/thread_annotations.h>
+#include <condition_variable>
#include <list>
#include <mutex>
#include <optional>
@@ -63,9 +64,12 @@
std::optional<aidl::android::hardware::automotive::vehicle::VehiclePropValues>
nextOnPropertyEventResults();
size_t countOnPropertyEventResults();
+ bool waitForSetValueResults(size_t size, size_t timeoutInNano);
+ bool waitForGetValueResults(size_t size, size_t timeoutInNano);
private:
std::mutex mLock;
+ std::condition_variable mCond;
std::list<aidl::android::hardware::automotive::vehicle::GetValueResults> mGetValueResults
GUARDED_BY(mLock);
std::list<aidl::android::hardware::automotive::vehicle::SetValueResults> mSetValueResults
diff --git a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
index eb3c663..cb8c8d1 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
@@ -231,7 +231,7 @@
std::vector<SubscribeOptions> options = {{
.propId = 0,
.areaIds = {0},
- .sampleRate = 10.0,
+ .sampleRate = 100.0,
}};
auto result = getManager()->subscribe(getCallbackClient(), options, true);
@@ -240,11 +240,13 @@
result = getManager()->unsubscribe(getCallbackClient()->asBinder().get());
ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message();
+ // Wait for the last events to come.
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+
clearEvents();
- std::this_thread::sleep_for(std::chrono::milliseconds(200));
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
- // Theoretically trigger 10 times, but check for at least 9 times to be stable.
ASSERT_TRUE(getEvents().empty());
}
@@ -269,6 +271,9 @@
std::vector<int32_t>({0}));
ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message();
+ // Wait for the last events to come.
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+
clearEvents();
std::this_thread::sleep_for(std::chrono::seconds(1));
@@ -301,6 +306,9 @@
result = getManager()->unsubscribe(getCallbackClient()->asBinder().get());
ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message();
+ // Wait for the last events to come.
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+
clearEvents();
std::this_thread::sleep_for(std::chrono::seconds(1));
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 f3c8234..e0267f3 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
@@ -266,6 +266,7 @@
CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */,
CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */,
ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = (((0x1014 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411092 */,
+ ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = (((0x1015 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411093 */,
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 */,
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 25c1df4..cd1f294 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -90,7 +90,17 @@
INFO_FUEL_CAPACITY = 0x0104 + 0x10000000 + 0x01000000
+ 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT
/**
- * List of fuels the vehicle may use
+ * List of fuels the vehicle may use.
+ *
+ * FuelType::FUEL_TYPE_ELECTRIC must only be included if the vehicle is plug in rechargeable.
+ * For example:
+ * An FHEV (Fully Hybrid Electric Vehicle) must not include FuelType::FUEL_TYPE_ELECTRIC in
+ * INFO_FUEL_TYPE's INT32_VEC value. So INFO_FUEL_TYPE can be populated as such:
+ * int32Values = { FuelType::FUEL_TYPE_UNLEADED }
+ * On the other hand, a PHEV (Partially Hybrid Electric Vehicle) is plug in rechargeable, and
+ * hence should include FuelType::FUEL_TYPE_ELECTRIC in INFO_FUEL_TYPE's INT32_VEC value. So
+ * INFO_FUEL_TYPE can be populated as such:
+ * int32Values = { FuelType::FUEL_TYPE_UNLEADED, FuelType::FUEL_TYPE_ELECTRIC }
*
* @change_mode VehiclePropertyChangeMode.STATIC
* @access VehiclePropertyAccess.READ
@@ -298,7 +308,10 @@
* configArray is used to indicate the micrometers-per-wheel-tick value and
* which wheels are supported. configArray is set as follows:
*
- * configArray[0], bits [0:3] = supported wheels. Uses enum Wheel.
+ * configArray[0], bits [0:3] = supported wheels. Uses enum Wheel. For example, if all wheels
+ * are supported, then configArray[0] = VehicleAreaWheel::LEFT_FRONT
+ * | VehicleAreaWheel::RIGHT_FRONT | VehicleAreaWheel::LEFT_REAR
+ * | VehicleAreaWheel::RIGHT_REAR
* configArray[1] = micrometers per front left wheel tick
* configArray[2] = micrometers per front right wheel tick
* configArray[3] = micrometers per rear right wheel tick
@@ -1948,7 +1961,8 @@
* Represents property for Seat easy access feature.
*
* If true, the seat will automatically adjust to make it easier for the occupant to enter and
- * exit the vehicle.
+ * exit the vehicle. Each area ID must map to the seat that the user is trying to enter/exit
+ * with the help of the easy access feature.
*
* @change_mode VehiclePropertyChangeMode.ON_CHANGE
* @access VehiclePropertyAccess.READ_WRITE
@@ -3619,7 +3633,7 @@
**********************************************************************************************/
/**
- * Enable or disable automatic emergency braking (AEB).
+ * Enable or disable Automatic Emergency Braking (AEB).
*
* Set true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the
* vehicle should be turned on and monitoring to avoid potential collisions.
@@ -3661,7 +3675,7 @@
0x1001 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/**
- * Enable or disable forward collision warning (FCW).
+ * Enable or disable Forward Collision Warning (FCW).
*
* Set true to enable FCW and false to disable FCW. When FCW is enabled, the ADAS system in the
* vehicle should be turned on and monitoring for potential collisions.
@@ -3700,7 +3714,7 @@
0x1003 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/**
- * Enable and disable blind spot warning (BSW).
+ * Enable and disable Blind Spot Warning (BSW).
*
* Set true to enable BSW and false to disable BSW. When BSW is enabled, the ADAS system in the
* vehicle should be turned on and monitoring for objects in the vehicle’s blind spots.
@@ -3739,7 +3753,7 @@
0x1005 + VehiclePropertyGroup.SYSTEM + VehicleArea.MIRROR + VehiclePropertyType.INT32,
/**
- * Enable or disable lane departure warning (LDW).
+ * Enable or disable Lane Departure Warning (LDW).
*
* Set true to enable LDW and false to disable LDW. When LDW is enabled, the ADAS system in the
* vehicle should be turned on and monitoring if the vehicle is approaching or crossing lane
@@ -3826,7 +3840,7 @@
0x1009 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/**
- * Enable or disable lane centering assist (LCA).
+ * Enable or disable Lane Centering Assist (LCA).
*
* Set true to enable LCA and false to disable LCA. When LCA is enabled, the ADAS system in the
* vehicle should be turned on and waiting for an activation signal from the driver. Once the
@@ -3898,7 +3912,7 @@
0x100C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/*
- * Enable or disable emergency lane keep assist (ELKA).
+ * Enable or disable Emergency Lane Keep Assist (ELKA).
*
* Set true to enable ELKA and false to disable ELKA. When ELKA is enabled, the ADAS system in
* the vehicle should be on and monitoring for unsafe lane changes by the driver. When an unsafe
@@ -4064,7 +4078,29 @@
0x1014 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/**
- * Enable or disable hands on detection (HOD).
+ * Measured distance from leading vehicle when using Adaptive Cruise Control (ACC) or
+ * Predictive Cruise Control.
+ *
+ * Returns the measured distance in millimeters between the rear-most point of the leading
+ * vehicle and the front-most point of the ACC vehicle.
+ *
+ * The minInt32Value should be 0.
+ * The maxInt32Value should be populated with the maximum range the distance sensor can support.
+ * This value should be non-negative.
+ *
+ * When no lead vehicle is detected (that is, when there is no leading vehicle or the leading
+ * vehicle is too far away for the sensor to detect), this property should return
+ * StatusCode.NOT_AVAILABLE.
+ *
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
+ * @unit VehicleUnit:MILLIMETER
+ */
+ ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE =
+ 0x1015 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+ /**
+ * Enable or disable Hands On Detection (HOD).
*
* Set true to enable HOD and false to disable HOD. When HOD is enabled, a system inside the
* vehicle should be monitoring the presence of the driver's hands on the steering wheel and
@@ -4084,7 +4120,7 @@
0x1016 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
/**
- * Hands on detection (HOD) driver state.
+ * 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,
@@ -4108,7 +4144,7 @@
0x1017 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
/**
- * Hands on detection (HOD) warning.
+ * 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.
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index 8530631..90fc727 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -576,6 +576,13 @@
VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
}
+TEST_P(VtsHalAutomotiveVehicleTargetTest,
+ verifyAdaptiveCruiseControlLeadVehicleMeasuredDistanceConfig) {
+ verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE,
+ VehiclePropertyAccess::READ, VehiclePropertyChangeMode::CONTINUOUS,
+ VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) {
verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE,
VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
index 8ea1ddd..9451087 100644
--- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
+++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
@@ -516,12 +516,15 @@
// Return the number of completed packets reported by the controller.
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
int packets_processed = 0;
- wait_for_event(false);
- if (event_queue.size() == 0) {
- ALOGW("%s: WaitForCallback timed out.", __func__);
- return packets_processed;
- }
- while (event_queue.size() > 0) {
+ while (true) {
+ // There should be at least one event.
+ wait_for_event(packets_processed == 0);
+ if (event_queue.empty()) {
+ if (packets_processed == 0) {
+ ALOGW("%s: WaitForCallback timed out.", __func__);
+ }
+ return packets_processed;
+ }
hidl_vec<uint8_t> event = event_queue.front();
event_queue.pop();
diff --git a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
index 9ae3837..28ac603 100644
--- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
+++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
@@ -539,12 +539,15 @@
// Return the number of completed packets reported by the controller.
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
int packets_processed = 0;
- wait_for_event(false);
- if (event_queue.size() == 0) {
- ALOGW("%s: WaitForCallback timed out.", __func__);
- return packets_processed;
- }
- while (event_queue.size() > 0) {
+ while (true) {
+ // There should be at least one event.
+ wait_for_event(packets_processed == 0);
+ if (event_queue.empty()) {
+ if (packets_processed == 0) {
+ ALOGW("%s: WaitForCallback timed out.", __func__);
+ }
+ return packets_processed;
+ }
hidl_vec<uint8_t> event = event_queue.front();
event_queue.pop();
diff --git a/cas/aidl/android/hardware/cas/DestinationBuffer.aidl b/cas/aidl/android/hardware/cas/DestinationBuffer.aidl
index 74336c2..ac562dc 100644
--- a/cas/aidl/android/hardware/cas/DestinationBuffer.aidl
+++ b/cas/aidl/android/hardware/cas/DestinationBuffer.aidl
@@ -25,13 +25,13 @@
@VintfStability
union DestinationBuffer {
/**
- * If type == SHARED_MEMORY, the descrambled data must be written
+ * If the buffer is SharedBuffer, the descrambled data must be written
* to user-space non-secure shared memory.
*/
SharedBuffer nonsecureMemory;
/**
- * If type == NATIVE_HANDLE, the descrambled data must be written
+ * If the buffer is presented by NativeHandle, the descrambled data must be written
* to secure memory referenced by the vendor's buffer allocator.
*/
NativeHandle secureMemory;
diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml
index d4fca6a..a7d1988 100644
--- a/compatibility_matrices/compatibility_matrix.8.xml
+++ b/compatibility_matrices/compatibility_matrix.8.xml
@@ -84,15 +84,6 @@
<regex-instance>[a-z]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.evs</name>
- <version>1.0-1</version>
- <interface>
- <name>IEvsEnumerator</name>
- <instance>default</instance>
- <regex-instance>[a-z]+/[0-9]+</regex-instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.automotive.occupant_awareness</name>
<version>1</version>
@@ -500,16 +491,6 @@
</interface>
</hal>
<hal format="aidl" optional="true">
- <name>android.hardware.radio.satellite</name>
- <version>1</version>
- <interface>
- <name>IRadioSatellite</name>
- <instance>slot1</instance>
- <instance>slot2</instance>
- <instance>slot3</instance>
- </interface>
- </hal>
- <hal format="aidl" optional="true">
<name>android.hardware.radio.ims.media</name>
<version>1</version>
<interface>
diff --git a/confirmationui/1.0/default/OWNERS b/confirmationui/1.0/default/OWNERS
index 335660d..17aed51 100644
--- a/confirmationui/1.0/default/OWNERS
+++ b/confirmationui/1.0/default/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 1124672
jdanis@google.com
swillden@google.com
diff --git a/confirmationui/1.0/vts/OWNERS b/confirmationui/1.0/vts/OWNERS
index e7aa8b4..aa07242 100644
--- a/confirmationui/1.0/vts/OWNERS
+++ b/confirmationui/1.0/vts/OWNERS
@@ -1,3 +1,4 @@
+# Bug component: 1124672
jdanis@google.com
swillden@google.com
yim@google.com
diff --git a/confirmationui/OWNERS b/confirmationui/OWNERS
index 2bcdb0e..d3896df 100644
--- a/confirmationui/OWNERS
+++ b/confirmationui/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 1124672
swillden@google.com
subrahmanyaman@google.com
diff --git a/confirmationui/aidl/vts/functional/Android.bp b/confirmationui/aidl/vts/functional/Android.bp
index 3649c87..ac2d53a 100644
--- a/confirmationui/aidl/vts/functional/Android.bp
+++ b/confirmationui/aidl/vts/functional/Android.bp
@@ -23,7 +23,7 @@
name: "VtsHalConfirmationUITargetTest",
defaults: [
"VtsHalTargetTestDefaults",
- "keymint_use_latest_hal_aidl_ndk_shared",
+ "keymint_use_latest_hal_aidl_ndk_static",
"use_libaidlvintf_gtest_helper_static",
],
srcs: [
@@ -31,8 +31,9 @@
],
static_libs: [
"android.hardware.confirmationui-V1-ndk",
- "libcn-cbor",
"android.hardware.confirmationui-support-lib",
+ "android.hardware.security.secureclock-V1-ndk",
+ "libcn-cbor",
],
shared_libs: [
"libbinder_ndk",
diff --git a/confirmationui/support/OWNERS b/confirmationui/support/OWNERS
index 335660d..17aed51 100644
--- a/confirmationui/support/OWNERS
+++ b/confirmationui/support/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 1124672
jdanis@google.com
swillden@google.com
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
index d66e1ac..de8d752 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
@@ -45,8 +45,8 @@
void sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message);
void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo);
void onHostEndpointDisconnected(char hostEndpointId);
- long[] getPreloadedNanoappIds();
- void onNanSessionStateChanged(in boolean state);
+ long[] getPreloadedNanoappIds(in int contextHubId);
+ void onNanSessionStateChanged(in android.hardware.contexthub.NanSessionStateUpdate update);
void setTestMode(in boolean enable);
- const int EX_CONTEXT_HUB_UNSPECIFIED = (-1);
+ const int EX_CONTEXT_HUB_UNSPECIFIED = (-1) /* -1 */;
}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
index e72ae73..6163cfc 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
@@ -38,6 +38,6 @@
void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms);
void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt);
void handleTransactionResult(in int transactionId, in boolean success);
- void handleNanSessionRequest(in boolean enable);
+ void handleNanSessionRequest(in android.hardware.contexthub.NanSessionRequest request);
const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000;
}
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl
similarity index 87%
rename from graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
rename to contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl
index 788bd4e..d539707 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2023, 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -31,8 +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.graphics.common;
+package android.hardware.contexthub;
@VintfStability
-parcelable ParcelableHdr {
- android.hardware.graphics.common.Hdr hdr;
+parcelable NanSessionRequest {
+ boolean enable;
}
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl
similarity index 87%
copy from graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
copy to contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl
index 788bd4e..80771e2 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2023, 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -31,8 +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.graphics.common;
+package android.hardware.contexthub;
@VintfStability
-parcelable ParcelableHdr {
- android.hardware.graphics.common.Hdr hdr;
+parcelable NanSessionStateUpdate {
+ boolean state;
}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
index 741a9cf..fdf3860 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
@@ -40,7 +40,7 @@
byte targetChreApiMajorVersion;
byte targetChreApiMinorVersion;
byte[] customBinary;
- const int FLAG_SIGNED = (1 << 0);
- const int FLAG_ENCRYPTED = (1 << 1);
- const int FLAG_TCM_CAPABLE = (1 << 2);
+ const int FLAG_SIGNED = (1 << 0) /* 1 */;
+ const int FLAG_ENCRYPTED = (1 << 1) /* 2 */;
+ const int FLAG_TCM_CAPABLE = (1 << 2) /* 4 */;
}
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
index f9838bd..9683d2d 100644
--- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
@@ -20,6 +20,7 @@
import android.hardware.contexthub.ContextHubMessage;
import android.hardware.contexthub.HostEndpointInfo;
import android.hardware.contexthub.IContextHubCallback;
+import android.hardware.contexthub.NanSessionStateUpdate;
import android.hardware.contexthub.NanoappBinary;
import android.hardware.contexthub.NanoappInfo;
import android.hardware.contexthub.Setting;
@@ -199,9 +200,11 @@
* Provides the list of preloaded nanoapp IDs on the system. The output of this API must
* not change.
*
- * @return The list of preloaded nanoapp IDs
+ * @param contextHubId The identifier of the Context Hub.
+ *
+ * @return The list of preloaded nanoapp IDs.
*/
- long[] getPreloadedNanoappIds();
+ long[] getPreloadedNanoappIds(in int contextHubId);
/**
* Invoked when the state of the NAN session requested through handleNanSessionRequest()
@@ -212,9 +215,9 @@
* explicitly invoke handleNanSessionRequest() at a later point in time to attempt to
* re-enable NAN.
*
- * @param state True if the NAN session is currently enabled.
+ * @param update Information about the latest NAN session state.
*/
- void onNanSessionStateChanged(in boolean state);
+ void onNanSessionStateChanged(in NanSessionStateUpdate update);
/**
* Puts the context hub in and out of test mode. Test mode is a clean state
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
index cff1893..bfcb51e 100644
--- a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
@@ -18,6 +18,7 @@
import android.hardware.contexthub.AsyncEventType;
import android.hardware.contexthub.ContextHubMessage;
+import android.hardware.contexthub.NanSessionRequest;
import android.hardware.contexthub.NanoappInfo;
@VintfStability
@@ -85,10 +86,9 @@
* request times out, onNanSessionStateChanged() will be invoked with the state that the session
* was previously in.
*
- * @param enable Whether the NAN session should be enabled or disabled depending on whether the
- * Contexthub needs access to NAN.
+ * @param request Request from the HAL indicating the latest NAN session state it would like.
*/
- void handleNanSessionRequest(in boolean enable);
+ void handleNanSessionRequest(in NanSessionRequest request);
/**
* Amount of time, in milliseconds, that a handleNanSessionRequest can be pending before the
diff --git a/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl b/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl
similarity index 60%
copy from radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl
copy to contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl
index 1a65bee..c462ba1 100644
--- a/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.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.
@@ -14,12 +14,16 @@
* limitations under the License.
*/
-package android.hardware.radio.satellite;
+package android.hardware.contexthub;
+/**
+ * Contains information needed to request a state change for a NAN session.
+ */
@VintfStability
-@Backing(type="int")
-@JavaDerive(toString=true)
-enum IndicationFilter {
- NONE = 0,
- SATELLITE_MODE = 1
+parcelable NanSessionRequest {
+ /**
+ * Whether the NAN session should be enabled or disabled depending on whether the Contexthub
+ * needs access to NAN.
+ */
+ boolean enable;
}
diff --git a/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl b/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl
similarity index 66%
rename from radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl
rename to contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl
index 1a65bee..a58eda5 100644
--- a/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.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.
@@ -14,12 +14,15 @@
* limitations under the License.
*/
-package android.hardware.radio.satellite;
+package android.hardware.contexthub;
+/**
+ * Contains information provided as a response to a NanSessionRequest.
+ */
@VintfStability
-@Backing(type="int")
-@JavaDerive(toString=true)
-enum IndicationFilter {
- NONE = 0,
- SATELLITE_MODE = 1
+parcelable NanSessionStateUpdate {
+ /**
+ * True if the NAN session is currently enabled.
+ */
+ boolean state;
}
diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp
index b98bfb2..5272957 100644
--- a/contexthub/aidl/default/ContextHub.cpp
+++ b/contexthub/aidl/default/ContextHub.cpp
@@ -76,7 +76,8 @@
}
}
-ScopedAStatus ContextHub::getPreloadedNanoappIds(std::vector<int64_t>* out_preloadedNanoappIds) {
+ScopedAStatus ContextHub::getPreloadedNanoappIds(int32_t /* in_contextHubId */,
+ std::vector<int64_t>* out_preloadedNanoappIds) {
if (out_preloadedNanoappIds == nullptr) {
return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
@@ -87,7 +88,7 @@
return ndk::ScopedAStatus::ok();
}
-ScopedAStatus ContextHub::onNanSessionStateChanged(bool /*sin_state*/) {
+ScopedAStatus ContextHub::onNanSessionStateChanged(const NanSessionStateUpdate& /*in_update*/) {
return ndk::ScopedAStatus::ok();
}
diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
index dc9aef0..7a2cfd1 100644
--- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
+++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
@@ -39,7 +39,7 @@
::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override;
::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId) override;
::ndk::ScopedAStatus getPreloadedNanoappIds(
- std::vector<int64_t>* out_preloadedNanoappIds) override;
+ int32_t in_contextHubId, std::vector<int64_t>* out_preloadedNanoappIds) override;
::ndk::ScopedAStatus registerCallback(
int32_t in_contextHubId, const std::shared_ptr<IContextHubCallback>& in_cb) override;
::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId,
@@ -48,7 +48,7 @@
::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override;
::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override;
- ::ndk::ScopedAStatus onNanSessionStateChanged(bool in_state) override;
+ ::ndk::ScopedAStatus onNanSessionStateChanged(const NanSessionStateUpdate& in_update) override;
private:
static constexpr uint32_t kMockHubId = 0;
diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
index b227e4a..f544d83 100644
--- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
+++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
@@ -42,6 +42,8 @@
using ::android::hardware::contexthub::NanoappBinary;
using ::android::hardware::contexthub::NanoappInfo;
using ::android::hardware::contexthub::NanoappRpcService;
+using ::android::hardware::contexthub::NanSessionRequest;
+using ::android::hardware::contexthub::NanSessionStateUpdate;
using ::android::hardware::contexthub::Setting;
using ::android::hardware::contexthub::vts_utils::kNonExistentAppId;
using ::android::hardware::contexthub::vts_utils::waitForCallback;
@@ -121,7 +123,9 @@
return Status::ok();
}
- Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+ Status handleNanSessionRequest(const NanSessionRequest& /* request */) override {
+ return Status::ok();
+ }
};
TEST_P(ContextHubAidl, TestRegisterCallback) {
@@ -153,7 +157,9 @@
return Status::ok();
}
- Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+ Status handleNanSessionRequest(const NanSessionRequest& /* request */) override {
+ return Status::ok();
+ }
std::promise<std::vector<NanoappInfo>> promise;
};
@@ -180,10 +186,10 @@
}
}
-// Calls getPreloadedNanoapps() and verifies there are preloaded nanoapps
-TEST_P(ContextHubAidl, TestGetPreloadedNanoapps) {
+// Calls getPreloadedNanoappsIds() and verifies there are preloaded nanoapps
+TEST_P(ContextHubAidl, TestGetPreloadedNanoappIds) {
std::vector<int64_t> preloadedNanoappIds;
- Status status = contextHub->getPreloadedNanoappIds(&preloadedNanoappIds);
+ Status status = contextHub->getPreloadedNanoappIds(getHubId(), &preloadedNanoappIds);
if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION ||
status.transactionError() == android::UNKNOWN_TRANSACTION) {
GTEST_SKIP() << "Not supported -> old API; or not implemented";
@@ -218,7 +224,9 @@
return Status::ok();
}
- Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+ Status handleNanSessionRequest(const NanSessionRequest& /* request */) override {
+ return Status::ok();
+ }
uint32_t expectedTransactionId = 0;
std::promise<bool> promise;
@@ -382,8 +390,11 @@
}
TEST_P(ContextHubAidl, TestNanSessionStateChange) {
- ASSERT_TRUE(contextHub->onNanSessionStateChanged(true /*state*/).isOk());
- ASSERT_TRUE(contextHub->onNanSessionStateChanged(false /*state*/).isOk());
+ NanSessionStateUpdate update;
+ update.state = true;
+ ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk());
+ update.state = false;
+ ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk());
}
std::string PrintGeneratedTest(const testing::TestParamInfo<ContextHubAidl::ParamType>& info) {
diff --git a/gatekeeper/OWNERS b/gatekeeper/OWNERS
index fddc2ff..5262dce 100644
--- a/gatekeeper/OWNERS
+++ b/gatekeeper/OWNERS
@@ -1,4 +1,6 @@
# Bug component: 1124862
-swillden@google.com
+drysdale@google.com
guangzhu@google.com
+oarbildo@google.com
subrahmanyaman@google.com
+swillden@google.com
diff --git a/gatekeeper/aidl/vts/functional/Android.bp b/gatekeeper/aidl/vts/functional/Android.bp
index 2fa80de..008f25c 100644
--- a/gatekeeper/aidl/vts/functional/Android.bp
+++ b/gatekeeper/aidl/vts/functional/Android.bp
@@ -24,14 +24,17 @@
defaults: [
"VtsHalTargetTestDefaults",
"use_libaidlvintf_gtest_helper_static",
- "keymint_use_latest_hal_aidl_ndk_shared",
+ "keymint_use_latest_hal_aidl_ndk_static",
],
srcs: ["VtsHalGatekeeperTargetTest.cpp"],
shared_libs: [
"libbinder_ndk",
"libbase",
],
- static_libs: ["android.hardware.gatekeeper-V1-ndk"],
+ static_libs: [
+ "android.hardware.gatekeeper-V1-ndk",
+ "android.hardware.security.secureclock-V1-ndk",
+ ],
test_suites: [
"general-tests",
"vts",
diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
index db724a4..925df1a 100644
--- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
+++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
@@ -133,50 +133,50 @@
* zero to the value in the table. The state flag with the widest range indicates the range of
* the received GNSS satellite time value.
*
- * +---------------------------+--------------------+-----+-----------+--------------------+------+
- * | |GPS/QZSS |GLNS |BDS |GAL |SBAS |
- * +---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |State Flag |L1 |L5I |L5Q |L1OF |B1I |B1I |E1B |E1C |E5AQ |L1 |
- * | |C/A | | | |(D1) |(D2)| | | |C/A |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_UNKNOWN |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_CODE_LOCK |1ms |1 ms |1 ms |1 ms |1 ms |1 ms|- |- |1 ms |1 ms |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_SYMBOL_SYNC |20ms |10 ms |1 ms |10 ms|20 ms |2 ms|4 ms |4 ms |1 ms |2 ms |
- * | |(opt.)| |(opt.)| |(opt.)| |(opt.)|(opt.)|(opt.)| |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_BIT_SYNC |20 ms |20 ms |1 ms |20 ms|20 ms |- |8 ms |- |1 ms |4 ms |
- * | | | |(opt.)| | | | | |(opt.)| |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_SUBFRAME_SYNC |6s |6s |- |2 s |6 s |- |- |- |100 ms|- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_TOW_DECODED |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week|
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_TOW_KNOWN |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week|
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_GLO_STRING_SYNC |- |- |- |2 s |- |- |- |- |- |- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_GLO_TOD_DECODED |- |- |- |1 day|- |- |- |- |- |- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_GLO_TOD_KNOWN |- |- |- |1 day|- |- |- |- |- |- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_BDS_D2_BIT_SYNC |- |- |- |- |- |2 ms|- |- |- |- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_BDS_D2_SUBFRAME_SYNC |- |- |- |- |- |600 |- |- |- |- |
- * | | | | | | |ms | | | | |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_GAL_E1BC_CODE_LOCK |- |- |- |- |- |- |4 ms |4 ms |- |- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_GAL_E1C_2ND_CODE_LOCK|- |- |- |- |- |- |- |100 ms|- |- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_2ND_CODE_LOCK |- |10 ms |20 ms |- |- |- |- |100 ms|100 ms|- |
- * | | |(opt.)| | | | | |(opt.)| | |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_GAL_E1B_PAGE_SYNC |- |- |- |- |- |- |2 s |- |- |- |
- * |---------------------------+------+------+------+-----+------+----+------+------+------+------+
- * |STATE_SBAS_SYNC |- |- |- |- |- |- |- |- |- |1s |
- * +---------------------------+------+------+------+-----+------+----+------+------+------+------+
+ * +---------------------------+---------------------------+-----+---------------------------+--------------------+------+------+
+ * | |GPS/QZSS |GLNS |BDS |GAL |SBAS |IRNSS |
+ * +---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |State Flag |L1 |L1C |L5I |L5Q |L1OF |B1I |B1I |B1C |B2AQ |E1B |E1C |E5AQ |L1 |L5C |
+ * | |C/A |(P) | | | |(D1) |(D2) |(P) | | | | |C/A | |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_UNKNOWN |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_CODE_LOCK |1ms |10 ms |1 ms |1 ms |1 ms |1 ms |1 ms |10 ms |1 ms |- |- |1 ms |1 ms |1ms |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_SYMBOL_SYNC |- |- |10 ms |- |10 ms|- |2 ms |- |- |- |- |- |2 ms |- |
+ * | | | | | | | | | | | | | | | |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_BIT_SYNC |20 ms |- |20 ms |- |20 ms|20 ms |- |- |- |8 ms |- |- |4 ms |20 ms |
+ * | | | | | | | | | | | | | | | |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_SUBFRAME_SYNC |6s |- |6s |- |- |6 s |- |- |100 ms|- |- |100 ms|- |6s |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_TOW_DECODED |1 week|- |1 week|- |- |1 week|1 week|- |- |1 week|1 week|- |1 week|1 week|
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_TOW_KNOWN |1 week|1 week|1 week|1 week|- |1 week|1 week|1 week|1 week|1 week|1 week|1 week|1 week|1 week|
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_GLO_STRING_SYNC |- |- |- |- |2 s |- |- |- |- |- |- |- |- |- |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_GLO_TOD_DECODED |- |- |- |- |1 day|- |- |- |- |- |- |- |- |- |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_GLO_TOD_KNOWN |- |- |- |- |1 day|- |- |- |- |- |- |- |- |- |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_BDS_D2_BIT_SYNC |- |- |- |- |- |- |2 ms |- |- |- |- |- |- |- |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_BDS_D2_SUBFRAME_SYNC |- |- |- |- |- |- |600 |- |- |- |- |- |- |- |
+ * | | | | | | | |ms | | | | | | | |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_GAL_E1BC_CODE_LOCK |- |- |- |- |- |- |- |- |- |4 ms |4 ms |- |- |- |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_GAL_E1C_2ND_CODE_LOCK|- |- |- |- |- |- |- |- |- |- |100 ms|- |- |- |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_2ND_CODE_LOCK |- |18000 |10 ms |20 ms |- |- |- |18000 |100 ms|- |- |100 ms|- |- |
+ * | | |ms | | | | | |ms | | | | | | |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_GAL_E1B_PAGE_SYNC |- |- |- |- |- |- |- |- |- |2 s |- |- |- |- |
+ * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
+ * |STATE_SBAS_SYNC |- |- |- |- |- |- |- |- |- |- |- |- |1s |- |
+ * +---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+
*
* Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
* been determined from other sources. If TOW decoded is set then TOW Known must also be set.
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 0fbd5e3..96dece4 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -1405,8 +1405,8 @@
/*
* TestGnssMeasurementIntervals_WithoutLocation:
- * 1. start measurement with interval
- * 2. verify that the received measurement intervals have expected mean and stdev
+ * 1. Start measurement at intervals
+ * 2. Verify measurement are received at expected intervals
*/
TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -1438,8 +1438,9 @@
/*
* TestGnssMeasurementIntervals_LocationOnBeforeMeasurement:
- * 1. start measurement with interval
- * 2. verify that the received measurement intervals have expected mean and stdev
+ * 1. Start location at 1s.
+ * 2. Start measurement at 2s. Verify measurements are received at 1s.
+ * 3. Stop measurement. Stop location.
*/
TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnBeforeMeasurement) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -1474,15 +1475,17 @@
}
/*
- * TestGnssMeasurementIntervals:
- * 1. start measurement with interval
- * 2. verify that the received measurement intervals have expected mean and stddev
+ * TestGnssMeasurementIntervals_LocationOnAfterMeasurement:
+ * 1. Start measurement at 2s
+ * 2. Start location at 1s. Verify measurements are received at 1s
+ * 3. Stop location. Verify measurements are received at 2s
+ * 4. Stop measurement
*/
TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return;
}
-
+ const int kFirstMeasTimeoutSec = 10;
std::vector<int> intervals({2000});
sp<IGnssMeasurementInterface> iGnssMeasurement;
@@ -1497,26 +1500,34 @@
auto callback = sp<GnssMeasurementCallbackAidl>::make();
startMeasurementWithInterval(intervalMs, iGnssMeasurement, callback);
+ // Start location and verify the measurements are received at 1Hz
StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false);
std::vector<int> deltas;
- collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, deltas);
+ collectMeasurementIntervals(callback, /*numEvents=*/10, kFirstMeasTimeoutSec, deltas);
+ assertMeanAndStdev(locationIntervalMs, deltas);
+ // Stop location request and verify the measurements are received at 2s intervals
StopAndClearLocations();
+ callback->gnss_data_cbq_.reset();
+ deltas.clear();
+ collectMeasurementIntervals(callback, /*numEvents=*/5, kFirstMeasTimeoutSec, deltas);
+ assertMeanAndStdev(intervalMs, deltas);
+
status = iGnssMeasurement->close();
ASSERT_TRUE(status.isOk());
-
- assertMeanAndStdev(locationIntervalMs, deltas);
}
}
/*
- * TestGnssMeasurementSetCallback:
+ * TestGnssMeasurementIntervals_changeIntervals:
* This test ensures setCallback() can be called consecutively without close().
* 1. Start measurement with 20s interval and wait for 1 measurement.
* 2. Start measurement with 1s interval and wait for 5 measurements.
* Verify the measurements were received at 1Hz.
+ * 3. Start measurement with 2s interval and wait for 5 measurements.
+ * Verify the measurements were received at 2s intervals.
*/
-TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) {
+TEST_P(GnssHalTest, TestGnssMeasurementIntervals_changeIntervals) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 2) {
return;
}
@@ -1526,7 +1537,6 @@
ASSERT_TRUE(status.isOk());
ASSERT_TRUE(iGnssMeasurement != nullptr);
- ALOGD("TestGnssMeasurementSetCallback");
auto callback = sp<GnssMeasurementCallbackAidl>::make();
std::vector<int> deltas;
@@ -1537,6 +1547,7 @@
// setCallback at 1s interval and wait for 5 measurements
callback->gnss_data_cbq_.reset();
+ deltas.clear();
startMeasurementWithInterval(1000, iGnssMeasurement, callback);
collectMeasurementIntervals(callback, /* numEvents= */ 5, kFirstGnssMeasurementTimeoutSeconds,
deltas);
@@ -1544,6 +1555,16 @@
// verify the measurements were received at 1Hz
assertMeanAndStdev(1000, deltas);
+ // setCallback at 2s interval and wait for 5 measurements
+ callback->gnss_data_cbq_.reset();
+ deltas.clear();
+ startMeasurementWithInterval(2000, iGnssMeasurement, callback);
+ collectMeasurementIntervals(callback, /* numEvents= */ 5, kFirstGnssMeasurementTimeoutSeconds,
+ deltas);
+
+ // verify the measurements were received at 2s intervals
+ assertMeanAndStdev(2000, deltas);
+
status = iGnssMeasurement->close();
ASSERT_TRUE(status.isOk());
}
diff --git a/gnss/common/utils/default/DeviceFileReader.cpp b/gnss/common/utils/default/DeviceFileReader.cpp
index dfc086a..91e75eb 100644
--- a/gnss/common/utils/default/DeviceFileReader.cpp
+++ b/gnss/common/utils/default/DeviceFileReader.cpp
@@ -32,40 +32,52 @@
return;
}
- int mGnssFd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK);
-
- if (mGnssFd == -1) {
+ int gnss_fd, epoll_fd;
+ if ((gnss_fd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK)) == -1) {
+ return;
+ }
+ if (write(gnss_fd, command.c_str(), command.size()) <= 0) {
+ close(gnss_fd);
return;
}
- int bytes_write = write(mGnssFd, command.c_str(), command.size());
- if (bytes_write <= 0) {
- close(mGnssFd);
+ // Create an epoll instance.
+ if ((epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) {
+ close(gnss_fd);
return;
}
+ // Add file descriptor to epoll instance.
struct epoll_event ev, events[1];
- ev.data.fd = mGnssFd;
+ memset(&ev, 0, sizeof(ev));
+ ev.data.fd = gnss_fd;
ev.events = EPOLLIN;
- int epoll_fd = epoll_create1(0);
- epoll_ctl(epoll_fd, EPOLL_CTL_ADD, mGnssFd, &ev);
+ if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, gnss_fd, &ev) == -1) {
+ close(gnss_fd);
+ close(epoll_fd);
+ return;
+ }
+
+ // Wait for device file event.
+ if (epoll_wait(epoll_fd, events, 1, mMinIntervalMs) == -1) {
+ close(gnss_fd);
+ close(epoll_fd);
+ return;
+ }
+
+ // Handle event and write data to string buffer.
int bytes_read = -1;
std::string inputStr = "";
- int epoll_ret = epoll_wait(epoll_fd, events, 1, mMinIntervalMs);
-
- if (epoll_ret == -1) {
- close(mGnssFd);
- return;
- }
while (true) {
memset(inputBuffer, 0, INPUT_BUFFER_SIZE);
- bytes_read = read(mGnssFd, &inputBuffer, INPUT_BUFFER_SIZE);
+ bytes_read = read(gnss_fd, &inputBuffer, INPUT_BUFFER_SIZE);
if (bytes_read <= 0) {
break;
}
s_buffer_ += std::string(inputBuffer, bytes_read);
}
- close(mGnssFd);
+ close(gnss_fd);
+ close(epoll_fd);
// Trim end of file mark(\n\n\n\n).
auto pos = s_buffer_.find("\n\n\n\n");
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index 2aed29b..8303d93 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -102,7 +102,7 @@
.receivedSvTimeUncertaintyInNs = 15,
.cN0DbHz = 30.0,
.pseudorangeRateMps = -484.13739013671875,
- .pseudorangeRateUncertaintyMps = 1.0379999876022339,
+ .pseudorangeRateUncertaintyMps = 0.1037999987602233,
.accumulatedDeltaRangeState = (uint32_t)V1_0::IGnssMeasurementCallback::
GnssAccumulatedDeltaRangeState::ADR_STATE_UNKNOWN,
.accumulatedDeltaRangeM = 0.0,
@@ -169,7 +169,7 @@
.basebandCN0DbHz = 26.5,
.agcLevelDb = 2.3,
.pseudorangeRateMps = -484.13739013671875,
- .pseudorangeRateUncertaintyMps = 1.0379999876022339,
+ .pseudorangeRateUncertaintyMps = 0.1037999987602233,
.accumulatedDeltaRangeState = GnssMeasurement::ADR_STATE_VALID,
.accumulatedDeltaRangeM = 1.52,
.accumulatedDeltaRangeUncertaintyM = 2.43,
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
index 66151ca..b74f7d7 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
@@ -34,7 +34,7 @@
package android.hardware.graphics.common;
@VintfStability
parcelable HdrConversionCapability {
- android.hardware.graphics.common.ParcelableHdr sourceType;
- @nullable android.hardware.graphics.common.ParcelableHdr outputType;
+ android.hardware.graphics.common.Hdr sourceType;
+ android.hardware.graphics.common.Hdr outputType;
boolean addsLatency;
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
index 6107c4c..c9ba16b 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
@@ -24,7 +24,7 @@
@Backing(type="int")
enum Hdr {
/**
- * Invalid HDR type
+ * Invalid HDR type
*/
INVALID = 0,
/**
diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
index 53b3256..d8524a5 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
@@ -16,22 +16,26 @@
package android.hardware.graphics.common;
-import android.hardware.graphics.common.ParcelableHdr;
+import android.hardware.graphics.common.Hdr;
/**
* Output parameter for IComposerClient.getHdrConversionCapabilities
- *
- * @param sourceType is the HDR type that can be converted to outputType.
- *
- * @param outputType is the HDR type/ SDR that the source type can be converted to. The value null
- * is used to depict SDR outputType.
- *
- * @param addsLatency is false if no latency added due to HDR conversion from sourceType to
- * outputType, otherwise true.
*/
@VintfStability
parcelable HdrConversionCapability {
- ParcelableHdr sourceType;
- @nullable ParcelableHdr outputType;
+ /** sourceType is the HDR type that can be converted to outputType */
+ Hdr sourceType;
+
+ /**
+ * outputType is the HDR type/ SDR that the source type can be converted to. The value INVALID
+ * is used to depict SDR outputType.
+ */
+
+ Hdr outputType;
+
+ /**
+ * addsLatency is false if no latency added due to HDR conversion from sourceType to
+ * outputType, otherwise true.
+ */
boolean addsLatency;
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
index f564e9f..71beaa0 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
@@ -15,25 +15,32 @@
*/
package android.hardware.graphics.common;
+
+import android.hardware.graphics.common.Hdr;
/**
* Input parameter for IComposerClient.setHdrConversionStrategy
- *
- * @param passthrough - When this parameter is set to true, HDR conversion is disabled by the
- * implementation. The output HDR type will change dynamically to match the content. This value is
- * never set to false, as other union values will be present in the false case.
- *
- * @param autoAllowedHdrTypes - When this parameter is set, the output HDR type is selected by the
- * implementation. The implementation is only allowed to set the output HDR type to the HDR types
- * present in this list. If conversion to any of the autoHdrTypes types is not possible, the
- * implementation should do no conversion.
- *
- * @param forceHdrConversion - When this parameter is set, the implementation should convert all
- * content to this HDR type, when possible. If not possible, the functionality should be similar to
- * passthrough=true.
*/
@VintfStability
union HdrConversionStrategy {
+ /**
+ * When this parameter is set to true, HDR conversion is disabled by the
+ * implementation. The output HDR type will change dynamically to match the content. This value
+ * is never set to false, as other union values will be present in the false case.
+ */
boolean passthrough = true;
- android.hardware.graphics.common.Hdr[] autoAllowedHdrTypes;
- android.hardware.graphics.common.Hdr forceHdrConversion;
+
+ /**
+ * When this parameter is set, the output HDR type is selected by the
+ * implementation. The implementation is only allowed to set the output HDR type to the HDR
+ * types present in this list. If conversion to any of the autoHdrTypes types is not possible,
+ * the implementation should do no conversion.
+ */
+ Hdr[] autoAllowedHdrTypes;
+
+ /**
+ * When this parameter is set, the implementation should convert all
+ * content to this HDR type, when possible. If not possible, the functionality should be similar
+ * to passthrough=true.
+ */
+ Hdr forceHdrConversion;
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl
deleted file mode 100644
index 9aff277..0000000
--- a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * 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.graphics.common;
-
-import android.hardware.graphics.common.Hdr;
-
-@VintfStability
-parcelable ParcelableHdr {
- Hdr hdr;
-}
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
index 4fb5d01..7b3a2b4 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
@@ -29,6 +29,11 @@
mVsyncAllowed = allowed;
}
+void GraphicsComposerCallback::setRefreshRateChangedDebugDataEnabledCallbackAllowed(bool allowed) {
+ std::scoped_lock lock(mMutex);
+ mRefreshRateChangedDebugDataEnabledCallbackAllowed = allowed;
+}
+
std::vector<int64_t> GraphicsComposerCallback::getDisplays() const {
std::scoped_lock lock(mMutex);
return mDisplays;
@@ -79,6 +84,21 @@
return ret;
}
+std::vector<RefreshRateChangedDebugData>
+GraphicsComposerCallback::takeListOfRefreshRateChangedDebugData() {
+ std::scoped_lock lock(mMutex);
+
+ std::vector<RefreshRateChangedDebugData> ret;
+ ret.swap(mRefreshRateChangedDebugData);
+
+ return ret;
+}
+
+int32_t GraphicsComposerCallback::getInvalidRefreshRateDebugEnabledCallbackCount() const {
+ std::scoped_lock lock(mMutex);
+ return mInvalidRefreshRateDebugEnabledCallbackCount;
+}
+
::ndk::ScopedAStatus GraphicsComposerCallback::onHotplug(int64_t in_display, bool in_connected) {
std::scoped_lock lock(mMutex);
@@ -125,9 +145,16 @@
}
::ndk::ScopedAStatus GraphicsComposerCallback::onRefreshRateChangedDebug(
- const RefreshRateChangedDebugData&) {
- // TODO(b/202734676) Add implementation for Vts tests
- return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ const RefreshRateChangedDebugData& data) {
+ std::scoped_lock lock(mMutex);
+
+ const auto it = std::find(mDisplays.begin(), mDisplays.end(), data.display);
+ if (mRefreshRateChangedDebugDataEnabledCallbackAllowed && it != mDisplays.end()) {
+ mRefreshRateChangedDebugData.push_back(data);
+ } else {
+ mInvalidRefreshRateDebugEnabledCallbackCount++;
+ }
+ return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncPeriodTimingChanged(
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
index 9c3bc70..13e992a 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
@@ -26,6 +26,8 @@
public:
void setVsyncAllowed(bool allowed);
+ void setRefreshRateChangedDebugDataEnabledCallbackAllowed(bool allowed);
+
std::vector<int64_t> getDisplays() const;
int32_t getInvalidHotplugCount() const;
@@ -44,6 +46,10 @@
std::optional<VsyncPeriodChangeTimeline> takeLastVsyncPeriodChangeTimeline();
+ std::vector<RefreshRateChangedDebugData> takeListOfRefreshRateChangedDebugData();
+
+ int32_t getInvalidRefreshRateDebugEnabledCallbackCount() const;
+
private:
virtual ::ndk::ScopedAStatus onHotplug(int64_t in_display, bool in_connected) override;
virtual ::ndk::ScopedAStatus onRefresh(int64_t in_display) override;
@@ -63,9 +69,13 @@
std::vector<int64_t> mDisplays GUARDED_BY(mMutex);
// true only when vsync is enabled
bool mVsyncAllowed GUARDED_BY(mMutex) = true;
+ // true only when RefreshRateChangedCallbackDebugEnabled is set to true.
+ bool mRefreshRateChangedDebugDataEnabledCallbackAllowed GUARDED_BY(mMutex) = false;
std::optional<VsyncPeriodChangeTimeline> mTimeline GUARDED_BY(mMutex);
+ std::vector<RefreshRateChangedDebugData> mRefreshRateChangedDebugData GUARDED_BY(mMutex);
+
int32_t mVsyncIdleCount GUARDED_BY(mMutex) = 0;
int64_t mVsyncIdleTime GUARDED_BY(mMutex) = 0;
@@ -75,6 +85,7 @@
int32_t mInvalidVsyncCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidVsyncPeriodChangeCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidSeamlessPossibleCount GUARDED_BY(mMutex) = 0;
+ int32_t mInvalidRefreshRateDebugEnabledCallbackCount GUARDED_BY(mMutex) = 0;
};
} // namespace aidl::android::hardware::graphics::composer3::vts
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp
index e03ef25..25b0ca0 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.cpp
+++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp
@@ -119,6 +119,24 @@
return updateDisplayProperties(vtsDisplay, config);
}
+ScopedAStatus VtsComposerClient::setPeakRefreshRateConfig(VtsDisplay* vtsDisplay) {
+ const auto displayId = vtsDisplay->getDisplayId();
+ auto [activeStatus, activeConfig] = getActiveConfig(displayId);
+ EXPECT_TRUE(activeStatus.isOk());
+ auto peakDisplayConfig = vtsDisplay->getDisplayConfig(activeConfig);
+ auto peakConfig = activeConfig;
+
+ const auto displayConfigs = vtsDisplay->getDisplayConfigs();
+ for (const auto [config, displayConfig] : displayConfigs) {
+ if (displayConfig.configGroup == peakDisplayConfig.configGroup &&
+ displayConfig.vsyncPeriod < peakDisplayConfig.vsyncPeriod) {
+ peakDisplayConfig = displayConfig;
+ peakConfig = config;
+ }
+ }
+ return setActiveConfig(vtsDisplay, peakConfig);
+}
+
std::pair<ScopedAStatus, int32_t> VtsComposerClient::getDisplayAttribute(
int64_t display, int32_t config, DisplayAttribute displayAttribute) {
int32_t outDisplayAttribute;
@@ -375,10 +393,15 @@
return mComposerCallback->getVsyncIdleTime();
}
-ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled(
- int64_t /* display */, bool /* enabled */) {
- // TODO(b/202734676) Add implementation for VTS tests
- return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled(int64_t display,
+ bool enabled) {
+ mComposerCallback->setRefreshRateChangedDebugDataEnabledCallbackAllowed(enabled);
+ return mComposerClient->setRefreshRateChangedCallbackDebugEnabled(display, enabled);
+}
+
+std::vector<RefreshRateChangedDebugData>
+VtsComposerClient::takeListOfRefreshRateChangedDebugData() {
+ return mComposerCallback->takeListOfRefreshRateChangedDebugData();
}
int64_t VtsComposerClient::getInvalidDisplayId() {
@@ -545,6 +568,10 @@
ALOGE("Invalid seamless possible count");
isValid = false;
}
+ if (mComposerCallback->getInvalidRefreshRateDebugEnabledCallbackCount() != 0) {
+ ALOGE("Invalid refresh rate debug enabled callback count");
+ isValid = false;
+ }
}
return isValid;
}
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h
index 81a62b3..ea3318c 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.h
+++ b/graphics/composer/aidl/vts/VtsComposerClient.h
@@ -77,6 +77,8 @@
ScopedAStatus setActiveConfig(VtsDisplay* vtsDisplay, int32_t config);
+ ScopedAStatus setPeakRefreshRateConfig(VtsDisplay* vtsDisplay);
+
std::pair<ScopedAStatus, int32_t> getDisplayAttribute(int64_t display, int32_t config,
DisplayAttribute displayAttribute);
@@ -183,6 +185,10 @@
std::pair<ScopedAStatus, OverlayProperties> getOverlaySupport();
+ ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t display, bool enabled);
+
+ std::vector<RefreshRateChangedDebugData> takeListOfRefreshRateChangedDebugData();
+
private:
ScopedAStatus addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config);
ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config);
@@ -197,9 +203,6 @@
bool verifyComposerCallbackParams();
- ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */,
- bool /* enabled */);
-
// Keep track of displays and layers. When a test fails/ends,
// the VtsComposerClient::tearDown should be called from the
// test tearDown to clean up the resources for the test.
@@ -245,15 +248,17 @@
};
void addDisplayConfig(int32_t config, DisplayConfig displayConfig) {
- displayConfigs.insert({config, displayConfig});
+ mDisplayConfigs.insert({config, displayConfig});
}
- DisplayConfig getDisplayConfig(int32_t config) { return displayConfigs.find(config)->second; }
+ DisplayConfig getDisplayConfig(int32_t config) { return mDisplayConfigs.find(config)->second; }
+
+ std::unordered_map<int32_t, DisplayConfig> getDisplayConfigs() { return mDisplayConfigs; }
private:
int64_t mDisplayId;
int32_t mDisplayWidth;
int32_t mDisplayHeight;
- std::unordered_map<int32_t, DisplayConfig> displayConfigs;
+ std::unordered_map<int32_t, DisplayConfig> mDisplayConfigs;
};
} // namespace aidl::android::hardware::graphics::composer3::vts
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 4974e71..746330b 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -650,10 +650,10 @@
}
const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
for (auto conversionCapability : conversionCapabilities) {
- if (conversionCapability.outputType) {
+ if (conversionCapability.outputType != common::Hdr::INVALID) {
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::forceHdrConversion>(
- conversionCapability.outputType->hdr);
+ conversionCapability.outputType);
const auto& [statusSet, preferredHdrOutputType] =
mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
EXPECT_TRUE(statusSet.isOk());
@@ -670,8 +670,8 @@
const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
std::vector<aidl::android::hardware::graphics::common::Hdr> autoHdrTypes;
for (auto conversionCapability : conversionCapabilities) {
- if (conversionCapability.outputType) {
- autoHdrTypes.push_back(conversionCapability.outputType->hdr);
+ if (conversionCapability.outputType != common::Hdr::INVALID) {
+ autoHdrTypes.push_back(conversionCapability.outputType);
}
}
common::HdrConversionStrategy hdrConversionStrategy;
@@ -1217,6 +1217,14 @@
}
}
+ bool checkIfCallbackRefreshRateChangedDebugEnabledReceived(
+ std::function<bool(RefreshRateChangedDebugData)> filter) {
+ const auto list = mComposerClient->takeListOfRefreshRateChangedDebugData();
+ return std::any_of(list.begin(), list.end(), [&](auto refreshRateChangedDebugData) {
+ return filter(refreshRateChangedDebugData);
+ });
+ }
+
sp<GraphicBuffer> allocate(::android::PixelFormat pixelFormat) {
return sp<GraphicBuffer>::make(
static_cast<uint32_t>(getPrimaryDisplay().getDisplayWidth()),
@@ -1316,7 +1324,7 @@
return vsyncPeriod;
}
- int64_t createOnScreenLayer() {
+ int64_t createOnScreenLayer(Composition composition = Composition::DEVICE) {
const auto& [status, layer] =
mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
EXPECT_TRUE(status.isOk());
@@ -1324,12 +1332,25 @@
getPrimaryDisplay().getDisplayHeight()};
FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(),
(float)getPrimaryDisplay().getDisplayHeight()};
- configureLayer(getPrimaryDisplay(), layer, Composition::DEVICE, displayFrame, cropRect);
+ configureLayer(getPrimaryDisplay(), layer, composition, displayFrame, cropRect);
auto& writer = getWriter(getPrimaryDisplayId());
writer.setLayerDataspace(getPrimaryDisplayId(), layer, common::Dataspace::UNKNOWN);
return layer;
}
+ void sendBufferUpdate(int64_t layer) {
+ const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888);
+ ASSERT_NE(nullptr, buffer->handle);
+
+ auto& writer = getWriter(getPrimaryDisplayId());
+ writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer->handle,
+ /*acquireFence*/ -1);
+
+ const sp<::android::Fence> presentFence =
+ presentAndGetFence(ComposerClientWriter::kNoTimestamp);
+ presentFence->waitForever(LOG_TAG);
+ }
+
bool hasDisplayCapability(int64_t display, DisplayCapability cap) {
const auto& [status, capabilities] = mComposerClient->getDisplayCapabilities(display);
EXPECT_TRUE(status.isOk());
@@ -2268,6 +2289,176 @@
EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
}
+TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsupported) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ auto status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled(
+ getPrimaryDisplayId(), /*enabled*/ true);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_NO_FATAL_FAILURE(
+ assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED));
+
+ status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled(getPrimaryDisplayId(),
+ /*enabled*/ false);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_NO_FATAL_FAILURE(
+ assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED));
+ }
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabled) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
+ return;
+ }
+
+ const auto displayId = getPrimaryDisplayId();
+ EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
+ // Enable the callback
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ true)
+ .isOk());
+ std::this_thread::sleep_for(100ms);
+
+ const auto displayFilter = [displayId](auto refreshRateChangedDebugData) {
+ return displayId == refreshRateChangedDebugData.display;
+ };
+
+ // Check that we immediately got a callback
+ EXPECT_TRUE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter));
+
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ false)
+ .isOk());
+}
+
+TEST_P(GraphicsComposerAidlCommandTest,
+ SetRefreshRateChangedCallbackDebugEnabled_noCallbackWhenIdle) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
+ return;
+ }
+
+ auto display = getEditablePrimaryDisplay();
+ const auto displayId = display.getDisplayId();
+
+ if (!hasDisplayCapability(displayId, DisplayCapability::DISPLAY_IDLE_TIMER)) {
+ GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported";
+ return;
+ }
+
+ EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
+ EXPECT_TRUE(mComposerClient->setPeakRefreshRateConfig(&display).isOk());
+
+ ASSERT_TRUE(mComposerClient->setIdleTimerEnabled(displayId, /*timeoutMs*/ 500).isOk());
+ // Enable the callback
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ true)
+ .isOk());
+
+ const auto displayFilter = [displayId](auto refreshRateChangedDebugData) {
+ return displayId == refreshRateChangedDebugData.display;
+ };
+
+ int retryCount = 3;
+ do {
+ // Wait for 1s so that we enter the idle state
+ std::this_thread::sleep_for(1s);
+ if (!checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter)) {
+ // DID NOT receive a callback, we are in the idle state.
+ break;
+ }
+ } while (--retryCount > 0);
+
+ if (retryCount == 0) {
+ GTEST_SUCCEED() << "Unable to enter the idle mode";
+ return;
+ }
+
+ // Send the REFRESH_RATE_INDICATOR update
+ ASSERT_NO_FATAL_FAILURE(
+ sendBufferUpdate(createOnScreenLayer(Composition::REFRESH_RATE_INDICATOR)));
+ std::this_thread::sleep_for(1s);
+ EXPECT_FALSE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter))
+ << "A callback should not be received for REFRESH_RATE_INDICATOR";
+
+ EXPECT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ false)
+ .isOk());
+}
+
+TEST_P(GraphicsComposerAidlCommandTest,
+ SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
+ return;
+ }
+
+ VsyncPeriodChangeConstraints constraints;
+ constraints.seamlessRequired = false;
+ constraints.desiredTimeNanos = systemTime();
+
+ for (VtsDisplay& display : mDisplays) {
+ const auto displayId = display.getDisplayId();
+ EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
+
+ // Enable the callback
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId, /*enabled*/ true)
+ .isOk());
+
+ forEachTwoConfigs(displayId, [&](int32_t config1, int32_t config2) {
+ const int32_t vsyncPeriod1 = display.getDisplayConfig(config1).vsyncPeriod;
+ const int32_t vsyncPeriod2 = display.getDisplayConfig(config2).vsyncPeriod;
+
+ if (vsyncPeriod1 == vsyncPeriod2) {
+ return; // continue
+ }
+
+ EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk());
+ sendRefreshFrame(display, nullptr);
+
+ const auto& [status, timeline] =
+ mComposerClient->setActiveConfigWithConstraints(&display, config2, constraints);
+ EXPECT_TRUE(status.isOk());
+
+ if (timeline.refreshRequired) {
+ sendRefreshFrame(display, &timeline);
+ }
+
+ const auto callbackFilter = [displayId,
+ vsyncPeriod2](auto refreshRateChangedDebugData) {
+ constexpr int kVsyncThreshold = 1000;
+ return displayId == refreshRateChangedDebugData.display &&
+ std::abs(vsyncPeriod2 - refreshRateChangedDebugData.vsyncPeriodNanos) <=
+ kVsyncThreshold;
+ };
+
+ int retryCount = 3;
+ do {
+ std::this_thread::sleep_for(100ms);
+ if (checkIfCallbackRefreshRateChangedDebugEnabledReceived(callbackFilter)) {
+ GTEST_SUCCEED() << "Received a callback successfully";
+ break;
+ }
+ } while (--retryCount > 0);
+
+ if (retryCount == 0) {
+ GTEST_FAIL() << "failed to get a callback for the display " << displayId
+ << " with config " << config2;
+ }
+ });
+
+ EXPECT_TRUE(
+ mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId, /*enabled*/ false)
+ .isOk());
+ }
+}
+
/*
* Test that no two display configs are exactly the same.
*/
diff --git a/identity/aidl/android/hardware/identity/IIdentityCredential.aidl b/identity/aidl/android/hardware/identity/IIdentityCredential.aidl
index abdb00b..df8e2bd 100644
--- a/identity/aidl/android/hardware/identity/IIdentityCredential.aidl
+++ b/identity/aidl/android/hardware/identity/IIdentityCredential.aidl
@@ -370,7 +370,8 @@
* - issuer: CN shall be set to "Android Identity Credential Key". (fixed value:
* same on all certs)
*
- * - validity: should be from current time and one year in the future (365 days).
+ * - validity: should be from current time and 31536000 seconds in the
+ * future (approximately 365 days).
*
* - subjectPublicKeyInfo: must contain attested public key.
*
diff --git a/identity/aidl/vts/Util.cpp b/identity/aidl/vts/Util.cpp
index f3d7c30..4f5c121 100644
--- a/identity/aidl/vts/Util.cpp
+++ b/identity/aidl/vts/Util.cpp
@@ -523,8 +523,24 @@
int64_t allowDriftSecs = 10;
EXPECT_LE(-allowDriftSecs, diffSecs);
EXPECT_GE(allowDriftSecs, diffSecs);
- constexpr uint64_t kSecsInOneYear = 365 * 24 * 60 * 60;
- EXPECT_EQ(notBefore + kSecsInOneYear, notAfter);
+
+ // The AIDL spec used to call for "one year in the future (365
+ // days)" but was updated to say "current time and 31536000
+ // seconds in the future (approximately 365 days)" to clarify that
+ // this was the original intention.
+ //
+ // However a number of implementations interpreted this as a
+ // "literal year" which started causing problems in March 2023
+ // because 2024 is a leap year. Since the extra day doesn't really
+ // matter (the validity period is specified in the MSO anyway and
+ // that's what RPs use), we allow both interpretations.
+ //
+ // For simplicity, we just require that that notAfter is after
+ // 31536000 and which also covers the case if there's a leap-day
+ // and possible leap-seconds.
+ //
+ constexpr uint64_t kSecsIn365Days = 365 * 24 * 60 * 60;
+ EXPECT_LE(notBefore + kSecsIn365Days, notAfter);
}
vector<RequestNamespace> buildRequestNamespaces(const vector<TestEntryData> entries) {
diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp
index dfccb4c..e8cebd7 100644
--- a/radio/aidl/Android.bp
+++ b/radio/aidl/Android.bp
@@ -262,19 +262,3 @@
},
},
}
-
-aidl_interface {
- name: "android.hardware.radio.satellite",
- vendor_available: true,
- srcs: ["android/hardware/radio/satellite/*.aidl"],
- stability: "vintf",
- imports: ["android.hardware.radio-V2"],
- backend: {
- cpp: {
- enabled: false,
- },
- java: {
- sdk_version: "module_current",
- },
- },
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
index 84376b7..37e3b25 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
@@ -34,13 +34,13 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum AmrMode {
- AMR_MODE_0 = (1 << 0),
- AMR_MODE_1 = (1 << 1),
- AMR_MODE_2 = (1 << 2),
- AMR_MODE_3 = (1 << 3),
- AMR_MODE_4 = (1 << 4),
- AMR_MODE_5 = (1 << 5),
- AMR_MODE_6 = (1 << 6),
- AMR_MODE_7 = (1 << 7),
- AMR_MODE_8 = (1 << 8),
+ AMR_MODE_0 = (1 << 0) /* 1 */,
+ AMR_MODE_1 = (1 << 1) /* 2 */,
+ AMR_MODE_2 = (1 << 2) /* 4 */,
+ AMR_MODE_3 = (1 << 3) /* 8 */,
+ AMR_MODE_4 = (1 << 4) /* 16 */,
+ AMR_MODE_5 = (1 << 5) /* 32 */,
+ AMR_MODE_6 = (1 << 6) /* 64 */,
+ AMR_MODE_7 = (1 << 7) /* 128 */,
+ AMR_MODE_8 = (1 << 8) /* 256 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
index 9eaf129..e4193cd 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
@@ -34,9 +34,9 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum CodecType {
- AMR = (1 << 0),
- AMR_WB = (1 << 1),
- EVS = (1 << 2),
- PCMA = (1 << 3),
- PCMU = (1 << 4),
+ AMR = (1 << 0) /* 1 */,
+ AMR_WB = (1 << 1) /* 2 */,
+ EVS = (1 << 2) /* 4 */,
+ PCMA = (1 << 3) /* 8 */,
+ PCMU = (1 << 4) /* 16 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
index 5e80f91..db3eb29 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
@@ -35,8 +35,8 @@
@Backing(type="int") @VintfStability
enum EvsBandwidth {
NONE = 0,
- NARROW_BAND = (1 << 0),
- WIDE_BAND = (1 << 1),
- SUPER_WIDE_BAND = (1 << 2),
- FULL_BAND = (1 << 3),
+ NARROW_BAND = (1 << 0) /* 1 */,
+ WIDE_BAND = (1 << 1) /* 2 */,
+ SUPER_WIDE_BAND = (1 << 2) /* 4 */,
+ FULL_BAND = (1 << 3) /* 8 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
index a530a8d..fb1f14d 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
@@ -34,25 +34,25 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum EvsMode {
- EVS_MODE_0 = (1 << 0),
- EVS_MODE_1 = (1 << 1),
- EVS_MODE_2 = (1 << 2),
- EVS_MODE_3 = (1 << 3),
- EVS_MODE_4 = (1 << 4),
- EVS_MODE_5 = (1 << 5),
- EVS_MODE_6 = (1 << 6),
- EVS_MODE_7 = (1 << 7),
- EVS_MODE_8 = (1 << 8),
- EVS_MODE_9 = (1 << 9),
- EVS_MODE_10 = (1 << 10),
- EVS_MODE_11 = (1 << 11),
- EVS_MODE_12 = (1 << 12),
- EVS_MODE_13 = (1 << 13),
- EVS_MODE_14 = (1 << 14),
- EVS_MODE_15 = (1 << 15),
- EVS_MODE_16 = (1 << 16),
- EVS_MODE_17 = (1 << 17),
- EVS_MODE_18 = (1 << 18),
- EVS_MODE_19 = (1 << 19),
- EVS_MODE_20 = (1 << 20),
+ EVS_MODE_0 = (1 << 0) /* 1 */,
+ EVS_MODE_1 = (1 << 1) /* 2 */,
+ EVS_MODE_2 = (1 << 2) /* 4 */,
+ EVS_MODE_3 = (1 << 3) /* 8 */,
+ EVS_MODE_4 = (1 << 4) /* 16 */,
+ EVS_MODE_5 = (1 << 5) /* 32 */,
+ EVS_MODE_6 = (1 << 6) /* 64 */,
+ EVS_MODE_7 = (1 << 7) /* 128 */,
+ EVS_MODE_8 = (1 << 8) /* 256 */,
+ EVS_MODE_9 = (1 << 9) /* 512 */,
+ EVS_MODE_10 = (1 << 10) /* 1024 */,
+ EVS_MODE_11 = (1 << 11) /* 2048 */,
+ EVS_MODE_12 = (1 << 12) /* 4096 */,
+ EVS_MODE_13 = (1 << 13) /* 8192 */,
+ EVS_MODE_14 = (1 << 14) /* 16384 */,
+ EVS_MODE_15 = (1 << 15) /* 32768 */,
+ EVS_MODE_16 = (1 << 16) /* 65536 */,
+ EVS_MODE_17 = (1 << 17) /* 131072 */,
+ EVS_MODE_18 = (1 << 18) /* 262144 */,
+ EVS_MODE_19 = (1 << 19) /* 524288 */,
+ EVS_MODE_20 = (1 << 20) /* 1048576 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
index d90b2a4..0e9eaee 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -35,8 +35,8 @@
@Backing(type="int") @VintfStability
enum MediaDirection {
NO_FLOW = 0,
- SEND_ONLY = 1,
- RECEIVE_ONLY = 2,
- SEND_RECEIVE = 3,
- INACTIVE = 4,
+ RTP_TX = (1 << 0) /* 1 */,
+ RTP_RX = (1 << 1) /* 2 */,
+ RTCP_TX = (1 << 2) /* 4 */,
+ RTCP_RX = (1 << 3) /* 8 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
index 0663754..289c810 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
@@ -35,11 +35,11 @@
@Backing(type="int") @VintfStability
enum RtcpXrReportBlockType {
RTCPXR_NONE = 0,
- RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0),
- RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1),
- RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2),
- RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3),
- RTCPXR_DLRR_REPORT_BLOCK = (1 << 4),
- RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5),
- RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6),
+ RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0) /* 1 */,
+ RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1) /* 2 */,
+ RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2) /* 4 */,
+ RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3) /* 8 */,
+ RTCPXR_DLRR_REPORT_BLOCK = (1 << 4) /* 16 */,
+ RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5) /* 32 */,
+ RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6) /* 64 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
index 1a8921e..8a826f6 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -34,7 +34,7 @@
package android.hardware.radio.ims.media;
@VintfStability
parcelable RtpConfig {
- android.hardware.radio.ims.media.MediaDirection direction;
+ int direction;
android.hardware.radio.AccessNetwork accessNetwork;
android.hardware.radio.ims.media.RtpAddress remoteAddress;
android.hardware.radio.ims.media.RtpSessionParams sessionParams;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl
deleted file mode 100644
index a00e4f5..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@VintfStability
-interface IRadioSatellite {
- oneway void addAllowedSatelliteContacts(in int serial, in String[] contacts);
- oneway void getCapabilities(in int serial);
- oneway void getMaxCharactersPerTextMessage(in int serial);
- oneway void getPendingMessages(in int serial);
- oneway void getPowerState(in int serial);
- oneway void getSatelliteMode(in int serial);
- oneway void getTimeForNextSatelliteVisibility(in int serial);
- oneway void provisionService(in int serial, in String imei, in String msisdn, in String imsi, in android.hardware.radio.satellite.SatelliteFeature[] features);
- oneway void removeAllowedSatelliteContacts(in int serial, in String[] contacts);
- oneway void responseAcknowledgement();
- oneway void sendMessages(in int serial, in String[] messages, in String destination, in double latitude, in double longitude);
- oneway void setIndicationFilter(in int serial, in int filterBitmask);
- oneway void setPower(in int serial, in boolean on);
- oneway void setResponseFunctions(in android.hardware.radio.satellite.IRadioSatelliteResponse satelliteResponse, in android.hardware.radio.satellite.IRadioSatelliteIndication satelliteIndication);
- oneway void startSendingSatellitePointingInfo(in int serial);
- oneway void stopSendingSatellitePointingInfo(in int serial);
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl
deleted file mode 100644
index 6a03f26..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@VintfStability
-interface IRadioSatelliteIndication {
- oneway void onMessagesTransferComplete(in android.hardware.radio.RadioIndicationType type, in boolean complete);
- oneway void onNewMessages(in android.hardware.radio.RadioIndicationType type, in String[] messages);
- oneway void onPendingMessageCount(in android.hardware.radio.RadioIndicationType type, in int count);
- oneway void onProvisionStateChanged(in android.hardware.radio.RadioIndicationType type, boolean provisioned, in android.hardware.radio.satellite.SatelliteFeature[] features);
- oneway void onSatelliteModeChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.SatelliteMode mode);
- oneway void onSatellitePointingInfoChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.PointingInfo pointingInfo);
- oneway void onSatelliteRadioTechnologyChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.NTRadioTechnology technology);
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl
deleted file mode 100644
index f6614b1..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@VintfStability
-interface IRadioSatelliteResponse {
- oneway void acknowledgeRequest(in int serial);
- oneway void addAllowedSatelliteContactsResponse(in android.hardware.radio.RadioResponseInfo info);
- oneway void getCapabilitiesResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.satellite.SatelliteCapabilities capabilities);
- oneway void getMaxCharactersPerTextMessageResponse(in android.hardware.radio.RadioResponseInfo info, in int charLimit);
- oneway void getPendingMessagesResponse(in android.hardware.radio.RadioResponseInfo info, in String[] messages);
- oneway void getPowerStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean on);
- oneway void getSatelliteModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.satellite.SatelliteMode mode, in android.hardware.radio.satellite.NTRadioTechnology technology);
- oneway void getTimeForNextSatelliteVisibilityResponse(in android.hardware.radio.RadioResponseInfo info, in int timeInSeconds);
- oneway void provisionServiceResponse(in android.hardware.radio.RadioResponseInfo info, in boolean provisioned);
- oneway void removeAllowedSatelliteContactsResponse(in android.hardware.radio.RadioResponseInfo info);
- oneway void sendMessagesResponse(in android.hardware.radio.RadioResponseInfo info);
- oneway void setIndicationFilterResponse(in android.hardware.radio.RadioResponseInfo info);
- oneway void setPowerResponse(in android.hardware.radio.RadioResponseInfo info);
- oneway void startSendingSatellitePointingInfoResponse(in android.hardware.radio.RadioResponseInfo info);
- oneway void stopSendingSatellitePointingInfoResponse(in android.hardware.radio.RadioResponseInfo info);
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl
deleted file mode 100644
index 5aa5739..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@Backing(type="int") @JavaDerive(toString=true) @VintfStability
-enum IndicationFilter {
- NONE = 0,
- SATELLITE_MODE = 1,
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl
deleted file mode 100644
index 29de55f..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@Backing(type="int") @JavaDerive(toString=true) @VintfStability
-enum NTRadioTechnology {
- NB_IOT_NTN = 0,
- NR_NTN = 1,
- EMTC_NTN = 2,
- PROPRIETARY = 3,
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl
deleted file mode 100644
index dcfce34..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@JavaDerive(toString=true) @VintfStability
-parcelable PointingInfo {
- float satelliteAzimuthDegrees;
- float satelliteElevationDegrees;
- float antennaAzimuthDegrees;
- float antennaPitchDegrees;
- float antennaRollDegrees;
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl
deleted file mode 100644
index 407a9d1..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@JavaDerive(toString=true) @VintfStability
-parcelable SatelliteCapabilities {
- android.hardware.radio.satellite.NTRadioTechnology[] supportedRadioTechnologies;
- boolean isAlwaysOn;
- boolean needsPointingToSatellite;
- android.hardware.radio.satellite.SatelliteFeature[] supportedFeatures;
- boolean needsSeparateSimProfile;
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl
deleted file mode 100644
index 1cf6a2c..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.radio.satellite;
-@Backing(type="int") @JavaDerive(toString=true) @VintfStability
-enum SatelliteMode {
- POWERED_OFF = 0,
- OUT_OF_SERVICE_NOT_SEARCHING = 1,
- OUT_OF_SERVICE_SEARCHING = 2,
- ACQUIRED = 3,
- MESSAGE_TRANSFERRING = 4,
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
index aa55cd7..b7b074b 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
@@ -34,28 +34,28 @@
package android.hardware.radio;
@Backing(type="int") @JavaDerive(toString=true) @VintfStability
enum RadioAccessFamily {
- UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN),
- GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS),
- EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE),
- UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS),
- IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A),
- IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B),
- ONE_X_RTT = (1 << android.hardware.radio.RadioTechnology.ONE_X_RTT),
- EVDO_0 = (1 << android.hardware.radio.RadioTechnology.EVDO_0),
- EVDO_A = (1 << android.hardware.radio.RadioTechnology.EVDO_A),
- HSDPA = (1 << android.hardware.radio.RadioTechnology.HSDPA),
- HSUPA = (1 << android.hardware.radio.RadioTechnology.HSUPA),
- HSPA = (1 << android.hardware.radio.RadioTechnology.HSPA),
- EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B),
- EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD),
- LTE = (1 << android.hardware.radio.RadioTechnology.LTE),
- HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP),
- GSM = (1 << android.hardware.radio.RadioTechnology.GSM),
- TD_SCDMA = (1 << android.hardware.radio.RadioTechnology.TD_SCDMA),
- IWLAN = (1 << android.hardware.radio.RadioTechnology.IWLAN),
+ UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN) /* 1 */,
+ GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS) /* 2 */,
+ EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE) /* 4 */,
+ UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS) /* 8 */,
+ IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A) /* 16 */,
+ IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B) /* 32 */,
+ ONE_X_RTT = (1 << android.hardware.radio.RadioTechnology.ONE_X_RTT) /* 64 */,
+ EVDO_0 = (1 << android.hardware.radio.RadioTechnology.EVDO_0) /* 128 */,
+ EVDO_A = (1 << android.hardware.radio.RadioTechnology.EVDO_A) /* 256 */,
+ HSDPA = (1 << android.hardware.radio.RadioTechnology.HSDPA) /* 512 */,
+ HSUPA = (1 << android.hardware.radio.RadioTechnology.HSUPA) /* 1024 */,
+ HSPA = (1 << android.hardware.radio.RadioTechnology.HSPA) /* 2048 */,
+ EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B) /* 4096 */,
+ EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD) /* 8192 */,
+ LTE = (1 << android.hardware.radio.RadioTechnology.LTE) /* 16384 */,
+ HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP) /* 32768 */,
+ GSM = (1 << android.hardware.radio.RadioTechnology.GSM) /* 65536 */,
+ TD_SCDMA = (1 << android.hardware.radio.RadioTechnology.TD_SCDMA) /* 131072 */,
+ IWLAN = (1 << android.hardware.radio.RadioTechnology.IWLAN) /* 262144 */,
/**
* @deprecated use LTE instead.
*/
- LTE_CA = (1 << android.hardware.radio.RadioTechnology.LTE_CA),
- NR = (1 << android.hardware.radio.RadioTechnology.NR),
+ LTE_CA = (1 << android.hardware.radio.RadioTechnology.LTE_CA) /* 524288 */,
+ NR = (1 << android.hardware.radio.RadioTechnology.NR) /* 1048576 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl
index 448c0bb..9785825 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl
@@ -37,5 +37,5 @@
const int MAX_RILDS = 3;
const int MAX_UUID_LENGTH = 64;
const int CARD_MAX_APPS = 8;
- const int P2_CONSTANT_NO_P2 = (-1);
+ const int P2_CONSTANT_NO_P2 = (-1) /* -1 */;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl
index b9db56c..98606e5 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl
@@ -123,15 +123,4 @@
BLOCKED_DUE_TO_CALL = 69,
RF_HARDWARE_ISSUE = 70,
NO_RF_CALIBRATION_INFO = 71,
- ENCODING_NOT_SUPPORTED = 72,
- FEATURE_NOT_SUPPORTED = 73,
- INVALID_CONTACT = 74,
- MODEM_INCOMPATIBLE = 75,
- NETWORK_TIMEOUT = 76,
- NO_SATELLITE_SIGNAL = 77,
- NOT_SUFFICIENT_ACCOUNT_BALANCE = 78,
- RADIO_TECHNOLOGY_NOT_SUPPORTED = 79,
- SUBSCRIBER_NOT_AUTHORIZED = 80,
- SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL = 81,
- UNIDENTIFIED_SUBSCRIBER = 82,
}
diff --git a/radio/aidl/android/hardware/radio/RadioError.aidl b/radio/aidl/android/hardware/radio/RadioError.aidl
index 4d44559..2031399 100644
--- a/radio/aidl/android/hardware/radio/RadioError.aidl
+++ b/radio/aidl/android/hardware/radio/RadioError.aidl
@@ -301,51 +301,4 @@
* Unlike RF_HARDWARE_ISSUE, this is a SW problem and no HW repair is needed.
*/
NO_RF_CALIBRATION_INFO = 71,
- /**
- * The encoding scheme is not supported by either the network or the MS.
- */
- ENCODING_NOT_SUPPORTED = 72,
- /**
- * The requesting feature is not supported by the service provider/operator.
- */
- FEATURE_NOT_SUPPORTED = 73,
- /**
- * The contact to be added is either not existing or not valid.
- */
- INVALID_CONTACT = 74,
- /**
- * The modem of the MS is not compatible with the service provider/operator. This generic error
- * should be used only when there are some mimatches in the capabilities between the MS and
- * the operator and the error cannot be mapped properly to other specific network errors.
- */
- MODEM_INCOMPATIBLE = 75,
- /**
- * Modem timeout to receive ACK or response from network after sending a request to the network.
- */
- NETWORK_TIMEOUT = 76,
- /**
- * Modem fails to communicate with the satellite network since there is no satellite signal.
- */
- NO_SATELLITE_SIGNAL = 77,
- /**
- * The request cannot be performed since the subscriber's account balance is not sufficient.
- */
- NOT_SUFFICIENT_ACCOUNT_BALANCE = 78,
- /**
- * The radio technology is not supported by the service provider/operator.
- */
- RADIO_TECHNOLOGY_NOT_SUPPORTED = 79,
- /**
- * The subscription is not authorized to register with the service provider/operator.
- */
- SUBSCRIBER_NOT_AUTHORIZED = 80,
- /**
- * While processing a request from the Framework, the satellite modem detects terrestrial
- * signal, aborts the request, and switches to the terrestrial network.
- */
- SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL = 81,
- /**
- * The subscriber is not registered in the service provider.
- */
- UNIDENTIFIED_SUBSCRIBER = 82
}
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
index 9f04d8e..e5c34c7 100644
--- a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -16,6 +16,17 @@
package android.hardware.radio.ims.media;
+/**
+ * Directions can be combined to meet various media direction
+ * requirements depending on the scenario.
+ *
+ * Examples:
+ * No Flow : NO_FLOW - eg. SRVCC.
+ * RTCP-only : RTCP_TX | RTCP_RX - eg. Local Hold or Dual Hold.
+ * Receive-Only : RTP_RX | RTCP_TX | RTCP_RX - eg. Remote Hold.
+ * Send-Receive : RTP_TX | RTP_RX | RTCP_TX | RTCP_RX - eg. Active call.
+ * Send-Only : RTP_TX | RTCP_TX | RTCP_RX - eg. Simplex call, voice mail, etc
+ */
@VintfStability
@Backing(type="int")
enum MediaDirection {
@@ -24,12 +35,16 @@
* may release the audio resource. Eg. SRVCC.
*/
NO_FLOW = 0,
- /** Device sends outgoing RTP and drops incoming RTP */
- SEND_ONLY = 1,
- /** Device receives the downlink RTP and does not transmit any uplink RTP */
- RECEIVE_ONLY = 2,
- /** Device sends and receive RTP in both directions */
- SEND_RECEIVE = 3,
- /** No RTP flow however RTCP continues to flow. Eg. HOLD */
- INACTIVE = 4,
+
+ /** Send RTP packets */
+ RTP_TX = 1 << 0,
+
+ /** Receive and processes RTP packets */
+ RTP_RX = 1 << 1,
+
+ /** Send RTCP packets */
+ RTCP_TX = 1 << 2,
+
+ /** Receive RTCP packets */
+ RTCP_RX = 1 << 3,
}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
index f6696f7..f93b112 100644
--- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -18,15 +18,14 @@
import android.hardware.radio.AccessNetwork;
import android.hardware.radio.ims.media.AnbrMode;
-import android.hardware.radio.ims.media.MediaDirection;
import android.hardware.radio.ims.media.RtcpConfig;
import android.hardware.radio.ims.media.RtpAddress;
import android.hardware.radio.ims.media.RtpSessionParams;
@VintfStability
parcelable RtpConfig {
- /** Media flow direction */
- MediaDirection direction;
+ /** Media flow direction. The bitfield of MediaDirection(s) */
+ int direction;
/** Radio Access Network */
AccessNetwork accessNetwork;
/** IP address and port number of the other party for RTP media */
diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl
deleted file mode 100644
index 87f13a6..0000000
--- a/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-import android.hardware.radio.satellite.IRadioSatelliteIndication;
-import android.hardware.radio.satellite.IRadioSatelliteResponse;
-import android.hardware.radio.satellite.IndicationFilter;
-import android.hardware.radio.satellite.SatelliteFeature;
-
-/**
- * This interface is used by telephony to send commands to and query info from satellite modem.
- * All the functions have minimum one parameter:
- * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
- * duration of a method call. If clients provide colliding serials (including passing the same
- * serial to different methods), multiple responses (one for each method call) must still be served.
- */
-@VintfStability
-oneway interface IRadioSatellite {
- /**
- * Add contacts that are allowed to be used for satellite communication. This is applicable for
- * incoming messages as well.
- *
- * @param serial Serial number of request.
- * @param contacts List of allowed contacts to be added.
- */
- void addAllowedSatelliteContacts(in int serial, in String[] contacts);
-
- /**
- * Get feature capabilities supported by satellite.
- *
- * @param serial Serial number of request.
- */
- void getCapabilities(in int serial);
-
- /**
- * Get max number of characters per text message.
- *
- * @param serial Serial number of request.
- */
- void getMaxCharactersPerTextMessage(in int serial);
-
- /**
- * Get pending messages.
- *
- * @param serial Serial number of request.
- */
- void getPendingMessages(in int serial);
-
- /**
- * Get satellite modem state.
- *
- * @param serial Serial number of request.
- */
- void getPowerState(in int serial);
-
- /**
- * Get current satellite registration mode, which is defined in {@link #SatelliteMode}.
- *
- * @param serial Serial number of request.
- */
- void getSatelliteMode(in int serial);
-
- /**
- * Get time for next visibility of satellite.
- *
- * @param serial Serial number of request.
- */
- void getTimeForNextSatelliteVisibility(in int serial);
-
- /**
- * Provision the subscription with a satellite provider. This is needed to register the
- * subscription if the provider allows dynamic registration.
- *
- * @param serial Serial number of request.
- * @param imei IMEI of the SIM associated with the satellite modem.
- * @param msisdn MSISDN of the SIM associated with the satellite modem.
- * @param imsi IMSI of the SIM associated with the satellite modem.
- * @param features List of features to be provisioned.
- */
- void provisionService(in int serial, in String imei, in String msisdn, in String imsi,
- in SatelliteFeature[] features);
-
- /**
- * Remove contacts that are allowed to be used for satellite communication. This is applicable
- * for incoming messages as well.
- *
- * @param serial Serial number of request.
- * @param contacts List of allowed contacts to be removed.
- */
- void removeAllowedSatelliteContacts(in int serial, in String[] contacts);
-
- /**
- * When response type received from a radio indication or radio response is
- * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively,
- * acknowledge the receipt of those messages by sending responseAcknowledgement().
- */
- void responseAcknowledgement();
-
- /**
- * Send text messages.
- *
- * @param serial Serial number of request.
- * @param messages List of messages in text format to be sent.
- * @param destination The recipient of the message.
- * @param latitude The current latitude of the device.
- * @param longitude The current longitude of the device. The location (i.e., latitude and
- * longitude) of the device will be filled for emergency messages.
- */
- void sendMessages(in int serial, in String[] messages, in String destination,
- in double latitude, in double longitude);
-
- /**
- * Set the filter for what type of indication framework want to receive from modem.
- *
- * @param serial Serial number of request.
- * @param filterBitmask The filter bitmask identifying what type of indication Telephony
- * framework wants to receive from modem. This bitmask is the 'or'
- * combination of the enum values defined in {@link #IndicationFilter}.
- */
- void setIndicationFilter(in int serial, in int filterBitmask);
-
- /**
- * Turn satellite modem on/off.
- *
- * @param serial Serial number of request.
- * @param on True for turning on.
- * False for turning off.
- */
- void setPower(in int serial, in boolean on);
-
- /**
- * Set response functions for Satellite requests and indications.
- *
- * @param satelliteResponse Object containing response functions
- * @param satelliteIndication Object containing radio indications
- */
- void setResponseFunctions(in IRadioSatelliteResponse satelliteResponse,
- in IRadioSatelliteIndication satelliteIndication);
-
- /**
- * User started pointing to the satellite. Modem should continue to update the pointing input
- * as user device/satellite moves.
- *
- * @param serial Serial number of request.
- */
- void startSendingSatellitePointingInfo(in int serial);
-
- /**
- * Stop sending satellite pointing info to the framework.
- *
- * @param serial Serial number of request.
- */
- void stopSendingSatellitePointingInfo(in int serial);
-}
diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl
deleted file mode 100644
index f1d9747..0000000
--- a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-import android.hardware.radio.RadioIndicationType;
-import android.hardware.radio.satellite.NTRadioTechnology;
-import android.hardware.radio.satellite.PointingInfo;
-import android.hardware.radio.satellite.SatelliteFeature;
-import android.hardware.radio.satellite.SatelliteMode;
-
-/**
- * Interface declaring unsolicited radio indications for satellite APIs.
- */
-@VintfStability
-oneway interface IRadioSatelliteIndication {
- /**
- * Confirms that ongoing message transfer is complete.
- *
- * @param type Type of radio indication
- * @param complete True mean the transfer is complete.
- * False means the transfer is not complete.
- */
- void onMessagesTransferComplete(in RadioIndicationType type, in boolean complete);
-
- /**
- * Indicates new message received on device.
- *
- * @param type Type of radio indication
- * @param messages List of new messages received.
- */
- void onNewMessages(in RadioIndicationType type, in String[] messages);
-
- /**
- * Indicates that satellite has pending messages for the device to be pulled.
- *
- * @param type Type of radio indication
- * @param count Number of pending messages.
- */
- void onPendingMessageCount(in RadioIndicationType type, in int count);
-
- /**
- * Indicate that satellite provision state has changed.
- *
- * @param type Type of radio indication
- * @param provisioned True means the service is provisioned.
- * False means the service is not provisioned.
- * @param features List of Feature whose provision state has changed.
- */
- void onProvisionStateChanged(
- in RadioIndicationType type, boolean provisioned, in SatelliteFeature[] features);
-
- /**
- * Indicate that satellite mode has changed.
- *
- * @param type Type of radio indication
- * @param mode The current mode of the satellite modem.
- */
- void onSatelliteModeChanged(in RadioIndicationType type, in SatelliteMode mode);
-
- /**
- * Indicate that satellite Pointing input has changed.
- *
- * @param type Type of radio indication
- * @param pointingInfo The current pointing info.
- */
- void onSatellitePointingInfoChanged(in RadioIndicationType type, in PointingInfo pointingInfo);
-
- /**
- * Indicate that satellite radio technology has changed.
- *
- * @param type Type of radio indication
- * @param technology The current technology of the satellite modem.
- */
- void onSatelliteRadioTechnologyChanged(
- in RadioIndicationType type, in NTRadioTechnology technology);
-}
diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl
deleted file mode 100644
index e81edaa..0000000
--- a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-import android.hardware.radio.RadioResponseInfo;
-import android.hardware.radio.satellite.NTRadioTechnology;
-import android.hardware.radio.satellite.SatelliteCapabilities;
-import android.hardware.radio.satellite.SatelliteMode;
-
-/**
- * Interface declaring response functions to solicited radio requests for satellite APIs.
- */
-@VintfStability
-oneway interface IRadioSatelliteResponse {
- /**
- * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for
- * radio request which take long time to respond. For more details, refer
- * https://source.android.com/devices/tech/connect/ril.html
- *
- * @param serial Serial no. of the request whose acknowledgement is sent.
- */
- void acknowledgeRequest(in int serial);
-
- /**
- * Response of the request addAllowedSatelliteContacts.
- *
- * @param info Response info struct containing serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:ABORTED
- * RadioError:ACCESS_BARRED
- * RadioError:CANCELLED
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_CONTACT
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NETWORK_ERR
- * RadioError:NETWORK_NOT_READY
- * RadioError:NETWORK_REJECT
- * RadioError:NETWORK_TIMEOUT
- * RadioError:NO_MEMORY
- * RadioError:NO_NETWORK_FOUND
- * RadioError:NO_RESOURCES
- * RadioError:NO_SATELLITE_SIGNAL
- * RadioError:NO_SUBSCRIPTION
- * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE
- * RadioError:OPERATION_NOT_ALLOWED
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SIM_ABSENT
- * RadioError:SIM_BUSY
- * RadioError:SIM_ERR
- * RadioError:SIM_FULL
- * RadioError:SYSTEM_ERR
- * RadioError:UNIDENTIFIED_SUBSCRIBER
- */
- void addAllowedSatelliteContactsResponse(in RadioResponseInfo info);
-
- /**
- * Response of the request getCapabilities.
- *
- * @param info Response info struct containing serial no. and error
- * @param capabilities List of capabilities that the satellite modem supports.
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void getCapabilitiesResponse(in RadioResponseInfo info, in SatelliteCapabilities capabilities);
-
- /**
- * Response of the request getMaxCharactersPerTextMessage.
- *
- * @param info Response info struct containing serial no. and error
- * @param charLimit Maximum number of characters in a text message that can be sent.
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void getMaxCharactersPerTextMessageResponse(in RadioResponseInfo info, in int charLimit);
-
- /**
- * Response of the request getPendingMessages.
- *
- * @param info Response info struct containing serial no. and error
- * @param messages List of pending messages received.
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:ABORTED
- * RadioError:ACCESS_BARRED
- * RadioError:BLOCKED_DUE_TO_CALL
- * RadioError:CANCELLED
- * RadioError:ENCODING_ERR
- * RadioError:ENCODING_NOT_SUPPORTED
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_SMS_FORMAT
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NETWORK_ERR
- * RadioError:NETWORK_NOT_READY
- * RadioError:NETWORK_REJECT
- * RadioError:NETWORK_TIMEOUT
- * RadioError:NO_MEMORY
- * RadioError:NO_NETWORK_FOUND
- * RadioError:NO_RESOURCES
- * RadioError:NO_SMS_TO_ACK
- * RadioError:NO_SATELLITE_SIGNAL
- * RadioError:NO_SUBSCRIPTION
- * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE
- * RadioError:OPERATION_NOT_ALLOWED
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SIM_ABSENT
- * RadioError:SIM_BUSY
- * RadioError:SIM_ERR
- * RadioError:SIM_FULL
- * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
- * RadioError:SYSTEM_ERR
- * RadioError:SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL
- */
- void getPendingMessagesResponse(in RadioResponseInfo info, in String[] messages);
-
- /**
- * Response of the request getPowerSate.
- *
- * @param info Response info struct containing serial no. and error
- * @param on True means the modem is ON.
- * False means the modem is OFF.
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void getPowerStateResponse(in RadioResponseInfo info, in boolean on);
-
- /**
- * Response of the request getSatelliteMode.
- *
- * @param info Response info struct containing serial no. and error
- * @param mode Current Mode of the satellite modem.
- * @param technology The current technology of the satellite modem.
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void getSatelliteModeResponse(
- in RadioResponseInfo info, in SatelliteMode mode, in NTRadioTechnology technology);
-
- /**
- * Response of the request getTimeForNextSatelliteVisibility.
- *
- * @param info Response info struct containing serial no. and error
- * @param timeInSeconds The duration in seconds after which the satellite will be visible.
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void getTimeForNextSatelliteVisibilityResponse(in RadioResponseInfo info, in int timeInSeconds);
-
- /**
- * Response of the request provisionService.
- *
- * @param info Response info struct containing serial no. and error
- * @param provisioned True means the service is provisioned.
- * False means the service is not provisioned.
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:ABORTED
- * RadioError:ACCESS_BARRED
- * RadioError:CANCELLED
- * RadioError:FEATURE_NOT_SUPPORTED
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:MODEM_INCOMPATIBLE
- * RadioError:NETWORK_ERR
- * RadioError:NETWORK_NOT_READY
- * RadioError:NETWORK_REJECT
- * RadioError:NETWORK_TIMEOUT
- * RadioError:NO_MEMORY
- * RadioError:NO_NETWORK_FOUND
- * RadioError:NO_RESOURCES
- * RadioError:NO_SATELLITE_SIGNAL
- * RadioError:NO_SUBSCRIPTION
- * RadioError:OPERATION_NOT_ALLOWED
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:RADIO_TECHNOLOGY_NOT_SUPPORTED
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SIM_ABSENT
- * RadioError:SIM_BUSY
- * RadioError:SIM_ERR
- * RadioError:SIM_FULL
- * RadioError:SUBSCRIBER_NOT_AUTHORIZED
- * RadioError:SYSTEM_ERR
- */
- void provisionServiceResponse(in RadioResponseInfo info, in boolean provisioned);
-
- /**
- * Response of the request removeAllowedSatelliteContacts.
- *
- * @param info Response info struct containing serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:ABORTED
- * RadioError:ACCESS_BARRED
- * RadioError:CANCELLED
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_CONTACT
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NETWORK_ERR
- * RadioError:NETWORK_NOT_READY
- * RadioError:NETWORK_REJECT
- * RadioError:NETWORK_TIMEOUT
- * RadioError:NO_MEMORY
- * RadioError:NO_NETWORK_FOUND
- * RadioError:NO_RESOURCES
- * RadioError:NO_SATELLITE_SIGNAL
- * RadioError:NO_SUBSCRIPTION
- * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE
- * RadioError:OPERATION_NOT_ALLOWED
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SIM_ABSENT
- * RadioError:SIM_BUSY
- * RadioError:SIM_ERR
- * RadioError:SIM_FULL
- * RadioError:SYSTEM_ERR
- * RadioError:UNIDENTIFIED_SUBSCRIBER
- */
- void removeAllowedSatelliteContactsResponse(in RadioResponseInfo info);
-
- /**
- * Response of the request sendMessages.
- *
- * @param info Response info struct containing serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:ABORTED
- * RadioError:ACCESS_BARRED
- * RadioError:BLOCKED_DUE_TO_CALL
- * RadioError:CANCELLED
- * RadioError:ENCODING_ERR
- * RadioError:ENCODING_NOT_SUPPORTED
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_SMS_FORMAT
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NETWORK_ERR
- * RadioError:NETWORK_NOT_READY
- * RadioError:NETWORK_REJECT
- * RadioError:NETWORK_TIMEOUT
- * RadioError:NO_MEMORY
- * RadioError:NO_NETWORK_FOUND
- * RadioError:NO_RESOURCES
- * RadioError:NO_SMS_TO_ACK
- * RadioError:NO_SATELLITE_SIGNAL
- * RadioError:NO_SUBSCRIPTION
- * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE
- * RadioError:OPERATION_NOT_ALLOWED
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SIM_ABSENT
- * RadioError:SIM_BUSY
- * RadioError:SIM_ERR
- * RadioError:SIM_FULL
- * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
- * RadioError:SMS_SEND_FAIL_RETRY
- * RadioError:SYSTEM_ERR
- * RadioError:SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL
- * RadioError:UNIDENTIFIED_SUBSCRIBER
- */
- void sendMessagesResponse(in RadioResponseInfo info);
-
- /**
- * Response of the request setIndicationFilter.
- *
- * @param info Response info struct containing serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void setIndicationFilterResponse(in RadioResponseInfo info);
-
- /**
- * Response of the request setPower.
- *
- * @param info Response info struct containing serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:NO_RF_CALIBRATION_INFO
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:RF_HARDWARE_ISSUE
- * RadioError:SYSTEM_ERR
- */
- void setPowerResponse(in RadioResponseInfo info);
-
- /**
- * Response of the request startSendingSatellitePointingInfo.
- *
- * @param info Response info struct containing serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void startSendingSatellitePointingInfoResponse(in RadioResponseInfo info);
-
- /**
- * Response of the request stopSendingSatellitePointingInfo.
- *
- * @param info Response info struct containing serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:INTERNAL_ERR
- * RadioError:INVALID_ARGUMENTS
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_SIM_STATE
- * RadioError:INVALID_STATE
- * RadioError:MODEM_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:REQUEST_RATE_LIMITED
- * RadioError:SYSTEM_ERR
- */
- void stopSendingSatellitePointingInfoResponse(in RadioResponseInfo info);
-}
diff --git a/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl b/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl
deleted file mode 100644
index 39b2b00..0000000
--- a/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-@VintfStability
-@Backing(type="int")
-@JavaDerive(toString=true)
-enum NTRadioTechnology {
- /* 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology */
- NB_IOT_NTN = 0,
- /* 3GPP 5G NR over Non-Terrestrial-Networks technology */
- NR_NTN = 1,
- /* 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology */
- EMTC_NTN = 2,
- /* Proprietary technology like Iridium or Bullitt */
- PROPRIETARY = 3
-}
diff --git a/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl b/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl
deleted file mode 100644
index 8496a59..0000000
--- a/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-@VintfStability
-@JavaDerive(toString=true)
-parcelable PointingInfo {
- /* Satellite azimuth in degrees */
- float satelliteAzimuthDegrees;
-
- /* Satellite elevation in degrees */
- float satelliteElevationDegrees;
-
- /* Antenna azimuth in degrees */
- float antennaAzimuthDegrees;
-
- /**
- * Angle of rotation about the x axis. This value represents the angle between a plane
- * parallel to the device's screen and a plane parallel to the ground.
- */
- float antennaPitchDegrees;
-
- /**
- * Angle of rotation about the y axis. This value represents the angle between a plane
- * perpendicular to the device's screen and a plane parallel to the ground.
- */
- float antennaRollDegrees;
-}
diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl
deleted file mode 100644
index 01e64aa..0000000
--- a/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-import android.hardware.radio.satellite.NTRadioTechnology;
-import android.hardware.radio.satellite.SatelliteFeature;
-
-@VintfStability
-@JavaDerive(toString=true)
-parcelable SatelliteCapabilities {
- /**
- * List of technologies supported by the satellite modem.
- */
- NTRadioTechnology[] supportedRadioTechnologies;
-
- /**
- * Whether satellite mode is always on (this indicates the power impact of keeping it on is
- * very minimal).
- */
- boolean isAlwaysOn;
-
- /**
- * Whether UE needs to point to a satellite to send and receive data.
- */
- boolean needsPointingToSatellite;
-
- /**
- * List of features supported by the satellite modem.
- */
- SatelliteFeature[] supportedFeatures;
-
- /**
- * Whether UE needs a separate SIM profile to communicate with satellite network.
- */
- boolean needsSeparateSimProfile;
-}
diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl
deleted file mode 100644
index 0e33998..0000000
--- a/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-@VintfStability
-@Backing(type="int")
-@JavaDerive(toString=true)
-enum SatelliteFeature {
- /* Able to send and receive SMS messages to/from SOS numbers like call/service centers */
- SOS_SMS = 0,
- /* Able to send and receive SMS messages to/from emergency numbers like 911 */
- EMERGENCY_SMS = 1,
- /* Able to send and receive SMS messages to/from any allowed contacts */
- SMS = 2,
- /* Able to send device location to allowed contacts */
- LOCATION_SHARING = 3
-}
diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl
deleted file mode 100644
index 349fd9e..0000000
--- a/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.satellite;
-
-@VintfStability
-@Backing(type="int")
-@JavaDerive(toString=true)
-enum SatelliteMode {
- /* Satellite modem is powered off */
- POWERED_OFF = 0,
- /* Satellite modem is in out of service state and not searching for satellite signal */
- OUT_OF_SERVICE_NOT_SEARCHING = 1,
- /* Satellite modem is in out of service state and searching for satellite signal */
- OUT_OF_SERVICE_SEARCHING = 2,
- /* Satellite modem has found satellite signal and gets connected to the satellite network */
- ACQUIRED = 3,
- /* Satellite modem is sending and/or receiving messages */
- MESSAGE_TRANSFERRING = 4
-}
diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp
index 9aecf78..5cf1378 100644
--- a/radio/aidl/compat/libradiocompat/Android.bp
+++ b/radio/aidl/compat/libradiocompat/Android.bp
@@ -43,7 +43,6 @@
"android.hardware.radio.modem-V2-ndk",
"android.hardware.radio.network-V2-ndk",
"android.hardware.radio.sap-V1-ndk",
- "android.hardware.radio.satellite-V1-ndk",
"android.hardware.radio.sim-V2-ndk",
"android.hardware.radio.voice-V2-ndk",
"android.hardware.radio@1.0",
@@ -94,9 +93,6 @@
"sap/Sap.cpp",
"sap/SapCallback.cpp",
"sap/structs.cpp",
- "satellite/RadioIndication-satellite.cpp",
- "satellite/RadioResponse-satellite.cpp",
- "satellite/RadioSatellite.cpp",
"sim/RadioIndication-sim.cpp",
"sim/RadioResponse-sim.cpp",
"sim/RadioSim.cpp",
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
index ad9127e..f042456 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
@@ -23,7 +23,6 @@
#include <aidl/android/hardware/radio/messaging/IRadioMessagingIndication.h>
#include <aidl/android/hardware/radio/modem/IRadioModemIndication.h>
#include <aidl/android/hardware/radio/network/IRadioNetworkIndication.h>
-#include <aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.h>
#include <aidl/android/hardware/radio/sim/IRadioSimIndication.h>
#include <aidl/android/hardware/radio/voice/IRadioVoiceIndication.h>
#include <android/hardware/radio/1.6/IRadioIndication.h>
@@ -61,10 +60,6 @@
::aidl::android::hardware::radio::ims::IRadioImsIndication,
::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true>
mImsCb;
- GuaranteedCallback< //
- ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication,
- ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndicationDefault, true>
- mSatelliteCb;
// IRadioIndication @ 1.0
Return<void> radioStateChanged(V1_0::RadioIndicationType type,
@@ -232,9 +227,6 @@
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb);
- void setResponseFunction(
- std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication>
- satelliteCb);
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb();
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
@@ -244,8 +236,6 @@
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb();
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb();
std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb();
- std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication>
- satelliteCb();
};
} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
index b976435..e20eed9 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
@@ -24,7 +24,6 @@
#include <aidl/android/hardware/radio/messaging/IRadioMessagingResponse.h>
#include <aidl/android/hardware/radio/modem/IRadioModemResponse.h>
#include <aidl/android/hardware/radio/network/IRadioNetworkResponse.h>
-#include <aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.h>
#include <aidl/android/hardware/radio/sim/IRadioSimResponse.h>
#include <aidl/android/hardware/radio/voice/IRadioVoiceResponse.h>
#include <android/hardware/radio/1.6/IRadioResponse.h>
@@ -55,9 +54,6 @@
GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse,
::aidl::android::hardware::radio::ims::IRadioImsResponseDefault>
mImsCb;
- GuaranteedCallback<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse,
- ::aidl::android::hardware::radio::satellite::IRadioSatelliteResponseDefault>
- mSatelliteCb;
// IRadioResponse @ 1.0
Return<void> getIccCardStatusResponse(const V1_0::RadioResponseInfo& info,
@@ -451,9 +447,6 @@
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb);
- void setResponseFunction(
- std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse>
- satelliteCb);
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb();
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse>
@@ -463,8 +456,6 @@
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb();
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb();
std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb();
- std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse>
- satelliteCb();
};
} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h
deleted file mode 100644
index 3ee6db2..0000000
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h
+++ /dev/null
@@ -1,65 +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.
- */
-#pragma once
-
-#include "RadioCompatBase.h"
-
-#include <aidl/android/hardware/radio/satellite/BnRadioSatellite.h>
-
-namespace android::hardware::radio::compat {
-
-class RadioSatellite : public RadioCompatBase,
- public aidl::android::hardware::radio::satellite::BnRadioSatellite {
- ::ndk::ScopedAStatus responseAcknowledgement() override;
- ::ndk::ScopedAStatus getCapabilities(int32_t serial) override;
- ::ndk::ScopedAStatus setPower(int32_t serial, bool on) override;
- ::ndk::ScopedAStatus getPowerState(int32_t serial) override;
- ::ndk::ScopedAStatus provisionService(
- int32_t serial, const std::string& imei, const std::string& msisdn,
- const std::string& imsi,
- const std::vector<::aidl::android::hardware::radio::satellite::SatelliteFeature>&
- features) override;
- ::ndk::ScopedAStatus addAllowedSatelliteContacts(
- int32_t serial, const std::vector<std::string>& contacts) override;
- ::ndk::ScopedAStatus removeAllowedSatelliteContacts(
- int32_t serial, const std::vector<std::string>& contacts) override;
- ::ndk::ScopedAStatus sendMessages(int32_t serial, const std::vector<std::string>& messages,
- const std::string& destination, double latitude,
- double longitude) override;
- ::ndk::ScopedAStatus getPendingMessages(int32_t serial) override;
- ::ndk::ScopedAStatus getSatelliteMode(int32_t serial) override;
- ::ndk::ScopedAStatus setIndicationFilter(int32_t serial, int32_t filterBitmask) override;
- ::ndk::ScopedAStatus startSendingSatellitePointingInfo(int32_t serial) override;
- ::ndk::ScopedAStatus stopSendingSatellitePointingInfo(int32_t serial) override;
- ::ndk::ScopedAStatus getMaxCharactersPerTextMessage(int32_t serial) override;
- ::ndk::ScopedAStatus getTimeForNextSatelliteVisibility(int32_t serial) override;
-
- ::ndk::ScopedAStatus setResponseFunctions(
- const std::shared_ptr<
- ::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse>&
- radioSatelliteResponse,
- const std::shared_ptr<
- ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication>&
- radioSatelliteIndication) override;
-
- protected:
- std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse> respond();
-
- public:
- using RadioCompatBase::RadioCompatBase;
-};
-
-} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp
deleted file mode 100644
index 39da43d..0000000
--- a/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp
+++ /dev/null
@@ -1,39 +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 <libradiocompat/RadioIndication.h>
-
-#include "commonStructs.h"
-#include "debug.h"
-
-#include "collections.h"
-
-#define RADIO_MODULE "RadioSatelliteIndication"
-
-namespace android::hardware::radio::compat {
-
-namespace aidl = ::aidl::android::hardware::radio::satellite;
-
-void RadioIndication::setResponseFunction(
- std::shared_ptr<aidl::IRadioSatelliteIndication> satelliteCb) {
- mSatelliteCb = satelliteCb;
-}
-
-std::shared_ptr<aidl::IRadioSatelliteIndication> RadioIndication::satelliteCb() {
- return mSatelliteCb.get();
-}
-
-} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp
deleted file mode 100644
index 2209c93..0000000
--- a/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp
+++ /dev/null
@@ -1,39 +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 <libradiocompat/RadioResponse.h>
-
-#include "commonStructs.h"
-#include "debug.h"
-
-#include "collections.h"
-
-#define RADIO_MODULE "RadioSatelliteResponse"
-
-namespace android::hardware::radio::compat {
-
-namespace aidl = ::aidl::android::hardware::radio::satellite;
-
-void RadioResponse::setResponseFunction(
- std::shared_ptr<aidl::IRadioSatelliteResponse> satelliteCb) {
- mSatelliteCb = satelliteCb;
-}
-
-std::shared_ptr<aidl::IRadioSatelliteResponse> RadioResponse::satelliteCb() {
- return mSatelliteCb.get();
-}
-
-} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp
deleted file mode 100644
index 16a3167..0000000
--- a/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp
+++ /dev/null
@@ -1,128 +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 <libradiocompat/RadioSatellite.h>
-
-#include "commonStructs.h"
-#include "debug.h"
-
-#include "collections.h"
-
-#define RADIO_MODULE "RadioSatellite"
-
-namespace android::hardware::radio::compat {
-
-using ::ndk::ScopedAStatus;
-namespace aidl = ::aidl::android::hardware::radio::satellite;
-constexpr auto ok = &ScopedAStatus::ok;
-
-std::shared_ptr<aidl::IRadioSatelliteResponse> RadioSatellite::respond() {
- return mCallbackManager->response().satelliteCb();
-}
-
-ScopedAStatus RadioSatellite::responseAcknowledgement() {
- LOG(ERROR) << " responseAcknowledgement is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::getCapabilities(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " getCapabilities is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::setPower(int32_t serial, bool /*on*/) {
- LOG_CALL << serial;
- LOG(ERROR) << " setPower is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::getPowerState(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " getPowerSate is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::provisionService(
- int32_t serial, const std::string& /*imei*/, const std::string& /*msisdn*/,
- const std::string& /*imsi*/,
- const std::vector<
- ::aidl::android::hardware::radio::satellite::SatelliteFeature>& /*features*/) {
- LOG_CALL << serial;
- LOG(ERROR) << " provisionService is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::addAllowedSatelliteContacts(
- int32_t serial, const std::vector<std::string>& /*contacts*/) {
- LOG_CALL << serial;
- LOG(ERROR) << " addAllowedSatelliteContacts is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::removeAllowedSatelliteContacts(
- int32_t serial, const std::vector<std::string>& /*contacts*/) {
- LOG_CALL << serial;
- LOG(ERROR) << " removeAllowedSatelliteContacts is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::sendMessages(int32_t serial,
- const std::vector<std::string>& /*messages*/,
- const std::string& /*destination*/, double /*latitude*/,
- double /*longitude*/) {
- LOG_CALL << serial;
- LOG(ERROR) << " sendMessage is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::getPendingMessages(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " getPendingMessages is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::getSatelliteMode(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " getSatelliteMode is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::setIndicationFilter(int32_t serial, int32_t /*filterBitmask*/) {
- LOG_CALL << serial;
- LOG(ERROR) << " setIndicationFilter is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::startSendingSatellitePointingInfo(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " startSendingSatellitePointingInfo is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::stopSendingSatellitePointingInfo(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " stopSendingSatellitePointingInfo is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::getMaxCharactersPerTextMessage(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " getMaxCharactersPerTextMessage is unsupported by HIDL HALs";
- return ok();
-}
-ScopedAStatus RadioSatellite::getTimeForNextSatelliteVisibility(int32_t serial) {
- LOG_CALL << serial;
- LOG(ERROR) << " getTimeForNextSatelliteVisibility is unsupported by HIDL HALs";
- return ok();
-}
-
-ScopedAStatus RadioSatellite::setResponseFunctions(
- const std::shared_ptr<aidl::IRadioSatelliteResponse>& response,
- const std::shared_ptr<aidl::IRadioSatelliteIndication>& indication) {
- LOG_CALL << response << ' ' << indication;
- mCallbackManager->setResponseFunctions(response, indication);
- return ok();
-}
-
-} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp
index 5d14c85..dff0182 100644
--- a/radio/aidl/compat/service/Android.bp
+++ b/radio/aidl/compat/service/Android.bp
@@ -46,7 +46,6 @@
"android.hardware.radio.modem-V2-ndk",
"android.hardware.radio.network-V2-ndk",
"android.hardware.radio.sap-V1-ndk",
- "android.hardware.radio.satellite-V1-ndk",
"android.hardware.radio.sim-V2-ndk",
"android.hardware.radio.voice-V2-ndk",
"android.hardware.radio@1.0",
diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp
index f112d6d..e79d3c0 100644
--- a/radio/aidl/vts/Android.bp
+++ b/radio/aidl/vts/Android.bp
@@ -58,9 +58,6 @@
"radio_network_test.cpp",
"radio_sap_callback.cpp",
"radio_sap_test.cpp",
- "radio_satellite_indication.cpp",
- "radio_satellite_response.cpp",
- "radio_satellite_test.cpp",
"radio_sim_indication.cpp",
"radio_sim_response.cpp",
"radio_sim_test.cpp",
@@ -83,7 +80,6 @@
"android.hardware.radio.modem-V2-ndk",
"android.hardware.radio.network-V2-ndk",
"android.hardware.radio.sap-V1-ndk",
- "android.hardware.radio.satellite-V1-ndk",
"android.hardware.radio.sim-V2-ndk",
"android.hardware.radio.voice-V2-ndk",
],
diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
index 86c1099..c04173b 100644
--- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp
+++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
@@ -24,7 +24,6 @@
#include "radio_modem_utils.h"
#include "radio_network_utils.h"
#include "radio_sap_utils.h"
-#include "radio_satellite_utils.h"
#include "radio_sim_utils.h"
#include "radio_voice_utils.h"
@@ -80,12 +79,6 @@
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioIms::descriptor)),
android::PrintInstanceNameToString);
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioSatelliteTest);
-INSTANTIATE_TEST_SUITE_P(
- PerInstance, RadioSatelliteTest,
- testing::ValuesIn(android::getAidlHalInstanceNames(IRadioSatellite::descriptor)),
- android::PrintInstanceNameToString);
-
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioImsMediaTest);
INSTANTIATE_TEST_SUITE_P(PerInstance, RadioImsMediaTest,
testing::ValuesIn(android::getAidlHalInstanceNames(IImsMedia::descriptor)),
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h
index 2e6c49c..d515e1a 100644
--- a/radio/aidl/vts/radio_aidl_hal_utils.h
+++ b/radio/aidl/vts/radio_aidl_hal_utils.h
@@ -69,8 +69,6 @@
static constexpr const char* FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims";
-static constexpr const char* FEATURE_TELEPHONY_SATELLITE = "android.hardware.telephony.satellite";
-
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
#define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2
diff --git a/radio/aidl/vts/radio_imsmedia_test.cpp b/radio/aidl/vts/radio_imsmedia_test.cpp
index d9e57c9..2b6f5ef 100644
--- a/radio/aidl/vts/radio_imsmedia_test.cpp
+++ b/radio/aidl/vts/radio_imsmedia_test.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <aidl/android/hardware/radio/ims/media/MediaDirection.h>
#include <android-base/logging.h>
#include <android/binder_auto_utils.h>
#include <android/binder_manager.h>
@@ -44,8 +45,10 @@
int32_t sessionId = 1;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -90,8 +93,10 @@
int32_t duration = 200;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -143,8 +148,10 @@
std::vector<RtpHeaderExtension> extensions;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -190,8 +197,10 @@
MediaQualityThreshold threshold;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -243,13 +252,14 @@
localEndPoint.rtcpFd = ndk::ScopedFileDescriptor(mRtcpSocketFd);
localEndPoint.modemId = 1;
- rtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ rtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
rtpConfig.remoteAddress.ipAddress = "122.22.22.22";
rtpConfig.remoteAddress.portNumber = 2222;
result = radio_imsmedia->openSession(sessionId, localEndPoint, rtpConfig);
-
return result;
}
diff --git a/radio/aidl/vts/radio_satellite_indication.cpp b/radio/aidl/vts/radio_satellite_indication.cpp
deleted file mode 100644
index 13e4453..0000000
--- a/radio/aidl/vts/radio_satellite_indication.cpp
+++ /dev/null
@@ -1,56 +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 "radio_satellite_utils.h"
-
-RadioSatelliteIndication::RadioSatelliteIndication(RadioServiceTest& parent)
- : parent_satellite(parent) {}
-
-ndk::ScopedAStatus RadioSatelliteIndication::onPendingMessageCount(RadioIndicationType /*type*/,
- int32_t /*count*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteIndication::onNewMessages(
- RadioIndicationType /*type*/, const std::vector<std::string>& /*messages*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteIndication::onMessagesTransferComplete(
- RadioIndicationType /*type*/, bool /*complete*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteIndication::onSatellitePointingInfoChanged(
- RadioIndicationType /*type*/, const PointingInfo& /*pointingInfo*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteIndication::onSatelliteModeChanged(RadioIndicationType /*type*/,
- SatelliteMode /*mode*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteIndication::onSatelliteRadioTechnologyChanged(
- RadioIndicationType /*type*/, NTRadioTechnology /*technology*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteIndication::onProvisionStateChanged(
- RadioIndicationType /*type*/, bool /*provisioned*/,
- const std::vector<SatelliteFeature>& /*features*/) {
- return ndk::ScopedAStatus::ok();
-}
diff --git a/radio/aidl/vts/radio_satellite_response.cpp b/radio/aidl/vts/radio_satellite_response.cpp
deleted file mode 100644
index 84d57b2..0000000
--- a/radio/aidl/vts/radio_satellite_response.cpp
+++ /dev/null
@@ -1,120 +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 "radio_satellite_utils.h"
-
-RadioSatelliteResponse::RadioSatelliteResponse(RadioServiceTest& parent)
- : parent_satellite(parent) {}
-
-ndk::ScopedAStatus RadioSatelliteResponse::acknowledgeRequest(int32_t /*serial*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::getCapabilitiesResponse(
- const RadioResponseInfo& info, const SatelliteCapabilities& /*capabilities*/) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::setPowerResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::getPowerStateResponse(const RadioResponseInfo& info,
- bool /*on*/) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::provisionServiceResponse(const RadioResponseInfo& info,
- bool /*provisioned*/) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::addAllowedSatelliteContactsResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::removeAllowedSatelliteContactsResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::sendMessagesResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::getPendingMessagesResponse(
- const RadioResponseInfo& info, const std::vector<std::string>& /*messages*/) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::getSatelliteModeResponse(
- const RadioResponseInfo& info, SatelliteMode /*mode*/, NTRadioTechnology /*technology*/) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::setIndicationFilterResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::startSendingSatellitePointingInfoResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::stopSendingSatellitePointingInfoResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::getMaxCharactersPerTextMessageResponse(
- const RadioResponseInfo& info, int32_t /*charLimit*/) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus RadioSatelliteResponse::getTimeForNextSatelliteVisibilityResponse(
- const RadioResponseInfo& info, int32_t /*timeInSeconds*/) {
- rspInfo = info;
- parent_satellite.notify(info.serial);
- return ndk::ScopedAStatus::ok();
-}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_satellite_test.cpp b/radio/aidl/vts/radio_satellite_test.cpp
deleted file mode 100644
index b0358b3..0000000
--- a/radio/aidl/vts/radio_satellite_test.cpp
+++ /dev/null
@@ -1,626 +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 <aidl/android/hardware/radio/config/IRadioConfig.h>
-#include <android-base/logging.h>
-#include <android/binder_manager.h>
-
-#include "radio_satellite_utils.h"
-
-#define ASSERT_OK(ret) ASSERT_TRUE(((ret).isOk()))
-
-void RadioSatelliteTest::SetUp() {
- std::string serviceName = GetParam();
-
- if (!isServiceValidForDeviceConfiguration(serviceName)) {
- ALOGI("Skipped the radio satellite tests due to device configuration.");
- GTEST_SKIP();
- }
-
- satellite = IRadioSatellite::fromBinder(
- ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
- ASSERT_NE(nullptr, satellite.get());
-
- rsp_satellite = ndk::SharedRefBase::make<RadioSatelliteResponse>(*this);
- ASSERT_NE(nullptr, rsp_satellite.get());
-
- count_ = 0;
-
- ind_satellite = ndk::SharedRefBase::make<RadioSatelliteIndication>(*this);
- ASSERT_NE(nullptr, ind_satellite.get());
-
- satellite->setResponseFunctions(rsp_satellite, ind_satellite);
-
- // Assert IRadioConfig exists before testing
- radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
- AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
- ASSERT_NE(nullptr, radio_config.get());
-}
-
-/*
- * Test IRadioSatellite.getCapabilities() for the response returned.
- */
-TEST_P(RadioSatelliteTest, getCapabilities) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping getCapabilities because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running getCapabilities because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->getCapabilities(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("getCapabilities, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.setPower() for the response returned.
- */
-TEST_P(RadioSatelliteTest, setPower) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping setPower because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running setPower because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->setPower(serial, true);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("setPower, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.getPowerSate() for the response returned.
- */
-TEST_P(RadioSatelliteTest, getPowerSate) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping getPowerSate because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running getPowerSate because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->getPowerState(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("getPowerSate, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.provisionService() for the response returned.
- */
-TEST_P(RadioSatelliteTest, provisionService) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping provisionService because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running provisionService because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- std::string imei = "imei";
- std::string msisdn = "msisdn";
- std::string imsi = "imsi";
- const std::vector<SatelliteFeature> features{
- SatelliteFeature::SOS_SMS, SatelliteFeature::EMERGENCY_SMS, SatelliteFeature::SMS};
- ndk::ScopedAStatus res = satellite->provisionService(serial, imei, msisdn, imsi, features);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("provisionService, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error,
- {RadioError::NONE,
- RadioError::ABORTED,
- RadioError::ACCESS_BARRED,
- RadioError::CANCELLED,
- RadioError::FEATURE_NOT_SUPPORTED,
- RadioError::INTERNAL_ERR,
- RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE,
- RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE,
- RadioError::MODEM_ERR,
- RadioError::MODEM_INCOMPATIBLE,
- RadioError::NETWORK_ERR,
- RadioError::NETWORK_NOT_READY,
- RadioError::NETWORK_REJECT,
- RadioError::NETWORK_TIMEOUT,
- RadioError::NO_MEMORY,
- RadioError::NO_NETWORK_FOUND,
- RadioError::NO_RESOURCES,
- RadioError::NO_SATELLITE_SIGNAL,
- RadioError::NO_SUBSCRIPTION,
- RadioError::OPERATION_NOT_ALLOWED,
- RadioError::RADIO_NOT_AVAILABLE,
- RadioError::RADIO_TECHNOLOGY_NOT_SUPPORTED,
- RadioError::REQUEST_NOT_SUPPORTED,
- RadioError::REQUEST_RATE_LIMITED,
- RadioError::SIM_ABSENT,
- RadioError::SIM_BUSY,
- RadioError::SIM_ERR,
- RadioError::SIM_FULL,
- RadioError::SUBSCRIBER_NOT_AUTHORIZED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.addAllowedSatelliteContacts() for the response returned.
- */
-TEST_P(RadioSatelliteTest, addAllowedSatelliteContacts) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping addAllowedSatelliteContacts because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running addAllowedSatelliteContacts because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- const std::vector<std::string> contacts = {"contact 1", "contact 2"};
- ndk::ScopedAStatus res = satellite->addAllowedSatelliteContacts(serial, contacts);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("addAllowedSatelliteContacts, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error,
- {RadioError::NONE,
- RadioError::ABORTED,
- RadioError::ACCESS_BARRED,
- RadioError::CANCELLED,
- RadioError::INTERNAL_ERR,
- RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_CONTACT,
- RadioError::INVALID_MODEM_STATE,
- RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE,
- RadioError::MODEM_ERR,
- RadioError::NETWORK_ERR,
- RadioError::NETWORK_NOT_READY,
- RadioError::NETWORK_REJECT,
- RadioError::NETWORK_TIMEOUT,
- RadioError::NO_MEMORY,
- RadioError::NO_NETWORK_FOUND,
- RadioError::NO_RESOURCES,
- RadioError::NO_SATELLITE_SIGNAL,
- RadioError::NO_SUBSCRIPTION,
- RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE,
- RadioError::OPERATION_NOT_ALLOWED,
- RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED,
- RadioError::REQUEST_RATE_LIMITED,
- RadioError::SIM_ABSENT,
- RadioError::SIM_BUSY,
- RadioError::SIM_ERR,
- RadioError::SIM_FULL,
- RadioError::SYSTEM_ERR,
- RadioError::UNIDENTIFIED_SUBSCRIBER}));
-}
-
-/*
- * Test IRadioSatellite.removeAllowedSatelliteContacts() for the response returned.
- */
-TEST_P(RadioSatelliteTest, removeAllowedSatelliteContacts) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping removeAllowedSatelliteContacts because satellite is not supported in "
- "device");
- return;
- } else {
- ALOGI("Running removeAllowedSatelliteContacts because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- const std::vector<std::string> contacts = {"contact 1", "contact 2"};
- ndk::ScopedAStatus res = satellite->removeAllowedSatelliteContacts(serial, contacts);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("removeAllowedSatelliteContacts, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error,
- {RadioError::NONE,
- RadioError::ABORTED,
- RadioError::ACCESS_BARRED,
- RadioError::CANCELLED,
- RadioError::INTERNAL_ERR,
- RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_CONTACT,
- RadioError::INVALID_MODEM_STATE,
- RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE,
- RadioError::MODEM_ERR,
- RadioError::NETWORK_ERR,
- RadioError::NETWORK_NOT_READY,
- RadioError::NETWORK_REJECT,
- RadioError::NETWORK_TIMEOUT,
- RadioError::NO_MEMORY,
- RadioError::NO_NETWORK_FOUND,
- RadioError::NO_RESOURCES,
- RadioError::NO_SATELLITE_SIGNAL,
- RadioError::NO_SUBSCRIPTION,
- RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE,
- RadioError::OPERATION_NOT_ALLOWED,
- RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED,
- RadioError::REQUEST_RATE_LIMITED,
- RadioError::SIM_ABSENT,
- RadioError::SIM_BUSY,
- RadioError::SIM_ERR,
- RadioError::SIM_FULL,
- RadioError::SYSTEM_ERR,
- RadioError::UNIDENTIFIED_SUBSCRIBER}));
-}
-
-/*
- * Test IRadioSatellite.sendMessages() for the response returned.
- */
-TEST_P(RadioSatelliteTest, sendMessages) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping sendMessages because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running sendMessages because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- const std::vector<std::string> messages = {"message 1", "message 2"};
- std::string destination = "0123456789";
- ndk::ScopedAStatus res = satellite->sendMessages(serial, messages, destination, 1.0, 2.0);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("sendMessages, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error,
- {RadioError::NONE,
- RadioError::ABORTED,
- RadioError::ACCESS_BARRED,
- RadioError::BLOCKED_DUE_TO_CALL,
- RadioError::CANCELLED,
- RadioError::ENCODING_ERR,
- RadioError::ENCODING_NOT_SUPPORTED,
- RadioError::INTERNAL_ERR,
- RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE,
- RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_SMS_FORMAT,
- RadioError::INVALID_STATE,
- RadioError::MODEM_ERR,
- RadioError::NETWORK_ERR,
- RadioError::NETWORK_NOT_READY,
- RadioError::NETWORK_REJECT,
- RadioError::NETWORK_TIMEOUT,
- RadioError::NO_MEMORY,
- RadioError::NO_NETWORK_FOUND,
- RadioError::NO_RESOURCES,
- RadioError::NO_SMS_TO_ACK,
- RadioError::NO_SATELLITE_SIGNAL,
- RadioError::NO_SUBSCRIPTION,
- RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE,
- RadioError::OPERATION_NOT_ALLOWED,
- RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED,
- RadioError::REQUEST_RATE_LIMITED,
- RadioError::SIM_ABSENT,
- RadioError::SIM_BUSY,
- RadioError::SIM_ERR,
- RadioError::SIM_FULL,
- RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED,
- RadioError::SMS_SEND_FAIL_RETRY,
- RadioError::SYSTEM_ERR,
- RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL,
- RadioError::UNIDENTIFIED_SUBSCRIBER}));
-}
-
-/*
- * Test IRadioSatellite.getPendingMessages() for the response returned.
- */
-TEST_P(RadioSatelliteTest, getPendingMessages) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping getPendingMessages because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running getPendingMessages because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->getPendingMessages(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("getPendingMessages, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error,
- {RadioError::NONE,
- RadioError::ABORTED,
- RadioError::ACCESS_BARRED,
- RadioError::BLOCKED_DUE_TO_CALL,
- RadioError::CANCELLED,
- RadioError::ENCODING_ERR,
- RadioError::ENCODING_NOT_SUPPORTED,
- RadioError::INTERNAL_ERR,
- RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE,
- RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_SMS_FORMAT,
- RadioError::INVALID_STATE,
- RadioError::MODEM_ERR,
- RadioError::NETWORK_ERR,
- RadioError::NETWORK_NOT_READY,
- RadioError::NETWORK_REJECT,
- RadioError::NETWORK_TIMEOUT,
- RadioError::NO_MEMORY,
- RadioError::NO_NETWORK_FOUND,
- RadioError::NO_RESOURCES,
- RadioError::NO_SMS_TO_ACK,
- RadioError::NO_SATELLITE_SIGNAL,
- RadioError::NO_SUBSCRIPTION,
- RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE,
- RadioError::OPERATION_NOT_ALLOWED,
- RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED,
- RadioError::REQUEST_RATE_LIMITED,
- RadioError::SIM_ABSENT,
- RadioError::SIM_BUSY,
- RadioError::SIM_ERR,
- RadioError::SIM_FULL,
- RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED,
- RadioError::SYSTEM_ERR,
- RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL}));
-}
-
-/*
- * Test IRadioSatellite.getSatelliteMode() for the response returned.
- */
-TEST_P(RadioSatelliteTest, getSatelliteMode) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping getSatelliteMode because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running getSatelliteMode because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->getSatelliteMode(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("getSatelliteMode, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.setIndicationFilter() for the response returned.
- */
-TEST_P(RadioSatelliteTest, setIndicationFilter) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping setIndicationFilter because satellite is not supported in device");
- return;
- } else {
- ALOGI("Running setIndicationFilter because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->setIndicationFilter(serial, 0);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("setIndicationFilter, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.startSendingSatellitePointingInfo() for the response returned.
- */
-TEST_P(RadioSatelliteTest, startSendingSatellitePointingInfo) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping startSendingSatellitePointingInfo because satellite is not supported in "
- "device");
- return;
- } else {
- ALOGI("Running startSendingSatellitePointingInfo because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->startSendingSatellitePointingInfo(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("startSendingSatellitePointingInfo, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.stopSatelliteLocationUpdate() for the response returned.
- */
-TEST_P(RadioSatelliteTest, stopSatelliteLocationUpdate) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping stopSendingSatellitePointingInfo because satellite is not supported in "
- "device");
- return;
- } else {
- ALOGI("Running stopSendingSatellitePointingInfo because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->stopSendingSatellitePointingInfo(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("stopSendingSatellitePointingInfo, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.getMaxCharactersPerTextMessage() for the response returned.
- */
-TEST_P(RadioSatelliteTest, getMaxCharactersPerTextMessage) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping getMaxCharactersPerTextMessage because satellite is not supported in "
- "device");
- return;
- } else {
- ALOGI("Running getMaxCharactersPerTextMessage because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->getMaxCharactersPerTextMessage(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("getMaxCharactersPerTextMessage, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
-
-/*
- * Test IRadioSatellite.getTimeForNextSatelliteVisibility() for the response returned.
- */
-TEST_P(RadioSatelliteTest, getTimeForNextSatelliteVisibility) {
- if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) {
- ALOGI("Skipping getTimeForNextSatelliteVisibility because satellite is not supported in "
- "device");
- return;
- } else {
- ALOGI("Running getTimeForNextSatelliteVisibility because satellite is supported in device");
- }
-
- serial = GetRandomSerialNumber();
- ndk::ScopedAStatus res = satellite->getTimeForNextSatelliteVisibility(serial);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type);
- EXPECT_EQ(serial, rsp_satellite->rspInfo.serial);
-
- ALOGI("getTimeForNextSatelliteVisibility, rspInfo.error = %s\n",
- toString(rsp_satellite->rspInfo.error).c_str());
-
- ASSERT_TRUE(CheckAnyOfErrors(
- rsp_satellite->rspInfo.error,
- {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE,
- RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY,
- RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED,
- RadioError::SYSTEM_ERR}));
-}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_satellite_utils.h b/radio/aidl/vts/radio_satellite_utils.h
deleted file mode 100644
index 2b07ec5..0000000
--- a/radio/aidl/vts/radio_satellite_utils.h
+++ /dev/null
@@ -1,126 +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.
- */
-
-#pragma once
-
-#include <aidl/android/hardware/radio/satellite/BnRadioSatelliteIndication.h>
-#include <aidl/android/hardware/radio/satellite/BnRadioSatelliteResponse.h>
-#include <aidl/android/hardware/radio/satellite/IRadioSatellite.h>
-
-#include "radio_aidl_hal_utils.h"
-
-using namespace aidl::android::hardware::radio::satellite;
-
-class RadioSatelliteTest;
-
-/* Callback class for Satellite response */
-class RadioSatelliteResponse : public BnRadioSatelliteResponse {
- protected:
- RadioServiceTest& parent_satellite;
-
- public:
- RadioSatelliteResponse(RadioServiceTest& parent_satellite);
- virtual ~RadioSatelliteResponse() = default;
-
- RadioResponseInfo rspInfo;
-
- virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
-
- virtual ndk::ScopedAStatus getCapabilitiesResponse(
- const RadioResponseInfo& info, const SatelliteCapabilities& capabilities) override;
-
- virtual ndk::ScopedAStatus setPowerResponse(const RadioResponseInfo& info) override;
-
- virtual ndk::ScopedAStatus getPowerStateResponse(const RadioResponseInfo& info,
- bool on) override;
-
- virtual ndk::ScopedAStatus provisionServiceResponse(const RadioResponseInfo& info,
- bool provisioned) override;
-
- virtual ndk::ScopedAStatus addAllowedSatelliteContactsResponse(
- const RadioResponseInfo& info) override;
-
- virtual ndk::ScopedAStatus removeAllowedSatelliteContactsResponse(
- const RadioResponseInfo& info) override;
-
- virtual ndk::ScopedAStatus sendMessagesResponse(const RadioResponseInfo& info) override;
-
- virtual ndk::ScopedAStatus getPendingMessagesResponse(
- const RadioResponseInfo& info, const std::vector<std::string>& /*messages*/) override;
-
- virtual ndk::ScopedAStatus getSatelliteModeResponse(
- const RadioResponseInfo& info, SatelliteMode mode,
- satellite::NTRadioTechnology technology) override;
-
- virtual ndk::ScopedAStatus setIndicationFilterResponse(const RadioResponseInfo& info) override;
-
- virtual ndk::ScopedAStatus startSendingSatellitePointingInfoResponse(
- const RadioResponseInfo& info) override;
-
- virtual ndk::ScopedAStatus stopSendingSatellitePointingInfoResponse(
- const RadioResponseInfo& info) override;
-
- virtual ndk::ScopedAStatus getMaxCharactersPerTextMessageResponse(const RadioResponseInfo& info,
- int32_t charLimit) override;
-
- virtual ndk::ScopedAStatus getTimeForNextSatelliteVisibilityResponse(
- const RadioResponseInfo& info, int32_t timeInSeconds) override;
-};
-
-/* Callback class for Satellite indication */
-class RadioSatelliteIndication : public BnRadioSatelliteIndication {
- protected:
- RadioServiceTest& parent_satellite;
-
- public:
- RadioSatelliteIndication(RadioServiceTest& parent_satellite);
- virtual ~RadioSatelliteIndication() = default;
-
- virtual ndk::ScopedAStatus onPendingMessageCount(RadioIndicationType type,
- int32_t count) override;
-
- virtual ndk::ScopedAStatus onNewMessages(RadioIndicationType type,
- const std::vector<std::string>& messages) override;
-
- virtual ndk::ScopedAStatus onMessagesTransferComplete(RadioIndicationType type,
- bool complete) override;
-
- virtual ndk::ScopedAStatus onSatellitePointingInfoChanged(
- RadioIndicationType type, const PointingInfo& pointingInfo) override;
-
- virtual ndk::ScopedAStatus onSatelliteModeChanged(RadioIndicationType type,
- SatelliteMode mode) override;
-
- virtual ndk::ScopedAStatus onSatelliteRadioTechnologyChanged(
- RadioIndicationType type, satellite::NTRadioTechnology technology) override;
-
- virtual ndk::ScopedAStatus onProvisionStateChanged(
- RadioIndicationType type, bool provisioned,
- const std::vector<SatelliteFeature>& features) override;
-};
-
-// The main test class for AIDL Satellite.
-class RadioSatelliteTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
- public:
- virtual void SetUp() override;
-
- /* Radio Satellite service handle */
- std::shared_ptr<IRadioSatellite> satellite;
- /* Radio Satellite response handle */
- std::shared_ptr<RadioSatelliteResponse> rsp_satellite;
- /* Radio Satellite indication handle */
- std::shared_ptr<RadioSatelliteIndication> ind_satellite;
-};
diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
index bbf3633..8ffc179 100644
--- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
+++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
@@ -172,8 +172,9 @@
// allowing it to be launched with Android S (or later) with Keymaster 4.0
// in StrongBox
void check_skip_test(void) const {
- if (is_attest_key_feature_disabled() && is_strongbox_enabled() &&
- is_chipset_allowed_km4_strongbox()) {
+ // Check the chipset first as that doesn't require a round-trip to Package Manager.
+ if (is_chipset_allowed_km4_strongbox() && is_strongbox_enabled() &&
+ is_attest_key_feature_disabled()) {
GTEST_SKIP() << "Test is not applicable";
}
}
diff --git a/security/keymint/aidl/vts/functional/AuthTest.cpp b/security/keymint/aidl/vts/functional/AuthTest.cpp
index a31ac01..78c88f4 100644
--- a/security/keymint/aidl/vts/functional/AuthTest.cpp
+++ b/security/keymint/aidl/vts/functional/AuthTest.cpp
@@ -274,7 +274,7 @@
std::shared_ptr<ISecureClock> clock_;
string password_;
uint32_t uid_;
- long sid_;
+ int64_t sid_;
std::vector<uint8_t> handle_;
};
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index fb5ef49..1dec8d7 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -108,6 +108,15 @@
return true;
}
+void check_crl_distribution_points_extension_not_present(X509* certificate) {
+ ASN1_OBJECT_Ptr crl_dp_oid(OBJ_txt2obj(kCrlDPOid, 1 /* dotted string format */));
+ ASSERT_TRUE(crl_dp_oid.get());
+
+ int location =
+ X509_get_ext_by_OBJ(certificate, crl_dp_oid.get(), -1 /* search from beginning */);
+ ASSERT_EQ(location, -1);
+}
+
void check_attestation_version(uint32_t attestation_version, int32_t aidl_version) {
// Version numbers in attestation extensions should be a multiple of 100.
EXPECT_EQ(attestation_version % 100, 0);
@@ -1690,6 +1699,10 @@
EXPECT_TRUE(!!cert.get());
if (!cert.get()) return false;
+ // Make sure CRL Distribution Points extension is not present in a certificate
+ // containing attestation record.
+ check_crl_distribution_points_extension_not_present(cert.get());
+
ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get());
EXPECT_TRUE(!!attest_rec);
if (!attest_rec) return false;
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
index a6a9df6..3c753d1 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
@@ -356,7 +356,7 @@
SecurityLevel securityLevel_;
string name_;
string author_;
- long challenge_;
+ int64_t challenge_;
private:
void CheckEncryptOneByteAtATime(BlockMode block_mode, const int block_size,
diff --git a/security/keymint/support/include/keymint_support/attestation_record.h b/security/keymint/support/include/keymint_support/attestation_record.h
index bc76c93..f280f48 100644
--- a/security/keymint/support/include/keymint_support/attestation_record.h
+++ b/security/keymint/support/include/keymint_support/attestation_record.h
@@ -43,6 +43,8 @@
*/
static const char kAttestionRecordOid[] = "1.3.6.1.4.1.11129.2.1.17";
+static const char kCrlDPOid[] = "2.5.29.31"; // Standard CRL Distribution Points extension.
+
enum class VerifiedBoot : uint8_t {
VERIFIED = 0,
SELF_SIGNED = 1,
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 9620b6a..491b757 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -805,8 +805,8 @@
return "Challenge must be a Bstr.";
}
- if (challenge.size() < 32 || challenge.size() > 64) {
- return "Challenge size must be between 32 and 64 bytes inclusive. "
+ if (challenge.size() < 16 || challenge.size() > 64) {
+ return "Challenge size must be between 16 and 64 bytes inclusive. "
"However, challenge is " +
std::to_string(challenge.size()) + " bytes long.";
}
diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
index 5bd2145..35b83dd 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
@@ -315,7 +315,7 @@
*
* @param in challenge contains a byte string from the provisioning server which will be
* included in the signed data of the CSR structure. Different provisioned backends may
- * use different semantic data for this field, but the supported sizes must be between 32
+ * use different semantic data for this field, but the supported sizes must be between 16
* and 64 bytes, inclusive.
*
* @return the following CBOR Certificate Signing Request (Csr) serialized into a byte array:
diff --git a/security/rkp/aidl/lint-baseline.xml b/security/rkp/aidl/lint-baseline.xml
new file mode 100644
index 0000000..d25d383
--- /dev/null
+++ b/security/rkp/aidl/lint-baseline.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 8.0.0-dev" type="baseline" dependencies="true" variant="all" version="8.0.0-dev">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 33): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/security/rkp/aidl/android.hardware.security.rkp-V1-java-source/gen/android/hardware/security/keymint/IRemotelyProvisionedComponent.java"
+ line="50"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 33): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/security/rkp/aidl/android.hardware.security.rkp-V2-java-source/gen/android/hardware/security/keymint/IRemotelyProvisionedComponent.java"
+ line="50"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 33): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/security/rkp/aidl/android.hardware.security.rkp-V3-java-source/gen/android/hardware/security/keymint/IRemotelyProvisionedComponent.java"
+ line="495"
+ column="12"/>
+ </issue>
+
+</issues>
\ No newline at end of file
diff --git a/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h b/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h
index b802e6c..a4e4457 100644
--- a/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h
+++ b/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h
@@ -46,8 +46,6 @@
bool resetHal() override;
void startPollingThread() override;
static void pollingThread(SensorsHidlEnvironmentV1_0* env, std::atomic_bool& stop);
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SensorsHidlEnvironmentV1_0);
};
#endif // ANDROID_SENSORS_HIDL_ENVIRONMENT_V1_0_H
\ No newline at end of file
diff --git a/sensors/aidl/vts/SensorsAidlEnvironment.h b/sensors/aidl/vts/SensorsAidlEnvironment.h
index 2f5f287..a852e91 100644
--- a/sensors/aidl/vts/SensorsAidlEnvironment.h
+++ b/sensors/aidl/vts/SensorsAidlEnvironment.h
@@ -69,8 +69,6 @@
*/
void readEvents();
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SensorsAidlEnvironment);
-
/**
* Pointer to the Sensors HAL Interface that allows the test to call HAL functions.
*/
diff --git a/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h b/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h
index 5fe4d8b..796de2f 100644
--- a/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h
+++ b/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h
@@ -79,8 +79,6 @@
*/
void readEvents();
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SensorsHidlEnvironmentV2_X);
-
/**
* Pointer to the Sensors HAL Interface that allows the test to call HAL functions.
*/
diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h
index f2c92ae..ec7c906 100644
--- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h
+++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h
@@ -225,7 +225,9 @@
ASSERT_EQ(batch(handle, samplingPeriodInNs, batchingPeriodInNs), Result::OK);
ASSERT_EQ(activate(handle, 1), Result::OK);
- events = getEnvironment()->collectEvents(minTimeUs, minNEvent, true /*clearBeforeStart*/);
+ events = getEnvironment()->collectEvents(
+ minTimeUs, minNEvent, true /* clearBeforeStart */, true /* changeCollection */,
+ [&type](const EventType& event) { return event.sensorType == type; });
ASSERT_EQ(activate(handle, 0), Result::OK);
ALOGI("Collected %zu samples", events.size());
@@ -233,24 +235,14 @@
ASSERT_GT(events.size(), 0u);
bool handleMismatchReported = false;
- bool metaSensorTypeErrorReported = false;
for (auto& e : events) {
- if (e.sensorType == type) {
- // avoid generating hundreds of error
- if (!handleMismatchReported) {
- EXPECT_EQ(e.sensorHandle, handle)
- << (handleMismatchReported = true,
- "Event of the same type must come from the sensor registered");
- }
- sensorEvents.push_back(e);
- } else {
- // avoid generating hundreds of error
- if (!metaSensorTypeErrorReported) {
- EXPECT_TRUE(isMetaSensorType(e.sensorType))
- << (metaSensorTypeErrorReported = true,
- "Only meta types are allowed besides the type registered");
- }
+ // avoid generating hundreds of error
+ if (!handleMismatchReported) {
+ EXPECT_EQ(e.sensorHandle, handle)
+ << (handleMismatchReported = true,
+ "Event of the same type must come from the sensor registered");
}
+ sensorEvents.push_back(e);
}
std::string s;
diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h
index 17a96ed..c061a75 100644
--- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h
+++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h
@@ -20,6 +20,7 @@
#include <gtest/gtest.h>
#include <atomic>
+#include <functional>
#include <memory>
#include <mutex>
#include <thread>
@@ -61,9 +62,16 @@
}
// set sensor event collection status
- void setCollection(bool enable) {
+ void setCollection(bool enable, const std::optional<std::function<bool(const Event&)>>& filter =
+ std::nullopt) {
std::lock_guard<std::mutex> lock(mEventsMutex);
mCollectionEnabled = enable;
+
+ if (enable && filter.has_value()) {
+ mEventFilter = *filter;
+ } else {
+ mEventFilter.reset();
+ }
}
void registerCallback(IEventCallback<Event>* callback) {
@@ -76,8 +84,10 @@
mCallback = nullptr;
}
- std::vector<Event> collectEvents(useconds_t timeLimitUs, size_t nEventLimit,
- bool clearBeforeStart = true, bool changeCollection = true) {
+ std::vector<Event> collectEvents(
+ useconds_t timeLimitUs, size_t nEventLimit, bool clearBeforeStart = true,
+ bool changeCollection = true,
+ const std::optional<std::function<bool(const Event&)>>& filter = std::nullopt) {
std::vector<Event> events;
constexpr useconds_t SLEEP_GRANULARITY = 100 * 1000; // granularity 100 ms
@@ -85,7 +95,7 @@
clearBeforeStart);
if (changeCollection) {
- setCollection(true);
+ setCollection(true, filter);
}
if (clearBeforeStart) {
catEvents(nullptr);
@@ -115,11 +125,13 @@
: mCollectionEnabled(false), mCallback(nullptr) {
mServiceName = service_name;
}
+ SensorsVtsEnvironmentBase(const SensorsVtsEnvironmentBase&) = delete;
+ SensorsVtsEnvironmentBase& operator=(const SensorsVtsEnvironmentBase&) = delete;
virtual ~SensorsVtsEnvironmentBase(){};
void addEvent(const Event& ev) {
std::lock_guard<std::mutex> lock(mEventsMutex);
- if (mCollectionEnabled) {
+ if (mCollectionEnabled && (!mEventFilter.has_value() || (*mEventFilter)(ev))) {
mEvents.push_back(ev);
}
@@ -136,11 +148,10 @@
std::atomic_bool mStopThread;
std::thread mPollThread;
std::vector<Event> mEvents;
+ std::optional<std::function<bool(const Event&)>> mEventFilter;
std::mutex mEventsMutex;
IEventCallback<Event>* mCallback;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SensorsVtsEnvironmentBase<Event>);
};
#endif // ANDROID_SENSORS_VTS_ENVIRONMENT_BASE_H
\ No newline at end of file
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl
index 637b01c..04cb099 100644
--- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl
@@ -37,4 +37,5 @@
String subType;
long groupId;
int dataLengthBytes;
+ const long NO_GROUP_ID = (-1) /* -1 */;
}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl
index 6df1f9a..88da538 100644
--- a/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl
+++ b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl
@@ -19,6 +19,10 @@
@VintfStability
parcelable TvMessage {
/**
+ * This value for TvMessage.groupId denotes that the message doesn't belong to any group.
+ */
+ const long NO_GROUP_ID = -1;
+ /**
* Extended data type, like “ATSC A/336 Watermark”, “ATSC_CC”, etc. This is opaque
* to the framework.
*/
diff --git a/tv/tuner/1.0/default/Dvr.cpp b/tv/tuner/1.0/default/Dvr.cpp
index 40879f2..9d6d86d 100644
--- a/tv/tuner/1.0/default/Dvr.cpp
+++ b/tv/tuner/1.0/default/Dvr.cpp
@@ -164,7 +164,7 @@
return false;
}
- mDvrMQ = move(tmpDvrMQ);
+ mDvrMQ = std::move(tmpDvrMQ);
if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != OK) {
return false;
diff --git a/tv/tuner/1.1/default/Dvr.cpp b/tv/tuner/1.1/default/Dvr.cpp
index fdb66c1..8262b4d 100644
--- a/tv/tuner/1.1/default/Dvr.cpp
+++ b/tv/tuner/1.1/default/Dvr.cpp
@@ -183,7 +183,7 @@
return false;
}
- mDvrMQ = move(tmpDvrMQ);
+ mDvrMQ = std::move(tmpDvrMQ);
if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != OK) {
return false;
diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp
index c9dd8ee..c046ae3 100644
--- a/tv/tuner/aidl/default/Dvr.cpp
+++ b/tv/tuner/aidl/default/Dvr.cpp
@@ -172,7 +172,7 @@
return false;
}
- mDvrMQ = move(tmpDvrMQ);
+ mDvrMQ = std::move(tmpDvrMQ);
if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != ::android::OK) {
return false;
diff --git a/usb/gadget/1.1/default/lib/MonitorFfs.cpp b/usb/gadget/1.1/default/lib/MonitorFfs.cpp
index 0cdf038..6d09a8a 100644
--- a/usb/gadget/1.1/default/lib/MonitorFfs.cpp
+++ b/usb/gadget/1.1/default/lib/MonitorFfs.cpp
@@ -59,9 +59,9 @@
if (addEpollFd(epollFd, eventFd) == -1) abort();
- mEpollFd = move(epollFd);
- mInotifyFd = move(inotifyFd);
- mEventFd = move(eventFd);
+ mEpollFd = std::move(epollFd);
+ mInotifyFd = std::move(inotifyFd);
+ mEventFd = std::move(eventFd);
gadgetPullup = false;
}
diff --git a/usb/gadget/1.2/default/lib/MonitorFfs.cpp b/usb/gadget/1.2/default/lib/MonitorFfs.cpp
index 0cdf038..6d09a8a 100644
--- a/usb/gadget/1.2/default/lib/MonitorFfs.cpp
+++ b/usb/gadget/1.2/default/lib/MonitorFfs.cpp
@@ -59,9 +59,9 @@
if (addEpollFd(epollFd, eventFd) == -1) abort();
- mEpollFd = move(epollFd);
- mInotifyFd = move(inotifyFd);
- mEventFd = move(eventFd);
+ mEpollFd = std::move(epollFd);
+ mInotifyFd = std::move(inotifyFd);
+ mEventFd = std::move(eventFd);
gadgetPullup = false;
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl
index dc2252b..d1f1256 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl
@@ -35,4 +35,5 @@
@Backing(type="int") @VintfStability
enum UwbVendorReasonCodes {
REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 128,
+ REASON_REGULATION_UWB_OFF = 129,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl
index ae203a3..a64a188 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl
@@ -24,11 +24,13 @@
@Backing(type="int")
enum UwbVendorReasonCodes {
/**
- * Use values from the vendor specific reason code range: 0x80 – 0xFF defined in Table 16 of
- * UCI specification.
+ * Use values from the vendor specific reason code range: 0x80 – 0xFF defined in
+ * Table 15 (state change with reason codes) of UCI specification.
*/
/** Fira specific */
/** The channel requested is not available for AoA */
REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 0x80,
+ /** UWB has been disabled (eg: country code change leads to UWB unsupported) */
+ REASON_REGULATION_UWB_OFF = 0x81,
}
diff --git a/vibrator/OWNERS b/vibrator/OWNERS
index 05e2e73..62a567e 100644
--- a/vibrator/OWNERS
+++ b/vibrator/OWNERS
@@ -2,7 +2,6 @@
include platform/frameworks/base:/services/core/java/com/android/server/vibrator/OWNERS
-chasewu@google.com
chrispaulo@google.com
michaelwr@google.com
nathankulczak@google.com
diff --git a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
index 7bcc6d3..37c55e7 100644
--- a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
+++ b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
@@ -68,17 +68,10 @@
virtual void TearDown() override { stopWifi(GetInstanceName()); }
- /* Used as a mechanism to inform the test about data/event callback */
- inline void notify() {
- std::unique_lock<std::mutex> lock(mtx_);
- count_++;
- cv_.notify_one();
- }
enum CallbackType {
- INVALID = -2,
ANY_CALLBACK = -1,
-
+ INVALID = 0,
NOTIFY_CAPABILITIES_RESPONSE = 0,
NOTIFY_ENABLE_RESPONSE,
NOTIFY_CONFIG_RESPONSE,
@@ -114,8 +107,14 @@
EVENT_DATA_PATH_CONFIRM_1_6,
};
+ /* Used as a mechanism to inform the test about data/event callback */
+ inline void notify(CallbackType callbackType) {
+ std::unique_lock<std::mutex> lock(mtx_);
+ callbackEventBitMap |= (0x1 << callbackType);
+ cv_.notify_one();
+ }
/* Test code calls this function to wait for data/event callback */
- /* Must set callbackType = INVALID before call this function */
+ /* Must set callbackEventBitMap = INVALID before call this function */
inline std::cv_status wait(CallbackType waitForCallbackType) {
std::unique_lock<std::mutex> lock(mtx_);
@@ -124,15 +123,11 @@
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
- while (count_ == 0) {
+ while (!(callbackEventBitMap & (0x1 << waitForCallbackType))) {
status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
- if (status == std::cv_status::timeout) return status;
- if (waitForCallbackType != ANY_CALLBACK && callbackType != INVALID &&
- callbackType != waitForCallbackType) {
- count_--;
- }
+ if (status == std::cv_status::timeout)
+ return status;
}
- count_--;
return status;
}
@@ -148,340 +143,276 @@
Return<void> notifyCapabilitiesResponse(
uint16_t id, const WifiNanStatus& status,
const ::android::hardware::wifi::V1_0::NanCapabilities& capabilities) override {
- parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.capabilities = capabilities;
- parent_.notify();
+ parent_.notify(NOTIFY_CAPABILITIES_RESPONSE);
return Void();
}
Return<void> notifyCapabilitiesResponse_1_5(
uint16_t id, const WifiNanStatus& status,
const ::android::hardware::wifi::V1_5::NanCapabilities& capabilities) override {
- parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_5;
-
parent_.id = id;
parent_.status = status;
parent_.capabilities_1_5 = capabilities;
- parent_.notify();
+ parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_5);
return Void();
}
Return<void> notifyEnableResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_ENABLE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_ENABLE_RESPONSE);
return Void();
}
Return<void> notifyConfigResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_CONFIG_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_CONFIG_RESPONSE);
return Void();
}
Return<void> notifyDisableResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_DISABLE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_DISABLE_RESPONSE);
return Void();
}
Return<void> notifyStartPublishResponse(uint16_t id, const WifiNanStatus& status,
uint8_t sessionId) override {
- parent_.callbackType = NOTIFY_START_PUBLISH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.sessionId = sessionId;
- parent_.notify();
+ parent_.notify(NOTIFY_START_PUBLISH_RESPONSE);
return Void();
}
Return<void> notifyStopPublishResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_STOP_PUBLISH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_STOP_PUBLISH_RESPONSE);
return Void();
}
Return<void> notifyStartSubscribeResponse(uint16_t id, const WifiNanStatus& status,
uint8_t sessionId) override {
- parent_.callbackType = NOTIFY_START_SUBSCRIBE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.sessionId = sessionId;
- parent_.notify();
+ parent_.notify(NOTIFY_START_SUBSCRIBE_RESPONSE);
return Void();
}
Return<void> notifyStopSubscribeResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_STOP_SUBSCRIBE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_STOP_SUBSCRIBE_RESPONSE);
return Void();
}
Return<void> notifyTransmitFollowupResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE);
return Void();
}
Return<void> notifyCreateDataInterfaceResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_CREATE_DATA_INTERFACE_RESPONSE);
return Void();
}
Return<void> notifyDeleteDataInterfaceResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_DELETE_DATA_INTERFACE_RESPONSE);
return Void();
}
Return<void> notifyInitiateDataPathResponse(uint16_t id, const WifiNanStatus& status,
uint32_t ndpInstanceId) override {
- parent_.callbackType = NOTIFY_INITIATE_DATA_PATH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.ndpInstanceId = ndpInstanceId;
- parent_.notify();
+ parent_.notify(NOTIFY_INITIATE_DATA_PATH_RESPONSE);
return Void();
}
Return<void> notifyRespondToDataPathIndicationResponse(
uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE);
return Void();
}
Return<void> notifyTerminateDataPathResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_TERMINATE_DATA_PATH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_TERMINATE_DATA_PATH_RESPONSE);
return Void();
}
Return<void> eventClusterEvent(const NanClusterEventInd& event) override {
- parent_.callbackType = EVENT_CLUSTER_EVENT;
-
parent_.nanClusterEventInd = event;
- parent_.notify();
+ parent_.notify(EVENT_CLUSTER_EVENT);
return Void();
}
Return<void> eventDisabled(const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_DISABLED;
-
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_DISABLED);
return Void();
}
Return<void> eventPublishTerminated(uint8_t sessionId,
const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_PUBLISH_TERMINATED;
-
parent_.sessionId = sessionId;
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_PUBLISH_TERMINATED);
return Void();
}
Return<void> eventSubscribeTerminated(uint8_t sessionId,
const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_SUBSCRIBE_TERMINATED;
-
parent_.sessionId = sessionId;
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_SUBSCRIBE_TERMINATED);
return Void();
}
Return<void> eventMatch(
const ::android::hardware::wifi::V1_0::NanMatchInd& event) override {
- parent_.callbackType = EVENT_MATCH;
-
parent_.nanMatchInd = event;
- parent_.notify();
+ parent_.notify(EVENT_MATCH);
return Void();
}
Return<void> eventMatchExpired(uint8_t discoverySessionId, uint32_t peerId) override {
- parent_.callbackType = EVENT_MATCH_EXPIRED;
-
parent_.sessionId = discoverySessionId;
parent_.peerId = peerId;
- parent_.notify();
+ parent_.notify(EVENT_MATCH_EXPIRED);
return Void();
}
Return<void> eventFollowupReceived(const NanFollowupReceivedInd& event) override {
- parent_.callbackType = EVENT_FOLLOWUP_RECEIVED;
-
parent_.nanFollowupReceivedInd = event;
- parent_.notify();
+ parent_.notify(EVENT_FOLLOWUP_RECEIVED);
return Void();
}
Return<void> eventTransmitFollowup(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_TRANSMIT_FOLLOWUP;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_TRANSMIT_FOLLOWUP);
return Void();
}
Return<void> eventDataPathRequest(const NanDataPathRequestInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_REQUEST;
-
parent_.nanDataPathRequestInd = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_REQUEST);
return Void();
}
Return<void> eventDataPathConfirm(
const ::android::hardware::wifi::V1_0::NanDataPathConfirmInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_CONFIRM;
-
parent_.nanDataPathConfirmInd = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_CONFIRM);
return Void();
}
Return<void> eventDataPathTerminated(uint32_t ndpInstanceId) override {
- parent_.callbackType = EVENT_DATA_PATH_TERMINATED;
-
parent_.ndpInstanceId = ndpInstanceId;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_TERMINATED);
return Void();
}
Return<void> eventDataPathConfirm_1_2(
const ::android::hardware::wifi::V1_2::NanDataPathConfirmInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_2;
-
parent_.nanDataPathConfirmInd_1_2 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_CONFIRM_1_2);
return Void();
}
Return<void> eventDataPathScheduleUpdate(
const ::android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd& event)
override {
- parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE;
-
parent_.nanDataPathScheduleUpdateInd_1_2 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE);
return Void();
}
Return<void> eventMatch_1_6(
const ::android::hardware::wifi::V1_6::NanMatchInd& event) override {
- parent_.callbackType = EVENT_MATCH_1_6;
-
parent_.nanMatchInd_1_6 = event;
- parent_.notify();
+ parent_.notify(EVENT_MATCH_1_6);
return Void();
}
Return<void> notifyCapabilitiesResponse_1_6(
uint16_t id, const WifiNanStatus& status,
const ::android::hardware::wifi::V1_6::NanCapabilities& capabilities) override {
- parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_6;
-
parent_.id = id;
parent_.status = status;
parent_.capabilities_1_6 = capabilities;
- parent_.notify();
+ parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_6);
return Void();
}
Return<void> eventDataPathScheduleUpdate_1_6(
const ::android::hardware::wifi::V1_6::NanDataPathScheduleUpdateInd& event)
override {
- parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6;
-
parent_.nanDataPathScheduleUpdateInd_1_6 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6);
return Void();
}
Return<void> eventDataPathConfirm_1_6(
const ::android::hardware::wifi::V1_6::NanDataPathConfirmInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_6;
-
parent_.nanDataPathConfirmInd_1_6 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_CONFIRM_1_6);
return Void();
}
};
@@ -490,7 +421,6 @@
// synchronization objects
std::mutex mtx_;
std::condition_variable cv_;
- int count_ = 0;
protected:
android::sp<::android::hardware::wifi::V1_6::IWifiNanIface> iwifiNanIface;
@@ -498,7 +428,7 @@
// Data from IWifiNanIfaceEventCallback callbacks: this is the collection of
// all arguments to all callbacks. They are set by the callback
// (notifications or events) and can be retrieved by tests.
- CallbackType callbackType;
+ uint32_t callbackEventBitMap;
uint16_t id;
WifiNanStatus status;
uint8_t sessionId;
@@ -535,7 +465,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, enableRequest_1_6InvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_4::NanEnableRequest nanEnableRequest = {};
::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {};
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId,
@@ -545,7 +475,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE));
- ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
}
@@ -572,7 +502,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, configRequest_1_6InvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {};
::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {};
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, configRequest_1_6, inputCmdId,
@@ -583,7 +513,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE));
- ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_CONFIG_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_CONFIG_RESPONSE));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
}
@@ -610,12 +540,12 @@
*/
TEST_P(WifiNanIfaceHidlTest, notifyCapabilitiesResponse_1_6) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest_1_5, inputCmdId).code;
ASSERT_EQ(WifiStatusCode::SUCCESS, halStatus);
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE_1_6));
- ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackEventBitMap & (0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::SUCCESS);
@@ -711,7 +641,7 @@
nanConfigRequestSupp.V1_5.V1_2.numberOfSpatialStreamsInDiscovery = 0;
nanConfigRequestSupp.V1_5.V1_2.enableDiscoveryWindowEarlyTermination = false;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
const auto& halStatus =
HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId, req, nanConfigRequestSupp);
@@ -720,7 +650,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE));
- ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::SUCCESS);
}
@@ -749,7 +679,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_START_PUBLISH_RESPONSE));
- ASSERT_EQ(NOTIFY_START_PUBLISH_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_START_PUBLISH_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_START_PUBLISH_RESPONSE));
ASSERT_EQ(id, inputCmdId + 1);
ASSERT_EQ(status.status, NanStatusType::SUCCESS);
}
@@ -760,7 +690,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, respondToDataPathIndicationRequest_1_6ShimInvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_6::NanRespondToDataPathIndicationRequest
nanRespondToDataPathIndicationRequest = {};
nanRespondToDataPathIndicationRequest.ifaceName = "AwareinterfaceNameTooLong";
@@ -777,7 +707,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, initiateDataPathRequest_1_6ShimInvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_6::NanInitiateDataPathRequest nanInitiateDataPathRequest = {};
nanInitiateDataPathRequest.ifaceName = "AwareinterfaceNameTooLong";
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, initiateDataPathRequest_1_6, inputCmdId,
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 2ff6896..23f4030 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
@@ -47,7 +47,7 @@
@PropagateAllowBlocking android.hardware.wifi.IWifiApIface getApIface(in String ifname);
String[] getApIfaceNames();
android.hardware.wifi.IWifiChip.ChipMode[] getAvailableModes();
- android.hardware.wifi.IWifiChip.ChipCapabilityMask getCapabilities();
+ int getCapabilities();
android.hardware.wifi.WifiDebugHostWakeReasonStats getDebugHostWakeReasonStats();
android.hardware.wifi.WifiDebugRingBufferStatus[] getDebugRingBuffersStatus();
int getId();
@@ -60,7 +60,7 @@
String[] getStaIfaceNames();
android.hardware.wifi.WifiRadioCombination[] getSupportedRadioCombinations();
android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities();
- android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask);
+ android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in int ifaceModeMask, in int filterMask);
void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo);
void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback);
void removeApIface(in String ifname);
@@ -73,7 +73,7 @@
byte[] requestFirmwareDebugDump();
void resetTxPowerScenario();
void selectTxPowerScenario(in android.hardware.wifi.IWifiChip.TxPowerScenario scenario);
- void setCoexUnsafeChannels(in android.hardware.wifi.IWifiChip.CoexUnsafeChannel[] unsafeChannels, in android.hardware.wifi.IWifiChip.CoexRestriction restrictions);
+ void setCoexUnsafeChannels(in android.hardware.wifi.IWifiChip.CoexUnsafeChannel[] unsafeChannels, in int restrictions);
void setCountryCode(in byte[2] code);
void setLatencyMode(in android.hardware.wifi.IWifiChip.LatencyMode mode);
void setMultiStaPrimaryConnection(in String ifName);
@@ -81,7 +81,7 @@
void startLoggingToDebugRingBuffer(in String ringName, in android.hardware.wifi.WifiDebugRingBufferVerboseLevel verboseLevel, in int maxIntervalInSec, in int minDataSizeInBytes);
void stopLoggingToDebugRingBuffer();
void triggerSubsystemRestart();
- void enableStaChannelForPeerNetwork(in android.hardware.wifi.IWifiChip.ChannelCategoryMask channelCategoryEnableFlag);
+ void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag);
void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode);
const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF;
@Backing(type="int") @VintfStability
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl
index 31b6881..a7f2081 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl
@@ -41,7 +41,7 @@
void enableNdOffload(in boolean enable);
android.hardware.wifi.StaApfPacketFilterCapabilities getApfPacketFilterCapabilities();
android.hardware.wifi.StaBackgroundScanCapabilities getBackgroundScanCapabilities();
- android.hardware.wifi.IWifiStaIface.StaIfaceCapabilityMask getCapabilities();
+ int getCapabilities();
android.hardware.wifi.WifiDebugRxPacketFateReport[] getDebugRxPacketFates();
android.hardware.wifi.WifiDebugTxPacketFateReport[] getDebugTxPacketFates();
byte[6] getFactoryMacAddress();
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl
index bb44679..a30893a 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl
@@ -47,7 +47,7 @@
int maxAppInfoLen;
int maxQueuedTransmitFollowupMsgs;
int maxSubscribeInterfaceAddresses;
- android.hardware.wifi.NanCipherSuiteType supportedCipherSuites;
+ int supportedCipherSuites;
boolean instantCommunicationModeSupportFlag;
boolean supports6g;
boolean supportsHe;
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl
index e84cabf..96d940a 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl
@@ -51,7 +51,7 @@
android.hardware.wifi.NanDataPathSecurityConfig securityConfig;
boolean rangingRequired;
int rangingIntervalMs;
- android.hardware.wifi.NanRangingIndication configRangingIndications;
+ int configRangingIndications;
char distanceIngressCm;
char distanceEgressCm;
boolean enableSessionSuspendability;
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl
index 6757bec..317489f 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl
@@ -47,7 +47,7 @@
boolean peerRequiresSecurityEnabledInNdp;
boolean peerRequiresRanging;
int rangingMeasurementInMm;
- android.hardware.wifi.NanRangingIndication rangingIndicationType;
+ int rangingIndicationType;
byte[] scid;
android.hardware.wifi.NanPairingConfig peerPairingConfig;
android.hardware.wifi.NanIdentityResolutionAttribute peerNira;
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl
index b49d406..4e9671a 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl
@@ -38,7 +38,7 @@
android.hardware.wifi.WifiBand band;
int[] frequencies;
int periodInMs;
- android.hardware.wifi.StaBackgroundScanBucketEventReportSchemeMask eventReportScheme;
+ int eventReportScheme;
int exponentialMaxPeriodInMs;
int exponentialBase;
int exponentialStepCount;
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl
index 5903760..7c75232 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl
@@ -34,7 +34,7 @@
package android.hardware.wifi;
@VintfStability
parcelable StaScanData {
- android.hardware.wifi.StaScanDataFlagMask flags;
+ int flags;
int bucketsScanned;
android.hardware.wifi.StaScanResult[] results;
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl
index 94e3a8a..774b242 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl
@@ -36,5 +36,5 @@
parcelable WifiUsableChannel {
int channel;
android.hardware.wifi.WifiChannelWidthInMhz channelBandwidth;
- android.hardware.wifi.WifiIfaceMode ifaceModeMask;
+ int ifaceModeMask;
}
diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
index c0e41cd..1710f63 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
@@ -590,7 +590,7 @@
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
- ChipCapabilityMask getCapabilities();
+ int getCapabilities();
/**
* API to retrieve the wifi wake up reason stats for debugging.
@@ -808,7 +808,7 @@
* |WifiStatusCode.FAILURE_UNKNOWN|
*/
WifiUsableChannel[] getUsableChannels(
- in WifiBand band, in WifiIfaceMode ifaceModeMask, in UsableChannelFilter filterMask);
+ in WifiBand band, in int ifaceModeMask, in int filterMask);
/*
* Set the max power level the chip is allowed to transmit on for 6Ghz AFC
@@ -982,8 +982,7 @@
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
*/
- void setCoexUnsafeChannels(
- in CoexUnsafeChannel[] unsafeChannels, in CoexRestriction restrictions);
+ void setCoexUnsafeChannels(in CoexUnsafeChannel[] unsafeChannels, in int restrictions);
/**
* Set country code for this Wifi chip.
@@ -1110,14 +1109,14 @@
* If the channel category is enabled and allowed by the regulatory, the HAL method
* getUsableChannels() will contain the current STA-connected channel if that channel belongs
* to that category.
- * @param channelCategoryEnableFlag bitmask of |ChannelCategoryMask|.
+ * @param channelCategoryEnableFlag Bitmask of |ChannelCategoryMask| values.
* For each bit, 1 enables the channel category and 0 disables that channel category.
* @throws ServiceSpecificException with one of the following values:
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.FAILURE_UNKNOWN|
*/
- void enableStaChannelForPeerNetwork(in ChannelCategoryMask channelCategoryEnableFlag);
+ void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag);
/**
* Multi-Link Operation modes.
diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl
index 28d6a4d..8e9a06d 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl
@@ -198,7 +198,7 @@
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
- StaIfaceCapabilityMask getCapabilities();
+ int getCapabilities();
/**
* API to retrieve the fates of inbound packets.
diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
index 4836612..4b74cd9 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
@@ -37,7 +37,7 @@
byte[6] peerDiscMacAddr;
/**
- * Bootstrapping method in the request, one of the |NanBootstrappingMethod|
+ * One of |NanBootstrappingMethod| indicating the bootstrapping method in the request.
*/
NanBootstrappingMethod requestBootstrappingMethod;
diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl
index 9094579..6f43892 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl
@@ -48,7 +48,7 @@
int bootstrappingInstanceId;
/**
- * Bootstrapping method in the incoming request, one of the |NanBootstrappingMethod|
+ * One of |NanBootstrappingMethod| indicating the bootstrapping method in the incoming request.
*/
NanBootstrappingMethod requestBootstrappingMethod;
}
diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl
index c1d6201..f581c5e 100644
--- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl
@@ -16,8 +16,6 @@
package android.hardware.wifi;
-import android.hardware.wifi.NanCipherSuiteType;
-
/**
* NDP Capabilities response.
*/
@@ -78,9 +76,9 @@
*/
int maxSubscribeInterfaceAddresses;
/**
- * The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used.
+ * Bitmap of |NanCipherSuiteType| values indicating the set of supported cipher suites.
*/
- NanCipherSuiteType supportedCipherSuites;
+ int supportedCipherSuites;
/**
* Flag to indicate if instant communication mode is supported.
*/
diff --git a/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl
index 42a5616..9a2013b 100644
--- a/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl
@@ -31,7 +31,8 @@
*/
NanDataPathSecurityType securityType;
/**
- * Cipher type for data-paths. If |securityType| is |NanDataPathSecurityType.OPEN| then must
+ * One of |NanCipherSuiteType| indicating the cipher type for data-paths.
+ * If |securityType| is |NanDataPathSecurityType.OPEN|, then this must
* be set to |NanCipherSuiteType.NONE|. Otherwise a non-|NanCipherSuiteType.NONE| cipher suite
* must be specified.
*/
diff --git a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl
index e98658b..58777c5 100644
--- a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl
@@ -18,7 +18,6 @@
import android.hardware.wifi.NanDataPathSecurityConfig;
import android.hardware.wifi.NanMatchAlg;
-import android.hardware.wifi.NanRangingIndication;
/**
* Configurations of NAN discovery sessions. Common to publish and subscribe discovery.
@@ -143,10 +142,11 @@
*/
int rangingIntervalMs;
/**
- * The type of ranging feedback to be provided by discovery session matches
- * |IWifiNanIfaceEventCallback.eventMatch|. Only relevant if |rangingRequired| is true.
+ * Bitmap of |NanRangingIndication| values indicating the type of ranging feedback
+ * to be provided by discovery session matches in |IWifiNanIfaceEventCallback.eventMatch|.
+ * Only relevant if |rangingRequired| is true.
*/
- NanRangingIndication configRangingIndications;
+ int configRangingIndications;
/**
* The ingress and egress distance in cm. If ranging is enabled (|rangingEnabled| is true) then
* |configRangingIndications| is used to determine whether ingress and/or egress (or neither)
diff --git a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl
index 314d599..5a04376 100644
--- a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl
@@ -19,7 +19,6 @@
import android.hardware.wifi.NanCipherSuiteType;
import android.hardware.wifi.NanIdentityResolutionAttribute;
import android.hardware.wifi.NanPairingConfig;
-import android.hardware.wifi.NanRangingIndication;
/**
* Match indication structure.
@@ -81,8 +80,9 @@
*/
byte rssiValue;
/**
- * Cipher type for data-paths constructed in the context of this discovery session. Valid if
- * |peerRequiresSecurityEnabledInNdp| is true.
+ * One of |NanCipherSuiteType| indicating the cipher type for data-paths constructed
+ * in the context of this discovery session.
+ * Valid if |peerRequiresSecurityEnabledInNdp| is true.
*/
NanCipherSuiteType peerCipherType;
/**
@@ -117,10 +117,11 @@
*/
int rangingMeasurementInMm;
/**
- * The ranging event(s) which triggered the ranging. e.g. can indicate that continuous ranging
- * was requested, or else that an ingress event occurred.
+ * Bitmap of |NanRangingIndication| values indicating the ranging event(s) which triggered the
+ * ranging. e.g. can indicate that continuous ranging was requested, or else that an ingress
+ * event occurred.
*/
- NanRangingIndication rangingIndicationType;
+ int rangingIndicationType;
/**
* Security Context Identifier attribute contains PMKID. Shall be included in NDP setup and
* response messages. Security Context Identifier identifies the Security Context. For NAN
diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl
index 20122e2..609dac2 100644
--- a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl
@@ -34,7 +34,8 @@
*/
boolean enablePairingVerification;
/**
- * The set of supported bootstrapping methods. The |NanBootstrappingMethod| bit fields are used.
+ * Bitmap of |NanBootstrappingMethod| values indicating the set of
+ * supported bootstrapping methods.
*/
int supportedBootstrappingMethods;
}
diff --git a/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl
index 7384e1a..a601751 100644
--- a/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl
@@ -49,8 +49,8 @@
*/
NanPairingAkm akm;
/**
- * Cipher type for pairing. Need to be one of the |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK|
- * or |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK|
+ * Cipher type for pairing. Must be one of |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK|
+ * or |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK|.
*/
NanCipherSuiteType cipherType;
}
diff --git a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl
index 6d85eea..4d65a41 100644
--- a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl
+++ b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl
@@ -41,8 +41,8 @@
*/
NanPairingAkm akm;
/**
- * Cipher type for pairing. Need to one of the |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| or
- * |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK|
+ * Cipher type for pairing. Must be one of |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| or
+ * |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK|.
*/
NanCipherSuiteType cipherType;
}
diff --git a/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl b/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl
index 7bd87b2..76b510d 100644
--- a/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl
+++ b/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl
@@ -16,7 +16,6 @@
package android.hardware.wifi;
-import android.hardware.wifi.StaBackgroundScanBucketEventReportSchemeMask;
import android.hardware.wifi.WifiBand;
/**
@@ -50,7 +49,7 @@
* Bitset of |StaBackgroundScanBucketEventReportSchemeMask| values controlling
* when events for this bucket must be reported.
*/
- StaBackgroundScanBucketEventReportSchemeMask eventReportScheme;
+ int eventReportScheme;
/**
* For exponential back off. If |exponentialMaxPeriodInMs| is non-zero or
* different than period, then this bucket is an exponential backoff bucket
diff --git a/wifi/aidl/android/hardware/wifi/StaScanData.aidl b/wifi/aidl/android/hardware/wifi/StaScanData.aidl
index 9d6bd53..abc5638 100644
--- a/wifi/aidl/android/hardware/wifi/StaScanData.aidl
+++ b/wifi/aidl/android/hardware/wifi/StaScanData.aidl
@@ -16,7 +16,6 @@
package android.hardware.wifi;
-import android.hardware.wifi.StaScanDataFlagMask;
import android.hardware.wifi.StaScanResult;
/**
@@ -26,9 +25,9 @@
@VintfStability
parcelable StaScanData {
/**
- * Bitset containing |ScanDataFlagMask| values.
+ * Bitset of |ScanDataFlagMask| values.
*/
- StaScanDataFlagMask flags;
+ int flags;
/**
* Bitset where each bit indicates if the bucket with that index (starting at
* 0) was scanned.
diff --git a/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl b/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl
index d92e4cc..077c17e 100644
--- a/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl
+++ b/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl
@@ -17,7 +17,6 @@
package android.hardware.wifi;
import android.hardware.wifi.WifiChannelWidthInMhz;
-import android.hardware.wifi.WifiIfaceMode;
/**
* Wifi usable channel information.
@@ -33,7 +32,8 @@
*/
WifiChannelWidthInMhz channelBandwidth;
/**
- * Iface modes feasible on this channel.
+ * Iface modes feasible on this channel, represented as a bitmask
+ * of |WifiIfaceMode| values.
*/
- WifiIfaceMode ifaceModeMask;
+ int ifaceModeMask;
}
diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp
index 5bfdcbb..4acdd2f 100644
--- a/wifi/aidl/default/aidl_struct_util.cpp
+++ b/wifi/aidl/default/aidl_struct_util.cpp
@@ -408,8 +408,8 @@
aidl_usable_channel->channel = legacy_usable_channel.freq;
aidl_usable_channel->channelBandwidth =
convertLegacyWifiChannelWidthToAidl(legacy_usable_channel.width);
- aidl_usable_channel->ifaceModeMask = static_cast<WifiIfaceMode>(
- convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask));
+ aidl_usable_channel->ifaceModeMask =
+ convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask);
return true;
}
@@ -572,7 +572,7 @@
legacy_bucket_spec.report_events = 0;
using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask;
for (const auto flag : {AidlFlag::EACH_SCAN, AidlFlag::FULL_RESULTS, AidlFlag::NO_BATCH}) {
- if (static_cast<int32_t>(aidl_bucket_spec.eventReportScheme) &
+ if (aidl_bucket_spec.eventReportScheme &
static_cast<std::underlying_type<AidlFlag>::type>(flag)) {
legacy_bucket_spec.report_events |= convertAidlGscanReportEventFlagToLegacy(flag);
}
@@ -678,7 +678,7 @@
convertLegacyGscanDataFlagToAidl(flag));
}
}
- aidl_scan_data->flags = static_cast<StaScanDataFlagMask>(flags);
+ aidl_scan_data->flags = flags;
aidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned;
CHECK(legacy_cached_scan_result.num_results >= 0 &&
@@ -1787,7 +1787,7 @@
: legacy_hal::NAN_RANGING_DISABLE;
legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs;
legacy_request->ranging_cfg.config_ranging_indications =
- static_cast<uint32_t>(aidl_request.baseConfigs.configRangingIndications);
+ aidl_request.baseConfigs.configRangingIndications;
legacy_request->ranging_cfg.distance_ingress_mm =
aidl_request.baseConfigs.distanceIngressCm * 10;
legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10;
@@ -1919,7 +1919,7 @@
: legacy_hal::NAN_RANGING_DISABLE;
legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs;
legacy_request->ranging_cfg.config_ranging_indications =
- static_cast<uint32_t>(aidl_request.baseConfigs.configRangingIndications);
+ aidl_request.baseConfigs.configRangingIndications;
legacy_request->ranging_cfg.distance_ingress_mm =
aidl_request.baseConfigs.distanceIngressCm * 10;
legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10;
@@ -2202,8 +2202,7 @@
aidl_response->maxQueuedTransmitFollowupMsgs =
legacy_response.max_queued_transmit_followup_msgs;
aidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address;
- aidl_response->supportedCipherSuites =
- static_cast<NanCipherSuiteType>(legacy_response.cipher_suites_supported);
+ aidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported;
aidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported;
aidl_response->supports6g = legacy_response.is_6g_supported;
aidl_response->supportsHe = legacy_response.is_he_supported;
@@ -2244,8 +2243,7 @@
aidl_ind->peerRequiresRanging =
legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE;
aidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm;
- aidl_ind->rangingIndicationType =
- static_cast<NanRangingIndication>(legacy_ind.range_info.ranging_event_type);
+ aidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type;
aidl_ind->scid = std::vector<uint8_t>(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len);
if (!convertLegacyNiraToAidl(legacy_ind.nira, &aidl_ind->peerNira)) {
diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h
index 3da94dc..9a13672 100644
--- a/wifi/aidl/default/aidl_struct_util.h
+++ b/wifi/aidl/default/aidl_struct_util.h
@@ -20,7 +20,10 @@
#include <aidl/android/hardware/wifi/IWifiChip.h>
#include <aidl/android/hardware/wifi/IWifiChipEventCallback.h>
#include <aidl/android/hardware/wifi/NanBandIndex.h>
+#include <aidl/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.h>
+#include <aidl/android/hardware/wifi/StaScanDataFlagMask.h>
#include <aidl/android/hardware/wifi/WifiDebugRingBufferFlags.h>
+#include <aidl/android/hardware/wifi/WifiIfaceMode.h>
#include <vector>
diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp
index 89edaa4..dd24e6b 100644
--- a/wifi/aidl/default/wifi_chip.cpp
+++ b/wifi/aidl/default/wifi_chip.cpp
@@ -455,7 +455,7 @@
&WifiChip::registerEventCallbackInternal, event_callback);
}
-ndk::ScopedAStatus WifiChip::getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) {
+ndk::ScopedAStatus WifiChip::getCapabilities(int32_t* _aidl_return) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
&WifiChip::getCapabilitiesInternal, _aidl_return);
}
@@ -681,7 +681,7 @@
ndk::ScopedAStatus WifiChip::setCoexUnsafeChannels(
const std::vector<IWifiChip::CoexUnsafeChannel>& in_unsafeChannels,
- CoexRestriction in_restrictions) {
+ int32_t in_restrictions) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
&WifiChip::setCoexUnsafeChannelsInternal, in_unsafeChannels,
in_restrictions);
@@ -692,8 +692,8 @@
&WifiChip::setCountryCodeInternal, in_code);
}
-ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask,
- UsableChannelFilter in_filterMask,
+ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, int32_t in_ifaceModeMask,
+ int32_t in_filterMask,
std::vector<WifiUsableChannel>* _aidl_return) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
&WifiChip::getUsableChannelsInternal, _aidl_return, in_band,
@@ -722,8 +722,7 @@
&WifiChip::getWifiChipCapabilitiesInternal, _aidl_return);
}
-ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork(
- ChannelCategoryMask in_channelCategoryEnableFlag) {
+ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork(int32_t in_channelCategoryEnableFlag) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
&WifiChip::enableStaChannelForPeerNetworkInternal,
in_channelCategoryEnableFlag);
@@ -787,7 +786,7 @@
return ndk::ScopedAStatus::ok();
}
-std::pair<IWifiChip::ChipCapabilityMask, ndk::ScopedAStatus> WifiChip::getCapabilitiesInternal() {
+std::pair<int32_t, ndk::ScopedAStatus> WifiChip::getCapabilitiesInternal() {
legacy_hal::wifi_error legacy_status;
uint64_t legacy_feature_set;
uint32_t legacy_logger_feature_set;
@@ -795,7 +794,7 @@
std::tie(legacy_status, legacy_feature_set) =
legacy_hal_.lock()->getSupportedFeatureSet(ifname);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
- return {IWifiChip::ChipCapabilityMask{}, createWifiStatusFromLegacyError(legacy_status)};
+ return {0, createWifiStatusFromLegacyError(legacy_status)};
}
std::tie(legacy_status, legacy_logger_feature_set) =
legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname);
@@ -806,9 +805,9 @@
uint32_t aidl_caps;
if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities(legacy_feature_set,
&aidl_caps)) {
- return {IWifiChip::ChipCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
+ return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
}
- return {static_cast<IWifiChip::ChipCapabilityMask>(aidl_caps), ndk::ScopedAStatus::ok()};
+ return {aidl_caps, ndk::ScopedAStatus::ok()};
}
std::pair<std::vector<IWifiChip::ChipMode>, ndk::ScopedAStatus>
@@ -1385,13 +1384,12 @@
}
ndk::ScopedAStatus WifiChip::setCoexUnsafeChannelsInternal(
- std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels, CoexRestriction restrictions) {
+ std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels, int32_t aidl_restrictions) {
std::vector<legacy_hal::wifi_coex_unsafe_channel> legacy_unsafe_channels;
if (!aidl_struct_util::convertAidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels,
&legacy_unsafe_channels)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
- uint32_t aidl_restrictions = static_cast<uint32_t>(restrictions);
uint32_t legacy_restrictions = 0;
if (aidl_restrictions & static_cast<uint32_t>(CoexRestriction::WIFI_DIRECT)) {
legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT;
@@ -1413,15 +1411,13 @@
}
std::pair<std::vector<WifiUsableChannel>, ndk::ScopedAStatus> WifiChip::getUsableChannelsInternal(
- WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask) {
+ WifiBand band, int32_t ifaceModeMask, int32_t filterMask) {
legacy_hal::wifi_error legacy_status;
std::vector<legacy_hal::wifi_usable_channel> legacy_usable_channels;
std::tie(legacy_status, legacy_usable_channels) = legacy_hal_.lock()->getUsableChannels(
aidl_struct_util::convertAidlWifiBandToLegacyMacBand(band),
- aidl_struct_util::convertAidlWifiIfaceModeToLegacy(
- static_cast<uint32_t>(ifaceModeMask)),
- aidl_struct_util::convertAidlUsableChannelFilterToLegacy(
- static_cast<uint32_t>(filterMask)));
+ aidl_struct_util::convertAidlWifiIfaceModeToLegacy(ifaceModeMask),
+ aidl_struct_util::convertAidlUsableChannelFilterToLegacy(filterMask));
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
return {std::vector<WifiUsableChannel>(), createWifiStatusFromLegacyError(legacy_status)};
@@ -1483,10 +1479,9 @@
}
ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetworkInternal(
- ChannelCategoryMask channelCategoryEnableFlag) {
+ int32_t channelCategoryEnableFlag) {
auto legacy_status = legacy_hal_.lock()->enableStaChannelForPeerNetwork(
- aidl_struct_util::convertAidlChannelCategoryToLegacy(
- static_cast<uint32_t>(channelCategoryEnableFlag)));
+ aidl_struct_util::convertAidlChannelCategoryToLegacy(channelCategoryEnableFlag));
return createWifiStatusFromLegacyError(legacy_status);
}
diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h
index eca68ed..c5dcee7 100644
--- a/wifi/aidl/default/wifi_chip.h
+++ b/wifi/aidl/default/wifi_chip.h
@@ -85,7 +85,7 @@
ndk::ScopedAStatus getId(int32_t* _aidl_return) override;
ndk::ScopedAStatus registerEventCallback(
const std::shared_ptr<IWifiChipEventCallback>& in_callback) override;
- ndk::ScopedAStatus getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) override;
+ ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
ndk::ScopedAStatus getAvailableModes(std::vector<IWifiChip::ChipMode>* _aidl_return) override;
ndk::ScopedAStatus configureChip(int32_t in_modeId) override;
ndk::ScopedAStatus getMode(int32_t* _aidl_return) override;
@@ -136,10 +136,10 @@
ndk::ScopedAStatus setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) override;
ndk::ScopedAStatus setCoexUnsafeChannels(
const std::vector<IWifiChip::CoexUnsafeChannel>& in_unsafeChannels,
- CoexRestriction in_restrictions) override;
+ int32_t in_restrictions) override;
ndk::ScopedAStatus setCountryCode(const std::array<uint8_t, 2>& in_code) override;
- ndk::ScopedAStatus getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask,
- UsableChannelFilter in_filterMask,
+ ndk::ScopedAStatus getUsableChannels(WifiBand in_band, int32_t in_ifaceModeMask,
+ int32_t in_filterMask,
std::vector<WifiUsableChannel>* _aidl_return) override;
ndk::ScopedAStatus setAfcChannelAllowance(
const std::vector<AvailableAfcFrequencyInfo>& availableAfcFrequencyInfo) override;
@@ -148,7 +148,7 @@
std::vector<WifiRadioCombination>* _aidl_return) override;
ndk::ScopedAStatus getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) override;
ndk::ScopedAStatus enableStaChannelForPeerNetwork(
- ChannelCategoryMask in_channelCategoryEnableFlag) override;
+ int32_t in_channelCategoryEnableFlag) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
ndk::ScopedAStatus setMloMode(const ChipMloMode in_mode) override;
@@ -162,7 +162,7 @@
std::pair<int32_t, ndk::ScopedAStatus> getIdInternal();
ndk::ScopedAStatus registerEventCallbackInternal(
const std::shared_ptr<IWifiChipEventCallback>& event_callback);
- std::pair<IWifiChip::ChipCapabilityMask, ndk::ScopedAStatus> getCapabilitiesInternal();
+ std::pair<int32_t, ndk::ScopedAStatus> getCapabilitiesInternal();
std::pair<std::vector<IWifiChip::ChipMode>, ndk::ScopedAStatus> getAvailableModesInternal();
ndk::ScopedAStatus configureChipInternal(std::unique_lock<std::recursive_mutex>* lock,
int32_t mode_id);
@@ -214,13 +214,11 @@
ndk::ScopedAStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname);
ndk::ScopedAStatus setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case);
ndk::ScopedAStatus setCoexUnsafeChannelsInternal(
- std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels,
- CoexRestriction restrictions);
+ std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels, int32_t restrictions);
ndk::ScopedAStatus setCountryCodeInternal(const std::array<uint8_t, 2>& in_code);
std::pair<std::vector<WifiUsableChannel>, ndk::ScopedAStatus> getUsableChannelsInternal(
- WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask);
- ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal(
- ChannelCategoryMask channelCategoryEnableFlag);
+ WifiBand band, int32_t ifaceModeMask, int32_t filterMask);
+ ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal(int32_t channelCategoryEnableFlag);
ndk::ScopedAStatus setAfcChannelAllowanceInternal(
const std::vector<AvailableAfcFrequencyInfo>& availableAfcFrequencyInfo);
ndk::ScopedAStatus handleChipConfiguration(std::unique_lock<std::recursive_mutex>* lock,
diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp
index 300316a..eceeeb5 100644
--- a/wifi/aidl/default/wifi_sta_iface.cpp
+++ b/wifi/aidl/default/wifi_sta_iface.cpp
@@ -82,8 +82,7 @@
&WifiStaIface::registerEventCallbackInternal, in_callback);
}
-ndk::ScopedAStatus WifiStaIface::getCapabilities(
- IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) {
+ndk::ScopedAStatus WifiStaIface::getCapabilities(int32_t* _aidl_return) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiStaIface::getCapabilitiesInternal, _aidl_return);
}
@@ -239,24 +238,20 @@
return ndk::ScopedAStatus::ok();
}
-std::pair<IWifiStaIface::StaIfaceCapabilityMask, ndk::ScopedAStatus>
-WifiStaIface::getCapabilitiesInternal() {
+std::pair<int32_t, ndk::ScopedAStatus> WifiStaIface::getCapabilitiesInternal() {
legacy_hal::wifi_error legacy_status;
uint64_t legacy_feature_set;
std::tie(legacy_status, legacy_feature_set) =
legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
- return {IWifiStaIface::StaIfaceCapabilityMask{},
- createWifiStatusFromLegacyError(legacy_status)};
+ return {0, createWifiStatusFromLegacyError(legacy_status)};
}
uint32_t aidl_caps;
if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities(legacy_feature_set,
&aidl_caps)) {
- return {IWifiStaIface::StaIfaceCapabilityMask{},
- createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
+ return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
}
- return {static_cast<IWifiStaIface::StaIfaceCapabilityMask>(aidl_caps),
- ndk::ScopedAStatus::ok()};
+ return {aidl_caps, ndk::ScopedAStatus::ok()};
}
std::pair<StaApfPacketFilterCapabilities, ndk::ScopedAStatus>
diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h
index 2e4403a..0831e16 100644
--- a/wifi/aidl/default/wifi_sta_iface.h
+++ b/wifi/aidl/default/wifi_sta_iface.h
@@ -54,8 +54,7 @@
ndk::ScopedAStatus getName(std::string* _aidl_return) override;
ndk::ScopedAStatus registerEventCallback(
const std::shared_ptr<IWifiStaIfaceEventCallback>& in_callback) override;
- ndk::ScopedAStatus getCapabilities(
- IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) override;
+ ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
ndk::ScopedAStatus getApfPacketFilterCapabilities(
StaApfPacketFilterCapabilities* _aidl_return) override;
ndk::ScopedAStatus installApfPacketFilter(const std::vector<uint8_t>& in_program) override;
@@ -99,7 +98,7 @@
std::pair<std::string, ndk::ScopedAStatus> getNameInternal();
ndk::ScopedAStatus registerEventCallbackInternal(
const std::shared_ptr<IWifiStaIfaceEventCallback>& callback);
- std::pair<IWifiStaIface::StaIfaceCapabilityMask, ndk::ScopedAStatus> getCapabilitiesInternal();
+ std::pair<int32_t, ndk::ScopedAStatus> getCapabilitiesInternal();
std::pair<StaApfPacketFilterCapabilities, ndk::ScopedAStatus>
getApfPacketFilterCapabilitiesInternal();
ndk::ScopedAStatus installApfPacketFilterInternal(const std::vector<uint8_t>& program);
diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp
index 463545b..4cf14a2 100644
--- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp
+++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp
@@ -208,9 +208,9 @@
}
int32_t getChipCapabilities(const std::shared_ptr<IWifiChip>& wifi_chip) {
- IWifiChip::ChipCapabilityMask caps = {};
+ int32_t caps = 0;
if (wifi_chip->getCapabilities(&caps).isOk()) {
- return static_cast<int32_t>(caps);
+ return caps;
}
return 0;
}
diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
index d0b7014..dbff949 100644
--- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp
@@ -22,6 +22,7 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/wifi/BnWifi.h>
#include <aidl/android/hardware/wifi/BnWifiChipEventCallback.h>
+#include <aidl/android/hardware/wifi/WifiIfaceMode.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <binder/IServiceManager.h>
@@ -232,9 +233,7 @@
std::vector<WifiUsableChannel> channels;
configureChipForConcurrencyType(IfaceConcurrencyType::STA);
- auto status = wifi_chip_->getUsableChannels(
- band, static_cast<WifiIfaceMode>(ifaceModeMask),
- static_cast<IWifiChip::UsableChannelFilter>(filterMask), &channels);
+ auto status = wifi_chip_->getUsableChannels(band, ifaceModeMask, filterMask, &channels);
if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) {
GTEST_SKIP() << "getUsableChannels() is not supported by vendor.";
}
@@ -337,7 +336,7 @@
// Test with an empty vector of CoexUnsafeChannels.
std::vector<IWifiChip::CoexUnsafeChannel> vec;
- IWifiChip::CoexRestriction restrictions = static_cast<IWifiChip::CoexRestriction>(0);
+ int restrictions = 0;
auto status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions);
if (!status.isOk()) {
EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED));
@@ -352,10 +351,9 @@
unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ;
unsafeChannel5Ghz.channel = 36;
vec.push_back(unsafeChannel5Ghz);
- restrictions = static_cast<IWifiChip::CoexRestriction>(
- static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_AWARE) |
- static_cast<int32_t>(IWifiChip::CoexRestriction::SOFTAP) |
- static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_DIRECT));
+ restrictions = static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_AWARE) |
+ static_cast<int32_t>(IWifiChip::CoexRestriction::SOFTAP) |
+ static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_DIRECT);
status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions);
if (!status.isOk()) {
diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
index fe32be5..b772bc3 100644
--- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
@@ -54,9 +54,9 @@
protected:
bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask expected) {
- IWifiStaIface::StaIfaceCapabilityMask caps = {};
+ int32_t caps = 0;
EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk());
- return static_cast<uint32_t>(caps) & static_cast<uint32_t>(expected);
+ return caps & static_cast<int32_t>(expected);
}
ndk::ScopedAStatus createStaIface(std::shared_ptr<IWifiStaIface>* sta_iface) {
@@ -86,9 +86,9 @@
* GetCapabilities
*/
TEST_P(WifiStaIfaceAidlTest, GetCapabilities) {
- IWifiStaIface::StaIfaceCapabilityMask caps = {};
+ int32_t caps = 0;
EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk());
- EXPECT_NE(static_cast<int32_t>(caps), 0);
+ EXPECT_NE(caps, 0);
}
/*
diff --git a/wifi/hostapd/aidl/lint-baseline.xml b/wifi/hostapd/aidl/lint-baseline.xml
new file mode 100644
index 0000000..657622e
--- /dev/null
+++ b/wifi/hostapd/aidl/lint-baseline.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 8.0.0-dev" type="baseline" dependencies="true" variant="all" version="8.0.0-dev">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/hostapd/aidl/android.hardware.wifi.hostapd-V1-java-source/gen/android/hardware/wifi/hostapd/IHostapd.java"
+ line="55"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/hostapd/aidl/android.hardware.wifi.hostapd-V1-java-source/gen/android/hardware/wifi/hostapd/IHostapdCallback.java"
+ line="46"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/hostapd/aidl/android.hardware.wifi.hostapd-V2-java-source/gen/android/hardware/wifi/hostapd/IHostapd.java"
+ line="117"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/hostapd/aidl/android.hardware.wifi.hostapd-V2-java-source/gen/android/hardware/wifi/hostapd/IHostapdCallback.java"
+ line="62"
+ column="12"/>
+ </issue>
+
+</issues>
\ No newline at end of file
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
index f617975..1616b26 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
@@ -98,6 +98,5 @@
android.hardware.wifi.supplicant.SignalPollResult[] getSignalPollResults();
android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] addQosPolicyRequestForScs(in android.hardware.wifi.supplicant.QosPolicyScsData[] qosPolicyData);
android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds);
- android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeAllQosPoliciesForScs();
const int MAX_POLICIES_PER_QOS_SCS_REQUEST = 16;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
index e006048..06ab8fb 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
@@ -850,20 +850,4 @@
* being processed. Supplicant will only handle one request at a time.
*/
QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds);
-
- /**
- * Request the removal of all QoS policies for SCS configured by the STA.
- *
- * @return QosPolicyScsRequestStatus[] synchronously corresponding to all
- * the scs policies.
- * @throws ServiceSpecificException with one of the following values:
- * |SupplicantStatusCode.FAILURE_UNKNOWN| if there are no policies to remove.
- *
- * |SupplicantStatusCode.FAILURE_UNSUPPORTED| if the AP does not support
- * the feature.
- *
- * |SupplicantStatusCode.FAILURE_ONGOING_REQUEST| if a request is currently
- * being processed. Supplicant will only handle one request at a time.
- */
- QosPolicyScsRequestStatus[] removeAllQosPoliciesForScs();
}
diff --git a/wifi/supplicant/aidl/lint-baseline.xml b/wifi/supplicant/aidl/lint-baseline.xml
new file mode 100644
index 0000000..0631223
--- /dev/null
+++ b/wifi/supplicant/aidl/lint-baseline.xml
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 8.0.0-dev" type="baseline" dependencies="true" variant="all" version="8.0.0-dev">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicant.java"
+ line="84"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantCallback.java"
+ line="43"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantP2pIface.java"
+ line="237"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.java"
+ line="91"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantP2pNetwork.java"
+ line="76"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaIface.java"
+ line="235"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.java"
+ line="124"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaNetwork.java"
+ line="354"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V1-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.java"
+ line="52"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/INonStandardCertCallback.java"
+ line="67"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicant.java"
+ line="200"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantCallback.java"
+ line="60"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantP2pIface.java"
+ line="928"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.java"
+ line="265"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantP2pNetwork.java"
+ line="164"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaIface.java"
+ line="939"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.java"
+ line="390"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaNetwork.java"
+ line="1239"
+ column="12"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 31 (current min is 30): `android.os.Binder#markVintfStability`"
+ errorLine1=" this.markVintfStability();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="out/.intermediates/hardware/interfaces/wifi/supplicant/aidl/android.hardware.wifi.supplicant-V2-java-source/gen/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.java"
+ line="97"
+ column="12"/>
+ </issue>
+
+</issues>
\ No newline at end of file