Merge "Remove GenericMetadata from composer3"
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
similarity index 83%
copy from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
copy to bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
index df07c9c..7c0d825 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2021, The Android Open Source Project
+/*
+ * Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,9 +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.graphics.composer3;
-@VintfStability
-parcelable ColorTransformPayload {
- float[] matrix;
- android.hardware.graphics.common.ColorTransform hint;
+package android.hardware.bluetooth.audio;
+@Backing(type="int") @VintfStability
+enum BluetoothAudioStatus {
+ UNKNOWN = 0,
+ SUCCESS = 1,
+ UNSUPPORTED_CODEC_CONFIGURATION = 2,
+ FAILURE = 3,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index 84bcc0c..e5e79cb 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
@@ -35,7 +35,7 @@
@VintfStability
interface IBluetoothAudioProvider {
void endSession();
- android.hardware.common.fmq.MQDescriptor<int,android.hardware.common.fmq.UnsynchronizedWrite> startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig);
- void streamStarted(in boolean status);
- void streamSuspended(in boolean status);
+ android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig);
+ void streamStarted(in android.hardware.bluetooth.audio.BluetoothAudioStatus status);
+ void streamSuspended(in android.hardware.bluetooth.audio.BluetoothAudioStatus status);
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LdacQualityIndex.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LdacQualityIndex.aidl
index bc0d97b..693392f 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LdacQualityIndex.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LdacQualityIndex.aidl
@@ -34,8 +34,8 @@
package android.hardware.bluetooth.audio;
@Backing(type="byte") @VintfStability
enum LdacQualityIndex {
- QUALITY_HIGH = 1,
- QUALITY_MID = 2,
- QUALITY_LOW = 4,
- QUALITY_ABR = 8,
+ HIGH = 1,
+ MID = 2,
+ LOW = 4,
+ ABR = 8,
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl
index 9efafca..a7224ca 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl
@@ -38,13 +38,13 @@
android.hardware.bluetooth.audio.CodecType codecType;
android.hardware.bluetooth.audio.AudioLocation supportedChannel;
int supportedChannelCount;
- android.hardware.bluetooth.audio.LeAudioCapabilities.LeaudioCodecCapabilities leaudioCodecCapabilities;
+ android.hardware.bluetooth.audio.LeAudioCapabilities.LeAudioCodecCapabilities leAudioCodecCapabilities;
@VintfStability
parcelable VendorCapabilities {
ParcelableHolder extension;
}
@VintfStability
- union LeaudioCodecCapabilities {
+ union LeAudioCodecCapabilities {
android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities;
android.hardware.bluetooth.audio.LeAudioCapabilities.VendorCapabilities vendorCapabillities;
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index c6cb5cb..2bc1791 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -35,10 +35,10 @@
@VintfStability
parcelable LeAudioConfiguration {
android.hardware.bluetooth.audio.LeAudioMode mode;
- android.hardware.bluetooth.audio.LeAudioConfiguration.LeAuioModeConfig modeConfig;
+ android.hardware.bluetooth.audio.LeAudioConfiguration.LeAudioModeConfig modeConfig;
android.hardware.bluetooth.audio.CodecType codecType;
@VintfStability
- union LeAuioModeConfig {
+ union LeAudioModeConfig {
android.hardware.bluetooth.audio.UnicastConfiguration unicastConfig;
android.hardware.bluetooth.audio.BroadcastConfiguration broadcastConfig;
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PcmCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PcmCapabilities.aidl
index 0c2f87d..6cfe5cd 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PcmCapabilities.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PcmCapabilities.aidl
@@ -35,7 +35,7 @@
@VintfStability
parcelable PcmCapabilities {
int[] sampleRateHz;
- android.hardware.bluetooth.audio.ChannelMode[] channelMode;
+ android.hardware.bluetooth.audio.ChannelMode channelMode;
byte[] bitsPerSample;
int[] dataIntervalUs;
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PresentationPosition.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PresentationPosition.aidl
index 810a9a1..7e997e8 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PresentationPosition.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/PresentationPosition.aidl
@@ -36,7 +36,7 @@
parcelable PresentationPosition {
long remoteDeviceAudioDelayNanos;
long transmittedOctets;
- android.hardware.bluetooth.audio.PresentationPosition.TimeSpec transmittedOctetsTimeStamp;
+ android.hardware.bluetooth.audio.PresentationPosition.TimeSpec transmittedOctetsTimestamp;
@VintfStability
parcelable TimeSpec {
long tvSec;
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl
index 900ab31..72d7fb2 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/SessionType.aidl
@@ -36,7 +36,7 @@
enum SessionType {
UNKNOWN = 0,
A2DP_SOFTWARE_ENCODING_DATAPATH = 1,
- A2DP_HARDWARE_OFFLOAD_DATAPATH = 2,
+ A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 2,
HEARING_AID_SOFTWARE_ENCODING_DATAPATH = 3,
LE_AUDIO_SOFTWARE_ENCODING_DATAPATH = 4,
LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5,
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
new file mode 100644
index 0000000..ec78445
--- /dev/null
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio;
+
+@VintfStability
+@Backing(type="int")
+enum BluetoothAudioStatus {
+ UNKNOWN = 0,
+ SUCCESS = 1,
+ UNSUPPORTED_CODEC_CONFIGURATION = 2,
+ // General failure
+ FAILURE = 3
+}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index cebd808..a2c5ae9 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
@@ -17,9 +17,10 @@
package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.AudioConfiguration;
+import android.hardware.bluetooth.audio.BluetoothAudioStatus;
import android.hardware.bluetooth.audio.IBluetoothAudioPort;
import android.hardware.common.fmq.MQDescriptor;
-import android.hardware.common.fmq.UnsynchronizedWrite;
+import android.hardware.common.fmq.SynchronizedReadWrite;
/**
* HAL interface from the Bluetooth stack to the Audio HAL
@@ -55,7 +56,7 @@
* audioConfig.pcmConfig parameter. Invalid if streaming is offloaded
* from/to hardware or on failure
*/
- MQDescriptor<int, UnsynchronizedWrite> startSession(
+ MQDescriptor<byte, SynchronizedReadWrite> startSession(
in IBluetoothAudioPort hostIf, in AudioConfiguration audioConfig);
/**
@@ -63,12 +64,12 @@
*
* @param status true for SUCCESS or false for FAILURE
*/
- void streamStarted(in boolean status);
+ void streamStarted(in BluetoothAudioStatus status);
/**
* Callback for IBluetoothAudioPort.suspendStream()
*
* @param status true for SUCCESS or false for FAILURE
*/
- void streamSuspended(in boolean status);
+ void streamSuspended(in BluetoothAudioStatus status);
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LdacQualityIndex.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LdacQualityIndex.aidl
index fc532f4..cb12583 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LdacQualityIndex.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LdacQualityIndex.aidl
@@ -22,17 +22,17 @@
/**
* 990kbps
*/
- QUALITY_HIGH = 1,
+ HIGH = 1,
/**
* 660kbps
*/
- QUALITY_MID = 1 << 1,
+ MID = 1 << 1,
/**
* 330kbps
*/
- QUALITY_LOW = 1 << 2,
+ LOW = 1 << 2,
/**
* Adaptive Bit Rate mode
*/
- QUALITY_ABR = 1 << 3,
+ ABR = 1 << 3,
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl
index ea05820..732427f 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioCapabilities.aidl
@@ -31,7 +31,7 @@
ParcelableHolder extension;
}
@VintfStability
- union LeaudioCodecCapabilities {
+ union LeAudioCodecCapabilities {
Lc3Capabilities lc3Capabilities;
VendorCapabilities vendorCapabillities;
}
@@ -43,5 +43,5 @@
*/
AudioLocation supportedChannel;
int supportedChannelCount;
- LeaudioCodecCapabilities leaudioCodecCapabilities;
+ LeAudioCodecCapabilities leAudioCodecCapabilities;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
index a212c96..515794b 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl
@@ -24,7 +24,7 @@
@VintfStability
parcelable LeAudioConfiguration {
@VintfStability
- union LeAuioModeConfig {
+ union LeAudioModeConfig {
UnicastConfiguration unicastConfig;
BroadcastConfiguration broadcastConfig;
}
@@ -32,6 +32,6 @@
* The mode of the LE audio
*/
LeAudioMode mode;
- LeAuioModeConfig modeConfig;
+ LeAudioModeConfig modeConfig;
CodecType codecType;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PcmCapabilities.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PcmCapabilities.aidl
index 776b777..f5d699e 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PcmCapabilities.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PcmCapabilities.aidl
@@ -24,7 +24,7 @@
@VintfStability
parcelable PcmCapabilities {
int[] sampleRateHz;
- ChannelMode[] channelMode;
+ ChannelMode channelMode;
byte[] bitsPerSample;
/**
* Data interval for data transfer
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PresentationPosition.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PresentationPosition.aidl
index 17e746f..f3b8aed 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PresentationPosition.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/PresentationPosition.aidl
@@ -44,9 +44,9 @@
*/
long transmittedOctets;
/*
- * transmittedOctetsTimeStamp the value of CLOCK_MONOTONIC
+ * transmittedOctetsTimestamp the value of CLOCK_MONOTONIC
* corresponding to transmittedOctets. If the software data path is
* unused (e.g., for Hardware Offload), the value is set to zero.
*/
- TimeSpec transmittedOctetsTimeStamp;
+ TimeSpec transmittedOctetsTimestamp;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
index b588869..30faae3 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/SessionType.aidl
@@ -27,7 +27,7 @@
/**
* The encoding of AVDTP media is done by HW and there is control only
*/
- A2DP_HARDWARE_OFFLOAD_DATAPATH,
+ A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
/**
* Used when encoded by Bluetooth Stack and streaming to Hearing Aid
*/
diff --git a/compatibility_matrices/compatibility_matrix.3.xml b/compatibility_matrices/compatibility_matrix.3.xml
index a75ed25..468735d 100644
--- a/compatibility_matrices/compatibility_matrix.3.xml
+++ b/compatibility_matrices/compatibility_matrix.3.xml
@@ -207,7 +207,10 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <!-- Either the AIDL or the HIDL health HAL must exist on the device.
+ If the HIDL health HAL exists, it must be at least version 2.0.
+ See DeviceManifestTest.HealthHal -->
+ <hal format="hidl" optional="true">
<name>android.hardware.health</name>
<version>2.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml
index 3b8ee21..96f291f 100644
--- a/compatibility_matrices/compatibility_matrix.4.xml
+++ b/compatibility_matrices/compatibility_matrix.4.xml
@@ -213,7 +213,10 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <!-- Either the AIDL or the HIDL health HAL must exist on the device.
+ If the HIDL health HAL exists, it must be at least version 2.0.
+ See DeviceManifestTest.HealthHal -->
+ <hal format="hidl" optional="true">
<name>android.hardware.health</name>
<version>2.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml
index 0fb21a7..3642814 100644
--- a/compatibility_matrices/compatibility_matrix.5.xml
+++ b/compatibility_matrices/compatibility_matrix.5.xml
@@ -238,7 +238,10 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <!-- Either the AIDL or the HIDL health HAL must exist on the device.
+ If the HIDL health HAL exists, it must be at least version 2.1.
+ See DeviceManifestTest.HealthHal -->
+ <hal format="hidl" optional="true">
<name>android.hardware.health</name>
<version>2.1</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.6.xml b/compatibility_matrices/compatibility_matrix.6.xml
index aee2c51..9c42cb0 100644
--- a/compatibility_matrices/compatibility_matrix.6.xml
+++ b/compatibility_matrices/compatibility_matrix.6.xml
@@ -268,7 +268,10 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <!-- Either the AIDL or the HIDL health HAL must exist on the device.
+ If the HIDL health HAL exists, it must be at least version 2.1.
+ See DeviceManifestTest.HealthHal -->
+ <hal format="hidl" optional="true">
<name>android.hardware.health</name>
<version>2.1</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 27e6b26..c875e8c 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -210,14 +210,6 @@
</interface>
</hal>
<hal format="hidl" optional="true">
- <name>android.hardware.contexthub</name>
- <version>1.2</version>
- <interface>
- <name>IContexthub</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
<name>android.hardware.drm</name>
<version>1.3-4</version>
<interface>
@@ -337,9 +329,9 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="aidl" optional="true">
<name>android.hardware.ir</name>
- <version>1.0</version>
+ <version>1</version>
<interface>
<name>IConsumerIr</name>
<instance>default</instance>
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
similarity index 93%
rename from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
rename to graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
index df07c9c..856ec64 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
@@ -33,7 +33,6 @@
package android.hardware.graphics.composer3;
@VintfStability
-parcelable ColorTransformPayload {
- float[] matrix;
- android.hardware.graphics.common.ColorTransform hint;
+parcelable ClockMonotonicTimestamp {
+ long timestamp;
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl
index 2f5d00f..3382633 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl
@@ -36,9 +36,10 @@
parcelable DisplayCommand {
long display;
android.hardware.graphics.composer3.LayerCommand[] layers;
- @nullable android.hardware.graphics.composer3.ColorTransformPayload colorTransform;
+ @nullable float[] colorTransformMatrix;
@nullable android.hardware.graphics.composer3.ClientTarget clientTarget;
@nullable android.hardware.graphics.composer3.Buffer virtualDisplayOutputBuffer;
+ @nullable android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime;
boolean validateDisplay;
boolean acceptDisplayChanges;
boolean presentDisplay;
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
index 1354ea0..2d17e0f 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -55,7 +55,7 @@
int getMaxVirtualDisplayCount();
android.hardware.graphics.composer3.PerFrameMetadataKey[] getPerFrameMetadataKeys(long display);
android.hardware.graphics.composer3.ReadbackBufferAttributes getReadbackBufferAttributes(long display);
- ParcelFileDescriptor getReadbackBufferFence(long display);
+ @nullable ParcelFileDescriptor getReadbackBufferFence(long display);
android.hardware.graphics.composer3.RenderIntent[] getRenderIntents(long display, android.hardware.graphics.composer3.ColorMode mode);
android.hardware.graphics.composer3.ContentType[] getSupportedContentTypes(long display);
void registerCallback(in android.hardware.graphics.composer3.IComposerCallback callback);
@@ -68,7 +68,7 @@
void setDisplayBrightness(long display, float brightness);
void setDisplayedContentSamplingEnabled(long display, boolean enable, android.hardware.graphics.composer3.FormatColorComponent componentMask, long maxFrames);
void setPowerMode(long display, android.hardware.graphics.composer3.PowerMode mode);
- void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in ParcelFileDescriptor releaseFence);
+ void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in @nullable ParcelFileDescriptor releaseFence);
void setVsyncEnabled(long display, boolean enabled);
const int EX_BAD_CONFIG = 1;
const int EX_BAD_DISPLAY = 2;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ColorTransformPayload.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
similarity index 65%
rename from graphics/composer/aidl/android/hardware/graphics/composer3/ColorTransformPayload.aidl
rename to graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
index fc37dac..f385038 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/ColorTransformPayload.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl
@@ -16,18 +16,10 @@
package android.hardware.graphics.composer3;
-import android.hardware.graphics.common.ColorTransform;
-
+/**
+ * Represents a nanoseconds timestamp in CLOCK_MONOTONIC.
+ */
@VintfStability
-parcelable ColorTransformPayload {
- /**
- * 4x4 transform matrix (16 floats) as described in DisplayCommand.colorTransform.
- */
- float[] matrix;
-
- /**
- * Hint value which may be used instead of the given matrix unless it
- * is ColorTransform.ARBITRARY.
- */
- ColorTransform hint;
+parcelable ClockMonotonicTimestamp {
+ long timestamp;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
index 4947463..49cdffc 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
@@ -74,16 +74,20 @@
*/
SIDEBAND = 5,
/**
- * A display decoration layer contains a buffer which is an 8 bit
- * alpha mask. Pixels in the mask with an alpha of 0 (transparent) will
- * show the content underneath, and pixels with an alpha of 255 will be
- * be rendered in black. An alpha in between will show the content
- * blended with black. This is useful, for example, to provide
+ * A display decoration layer contains a buffer which is used to provide
* anti-aliasing on the cutout region/rounded corners on the top and
* bottom of a display.
*
+ * Pixels in the buffer with an alpha of 0 (transparent) will show the
+ * content underneath, and pixels with an alpha of 255 will be rendered in
+ * black. An alpha in between will show the underlying content blended with
+ * black.
+ *
+ * Some devices may support this flag with a buffer containing an 8 bit
+ * alpha mask.
+ *
* Upon validateDisplay, the device may request a change from this type
- * to CLIENT.
+ * to either DEVICE or CLIENT.
*/
DISPLAY_DECORATION = 6,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
index 21497c4..18461ad 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
@@ -18,7 +18,7 @@
import android.hardware.graphics.composer3.Buffer;
import android.hardware.graphics.composer3.ClientTarget;
-import android.hardware.graphics.composer3.ColorTransformPayload;
+import android.hardware.graphics.composer3.ClockMonotonicTimestamp;
import android.hardware.graphics.composer3.LayerCommand;
@VintfStability
@@ -38,11 +38,7 @@
/**
* Sets a color transform which will be applied after composition.
*
- * If hint is not ColorTransform.ARBITRARY, then the device may use the
- * hint to apply the desired color transform instead of using the color
- * matrix directly.
- *
- * If the device is not capable of either using the hint or the matrix to
+ * If the device is not capable of either using the matrix to
* apply the desired color transform, it must force all layers to client
* composition during VALIDATE_DISPLAY.
*
@@ -70,7 +66,7 @@
* B_out = R_in * r.b + G_in * g.b + B_in * b.b + Tb
*
*/
- @nullable ColorTransformPayload colorTransform;
+ @nullable float[] colorTransformMatrix;
/**
* Sets the buffer handle which will receive the output of client
@@ -115,6 +111,14 @@
@nullable Buffer virtualDisplayOutputBuffer;
/**
+ * Sets the expected present time to present the current content on screen.
+ * The implementation should try to present the display as close as possible
+ * to the given expectedPresentTime. If expectedPresentTime is 0, the
+ * implementation should present the display as soon as possible.
+ */
+ @nullable ClockMonotonicTimestamp expectedPresentTime;
+
+ /**
* Instructs the device to inspect all of the layer state and determine if
* there are any composition type changes necessary before presenting the
* display. Permitted changes are described in the definition of
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index 742b52b..ab7f397 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -464,7 +464,7 @@
* getReadbackBufferAttributes
* setReadbackBuffer
*/
- ParcelFileDescriptor getReadbackBufferFence(long display);
+ @nullable ParcelFileDescriptor getReadbackBufferFence(long display);
/**
* Returns the render intents supported by the specified display and color
@@ -687,13 +687,15 @@
* This buffer must have been allocated as described in
* getReadbackBufferAttributes and is in the dataspace provided by the same.
*
+ * Also provides a file descriptor referring to a release sync fence
+ * object, which must be signaled when it is safe to write to the readback
+ * buffer. If it is already safe to write to the readback buffer, null may be passed instead.
+ *
* If there is hardware protected content on the display at the time of the next
* composition, the area of the readback buffer covered by such content must be
* completely black. Any areas of the buffer not covered by such content may
* optionally be black as well.
*
- * The release fence file descriptor provided works identically to the one
- * described for setOutputBuffer.
*
* This function must not be called between any call to validateDisplay and a
* subsequent call to presentDisplay.
@@ -701,7 +703,8 @@
* Parameters:
* @param display - the display on which to create the layer.
* @param buffer - the new readback buffer
- * @param releaseFence - a sync fence file descriptor as described in setOutputBuffer
+ * @param releaseFence - a sync fence file descriptor as described above or null if it is
+ * already safe to write to the readback buffer.
*
* @exception EX_BAD_DISPLAY - an invalid display handle was passed in
* @exception EX_BAD_PARAMETER - the new readback buffer handle was invalid
@@ -711,7 +714,7 @@
* getReadbackBufferFence
*/
void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer,
- in ParcelFileDescriptor releaseFence);
+ in @nullable ParcelFileDescriptor releaseFence);
/**
* Enables or disables the vsync signal for the given display. Virtual
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
index 34dea9e..eddc2d3 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
@@ -258,7 +258,7 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
// if hwc cannot handle and asks for composition change,
// just succeed the test
@@ -317,7 +317,7 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@@ -377,7 +377,7 @@
mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@@ -492,7 +492,7 @@
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@@ -606,7 +606,7 @@
clientLayer->setDisplayFrame(clientFrame);
clientLayer->setZOrder(0);
clientLayer->write(mWriter);
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@@ -685,7 +685,7 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -715,7 +715,7 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
@@ -756,7 +756,7 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -819,7 +819,7 @@
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -877,7 +877,7 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -902,7 +902,7 @@
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
&changedCompositionTypes);
@@ -1027,7 +1027,7 @@
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -1072,7 +1072,7 @@
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -1112,7 +1112,7 @@
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -1195,7 +1195,7 @@
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -1241,7 +1241,7 @@
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@@ -1287,7 +1287,7 @@
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> layers;
std::vector<Composition> types;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
index 040f402..6638744 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -17,6 +17,7 @@
#include <android/hardware/graphics/composer3/ComposerClientWriter.h>
#include <binder/ProcessState.h>
#include <gtest/gtest.h>
+#include <ui/Fence.h>
#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>
#include <algorithm>
@@ -971,14 +972,14 @@
TEST_P(GraphicsComposerAidlTest, SetPowerModeUnsupported) {
std::vector<DisplayCapability> capabilities;
- const auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
+ auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
ASSERT_TRUE(error.isOk());
const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::DOZE) != capabilities.end();
const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::SUSPEND) != capabilities.end();
if (!isDozeSupported) {
- auto error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::DOZE);
+ error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::DOZE);
EXPECT_FALSE(error.isOk());
EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
@@ -988,7 +989,7 @@
}
if (!isSuspendSupported) {
- auto error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON_SUSPEND);
+ error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON_SUSPEND);
EXPECT_FALSE(error.isOk());
EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
@@ -1261,7 +1262,7 @@
mWriter.setLayerBuffer(display.get(), layer, 0, buffer->handle, -1);
mWriter.setLayerDataspace(display.get(), layer, common::Dataspace::UNKNOWN);
- mWriter.validateDisplay(display.get());
+ mWriter.validateDisplay(display.get(), ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -1277,7 +1278,7 @@
mWriter.setLayerBuffer(display.get(), layer, 0, buffer->handle, -1);
mWriter.setLayerSurfaceDamage(display.get(), layer,
std::vector<Rect>(1, {0, 0, 10, 10}));
- mWriter.validateDisplay(display.get());
+ mWriter.validateDisplay(display.get(), ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@@ -1288,6 +1289,53 @@
ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer));
}
+ sp<::android::Fence> presentAndGetFence(
+ std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
+ mWriter.validateDisplay(mPrimaryDisplay, expectedPresentTime);
+ execute();
+ EXPECT_TRUE(mReader.takeErrors().empty());
+
+ mWriter.presentDisplay(mPrimaryDisplay);
+ execute();
+ EXPECT_TRUE(mReader.takeErrors().empty());
+
+ int presentFence;
+ mReader.takePresentFence(mPrimaryDisplay, &presentFence);
+ EXPECT_NE(-1, presentFence);
+ return sp<::android::Fence>::make(presentFence);
+ }
+
+ int32_t getVsyncPeriod() {
+ int32_t activeConfig;
+ EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &activeConfig).isOk());
+
+ int32_t vsyncPeriod;
+ EXPECT_TRUE(mComposerClient
+ ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
+ DisplayAttribute::VSYNC_PERIOD, &vsyncPeriod)
+ .isOk());
+ return vsyncPeriod;
+ }
+
+ int64_t createOnScreenLayer() {
+ const int64_t layer = createLayer(mDisplays[0]);
+ mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::DEVICE);
+ mWriter.setLayerDisplayFrame(mPrimaryDisplay, layer, {0, 0, mDisplayWidth, mDisplayHeight});
+ mWriter.setLayerPlaneAlpha(mPrimaryDisplay, layer, 1);
+ mWriter.setLayerSourceCrop(
+ mPrimaryDisplay, layer,
+ {0, 0, static_cast<float>(mDisplayWidth), static_cast<float>(mDisplayHeight)});
+ mWriter.setLayerTransform(mPrimaryDisplay, layer, static_cast<Transform>(0));
+ mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer,
+ std::vector<Rect>(1, {0, 0, mDisplayWidth, mDisplayHeight}));
+ mWriter.setLayerZOrder(mPrimaryDisplay, layer, 10);
+ mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
+ mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer,
+ std::vector<Rect>(1, {0, 0, mDisplayWidth, mDisplayHeight}));
+ mWriter.setLayerDataspace(mPrimaryDisplay, layer, common::Dataspace::UNKNOWN);
+ return layer;
+ }
+
void Test_setActiveConfigWithConstraints(const TestParameters& params) {
for (VtsDisplay& display : mDisplays) {
forEachTwoConfigs(display.get(), [&](int32_t config1, int32_t config2) {
@@ -1378,6 +1426,47 @@
}
}
+ void Test_expectedPresentTime(std::optional<int> framesDelay) {
+ ASSERT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON).isOk());
+
+ const auto vsyncPeriod = getVsyncPeriod();
+
+ const auto buffer1 = allocate();
+ const auto buffer2 = allocate();
+ ASSERT_NE(nullptr, buffer1);
+ ASSERT_NE(nullptr, buffer2);
+
+ const auto layer = createOnScreenLayer();
+ mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, buffer1->handle, -1);
+ const sp<::android::Fence> presentFence1 =
+ presentAndGetFence(ComposerClientWriter::kNoTimestamp);
+ presentFence1->waitForever(LOG_TAG);
+
+ auto expectedPresentTime = presentFence1->getSignalTime() + vsyncPeriod;
+ if (framesDelay.has_value()) {
+ expectedPresentTime += *framesDelay * vsyncPeriod;
+ }
+
+ mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, buffer2->handle, -1);
+ const auto setExpectedPresentTime = [&]() -> std::optional<ClockMonotonicTimestamp> {
+ if (!framesDelay.has_value()) {
+ return ComposerClientWriter::kNoTimestamp;
+ } else if (*framesDelay == 0) {
+ return ClockMonotonicTimestamp{0};
+ }
+ return ClockMonotonicTimestamp{expectedPresentTime};
+ }();
+
+ const sp<::android::Fence> presentFence2 = presentAndGetFence(setExpectedPresentTime);
+ presentFence2->waitForever(LOG_TAG);
+
+ const auto actualPresentTime = presentFence2->getSignalTime();
+ const auto presentError = std::abs(expectedPresentTime - actualPresentTime);
+ EXPECT_LE(presentError, vsyncPeriod / 2);
+
+ ASSERT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF).isOk());
+ }
+
// clang-format off
const std::array<float, 16> kIdentity = {{
1.0f, 0.0f, 0.0f, 0.0f,
@@ -1392,7 +1481,7 @@
};
TEST_P(GraphicsComposerAidlCommandTest, SET_COLOR_TRANSFORM) {
- mWriter.setColorTransform(mPrimaryDisplay, kIdentity.data(), ColorTransform::IDENTITY);
+ mWriter.setColorTransform(mPrimaryDisplay, kIdentity.data());
execute();
}
@@ -1440,19 +1529,19 @@
}
TEST_P(GraphicsComposerAidlCommandTest, VALIDATE_DISPLAY) {
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
}
TEST_P(GraphicsComposerAidlCommandTest, ACCEPT_DISPLAY_CHANGES) {
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
mWriter.acceptDisplayChanges(mPrimaryDisplay);
execute();
}
// TODO(b/208441745) fix the test failure
TEST_P(GraphicsComposerAidlCommandTest, PRESENT_DISPLAY) {
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
mWriter.presentDisplay(mPrimaryDisplay);
execute();
}
@@ -1501,7 +1590,7 @@
mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, handle, -1);
mWriter.setLayerDataspace(mPrimaryDisplay, layer, Dataspace::UNKNOWN);
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> layers;
std::vector<Composition> types;
@@ -1548,7 +1637,7 @@
mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>(1, displayFrame));
mWriter.setLayerDataspace(mPrimaryDisplay, layer, Dataspace::UNKNOWN);
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> layers;
@@ -1565,7 +1654,7 @@
execute();
mWriter.setLayerCursorPosition(mPrimaryDisplay, layer, 0, 0);
- mWriter.validateDisplay(mPrimaryDisplay);
+ mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
mWriter.presentDisplay(mPrimaryDisplay);
execute();
}
@@ -1925,6 +2014,18 @@
}
}
+TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_NoTimestamp) {
+ ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(std::nullopt));
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_0) {
+ ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(0));
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_5) {
+ ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(5));
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest);
INSTANTIATE_TEST_SUITE_P(
PerInstance, GraphicsComposerAidlCommandTest,
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
index 28bdd70..5bab266 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
@@ -63,6 +63,8 @@
class ComposerClientWriter {
public:
+ static constexpr std::optional<ClockMonotonicTimestamp> kNoTimestamp = std::nullopt;
+
ComposerClientWriter() { reset(); }
virtual ~ComposerClientWriter() { reset(); }
@@ -73,11 +75,11 @@
mCommands.clear();
}
- void setColorTransform(int64_t display, const float* matrix, ColorTransform hint) {
- ColorTransformPayload colorTransformPayload;
- colorTransformPayload.matrix.assign(matrix, matrix + 16);
- colorTransformPayload.hint = hint;
- getDisplayCommand(display).colorTransform.emplace(std::move(colorTransformPayload));
+ void setColorTransform(int64_t display, const float* matrix) {
+ std::vector<float> matVec;
+ matVec.reserve(16);
+ matVec.assign(matrix, matrix + 16);
+ getDisplayCommand(display).colorTransformMatrix.emplace(std::move(matVec));
}
void setClientTarget(int64_t display, uint32_t slot, const native_handle_t* target,
@@ -95,10 +97,18 @@
getBuffer(slot, buffer, releaseFence));
}
- void validateDisplay(int64_t display) { getDisplayCommand(display).validateDisplay = true; }
+ void validateDisplay(int64_t display,
+ std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
+ auto& command = getDisplayCommand(display);
+ command.expectedPresentTime = expectedPresentTime;
+ command.validateDisplay = true;
+ }
- void presentOrvalidateDisplay(int64_t display) {
- getDisplayCommand(display).presentOrValidateDisplay = true;
+ void presentOrvalidateDisplay(int64_t display,
+ std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
+ auto& command = getDisplayCommand(display);
+ command.expectedPresentTime = expectedPresentTime;
+ command.presentOrValidateDisplay = true;
}
void acceptDisplayChanges(int64_t display) {
diff --git a/health/aidl/vts/functional/Android.bp b/health/aidl/vts/functional/Android.bp
index 434f565..d315c60 100644
--- a/health/aidl/vts/functional/Android.bp
+++ b/health/aidl/vts/functional/Android.bp
@@ -43,6 +43,7 @@
"libhealthtest_headers",
],
test_suites: [
+ "general-tests",
"vts",
],
}
diff --git a/ir/aidl/Android.bp b/ir/aidl/Android.bp
new file mode 100644
index 0000000..8741157
--- /dev/null
+++ b/ir/aidl/Android.bp
@@ -0,0 +1,35 @@
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+aidl_interface {
+ name: "android.hardware.ir",
+ vendor_available: true,
+ srcs: ["android/hardware/ir/*.aidl"],
+ stability: "vintf",
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ sdk_version: "module_current",
+ },
+ ndk: {
+ separate_platform_variant: false,
+ vndk: {
+ // TODO(b/206116595) enable this
+ enabled: false,
+ },
+ },
+ },
+}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl b/ir/aidl/aidl_api/android.hardware.ir/current/android/hardware/ir/ConsumerIrFreqRange.aidl
similarity index 85%
copy from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
copy to ir/aidl/aidl_api/android.hardware.ir/current/android/hardware/ir/ConsumerIrFreqRange.aidl
index df07c9c..4a0d286 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
+++ b/ir/aidl/aidl_api/android.hardware.ir/current/android/hardware/ir/ConsumerIrFreqRange.aidl
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2021, The Android Open Source Project
+/*
+ * Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,9 +31,9 @@
// 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.composer3;
+package android.hardware.ir;
@VintfStability
-parcelable ColorTransformPayload {
- float[] matrix;
- android.hardware.graphics.common.ColorTransform hint;
+parcelable ConsumerIrFreqRange {
+ int minHz;
+ int maxHz;
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl b/ir/aidl/aidl_api/android.hardware.ir/current/android/hardware/ir/IConsumerIr.aidl
similarity index 84%
copy from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
copy to ir/aidl/aidl_api/android.hardware.ir/current/android/hardware/ir/IConsumerIr.aidl
index df07c9c..056a8b1 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
+++ b/ir/aidl/aidl_api/android.hardware.ir/current/android/hardware/ir/IConsumerIr.aidl
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2021, The Android Open Source Project
+/*
+ * Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,9 +31,9 @@
// 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.composer3;
+package android.hardware.ir;
@VintfStability
-parcelable ColorTransformPayload {
- float[] matrix;
- android.hardware.graphics.common.ColorTransform hint;
+interface IConsumerIr {
+ android.hardware.ir.ConsumerIrFreqRange[] getCarrierFreqs();
+ void transmit(in int carrierFreq, in int[] pattern);
}
diff --git a/ir/aidl/android/hardware/ir/ConsumerIrFreqRange.aidl b/ir/aidl/android/hardware/ir/ConsumerIrFreqRange.aidl
new file mode 100644
index 0000000..ab0276a
--- /dev/null
+++ b/ir/aidl/android/hardware/ir/ConsumerIrFreqRange.aidl
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.ir;
+
+@VintfStability
+parcelable ConsumerIrFreqRange {
+ int minHz;
+ int maxHz;
+}
diff --git a/ir/aidl/android/hardware/ir/IConsumerIr.aidl b/ir/aidl/android/hardware/ir/IConsumerIr.aidl
new file mode 100644
index 0000000..d14fa56
--- /dev/null
+++ b/ir/aidl/android/hardware/ir/IConsumerIr.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.ir;
+
+import android.hardware.ir.ConsumerIrFreqRange;
+
+@VintfStability
+interface IConsumerIr {
+ /**
+ * Enumerates which frequencies the IR transmitter supports.
+ *
+ * Status OK (EX_NONE) on success.
+ *
+ * @return - an array of all supported frequency ranges.
+ */
+ ConsumerIrFreqRange[] getCarrierFreqs();
+
+ /**
+ * Sends an IR pattern at a given frequency in HZ.
+ *
+ * The pattern is alternating series of carrier on and off periods measured in
+ * microseconds. The carrier should be turned off at the end of a transmit
+ * even if there are and odd number of entries in the pattern array.
+ *
+ * This call must return when the transmit is complete or encounters an error.
+ *
+ * Status OK (EX_NONE) on success.
+ * EX_UNSUPPORTED_OPERATION when the frequency is not supported.
+ */
+ void transmit(in int carrierFreq, in int[] pattern);
+}
diff --git a/ir/aidl/default/Android.bp b/ir/aidl/default/Android.bp
new file mode 100644
index 0000000..6519664
--- /dev/null
+++ b/ir/aidl/default/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Example binder service of the ir HAL.
+cc_binary {
+ name: "android.hardware.ir-service.example",
+ relative_install_path: "hw",
+ init_rc: ["android.hardware.ir-service.example.rc"],
+ vendor: true,
+ vintf_fragments: ["android.hardware.ir-service.example.xml"],
+
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "libcutils",
+ "liblog",
+ "libutils",
+ "android.hardware.ir-V1-ndk",
+ ],
+
+ srcs: ["main.cpp"],
+}
diff --git a/ir/aidl/default/android.hardware.ir-service.example.rc b/ir/aidl/default/android.hardware.ir-service.example.rc
new file mode 100644
index 0000000..56def64
--- /dev/null
+++ b/ir/aidl/default/android.hardware.ir-service.example.rc
@@ -0,0 +1,4 @@
+service vendor.ir-default /vendor/bin/hw/android.hardware.ir-service.example
+ class hal
+ user nobody
+ group nobody
diff --git a/ir/aidl/default/android.hardware.ir-service.example.xml b/ir/aidl/default/android.hardware.ir-service.example.xml
new file mode 100644
index 0000000..1a63520
--- /dev/null
+++ b/ir/aidl/default/android.hardware.ir-service.example.xml
@@ -0,0 +1,7 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.ir</name>
+ <version>1</version>
+ <fqname>IConsumerIr/default</fqname>
+ </hal>
+</manifest>
diff --git a/ir/aidl/default/main.cpp b/ir/aidl/default/main.cpp
new file mode 100644
index 0000000..764aeaf
--- /dev/null
+++ b/ir/aidl/default/main.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/ir/BnConsumerIr.h>
+#include <android-base/logging.h>
+#include <android/binder_interface_utils.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <numeric>
+
+namespace aidl::android::hardware::ir {
+
+const std::vector<ConsumerIrFreqRange> kSupportedFreqs = {
+ {2000, 4000},
+ {10000, 30000},
+};
+
+class ConsumerIr : public BnConsumerIr {
+ ::ndk::ScopedAStatus getCarrierFreqs(std::vector<ConsumerIrFreqRange>* _aidl_return) override;
+ ::ndk::ScopedAStatus transmit(int32_t in_carrierFreq,
+ const std::vector<int32_t>& in_pattern) override;
+};
+
+::ndk::ScopedAStatus ConsumerIr::getCarrierFreqs(std::vector<ConsumerIrFreqRange>* _aidl_return) {
+ *_aidl_return = kSupportedFreqs;
+ return ::ndk::ScopedAStatus::ok();
+}
+
+bool isSupportedFreq(int32_t freq) {
+ for (const auto& range : kSupportedFreqs) {
+ if (freq >= range.minHz && freq <= range.maxHz) return true;
+ }
+ return false;
+}
+
+::ndk::ScopedAStatus ConsumerIr::transmit(int32_t in_carrierFreq,
+ const std::vector<int32_t>& in_pattern) {
+ if (isSupportedFreq(in_carrierFreq)) {
+ // trasmit the pattern, each integer is number of microseconds in an
+ // alternating on/off state.
+ usleep(std::accumulate(in_pattern.begin(), in_pattern.end(), 0));
+ return ::ndk::ScopedAStatus::ok();
+ } else {
+ // unsupported operation
+ return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ return ::ndk::ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::ir
+
+using aidl::android::hardware::ir::ConsumerIr;
+
+int main() {
+ auto binder = ::ndk::SharedRefBase::make<ConsumerIr>();
+ const std::string name = std::string() + ConsumerIr::descriptor + "/default";
+ CHECK_EQ(STATUS_OK, AServiceManager_addService(binder->asBinder().get(), name.c_str()))
+ << "Failed to register " << name;
+
+ ABinderProcess_setThreadPoolMaxThreadCount(0);
+ ABinderProcess_joinThreadPool();
+
+ return EXIT_FAILURE; // should not reached
+}
diff --git a/ir/aidl/vts/Android.bp b/ir/aidl/vts/Android.bp
new file mode 100644
index 0000000..c2491b8
--- /dev/null
+++ b/ir/aidl/vts/Android.bp
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_test {
+ name: "VtsHalIrTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ srcs: ["VtsHalIrTargetTest.cpp"],
+ shared_libs: [
+ "libbinder_ndk",
+ ],
+ static_libs: [
+ "android.hardware.ir-V1-ndk",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/ir/aidl/vts/VtsHalIrTargetTest.cpp b/ir/aidl/vts/VtsHalIrTargetTest.cpp
new file mode 100644
index 0000000..3527625
--- /dev/null
+++ b/ir/aidl/vts/VtsHalIrTargetTest.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "ir_aidl_hal_test"
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/ir/IConsumerIr.h>
+#include <android-base/logging.h>
+#include <android/binder_auto_utils.h>
+#include <android/binder_manager.h>
+#include <gtest/gtest.h>
+#include <algorithm>
+#include <vector>
+
+using ::aidl::android::hardware::ir::ConsumerIrFreqRange;
+using ::aidl::android::hardware::ir::IConsumerIr;
+using ::ndk::SpAIBinder;
+
+class ConsumerIrTest : public ::testing::TestWithParam<std::string> {
+ public:
+ virtual void SetUp() override {
+ mIr = IConsumerIr::fromBinder(
+ SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(mIr, nullptr);
+ }
+
+ std::shared_ptr<IConsumerIr> mIr;
+};
+
+// Test transmit() for the min and max frequency of every available range
+TEST_P(ConsumerIrTest, TransmitTest) {
+ std::vector<ConsumerIrFreqRange> ranges;
+ const auto& ret = mIr->getCarrierFreqs(&ranges);
+ ASSERT_TRUE(ret.isOk());
+
+ if (ranges.size() > 0) {
+ uint32_t len = 16;
+ std::vector<int32_t> vec;
+ vec.resize(len);
+ std::fill(vec.begin(), vec.end(), 1000);
+ for (auto range = ranges.begin(); range != ranges.end(); range++) {
+ EXPECT_TRUE(mIr->transmit(range->minHz, vec).isOk());
+ EXPECT_TRUE(mIr->transmit(range->maxHz, vec).isOk());
+ }
+ }
+}
+
+// Test transmit() when called with invalid frequencies
+TEST_P(ConsumerIrTest, BadFreqTest) {
+ uint32_t len = 16;
+ std::vector<int32_t> vec;
+ vec.resize(len);
+ std::fill(vec.begin(), vec.end(), 1);
+ const auto& res = mIr->transmit(-1, vec);
+ EXPECT_FALSE(res.isOk());
+ EXPECT_EQ(res.getExceptionCode(), EX_UNSUPPORTED_OPERATION);
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ConsumerIrTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, ConsumerIrTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IConsumerIr::descriptor)),
+ ::android::PrintInstanceNameToString);
diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp
new file mode 100644
index 0000000..935d2e5
--- /dev/null
+++ b/radio/aidl/vts/Android.bp
@@ -0,0 +1,71 @@
+// Copyright 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_test {
+ name: "VtsHalRadioTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ srcs: [
+ "radio_aidl_hal_utils.cpp",
+ "radio_data_indication.cpp",
+ "radio_data_response.cpp",
+ "radio_data_test.cpp",
+ "radio_messaging_indication.cpp",
+ "radio_messaging_response.cpp",
+ "radio_messaging_test.cpp",
+ "radio_modem_indication.cpp",
+ "radio_modem_response.cpp",
+ "radio_modem_test.cpp",
+ "radio_network_indication.cpp",
+ "radio_network_response.cpp",
+ "radio_network_test.cpp",
+ "radio_sim_indication.cpp",
+ "radio_sim_response.cpp",
+ "radio_sim_test.cpp",
+ "radio_voice_indication.cpp",
+ "radio_voice_response.cpp",
+ "radio_voice_test.cpp",
+ "VtsHalRadioTargetTest.cpp",
+ ],
+ shared_libs: [
+ "libbinder_ndk",
+ "libvintf",
+ ],
+ static_libs: [
+ "android.hardware.radio-V1-ndk",
+ "android.hardware.radio.config-V1-ndk",
+ "android.hardware.radio.data-V1-ndk",
+ "android.hardware.radio.messaging-V1-ndk",
+ "android.hardware.radio.modem-V1-ndk",
+ "android.hardware.radio.network-V1-ndk",
+ "android.hardware.radio.sim-V1-ndk",
+ "android.hardware.radio.voice-V1-ndk",
+ ],
+ // TODO(b/210712359): enable after b/207695009 is resolved.
+ //test_suites: [
+ // "general-tests",
+ // "vts",
+ //],
+}
diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
new file mode 100644
index 0000000..e829f8e
--- /dev/null
+++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android/binder_process.h>
+
+#include "radio_data_utils.h"
+#include "radio_messaging_utils.h"
+#include "radio_modem_utils.h"
+#include "radio_network_utils.h"
+#include "radio_sim_utils.h"
+#include "radio_voice_utils.h"
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioDataTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioDataTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioData::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioMessagingTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioMessagingTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioMessaging::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioModemTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioModemTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioModem::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioNetworkTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioNetworkTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioNetwork::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioSimTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance, RadioSimTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioSim::descriptor)),
+ android::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioVoiceTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioVoiceTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioVoice::descriptor)),
+ android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.cpp b/radio/aidl/vts/radio_aidl_hal_utils.cpp
new file mode 100644
index 0000000..14a16c0
--- /dev/null
+++ b/radio/aidl/vts/radio_aidl_hal_utils.cpp
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "RadioTest"
+
+#include "radio_aidl_hal_utils.h"
+#include <iostream>
+#include "VtsCoreUtil.h"
+
+using namespace aidl::android::hardware::radio::network;
+
+#define WAIT_TIMEOUT_PERIOD 75
+
+aidl::android::hardware::radio::sim::CardStatus cardStatus = {};
+
+int GetRandomSerialNumber() {
+ return rand();
+}
+
+::testing::AssertionResult CheckAnyOfErrors(RadioError err, std::vector<RadioError> errors,
+ CheckFlag flag) {
+ const static std::vector<RadioError> generalErrors = {
+ RadioError::RADIO_NOT_AVAILABLE, RadioError::NO_MEMORY,
+ RadioError::INTERNAL_ERR, RadioError::SYSTEM_ERR,
+ RadioError::REQUEST_NOT_SUPPORTED, RadioError::CANCELLED};
+ if (flag == CHECK_GENERAL_ERROR || flag == CHECK_OEM_AND_GENERAL_ERROR) {
+ for (size_t i = 0; i < generalErrors.size(); i++) {
+ if (err == generalErrors[i]) {
+ return testing::AssertionSuccess();
+ }
+ }
+ }
+ if (flag == CHECK_OEM_ERROR || flag == CHECK_OEM_AND_GENERAL_ERROR) {
+ if (err >= RadioError::OEM_ERROR_1 && err <= RadioError::OEM_ERROR_25) {
+ return testing::AssertionSuccess();
+ }
+ }
+ for (size_t i = 0; i < errors.size(); i++) {
+ if (err == errors[i]) {
+ return testing::AssertionSuccess();
+ }
+ }
+ return testing::AssertionFailure() << "RadioError:" + toString(err) + " is returned";
+}
+
+// Runs "pm list features" and attempts to find the specified feature in its output.
+bool deviceSupportsFeature(const char* feature) {
+ bool hasFeature = false;
+ FILE* p = popen("/system/bin/pm list features", "re");
+ if (p) {
+ char* line = NULL;
+ size_t len = 0;
+ while (getline(&line, &len, p) > 0) {
+ if (strstr(line, feature)) {
+ hasFeature = true;
+ break;
+ }
+ }
+ pclose(p);
+ } else {
+ __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, "popen failed: %d", errno);
+ _exit(EXIT_FAILURE);
+ }
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Feature %s: %ssupported", feature,
+ hasFeature ? "" : "not ");
+ return hasFeature;
+}
+
+bool isSsSsEnabled() {
+ // Do not use checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "")
+ // until b/148904287 is fixed. We need exact matching instead of partial matching. (i.e.
+ // by definition the empty string "" is a substring of any string).
+ return !isDsDsEnabled() && !isTsTsEnabled();
+}
+
+bool isDsDsEnabled() {
+ return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsds");
+}
+
+bool isTsTsEnabled() {
+ return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "tsts");
+}
+
+bool isVoiceInService(RegState state) {
+ return RegState::REG_HOME == state || RegState::REG_ROAMING == state;
+}
+
+bool isVoiceEmergencyOnly(RegState state) {
+ return RegState::NOT_REG_MT_NOT_SEARCHING_OP_EM == state ||
+ RegState::NOT_REG_MT_SEARCHING_OP_EM == state || RegState::REG_DENIED_EM == state ||
+ RegState::UNKNOWN_EM == state;
+}
+
+bool isServiceValidForDeviceConfiguration(std::string& serviceName) {
+ if (isSsSsEnabled()) {
+ // Device is configured as SSSS.
+ if (serviceName != RADIO_SERVICE_SLOT1_NAME) {
+ ALOGI("%s instance is not valid for SSSS device.", serviceName.c_str());
+ return false;
+ }
+ } else if (isDsDsEnabled()) {
+ // Device is configured as DSDS.
+ if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME) {
+ ALOGI("%s instance is not valid for DSDS device.", serviceName.c_str());
+ return false;
+ }
+ } else if (isTsTsEnabled()) {
+ // Device is configured as TSTS.
+ if (serviceName != RADIO_SERVICE_SLOT1_NAME && serviceName != RADIO_SERVICE_SLOT2_NAME &&
+ serviceName != RADIO_SERVICE_SLOT3_NAME) {
+ ALOGI("%s instance is not valid for TSTS device.", serviceName.c_str());
+ return false;
+ }
+ }
+ return true;
+}
+
+/*
+ * Notify that the response message is received.
+ */
+void RadioResponseWaiter::notify(int receivedSerial) {
+ std::unique_lock<std::mutex> lock(mtx_);
+ if (serial == receivedSerial) {
+ count_++;
+ cv_.notify_one();
+ }
+}
+
+/*
+ * Wait till the response message is notified or till WAIT_TIMEOUT_PERIOD.
+ */
+std::cv_status RadioResponseWaiter::wait() {
+ std::unique_lock<std::mutex> lock(mtx_);
+ std::cv_status status = std::cv_status::no_timeout;
+ auto now = std::chrono::system_clock::now();
+ while (count_ == 0) {
+ status = cv_.wait_until(lock, now + std::chrono::seconds(WAIT_TIMEOUT_PERIOD));
+ if (status == std::cv_status::timeout) {
+ return status;
+ }
+ }
+ count_--;
+ return status;
+}
+
+/**
+ * Specific features on the Radio HAL rely on Radio HAL Capabilities.
+ * The VTS test related to those features must not run if the related capability is disabled.
+ * Typical usage within VTS: if (getRadioHalCapabilities()) return;
+ */
+bool RadioResponseWaiter::getRadioHalCapabilities() {
+ // TODO(b/210712359): implement after RadioConfig VTS is created
+ /**
+ // Get HalDeviceCapabilities from the radio config
+ std::shared_ptr<RadioConfigResponse> radioConfigRsp = new (std::nothrow)
+ RadioConfigResponse(*this); radioConfig->setResponseFunctions(radioConfigRsp, nullptr); serial =
+ GetRandomSerialNumber();
+
+ radioConfig->getHalDeviceCapabilities(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ return radioConfigRsp->modemReducedFeatureSet1;
+ **/
+ return true;
+}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h
new file mode 100644
index 0000000..2f31fa8
--- /dev/null
+++ b/radio/aidl/vts/radio_aidl_hal_utils.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/radio/RadioError.h>
+#include <aidl/android/hardware/radio/network/RegState.h>
+#include <aidl/android/hardware/radio/sim/CardStatus.h>
+#include <utils/Log.h>
+#include <vector>
+
+using namespace aidl::android::hardware::radio;
+using aidl::android::hardware::radio::sim::CardStatus;
+
+extern CardStatus cardStatus;
+
+/*
+ * MACRO used to skip test case when radio response return error REQUEST_NOT_SUPPORTED
+ * on HAL versions which has deprecated the request interfaces. The MACRO can only be used
+ * AFTER receiving radio response.
+ */
+#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, __radio__, __radioRsp__) \
+ do { \
+ sp<::android::hardware::radio::V##__ver__::IRadio> __radio = \
+ ::android::hardware::radio::V##__ver__::IRadio::castFrom(__radio__); \
+ if (__radio && __radioRsp__->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED) { \
+ GTEST_SKIP() << "REQUEST_NOT_SUPPORTED"; \
+ } \
+ } while (0)
+
+enum CheckFlag {
+ CHECK_DEFAULT = 0,
+ CHECK_GENERAL_ERROR = 1,
+ CHECK_OEM_ERROR = 2,
+ CHECK_OEM_AND_GENERAL_ERROR = 3,
+ CHECK_SAP_ERROR = 4,
+};
+
+static constexpr const char* FEATURE_VOICE_CALL = "android.software.connectionservice";
+
+static constexpr const char* FEATURE_TELEPHONY = "android.hardware.telephony";
+
+static constexpr const char* FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
+
+static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
+
+#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
+#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
+#define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2
+
+#define RADIO_SERVICE_SLOT1_NAME "slot1" // HAL instance name for SIM slot 1 or single SIM device
+#define RADIO_SERVICE_SLOT2_NAME "slot2" // HAL instance name for SIM slot 2 on dual SIM device
+#define RADIO_SERVICE_SLOT3_NAME "slot3" // HAL instance name for SIM slot 3 on triple SIM device
+
+/*
+ * Generate random serial number for radio test
+ */
+int GetRandomSerialNumber();
+
+/*
+ * Check multiple radio error codes which are possibly returned because of the different
+ * vendor/devices implementations. It allows optional checks for general errors or/and oem errors.
+ */
+::testing::AssertionResult CheckAnyOfErrors(RadioError err, std::vector<RadioError> generalError,
+ CheckFlag flag = CHECK_DEFAULT);
+
+/*
+ * Check if device supports feature.
+ */
+bool deviceSupportsFeature(const char* feature);
+
+/*
+ * Check if device is in SsSs (Single SIM Single Standby).
+ */
+bool isSsSsEnabled();
+
+/*
+ * Check if device is in DSDS (Dual SIM Dual Standby).
+ */
+bool isDsDsEnabled();
+
+/*
+ * Check if device is in TSTS (Triple SIM Triple Standby).
+ */
+bool isTsTsEnabled();
+
+/*
+ * Check if voice status is in emergency only.
+ */
+bool isVoiceEmergencyOnly(aidl::android::hardware::radio::network::RegState state);
+
+/*
+ * Check if voice status is in service.
+ */
+bool isVoiceInService(aidl::android::hardware::radio::network::RegState state);
+
+/*
+ * Check if service is valid for device configuration
+ */
+bool isServiceValidForDeviceConfiguration(std::string& serviceName);
+
+/**
+ * Used when waiting for an asynchronous response from the HAL.
+ */
+class RadioResponseWaiter {
+ protected:
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int count_;
+
+ public:
+ /* Serial number for radio request */
+ int serial;
+
+ /* Used as a mechanism to inform the test about data/event callback */
+ void notify(int receivedSerial);
+
+ /* Test code calls this function to wait for response */
+ std::cv_status wait();
+
+ // TODO(b/210712359): this probably isn't the best place to put this, but it works for now
+ // since all RadioXTest extend RadioResponseWaiter
+ /* Used to get the radio HAL capabilities */
+ bool getRadioHalCapabilities();
+};
diff --git a/radio/aidl/vts/radio_data_indication.cpp b/radio/aidl/vts/radio_data_indication.cpp
new file mode 100644
index 0000000..1e02fe1
--- /dev/null
+++ b/radio/aidl/vts/radio_data_indication.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_data_utils.h"
+
+RadioDataIndication::RadioDataIndication(RadioDataTest& parent) : parent_data(parent) {}
+
+ndk::ScopedAStatus RadioDataIndication::dataCallListChanged(
+ RadioIndicationType /*type*/, const std::vector<SetupDataCallResult>& /*dcList*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataIndication::keepaliveStatus(RadioIndicationType /*type*/,
+ const KeepaliveStatus& /*status*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataIndication::pcoData(RadioIndicationType /*type*/,
+ const PcoDataInfo& /*pco*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataIndication::unthrottleApn(RadioIndicationType /*type*/,
+ const DataProfileInfo& /*dataProfileInfo*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_data_response.cpp b/radio/aidl/vts/radio_data_response.cpp
new file mode 100644
index 0000000..682ddfb
--- /dev/null
+++ b/radio/aidl/vts/radio_data_response.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_data_utils.h"
+
+RadioDataResponse::RadioDataResponse(RadioResponseWaiter& parent) : parent_data(parent) {}
+
+ndk::ScopedAStatus RadioDataResponse::acknowledgeRequest(int32_t /*serial*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::allocatePduSessionIdResponse(const RadioResponseInfo& info,
+ int32_t id) {
+ rspInfo = info;
+ allocatedPduSessionId = id;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::cancelHandoverResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::deactivateDataCallResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::getDataCallListResponse(
+ const RadioResponseInfo& info, const std::vector<SetupDataCallResult>& /*dcResponse*/) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::getSlicingConfigResponse(
+ const RadioResponseInfo& info, const SlicingConfig& /*slicingConfig*/) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::releasePduSessionIdResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::setDataThrottlingResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::setInitialAttachApnResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::setupDataCallResponse(const RadioResponseInfo& info,
+ const SetupDataCallResult& dcResponse) {
+ rspInfo = info;
+ setupDataCallResult = dcResponse;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::startHandoverResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_data.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
+ const KeepaliveStatus& /*status*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioDataResponse::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp
new file mode 100644
index 0000000..dbf0eb7
--- /dev/null
+++ b/radio/aidl/vts/radio_data_test.cpp
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <algorithm>
+
+#include "radio_data_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioDataTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_data = IRadioData::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_data.get());
+
+ radioRsp_data = ndk::SharedRefBase::make<RadioDataResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_data.get());
+
+ count_ = 0;
+
+ radioInd_data = ndk::SharedRefBase::make<RadioDataIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_data.get());
+
+ radio_data->setResponseFunctions(radioRsp_data, radioInd_data);
+
+ // Assert IRadioConfig exists before testing
+ std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
+ aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(
+ "android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radioConfig.get());
+}
+
+ndk::ScopedAStatus RadioDataTest::getDataCallList() {
+ serial = GetRandomSerialNumber();
+ radio_data->getDataCallList(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ return ndk::ScopedAStatus::ok();
+}
+
+/*
+ * Test IRadioData.setupDataCall() for the response returned.
+ */
+TEST_P(RadioDataTest, setupDataCall) {
+ serial = GetRandomSerialNumber();
+
+ AccessNetwork accessNetwork = AccessNetwork::EUTRAN;
+
+ DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
+ dataProfileInfo.apn = std::string("internet");
+ dataProfileInfo.protocol = PdpProtocolType::IP;
+ dataProfileInfo.roamingProtocol = PdpProtocolType::IP;
+ dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.user = std::string("username");
+ dataProfileInfo.password = std::string("password");
+ dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
+ dataProfileInfo.maxConnsTime = 300;
+ dataProfileInfo.maxConns = 20;
+ dataProfileInfo.waitTime = 0;
+ dataProfileInfo.enabled = true;
+ // TODO(b/210712359): 320 was the previous value; need to support bitmaps
+ dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
+ // TODO(b/210712359): 161543 was the previous value; need to support bitmaps
+ dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
+ dataProfileInfo.mtuV4 = 0;
+ dataProfileInfo.mtuV6 = 0;
+ dataProfileInfo.preferred = true;
+ dataProfileInfo.persistent = false;
+
+ bool roamingAllowed = false;
+
+ std::vector<LinkAddress> addresses = {};
+ std::vector<std::string> dnses = {};
+
+ DataRequestReason reason = DataRequestReason::NORMAL;
+ SliceInfo sliceInfo;
+ bool matchAllRuleAllowed = true;
+
+ ndk::ScopedAStatus res =
+ radio_data->setupDataCall(serial, accessNetwork, dataProfileInfo, roamingAllowed,
+ reason, addresses, dnses, -1, sliceInfo, matchAllRuleAllowed);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ }
+}
+
+/*
+ * Test IRadioData.setupDataCall() with osAppId for the response returned.
+ */
+TEST_P(RadioDataTest, setupDataCall_osAppId) {
+ serial = GetRandomSerialNumber();
+
+ AccessNetwork accessNetwork = AccessNetwork::EUTRAN;
+
+ TrafficDescriptor trafficDescriptor;
+ OsAppId osAppId;
+ std::string osAppIdString("osAppId");
+ // TODO(b/210712359): there should be a cleaner way to convert this
+ std::vector<unsigned char> output(osAppIdString.length());
+ std::transform(osAppIdString.begin(), osAppIdString.end(), output.begin(),
+ [](char c) { return static_cast<unsigned char>(c); });
+ osAppId.osAppId = output;
+ trafficDescriptor.osAppId = osAppId;
+
+ DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
+ dataProfileInfo.apn = std::string("internet");
+ dataProfileInfo.protocol = PdpProtocolType::IP;
+ dataProfileInfo.roamingProtocol = PdpProtocolType::IP;
+ dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.user = std::string("username");
+ dataProfileInfo.password = std::string("password");
+ dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
+ dataProfileInfo.maxConnsTime = 300;
+ dataProfileInfo.maxConns = 20;
+ dataProfileInfo.waitTime = 0;
+ dataProfileInfo.enabled = true;
+ // TODO(b/210712359): 320 was the previous value; need to support bitmaps
+ dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
+ // TODO(b/210712359): 161543 was the previous value; need to support bitmaps
+ dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
+ dataProfileInfo.mtuV4 = 0;
+ dataProfileInfo.mtuV6 = 0;
+ dataProfileInfo.preferred = true;
+ dataProfileInfo.persistent = false;
+ dataProfileInfo.trafficDescriptor = trafficDescriptor;
+
+ bool roamingAllowed = false;
+
+ std::vector<LinkAddress> addresses = {};
+ std::vector<std::string> dnses = {};
+
+ DataRequestReason reason = DataRequestReason::NORMAL;
+ SliceInfo sliceInfo;
+ bool matchAllRuleAllowed = true;
+
+ ndk::ScopedAStatus res =
+ radio_data->setupDataCall(serial, accessNetwork, dataProfileInfo, roamingAllowed,
+ reason, addresses, dnses, -1, sliceInfo, matchAllRuleAllowed);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ if (radioRsp_data->setupDataCallResult.trafficDescriptors.size() <= 0) {
+ return;
+ }
+ EXPECT_EQ(trafficDescriptor.osAppId.value().osAppId,
+ radioRsp_data->setupDataCallResult.trafficDescriptors[0].osAppId.value().osAppId);
+ }
+}
+
+/*
+ * Test IRadioData.getSlicingConfig() for the response returned.
+ */
+TEST_P(RadioDataTest, getSlicingConfig) {
+ serial = GetRandomSerialNumber();
+ radio_data->getSlicingConfig(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+ if (getRadioHalCapabilities()) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::REQUEST_NOT_SUPPORTED}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::INTERNAL_ERR, RadioError::MODEM_ERR}));
+ }
+}
+
+/*
+ * Test IRadioData.setDataThrottling() for the response returned.
+ */
+TEST_P(RadioDataTest, setDataThrottling) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_data->setDataThrottling(
+ serial, DataThrottlingAction::THROTTLE_SECONDARY_CARRIER, 60000);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+ if (getRadioHalCapabilities()) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
+ RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
+ }
+
+ sleep(1);
+ serial = GetRandomSerialNumber();
+
+ res = radio_data->setDataThrottling(serial, DataThrottlingAction::THROTTLE_ANCHOR_CARRIER,
+ 60000);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+ if (getRadioHalCapabilities()) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
+ RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
+ }
+
+ sleep(1);
+ serial = GetRandomSerialNumber();
+
+ res = radio_data->setDataThrottling(serial, DataThrottlingAction::HOLD, 60000);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+ if (getRadioHalCapabilities()) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
+ RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
+ }
+
+ sleep(1);
+ serial = GetRandomSerialNumber();
+
+ res = radio_data->setDataThrottling(serial, DataThrottlingAction::NO_DATA_THROTTLING, 60000);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
+ if (getRadioHalCapabilities()) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
+ {RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR,
+ RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
+ }
+
+ sleep(1);
+}
diff --git a/radio/aidl/vts/radio_data_utils.h b/radio/aidl/vts/radio_data_utils.h
new file mode 100644
index 0000000..ada8ac1
--- /dev/null
+++ b/radio/aidl/vts/radio_data_utils.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/data/BnRadioDataIndication.h>
+#include <aidl/android/hardware/radio/data/BnRadioDataResponse.h>
+#include <aidl/android/hardware/radio/data/IRadioData.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::data;
+using aidl::android::hardware::radio::sim::CardStatus;
+
+class RadioDataTest;
+
+/* Callback class for radio data response */
+class RadioDataResponse : public BnRadioDataResponse {
+ protected:
+ RadioResponseWaiter& parent_data;
+
+ public:
+ RadioDataResponse(RadioResponseWaiter& parent_data);
+ virtual ~RadioDataResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ int32_t allocatedPduSessionId;
+ SetupDataCallResult setupDataCallResult;
+
+ virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
+
+ virtual ndk::ScopedAStatus allocatePduSessionIdResponse(const RadioResponseInfo& info,
+ int32_t id) override;
+
+ virtual ndk::ScopedAStatus cancelHandoverResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus deactivateDataCallResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getDataCallListResponse(
+ const RadioResponseInfo& info,
+ const std::vector<SetupDataCallResult>& dcResponse) override;
+
+ virtual ndk::ScopedAStatus getSlicingConfigResponse(
+ const RadioResponseInfo& info, const SlicingConfig& slicingConfig) override;
+
+ virtual ndk::ScopedAStatus releasePduSessionIdResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setDataAllowedResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setDataProfileResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setDataThrottlingResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setInitialAttachApnResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setupDataCallResponse(
+ const RadioResponseInfo& info, const SetupDataCallResult& dcResponse) override;
+
+ virtual ndk::ScopedAStatus startHandoverResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus startKeepaliveResponse(const RadioResponseInfo& info,
+ const KeepaliveStatus& status) override;
+
+ virtual ndk::ScopedAStatus stopKeepaliveResponse(const RadioResponseInfo& info) override;
+};
+
+/* Callback class for radio data indication */
+class RadioDataIndication : public BnRadioDataIndication {
+ protected:
+ RadioDataTest& parent_data;
+
+ public:
+ RadioDataIndication(RadioDataTest& parent_data);
+ virtual ~RadioDataIndication() = default;
+
+ virtual ndk::ScopedAStatus dataCallListChanged(
+ RadioIndicationType type, const std::vector<SetupDataCallResult>& dcList) override;
+
+ virtual ndk::ScopedAStatus keepaliveStatus(RadioIndicationType type,
+ const KeepaliveStatus& status) override;
+
+ virtual ndk::ScopedAStatus pcoData(RadioIndicationType type, const PcoDataInfo& pco) override;
+
+ virtual ndk::ScopedAStatus unthrottleApn(RadioIndicationType type,
+ const DataProfileInfo& dataProfile) override;
+};
+
+// The main test class for Radio AIDL Data.
+class RadioDataTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+ protected:
+ /* Get current data call list */
+ ndk::ScopedAStatus getDataCallList();
+
+ public:
+ virtual void SetUp() override;
+
+ /* radio data service handle */
+ std::shared_ptr<IRadioData> radio_data;
+ /* radio data response handle */
+ std::shared_ptr<RadioDataResponse> radioRsp_data;
+ /* radio data indication handle */
+ std::shared_ptr<RadioDataIndication> radioInd_data;
+};
diff --git a/radio/aidl/vts/radio_messaging_indication.cpp b/radio/aidl/vts/radio_messaging_indication.cpp
new file mode 100644
index 0000000..7eeb266
--- /dev/null
+++ b/radio/aidl/vts/radio_messaging_indication.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_messaging_utils.h"
+
+RadioMessagingIndication::RadioMessagingIndication(RadioMessagingTest& parent)
+ : parent_messaging(parent) {}
+
+ndk::ScopedAStatus RadioMessagingIndication::cdmaNewSms(RadioIndicationType /*type*/,
+ const CdmaSmsMessage& /*msg*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingIndication::cdmaRuimSmsStorageFull(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingIndication::newBroadcastSms(RadioIndicationType /*type*/,
+ const std::vector<uint8_t>& /*data*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingIndication::newSms(RadioIndicationType /*type*/,
+ const std::vector<uint8_t>& /*pdu*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingIndication::newSmsOnSim(RadioIndicationType /*type*/,
+ int32_t /*recordNumber*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingIndication::newSmsStatusReport(
+ RadioIndicationType /*type*/, const std::vector<uint8_t>& /*pdu*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingIndication::onUssd(RadioIndicationType /*type*/,
+ UssdModeType /*modeType*/,
+ const std::string& /*msg*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingIndication::simSmsStorageFull(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_messaging_response.cpp b/radio/aidl/vts/radio_messaging_response.cpp
new file mode 100644
index 0000000..d73278f
--- /dev/null
+++ b/radio/aidl/vts/radio_messaging_response.cpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_messaging_utils.h"
+
+RadioMessagingResponse::RadioMessagingResponse(RadioResponseWaiter& parent)
+ : parent_messaging(parent) {}
+
+ndk::ScopedAStatus RadioMessagingResponse::acknowledgeIncomingGsmSmsWithPduResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingCdmaSmsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingGsmSmsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::acknowledgeRequest(int32_t /*serial*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::cancelPendingUssdResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnRuimResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnSimResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::getCdmaBroadcastConfigResponse(
+ const RadioResponseInfo& /*info*/,
+ const std::vector<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::getGsmBroadcastConfigResponse(
+ const RadioResponseInfo& /*info*/,
+ const std::vector<GsmBroadcastSmsConfigInfo>& /*configs*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::getSmscAddressResponse(const RadioResponseInfo& /*info*/,
+ const std::string& /*smsc*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::reportSmsMemoryStatusResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::sendCdmaSmsExpectMoreResponse(
+ const RadioResponseInfo& info, const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_messaging.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::sendCdmaSmsResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_messaging.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::sendImsSmsResponse(const RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::sendSmsExpectMoreResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_messaging.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::sendSmsResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_messaging.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::sendUssdResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastActivationResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastConfigResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastActivationResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastConfigResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::setSmscAddressResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*index*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioMessagingResponse::writeSmsToSimResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*index*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_messaging_test.cpp b/radio/aidl/vts/radio_messaging_test.cpp
new file mode 100644
index 0000000..58aeaab
--- /dev/null
+++ b/radio/aidl/vts/radio_messaging_test.cpp
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_messaging_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioMessagingTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_messaging = IRadioMessaging::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_messaging.get());
+
+ radioRsp_messaging = ndk::SharedRefBase::make<RadioMessagingResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_messaging.get());
+
+ count_ = 0;
+
+ radioInd_messaging = ndk::SharedRefBase::make<RadioMessagingIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_messaging.get());
+
+ radio_messaging->setResponseFunctions(radioRsp_messaging, radioInd_messaging);
+
+ // Assert IRadioConfig exists before testing
+ std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
+ aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(
+ "android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radioConfig.get());
+}
+
+/*
+ * Test IRadioMessaging.sendSms() for the response returned.
+ */
+TEST_P(RadioMessagingTest, sendSms) {
+ LOG(DEBUG) << "sendSms";
+ serial = GetRandomSerialNumber();
+ GsmSmsMessage msg;
+ msg.smscPdu = "";
+ msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+
+ radio_messaging->sendSms(serial, msg);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ EXPECT_EQ(0, radioRsp_messaging->sendSmsResult.errorCode);
+ }
+ LOG(DEBUG) << "sendSms finished";
+}
+
+/*
+ * Test IRadioMessaging.sendSmsExpectMore() for the response returned.
+ */
+TEST_P(RadioMessagingTest, sendSmsExpectMore) {
+ LOG(DEBUG) << "sendSmsExpectMore";
+ serial = GetRandomSerialNumber();
+ GsmSmsMessage msg;
+ msg.smscPdu = "";
+ msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+
+ radio_messaging->sendSmsExpectMore(serial, msg);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendSmsExpectMore finished";
+}
+
+/*
+ * Test IRadioMessaging.sendCdmaSms() for the response returned.
+ */
+TEST_P(RadioMessagingTest, sendCdmaSms) {
+ LOG(DEBUG) << "sendCdmaSms";
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
+ cdmaSmsAddress.isNumberModeDataNetwork = false;
+ cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
+ cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+
+ // Create a CdmaSmsSubAddress
+ CdmaSmsSubaddress cdmaSmsSubaddress;
+ cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ CdmaSmsMessage cdmaSmsMessage;
+ cdmaSmsMessage.teleserviceId = 4098;
+ cdmaSmsMessage.isServicePresent = false;
+ cdmaSmsMessage.serviceCategory = 0;
+ cdmaSmsMessage.address = cdmaSmsAddress;
+ cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+ cdmaSmsMessage.bearerData =
+ (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+
+ radio_messaging->sendCdmaSms(serial, cdmaSmsMessage);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendCdmaSms finished";
+}
+
+/*
+ * Test IRadioMessaging.sendCdmaSmsExpectMore() for the response returned.
+ */
+TEST_P(RadioMessagingTest, sendCdmaSmsExpectMore) {
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
+ cdmaSmsAddress.isNumberModeDataNetwork = false;
+ cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
+ cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+
+ // Create a CdmaSmsSubAddress
+ CdmaSmsSubaddress cdmaSmsSubaddress;
+ cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ CdmaSmsMessage cdmaSmsMessage;
+ cdmaSmsMessage.teleserviceId = 4098;
+ cdmaSmsMessage.isServicePresent = false;
+ cdmaSmsMessage.serviceCategory = 0;
+ cdmaSmsMessage.address = cdmaSmsAddress;
+ cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+ cdmaSmsMessage.bearerData =
+ (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+
+ radio_messaging->sendCdmaSmsExpectMore(serial, cdmaSmsMessage);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_messaging->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+}
diff --git a/radio/aidl/vts/radio_messaging_utils.h b/radio/aidl/vts/radio_messaging_utils.h
new file mode 100644
index 0000000..96cde08
--- /dev/null
+++ b/radio/aidl/vts/radio_messaging_utils.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/messaging/BnRadioMessagingIndication.h>
+#include <aidl/android/hardware/radio/messaging/BnRadioMessagingResponse.h>
+#include <aidl/android/hardware/radio/messaging/IRadioMessaging.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::messaging;
+
+class RadioMessagingTest;
+
+/* Callback class for radio messaging response */
+class RadioMessagingResponse : public BnRadioMessagingResponse {
+ protected:
+ RadioResponseWaiter& parent_messaging;
+
+ public:
+ RadioMessagingResponse(RadioResponseWaiter& parent_messaging);
+ virtual ~RadioMessagingResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ SendSmsResult sendSmsResult;
+
+ virtual ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPduResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus acknowledgeLastIncomingCdmaSmsResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus acknowledgeLastIncomingGsmSmsResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
+
+ virtual ndk::ScopedAStatus cancelPendingUssdResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus deleteSmsOnRuimResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus deleteSmsOnSimResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getCdmaBroadcastConfigResponse(
+ const RadioResponseInfo& info,
+ const std::vector<CdmaBroadcastSmsConfigInfo>& configs) override;
+
+ virtual ndk::ScopedAStatus getGsmBroadcastConfigResponse(
+ const RadioResponseInfo& info,
+ const std::vector<GsmBroadcastSmsConfigInfo>& configs) override;
+
+ virtual ndk::ScopedAStatus getSmscAddressResponse(const RadioResponseInfo& info,
+ const std::string& smsc) override;
+
+ virtual ndk::ScopedAStatus reportSmsMemoryStatusResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) override;
+
+ virtual ndk::ScopedAStatus sendCdmaSmsResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) override;
+
+ virtual ndk::ScopedAStatus sendImsSmsResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) override;
+
+ virtual ndk::ScopedAStatus sendSmsExpectMoreResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) override;
+
+ virtual ndk::ScopedAStatus sendSmsResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms) override;
+
+ virtual ndk::ScopedAStatus sendUssdResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCdmaBroadcastActivationResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCdmaBroadcastConfigResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setGsmBroadcastActivationResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setGsmBroadcastConfigResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setSmscAddressResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus writeSmsToRuimResponse(const RadioResponseInfo& info,
+ int32_t index) override;
+
+ virtual ndk::ScopedAStatus writeSmsToSimResponse(const RadioResponseInfo& info,
+ int32_t index) override;
+};
+
+/* Callback class for radio messaging indication */
+class RadioMessagingIndication : public BnRadioMessagingIndication {
+ protected:
+ RadioMessagingTest& parent_messaging;
+
+ public:
+ RadioMessagingIndication(RadioMessagingTest& parent_messaging);
+ virtual ~RadioMessagingIndication() = default;
+
+ virtual ndk::ScopedAStatus cdmaNewSms(RadioIndicationType type,
+ const CdmaSmsMessage& msg) override;
+
+ virtual ndk::ScopedAStatus cdmaRuimSmsStorageFull(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus newBroadcastSms(RadioIndicationType type,
+ const std::vector<uint8_t>& data) override;
+
+ virtual ndk::ScopedAStatus newSms(RadioIndicationType type,
+ const std::vector<uint8_t>& pdu) override;
+
+ virtual ndk::ScopedAStatus newSmsOnSim(RadioIndicationType type, int32_t recordNumber) override;
+
+ virtual ndk::ScopedAStatus newSmsStatusReport(RadioIndicationType type,
+ const std::vector<uint8_t>& pdu) override;
+
+ virtual ndk::ScopedAStatus onUssd(RadioIndicationType type, UssdModeType modeType,
+ const std::string& msg) override;
+
+ virtual ndk::ScopedAStatus simSmsStorageFull(RadioIndicationType type) override;
+};
+
+// The main test class for Radio AIDL Messaging.
+class RadioMessagingTest : public ::testing::TestWithParam<std::string>,
+ public RadioResponseWaiter {
+ public:
+ virtual void SetUp() override;
+
+ /* radio messaging service handle */
+ std::shared_ptr<IRadioMessaging> radio_messaging;
+ /* radio messaging response handle */
+ std::shared_ptr<RadioMessagingResponse> radioRsp_messaging;
+ /* radio messaging indication handle */
+ std::shared_ptr<RadioMessagingIndication> radioInd_messaging;
+};
diff --git a/radio/aidl/vts/radio_modem_indication.cpp b/radio/aidl/vts/radio_modem_indication.cpp
new file mode 100644
index 0000000..17f37a8
--- /dev/null
+++ b/radio/aidl/vts/radio_modem_indication.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_modem_utils.h"
+
+RadioModemIndication::RadioModemIndication(RadioModemTest& parent) : parent_modem(parent) {}
+
+ndk::ScopedAStatus RadioModemIndication::hardwareConfigChanged(
+ RadioIndicationType /*type*/, const std::vector<HardwareConfig>& /*configs*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemIndication::modemReset(RadioIndicationType /*type*/,
+ const std::string& /*reason*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemIndication::radioCapabilityIndication(RadioIndicationType /*type*/,
+ const RadioCapability& /*rc*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemIndication::radioStateChanged(RadioIndicationType /*type*/,
+ RadioState /*radioState*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemIndication::rilConnected(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_modem_response.cpp b/radio/aidl/vts/radio_modem_response.cpp
new file mode 100644
index 0000000..7ac590f
--- /dev/null
+++ b/radio/aidl/vts/radio_modem_response.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_modem_utils.h"
+
+RadioModemResponse::RadioModemResponse(RadioResponseWaiter& parent) : parent_modem(parent) {}
+
+ndk::ScopedAStatus RadioModemResponse::acknowledgeRequest(int32_t /*serial*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& /*info*/,
+ const std::string& /*version*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& /*info*/,
+ const std::string& /*imei*/,
+ const std::string& /*imeisv*/,
+ const std::string& /*esn*/,
+ const std::string& /*meid*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse(
+ const RadioResponseInfo& /*info*/, const std::vector<HardwareConfig>& /*config*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::getModemActivityInfoResponse(
+ const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(
+ const RadioResponseInfo& /*info*/, const bool /*enabled*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+ const RadioCapability& /*rc*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& /*info*/,
+ const std::string& /*result*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+ const RadioCapability& /*rc*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioModemResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_modem.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp
new file mode 100644
index 0000000..406927f
--- /dev/null
+++ b/radio/aidl/vts/radio_modem_test.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_modem_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioModemTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_modem = IRadioModem::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_modem.get());
+
+ radioRsp_modem = ndk::SharedRefBase::make<RadioModemResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_modem.get());
+
+ count_ = 0;
+
+ radioInd_modem = ndk::SharedRefBase::make<RadioModemIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_modem.get());
+
+ radio_modem->setResponseFunctions(radioRsp_modem, radioInd_modem);
+
+ // Assert IRadioConfig exists before testing
+ std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
+ aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(
+ "android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radioConfig.get());
+}
+
+/*
+ * Test IRadioModem.setRadioPower() for the response returned.
+ */
+TEST_P(RadioModemTest, setRadioPower_emergencyCall_cancelled) {
+ // Set radio power to off.
+ serial = GetRandomSerialNumber();
+ radio_modem->setRadioPower(serial, false, false, false);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
+
+ // Set radio power to on with forEmergencyCall being true. This should put modem to only scan
+ // emergency call bands.
+ serial = GetRandomSerialNumber();
+ radio_modem->setRadioPower(serial, true, true, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
+
+ // Set radio power to on with forEmergencyCall being false. This should put modem in regular
+ // operation modem.
+ serial = GetRandomSerialNumber();
+ radio_modem->setRadioPower(serial, true, false, false);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
+}
diff --git a/radio/aidl/vts/radio_modem_utils.h b/radio/aidl/vts/radio_modem_utils.h
new file mode 100644
index 0000000..cd9a30d
--- /dev/null
+++ b/radio/aidl/vts/radio_modem_utils.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/modem/BnRadioModemIndication.h>
+#include <aidl/android/hardware/radio/modem/BnRadioModemResponse.h>
+#include <aidl/android/hardware/radio/modem/IRadioModem.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::config;
+using namespace aidl::android::hardware::radio::modem;
+
+class RadioModemTest;
+
+/* Callback class for radio modem response */
+class RadioModemResponse : public BnRadioModemResponse {
+ protected:
+ RadioResponseWaiter& parent_modem;
+
+ public:
+ RadioModemResponse(RadioResponseWaiter& parent_modem);
+ virtual ~RadioModemResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ bool isModemEnabled;
+ bool enableModemResponseToggle;
+
+ virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
+
+ virtual ndk::ScopedAStatus enableModemResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getBasebandVersionResponse(const RadioResponseInfo& info,
+ const std::string& version) override;
+
+ virtual ndk::ScopedAStatus getDeviceIdentityResponse(const RadioResponseInfo& info,
+ const std::string& imei,
+ const std::string& imeisv,
+ const std::string& esn,
+ const std::string& meid) override;
+
+ virtual ndk::ScopedAStatus getHardwareConfigResponse(
+ const RadioResponseInfo& info, const std::vector<HardwareConfig>& config) override;
+
+ virtual ndk::ScopedAStatus getModemActivityInfoResponse(
+ const RadioResponseInfo& info, const ActivityStatsInfo& activityInfo) override;
+
+ virtual ndk::ScopedAStatus getModemStackStatusResponse(const RadioResponseInfo& info,
+ const bool enabled) override;
+
+ virtual ndk::ScopedAStatus getRadioCapabilityResponse(const RadioResponseInfo& info,
+ const RadioCapability& rc) override;
+
+ virtual ndk::ScopedAStatus nvReadItemResponse(const RadioResponseInfo& info,
+ const std::string& result) override;
+
+ virtual ndk::ScopedAStatus nvResetConfigResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus nvWriteCdmaPrlResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus nvWriteItemResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus requestShutdownResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus sendDeviceStateResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setRadioCapabilityResponse(const RadioResponseInfo& info,
+ const RadioCapability& rc) override;
+
+ virtual ndk::ScopedAStatus setRadioPowerResponse(const RadioResponseInfo& info) override;
+};
+
+/* Callback class for radio modem indication */
+class RadioModemIndication : public BnRadioModemIndication {
+ protected:
+ RadioModemTest& parent_modem;
+
+ public:
+ RadioModemIndication(RadioModemTest& parent_modem);
+ virtual ~RadioModemIndication() = default;
+
+ virtual ndk::ScopedAStatus hardwareConfigChanged(
+ RadioIndicationType type, const std::vector<HardwareConfig>& configs) override;
+
+ virtual ndk::ScopedAStatus modemReset(RadioIndicationType type,
+ const std::string& reason) override;
+
+ virtual ndk::ScopedAStatus radioCapabilityIndication(RadioIndicationType type,
+ const RadioCapability& rc) override;
+
+ virtual ndk::ScopedAStatus radioStateChanged(RadioIndicationType type,
+ RadioState radioState) override;
+
+ virtual ndk::ScopedAStatus rilConnected(RadioIndicationType type) override;
+};
+
+// The main test class for Radio AIDL Modem.
+class RadioModemTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+ public:
+ virtual void SetUp() override;
+
+ /* radio modem service handle */
+ std::shared_ptr<IRadioModem> radio_modem;
+ /* radio modem response handle */
+ std::shared_ptr<RadioModemResponse> radioRsp_modem;
+ /* radio modem indication handle */
+ std::shared_ptr<RadioModemIndication> radioInd_modem;
+};
diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp
new file mode 100644
index 0000000..7bed759
--- /dev/null
+++ b/radio/aidl/vts/radio_network_indication.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_network_utils.h"
+
+RadioNetworkIndication::RadioNetworkIndication(RadioNetworkTest& parent) : parent_network(parent) {}
+
+ndk::ScopedAStatus RadioNetworkIndication::barringInfoChanged(
+ RadioIndicationType /*type*/, const CellIdentity& /*cellIdentity*/,
+ const std::vector<BarringInfo>& /*barringInfos*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::cdmaPrlChanged(RadioIndicationType /*type*/,
+ int32_t /*version*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::cellInfoList(RadioIndicationType /*type*/,
+ const std::vector<CellInfo>& /*records*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::currentLinkCapacityEstimate(
+ RadioIndicationType /*type*/, const LinkCapacityEstimate& /*lce*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::currentPhysicalChannelConfigs(
+ RadioIndicationType /*type*/, const std::vector<PhysicalChannelConfig>& /*configs*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::currentSignalStrength(
+ RadioIndicationType /*type*/, const SignalStrength& /*signalStrength*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::imsNetworkStateChanged(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::networkScanResult(RadioIndicationType /*type*/,
+ const NetworkScanResult& /*result*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::networkStateChanged(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::nitzTimeReceived(RadioIndicationType /*type*/,
+ const std::string& /*nitzTime*/,
+ int64_t /*receivedTime*/,
+ int64_t /*age*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::registrationFailed(RadioIndicationType /*type*/,
+ const CellIdentity& /*cellIdentity*/,
+ const std::string& /*chosenPlmn*/,
+ Domain /*domain*/,
+ int32_t /*causeCode*/,
+ int32_t /*additionalCauseCode*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::restrictedStateChanged(RadioIndicationType /*type*/,
+ PhoneRestrictedState /*state*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::suppSvcNotify(RadioIndicationType /*type*/,
+ const SuppSvcNotification& /*suppSvc*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkIndication::voiceRadioTechChanged(RadioIndicationType /*type*/,
+ RadioTechnology /*rat*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp
new file mode 100644
index 0000000..64f85c6
--- /dev/null
+++ b/radio/aidl/vts/radio_network_response.cpp
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_network_utils.h"
+
+RadioNetworkResponse::RadioNetworkResponse(RadioResponseWaiter& parent) : parent_network(parent) {}
+
+ndk::ScopedAStatus RadioNetworkResponse::acknowledgeRequest(int32_t /*serial*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getAllowedNetworkTypesBitmapResponse(
+ const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) {
+ rspInfo = info;
+ networkTypeBitmapResponse = networkTypeBitmap;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getAvailableBandModesResponse(
+ const RadioResponseInfo& /*info*/, const std::vector<RadioBandMode>& /*bandModes*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getAvailableNetworksResponse(
+ const RadioResponseInfo& info, const std::vector<OperatorInfo>& operatorInfos) {
+ rspInfo = info;
+ networkInfos = operatorInfos;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getBarringInfoResponse(
+ const RadioResponseInfo& /*info*/, const CellIdentity& /*cellIdentity*/,
+ const std::vector<BarringInfo>& /*barringInfos*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getCdmaRoamingPreferenceResponse(
+ const RadioResponseInfo& /*info*/, CdmaRoamingType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getCellInfoListResponse(
+ const RadioResponseInfo& /*info*/, const std::vector<CellInfo>& /*cellInfo*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getDataRegistrationStateResponse(
+ const RadioResponseInfo& info, const RegStateResult& /*regResponse*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getImsRegistrationStateResponse(
+ const RadioResponseInfo& /*info*/, bool /*isRegistered*/,
+ RadioTechnologyFamily /*ratFamily*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getNetworkSelectionModeResponse(
+ const RadioResponseInfo& /*info*/, bool /*manual*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getOperatorResponse(const RadioResponseInfo& /*info*/,
+ const std::string& /*longName*/,
+ const std::string& /*shortName*/,
+ const std::string& /*numeric*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getSignalStrengthResponse(
+ const RadioResponseInfo& /*info*/, const SignalStrength& /*sig_strength*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getSystemSelectionChannelsResponse(
+ const RadioResponseInfo& info, const std::vector<RadioAccessSpecifier>& /*specifier*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getUsageSettingResponse(
+ const RadioResponseInfo& /*info*/, const UsageSetting /*usageSetting*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getVoiceRadioTechnologyResponse(
+ const RadioResponseInfo& /*info*/, RadioTechnology /*rat*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::getVoiceRegistrationStateResponse(
+ const RadioResponseInfo& info, const RegStateResult& regResponse) {
+ rspInfo = info;
+ regStateResp.regState = regResponse.regState;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::isNrDualConnectivityEnabledResponse(
+ const RadioResponseInfo& info, bool isEnabled) {
+ rspInfo = info;
+ isNrDualConnectivityEnabled = isEnabled;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setAllowedNetworkTypesBitmapResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setBandModeResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setBarringPasswordResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setCdmaRoamingPreferenceResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setCellInfoListRateResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setIndicationFilterResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setLinkCapacityReportingCriteriaResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setLocationUpdatesResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeAutomaticResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeManualResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setNrDualConnectivityStateResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setSignalStrengthReportingCriteriaResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setSuppServiceNotificationsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setSystemSelectionChannelsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::setUsageSettingResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::startNetworkScanResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::stopNetworkScanResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::supplyNetworkDepersonalizationResponse(
+ const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
new file mode 100644
index 0000000..a8f87fc
--- /dev/null
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_network_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioNetworkTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_network = IRadioNetwork::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_network.get());
+
+ radioRsp_network = ndk::SharedRefBase::make<RadioNetworkResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_network.get());
+
+ count_ = 0;
+
+ radioInd_network = ndk::SharedRefBase::make<RadioNetworkIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_network.get());
+
+ radio_network->setResponseFunctions(radioRsp_network, radioInd_network);
+
+ // Assert IRadioConfig exists before testing
+ std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
+ aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(
+ "android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radioConfig.get());
+}
+
+/*
+ * Test IRadioNetwork.setAllowedNetworkTypesBitmap for the response returned.
+ */
+TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) {
+ serial = GetRandomSerialNumber();
+ RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
+
+ radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::OPERATION_NOT_ALLOWED,
+ RadioError::MODE_NOT_SUPPORTED, RadioError::INTERNAL_ERR, RadioError::MODEM_ERR,
+ RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED,
+ RadioError::NO_RESOURCES}));
+}
+
+/*
+ * Test IRadioNetwork.getAllowedNetworkTypesBitmap for the response returned.
+ */
+TEST_P(RadioNetworkTest, getAllowedNetworkTypesBitmap) {
+ serial = GetRandomSerialNumber();
+ RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
+
+ radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ if (radioRsp_network->rspInfo.error == RadioError::NONE) {
+ sleep(3); // wait for modem
+ serial = GetRandomSerialNumber();
+ radio_network->getAllowedNetworkTypesBitmap(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR,
+ RadioError::OPERATION_NOT_ALLOWED, RadioError::MODE_NOT_SUPPORTED,
+ RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR,
+ RadioError::REQUEST_NOT_SUPPORTED, RadioError::NO_RESOURCES}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.setNrDualConnectivityState() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setNrDualConnectivityState) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_network->setNrDualConnectivityState(serial, NrDualConnectivityState::DISABLE);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ if (getRadioHalCapabilities()) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::REQUEST_NOT_SUPPORTED}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR,
+ RadioError::INVALID_STATE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
+ }
+}
+
+/*
+ * Test IRadioNetwork.isNrDualConnectivityEnabled() for the response returned.
+ */
+TEST_P(RadioNetworkTest, isNrDualConnectivityEnabled) {
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_network->isNrDualConnectivityEnabled(serial);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+ if (getRadioHalCapabilities()) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::REQUEST_NOT_SUPPORTED}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR, RadioError::NONE}));
+ }
+}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h
new file mode 100644
index 0000000..26fce01
--- /dev/null
+++ b/radio/aidl/vts/radio_network_utils.h
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/network/BnRadioNetworkIndication.h>
+#include <aidl/android/hardware/radio/network/BnRadioNetworkResponse.h>
+#include <aidl/android/hardware/radio/network/IRadioNetwork.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::network;
+
+class RadioNetworkTest;
+
+/* Callback class for radio network response */
+class RadioNetworkResponse : public BnRadioNetworkResponse {
+ protected:
+ RadioResponseWaiter& parent_network;
+
+ public:
+ RadioNetworkResponse(RadioResponseWaiter& parent_network);
+ virtual ~RadioNetworkResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ std::vector<RadioBandMode> radioBandModes;
+ std::vector<OperatorInfo> networkInfos;
+ bool isNrDualConnectivityEnabled;
+ RadioAccessFamily networkTypeBitmapResponse;
+ RegStateResult regStateResp;
+ CellIdentity barringCellIdentity;
+ std::vector<BarringInfo> barringInfos;
+
+ virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
+
+ virtual ndk::ScopedAStatus getAllowedNetworkTypesBitmapResponse(
+ const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) override;
+
+ virtual ndk::ScopedAStatus getAvailableBandModesResponse(
+ const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) override;
+
+ virtual ndk::ScopedAStatus getAvailableNetworksResponse(
+ const RadioResponseInfo& info, const std::vector<OperatorInfo>& networkInfos) override;
+
+ virtual ndk::ScopedAStatus getBarringInfoResponse(
+ const RadioResponseInfo& info, const CellIdentity& cellIdentity,
+ const std::vector<BarringInfo>& barringInfos) override;
+
+ virtual ndk::ScopedAStatus getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
+ CdmaRoamingType type) override;
+
+ virtual ndk::ScopedAStatus getCellInfoListResponse(
+ const RadioResponseInfo& info, const std::vector<CellInfo>& cellInfo) override;
+
+ virtual ndk::ScopedAStatus getDataRegistrationStateResponse(
+ const RadioResponseInfo& info, const RegStateResult& dataRegResponse) override;
+
+ virtual ndk::ScopedAStatus getImsRegistrationStateResponse(
+ const RadioResponseInfo& info, bool isRegistered,
+ RadioTechnologyFamily ratFamily) override;
+
+ virtual ndk::ScopedAStatus getNetworkSelectionModeResponse(const RadioResponseInfo& info,
+ bool manual) override;
+
+ virtual ndk::ScopedAStatus getOperatorResponse(const RadioResponseInfo& info,
+ const std::string& longName,
+ const std::string& shortName,
+ const std::string& numeric) override;
+
+ virtual ndk::ScopedAStatus getSignalStrengthResponse(
+ const RadioResponseInfo& info, const SignalStrength& sigStrength) override;
+
+ virtual ndk::ScopedAStatus getSystemSelectionChannelsResponse(
+ const RadioResponseInfo& info,
+ const std::vector<RadioAccessSpecifier>& specifier) override;
+
+ virtual ndk::ScopedAStatus getUsageSettingResponse(const RadioResponseInfo& info,
+ UsageSetting usageSetting) override;
+
+ virtual ndk::ScopedAStatus getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
+ RadioTechnology rat) override;
+
+ virtual ndk::ScopedAStatus getVoiceRegistrationStateResponse(
+ const RadioResponseInfo& info, const RegStateResult& voiceRegResponse) override;
+
+ virtual ndk::ScopedAStatus isNrDualConnectivityEnabledResponse(const RadioResponseInfo& info,
+ bool isEnabled) override;
+
+ virtual ndk::ScopedAStatus setAllowedNetworkTypesBitmapResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setBandModeResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setBarringPasswordResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCdmaRoamingPreferenceResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCellInfoListRateResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setIndicationFilterResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setLinkCapacityReportingCriteriaResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setLocationUpdatesResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setNetworkSelectionModeAutomaticResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setNetworkSelectionModeManualResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setNrDualConnectivityStateResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setSignalStrengthReportingCriteriaResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setSuppServiceNotificationsResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setSystemSelectionChannelsResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setUsageSettingResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus startNetworkScanResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus stopNetworkScanResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus supplyNetworkDepersonalizationResponse(
+ const RadioResponseInfo& info, int32_t remainingRetries) override;
+};
+
+/* Callback class for radio network indication */
+class RadioNetworkIndication : public BnRadioNetworkIndication {
+ protected:
+ RadioNetworkTest& parent_network;
+
+ public:
+ RadioNetworkIndication(RadioNetworkTest& parent_network);
+ virtual ~RadioNetworkIndication() = default;
+
+ virtual ndk::ScopedAStatus barringInfoChanged(
+ RadioIndicationType type, const CellIdentity& cellIdentity,
+ const std::vector<BarringInfo>& barringInfos) override;
+
+ virtual ndk::ScopedAStatus cdmaPrlChanged(RadioIndicationType type, int32_t version) override;
+
+ virtual ndk::ScopedAStatus cellInfoList(RadioIndicationType type,
+ const std::vector<CellInfo>& records) override;
+
+ virtual ndk::ScopedAStatus currentLinkCapacityEstimate(
+ RadioIndicationType type, const LinkCapacityEstimate& lce) override;
+
+ virtual ndk::ScopedAStatus currentPhysicalChannelConfigs(
+ RadioIndicationType type, const std::vector<PhysicalChannelConfig>& configs) override;
+
+ virtual ndk::ScopedAStatus currentSignalStrength(RadioIndicationType type,
+ const SignalStrength& signalStrength) override;
+
+ virtual ndk::ScopedAStatus imsNetworkStateChanged(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus networkScanResult(RadioIndicationType type,
+ const NetworkScanResult& result) override;
+
+ virtual ndk::ScopedAStatus networkStateChanged(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus nitzTimeReceived(RadioIndicationType type,
+ const std::string& nitzTime, int64_t receivedTimeMs,
+ int64_t ageMs) override;
+
+ virtual ndk::ScopedAStatus registrationFailed(RadioIndicationType type,
+ const CellIdentity& cellIdentity,
+ const std::string& chosenPlmn, Domain domain,
+ int32_t causeCode,
+ int32_t additionalCauseCode) override;
+
+ virtual ndk::ScopedAStatus restrictedStateChanged(RadioIndicationType type,
+ PhoneRestrictedState state) override;
+
+ virtual ndk::ScopedAStatus suppSvcNotify(RadioIndicationType type,
+ const SuppSvcNotification& suppSvc) override;
+
+ virtual ndk::ScopedAStatus voiceRadioTechChanged(RadioIndicationType type,
+ RadioTechnology rat) override;
+};
+
+// The main test class for Radio AIDL Network.
+class RadioNetworkTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+ public:
+ virtual void SetUp() override;
+
+ /* radio network service handle */
+ std::shared_ptr<IRadioNetwork> radio_network;
+ /* radio network response handle */
+ std::shared_ptr<RadioNetworkResponse> radioRsp_network;
+ /* radio network indication handle */
+ std::shared_ptr<RadioNetworkIndication> radioInd_network;
+};
diff --git a/radio/aidl/vts/radio_sim_indication.cpp b/radio/aidl/vts/radio_sim_indication.cpp
new file mode 100644
index 0000000..0385845
--- /dev/null
+++ b/radio/aidl/vts/radio_sim_indication.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_sim_utils.h"
+
+RadioSimIndication::RadioSimIndication(RadioSimTest& parent) : parent_sim(parent) {}
+
+ndk::ScopedAStatus RadioSimIndication::carrierInfoForImsiEncryption(RadioIndicationType /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::cdmaSubscriptionSourceChanged(
+ RadioIndicationType /*type*/, CdmaSubscriptionSource /*cdmaSource*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::simPhonebookChanged(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::simPhonebookRecordsReceived(
+ RadioIndicationType /*type*/, PbReceivedStatus /*status*/,
+ const std::vector<PhonebookRecordInfo>& /*records*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::simRefresh(RadioIndicationType /*type*/,
+ const SimRefreshResult& /*refreshResult*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::simStatusChanged(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::stkEventNotify(RadioIndicationType /*type*/,
+ const std::string& /*cmd*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::stkProactiveCommand(RadioIndicationType /*type*/,
+ const std::string& /*cmd*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::stkSessionEnd(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::subscriptionStatusChanged(RadioIndicationType /*type*/,
+ bool /*activate*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimIndication::uiccApplicationsEnablementChanged(
+ RadioIndicationType /*type*/, bool /*enabled*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_sim_response.cpp b/radio/aidl/vts/radio_sim_response.cpp
new file mode 100644
index 0000000..2c796fa
--- /dev/null
+++ b/radio/aidl/vts/radio_sim_response.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_sim_utils.h"
+
+RadioSimResponse::RadioSimResponse(RadioResponseWaiter& parent) : parent_sim(parent) {}
+
+ndk::ScopedAStatus RadioSimResponse::acknowledgeRequest(int32_t /*serial*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::areUiccApplicationsEnabledResponse(
+ const RadioResponseInfo& /*info*/, bool /*enabled*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getAllowedCarriersResponse(
+ const RadioResponseInfo& /*info*/, const CarrierRestrictions& /*carriers*/,
+ SimLockMultiSimPolicy /*multiSimPolicy*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionResponse(
+ const RadioResponseInfo& /*info*/, const std::string& /*mdn*/, const std::string& /*hSid*/,
+ const std::string& /*hNid*/, const std::string& /*min*/, const std::string& /*prl*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionSourceResponse(
+ const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(
+ const RadioResponseInfo& /*info*/, int32_t /*response*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getIccCardStatusResponse(const RadioResponseInfo& info,
+ const CardStatus& card_status) {
+ rspInfo = info;
+ cardStatus = card_status;
+ parent_sim.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getImsiForAppResponse(const RadioResponseInfo& /*info*/,
+ const std::string& /*imsi*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getSimPhonebookCapacityResponse(
+ const RadioResponseInfo& info, const PhonebookCapacity& pbCapacity) {
+ rspInfo = info;
+ capacity = pbCapacity;
+ parent_sim.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::getSimPhonebookRecordsResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& /*info*/,
+ const IccIoResult& /*iccIo*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::iccOpenLogicalChannelResponse(
+ const RadioResponseInfo& /*info*/, int32_t /*channelId*/,
+ const std::vector<uint8_t>& /*selectResponse*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::iccTransmitApduBasicChannelResponse(
+ const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::iccTransmitApduLogicalChannelResponse(
+ const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::reportStkServiceIsRunningResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::requestIccSimAuthenticationResponse(
+ const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& /*info*/,
+ const std::string& /*commandResponse*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(
+ const RadioResponseInfo& /*info*/, const IccIoResult& /*iccIo*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::sendTerminalResponseToSimResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::setCarrierInfoForImsiEncryptionResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::setCdmaSubscriptionSourceResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(
+ const RadioResponseInfo& /*info*/, int32_t /*retry*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::setSimCardPowerResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_sim.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::supplySimDepersonalizationResponse(
+ const RadioResponseInfo& /*info*/, PersoSubstate /*persoType*/,
+ int32_t /*remainingRetries*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioSimResponse::updateSimPhonebookRecordsResponse(
+ const RadioResponseInfo& info, int32_t recordIndex) {
+ rspInfo = info;
+ updatedRecordIndex = recordIndex;
+ parent_sim.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp
new file mode 100644
index 0000000..c70219f
--- /dev/null
+++ b/radio/aidl/vts/radio_sim_test.cpp
@@ -0,0 +1,259 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_sim_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioSimTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_sim = IRadioSim::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_sim.get());
+
+ radioRsp_sim = ndk::SharedRefBase::make<RadioSimResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_sim.get());
+
+ count_ = 0;
+
+ radioInd_sim = ndk::SharedRefBase::make<RadioSimIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_sim.get());
+
+ radio_sim->setResponseFunctions(radioRsp_sim, radioInd_sim);
+
+ // Assert IRadioConfig exists before testing
+ std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
+ aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(
+ "android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radioConfig.get());
+}
+
+ndk::ScopedAStatus RadioSimTest::updateSimCardStatus() {
+ serial = GetRandomSerialNumber();
+ radio_sim->getIccCardStatus(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ return ndk::ScopedAStatus::ok();
+}
+
+/*
+ * Test IRadioSim.setSimCardPower() for the response returned.
+ */
+TEST_P(RadioSimTest, setSimCardPower) {
+ /* Test setSimCardPower power down */
+ serial = GetRandomSerialNumber();
+ radio_sim->setSimCardPower(serial, CardPowerState::POWER_DOWN);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ERR}));
+
+ // setSimCardPower does not return until the request is handled, and should not trigger
+ // CardStatus::STATE_ABSENT when turning off power
+ if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
+ /* Wait some time for setting sim power down and then verify it */
+ updateSimCardStatus();
+ // We cannot assert the consistency of CardState here due to b/203031664
+ // EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
+ // applications should be an empty vector of AppStatus
+ EXPECT_EQ(0, cardStatus.applications.size());
+ }
+
+ // Give some time for modem to fully power down the SIM card
+ sleep(MODEM_SET_SIM_POWER_DELAY_IN_SECONDS);
+
+ /* Test setSimCardPower power up */
+ serial = GetRandomSerialNumber();
+ radio_sim->setSimCardPower(serial, CardPowerState::POWER_UP);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
+ RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ERR}));
+
+ // Give some time for modem to fully power up the SIM card
+ sleep(MODEM_SET_SIM_POWER_DELAY_IN_SECONDS);
+
+ // setSimCardPower does not return until the request is handled. Just verify that we still
+ // have CardStatus::STATE_PRESENT after turning the power back on
+ if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
+ updateSimCardStatus();
+ EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
+ }
+}
+
+/*
+ * Test IRadioSim.setCarrierInfoForImsiEncryption() for the response returned.
+ */
+TEST_P(RadioSimTest, setCarrierInfoForImsiEncryption) {
+ serial = GetRandomSerialNumber();
+ ImsiEncryptionInfo imsiInfo;
+ imsiInfo.mcc = "310";
+ imsiInfo.mnc = "004";
+ imsiInfo.carrierKey = (std::vector<uint8_t>){1, 2, 3, 4, 5, 6};
+ imsiInfo.keyIdentifier = "Test";
+ imsiInfo.expirationTime = 20180101;
+ imsiInfo.keyType = ImsiEncryptionInfo::PUBLIC_KEY_TYPE_EPDG;
+
+ radio_sim->setCarrierInfoForImsiEncryption(serial, imsiInfo);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
+}
+
+/*
+ * Test IRadioSim.getSimPhonebookRecords() for the response returned.
+ */
+TEST_P(RadioSimTest, getSimPhonebookRecords) {
+ serial = GetRandomSerialNumber();
+ radio_sim->getSimPhonebookRecords(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::INVALID_SIM_STATE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS,
+ RadioError::REQUEST_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadioSim.getSimPhonebookCapacity for the response returned.
+ */
+TEST_P(RadioSimTest, getSimPhonebookCapacity) {
+ serial = GetRandomSerialNumber();
+ radio_sim->getSimPhonebookCapacity(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::INVALID_SIM_STATE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS,
+ RadioError::REQUEST_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+
+ PhonebookCapacity pbCapacity = radioRsp_sim->capacity;
+ if (pbCapacity.maxAdnRecords > 0) {
+ EXPECT_TRUE(pbCapacity.maxNameLen > 0 && pbCapacity.maxNumberLen > 0);
+ EXPECT_TRUE(pbCapacity.usedAdnRecords <= pbCapacity.maxAdnRecords);
+ }
+
+ if (pbCapacity.maxEmailRecords > 0) {
+ EXPECT_TRUE(pbCapacity.maxEmailLen > 0);
+ EXPECT_TRUE(pbCapacity.usedEmailRecords <= pbCapacity.maxEmailRecords);
+ }
+
+ if (pbCapacity.maxAdditionalNumberRecords > 0) {
+ EXPECT_TRUE(pbCapacity.maxAdditionalNumberLen > 0);
+ EXPECT_TRUE(pbCapacity.usedAdditionalNumberRecords <=
+ pbCapacity.maxAdditionalNumberRecords);
+ }
+ }
+}
+
+/*
+ * Test IRadioSim.updateSimPhonebookRecords() for the response returned.
+ */
+TEST_P(RadioSimTest, updateSimPhonebookRecords) {
+ serial = GetRandomSerialNumber();
+ radio_sim->getSimPhonebookCapacity(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::INVALID_SIM_STATE, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS,
+ RadioError::REQUEST_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+ } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+ PhonebookCapacity pbCapacity = radioRsp_sim->capacity;
+
+ serial = GetRandomSerialNumber();
+ radio_sim->getSimPhonebookRecords(serial);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED},
+ CHECK_GENERAL_ERROR));
+
+ if (pbCapacity.maxAdnRecords > 0 && pbCapacity.usedAdnRecords < pbCapacity.maxAdnRecords) {
+ // Add a phonebook record
+ PhonebookRecordInfo recordInfo;
+ recordInfo.recordId = 0;
+ recordInfo.name = "ABC";
+ recordInfo.number = "1234567890";
+ serial = GetRandomSerialNumber();
+ radio_sim->updateSimPhonebookRecords(serial, recordInfo);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+ int index = radioRsp_sim->updatedRecordIndex;
+ EXPECT_TRUE(index > 0);
+
+ // Deleted a phonebook record
+ recordInfo.recordId = index;
+ recordInfo.name = "";
+ recordInfo.number = "";
+ serial = GetRandomSerialNumber();
+ radio_sim->updateSimPhonebookRecords(serial, recordInfo);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
+ }
+ }
+}
diff --git a/radio/aidl/vts/radio_sim_utils.h b/radio/aidl/vts/radio_sim_utils.h
new file mode 100644
index 0000000..6cb6790
--- /dev/null
+++ b/radio/aidl/vts/radio_sim_utils.h
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/sim/BnRadioSimIndication.h>
+#include <aidl/android/hardware/radio/sim/BnRadioSimResponse.h>
+#include <aidl/android/hardware/radio/sim/IRadioSim.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::sim;
+
+class RadioSimTest;
+
+/* Callback class for radio SIM response */
+class RadioSimResponse : public BnRadioSimResponse {
+ protected:
+ RadioResponseWaiter& parent_sim;
+
+ public:
+ RadioSimResponse(RadioResponseWaiter& parent_sim);
+ virtual ~RadioSimResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ CarrierRestrictions carrierRestrictionsResp;
+ SimLockMultiSimPolicy multiSimPolicyResp;
+ bool canToggleUiccApplicationsEnablement;
+ bool areUiccApplicationsEnabled;
+ PhonebookCapacity capacity;
+ int32_t updatedRecordIndex;
+
+ virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
+
+ virtual ndk::ScopedAStatus areUiccApplicationsEnabledResponse(const RadioResponseInfo& info,
+ bool enabled) override;
+
+ virtual ndk::ScopedAStatus changeIccPin2ForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus changeIccPinForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus enableUiccApplicationsResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getAllowedCarriersResponse(
+ const RadioResponseInfo& info, const CarrierRestrictions& carriers,
+ const SimLockMultiSimPolicy multiSimPolicy) override;
+
+ virtual ndk::ScopedAStatus getCdmaSubscriptionResponse(
+ const RadioResponseInfo& info, const std::string& mdn, const std::string& hSid,
+ const std::string& hNid, const std::string& min, const std::string& prl) override;
+
+ virtual ndk::ScopedAStatus getCdmaSubscriptionSourceResponse(
+ const RadioResponseInfo& info, CdmaSubscriptionSource source) override;
+
+ virtual ndk::ScopedAStatus getFacilityLockForAppResponse(const RadioResponseInfo& info,
+ int32_t response) override;
+
+ virtual ndk::ScopedAStatus getIccCardStatusResponse(const RadioResponseInfo& info,
+ const CardStatus& cardStatus) override;
+
+ virtual ndk::ScopedAStatus getImsiForAppResponse(const RadioResponseInfo& info,
+ const std::string& imsi) override;
+
+ virtual ndk::ScopedAStatus getSimPhonebookCapacityResponse(
+ const RadioResponseInfo& info, const PhonebookCapacity& capacity) override;
+
+ virtual ndk::ScopedAStatus getSimPhonebookRecordsResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus iccCloseLogicalChannelResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus iccIoForAppResponse(const RadioResponseInfo& info,
+ const IccIoResult& iccIo) override;
+
+ virtual ndk::ScopedAStatus iccOpenLogicalChannelResponse(
+ const RadioResponseInfo& info, int32_t channelId,
+ const std::vector<uint8_t>& selectResponse) override;
+
+ virtual ndk::ScopedAStatus iccTransmitApduBasicChannelResponse(
+ const RadioResponseInfo& info, const IccIoResult& result) override;
+
+ virtual ndk::ScopedAStatus iccTransmitApduLogicalChannelResponse(
+ const RadioResponseInfo& info, const IccIoResult& result) override;
+
+ virtual ndk::ScopedAStatus reportStkServiceIsRunningResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus requestIccSimAuthenticationResponse(
+ const RadioResponseInfo& info, const IccIoResult& result) override;
+
+ virtual ndk::ScopedAStatus sendEnvelopeResponse(const RadioResponseInfo& info,
+ const std::string& commandResponse) override;
+
+ virtual ndk::ScopedAStatus sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
+ const IccIoResult& iccIo) override;
+
+ virtual ndk::ScopedAStatus sendTerminalResponseToSimResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setAllowedCarriersResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCarrierInfoForImsiEncryptionResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCdmaSubscriptionSourceResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setFacilityLockForAppResponse(const RadioResponseInfo& info,
+ int32_t retry) override;
+
+ virtual ndk::ScopedAStatus setSimCardPowerResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setUiccSubscriptionResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus supplyIccPinForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus supplyIccPukForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus supplySimDepersonalizationResponse(
+ const RadioResponseInfo& info, PersoSubstate persoType,
+ int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus updateSimPhonebookRecordsResponse(
+ const RadioResponseInfo& info, int32_t updatedRecordIndex) override;
+};
+
+/* Callback class for radio SIM indication */
+class RadioSimIndication : public BnRadioSimIndication {
+ protected:
+ RadioSimTest& parent_sim;
+
+ public:
+ RadioSimIndication(RadioSimTest& parent_sim);
+ virtual ~RadioSimIndication() = default;
+
+ virtual ndk::ScopedAStatus carrierInfoForImsiEncryption(RadioIndicationType info) override;
+
+ virtual ndk::ScopedAStatus cdmaSubscriptionSourceChanged(
+ RadioIndicationType type, CdmaSubscriptionSource cdmaSource) override;
+
+ virtual ndk::ScopedAStatus simPhonebookChanged(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus simPhonebookRecordsReceived(
+ RadioIndicationType type, PbReceivedStatus status,
+ const std::vector<PhonebookRecordInfo>& records) override;
+
+ virtual ndk::ScopedAStatus simRefresh(RadioIndicationType type,
+ const SimRefreshResult& refreshResult) override;
+
+ virtual ndk::ScopedAStatus simStatusChanged(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus stkEventNotify(RadioIndicationType type,
+ const std::string& cmd) override;
+
+ virtual ndk::ScopedAStatus stkProactiveCommand(RadioIndicationType type,
+ const std::string& cmd) override;
+
+ virtual ndk::ScopedAStatus stkSessionEnd(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus subscriptionStatusChanged(RadioIndicationType type,
+ bool activate) override;
+
+ virtual ndk::ScopedAStatus uiccApplicationsEnablementChanged(RadioIndicationType type,
+ bool enabled) override;
+};
+
+// The main test class for Radio AIDL SIM.
+class RadioSimTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+ protected:
+ /* Update Sim Card Status */
+ virtual ndk::ScopedAStatus updateSimCardStatus();
+
+ public:
+ virtual void SetUp() override;
+
+ /* radio SIM service handle */
+ std::shared_ptr<IRadioSim> radio_sim;
+ /* radio SIM response handle */
+ std::shared_ptr<RadioSimResponse> radioRsp_sim;
+ /* radio SIM indication handle */
+ std::shared_ptr<RadioSimIndication> radioInd_sim;
+};
diff --git a/radio/aidl/vts/radio_voice_indication.cpp b/radio/aidl/vts/radio_voice_indication.cpp
new file mode 100644
index 0000000..2c46817
--- /dev/null
+++ b/radio/aidl/vts/radio_voice_indication.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_voice_utils.h"
+
+RadioVoiceIndication::RadioVoiceIndication(RadioVoiceTest& parent) : parent_voice(parent) {}
+
+ndk::ScopedAStatus RadioVoiceIndication::callRing(RadioIndicationType /*type*/, bool /*isGsm*/,
+ const CdmaSignalInfoRecord& /*record*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::callStateChanged(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::cdmaCallWaiting(
+ RadioIndicationType /*type*/, const CdmaCallWaiting& /*callWaitingRecord*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::cdmaInfoRec(
+ RadioIndicationType /*type*/, const std::vector<CdmaInformationRecord>& /*records*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::cdmaOtaProvisionStatus(RadioIndicationType /*type*/,
+ CdmaOtaProvisionStatus /*status*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::currentEmergencyNumberList(
+ RadioIndicationType /*type*/, const std::vector<EmergencyNumber>& /*emergencyNumberList*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::enterEmergencyCallbackMode(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::exitEmergencyCallbackMode(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::indicateRingbackTone(RadioIndicationType /*type*/,
+ bool /*start*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::onSupplementaryServiceIndication(
+ RadioIndicationType /*type*/, const StkCcUnsolSsResult& /*ss*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::resendIncallMute(RadioIndicationType /*type*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::srvccStateNotify(RadioIndicationType /*type*/,
+ SrvccState /*state*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::stkCallControlAlphaNotify(RadioIndicationType /*type*/,
+ const std::string& /*alpha*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceIndication::stkCallSetup(RadioIndicationType /*type*/,
+ int64_t /*timeout*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_voice_response.cpp b/radio/aidl/vts/radio_voice_response.cpp
new file mode 100644
index 0000000..ca350c6
--- /dev/null
+++ b/radio/aidl/vts/radio_voice_response.cpp
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "radio_voice_utils.h"
+
+RadioVoiceResponse::RadioVoiceResponse(RadioResponseWaiter& parent) : parent_voice(parent) {}
+
+ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::acknowledgeRequest(int32_t /*serial*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::conferenceResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::dialResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::emergencyDialResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::exitEmergencyCallbackModeResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::explicitCallTransferResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getCallForwardStatusResponse(
+ const RadioResponseInfo& /*info*/,
+ const std::vector<CallForwardInfo>& /*callForwardInfos*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getCallWaitingResponse(const RadioResponseInfo& /*info*/,
+ bool /*enable*/,
+ int32_t /*serviceClass*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getClipResponse(const RadioResponseInfo& /*info*/,
+ ClipStatus /*status*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getClirResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*n*/, int32_t /*m*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getCurrentCallsResponse(const RadioResponseInfo& info,
+ const std::vector<Call>& calls) {
+ rspInfo = info;
+ currentCalls = calls;
+ parent_voice.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getLastCallFailCauseResponse(
+ const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getMuteResponse(const RadioResponseInfo& /*info*/,
+ bool /*enable*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getPreferredVoicePrivacyResponse(
+ const RadioResponseInfo& /*info*/, bool /*enable*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::getTtyModeResponse(const RadioResponseInfo& /*info*/,
+ TtyMode /*mode*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::handleStkCallSetupRequestFromSimResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::hangupConnectionResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_voice.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::hangupForegroundResumeBackgroundResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::hangupWaitingOrBackgroundResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::isVoNrEnabledResponse(const RadioResponseInfo& /*info*/,
+ bool /*enabled*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::rejectCallResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::sendCdmaFeatureCodeResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::sendDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::separateConnectionResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setCallForwardResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setCallWaitingResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setClirResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setMuteResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setPreferredVoicePrivacyResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setTtyModeResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::setVoNrEnabledResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::startDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::stopDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioVoiceResponse::switchWaitingOrHoldingAndActiveResponse(
+ const RadioResponseInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_voice_test.cpp b/radio/aidl/vts/radio_voice_test.cpp
new file mode 100644
index 0000000..201f14c
--- /dev/null
+++ b/radio/aidl/vts/radio_voice_test.cpp
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_voice_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioVoiceTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_voice = IRadioVoice::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_voice.get());
+
+ radioRsp_voice = ndk::SharedRefBase::make<RadioVoiceResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_voice.get());
+
+ count_ = 0;
+
+ radioInd_voice = ndk::SharedRefBase::make<RadioVoiceIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_voice.get());
+
+ radio_voice->setResponseFunctions(radioRsp_voice, radioInd_voice);
+
+ // Assert IRadioConfig exists before testing
+ std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfig> radioConfig =
+ aidl::android::hardware::radio::config::IRadioConfig::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(
+ "android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radioConfig.get());
+}
+
+ndk::ScopedAStatus RadioVoiceTest::clearPotentialEstablishedCalls() {
+ // Get the current call Id to hangup the established emergency call.
+ serial = GetRandomSerialNumber();
+ radio_voice->getCurrentCalls(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+
+ // Hang up to disconnect the established call channels.
+ for (const Call& call : radioRsp_voice->currentCalls) {
+ serial = GetRandomSerialNumber();
+ radio_voice->hangup(serial, call.index);
+ ALOGI("Hang up to disconnect the established call channel: %d", call.index);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ // Give some time for modem to disconnect the established call channel.
+ sleep(MODEM_EMERGENCY_CALL_DISCONNECT_TIME);
+ }
+
+ // Verify there are no more current calls.
+ serial = GetRandomSerialNumber();
+ radio_voice->getCurrentCalls(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(0, radioRsp_voice->currentCalls.size());
+ return ndk::ScopedAStatus::ok();
+}
+
+/*
+ * Test IRadioVoice.emergencyDial() for the response returned.
+ */
+TEST_P(RadioVoiceTest, emergencyDial) {
+ if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
+ ALOGI("Skipping emergencyDial because voice call is not supported in device");
+ return;
+ } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
+ !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
+ ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
+ return;
+ } else {
+ ALOGI("Running emergencyDial because voice call is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ Dial dialInfo;
+ dialInfo.address = std::string("911");
+ EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
+ std::vector<std::string> urns = {""};
+ EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
+
+ ndk::ScopedAStatus res =
+ radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ ALOGI("emergencyDial, rspInfo.error = %s\n", toString(radioRsp_voice->rspInfo.error).c_str());
+
+ RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
+ // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
+ // or Emergency_Only.
+ if (isDsDsEnabled() || isTsTsEnabled()) {
+ // TODO(b/210712359): maybe create a local RadioNetwork instance
+ /**
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getVoiceRegistrationState(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
+ }
+ **/
+ } else {
+ EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
+ }
+
+ // Give some time for modem to establish the emergency call channel.
+ sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
+
+ // Disconnect all the potential established calls to prevent them affecting other tests.
+ clearPotentialEstablishedCalls();
+}
+
+/*
+ * Test IRadioVoice.emergencyDial() with specified service and its response returned.
+ */
+TEST_P(RadioVoiceTest, emergencyDial_withServices) {
+ if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
+ ALOGI("Skipping emergencyDial because voice call is not supported in device");
+ return;
+ } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
+ !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
+ ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
+ return;
+ } else {
+ ALOGI("Running emergencyDial because voice call is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ Dial dialInfo;
+ dialInfo.address = std::string("911");
+ EmergencyServiceCategory categories = EmergencyServiceCategory::AMBULANCE;
+ std::vector<std::string> urns = {"urn:service:sos.ambulance"};
+ EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
+
+ ndk::ScopedAStatus res =
+ radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ ALOGI("emergencyDial_withServices, rspInfo.error = %s\n",
+ toString(radioRsp_voice->rspInfo.error).c_str());
+ RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
+
+ // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
+ // or Emergency_Only.
+ if (isDsDsEnabled() || isTsTsEnabled()) {
+ // TODO(b/210712359): maybe create a local RadioNetwork instance
+ /**
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getVoiceRegistrationState_1_6(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
+ }
+ **/
+ } else {
+ EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
+ }
+ // Give some time for modem to establish the emergency call channel.
+ sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
+
+ // Disconnect all the potential established calls to prevent them affecting other tests.
+ clearPotentialEstablishedCalls();
+}
+
+/*
+ * Test IRadioVoice.emergencyDial() with known emergency call routing and its response returned.
+ */
+TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) {
+ if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
+ ALOGI("Skipping emergencyDial because voice call is not supported in device");
+ return;
+ } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
+ !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
+ ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
+ return;
+ } else {
+ ALOGI("Running emergencyDial because voice call is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ Dial dialInfo;
+ dialInfo.address = std::string("911");
+ EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
+ std::vector<std::string> urns = {""};
+ EmergencyCallRouting routing = EmergencyCallRouting::EMERGENCY;
+
+ ndk::ScopedAStatus res =
+ radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+
+ ALOGI("emergencyDial_withEmergencyRouting, rspInfo.error = %s\n",
+ toString(radioRsp_voice->rspInfo.error).c_str());
+ RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
+
+ // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
+ // or Emergency_Only.
+ if (isDsDsEnabled() || isTsTsEnabled()) {
+ // TODO(b/210712359): maybe create a local RadioNetwork instance
+ /**
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getVoiceRegistrationState_1_6(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
+ }
+ **/
+ } else {
+ EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
+ }
+
+ // Give some time for modem to establish the emergency call channel.
+ sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
+
+ // Disconnect all the potential established calls to prevent them affecting other tests.
+ clearPotentialEstablishedCalls();
+}
+
+/*
+ * Test IRadioVoice.getCurrentCalls() for the response returned.
+ */
+TEST_P(RadioVoiceTest, getCurrentCalls) {
+ serial = GetRandomSerialNumber();
+ radio_voice->getCurrentCalls(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
+}
diff --git a/radio/aidl/vts/radio_voice_utils.h b/radio/aidl/vts/radio_voice_utils.h
new file mode 100644
index 0000000..a676a7f
--- /dev/null
+++ b/radio/aidl/vts/radio_voice_utils.h
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/voice/BnRadioVoiceIndication.h>
+#include <aidl/android/hardware/radio/voice/BnRadioVoiceResponse.h>
+#include <aidl/android/hardware/radio/voice/IRadioVoice.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::voice;
+
+class RadioVoiceTest;
+
+/* Callback class for radio voice response */
+class RadioVoiceResponse : public BnRadioVoiceResponse {
+ protected:
+ RadioResponseWaiter& parent_voice;
+
+ public:
+ RadioVoiceResponse(RadioResponseWaiter& parent_voice);
+ virtual ~RadioVoiceResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ std::vector<Call> currentCalls;
+
+ virtual ndk::ScopedAStatus acceptCallResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
+
+ virtual ndk::ScopedAStatus conferenceResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus dialResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus emergencyDialResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus exitEmergencyCallbackModeResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus explicitCallTransferResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus getCallForwardStatusResponse(
+ const RadioResponseInfo& info,
+ const std::vector<CallForwardInfo>& call_forwardInfos) override;
+
+ virtual ndk::ScopedAStatus getCallWaitingResponse(const RadioResponseInfo& info, bool enable,
+ int32_t serviceClass) override;
+
+ virtual ndk::ScopedAStatus getClipResponse(const RadioResponseInfo& info,
+ ClipStatus status) override;
+
+ virtual ndk::ScopedAStatus getClirResponse(const RadioResponseInfo& info, int32_t n,
+ int32_t m) override;
+
+ virtual ndk::ScopedAStatus getCurrentCallsResponse(const RadioResponseInfo& info,
+ const std::vector<Call>& calls) override;
+
+ virtual ndk::ScopedAStatus getLastCallFailCauseResponse(
+ const RadioResponseInfo& info, const LastCallFailCauseInfo& failCauseInfo) override;
+
+ virtual ndk::ScopedAStatus getMuteResponse(const RadioResponseInfo& info, bool enable) override;
+
+ virtual ndk::ScopedAStatus getPreferredVoicePrivacyResponse(const RadioResponseInfo& info,
+ bool enable) override;
+
+ virtual ndk::ScopedAStatus getTtyModeResponse(const RadioResponseInfo& info,
+ TtyMode mode) override;
+
+ virtual ndk::ScopedAStatus handleStkCallSetupRequestFromSimResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus hangupConnectionResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus hangupForegroundResumeBackgroundResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus hangupWaitingOrBackgroundResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus isVoNrEnabledResponse(const RadioResponseInfo& info,
+ bool enable) override;
+
+ virtual ndk::ScopedAStatus rejectCallResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus sendBurstDtmfResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus sendCdmaFeatureCodeResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus sendDtmfResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus separateConnectionResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCallForwardResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setCallWaitingResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setClirResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setMuteResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setPreferredVoicePrivacyResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setTtyModeResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus setVoNrEnabledResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus startDtmfResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus stopDtmfResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus switchWaitingOrHoldingAndActiveResponse(
+ const RadioResponseInfo& info) override;
+};
+
+/* Callback class for radio voice indication */
+class RadioVoiceIndication : public BnRadioVoiceIndication {
+ protected:
+ RadioVoiceTest& parent_voice;
+
+ public:
+ RadioVoiceIndication(RadioVoiceTest& parent_voice);
+ virtual ~RadioVoiceIndication() = default;
+
+ virtual ndk::ScopedAStatus callRing(RadioIndicationType type, bool isGsm,
+ const CdmaSignalInfoRecord& record) override;
+
+ virtual ndk::ScopedAStatus callStateChanged(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus cdmaCallWaiting(RadioIndicationType type,
+ const CdmaCallWaiting& callWaitingRecord) override;
+
+ virtual ndk::ScopedAStatus cdmaInfoRec(
+ RadioIndicationType type, const std::vector<CdmaInformationRecord>& records) override;
+
+ virtual ndk::ScopedAStatus cdmaOtaProvisionStatus(RadioIndicationType type,
+ CdmaOtaProvisionStatus status) override;
+
+ virtual ndk::ScopedAStatus currentEmergencyNumberList(
+ RadioIndicationType type,
+ const std::vector<EmergencyNumber>& emergencyNumberList) override;
+
+ virtual ndk::ScopedAStatus enterEmergencyCallbackMode(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus exitEmergencyCallbackMode(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus indicateRingbackTone(RadioIndicationType type, bool start) override;
+
+ virtual ndk::ScopedAStatus onSupplementaryServiceIndication(
+ RadioIndicationType type, const StkCcUnsolSsResult& ss) override;
+
+ virtual ndk::ScopedAStatus resendIncallMute(RadioIndicationType type) override;
+
+ virtual ndk::ScopedAStatus srvccStateNotify(RadioIndicationType type,
+ SrvccState state) override;
+
+ virtual ndk::ScopedAStatus stkCallControlAlphaNotify(RadioIndicationType type,
+ const std::string& alpha) override;
+
+ virtual ndk::ScopedAStatus stkCallSetup(RadioIndicationType type, int64_t timeout) override;
+};
+
+// The main test class for Radio AIDL Voice.
+class RadioVoiceTest : public ::testing::TestWithParam<std::string>, public RadioResponseWaiter {
+ protected:
+ /* Clear Potential Established Calls */
+ virtual ndk::ScopedAStatus clearPotentialEstablishedCalls();
+
+ public:
+ virtual void SetUp() override;
+
+ /* radio voice service handle */
+ std::shared_ptr<IRadioVoice> radio_voice;
+ /* radio voice response handle */
+ std::shared_ptr<RadioVoiceResponse> radioRsp_voice;
+ /* radio voice indication handle */
+ std::shared_ptr<RadioVoiceIndication> radioInd_voice;
+};
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl
index 2c6cc00..e763cfb 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessage.aidl
@@ -50,4 +50,5 @@
android.hardware.tv.tuner.FrontendModulation modulation;
android.hardware.tv.tuner.FrontendDvbcAnnex annex;
boolean isHighPriority;
+ int[] dvbtCellIds;
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl
index b121c85..6976ecd 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl
@@ -50,4 +50,5 @@
MODULATION = 12,
DVBC_ANNEX = 13,
HIGH_PRIORITY = 14,
+ DVBT_CELL_IDS = 15,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
index c79b751..fc0efc9 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
@@ -75,4 +75,5 @@
android.hardware.tv.tuner.FrontendIsdbtMode isdbtMode;
android.hardware.tv.tuner.FrontendIsdbtPartialReceptionFlag partialReceptionFlag;
int[] streamIdList;
+ int[] dvbtCellIds;
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
index 9ea3200..2cc62d5 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
@@ -75,4 +75,5 @@
ISDBT_MODE = 37,
ISDBT_PARTIAL_RECEPTION_FLAG = 38,
STREAM_ID_LIST = 39,
+ DVBT_CELL_IDS = 40,
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl
index 19c6766..a941066 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessage.aidl
@@ -70,4 +70,10 @@
FrontendDvbcAnnex annex;
boolean isHighPriority;
+
+ /**
+ * DVB-T Cell Ids.
+ */
+ int[] dvbtCellIds;
+
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessageType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessageType.aidl
index 2b91216..f4d2ee0 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessageType.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendScanMessageType.aidl
@@ -86,4 +86,10 @@
DVBC_ANNEX,
HIGH_PRIORITY,
+
+ /**
+ * DVB-T CELL ID.
+ */
+ DVBT_CELL_IDS,
+
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
index 6e6f315..ae6e46f 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
@@ -236,4 +236,10 @@
*/
int[] streamIdList;
+ /**
+ * DVB-T Cell Id.
+ */
+ int[] dvbtCellIds;
+
+
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl
index 7feb72d..e7da517 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl
@@ -223,4 +223,9 @@
* Stream ID list included in a transponder.
*/
STREAM_ID_LIST,
+
+ /**
+ * DVB-T Cell Id.
+ */
+ DVBT_CELL_IDS,
}
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index a4dde2a..c1b8b5d 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -237,6 +237,13 @@
mCallback->onScanMessage(FrontendScanMessageType::HIGH_PRIORITY, msg);
}
+ if (mType == FrontendType::DVBT) {
+ FrontendScanMessage msg;
+ vector<int32_t> dvbtCellIds = {0, 1};
+ msg.set<FrontendScanMessage::Tag::dvbtCellIds>(dvbtCellIds);
+ mCallback->onScanMessage(FrontendScanMessageType::DVBT_CELL_IDS, msg);
+ }
+
{
FrontendScanMessage msg;
msg.set<FrontendScanMessage::Tag::isLocked>(true);
@@ -681,6 +688,11 @@
status.set<FrontendStatus::streamIdList>(streamIds);
break;
}
+ case FrontendStatusType::DVBT_CELL_IDS: {
+ vector<int32_t> dvbtCellIds = {0, 1};
+ status.set<FrontendStatus::dvbtCellIds>(dvbtCellIds);
+ break;
+ }
default: {
continue;
}
diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp
index 96e83bb..9e81177 100644
--- a/tv/tuner/aidl/default/Tuner.cpp
+++ b/tv/tuner/aidl/default/Tuner.cpp
@@ -112,6 +112,7 @@
FrontendStatusType::GUARD_INTERVAL,
FrontendStatusType::TRANSMISSION_MODE,
FrontendStatusType::T2_SYSTEM_ID,
+ FrontendStatusType::DVBT_CELL_IDS,
};
mFrontendStatusCaps[4] = statusCaps;
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
index 42d20f7..f24dea1 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -405,6 +405,13 @@
expectStatuses[i].get<FrontendStatus::Tag::streamIdList>().begin()));
break;
}
+ case FrontendStatusType::DVBT_CELL_IDS: {
+ ASSERT_TRUE(std::equal(
+ realStatuses[i].get<FrontendStatus::Tag::dvbtCellIds>().begin(),
+ realStatuses[i].get<FrontendStatus::Tag::dvbtCellIds>().end(),
+ expectStatuses[i].get<FrontendStatus::Tag::dvbtCellIds>().begin()));
+ break;
+ }
default: {
continue;
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IHostapdCallback.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IHostapdCallback.aidl
index 36d2104..9dd062a 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IHostapdCallback.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IHostapdCallback.aidl
@@ -36,5 +36,5 @@
interface IHostapdCallback {
oneway void onApInstanceInfoChanged(in android.hardware.wifi.hostapd.ApInfo apInfo);
oneway void onConnectedClientsChanged(in android.hardware.wifi.hostapd.ClientInfo clientInfo);
- oneway void onFailure(in String ifaceName);
+ oneway void onFailure(in String ifaceName, in String instanceName);
}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IHostapdCallback.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IHostapdCallback.aidl
index 7b04944..456f46a 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IHostapdCallback.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IHostapdCallback.aidl
@@ -41,7 +41,10 @@
* Invoked when an asynchronous failure is encountered in one of the access
* points added via |IHostapd.addAccessPoint|.
*
- * @param ifaceName Name of the interface.
+ * @param ifaceName Name of the interface which was added via
+ * |IHostapd.addAccessPoint|.
+ * @param instanceName Name of the AP instance which is associated with
+ * the interface.
*/
- oneway void onFailure(in String ifaceName);
+ oneway void onFailure(in String ifaceName, in String instanceName);
}
diff --git a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp
index 41c54b3..dad7085 100644
--- a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp
+++ b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp
@@ -232,7 +232,7 @@
const ::aidl::android::hardware::wifi::hostapd::ClientInfo &) override {
return ndk::ScopedAStatus::ok();
}
- ::ndk::ScopedAStatus onFailure(const std::string &) override {
+ ::ndk::ScopedAStatus onFailure(const std::string&, const std::string&) override {
return ndk::ScopedAStatus::ok();
}
};