Merge "Migrate NNAPI to canonical types"
diff --git a/audio/7.0/config/api/current.txt b/audio/7.0/config/api/current.txt
index ac8dc8a..453ed16 100644
--- a/audio/7.0/config/api/current.txt
+++ b/audio/7.0/config/api/current.txt
@@ -44,10 +44,12 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_IN_VOICE_CALL_MONO;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_NONE;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_2POINT0POINT2;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_2POINT1;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_2POINT1POINT2;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_3POINT0POINT2;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_3POINT1;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_3POINT1POINT2;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_5POINT1;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_5POINT1POINT2;
@@ -70,6 +72,8 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_STEREO_HAPTIC_AB;
enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_SURROUND;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_TRI;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioChannelMask AUDIO_CHANNEL_OUT_TRI_BACK;
}
public enum AudioContentType {
@@ -87,6 +91,7 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_IN_AUX_DIGITAL;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_IN_BACK_MIC;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_IN_BLE_HEADSET;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_A2DP;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_BLE;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
@@ -117,6 +122,8 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_AUX_DIGITAL;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_AUX_LINE;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_BLE_HEADSET;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_BLE_SPEAKER;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
enum_constant public static final audio.policy.configuration.V7_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
@@ -191,7 +198,6 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_APTX_HD;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_APTX_TWSP;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_CELT;
- enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_DEFAULT;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_DOLBY_TRUEHD;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_DSD;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_DTS;
@@ -206,9 +212,11 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_HE_AAC_V1;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_HE_AAC_V2;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_IEC61937;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_LC3;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_LDAC;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_LHDC;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_LHDC_LL;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MAT;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MAT_1_0;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MAT_2_0;
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MAT_2_1;
@@ -228,6 +236,13 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_WMA_PRO;
}
+ public enum AudioGainMode {
+ method public String getRawName();
+ enum_constant public static final audio.policy.configuration.V7_0.AudioGainMode AUDIO_GAIN_MODE_CHANNELS;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioGainMode AUDIO_GAIN_MODE_JOINT;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioGainMode AUDIO_GAIN_MODE_RAMP;
+ }
+
public enum AudioInOutFlag {
method public String getRawName();
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_DIRECT;
@@ -235,6 +250,7 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_HW_AV_SYNC;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_HW_HOTWORD;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_MMAP_NOIRQ;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_NONE;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_RAW;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_SYNC;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_INPUT_FLAG_VOIP_TX;
@@ -247,6 +263,7 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_OUTPUT_FLAG_INCALL_MUSIC;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_OUTPUT_FLAG_MMAP_NOIRQ;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_OUTPUT_FLAG_NONE;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_OUTPUT_FLAG_NON_BLOCKING;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_OUTPUT_FLAG_PRIMARY;
enum_constant public static final audio.policy.configuration.V7_0.AudioInOutFlag AUDIO_OUTPUT_FLAG_RAW;
@@ -291,6 +308,7 @@
enum_constant public static final audio.policy.configuration.V7_0.AudioStreamType AUDIO_STREAM_ALARM;
enum_constant public static final audio.policy.configuration.V7_0.AudioStreamType AUDIO_STREAM_ASSISTANT;
enum_constant public static final audio.policy.configuration.V7_0.AudioStreamType AUDIO_STREAM_BLUETOOTH_SCO;
+ enum_constant public static final audio.policy.configuration.V7_0.AudioStreamType AUDIO_STREAM_CALL_ASSISTANT;
enum_constant public static final audio.policy.configuration.V7_0.AudioStreamType AUDIO_STREAM_DTMF;
enum_constant public static final audio.policy.configuration.V7_0.AudioStreamType AUDIO_STREAM_ENFORCED_AUDIBLE;
enum_constant public static final audio.policy.configuration.V7_0.AudioStreamType AUDIO_STREAM_MUSIC;
@@ -364,13 +382,6 @@
enum_constant public static final audio.policy.configuration.V7_0.EngineSuffix configurable;
}
- public enum GainMode {
- method public String getRawName();
- enum_constant public static final audio.policy.configuration.V7_0.GainMode AUDIO_GAIN_MODE_CHANNELS;
- enum_constant public static final audio.policy.configuration.V7_0.GainMode AUDIO_GAIN_MODE_JOINT;
- enum_constant public static final audio.policy.configuration.V7_0.GainMode AUDIO_GAIN_MODE_RAMP;
- }
-
public class Gains {
ctor public Gains();
method public java.util.List<audio.policy.configuration.V7_0.Gains.Gain> getGain();
@@ -384,7 +395,7 @@
method public int getMaxValueMB();
method public int getMinRampMs();
method public int getMinValueMB();
- method public audio.policy.configuration.V7_0.GainMode getMode();
+ method public java.util.List<audio.policy.configuration.V7_0.AudioGainMode> getMode();
method public String getName();
method public int getStepValueMB();
method public boolean getUseForVolume();
@@ -394,7 +405,7 @@
method public void setMaxValueMB(int);
method public void setMinRampMs(int);
method public void setMinValueMB(int);
- method public void setMode(audio.policy.configuration.V7_0.GainMode);
+ method public void setMode(java.util.List<audio.policy.configuration.V7_0.AudioGainMode>);
method public void setName(String);
method public void setStepValueMB(int);
method public void setUseForVolume(boolean);
diff --git a/audio/7.0/config/audio_policy_configuration.xsd b/audio/7.0/config/audio_policy_configuration.xsd
index 20fe020..6784828 100644
--- a/audio/7.0/config/audio_policy_configuration.xsd
+++ b/audio/7.0/config/audio_policy_configuration.xsd
@@ -159,9 +159,13 @@
<xs:annotation>
<xs:documentation xml:lang="en">
The flags indicate suggested stream attributes supported by the profile.
+ Use of AUDIO_{INPUT|OUTPUT}_FLAG_NONE in the XML file isn't required
+ as empty flag lists are allowed. However these constants are useful for
+ representing an empty enum value.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
+ <xs:enumeration value="AUDIO_OUTPUT_FLAG_NONE" />
<xs:enumeration value="AUDIO_OUTPUT_FLAG_DIRECT" />
<xs:enumeration value="AUDIO_OUTPUT_FLAG_PRIMARY" />
<xs:enumeration value="AUDIO_OUTPUT_FLAG_FAST" />
@@ -177,6 +181,7 @@
<xs:enumeration value="AUDIO_OUTPUT_FLAG_MMAP_NOIRQ" />
<xs:enumeration value="AUDIO_OUTPUT_FLAG_VOIP_RX" />
<xs:enumeration value="AUDIO_OUTPUT_FLAG_INCALL_MUSIC" />
+ <xs:enumeration value="AUDIO_INPUT_FLAG_NONE" />
<xs:enumeration value="AUDIO_INPUT_FLAG_FAST" />
<xs:enumeration value="AUDIO_INPUT_FLAG_HW_HOTWORD" />
<xs:enumeration value="AUDIO_INPUT_FLAG_RAW" />
@@ -251,8 +256,8 @@
<xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER"/>
- <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/>
+ <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/>
@@ -271,6 +276,8 @@
<xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_HEARING_AID"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_ECHO_CANCELLER"/>
+ <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_HEADSET"/>
+ <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_SPEAKER"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/>
<xs:enumeration value="AUDIO_DEVICE_OUT_STUB"/>
@@ -279,8 +286,8 @@
<xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_WIRED_HEADSET"/>
- <xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/>
<xs:enumeration value="AUDIO_DEVICE_IN_HDMI"/>
+ <xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/>
<xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/>
<xs:enumeration value="AUDIO_DEVICE_IN_TELEPHONY_RX"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BACK_MIC"/>
@@ -302,6 +309,7 @@
<xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/>
<xs:enumeration value="AUDIO_DEVICE_IN_HDMI_ARC"/>
<xs:enumeration value="AUDIO_DEVICE_IN_ECHO_REFERENCE"/>
+ <xs:enumeration value="AUDIO_DEVICE_IN_BLE_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
<xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
</xs:restriction>
@@ -321,7 +329,6 @@
</xs:simpleType>
<xs:simpleType name="audioFormat">
<xs:restriction base="xs:string">
- <xs:enumeration value="AUDIO_FORMAT_DEFAULT" />
<xs:enumeration value="AUDIO_FORMAT_PCM_16_BIT" />
<xs:enumeration value="AUDIO_FORMAT_PCM_8_BIT"/>
<xs:enumeration value="AUDIO_FORMAT_PCM_32_BIT"/>
@@ -342,22 +349,14 @@
<xs:enumeration value="AUDIO_FORMAT_AAC_LD"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_HE_V2"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_ELD"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_MAIN"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LC"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SSR"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LTP"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V1"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SCALABLE"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ERLC"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LD"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V2"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ELD"/>
- <xs:enumeration value="AUDIO_FORMAT_VORBIS"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_XHE"/>
<xs:enumeration value="AUDIO_FORMAT_HE_AAC_V1"/>
<xs:enumeration value="AUDIO_FORMAT_HE_AAC_V2"/>
+ <xs:enumeration value="AUDIO_FORMAT_VORBIS"/>
<xs:enumeration value="AUDIO_FORMAT_OPUS"/>
<xs:enumeration value="AUDIO_FORMAT_AC3"/>
<xs:enumeration value="AUDIO_FORMAT_E_AC3"/>
+ <xs:enumeration value="AUDIO_FORMAT_E_AC3_JOC"/>
<xs:enumeration value="AUDIO_FORMAT_DTS"/>
<xs:enumeration value="AUDIO_FORMAT_DTS_HD"/>
<xs:enumeration value="AUDIO_FORMAT_IEC61937"/>
@@ -377,17 +376,26 @@
<xs:enumeration value="AUDIO_FORMAT_ALAC"/>
<xs:enumeration value="AUDIO_FORMAT_APE"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_ADTS"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_MAIN"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LC"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SSR"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LTP"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V1"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SCALABLE"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ERLC"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LD"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V2"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ELD"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_XHE"/>
<xs:enumeration value="AUDIO_FORMAT_SBC"/>
<xs:enumeration value="AUDIO_FORMAT_APTX"/>
<xs:enumeration value="AUDIO_FORMAT_APTX_HD"/>
<xs:enumeration value="AUDIO_FORMAT_AC4"/>
<xs:enumeration value="AUDIO_FORMAT_LDAC"/>
- <xs:enumeration value="AUDIO_FORMAT_E_AC3_JOC"/>
+ <xs:enumeration value="AUDIO_FORMAT_MAT"/>
<xs:enumeration value="AUDIO_FORMAT_MAT_1_0"/>
<xs:enumeration value="AUDIO_FORMAT_MAT_2_0"/>
<xs:enumeration value="AUDIO_FORMAT_MAT_2_1"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_XHE"/>
- <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_XHE"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_LATM"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_LATM_LC"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_LATM_HE_V1"/>
@@ -397,6 +405,7 @@
<xs:enumeration value="AUDIO_FORMAT_LHDC"/>
<xs:enumeration value="AUDIO_FORMAT_LHDC_LL"/>
<xs:enumeration value="AUDIO_FORMAT_APTX_TWSP"/>
+ <xs:enumeration value="AUDIO_FORMAT_LC3"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="extendableAudioFormat">
@@ -465,9 +474,13 @@
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
+ <xs:enumeration value="AUDIO_CHANNEL_NONE"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_MONO"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_STEREO"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_2POINT1"/>
+ <xs:enumeration value="AUDIO_CHANNEL_OUT_TRI"/>
+ <xs:enumeration value="AUDIO_CHANNEL_OUT_TRI_BACK"/>
+ <xs:enumeration value="AUDIO_CHANNEL_OUT_3POINT1"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_2POINT0POINT2"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_2POINT1POINT2"/>
<xs:enumeration value="AUDIO_CHANNEL_OUT_3POINT0POINT2"/>
@@ -538,19 +551,27 @@
<xs:attribute name="samplingRates" type="samplingRates" use="optional"/>
<xs:attribute name="channelMasks" type="channelMasks" use="optional"/>
</xs:complexType>
- <xs:simpleType name="gainMode">
+ <xs:simpleType name="audioGainMode">
<xs:restriction base="xs:string">
<xs:enumeration value="AUDIO_GAIN_MODE_JOINT"/>
<xs:enumeration value="AUDIO_GAIN_MODE_CHANNELS"/>
<xs:enumeration value="AUDIO_GAIN_MODE_RAMP"/>
</xs:restriction>
</xs:simpleType>
+ <xs:simpleType name="audioGainModeMaskUnrestricted">
+ <xs:list itemType="audioGainMode" />
+ </xs:simpleType>
+ <xs:simpleType name='audioGainModeMask'>
+ <xs:restriction base='audioGainModeMaskUnrestricted'>
+ <xs:minLength value='1' />
+ </xs:restriction>
+ </xs:simpleType>
<xs:complexType name="gains">
<xs:sequence>
<xs:element name="gain" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:token" use="required"/>
- <xs:attribute name="mode" type="gainMode" use="required"/>
+ <xs:attribute name="mode" type="audioGainModeMask" use="required"/>
<xs:attribute name="channel_mask" type="audioChannelMask" use="optional"/>
<xs:attribute name="minValueMB" type="xs:int" use="optional"/>
<xs:attribute name="maxValueMB" type="xs:int" use="optional"/>
@@ -670,6 +691,7 @@
<xs:enumeration value="AUDIO_STREAM_ASSISTANT"/>
<xs:enumeration value="AUDIO_STREAM_REROUTING"/>
<xs:enumeration value="AUDIO_STREAM_PATCH"/>
+ <xs:enumeration value="AUDIO_STREAM_CALL_ASSISTANT"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="audioSource">
diff --git a/audio/common/7.0/enums/include/audio_policy_configuration_V7_0-enums.h b/audio/common/7.0/enums/include/audio_policy_configuration_V7_0-enums.h
index d5fedce..cedcab3 100644
--- a/audio/common/7.0/enums/include/audio_policy_configuration_V7_0-enums.h
+++ b/audio/common/7.0/enums/include/audio_policy_configuration_V7_0-enums.h
@@ -25,6 +25,8 @@
static inline size_t getChannelCount(AudioChannelMask mask) {
switch (mask) {
+ case AudioChannelMask::AUDIO_CHANNEL_NONE:
+ return 0;
case AudioChannelMask::AUDIO_CHANNEL_OUT_MONO:
case AudioChannelMask::AUDIO_CHANNEL_IN_MONO:
case AudioChannelMask::AUDIO_CHANNEL_INDEX_MASK_1:
@@ -42,9 +44,12 @@
case AudioChannelMask::AUDIO_CHANNEL_OUT_2POINT1:
case AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A:
case AudioChannelMask::AUDIO_CHANNEL_OUT_MONO_HAPTIC_AB:
+ case AudioChannelMask::AUDIO_CHANNEL_OUT_TRI:
+ case AudioChannelMask::AUDIO_CHANNEL_OUT_TRI_BACK:
case AudioChannelMask::AUDIO_CHANNEL_INDEX_MASK_3:
return 3;
case AudioChannelMask::AUDIO_CHANNEL_OUT_2POINT0POINT2:
+ case AudioChannelMask::AUDIO_CHANNEL_OUT_3POINT1:
case AudioChannelMask::AUDIO_CHANNEL_OUT_QUAD:
case AudioChannelMask::AUDIO_CHANNEL_OUT_QUAD_BACK:
case AudioChannelMask::AUDIO_CHANNEL_OUT_QUAD_SIDE:
@@ -158,6 +163,8 @@
case AudioDevice::AUDIO_DEVICE_OUT_USB_HEADSET:
case AudioDevice::AUDIO_DEVICE_OUT_HEARING_AID:
case AudioDevice::AUDIO_DEVICE_OUT_ECHO_CANCELLER:
+ case AudioDevice::AUDIO_DEVICE_OUT_BLE_HEADSET:
+ case AudioDevice::AUDIO_DEVICE_OUT_BLE_SPEAKER:
case AudioDevice::AUDIO_DEVICE_OUT_DEFAULT:
case AudioDevice::AUDIO_DEVICE_OUT_STUB:
return true;
@@ -189,6 +196,7 @@
case AudioDevice::AUDIO_DEVICE_IN_BLUETOOTH_BLE:
case AudioDevice::AUDIO_DEVICE_IN_HDMI_ARC:
case AudioDevice::AUDIO_DEVICE_IN_ECHO_REFERENCE:
+ case AudioDevice::AUDIO_DEVICE_IN_BLE_HEADSET:
case AudioDevice::AUDIO_DEVICE_IN_DEFAULT:
case AudioDevice::AUDIO_DEVICE_IN_STUB:
return false;
diff --git a/audio/common/7.0/types.hal b/audio/common/7.0/types.hal
index 31c7388..0d0fa7e 100644
--- a/audio/common/7.0/types.hal
+++ b/audio/common/7.0/types.hal
@@ -106,6 +106,8 @@
/**
* Audio channel mask indicates presence of particular channels.
+ * Note that every value is already a mask comprised of individual
+ * channels.
* See 'audioChannelMask' in audio_policy_configuration.xsd for the
* list of allowed values.
*/
@@ -127,13 +129,8 @@
AudioFormat format;
/** List of the sample rates (in Hz) supported by the profile. */
vec<uint32_t> sampleRates;
- /**
- * List of channel masks supported by the profile. Every subvector might be
- * comprised of several individual channel mask entries for non-traditional
- * channel masks, e.g. a combination "OUT_FRONT_LEFT,OUT_FRONT_CENTER" which
- * doesn't have a corresponding predefined channel mask.
- */
- vec<vec<AudioChannelMask>> channelMasks;
+ /** List of channel masks supported by the profile. */
+ vec<AudioChannelMask> channelMasks;
};
/**
@@ -299,21 +296,18 @@
/**
* Type of gain control exposed by an audio port.
+ * See 'audioGainMode' in audio_policy_configuration.xsd for the
+ * list of allowed values.
*/
-@export(name="", value_prefix="AUDIO_GAIN_MODE_")
-enum AudioGainMode : uint32_t {
- JOINT = 0x1, // supports joint channel gain control
- CHANNELS = 0x2, // supports separate channel gain control
- RAMP = 0x4 // supports gain ramps
-};
+typedef string AudioGainMode;
/**
* An audio_gain struct is a representation of a gain stage.
* A gain stage is always attached to an audio port.
*/
struct AudioGain {
- bitfield<AudioGainMode> mode;
- vec<AudioChannelMask> channelMask; // channels which gain an be controlled
+ vec<AudioGainMode> mode; // modes of operation
+ AudioChannelMask channelMask; // channels which gain can be controlled
int32_t minValue; // minimum gain value in millibels
int32_t maxValue; // maximum gain value in millibels
int32_t defaultValue; // default gain value in millibels
@@ -328,8 +322,8 @@
*/
struct AudioGainConfig {
int32_t index; // index of the corresponding AudioGain in AudioPort.gains
- AudioGainMode mode;
- vec<AudioChannelMask> channelMask; // channels which gain value follows
+ vec<AudioGainMode> mode; // modes of operation
+ AudioChannelMask channelMask; // channels which gain value follows
/**
* Gain values in millibels for each channel ordered from LSb to MSb in
* channel mask. The number of values is 1 in joint mode or
diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp
index 147d062..710ddce 100644
--- a/audio/common/all-versions/default/service/service.cpp
+++ b/audio/common/all-versions/default/service/service.cpp
@@ -87,7 +87,8 @@
},
{
"Bluetooth Audio API",
- "android.hardware.bluetooth.audio@2.0::IBluetoothAudioProvidersFactory"
+ "android.hardware.bluetooth.audio@2.1::IBluetoothAudioProvidersFactory",
+ "android.hardware.bluetooth.audio@2.0::IBluetoothAudioProvidersFactory",
},
// remove the old HIDL when Bluetooth Audio Hal V2 has offloading supported
{
diff --git a/audio/core/all-versions/default/Conversions.cpp b/audio/core/all-versions/default/Conversions.cpp
index eddff55..0b6ad80 100644
--- a/audio/core/all-versions/default/Conversions.cpp
+++ b/audio/core/all-versions/default/Conversions.cpp
@@ -31,7 +31,7 @@
// HAL assumes that the address is NUL-terminated.
char halAddress[AUDIO_DEVICE_MAX_ADDRESS_LEN];
memset(halAddress, 0, sizeof(halAddress));
- uint32_t halDevice = static_cast<uint32_t>(address.device);
+ audio_devices_t halDevice = static_cast<audio_devices_t>(address.device);
if (getAudioDeviceOutAllA2dpSet().count(halDevice) > 0 ||
halDevice == AUDIO_DEVICE_IN_BLUETOOTH_A2DP) {
snprintf(halAddress, sizeof(halAddress), "%02X:%02X:%02X:%02X:%02X:%02X",
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index 5e4b414..0a9d5ee 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -1150,7 +1150,7 @@
for (const auto& channelMask : profile.channelMasks) {
AudioConfigBase config{.format = profile.format,
.sampleRateHz = sampleRate,
- .channelMask = channelMask};
+ .channelMask = {{channelMask}}};
auto ret = stream->setAudioProperties(config);
EXPECT_TRUE(ret.isOk());
EXPECT_EQ(Result::OK, ret) << config.format << "; " << config.sampleRateHz << "; "
diff --git a/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp b/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp
index 687c70c..c09b265 100644
--- a/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp
+++ b/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp
@@ -34,11 +34,19 @@
authsecret = IAuthSecret::getService(GetParam());
ASSERT_NE(authsecret, nullptr);
+ // Notify LSS to generate PIN code '1234' and corresponding secret.
+ (void)system("cmd lock_settings set-pin 1234");
+
// All tests must enroll the correct secret first as this cannot be changed
// without a factory reset and the order of tests could change.
authsecret->primaryUserCredential(CORRECT_SECRET);
}
+ static void TearDownTestSuite() {
+ // clean up PIN code after testing
+ (void)system("cmd lock_settings clear --old 1234");
+ }
+
sp<IAuthSecret> authsecret;
hidl_vec<uint8_t> CORRECT_SECRET{61, 93, 124, 240, 5, 0, 7, 201, 9, 129, 11, 12, 0, 14, 0, 16};
hidl_vec<uint8_t> WRONG_SECRET{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index e3b559e..80a1831 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -1095,6 +1095,30 @@
{
.config =
{
+ .prop = toInt(VehicleProperty::POWER_POLICY_REQ),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ },
+ },
+ {
+ .config =
+ {
+ .prop = toInt(VehicleProperty::POWER_POLICY_GROUP_REQ),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ },
+ },
+ {
+ .config =
+ {
+ .prop = toInt(VehicleProperty::CURRENT_POWER_POLICY),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ },
+ },
+ {
+ .config =
+ {
.prop = toInt(VehicleProperty::WATCHDOG_ALIVE),
.access = VehiclePropertyAccess::WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 11fe70e..931fee4 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -2921,6 +2921,65 @@
| VehicleArea:GLOBAL),
/**
+ * Defines a request to apply power policy.
+ *
+ * VHAL sets this property to change car power policy. Car power policy service subscribes to
+ * this property and actually changes the power policy.
+ * The request is made by setting the VehiclePropValue with the ID of a power policy which is
+ * defined at /vendor/etc/power_policy.xml. If the given ID is not defined, car power policy
+ * service ignores the request and the current power policy is maintained.
+ *
+ * string: "sample_policy_id" // power policy ID
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ */
+ POWER_POLICY_REQ = (
+ 0x0F21
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:STRING
+ | VehicleArea:GLOBAL),
+
+ /**
+ * Defines a request to set the power polic group used to decide a default power policy per
+ * power status transition.
+ *
+ * VHAL sets this property with the ID of a power policy group in order to set the default power
+ * policy applied at power status transition. Power policy groups are defined at
+ * /vendor/etc/power_policy.xml. If the given ID is not defined, car power policy service
+ * ignores the request.
+ * Car power policy service subscribes to this property and sets the power policy group.
+ * The actual application of power policy takes place when the system power status changes and
+ * there is a valid mapped power policy for the new power status.
+ *
+ * string: "sample_policy_group_id" // power policy group ID
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ */
+ POWER_POLICY_GROUP_REQ = (
+ 0x0F22
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:STRING
+ | VehicleArea:GLOBAL),
+
+ /**
+ * Notifies the current power policy to VHAL layer.
+ *
+ * Car power policy service sets this property when the current power policy is changed.
+ *
+ * string: "sample_policy_id" // power policy ID
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ CURRENT_POWER_POLICY = (
+ 0x0F23
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:STRING
+ | VehicleArea:GLOBAL),
+
+ /**
* Defines an event that car watchdog updates to tell it's alive.
*
* Car watchdog sets this property to system uptime in milliseconds at every 3 second.
@@ -2938,8 +2997,8 @@
/**
* Defines a process terminated by car watchdog and the reason of termination.
*
- * int32Values[0]: 1 // ProcessTerminationReason showing why a process is terminated.
- * string: "/system/bin/log" // Process execution command.
+ * int32Values[0]: 1 // ProcessTerminationReason showing why a process is terminated.
+ * string: "/system/bin/log" // Process execution command.
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:WRITE
diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp
new file mode 100644
index 0000000..4f8b71d
--- /dev/null
+++ b/biometrics/face/aidl/Android.bp
@@ -0,0 +1,22 @@
+aidl_interface {
+ name: "android.hardware.biometrics.face",
+ vendor_available: true,
+ srcs: [
+ "android/hardware/biometrics/face/**/*.aidl",
+ ],
+ imports: [
+ "android.hardware.biometrics.common",
+ "android.hardware.common",
+ "android.hardware.keymaster",
+ ],
+ stability: "vintf",
+ backend: {
+ java: {
+ enabled: false,
+ platform_apis: false,
+ },
+ cpp: {
+ enabled: false,
+ },
+ },
+}
diff --git a/biometrics/face/aidl/OWNERS b/biometrics/face/aidl/OWNERS
new file mode 100644
index 0000000..36d7261
--- /dev/null
+++ b/biometrics/face/aidl/OWNERS
@@ -0,0 +1,2 @@
+ilyamaty@google.com
+kchyn@google.com
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl
similarity index 64%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
copy to biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl
index c9fe1d7..011b711 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl
@@ -15,11 +15,30 @@
// 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.common;
-@VintfStability
-parcelable MQDescriptor {
- android.hardware.common.GrantorDescriptor[] grantors;
- ParcelFileDescriptor fileDescriptor;
- int quantum;
- int flags;
+package android.hardware.biometrics.face;
+@Backing(type="byte") @VintfStability
+enum AcquiredInfo {
+ GOOD = 0,
+ INSUFFICIENT = 1,
+ TOO_BRIGHT = 2,
+ TOO_DARK = 3,
+ TOO_CLOSE = 4,
+ TOO_FAR = 5,
+ FACE_TOO_HIGH = 6,
+ FACE_TOO_LOW = 7,
+ FACE_TOO_RIGHT = 8,
+ FACE_TOO_LEFT = 9,
+ POOR_GAZE = 10,
+ NOT_DETECTED = 11,
+ TOO_MUCH_MOTION = 12,
+ RECALIBRATE = 13,
+ TOO_DIFFERENT = 14,
+ TOO_SIMILAR = 15,
+ PAN_TOO_EXTREME = 16,
+ TILT_TOO_EXTREME = 17,
+ ROLL_TOO_EXTREME = 18,
+ FACE_OBSCURED = 19,
+ START = 20,
+ SENSOR_DIRTY = 21,
+ VENDOR = 22,
}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl
similarity index 81%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
copy to biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl
index c9fe1d7..15fcbf9 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl
@@ -15,11 +15,14 @@
// 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.common;
-@VintfStability
-parcelable MQDescriptor {
- android.hardware.common.GrantorDescriptor[] grantors;
- ParcelFileDescriptor fileDescriptor;
- int quantum;
- int flags;
+package android.hardware.biometrics.face;
+@Backing(type="byte") @VintfStability
+enum Error {
+ HW_UNAVAILABLE = 1,
+ UNABLE_TO_PROCESS = 2,
+ TIMEOUT = 3,
+ NO_SPACE = 4,
+ CANCELED = 5,
+ UNABLE_TO_REMOVE = 6,
+ VENDOR = 8,
}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl
similarity index 88%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
copy to biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl
index 07bceb0..943129e 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl
@@ -15,9 +15,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.common;
-@VintfStability
-parcelable GrantorDescriptor {
- int offset;
- long extent;
+package android.hardware.biometrics.face;
+@Backing(type="byte") @VintfStability
+enum FaceSensorType {
+ RGB = 0,
+ IR = 1,
}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl
similarity index 78%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
copy to biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl
index c9fe1d7..518fb14 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl
@@ -15,11 +15,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.common;
+package android.hardware.biometrics.face;
@VintfStability
-parcelable MQDescriptor {
- android.hardware.common.GrantorDescriptor[] grantors;
- ParcelFileDescriptor fileDescriptor;
- int quantum;
- int flags;
+interface IFace {
+ android.hardware.biometrics.face.SensorProps[] getSensorProps();
+ android.hardware.biometrics.face.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.face.ISessionCallback cb);
}
diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl
new file mode 100644
index 0000000..5d9a430
--- /dev/null
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.biometrics.face;
+@VintfStability
+interface ISession {
+ void generateChallenge(in int cookie, in int timeoutSec);
+ void revokeChallenge(in int cookie, in long challenge);
+ android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.common.NativeHandle previewSurface);
+ android.hardware.biometrics.common.ICancellationSignal authenticate(in int cookie, in long operationId);
+ android.hardware.biometrics.common.ICancellationSignal detectInteraction(in int cookie);
+ void enumerateEnrollments(in int cookie);
+ void removeEnrollments(in int cookie, in int[] enrollmentIds);
+ void getAuthenticatorId(in int cookie);
+ void invalidateAuthenticatorId(in int cookie);
+ void resetLockout(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat);
+}
diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl
new file mode 100644
index 0000000..477ba5a
--- /dev/null
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.biometrics.face;
+@VintfStability
+interface ISessionCallback {
+ void onStateChanged(in int cookie, in android.hardware.biometrics.face.SessionState state);
+ void onChallengeGenerated(in int sensorId, in int userId, in long challenge);
+ void onChallengeRevoked(in int sensorId, in int userId, in long challenge);
+ void onAcquired(in android.hardware.biometrics.face.AcquiredInfo info, in int vendorCode);
+ void onError(in android.hardware.biometrics.face.Error error, in int vendorCode);
+ void onEnrollmentProgress(in int enrollmentId, int remaining);
+ void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat);
+ void onAuthenticationFailed();
+ void onLockoutTimed(in long durationMillis);
+ void onLockoutPermanent();
+ void onLockoutCleared();
+ void onInteractionDetected();
+ void onEnrollmentsEnumerated(in int[] enrollmentIds);
+ void onEnrollmentsRemoved(in int[] enrollmentIds);
+ void onAuthenticatorIdRetrieved(in long authenticatorId);
+ void onAuthenticatorIdInvalidated();
+}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl
similarity index 82%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
copy to biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl
index c9fe1d7..9f977f5 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl
@@ -15,11 +15,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.common;
+package android.hardware.biometrics.face;
@VintfStability
-parcelable MQDescriptor {
- android.hardware.common.GrantorDescriptor[] grantors;
- ParcelFileDescriptor fileDescriptor;
- int quantum;
- int flags;
+parcelable SensorProps {
+ android.hardware.biometrics.common.CommonProps commonProps;
+ android.hardware.biometrics.face.FaceSensorType sensorType;
+ boolean halControlsPreview;
}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SessionState.aidl
similarity index 71%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
copy to biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SessionState.aidl
index c9fe1d7..8e5139b 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
+++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SessionState.aidl
@@ -15,11 +15,19 @@
// 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.common;
-@VintfStability
-parcelable MQDescriptor {
- android.hardware.common.GrantorDescriptor[] grantors;
- ParcelFileDescriptor fileDescriptor;
- int quantum;
- int flags;
+package android.hardware.biometrics.face;
+@Backing(type="byte") @VintfStability
+enum SessionState {
+ IDLING = 0,
+ TERMINATED = 1,
+ GENERATING_CHALLENGE = 2,
+ REVOKING_CHALLENGE = 3,
+ ENROLLING = 4,
+ AUTHENTICATING = 5,
+ DETECTING_INTERACTION = 6,
+ ENUMERATING_ENROLLMENTS = 7,
+ REMOVING_ENROLLMENTS = 8,
+ GETTING_AUTHENTICATOR_ID = 9,
+ INVALIDATING_AUTHENTICATOR_ID = 10,
+ RESETTING_LOCKOUT = 11,
}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl
new file mode 100644
index 0000000..fffb418
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face;
+
+@VintfStability
+@Backing(type="byte")
+enum AcquiredInfo {
+
+ /**
+ * The acquired face data was good, no further user interaction is necessary.
+ */
+ GOOD = 0,
+
+ /**
+ * The acquired face data was too noisy or did not have sufficient detail.
+ * This is a catch-all for all acquisition errors not captured by the other
+ * constants.
+ */
+ INSUFFICIENT = 1,
+
+ /**
+ * Because there was too much ambient light, the captured face data was too
+ * bright. It's reasonable to return this after multiple
+ * AcquiredInfo.INSUFFICIENT.
+ *
+ * The user is expected to take action to retry the operation in better
+ * lighting conditions when this is returned.
+ */
+ TOO_BRIGHT = 2,
+
+ /**
+ * Because there was not enough illumination, the captured face data was too
+ * dark. It's reasonable to return this after multiple
+ * AcquiredInfo.INSUFFICIENT.
+ *
+ * The user is expected to take action to retry the operation in better
+ * lighting conditions when this is returned.
+ */
+ TOO_DARK = 3,
+
+ /**
+ * The detected face is too close to the sensor, and the image cannot be
+ * processed.
+ *
+ * The user is expected to be informed to move further from the sensor when
+ * this is returned.
+ */
+ TOO_CLOSE = 4,
+
+ /**
+ * The detected face is too small, as the user might be too far away from
+ * the sensor.
+ *
+ * The user is expected to be informed to move closer to the sensor when
+ * this is returned.
+ */
+ TOO_FAR = 5,
+
+ /**
+ * Only the upper part of the face was detected. The sensor's field of view
+ * is too high.
+ *
+ * The user should be informed to move up with respect to the sensor when
+ * this is returned.
+ */
+ FACE_TOO_HIGH = 6,
+
+ /**
+ * Only the lower part of the face was detected. The sensor's field of view
+ * is too low.
+ *
+ * The user should be informed to move down with respect to the sensor when
+ * this is returned.
+ */
+ FACE_TOO_LOW = 7,
+
+ /**
+ * Only the right part of the face was detected. The sensor's field of view
+ * is too far right.
+ *
+ * The user should be informed to move to the right with respect to the
+ * sensor when this is returned.
+ */
+ FACE_TOO_RIGHT = 8,
+
+ /**
+ * Only the left part of the face was detected. The sensor's field of view
+ * is too far left.
+ *
+ * The user should be informed to move to the left with respect to the
+ * sensor when this is returned.
+ */
+ FACE_TOO_LEFT = 9,
+
+ /**
+ * The user's eyes have strayed away from the sensor. If this message is
+ * sent, the user should be informed to look at the device. If the user
+ * can't be found in the frame, one of the other acquisition messages
+ * must be sent, e.g. NOT_DETECTED.
+ */
+ POOR_GAZE = 10,
+
+ /**
+ * No face was detected within the sensor's field of view.
+ *
+ * The user should be informed to point the sensor to a face when this is
+ * returned.
+ */
+ NOT_DETECTED = 11,
+
+ /**
+ * Too much motion was detected.
+ *
+ * The user should be informed to keep their face steady relative to the
+ * sensor.
+ */
+ TOO_MUCH_MOTION = 12,
+
+ /**
+ * The sensor needs to be re-calibrated. This is an unexpected condition,
+ * and must only be sent if a serious, uncorrectable, and unrecoverable
+ * calibration issue is detected which requires user intervention, e.g.
+ * re-enrolling. The expected response to this message is to direct the
+ * user to re-enroll.
+ */
+ RECALIBRATE = 13,
+
+ /**
+ * The face is too different from a previous acquisition. This condition
+ * only applies to enrollment. This can happen if the user passes the
+ * device to someone else in the middle of enrollment.
+ */
+ TOO_DIFFERENT = 14,
+
+ /**
+ * The face is too similar to a previous acquisition. This condition only
+ * applies to enrollment. The user should change their pose.
+ */
+ TOO_SIMILAR = 15,
+
+ /**
+ * The magnitude of the pan angle of the user’s face with respect to the sensor’s
+ * capture plane is too high.
+ *
+ * The pan angle is defined as the angle swept out by the user’s face turning
+ * their neck left and right. The pan angle would be zero if the user faced the
+ * camera directly.
+ *
+ * The user should be informed to look more directly at the camera.
+ */
+ PAN_TOO_EXTREME = 16,
+
+ /**
+ * The magnitude of the tilt angle of the user’s face with respect to the sensor’s
+ * capture plane is too high.
+ *
+ * The tilt angle is defined as the angle swept out by the user’s face looking up
+ * and down. The tilt angle would be zero if the user faced the camera directly.
+ *
+ * The user should be informed to look more directly at the camera.
+ */
+ TILT_TOO_EXTREME = 17,
+
+ /**
+ * The magnitude of the roll angle of the user’s face with respect to the sensor’s
+ * capture plane is too high.
+ *
+ * The roll angle is defined as the angle swept out by the user’s face tilting their head
+ * towards their shoulders to the left and right. The roll angle would be zero if the user's
+ * head is vertically aligned with the camera.
+ *
+ * The user should be informed to look more directly at the camera.
+ */
+ ROLL_TOO_EXTREME = 18,
+
+ /**
+ * The user’s face has been obscured by some object.
+ *
+ * The user should be informed to remove any objects from the line of sight from
+ * the sensor to the user’s face.
+ */
+ FACE_OBSCURED = 19,
+
+ /**
+ * This message represents the earliest message sent at the beginning of the authentication
+ * pipeline. It is expected to be used to measure latency. For example, in a camera-based
+ * authentication system it's expected to be sent prior to camera initialization. Note this
+ * should be sent whenever authentication is restarted (see IBiometricsFace#userActivity).
+ * The framework will measure latency based on the time between the last START message and the
+ * onAuthenticated callback.
+ */
+ START = 20,
+
+ /**
+ * The sensor is dirty. The user should be informed to clean the sensor.
+ */
+ SENSOR_DIRTY = 21,
+
+ /**
+ * Vendor-specific acquisition message. See ISessionCallback#onAcquired vendorCode
+ * documentation.
+ */
+ VENDOR = 22
+}
+
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl
new file mode 100644
index 0000000..1d02456
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face;
+
+@VintfStability
+@Backing(type="byte")
+enum Error {
+ /**
+ * Reserved for testing and to keep subsequent numbering consistent with
+ * older interfaces.
+ *
+ * NO_ERROR = 0,
+ */
+
+ /**
+ * A hardware error has occurred that cannot be resolved. Try again later.
+ */
+ HW_UNAVAILABLE = 1,
+
+ /**
+ * The current enroll or authenticate operation could not be completed,
+ * e.g. the sensor was unable to process the current image or the HAT was
+ * invalid.
+ */
+ UNABLE_TO_PROCESS = 2,
+
+ /**
+ * The current operation took too long to complete. This is intended to
+ * prevent programs from blocking the face HAL indefinitely. The timeout is
+ * framework and sensor-specific, but is generally on the order of 30
+ * seconds.
+ *
+ * The timeout is a device-specific time meant to optimize power. For
+ * example after 30 seconds of searching for a face it can be use to
+ * indicate that the implementation is no longer looking and the framework
+ * should restart the operation on the next user interaction.
+ */
+ TIMEOUT = 3,
+
+ /**
+ * The current operation could not be completed because there is not enough
+ * storage space remaining to do so.
+ */
+ NO_SPACE = 4,
+
+ /**
+ * The current operation has been cancelled. This may happen if a new
+ * request (authenticate, remove, enumerate, enroll) is initiated while
+ * an on-going operation is in progress, or if cancel() was called.
+ */
+ CANCELED = 5,
+
+ /**
+ * The current remove operation could not be completed; the face template
+ * provided could not be removed.
+ */
+ UNABLE_TO_REMOVE = 6,
+
+ /**
+ * Reserved to maintain backwards compatibility. See
+ * ISessionCallback#onLockoutTimed instead.
+ *
+ * LOCKOUT = 7,
+ */
+
+ /**
+ * Used to enable a vendor-specific error message.
+ */
+ VENDOR = 8,
+
+ /**
+ * Reserved to maintain backwards compatibility. See
+ * ISessionCallback#onLockoutPermanent instead.
+ *
+ * LOCKOUT_PERMANENT = 9
+ */
+}
+
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl
similarity index 70%
rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl
rename to biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl
index eadba52..766f732 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl
@@ -14,13 +14,11 @@
* limitations under the License.
*/
-package android.hardware.biometrics.fingerprint;
+package android.hardware.biometrics.face;
@VintfStability
-oneway interface IRevokeChallengeCallback {
- /**
- * Notifies the framework when a challenge has been revoked.
- */
- void onChallengeRevoked(in int sensorId, in int userId, in long challenge);
+@Backing(type="byte")
+enum FaceSensorType {
+ RGB,
+ IR
}
-
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl
new file mode 100644
index 0000000..e9a66e2
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face;
+
+import android.hardware.biometrics.face.ISession;
+import android.hardware.biometrics.face.ISessionCallback;
+import android.hardware.biometrics.face.SensorProps;
+
+@VintfStability
+interface IFace {
+ /**
+ * getSensorProps:
+ *
+ * @return A list of properties for all face sensors available to the HAL.
+ */
+ SensorProps[] getSensorProps();
+
+ /**
+ * createSession:
+ *
+ * Creates a session that can be used by the framework to perform operations such as
+ * enroll, authenticate, etc. for the given sensorId and userId.
+ *
+ * Implementations must store user-specific state or metadata in /data/vendor_de/<user>/facedata
+ * as specified by the SELinux policy. The directory /data/vendor_de is managed by vold (see
+ * vold_prepare_subdirs.cpp). Implementations may store additional user-specific data, such as
+ * embeddings or templates in StrongBox.
+ *
+ * @param sensorId The sensorId with which this session is being created.
+ * @param userId The userId with which this session is being created.
+ * @param cb A callback to notify the framework about the session's results and events.
+ * @return A new session.
+ */
+ ISession createSession(in int sensorId, in int userId, in ISessionCallback cb);
+
+}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl
new file mode 100644
index 0000000..c7beae0
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face;
+
+import android.hardware.biometrics.common.ICancellationSignal;
+import android.hardware.keymaster.HardwareAuthToken;
+import android.hardware.common.NativeHandle;
+
+/**
+ * A session is a collection of immutable state (sensorId, userId), mutable state (SessionState),
+ * methods available for the framework to call, and a callback (ISessionCallback) to notify the
+ * framework about the events and results. A session is used to establish communication between
+ * the framework and the HAL.
+ */
+@VintfStability
+interface ISession {
+ /**
+ * generateChallenge:
+ *
+ * Begins a secure transaction request. Note that the challenge by itself is not useful. It only
+ * becomes useful when wrapped in a verifiable message such as a HardwareAuthToken.
+ *
+ * Canonical example:
+ * 1) User requests an operation, such as face enrollment.
+ * 2) Face enrollment cannot happen until the user confirms their lockscreen credential
+ * (PIN/Pattern/Password).
+ * 3) However, the biometric subsystem does not want just "any" proof of credential
+ * confirmation. It needs proof that the user explicitly authenticated credential in order
+ * to allow addition of biometric enrollments.
+ * To secure this path, the following path is taken:
+ * 1) Upon user requesting face enroll, the framework requests
+ * IFace#generateChallenge
+ * 2) Framework sends the challenge to the credential subsystem, and upon credential
+ * confirmation, a HAT is created, containing the challenge in the "challenge" field.
+ * 3) Framework sends the HAT to the HAL, e.g. ISession#enroll.
+ * 4) Implementation verifies the authenticity and integrity of the HAT.
+ * 5) Implementation now has confidence that the user entered their credential to allow
+ * biometric enrollment.
+ *
+ * Note that the interface allows multiple in-flight challenges. For example, invoking
+ * generateChallenge(0, 0, timeoutSec) twice does not invalidate the first challenge. The
+ * challenge is invalidated only when:
+ * 1) The provided timeout expires, or
+ * 2) IFace#revokeChallenge is invoked
+ *
+ * For example, the following is a possible table of valid challenges:
+ * ----------------------------------------------
+ * | SensorId | UserId | ValidUntil | Challenge |
+ * |----------|--------|------------|-----------|
+ * | 0 | 0 | <Time1> | <Random1> |
+ * | 0 | 0 | <Time2> | <Random2> |
+ * | 1 | 0 | <Time3> | <Random3> |
+ * | 0 | 10 | <Time4> | <Random4> |
+ * ----------------------------------------------
+ *
+ * @param cookie A unique number identifying this operation
+ * @param timeoutSec Duration for which the challenge is valid for
+ */
+ void generateChallenge(in int cookie, in int timeoutSec);
+
+ /**
+ * revokeChallenge:
+ *
+ * Revokes a challenge that was previously generated. Note that if an invalid combination of
+ * parameters is requested, the implementation must still notify the framework using the
+ * provided callback.
+ *
+ * @param cookie A unique number identifying this operation
+ * @param challenge Challenge that should be revoked.
+ */
+ void revokeChallenge(in int cookie, in long challenge);
+
+ /**
+ * enroll:
+ *
+ * A request to add a face enrollment.
+ *
+ * Once the HAL is able to start processing the enrollment request, it must notify the framework
+ * via ISessionCallback#onStateChanged with SessionState::ENROLLING.
+ *
+ * At any point during enrollment, if a non-recoverable error occurs, the HAL must notify the
+ * framework via ISessionCallback#onError with the applicable enrollment-specific error, and
+ * then send ISessionCallback#onStateChanged(cookie, SessionState::IDLING) if no subsequent
+ * operation is in the queue.
+ *
+ * Before capturing face data, the implementation must first verify the authenticity and
+ * integrity of the provided HardwareAuthToken. In addition, it must check that the challenge
+ * within the provided HardwareAuthToken is valid. See IFace#generateChallenge. If any of
+ * the above checks fail, the framework must be notified via ISessionCallback#onError and the
+ * HAL must notify the framework when it returns to the idle state. See
+ * Error::UNABLE_TO_PROCESS.
+ *
+ * During enrollment, the implementation may notify the framework via
+ * ISessionCallback#onAcquired with messages that may be used to guide the user. This callback
+ * can be invoked multiple times if necessary. Similarly, the framework may be notified of
+ * enrollment progress changes via ISessionCallback#onEnrollmentProgress. Once the framework is
+ * notified that there are 0 "remaining" steps, the framework may cache the "enrollmentId". See
+ * ISessionCallback#onEnrollmentProgress for more info. The HAL must notify the framework once
+ * it returns to the idle state.
+ *
+ * When a finger is successfully added and before the framework is notified of remaining=0, the
+ * implementation MUST update and associate this (sensorId, userId) pair with a new new
+ * entropy-encoded random identifier. See ISession#getAuthenticatorId for more information.
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path. The
+ * client must guarantee that it is unique per ISession.
+ * @param previewSurface A surface provided by the framework if SensorProps#halControlsPreview is
+ * set to true. The HAL must send the preview frames to previewSurface if
+ * it's not null.
+ * @param hat See above documentation.
+ * @return ICancellationSignal An object that can be used by the framework to cancel this
+ * operation.
+ */
+ ICancellationSignal enroll(in int cookie, in HardwareAuthToken hat, in NativeHandle previewSurface);
+
+ /**
+ * authenticate:
+ *
+ * A request to start looking for faces to authenticate.
+ *
+ * Once the HAL is able to start processing the authentication request, it must notify framework
+ * via ISessionCallback#onStateChanged with SessionState::AUTHENTICATING.
+ *
+ * At any point during authentication, if a non-recoverable error occurs, the HAL must notify
+ * the framework via ISessionCallback#onError with the applicable authentication-specific error,
+ * and then send ISessionCallback#onStateChanged(cookie, SessionState::IDLING) if no
+ * subsequent operation is in the queue.
+ *
+ * During authentication, the implementation may notify the framework via
+ * ISessionCallback#onAcquired with messages that may be used to guide the user. This callback
+ * can be invoked multiple times if necessary.
+ *
+ * The HAL must notify the framework of accepts/rejects via ISessionCallback#onAuthentication*.
+ *
+ * The authentication lifecycle ends when either
+ * 1) A face is accepted, and ISessionCallback#onAuthenticationSucceeded is invoked, or
+ * 2) Any non-recoverable error occurs (such as lockout). See the full list of
+ * authentication-specific errors in the Error enum.
+ *
+ * Note that upon successful authentication, the lockout counter for this (sensorId, userId)
+ * pair must be cleared.
+ *
+ * Note that upon successful authentication, ONLY sensors configured as SensorStrength::STRONG
+ * are allowed to create and send a HardwareAuthToken to the framework. See the Android CDD for
+ * more details. For SensorStrength::STRONG sensors, the HardwareAuthToken's "challenge" field
+ * must be set with the operationId passed in during #authenticate. If the sensor is NOT
+ * SensorStrength::STRONG, the HardwareAuthToken MUST be null.
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path. The
+ * client must guarantee that it is unique per ISession.
+ * @param operationId For sensors configured as SensorStrength::STRONG, this must be used ONLY
+ * upon successful authentication and wrapped in the HardwareAuthToken's
+ * "challenge" field and sent to the framework via
+ * ISessionCallback#onAuthenticated. The operationId is an opaque identifier
+ * created from a separate secure subsystem such as, but not limited to
+ * KeyStore/KeyMaster. The HardwareAuthToken can then be used as an
+ * attestation for the provided operation. For example, this is used
+ * to unlock biometric-bound auth-per-use keys (see
+ * setUserAuthenticationParameters in KeyGenParameterSpec.Builder and
+ * KeyProtection.Builder.
+ * @return ICancellationSignal An object that can be used by the framework to cancel this
+ * operation.
+ */
+ ICancellationSignal authenticate(in int cookie, in long operationId);
+
+ /**
+ * detectInteraction:
+ *
+ * A request to start looking for faces without performing matching.
+ *
+ * Once the HAL is able to start processing this request, it must notify the framework via
+ * ISessionCallback#onStateChanged with SessionState::DETECTING_INTERACTION.
+ *
+ * The framework will use this method in cases where determing user presence is required, but
+ * identifying/authentication is not. For example, when the device is encrypted (first boot) or
+ * in lockdown mode.
+ *
+ * At any point during detectInteraction, if a non-recoverable error occurs, the HAL must notify
+ * the framework via ISessionCallback#onError with the applicable error, and then send
+ * ISessionCallback#onStateChanged(cookie, SessionState::IDLING) if no subsequent operation is
+ * in the queue.
+ *
+ * The implementation must only check for a face-like image was detected (e.g. to
+ * minimize interactions due to non-face objects), and the lockout counter must not
+ * be modified.
+ *
+ * Upon detecting any face, the implementation must invoke
+ * ISessionCallback#onInteractionDetected.
+ *
+ * The lifecycle of this operation ends when either
+ * 1) Any face is detected and the framework is notified via
+ * ISessionCallback#onInteractiondetected
+ * 2) The operation was cancelled by the framework (see ICancellationSignal)
+ * 3) The HAL ends the operation, for example when a subsequent operation pre-empts this one.
+ *
+ * Note that if the operation is canceled, the implementation must notify the framework via
+ * ISessionCallback#onError with Error::CANCELED.
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path.
+ * The framework will guarantee that it is unique per ISession.
+ * @return ICancellationSignal An object that can be used by the framework to cancel this
+ * operation.
+ */
+ ICancellationSignal detectInteraction(in int cookie);
+
+ /*
+ * enumerateEnrollments:
+ *
+ * A request to enumerate (list) the enrollments for this (sensorId, userId) pair. The
+ * framework typically uses this to ensure that its cache is in sync with the HAL.
+ *
+ * Once the HAL is able to start processing this request, it must notify the framework via
+ * ISessionCallback#onStateChanged with SessionState::ENUMERATING_ENROLLMENTS.
+ *
+ * The implementation must then notify the framework with a list of enrollments applicable
+ * for the current session via ISessionCallback#onEnrollmentsEnumerated.
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path.
+ * The framework will guarantee that it is unique per ISession.
+ */
+ void enumerateEnrollments(in int cookie);
+
+ /**
+ * removeEnrollments:
+ *
+ * A request to remove the enrollments for this (sensorId, userId) pair.
+ *
+ * Once the HAL is able to start processing this request, it must notify the framework via
+ * ISessionCallback#onStateChanged with SessionState::REMOVING_ENROLLMENTS.
+ *
+ * After removing the enrollmentIds from everywhere necessary (filesystem, secure subsystems,
+ * etc), the implementation must notify the framework via ISessionCallback#onEnrollmentsRemoved.
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path.
+ * The framework will guarantee that it is unique per ISession.
+ */
+ void removeEnrollments(in int cookie, in int[] enrollmentIds);
+
+ /**
+ * getAuthenticatorId:
+ *
+ * MUST return 0 via ISessionCallback#onAuthenticatorIdRetrieved for sensors that are configured
+ * as SensorStrength::WEAK or SensorStrength::CONVENIENCE.
+ *
+ * The following only applies to sensors that are configured as SensorStrength::STRONG.
+ *
+ * The authenticatorId is a (sensorId, user)-specific identifier which can be used during key
+ * generation and key import to to associate a key (in KeyStore / KeyMaster) with the current
+ * set of enrolled faces. For example, the following public Android APIs allow for keys
+ * to be invalidated when the user adds a new enrollment after the key was created:
+ * KeyGenParameterSpec.Builder.setInvalidatedByBiometricEnrollment and
+ * KeyProtection.Builder.setInvalidatedByBiometricEnrollment.
+ *
+ * In addition, upon successful face authentication, the signed HAT that is returned to
+ * the framework via ISessionCallback#onAuthenticated must contain this identifier in the
+ * authenticatorId field.
+ *
+ * Returns an entropy-encoded random identifier associated with the current set of enrollments
+ * via ISessionCallback#onAuthenticatorIdRetrieved. The authenticatorId
+ * 1) MUST change whenever a new face is enrolled
+ * 2) MUST return 0 if no faces are enrolled
+ * 3) MUST not change if a face is deleted.
+ * 4) MUST be an entropy-encoded random number
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path. The
+ * client must guarantee that it is unique per ISession.
+ */
+ void getAuthenticatorId(in int cookie);
+
+ /**
+ * invalidateAuthenticatorId:
+ *
+ * This method only applies to sensors that are configured as SensorStrength::STRONG. If invoked
+ * by the framework for sensor of other strengths, the HAL should immediately invoke
+ * ISessionCallback#onAuthenticatorIdInvalidated.
+ *
+ * The following only applies to sensors that are configured as SensorStrength::STRONG.
+ *
+ * When invoked by the framework, the implementation must perform the following sequence of
+ * events:
+ * 1) Verify the authenticity and integrity of the provided HAT. If this check fails, the HAL
+ * must invoke ISessionCallback#onError with Error::UNABLE_TO_PROCESS and return to
+ * SessionState::IDLING if no subsequent work is in the queue.
+ * 2) Verify that the timestamp provided within the HAT is relatively recent (e.g. on the
+ * order of minutes, not hours). If this check fails, the HAL must invoke
+ * ISessionCallback#onError with Error::UNABLE_TO_PROCESS and return to
+ * SessionState::IDLING if no subsequent work is in the queue.
+ * 3) Update the authenticatorId with a new entropy-encoded random number
+ * 4) Persist the new authenticatorId to non-ephemeral storage
+ * 5) Notify the framework that the above is completed, via
+ * ISessionCallback#onAuthenticatorInvalidated
+ *
+ * A practical use case of invalidation would be when the user adds a new enrollment to a sensor
+ * managed by a different HAL instance. The public android.security.keystore APIs bind keys to
+ * "all biometrics" rather than "face-only" or "face-only" (see #getAuthenticatorId
+ * for more details). As such, the framework would coordinate invalidation across multiple
+ * biometric HALs as necessary.
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path. The
+ * client must guarantee that it is unique per ISession.
+ */
+ void invalidateAuthenticatorId(in int cookie);
+
+ /**
+ * resetLockout:
+ *
+ * Requests the implementation to clear the lockout counter. Upon receiving this request, the
+ * implementation must perform the following:
+ * 1) Verify the authenticity and integrity of the provided HAT
+ * 2) Verify that the timestamp provided within the HAT is relatively recent (e.g. on the
+ * order of minutes, not hours).
+ * If either of the checks fail, the HAL must invoke ISessionCallback#onError with
+ * Error::UNABLE_TO_PROCESS and return to SessionState::IDLING if no subsequent work is in the
+ * queue.
+ *
+ * Upon successful verification, the HAL must clear the lockout counter and notify the framework
+ * via ISessionCallback#onLockoutCleared.
+ *
+ * Note that lockout is user AND sensor specific. In other words, there is a separate lockout
+ * state for each (user, sensor) pair. For example, the following is a valid state on a
+ * multi-sensor device:
+ * ------------------------------------------------------------------
+ * | SensorId | UserId | FailedAttempts | LockedOut | LockedUntil |
+ * |----------|--------|----------------|-----------|---------------|
+ * | 0 | 0 | 1 | false | x |
+ * | 1 | 0 | 5 | true | <future_time> |
+ * | 0 | 10 | 0 | false | x |
+ * | 1 | 10 | 0 | false | x |
+ * ------------------------------------------------------------------
+ *
+ * Lockout may be cleared in the following ways:
+ * 1) ISession#resetLockout
+ * 2) After a period of time, according to a rate-limiter.
+ *
+ * Note that the "FailedAttempts" counter must be cleared upon successful face
+ * authentication. For example, if SensorId=0 UserId=0 FailedAttempts=1, and a successful
+ * face authentication occurs, the counter for that (SensorId, UserId) pair must be reset
+ * to 0.
+ *
+ * In addition, lockout states MUST persist after device reboots, HAL crashes, etc.
+ *
+ * See the Android CDD section 7.3.10 for the full set of lockout and rate-limiting
+ * requirements.
+ *
+ * @param cookie An identifier used to track subsystem operations related to this call path. The
+ * client must guarantee that it is unique per ISession.
+ * @param hat HardwareAuthToken See above documentation.
+ */
+ void resetLockout(in int cookie, in HardwareAuthToken hat);
+}
+
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl
new file mode 100644
index 0000000..2608d5f
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face;
+
+import android.hardware.biometrics.face.AcquiredInfo;
+import android.hardware.biometrics.face.Error;
+import android.hardware.biometrics.face.SessionState;
+import android.hardware.keymaster.HardwareAuthToken;
+
+@VintfStability
+interface ISessionCallback {
+ /**
+ * Used to notify the framework of session state changes. See ISession for more information.
+ */
+ void onStateChanged(in int cookie, in SessionState state);
+
+ /**
+ * Notifies the framework when a challenge is successfully generated.
+ */
+ void onChallengeGenerated(in int sensorId, in int userId, in long challenge);
+
+ /**
+ * Notifies the framework when a challenge has been revoked.
+ */
+ void onChallengeRevoked(in int sensorId, in int userId, in long challenge);
+
+ /**
+ * This method must only be used to notify the framework during the following states:
+ * 1) SessionState::ENROLLING
+ * 2) SessionState::AUTHENTICATING
+ * 3) SessionState::DETECTING_INTERACTION
+ *
+ * These messages may be used to provide user guidance multiple times if necessary per
+ * operation.
+ *
+ * @param info See the AcquiredInfo enum.
+ * @param vendorCode Only valid if info == AcquiredInfo::VENDOR. The vendorCode must be used to
+ * index into the configuration
+ * com.android.internal.R.array.face_acquired_vendor that's installed
+ * on the vendor partition.
+ */
+ void onAcquired(in AcquiredInfo info, in int vendorCode);
+
+ /**
+ * This method must only be used to notify the framework during the following states:
+ * 1) SessionState::ENROLLING
+ * 2) SessionState::AUTHENTICATING
+ * 3) SessionState::DETECTING_INTERACTION
+ * 4) SessionState::INVALIDATING_AUTHENTICATOR_ID
+ * 5) SessionState::RESETTING_LOCKOUT
+ *
+ * These messages may be used to notify the framework or user that a non-recoverable error
+ * has occurred. The operation is finished, and the HAL must proceed with the next operation
+ * or return to SessionState::IDLING if the queue is empty.
+ *
+ * Note that cancellation (see common::ICancellationSignal) and preemption most be followed with
+ * an Error::CANCELED message.
+ *
+ * @param error See the Error enum.
+ * @param vendorCode Only valid if error == Error::VENDOR. The vendorCode must be used to index
+ * into the configuration
+ * com.android.internal.R.face_error_vendor that's installed on the
+ * vendor partition.
+ */
+ void onError(in Error error, in int vendorCode);
+
+ /**
+ * This method must only be used to notify the framework during the following state:
+ * 1) SessionState::ENROLLING
+ *
+ * @param enrollmentId Unique stable identifier for the enrollment that's being added by this
+ * ISession#enroll invocation.
+ * @param remaining Remaining number of steps before enrollment is complete.
+ */
+ void onEnrollmentProgress(in int enrollmentId, int remaining);
+
+ /**
+ * This method must only be used to notify the framework during SessionState::AUTHENTICATING.
+ *
+ * Used to notify the framework upon successful authentication. Note that the authentication
+ * lifecycle ends when either 1) a face is accepted, or 2) an error occurred. The
+ * authentication lifecycle does NOT end when a face is rejected.
+ *
+ * @param enrollmentId Face that was accepted.
+ * @param hat If the sensor is configured as SensorStrength::STRONG, a non-null attestation that
+ * a face was accepted. The HardwareAuthToken's "challenge" field must be set
+ * with the operationId passed in during ISession#authenticate. If the sensor is NOT
+ * SensorStrength::STRONG, the HardwareAuthToken MUST be null.
+ */
+ void onAuthenticationSucceeded(in int enrollmentId, in HardwareAuthToken hat);
+
+ /**
+ * This method must only be used to notify the framework during SessionState::AUTHENTICATING.
+ *
+ * Used to notify the framework upon rejected attempts. Note that the authentication
+ * lifecycle ends when either 1) a face is accepted, or 2) an occurred. The
+ * authentication lifecycle does NOT end when a face is rejected.
+ */
+ void onAuthenticationFailed();
+
+ /**
+ * This method must only be used to notify the framework during SessionState::AUTHENTICATING.
+ *
+ * Authentication is locked out due to too many unsuccessful attempts. This is a rate-limiting
+ * lockout, and authentication can be restarted after a period of time. See
+ * ISession#resetLockout.
+ *
+ * @param sensorId Sensor for which the user is locked out.
+ * @param userId User for which the sensor is locked out.
+ * @param durationMillis Remaining duration of the lockout.
+ */
+ void onLockoutTimed(in long durationMillis);
+
+ /**
+ * This method must only be used to notify the framework during SessionState::AUTHENTICATING.
+ *
+ * Authentication is disabled until the user unlocks with their device credential
+ * (PIN/Pattern/Password). See ISession#resetLockout.
+ *
+ * @param sensorId Sensor for which the user is locked out.
+ * @param userId User for which the sensor is locked out.
+ */
+ void onLockoutPermanent();
+
+ /**
+ * Notifies the framework that lockout has been cleared for this (sensorId, userId) pair.
+ *
+ * Note that this method can be used to notify the framework during any state.
+ *
+ * Lockout can be cleared in the following scenarios:
+ * 1) A timed lockout has ended (e.g. durationMillis specified in previous #onLockoutTimed
+ * has expired.
+ * 2) See ISession#resetLockout.
+ *
+ * @param sensorId Sensor for which the user's lockout is cleared.
+ * @param userId User for the sensor's lockout is cleared.
+ */
+ void onLockoutCleared();
+
+ /**
+ * This method must only be used to notify the framework during
+ * SessionState::DETECTING_INTERACTION
+ *
+ * Notifies the framework that user interaction occurred. See ISession#detectInteraction.
+ */
+ void onInteractionDetected();
+
+ /**
+ * This method must only be used to notify the framework during
+ * SessionState::ENUMERATING_ENROLLMENTS.
+ *
+ * Notifies the framework of the current enrollments. See ISession#enumerateEnrollments.
+ *
+ * @param enrollmentIds A list of enrollments for the session's (userId, sensorId) pair.
+ */
+ void onEnrollmentsEnumerated(in int[] enrollmentIds);
+
+ /**
+ * This method must only be used to notify the framework during
+ * SessionState::REMOVING_ENROLLMENTS.
+ *
+ * Notifies the framework that the specified enrollments are removed.
+ *
+ * @param enrollmentIds The enrollments that were removed.
+ */
+ void onEnrollmentsRemoved(in int[] enrollmentIds);
+
+ /**
+ * This method must only be used to notify the framework during
+ * SessionState::GETTING_AUTHENTICATOR_ID.
+ *
+ * Notifies the framework with the authenticatorId corresponding to this session's
+ * (userId, sensorId) pair.
+ *
+ * @param authenticatorId See the above documentation.
+ */
+ void onAuthenticatorIdRetrieved(in long authenticatorId);
+
+ /**
+ * This method must only be used to notify the framework during
+ * SessionState::INVALIDATING_AUTHENTICATOR_ID.
+ *
+ * See ISession#invalidateAuthenticatorId for more information.
+ */
+ void onAuthenticatorIdInvalidated();
+}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl
new file mode 100644
index 0000000..53cc44e
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face;
+
+import android.hardware.biometrics.common.CommonProps;
+import android.hardware.biometrics.face.FaceSensorType;
+
+@VintfStability
+parcelable SensorProps {
+ /**
+ * Statically configured properties that apply to this face sensor.
+ */
+ CommonProps commonProps;
+
+ /**
+ * A statically configured sensor type representing this face sensor.
+ */
+ FaceSensorType sensorType;
+
+ /**
+ * Whether or not the HAL is responsible for showing the face enrollment preview to the user.
+ * Devices with multiple front camera sensors can set this to false and rely on the framework to
+ * show the preview with one of the unused cameras. Devices with a single front sensor must set
+ * this to true and configure their send their camera stream to the preview surface provided by
+ * the framework.
+ */
+ boolean halControlsPreview;
+}
+
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/SessionState.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/SessionState.aidl
new file mode 100644
index 0000000..1878f7c
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/SessionState.aidl
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face;
+
+@VintfStability
+@Backing(type="byte")
+enum SessionState {
+ /**
+ * The HAL is not processing any session requests.
+ */
+ IDLING,
+
+ /**
+ * The session has been terminated by the HAL.
+ */
+ TERMINATED,
+
+ /**
+ * The HAL is processing the ISession#generateChallenge request.
+ */
+ GENERATING_CHALLENGE,
+
+ /**
+ * The HAL is processing the ISession#revokeChallenge request.
+ */
+ REVOKING_CHALLENGE,
+
+ /**
+ * The HAL is processing the ISession#enroll request.
+ */
+ ENROLLING,
+
+ /**
+ * The HAL is processing the ISession#authenticate request.
+ */
+ AUTHENTICATING,
+
+ /**
+ * The HAL is processing the ISession#detectInteraction request.
+ */
+ DETECTING_INTERACTION,
+
+ /**
+ * The HAL is processing the ISession#enumerateEnrollments request.
+ */
+ ENUMERATING_ENROLLMENTS,
+
+ /**
+ * The HAL is processing the ISession#removeEnrollments request.
+ */
+ REMOVING_ENROLLMENTS,
+
+ /**
+ * The HAL is processing the ISession#getAuthenticatorId request.
+ */
+ GETTING_AUTHENTICATOR_ID,
+
+ /**
+ * The HAL is processing the ISession#invalidateAuthenticatorId request.
+ */
+ INVALIDATING_AUTHENTICATOR_ID,
+
+ /**
+ * The HAL is processing the ISession#resetLockout request.
+ */
+ RESETTING_LOCKOUT
+}
+
diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp
new file mode 100644
index 0000000..51a8ef4
--- /dev/null
+++ b/biometrics/face/aidl/default/Android.bp
@@ -0,0 +1,18 @@
+cc_binary {
+ name: "android.hardware.biometrics.face-service.example",
+ relative_install_path: "hw",
+ init_rc: ["face-default.rc"],
+ vintf_fragments: ["face-default.xml"],
+ vendor: true,
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "android.hardware.biometrics.face-ndk_platform",
+ "android.hardware.biometrics.common-unstable-ndk_platform",
+ ],
+ srcs: [
+ "main.cpp",
+ "Face.cpp",
+ "Session.cpp",
+ ],
+}
diff --git a/biometrics/face/aidl/default/Face.cpp b/biometrics/face/aidl/default/Face.cpp
new file mode 100644
index 0000000..1526245
--- /dev/null
+++ b/biometrics/face/aidl/default/Face.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Face.h"
+#include "Session.h"
+
+namespace aidl::android::hardware::biometrics::face {
+
+const int kSensorId = 0;
+const common::SensorStrength kSensorStrength = common::SensorStrength::WEAK;
+const int kMaxEnrollmentsPerUser = 5;
+const FaceSensorType kSensorType = FaceSensorType::RGB;
+const bool kHalControlsPreview = true;
+const std::string kHwDeviceName = "faceSensor";
+const std::string kHardwareVersion = "vendor/model/revision";
+const std::string kFirmwareVersion = "1.01";
+const std::string kSerialNumber = "00000001";
+
+ndk::ScopedAStatus Face::getSensorProps(std::vector<SensorProps>* return_val) {
+ common::HardwareInfo hardware_info;
+ hardware_info.deviceName = kHwDeviceName;
+ hardware_info.hardwareVersion = kHardwareVersion;
+ hardware_info.firmwareVersion = kFirmwareVersion;
+ hardware_info.serialNumber = kSerialNumber;
+
+ common::CommonProps commonProps;
+ commonProps.sensorId = kSensorId;
+ commonProps.sensorStrength = kSensorStrength;
+ commonProps.maxEnrollmentsPerUser = kMaxEnrollmentsPerUser;
+ commonProps.hardwareInfo = {std::move(hardware_info)};
+
+ SensorProps props;
+ props.commonProps = std::move(commonProps);
+ props.sensorType = kSensorType;
+ props.halControlsPreview = kHalControlsPreview;
+
+ *return_val = {std::move(props)};
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Face::createSession(int32_t /*sensorId*/, int32_t /*userId*/,
+ const std::shared_ptr<ISessionCallback>& cb,
+ std::shared_ptr<ISession>* return_val) {
+ *return_val = SharedRefBase::make<Session>(cb);
+ return ndk::ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/Face.h b/biometrics/face/aidl/default/Face.h
new file mode 100644
index 0000000..786b4f8
--- /dev/null
+++ b/biometrics/face/aidl/default/Face.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/biometrics/face/BnFace.h>
+
+namespace aidl::android::hardware::biometrics::face {
+
+class Face : public BnFace {
+ public:
+ ndk::ScopedAStatus getSensorProps(std::vector<SensorProps>* _aidl_return) override;
+
+ ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId,
+ const std::shared_ptr<ISessionCallback>& cb,
+ std::shared_ptr<ISession>* _aidl_return) override;
+};
+
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/Session.cpp b/biometrics/face/aidl/default/Session.cpp
new file mode 100644
index 0000000..2b1d4a7
--- /dev/null
+++ b/biometrics/face/aidl/default/Session.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aidl/android/hardware/biometrics/common/BnCancellationSignal.h>
+
+#include "Session.h"
+
+namespace aidl::android::hardware::biometrics::face {
+
+class CancellationSignal : public common::BnCancellationSignal {
+ public:
+ ndk::ScopedAStatus cancel() override { return ndk::ScopedAStatus::ok(); }
+};
+
+Session::Session(std::shared_ptr<ISessionCallback> cb) : cb_(std::move(cb)) {}
+
+ndk::ScopedAStatus Session::generateChallenge(int32_t /*cookie*/, int32_t /*timeoutSec*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::revokeChallenge(int32_t /*cookie*/, int64_t /*challenge*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::enroll(int32_t /*cookie*/, const keymaster::HardwareAuthToken& /*hat*/,
+ const NativeHandle& /*previewSurface*/,
+ std::shared_ptr<biometrics::common::ICancellationSignal>*
+ /*returnVal*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::authenticate(int32_t /*cookie*/, int64_t /*keystoreOperationId*/,
+ std::shared_ptr<common::ICancellationSignal>* return_val) {
+ if (cb_) {
+ cb_->onStateChanged(0, SessionState::AUTHENTICATING);
+ }
+ *return_val = SharedRefBase::make<CancellationSignal>();
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::detectInteraction(
+ int32_t /*cookie*/, std::shared_ptr<common::ICancellationSignal>* /*return_val*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::enumerateEnrollments(int32_t /*cookie*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::removeEnrollments(int32_t /*cookie*/,
+ const std::vector<int32_t>& /*enrollmentIds*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::getAuthenticatorId(int32_t /*cookie*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::invalidateAuthenticatorId(int32_t /*cookie*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::resetLockout(int32_t /*cookie*/,
+ const keymaster::HardwareAuthToken& /*hat*/) {
+ return ndk::ScopedAStatus::ok();
+}
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/Session.h b/biometrics/face/aidl/default/Session.h
new file mode 100644
index 0000000..2bb5c42
--- /dev/null
+++ b/biometrics/face/aidl/default/Session.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/biometrics/face/BnSession.h>
+#include <aidl/android/hardware/biometrics/face/ISessionCallback.h>
+
+namespace aidl::android::hardware::biometrics::face {
+
+namespace common = aidl::android::hardware::biometrics::common;
+namespace keymaster = aidl::android::hardware::keymaster;
+
+using aidl::android::hardware::common::NativeHandle;
+
+class Session : public BnSession {
+ public:
+ explicit Session(std::shared_ptr<ISessionCallback> cb);
+
+ ndk::ScopedAStatus generateChallenge(int32_t cookie, int32_t timeoutSec) override;
+
+ ndk::ScopedAStatus revokeChallenge(int32_t cookie, int64_t challenge) override;
+
+ ndk::ScopedAStatus enroll(
+ int32_t cookie, const keymaster::HardwareAuthToken& hat,
+ const NativeHandle& previewSurface,
+ std::shared_ptr<biometrics::common::ICancellationSignal>* returnVal) override;
+
+ ndk::ScopedAStatus authenticate(
+ int32_t cookie, int64_t keystoreOperationId,
+ std::shared_ptr<common::ICancellationSignal>* returnVal) override;
+
+ ndk::ScopedAStatus detectInteraction(
+ int32_t cookie, std::shared_ptr<common::ICancellationSignal>* returnVal) override;
+
+ ndk::ScopedAStatus enumerateEnrollments(int32_t cookie) override;
+
+ ndk::ScopedAStatus removeEnrollments(int32_t cookie,
+ const std::vector<int32_t>& enrollmentIds) override;
+
+ ndk::ScopedAStatus getAuthenticatorId(int32_t cookie) override;
+
+ ndk::ScopedAStatus invalidateAuthenticatorId(int32_t cookie) override;
+
+ ndk::ScopedAStatus resetLockout(int32_t cookie,
+ const keymaster::HardwareAuthToken& hat) override;
+
+ private:
+ std::shared_ptr<ISessionCallback> cb_;
+};
+
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/face-default.rc b/biometrics/face/aidl/default/face-default.rc
new file mode 100644
index 0000000..f6499f0
--- /dev/null
+++ b/biometrics/face/aidl/default/face-default.rc
@@ -0,0 +1,5 @@
+service vendor.face-default /vendor/bin/hw/android.hardware.biometrics.face-service.example
+ class hal
+ user nobody
+ group nobody
+
diff --git a/biometrics/face/aidl/default/face-default.xml b/biometrics/face/aidl/default/face-default.xml
new file mode 100644
index 0000000..6915ad0
--- /dev/null
+++ b/biometrics/face/aidl/default/face-default.xml
@@ -0,0 +1,6 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.biometrics.face</name>
+ <fqname>IFace/default</fqname>
+ </hal>
+</manifest>
diff --git a/biometrics/face/aidl/default/main.cpp b/biometrics/face/aidl/default/main.cpp
new file mode 100644
index 0000000..80b153e
--- /dev/null
+++ b/biometrics/face/aidl/default/main.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Face.h"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+using aidl::android::hardware::biometrics::face::Face;
+
+int main() {
+ LOG(INFO) << "Face HAL started";
+ ABinderProcess_setThreadPoolMaxThreadCount(0);
+ std::shared_ptr<Face> hal = ndk::SharedRefBase::make<Face>();
+
+ const std::string instance = std::string(Face::descriptor) + "/default";
+ binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str());
+ CHECK(status == STATUS_OK);
+
+ ABinderProcess_joinThreadPool();
+ return EXIT_FAILURE; // should not reach
+}
diff --git a/biometrics/face/aidl/vts/Android.bp b/biometrics/face/aidl/vts/Android.bp
new file mode 100644
index 0000000..427b878
--- /dev/null
+++ b/biometrics/face/aidl/vts/Android.bp
@@ -0,0 +1,16 @@
+cc_test {
+ name: "VtsHalBiometricsFaceTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ srcs: ["VtsHalBiometricsFaceTargetTest.cpp"],
+ shared_libs: [
+ "libbinder_ndk",
+ "android.hardware.biometrics.face-ndk_platform",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp b/biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp
new file mode 100644
index 0000000..c1ba66b
--- /dev/null
+++ b/biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/biometrics/face/BnFace.h>
+#include <aidl/android/hardware/biometrics/face/BnSessionCallback.h>
+
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+#include <future>
+
+namespace aidl::android::hardware::biometrics::face {
+namespace {
+
+constexpr int kSensorId = 0;
+constexpr int kUserId = 0;
+constexpr auto kCallbackTimeout = std::chrono::seconds(1);
+
+enum class SessionCallbackMethodName {
+ kOnStateChanged,
+};
+
+struct SessionCallbackInvocation {
+ SessionCallbackMethodName method_name;
+ SessionState state;
+};
+
+class SessionCallback : public BnSessionCallback {
+ public:
+ explicit SessionCallback(std::promise<SessionCallbackInvocation> invocation_promise)
+ : invocation_promise_(std::move(invocation_promise)) {}
+ ndk::ScopedAStatus onStateChanged(int32_t /*cookie*/, SessionState state) override {
+ SessionCallbackInvocation invocation = {};
+ invocation.method_name = SessionCallbackMethodName::kOnStateChanged;
+ invocation.state = state;
+ invocation_promise_.set_value(invocation);
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onChallengeGenerated(int32_t /*sensorId*/, int32_t /*userId*/,
+ int64_t /*challenge*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onChallengeRevoked(int32_t /*sensorId*/, int32_t /*userId*/,
+ int64_t /*challenge*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onAcquired(AcquiredInfo /*info*/, int32_t /*vendorCode*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onError(Error /*error*/, int32_t /*vendorCode*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onEnrollmentProgress(int32_t /*enrollmentId*/,
+ int32_t /*remaining*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onAuthenticationSucceeded(
+ int32_t /*enrollmentId*/, const keymaster::HardwareAuthToken& /*hat*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onAuthenticationFailed() override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus onLockoutTimed(int64_t /*durationMillis*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onLockoutPermanent() override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus onLockoutCleared() override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus onInteractionDetected() override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus onEnrollmentsEnumerated(
+ const std::vector<int32_t>& /*enrollmentIds*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onEnrollmentsRemoved(
+ const std::vector<int32_t>& /*enrollmentIds*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t /*authenticatorId*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onAuthenticatorIdInvalidated() override { return ndk::ScopedAStatus::ok(); }
+
+ private:
+ std::promise<SessionCallbackInvocation> invocation_promise_;
+};
+
+class Face : public testing::TestWithParam<std::string> {
+ protected:
+ void SetUp() override {
+ AIBinder* binder = AServiceManager_waitForService(GetParam().c_str());
+ ASSERT_NE(binder, nullptr);
+ hal_ = IFace::fromBinder(ndk::SpAIBinder(binder));
+ }
+
+ std::shared_ptr<IFace> hal_;
+};
+
+TEST_P(Face, AuthenticateTest) {
+ std::promise<SessionCallbackInvocation> invocation_promise;
+ std::future<SessionCallbackInvocation> invocation_future = invocation_promise.get_future();
+ std::shared_ptr<SessionCallback> session_cb =
+ ndk::SharedRefBase::make<SessionCallback>(std::move(invocation_promise));
+
+ std::shared_ptr<ISession> session;
+ ASSERT_TRUE(hal_->createSession(kSensorId, kUserId, session_cb, &session).isOk());
+
+ std::shared_ptr<common::ICancellationSignal> cancel_cb;
+ ASSERT_TRUE(session->authenticate(0, 0, &cancel_cb).isOk());
+ ASSERT_EQ(invocation_future.wait_for(kCallbackTimeout), std::future_status::ready);
+
+ SessionCallbackInvocation invocation = invocation_future.get();
+ EXPECT_EQ(invocation.method_name, SessionCallbackMethodName::kOnStateChanged);
+ EXPECT_EQ(invocation.state, SessionState::AUTHENTICATING);
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Face);
+INSTANTIATE_TEST_SUITE_P(IFace, Face,
+ testing::ValuesIn(::android::getAidlHalInstanceNames(IFace::descriptor)),
+ ::android::PrintInstanceNameToString);
+
+} // namespace
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
+
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/fingerprint/aidl/OWNERS b/biometrics/fingerprint/aidl/OWNERS
new file mode 100644
index 0000000..36d7261
--- /dev/null
+++ b/biometrics/fingerprint/aidl/OWNERS
@@ -0,0 +1,2 @@
+ilyamaty@google.com
+kchyn@google.com
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl
index 6ca6d16..c5c6786 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl
@@ -20,6 +20,4 @@
interface IFingerprint {
android.hardware.biometrics.fingerprint.SensorProps[] getSensorProps();
android.hardware.biometrics.fingerprint.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.fingerprint.ISessionCallback cb);
- void generateChallenge(in int sensorId, in int userId, in int timeoutSec, in android.hardware.biometrics.fingerprint.IGenerateChallengeCallback cb);
- void revokeChallenge(in int sensorId, in int userId, in long challenge, in android.hardware.biometrics.fingerprint.IRevokeChallengeCallback cb);
}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IGenerateChallengeCallback.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IGenerateChallengeCallback.aidl
deleted file mode 100644
index 063be60..0000000
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IGenerateChallengeCallback.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.biometrics.fingerprint;
-@VintfStability
-interface IGenerateChallengeCallback {
- oneway void onChallengeGenerated(in int sensorId, in int userId, in long challenge);
-}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl
deleted file mode 100644
index 23fc10f..0000000
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.biometrics.fingerprint;
-@VintfStability
-interface IRevokeChallengeCallback {
- oneway void onChallengeRevoked(in int sensorId, in int userId, in long challenge);
-}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl
index c1f66e3..00a08ba 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl
@@ -18,6 +18,8 @@
package android.hardware.biometrics.fingerprint;
@VintfStability
interface ISession {
+ void generateChallenge(in int cookie, in int timeoutSec);
+ void revokeChallenge(in int cookie, in long challenge);
android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat);
android.hardware.biometrics.common.ICancellationSignal authenticate(in int cookie, in long operationId);
android.hardware.biometrics.common.ICancellationSignal detectInteraction(in int cookie);
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl
index 74ec077..b7a48a5 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl
@@ -19,6 +19,8 @@
@VintfStability
interface ISessionCallback {
void onStateChanged(in int cookie, in android.hardware.biometrics.fingerprint.SessionState state);
+ void onChallengeGenerated(in long challenge);
+ void onChallengeRevoked(in long challenge);
void onAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfo info, in int vendorCode);
void onError(in android.hardware.biometrics.fingerprint.Error error, in int vendorCode);
void onEnrollmentProgress(in int enrollmentId, int remaining);
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl
index 97f1a1e..e9daef1 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl
@@ -19,12 +19,14 @@
@Backing(type="byte") @VintfStability
enum SessionState {
IDLING = 0,
- ENROLLING = 1,
- AUTHENTICATING = 2,
- DETECTING_INTERACTION = 3,
- ENUMERATING_ENROLLMENTS = 4,
- REMOVING_ENROLLMENTS = 5,
- GETTING_AUTHENTICATOR_ID = 6,
- INVALIDATING_AUTHENTICATOR_ID = 7,
- RESETTING_LOCKOUT = 8,
+ GENERATING_CHALLENGE = 1,
+ REVOKING_CHALLENGE = 2,
+ ENROLLING = 3,
+ AUTHENTICATING = 4,
+ DETECTING_INTERACTION = 5,
+ ENUMERATING_ENROLLMENTS = 6,
+ REMOVING_ENROLLMENTS = 7,
+ GETTING_AUTHENTICATOR_ID = 8,
+ INVALIDATING_AUTHENTICATOR_ID = 9,
+ RESETTING_LOCKOUT = 10,
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl
index 4b907b4..3675aa4 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl
@@ -16,8 +16,6 @@
package android.hardware.biometrics.fingerprint;
-import android.hardware.biometrics.fingerprint.IGenerateChallengeCallback;
-import android.hardware.biometrics.fingerprint.IRevokeChallengeCallback;
import android.hardware.biometrics.fingerprint.ISession;
import android.hardware.biometrics.fingerprint.ISessionCallback;
import android.hardware.biometrics.fingerprint.SensorProps;
@@ -63,64 +61,4 @@
* @return A new session
*/
ISession createSession(in int sensorId, in int userId, in ISessionCallback cb);
-
- /**
- * generateChallenge:
- *
- * Begins a secure transaction request. Note that the challenge by itself is not useful. It only
- * becomes useful when wrapped in a verifiable message such as a HardwareAuthToken.
- *
- * Canonical example:
- * 1) User requests an operation, such as fingerprint enrollment.
- * 2) Fingerprint enrollment cannot happen until the user confirms their lockscreen credential
- * (PIN/Pattern/Password).
- * 3) However, the biometric subsystem does not want just "any" proof of credential
- * confirmation. It needs proof that the user explicitly authenticated credential in order
- * to allow addition of biometric enrollments.
- * To secure this path, the following path is taken:
- * 1) Upon user requesting fingerprint enroll, the framework requests
- * IFingerprint#generateChallenge
- * 2) Framework sends the challenge to the credential subsystem, and upon credential
- * confirmation, a HAT is created, containing the challenge in the "challenge" field.
- * 3) Framework sends the HAT to the HAL, e.g. ISession#enroll.
- * 4) Implementation verifies the authenticity and integrity of the HAT.
- * 5) Implementation now has confidence that the user entered their credential to allow
- * biometric enrollment.
- *
- * Note that the interface allows multiple in-flight challenges. For example, invoking
- * generateChallenge(0, 0, timeoutSec, cb) twice does not invalidate the first challenge. The
- * challenge is invalidated only when:
- * 1) The provided timeout expires, or
- * 2) IFingerprint#revokeChallenge is invoked
- *
- * For example, the following is a possible table of valid challenges:
- * ----------------------------------------------
- * | SensorId | UserId | ValidUntil | Challenge |
- * |----------|--------|------------|-----------|
- * | 0 | 0 | <Time1> | <Random1> |
- * | 0 | 0 | <Time2> | <Random2> |
- * | 1 | 0 | <Time3> | <Random3> |
- * | 0 | 10 | <Time4> | <Random4> |
- * ----------------------------------------------
- *
- * @param sensorId Sensor to associate the challenge with
- * @param userId User to associate the challenge with
- * @param timeoutSec Duration for which the challenge is valid for
- * @param cb Callback to notify the framework
- */
- void generateChallenge(in int sensorId, in int userId, in int timeoutSec, in IGenerateChallengeCallback cb);
-
- /**
- * revokeChallenge:
- *
- * Revokes a challenge that was previously generated. Note that if an invalid combination of
- * parameters is requested, the implementation must still notify the framework using the
- * provided callback.
- *
- * @param sensorId Sensor that the revocation should apply to.
- * @param userId User that the revocation should apply to.
- * @param challenge Challenge that should be revoked.
- * @param cb Used to notify the framework.
- */
- void revokeChallenge(in int sensorId, in int userId, in long challenge, in IRevokeChallengeCallback cb);
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl
index 644e214..da767be 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl
@@ -47,6 +47,62 @@
*/
/**
+ * generateChallenge:
+ *
+ * Begins a secure transaction request. Note that the challenge by itself is not useful. It only
+ * becomes useful when wrapped in a verifiable message such as a HardwareAuthToken.
+ *
+ * Canonical example:
+ * 1) User requests an operation, such as fingerprint enrollment.
+ * 2) Fingerprint enrollment cannot happen until the user confirms their lockscreen credential
+ * (PIN/Pattern/Password).
+ * 3) However, the biometric subsystem does not want just "any" proof of credential
+ * confirmation. It needs proof that the user explicitly authenticated credential in order
+ * to allow addition of biometric enrollments.
+ * To secure this path, the following path is taken:
+ * 1) Upon user requesting fingerprint enroll, the framework requests
+ * IFingerprint#generateChallenge
+ * 2) Framework sends the challenge to the credential subsystem, and upon credential
+ * confirmation, a HAT is created, containing the challenge in the "challenge" field.
+ * 3) Framework sends the HAT to the HAL, e.g. ISession#enroll.
+ * 4) Implementation verifies the authenticity and integrity of the HAT.
+ * 5) Implementation now has confidence that the user entered their credential to allow
+ * biometric enrollment.
+ *
+ * Note that the interface allows multiple in-flight challenges. For example, invoking
+ * generateChallenge(0, 0, timeoutSec, cb) twice does not invalidate the first challenge. The
+ * challenge is invalidated only when:
+ * 1) The provided timeout expires, or
+ * 2) IFingerprint#revokeChallenge is invoked
+ *
+ * For example, the following is a possible table of valid challenges:
+ * ----------------------------------------------
+ * | SensorId | UserId | ValidUntil | Challenge |
+ * |----------|--------|------------|-----------|
+ * | 0 | 0 | <Time1> | <Random1> |
+ * | 0 | 0 | <Time2> | <Random2> |
+ * | 1 | 0 | <Time3> | <Random3> |
+ * | 0 | 10 | <Time4> | <Random4> |
+ * ----------------------------------------------
+ *
+ * @param cookie A unique number identifying this operation
+ * @param timeoutSec Duration for which the challenge is valid for
+ */
+ void generateChallenge(in int cookie, in int timeoutSec);
+
+ /**
+ * revokeChallenge:
+ *
+ * Revokes a challenge that was previously generated. Note that if an invalid combination of
+ * parameters is requested, the implementation must still notify the framework using the
+ * provided callback.
+ *
+ * @param cookie A unique number identifying this operation
+ * @param challenge Challenge that should be revoked.
+ */
+ void revokeChallenge(in int cookie, in long challenge);
+
+ /**
* enroll:
*
* A request to add a fingerprint enrollment.
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl
index 74792d8..4387f98 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl
@@ -29,6 +29,16 @@
void onStateChanged(in int cookie, in SessionState state);
/**
+ * Notifies the framework when a challenge is successfully generated.
+ */
+ void onChallengeGenerated(in long challenge);
+
+ /**
+ * Notifies the framework when a challenge has been revoked.
+ */
+ void onChallengeRevoked(in long challenge);
+
+ /**
* This method must only be used to notify the framework during the following states:
* 1) SessionState::ENROLLING
* 2) SessionState::AUTHENTICATING
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SessionState.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SessionState.aidl
index 405b011..1de01ad 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SessionState.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SessionState.aidl
@@ -25,6 +25,16 @@
IDLING,
/**
+ * The HAL is processing the ISession#generateChallenge request.
+ */
+ GENERATING_CHALLENGE,
+
+ /**
+ * The HAL is processing the ISession#revokeChallenge request.
+ */
+ REVOKING_CHALLENGE,
+
+ /**
* The HAL is processing the ISession#enroll request.
*/
ENROLLING,
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index b907bf1..18ce0c8 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -60,17 +60,4 @@
*return_val = SharedRefBase::make<Session>(cb);
return ndk::ScopedAStatus::ok();
}
-
-ndk::ScopedAStatus Fingerprint::generateChallenge(
- int32_t /*sensorId*/, int32_t /*userId*/, int32_t /*timeoutSec*/,
- const std::shared_ptr<IGenerateChallengeCallback>& /*cb*/) {
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus Fingerprint::revokeChallenge(
- int32_t /*sensorId*/, int32_t /*userId*/, int64_t /*challenge*/,
- const std::shared_ptr<IRevokeChallengeCallback>& /*cb*/) {
- return ndk::ScopedAStatus::ok();
-}
-
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.h b/biometrics/fingerprint/aidl/default/Fingerprint.h
index 59cdd44..4e952ba 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.h
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.h
@@ -27,14 +27,6 @@
ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId,
const std::shared_ptr<ISessionCallback>& cb,
std::shared_ptr<ISession>* _aidl_return) override;
-
- ndk::ScopedAStatus generateChallenge(
- int32_t sensorId, int32_t userId, int32_t timeoutSec,
- const std::shared_ptr<IGenerateChallengeCallback>& cb) override;
-
- ndk::ScopedAStatus revokeChallenge(
- int32_t sensorId, int32_t userId, int64_t challenge,
- const std::shared_ptr<IRevokeChallengeCallback>& cb) override;
};
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp
index c2934a8..96f1e56 100644
--- a/biometrics/fingerprint/aidl/default/Session.cpp
+++ b/biometrics/fingerprint/aidl/default/Session.cpp
@@ -27,6 +27,14 @@
Session::Session(std::shared_ptr<ISessionCallback> cb) : cb_(std::move(cb)) {}
+ndk::ScopedAStatus Session::generateChallenge(int32_t /*cookie*/, int32_t /*timeoutSec*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Session::revokeChallenge(int32_t /*cookie*/, int64_t /*challenge*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus Session::enroll(int32_t /*cookie*/, const keymaster::HardwareAuthToken& /*hat*/,
std::shared_ptr<common::ICancellationSignal>* /*return_val*/) {
return ndk::ScopedAStatus::ok();
@@ -47,20 +55,32 @@
}
ndk::ScopedAStatus Session::enumerateEnrollments(int32_t /*cookie*/) {
+ if (cb_) {
+ cb_->onStateChanged(0, SessionState::ENUMERATING_ENROLLMENTS);
+ cb_->onEnrollmentsEnumerated(std::vector<int32_t>());
+ }
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::removeEnrollments(int32_t /*cookie*/,
const std::vector<int32_t>& /*enrollmentIds*/) {
+ if (cb_) {
+ cb_->onStateChanged(0, SessionState::REMOVING_ENROLLMENTS);
+ cb_->onEnrollmentsRemoved(std::vector<int32_t>());
+ }
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::getAuthenticatorId(int32_t /*cookie*/) {
+ if (cb_) {
+ cb_->onStateChanged(0, SessionState::GETTING_AUTHENTICATOR_ID);
+ cb_->onAuthenticatorIdRetrieved(0 /* authenticatorId */);
+ }
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::invalidateAuthenticatorId(int32_t /*cookie*/,
- const keymaster::HardwareAuthToken& /*hat*/) {
+ const keymaster::HardwareAuthToken& /*hat*/) {
return ndk::ScopedAStatus::ok();
}
@@ -81,5 +101,4 @@
ndk::ScopedAStatus Session::onUiReady() {
return ndk::ScopedAStatus::ok();
}
-
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/Session.h b/biometrics/fingerprint/aidl/default/Session.h
index f7cba1b..05c570c 100644
--- a/biometrics/fingerprint/aidl/default/Session.h
+++ b/biometrics/fingerprint/aidl/default/Session.h
@@ -28,14 +28,19 @@
public:
explicit Session(std::shared_ptr<ISessionCallback> cb);
+ ndk::ScopedAStatus generateChallenge(int32_t cookie, int32_t timeoutSec) override;
+
+ ndk::ScopedAStatus revokeChallenge(int32_t cookie, int64_t challenge) override;
+
ndk::ScopedAStatus enroll(int32_t cookie, const keymaster::HardwareAuthToken& hat,
std::shared_ptr<common::ICancellationSignal>* return_val) override;
- ndk::ScopedAStatus authenticate(int32_t cookie, int64_t keystoreOperationId,
- std::shared_ptr<common::ICancellationSignal>* return_val) override;
+ ndk::ScopedAStatus authenticate(
+ int32_t cookie, int64_t keystoreOperationId,
+ std::shared_ptr<common::ICancellationSignal>* return_val) override;
- ndk::ScopedAStatus detectInteraction(int32_t cookie,
- std::shared_ptr<common::ICancellationSignal>* return_val) override;
+ ndk::ScopedAStatus detectInteraction(
+ int32_t cookie, std::shared_ptr<common::ICancellationSignal>* return_val) override;
ndk::ScopedAStatus enumerateEnrollments(int32_t cookie) override;
@@ -45,7 +50,7 @@
ndk::ScopedAStatus getAuthenticatorId(int32_t cookie) override;
ndk::ScopedAStatus invalidateAuthenticatorId(int32_t cookie,
- const keymaster::HardwareAuthToken& hat) override;
+ const keymaster::HardwareAuthToken& hat) override;
ndk::ScopedAStatus resetLockout(int32_t cookie,
const keymaster::HardwareAuthToken& hat) override;
diff --git a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
index 496badc..adb98ac 100644
--- a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
+++ b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
@@ -52,6 +52,14 @@
return ndk::ScopedAStatus::ok();
}
+ ndk::ScopedAStatus onChallengeGenerated(int64_t /*challenge*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onChallengeRevoked(int64_t /*challenge*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
ndk::ScopedAStatus onAcquired(AcquiredInfo /*info*/, int32_t /*vendorCode*/) override {
return ndk::ScopedAStatus::ok();
}
diff --git a/bluetooth/audio/2.1/Android.bp b/bluetooth/audio/2.1/Android.bp
new file mode 100644
index 0000000..9af8add
--- /dev/null
+++ b/bluetooth/audio/2.1/Android.bp
@@ -0,0 +1,22 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.bluetooth.audio@2.1",
+ root: "android.hardware",
+ srcs: [
+ "types.hal",
+ "IBluetoothAudioProvider.hal",
+ "IBluetoothAudioProvidersFactory.hal",
+ ],
+ interfaces: [
+ "android.hardware.audio.common@5.0",
+ "android.hardware.bluetooth.audio@2.0",
+ "android.hidl.base@1.0",
+ "android.hidl.safe_union@1.0",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.bluetooth.updatable",
+ ],
+ gen_java: false,
+}
diff --git a/bluetooth/audio/2.1/IBluetoothAudioProvider.hal b/bluetooth/audio/2.1/IBluetoothAudioProvider.hal
new file mode 100644
index 0000000..c462b9e
--- /dev/null
+++ b/bluetooth/audio/2.1/IBluetoothAudioProvider.hal
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio@2.1;
+
+import @2.0::IBluetoothAudioProvider;
+import @2.0::IBluetoothAudioPort;
+import @2.0::Status;
+
+/**
+ * HAL interface from the Bluetooth stack to the Audio HAL
+ *
+ * The Bluetooth stack calls methods in this interface to start and end audio
+ * sessions and sends callback events to the Audio HAL.
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioProvider extends @2.0::IBluetoothAudioProvider {
+
+ /**
+ * This method indicates that the Bluetooth stack is ready to stream audio.
+ * It registers an instance of IBluetoothAudioPort with and provides the
+ * current negotiated codec to the Audio HAL. After this method is called,
+ * the Audio HAL can invoke IBluetoothAudioPort.startStream().
+ *
+ * Note: endSession() must be called to unregister this IBluetoothAudioPort
+ *
+ * @param hostIf An instance of IBluetoothAudioPort for stream control
+ * @param audioConfig The audio configuration negotiated with the remote
+ * device. The PCM parameters are set if software based encoding,
+ * otherwise the correct codec configuration is used for hardware
+ * encoding.
+ *
+ * @return status One of the following
+ * SUCCESS if this IBluetoothAudioPort was successfully registered with
+ * the Audio HAL
+ * UNSUPPORTED_CODEC_CONFIGURATION if the Audio HAL cannot register this
+ * IBluetoothAudioPort with the given codec configuration
+ * FAILURE if the Audio HAL cannot register this IBluetoothAudioPort for
+ * any other reason
+ * @return dataMQ The fast message queue for audio data from/to this
+ * provider. Audio data will be in PCM format as specified by the
+ * audioConfig.pcmConfig parameter. Invalid if streaming is offloaded
+ * from/to hardware or on failure.
+ */
+ startSession_2_1(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig)
+ generates (Status status, fmq_sync<uint8_t> dataMQ);
+};
diff --git a/bluetooth/audio/2.1/IBluetoothAudioProvidersFactory.hal b/bluetooth/audio/2.1/IBluetoothAudioProvidersFactory.hal
new file mode 100644
index 0000000..5593c7c
--- /dev/null
+++ b/bluetooth/audio/2.1/IBluetoothAudioProvidersFactory.hal
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio@2.1;
+
+import IBluetoothAudioProvider;
+import @2.0::IBluetoothAudioProvidersFactory;
+import @2.0::Status;
+
+/**
+ * This factory allows a HAL implementation to be split into multiple
+ * independent providers.
+ *
+ * When the Bluetooth stack is ready to create an audio session, it must first
+ * obtain the IBluetoothAudioProvider for that session type by calling
+ * openProvider().
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioProvidersFactory extends @2.0::IBluetoothAudioProvidersFactory {
+
+ /**
+ * Opens an audio provider for a session type. To close the provider, it is
+ * necessary to release references to the returned provider object.
+ *
+ * @param sessionType The session type (e.g.
+ * LE_AUDIO_SOFTWARE_ENCODING_DATAPATH).
+ *
+ * @return status One of the following
+ * SUCCESS if the Audio HAL successfully opens the provider with the
+ * given session type
+ * FAILURE if the Audio HAL cannot open the provider
+ * @return provider The provider of the specified session type
+ */
+ openProvider_2_1(SessionType sessionType)
+ generates (Status status, IBluetoothAudioProvider provider);
+
+ /**
+ * Gets a list of audio capabilities for a session type.
+ *
+ * For software encoding, the PCM capabilities are returned.
+ * For hardware encoding, the supported codecs and their capabilities are
+ * returned.
+ *
+ * @param sessionType The session type (e.g.
+ * A2DP_SOFTWARE_ENCODING_DATAPATH).
+ * @return audioCapabilities A list containing all the capabilities
+ * supported by the sesson type. The capabilities is a list of
+ * available options when configuring the codec for the session.
+ * For software encoding it is the PCM data rate.
+ * For hardware encoding it is the list of supported codecs and their
+ * capabilities.
+ * If a provider isn't supported, an empty list should be returned.
+ * Note: Only one entry should exist per codec when using hardware
+ * encoding.
+ */
+ getProviderCapabilities_2_1(SessionType sessionType)
+ generates (vec<AudioCapabilities> audioCapabilities);
+};
diff --git a/bluetooth/audio/2.1/default/A2dpOffloadAudioProvider.cpp b/bluetooth/audio/2.1/default/A2dpOffloadAudioProvider.cpp
new file mode 100644
index 0000000..b4a61b6
--- /dev/null
+++ b/bluetooth/audio/2.1/default/A2dpOffloadAudioProvider.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "BTAudioProviderA2dpOffload"
+
+#include "A2dpOffloadAudioProvider.h"
+
+#include <android-base/logging.h>
+#include <fmq/MessageQueue.h>
+#include <hidl/MQDescriptor.h>
+
+#include "BluetoothAudioSessionReport.h"
+#include "BluetoothAudioSupportedCodecsDB.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::bluetooth::audio::BluetoothAudioSessionReport;
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+using ::android::hardware::Void;
+using ::android::hardware::bluetooth::audio::V2_0::AudioConfiguration;
+
+using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+
+A2dpOffloadAudioProvider::A2dpOffloadAudioProvider()
+ : BluetoothAudioProvider() {
+ session_type_ = SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH;
+}
+
+bool A2dpOffloadAudioProvider::isValid(const V2_0::SessionType& sessionType) {
+ return isValid(static_cast<SessionType>(sessionType));
+}
+
+bool A2dpOffloadAudioProvider::isValid(const SessionType& sessionType) {
+ return (sessionType == session_type_);
+}
+
+Return<void> A2dpOffloadAudioProvider::startSession(
+ const sp<IBluetoothAudioPort>& hostIf,
+ const AudioConfiguration& audioConfig, startSession_cb _hidl_cb) {
+ /**
+ * Initialize the audio platform if audioConfiguration is supported.
+ * Save the IBluetoothAudioPort interface, so that it can be used
+ * later to send stream control commands to the HAL client, based on
+ * interaction with Audio framework.
+ */
+ if (audioConfig.getDiscriminator() !=
+ AudioConfiguration::hidl_discriminator::codecConfig) {
+ LOG(WARNING) << __func__
+ << " - Invalid Audio Configuration=" << toString(audioConfig);
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ } else if (!android::bluetooth::audio::IsOffloadCodecConfigurationValid(
+ session_type_, audioConfig.codecConfig())) {
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ }
+
+ return BluetoothAudioProvider::startSession(hostIf, audioConfig, _hidl_cb);
+}
+
+Return<void> A2dpOffloadAudioProvider::onSessionReady(
+ startSession_cb _hidl_cb) {
+ BluetoothAudioSessionReport::OnSessionStarted(session_type_, stack_iface_,
+ nullptr, audio_config_);
+ _hidl_cb(BluetoothAudioStatus::SUCCESS, DataMQ::Descriptor());
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/A2dpOffloadAudioProvider.h b/bluetooth/audio/2.1/default/A2dpOffloadAudioProvider.h
new file mode 100644
index 0000000..13e0b9a
--- /dev/null
+++ b/bluetooth/audio/2.1/default/A2dpOffloadAudioProvider.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "BluetoothAudioProvider.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+class A2dpOffloadAudioProvider : public BluetoothAudioProvider {
+ public:
+ A2dpOffloadAudioProvider();
+
+ bool isValid(const SessionType& sessionType) override;
+ bool isValid(const V2_0::SessionType& sessionType) override;
+
+ Return<void> startSession(const sp<V2_0::IBluetoothAudioPort>& hostIf,
+ const V2_0::AudioConfiguration& audioConfig,
+ startSession_cb _hidl_cb) override;
+
+ private:
+ Return<void> onSessionReady(startSession_cb _hidl_cb) override;
+};
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/A2dpSoftwareAudioProvider.cpp b/bluetooth/audio/2.1/default/A2dpSoftwareAudioProvider.cpp
new file mode 100644
index 0000000..a67c341
--- /dev/null
+++ b/bluetooth/audio/2.1/default/A2dpSoftwareAudioProvider.cpp
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "BTAudioProviderA2dpSoftware"
+
+#include "A2dpSoftwareAudioProvider.h"
+
+#include <android-base/logging.h>
+
+#include "BluetoothAudioSessionReport.h"
+#include "BluetoothAudioSupportedCodecsDB.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::bluetooth::audio::BluetoothAudioSessionReport;
+using ::android::hardware::Void;
+using ::android::hardware::bluetooth::audio::V2_0::AudioConfiguration;
+
+static constexpr uint32_t kPcmFrameSize = 4; // 16 bits per sample / stereo
+static constexpr uint32_t kPcmFrameCount = 128;
+static constexpr uint32_t kRtpFrameSize = kPcmFrameSize * kPcmFrameCount;
+static constexpr uint32_t kRtpFrameCount = 7; // max counts by 1 tick (20ms)
+static constexpr uint32_t kBufferSize = kRtpFrameSize * kRtpFrameCount;
+static constexpr uint32_t kBufferCount = 2; // double buffer
+static constexpr uint32_t kDataMqSize = kBufferSize * kBufferCount;
+
+A2dpSoftwareAudioProvider::A2dpSoftwareAudioProvider()
+ : BluetoothAudioProvider(), mDataMQ(nullptr) {
+ LOG(INFO) << __func__ << " - size of audio buffer " << kDataMqSize
+ << " byte(s)";
+ std::unique_ptr<DataMQ> tempDataMQ(
+ new DataMQ(kDataMqSize, /* EventFlag */ true));
+ if (tempDataMQ && tempDataMQ->isValid()) {
+ mDataMQ = std::move(tempDataMQ);
+ session_type_ = SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH;
+ } else {
+ ALOGE_IF(!tempDataMQ, "failed to allocate data MQ");
+ ALOGE_IF(tempDataMQ && !tempDataMQ->isValid(), "data MQ is invalid");
+ }
+}
+
+bool A2dpSoftwareAudioProvider::isValid(const V2_0::SessionType& sessionType) {
+ return isValid(static_cast<SessionType>(sessionType));
+}
+
+bool A2dpSoftwareAudioProvider::isValid(const SessionType& sessionType) {
+ return (sessionType == session_type_ && mDataMQ && mDataMQ->isValid());
+}
+
+Return<void> A2dpSoftwareAudioProvider::startSession(
+ const sp<IBluetoothAudioPort>& hostIf,
+ const V2_0::AudioConfiguration& audioConfig, startSession_cb _hidl_cb) {
+ /**
+ * Initialize the audio platform if audioConfiguration is supported.
+ * Save the IBluetoothAudioPort interface, so that it can be used
+ * later to send stream control commands to the HAL client, based on
+ * interaction with Audio framework.
+ */
+ if (audioConfig.getDiscriminator() !=
+ AudioConfiguration::hidl_discriminator::pcmConfig) {
+ LOG(WARNING) << __func__
+ << " - Invalid Audio Configuration=" << toString(audioConfig);
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ } else if (!android::bluetooth::audio::IsSoftwarePcmConfigurationValid(
+ audioConfig.pcmConfig())) {
+ LOG(WARNING) << __func__ << " - Unsupported PCM Configuration="
+ << toString(audioConfig.pcmConfig());
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ }
+
+ return BluetoothAudioProvider::startSession(hostIf, audioConfig, _hidl_cb);
+}
+
+Return<void> A2dpSoftwareAudioProvider::onSessionReady(
+ startSession_cb _hidl_cb) {
+ if (mDataMQ && mDataMQ->isValid()) {
+ BluetoothAudioSessionReport::OnSessionStarted(
+ session_type_, stack_iface_, mDataMQ->getDesc(), audio_config_);
+ _hidl_cb(BluetoothAudioStatus::SUCCESS, *mDataMQ->getDesc());
+ } else {
+ _hidl_cb(BluetoothAudioStatus::FAILURE, DataMQ::Descriptor());
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/A2dpSoftwareAudioProvider.h b/bluetooth/audio/2.1/default/A2dpSoftwareAudioProvider.h
new file mode 100644
index 0000000..20566d1
--- /dev/null
+++ b/bluetooth/audio/2.1/default/A2dpSoftwareAudioProvider.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <fmq/MessageQueue.h>
+#include <hidl/MQDescriptor.h>
+
+#include "BluetoothAudioProvider.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+
+using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+
+class A2dpSoftwareAudioProvider : public BluetoothAudioProvider {
+ public:
+ A2dpSoftwareAudioProvider();
+
+ bool isValid(const SessionType& sessionType) override;
+ bool isValid(const V2_0::SessionType& sessionType) override;
+
+ Return<void> startSession(const sp<IBluetoothAudioPort>& hostIf,
+ const V2_0::AudioConfiguration& audioConfig,
+ startSession_cb _hidl_cb) override;
+
+ private:
+ // audio data queue for software encoding
+ std::unique_ptr<DataMQ> mDataMQ;
+
+ Return<void> onSessionReady(startSession_cb _hidl_cb) override;
+};
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/Android.bp b/bluetooth/audio/2.1/default/Android.bp
new file mode 100644
index 0000000..5381fec
--- /dev/null
+++ b/bluetooth/audio/2.1/default/Android.bp
@@ -0,0 +1,48 @@
+cc_library_shared {
+ name: "android.hardware.bluetooth.audio@2.1-impl",
+ defaults: ["hidl_defaults"],
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: [
+ "BluetoothAudioProvidersFactory.cpp",
+ "BluetoothAudioProvider.cpp",
+ "A2dpOffloadAudioProvider.cpp",
+ "A2dpSoftwareAudioProvider.cpp",
+ "HearingAidAudioProvider.cpp",
+ "LeAudioAudioProvider.cpp",
+ ],
+ header_libs: ["libhardware_headers"],
+ shared_libs: [
+ "android.hardware.bluetooth.audio@2.0",
+ "android.hardware.bluetooth.audio@2.1",
+ "libbase",
+ "libbluetooth_audio_session_2_1",
+ "libcutils",
+ "libfmq",
+ "libhidlbase",
+ "liblog",
+ "libutils",
+ ],
+}
+
+cc_library_shared {
+ name: "libbluetooth_audio_session_2_1",
+ defaults: ["hidl_defaults"],
+ vendor: true,
+ srcs: [
+ "session/BluetoothAudioSession.cpp",
+ "session/BluetoothAudioSupportedCodecsDB.cpp",
+ ],
+ export_include_dirs: ["session/"],
+ header_libs: ["libhardware_headers"],
+ shared_libs: [
+ "android.hardware.bluetooth.audio@2.0",
+ "android.hardware.bluetooth.audio@2.1",
+ "libbase",
+ "libcutils",
+ "libfmq",
+ "libhidlbase",
+ "liblog",
+ "libutils",
+ ],
+}
diff --git a/bluetooth/audio/2.1/default/BluetoothAudioProvider.cpp b/bluetooth/audio/2.1/default/BluetoothAudioProvider.cpp
new file mode 100644
index 0000000..0f349a4
--- /dev/null
+++ b/bluetooth/audio/2.1/default/BluetoothAudioProvider.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "BTAudioProviderStub"
+
+#include "BluetoothAudioProvider.h"
+
+#include <android-base/logging.h>
+
+#include "BluetoothAudioSessionReport.h"
+#include "BluetoothAudioSupportedCodecsDB.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::bluetooth::audio::BluetoothAudioSessionReport;
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+using ::android::hardware::Void;
+
+using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+
+void BluetoothAudioDeathRecipient::serviceDied(
+ uint64_t cookie __unused,
+ const wp<::android::hidl::base::V1_0::IBase>& who __unused) {
+ LOG(ERROR) << "BluetoothAudioDeathRecipient::" << __func__
+ << " - BluetoothAudio Service died";
+ provider_->endSession();
+}
+
+BluetoothAudioProvider::BluetoothAudioProvider()
+ : death_recipient_(new BluetoothAudioDeathRecipient(this)),
+ session_type_(SessionType::UNKNOWN),
+ audio_config_({}) {}
+
+Return<void> BluetoothAudioProvider::startSession(
+ const sp<IBluetoothAudioPort>& hostIf,
+ const V2_0::AudioConfiguration& audioConfig, startSession_cb _hidl_cb) {
+ AudioConfiguration audioConfig_2_1;
+
+ audioConfig_2_1.codecConfig() = audioConfig.codecConfig();
+ audioConfig_2_1.pcmConfig() = {
+ .sampleRate = static_cast<SampleRate>(audioConfig.pcmConfig().sampleRate),
+ .channelMode = audioConfig.pcmConfig().channelMode,
+ .bitsPerSample = audioConfig.pcmConfig().bitsPerSample,
+ .dataIntervalUs = 0};
+
+ return startSession_2_1(hostIf, audioConfig_2_1, _hidl_cb);
+}
+
+Return<void> BluetoothAudioProvider::startSession_2_1(
+ const sp<IBluetoothAudioPort>& hostIf,
+ const AudioConfiguration& audioConfig, startSession_cb _hidl_cb) {
+ if (hostIf == nullptr) {
+ _hidl_cb(BluetoothAudioStatus::FAILURE, DataMQ::Descriptor());
+ return Void();
+ }
+
+ /**
+ * Initialize the audio platform if audioConfiguration is supported.
+ * Save the IBluetoothAudioPort interface, so that it can be used
+ * later to send stream control commands to the HAL client, based on
+ * interaction with Audio framework.
+ */
+ audio_config_ = audioConfig;
+ stack_iface_ = hostIf;
+ stack_iface_->linkToDeath(death_recipient_, 0);
+
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", AudioConfiguration=[" << toString(audio_config_) << "]";
+
+ onSessionReady(_hidl_cb);
+ return Void();
+}
+
+Return<void> BluetoothAudioProvider::streamStarted(
+ BluetoothAudioStatus status) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", status=" << toString(status);
+
+ /**
+ * Streaming on control path has started,
+ * HAL server should start the streaming on data path.
+ */
+ if (stack_iface_) {
+ BluetoothAudioSessionReport::ReportControlStatus(session_type_, true,
+ status);
+ } else {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", status=" << toString(status) << " has NO session";
+ }
+
+ return Void();
+}
+
+Return<void> BluetoothAudioProvider::streamSuspended(
+ BluetoothAudioStatus status) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", status=" << toString(status);
+
+ /**
+ * Streaming on control path has suspend,
+ * HAL server should suspend the streaming on data path.
+ */
+ if (stack_iface_) {
+ BluetoothAudioSessionReport::ReportControlStatus(session_type_, false,
+ status);
+ } else {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", status=" << toString(status) << " has NO session";
+ }
+
+ return Void();
+}
+
+Return<void> BluetoothAudioProvider::endSession() {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_);
+
+ if (stack_iface_) {
+ BluetoothAudioSessionReport::OnSessionEnded(session_type_);
+ stack_iface_->unlinkToDeath(death_recipient_);
+ } else {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ }
+
+ /**
+ * Clean up the audio platform as remote audio device is no
+ * longer active
+ */
+ stack_iface_ = nullptr;
+ audio_config_ = {};
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/BluetoothAudioProvider.h b/bluetooth/audio/2.1/default/BluetoothAudioProvider.h
new file mode 100644
index 0000000..a2e611f
--- /dev/null
+++ b/bluetooth/audio/2.1/default/BluetoothAudioProvider.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <android/hardware/bluetooth/audio/2.1/IBluetoothAudioProvider.h>
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::bluetooth::audio::V2_0::IBluetoothAudioPort;
+
+using BluetoothAudioStatus =
+ ::android::hardware::bluetooth::audio::V2_0::Status;
+
+class BluetoothAudioDeathRecipient;
+
+class BluetoothAudioProvider : public IBluetoothAudioProvider {
+ public:
+ BluetoothAudioProvider();
+ ~BluetoothAudioProvider() = default;
+
+ virtual bool isValid(const SessionType& sessionType) = 0;
+ virtual bool isValid(const V2_0::SessionType& sessionType) = 0;
+
+ Return<void> startSession(const sp<IBluetoothAudioPort>& hostIf,
+ const V2_0::AudioConfiguration& audioConfig,
+ startSession_cb _hidl_cb) override;
+ Return<void> startSession_2_1(const sp<IBluetoothAudioPort>& hostIf,
+ const AudioConfiguration& audioConfig,
+ startSession_cb _hidl_cb) override;
+ Return<void> streamStarted(BluetoothAudioStatus status) override;
+ Return<void> streamSuspended(BluetoothAudioStatus status) override;
+ Return<void> endSession() override;
+
+ protected:
+ sp<BluetoothAudioDeathRecipient> death_recipient_;
+
+ SessionType session_type_;
+ AudioConfiguration audio_config_;
+ sp<V2_0::IBluetoothAudioPort> stack_iface_;
+
+ virtual Return<void> onSessionReady(startSession_cb _hidl_cb) = 0;
+};
+
+class BluetoothAudioDeathRecipient : public hidl_death_recipient {
+ public:
+ BluetoothAudioDeathRecipient(const sp<BluetoothAudioProvider> provider)
+ : provider_(provider) {}
+
+ virtual void serviceDied(
+ uint64_t cookie,
+ const wp<::android::hidl::base::V1_0::IBase>& who) override;
+
+ private:
+ sp<BluetoothAudioProvider> provider_;
+};
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.cpp b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.cpp
new file mode 100644
index 0000000..adf2717
--- /dev/null
+++ b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.cpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "BTAudioProvidersFactory"
+
+#include "BluetoothAudioProvidersFactory.h"
+
+#include <android-base/logging.h>
+
+#include "BluetoothAudioSupportedCodecsDB.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Void;
+using ::android::hardware::bluetooth::audio::V2_0::CodecCapabilities;
+
+A2dpSoftwareAudioProvider
+ BluetoothAudioProvidersFactory::a2dp_software_provider_instance_;
+A2dpOffloadAudioProvider
+ BluetoothAudioProvidersFactory::a2dp_offload_provider_instance_;
+HearingAidAudioProvider
+ BluetoothAudioProvidersFactory::hearing_aid_provider_instance_;
+LeAudioOutputAudioProvider
+ BluetoothAudioProvidersFactory::leaudio_output_provider_instance_;
+LeAudioInputAudioProvider
+ BluetoothAudioProvidersFactory::leaudio_input_provider_instance_;
+
+Return<void> BluetoothAudioProvidersFactory::openProvider(
+ const V2_0::SessionType sessionType, openProvider_cb _hidl_cb) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(sessionType);
+ BluetoothAudioStatus status = BluetoothAudioStatus::SUCCESS;
+ BluetoothAudioProvider* provider = nullptr;
+ switch (sessionType) {
+ case V2_0::SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH:
+ provider = &a2dp_software_provider_instance_;
+ break;
+ case V2_0::SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH:
+ provider = &a2dp_offload_provider_instance_;
+ break;
+ case V2_0::SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH:
+ provider = &hearing_aid_provider_instance_;
+ break;
+ default:
+ status = BluetoothAudioStatus::FAILURE;
+ }
+ if (provider == nullptr || !provider->isValid(sessionType)) {
+ provider = nullptr;
+ status = BluetoothAudioStatus::FAILURE;
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(sessionType)
+ << ", status=" << toString(status);
+ }
+ _hidl_cb(status, provider);
+ return Void();
+}
+
+Return<void> BluetoothAudioProvidersFactory::openProvider_2_1(
+ const SessionType sessionType, openProvider_2_1_cb _hidl_cb) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(sessionType);
+ BluetoothAudioStatus status = BluetoothAudioStatus::SUCCESS;
+ BluetoothAudioProvider* provider = nullptr;
+ switch (sessionType) {
+ case SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH:
+ provider = &a2dp_software_provider_instance_;
+ break;
+ case SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH:
+ provider = &a2dp_offload_provider_instance_;
+ break;
+ case SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH:
+ provider = &hearing_aid_provider_instance_;
+ break;
+ case SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH:
+ provider = &leaudio_output_provider_instance_;
+ break;
+ case SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH:
+ provider = &leaudio_input_provider_instance_;
+ break;
+ default:
+ status = BluetoothAudioStatus::FAILURE;
+ }
+ if (provider == nullptr || !provider->isValid(sessionType)) {
+ provider = nullptr;
+ status = BluetoothAudioStatus::FAILURE;
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(sessionType)
+ << ", status=" << toString(status);
+ }
+ _hidl_cb(status, provider);
+ return Void();
+}
+
+Return<void> BluetoothAudioProvidersFactory::getProviderCapabilities(
+ const V2_0::SessionType sessionType, getProviderCapabilities_cb _hidl_cb) {
+ hidl_vec<V2_0::AudioCapabilities> audio_capabilities =
+ hidl_vec<V2_0::AudioCapabilities>(0);
+ if (sessionType == V2_0::SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ std::vector<CodecCapabilities> db_codec_capabilities =
+ android::bluetooth::audio::GetOffloadCodecCapabilities(sessionType);
+ if (db_codec_capabilities.size()) {
+ audio_capabilities.resize(db_codec_capabilities.size());
+ for (int i = 0; i < db_codec_capabilities.size(); ++i) {
+ audio_capabilities[i].codecCapabilities(db_codec_capabilities[i]);
+ }
+ }
+ } else if (sessionType != V2_0::SessionType::UNKNOWN) {
+ std::vector<::android::hardware::bluetooth::audio::V2_0::PcmParameters>
+ db_pcm_capabilities =
+ android::bluetooth::audio::GetSoftwarePcmCapabilities();
+ if (db_pcm_capabilities.size() == 1) {
+ audio_capabilities.resize(1);
+ audio_capabilities[0].pcmCapabilities(db_pcm_capabilities[0]);
+ }
+ }
+ LOG(INFO) << __func__ << " - SessionType=" << toString(sessionType)
+ << " supports " << audio_capabilities.size() << " codecs";
+ _hidl_cb(audio_capabilities);
+ return Void();
+}
+
+Return<void> BluetoothAudioProvidersFactory::getProviderCapabilities_2_1(
+ const SessionType sessionType, getProviderCapabilities_2_1_cb _hidl_cb) {
+ hidl_vec<AudioCapabilities> audio_capabilities =
+ hidl_vec<AudioCapabilities>(0);
+ if (sessionType == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ std::vector<CodecCapabilities> db_codec_capabilities =
+ android::bluetooth::audio::GetOffloadCodecCapabilities(sessionType);
+ if (db_codec_capabilities.size()) {
+ audio_capabilities.resize(db_codec_capabilities.size());
+ for (int i = 0; i < db_codec_capabilities.size(); ++i) {
+ audio_capabilities[i].codecCapabilities(db_codec_capabilities[i]);
+ }
+ }
+ } else if (sessionType != SessionType::UNKNOWN) {
+ std::vector<PcmParameters> db_pcm_capabilities =
+ android::bluetooth::audio::GetSoftwarePcmCapabilities_2_1();
+ if (db_pcm_capabilities.size() == 1) {
+ audio_capabilities.resize(1);
+ audio_capabilities[0].pcmCapabilities(db_pcm_capabilities[0]);
+ }
+ }
+ LOG(INFO) << __func__ << " - SessionType=" << toString(sessionType)
+ << " supports " << audio_capabilities.size() << " codecs";
+ _hidl_cb(audio_capabilities);
+ return Void();
+}
+
+IBluetoothAudioProvidersFactory* HIDL_FETCH_IBluetoothAudioProvidersFactory(
+ const char* /* name */) {
+ return new BluetoothAudioProvidersFactory();
+}
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.h b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.h
new file mode 100644
index 0000000..fd83694
--- /dev/null
+++ b/bluetooth/audio/2.1/default/BluetoothAudioProvidersFactory.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <android/hardware/bluetooth/audio/2.1/IBluetoothAudioProvidersFactory.h>
+
+#include "A2dpOffloadAudioProvider.h"
+#include "A2dpSoftwareAudioProvider.h"
+#include "BluetoothAudioProvider.h"
+#include "HearingAidAudioProvider.h"
+#include "LeAudioAudioProvider.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+class BluetoothAudioProvidersFactory : public IBluetoothAudioProvidersFactory {
+ public:
+ BluetoothAudioProvidersFactory() {}
+
+ Return<void> openProvider(const V2_0::SessionType sessionType,
+ openProvider_cb _hidl_cb) override;
+
+ Return<void> getProviderCapabilities(
+ const V2_0::SessionType sessionType,
+ getProviderCapabilities_cb _hidl_cb) override;
+
+ Return<void> openProvider_2_1(const SessionType sessionType,
+ openProvider_2_1_cb _hidl_cb) override;
+
+ Return<void> getProviderCapabilities_2_1(
+ const SessionType sessionType,
+ getProviderCapabilities_2_1_cb _hidl_cb) override;
+
+ private:
+ static A2dpSoftwareAudioProvider a2dp_software_provider_instance_;
+ static A2dpOffloadAudioProvider a2dp_offload_provider_instance_;
+ static HearingAidAudioProvider hearing_aid_provider_instance_;
+ static LeAudioOutputAudioProvider leaudio_output_provider_instance_;
+ static LeAudioInputAudioProvider leaudio_input_provider_instance_;
+};
+
+extern "C" IBluetoothAudioProvidersFactory*
+HIDL_FETCH_IBluetoothAudioProvidersFactory(const char* name);
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/HearingAidAudioProvider.cpp b/bluetooth/audio/2.1/default/HearingAidAudioProvider.cpp
new file mode 100644
index 0000000..aded7e1
--- /dev/null
+++ b/bluetooth/audio/2.1/default/HearingAidAudioProvider.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "BTAudioProviderHearingAid"
+
+#include "HearingAidAudioProvider.h"
+
+#include <android-base/logging.h>
+
+#include "BluetoothAudioSessionReport.h"
+#include "BluetoothAudioSupportedCodecsDB.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::bluetooth::audio::BluetoothAudioSessionReport;
+using ::android::hardware::Void;
+using ::android::hardware::bluetooth::audio::V2_0::AudioConfiguration;
+
+static constexpr uint32_t kPcmFrameSize = 4; // 16 bits per sample / stereo
+static constexpr uint32_t kPcmFrameCount = 128;
+static constexpr uint32_t kRtpFrameSize = kPcmFrameSize * kPcmFrameCount;
+static constexpr uint32_t kRtpFrameCount = 7; // max counts by 1 tick (20ms)
+static constexpr uint32_t kBufferSize = kRtpFrameSize * kRtpFrameCount;
+static constexpr uint32_t kBufferCount = 1; // single buffer
+static constexpr uint32_t kDataMqSize = kBufferSize * kBufferCount;
+
+HearingAidAudioProvider::HearingAidAudioProvider()
+ : BluetoothAudioProvider(), mDataMQ(nullptr) {
+ LOG(INFO) << __func__ << " - size of audio buffer " << kDataMqSize
+ << " byte(s)";
+ std::unique_ptr<DataMQ> tempDataMQ(
+ new DataMQ(kDataMqSize, /* EventFlag */ true));
+ if (tempDataMQ && tempDataMQ->isValid()) {
+ mDataMQ = std::move(tempDataMQ);
+ session_type_ = SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH;
+ } else {
+ ALOGE_IF(!tempDataMQ, "failed to allocate data MQ");
+ ALOGE_IF(tempDataMQ && !tempDataMQ->isValid(), "data MQ is invalid");
+ }
+}
+
+bool HearingAidAudioProvider::isValid(const V2_0::SessionType& sessionType) {
+ return isValid(static_cast<SessionType>(sessionType));
+}
+
+bool HearingAidAudioProvider::isValid(const SessionType& sessionType) {
+ return (sessionType == session_type_ && mDataMQ && mDataMQ->isValid());
+}
+
+Return<void> HearingAidAudioProvider::startSession(
+ const sp<IBluetoothAudioPort>& hostIf,
+ const V2_0::AudioConfiguration& audioConfig, startSession_cb _hidl_cb) {
+ /**
+ * Initialize the audio platform if audioConfiguration is supported.
+ * Save the IBluetoothAudioPort interface, so that it can be used
+ * later to send stream control commands to the HAL client, based on
+ * interaction with Audio framework.
+ */
+ if (audioConfig.getDiscriminator() !=
+ AudioConfiguration::hidl_discriminator::pcmConfig) {
+ LOG(WARNING) << __func__
+ << " - Invalid Audio Configuration=" << toString(audioConfig);
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ } else if (!android::bluetooth::audio::IsSoftwarePcmConfigurationValid(
+ audioConfig.pcmConfig())) {
+ LOG(WARNING) << __func__ << " - Unsupported PCM Configuration="
+ << toString(audioConfig.pcmConfig());
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ }
+
+ return BluetoothAudioProvider::startSession(hostIf, audioConfig, _hidl_cb);
+}
+
+Return<void> HearingAidAudioProvider::onSessionReady(startSession_cb _hidl_cb) {
+ if (mDataMQ && mDataMQ->isValid()) {
+ BluetoothAudioSessionReport::OnSessionStarted(
+ session_type_, stack_iface_, mDataMQ->getDesc(), audio_config_);
+ _hidl_cb(BluetoothAudioStatus::SUCCESS, *mDataMQ->getDesc());
+ } else {
+ _hidl_cb(BluetoothAudioStatus::FAILURE, DataMQ::Descriptor());
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/HearingAidAudioProvider.h b/bluetooth/audio/2.1/default/HearingAidAudioProvider.h
new file mode 100644
index 0000000..c949257
--- /dev/null
+++ b/bluetooth/audio/2.1/default/HearingAidAudioProvider.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <fmq/MessageQueue.h>
+#include <hidl/MQDescriptor.h>
+
+#include "BluetoothAudioProvider.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+
+using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+
+class HearingAidAudioProvider : public BluetoothAudioProvider {
+ public:
+ HearingAidAudioProvider();
+
+ bool isValid(const SessionType& sessionType) override;
+ bool isValid(const V2_0::SessionType& sessionType) override;
+
+ Return<void> startSession(const sp<IBluetoothAudioPort>& hostIf,
+ const V2_0::AudioConfiguration& audioConfig,
+ startSession_cb _hidl_cb) override;
+
+ private:
+ // audio data queue for software encoding
+ std::unique_ptr<DataMQ> mDataMQ;
+
+ Return<void> onSessionReady(startSession_cb _hidl_cb) override;
+};
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/LeAudioAudioProvider.cpp b/bluetooth/audio/2.1/default/LeAudioAudioProvider.cpp
new file mode 100644
index 0000000..1fa2dce
--- /dev/null
+++ b/bluetooth/audio/2.1/default/LeAudioAudioProvider.cpp
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2020 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
+ * www.ehima.com
+ *
+ * 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 "BTAudioProviderLeAudio"
+
+#include "LeAudioAudioProvider.h"
+
+#include <android-base/logging.h>
+
+#include "BluetoothAudioSessionReport.h"
+#include "BluetoothAudioSupportedCodecsDB.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::bluetooth::audio::BluetoothAudioSessionReport;
+using ::android::hardware::Void;
+using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample;
+using ::android::hardware::bluetooth::audio::V2_0::ChannelMode;
+using ::android::hardware::bluetooth::audio::V2_1::SampleRate;
+
+static constexpr uint32_t kBufferOutCount = 2; // two frame buffer
+static constexpr uint32_t kBufferInCount = 2; // two frame buffer
+
+LeAudioOutputAudioProvider::LeAudioOutputAudioProvider()
+ : LeAudioAudioProvider() {
+ session_type_ = SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
+}
+
+LeAudioInputAudioProvider::LeAudioInputAudioProvider()
+ : LeAudioAudioProvider() {
+ session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH;
+}
+
+LeAudioAudioProvider::LeAudioAudioProvider()
+ : BluetoothAudioProvider(), mDataMQ(nullptr) {}
+
+bool LeAudioAudioProvider::isValid(const V2_0::SessionType& sessionType) {
+ LOG(ERROR) << __func__ << ", invalid session type for Le Audio provider: "
+ << toString(sessionType);
+
+ return false;
+}
+
+bool LeAudioAudioProvider::isValid(const SessionType& sessionType) {
+ return (sessionType == session_type_);
+}
+
+Return<void> LeAudioAudioProvider::startSession_2_1(
+ const sp<V2_0::IBluetoothAudioPort>& hostIf,
+ const AudioConfiguration& audioConfig, startSession_cb _hidl_cb) {
+ /**
+ * Initialize the audio platform if audioConfiguration is supported.
+ * Save the IBluetoothAudioPort interface, so that it can be used
+ * later to send stream control commands to the HAL client, based on
+ * interaction with Audio framework.
+ */
+ if (audioConfig.getDiscriminator() !=
+ AudioConfiguration::hidl_discriminator::pcmConfig) {
+ LOG(WARNING) << __func__
+ << " - Invalid Audio Configuration=" << toString(audioConfig);
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ } else if (!android::bluetooth::audio::IsSoftwarePcmConfigurationValid_2_1(
+ audioConfig.pcmConfig())) {
+ LOG(WARNING) << __func__ << " - Unsupported PCM Configuration="
+ << toString(audioConfig.pcmConfig());
+ _hidl_cb(BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION,
+ DataMQ::Descriptor());
+ return Void();
+ }
+
+ uint32_t kDataMqSize = 0;
+ switch (audioConfig.pcmConfig().sampleRate) {
+ case SampleRate::RATE_16000:
+ kDataMqSize = 16000;
+ break;
+ case SampleRate::RATE_24000:
+ kDataMqSize = 24000;
+ break;
+ case SampleRate::RATE_44100:
+ kDataMqSize = 44100;
+ break;
+ case SampleRate::RATE_48000:
+ kDataMqSize = 48000;
+ break;
+ case SampleRate::RATE_88200:
+ kDataMqSize = 88200;
+ break;
+ case SampleRate::RATE_96000:
+ kDataMqSize = 96000;
+ break;
+ case SampleRate::RATE_176400:
+ kDataMqSize = 176400;
+ break;
+ case SampleRate::RATE_192000:
+ kDataMqSize = 192000;
+ break;
+ default:
+ /* This should never happen it would be caught while validating
+ * parameters.
+ */
+ break;
+ }
+
+ /* Number of samples per millisecond */
+ kDataMqSize = ceil(kDataMqSize / 1000);
+
+ switch (audioConfig.pcmConfig().channelMode) {
+ case ChannelMode::MONO:
+ break;
+ case ChannelMode::STEREO:
+ kDataMqSize *= 2;
+ break;
+ default:
+ /* This should never happen it would be caught while validating
+ * parameters.
+ */
+ break;
+ }
+
+ switch (audioConfig.pcmConfig().bitsPerSample) {
+ case BitsPerSample::BITS_16:
+ kDataMqSize *= 2;
+ break;
+ case BitsPerSample::BITS_24:
+ kDataMqSize *= 3;
+ break;
+ case BitsPerSample::BITS_32:
+ kDataMqSize *= 4;
+ break;
+ default:
+ /* This should never happen it would be caught while validating
+ * parameters.
+ */
+ break;
+ }
+
+ if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH)
+ kDataMqSize *= kBufferOutCount;
+ else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH)
+ kDataMqSize *= kBufferInCount;
+ else
+ LOG(WARNING) << __func__ << ", default single buffer used";
+
+ kDataMqSize *= audioConfig.pcmConfig().dataIntervalUs / 1000;
+
+ LOG(INFO) << __func__ << " - size of audio buffer " << kDataMqSize
+ << " byte(s)";
+
+ std::unique_ptr<DataMQ> tempDataMQ(
+ new DataMQ(kDataMqSize, /* EventFlag */ true));
+ if (tempDataMQ && tempDataMQ->isValid()) {
+ mDataMQ = std::move(tempDataMQ);
+ } else {
+ ALOGE_IF(!tempDataMQ, "failed to allocate data MQ");
+ ALOGE_IF(tempDataMQ && !tempDataMQ->isValid(), "data MQ is invalid");
+ _hidl_cb(BluetoothAudioStatus::FAILURE, DataMQ::Descriptor());
+ return Void();
+ }
+
+ return BluetoothAudioProvider::startSession_2_1(hostIf, audioConfig,
+ _hidl_cb);
+}
+
+Return<void> LeAudioAudioProvider::onSessionReady(startSession_cb _hidl_cb) {
+ if (mDataMQ && mDataMQ->isValid()) {
+ BluetoothAudioSessionReport::OnSessionStarted(
+ session_type_, stack_iface_, mDataMQ->getDesc(), audio_config_);
+ _hidl_cb(BluetoothAudioStatus::SUCCESS, *mDataMQ->getDesc());
+ } else {
+ _hidl_cb(BluetoothAudioStatus::FAILURE, DataMQ::Descriptor());
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/LeAudioAudioProvider.h b/bluetooth/audio/2.1/default/LeAudioAudioProvider.h
new file mode 100644
index 0000000..09b2b54
--- /dev/null
+++ b/bluetooth/audio/2.1/default/LeAudioAudioProvider.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2020 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
+ * www.ehima.com
+ *
+ * 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 <android/hardware/bluetooth/audio/2.1/types.h>
+#include <fmq/MessageQueue.h>
+#include <hidl/MQDescriptor.h>
+
+#include "BluetoothAudioProvider.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace audio {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+
+using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+
+class LeAudioAudioProvider : public BluetoothAudioProvider {
+ public:
+ LeAudioAudioProvider();
+
+ bool isValid(const SessionType& sessionType) override;
+ bool isValid(const V2_0::SessionType& sessionType) override;
+
+ Return<void> startSession_2_1(const sp<V2_0::IBluetoothAudioPort>& hostIf,
+ const AudioConfiguration& audioConfig,
+ startSession_cb _hidl_cb) override;
+
+ private:
+ /** queue for software encodec/decoded audio data */
+ std::unique_ptr<DataMQ> mDataMQ;
+
+ Return<void> onSessionReady(startSession_cb _hidl_cb) override;
+};
+
+class LeAudioOutputAudioProvider : public LeAudioAudioProvider {
+ public:
+ LeAudioOutputAudioProvider();
+};
+
+class LeAudioInputAudioProvider : public LeAudioAudioProvider {
+ public:
+ LeAudioInputAudioProvider();
+};
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace audio
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/session/BluetoothAudioSession.cpp b/bluetooth/audio/2.1/default/session/BluetoothAudioSession.cpp
new file mode 100644
index 0000000..ea2c54a
--- /dev/null
+++ b/bluetooth/audio/2.1/default/session/BluetoothAudioSession.cpp
@@ -0,0 +1,467 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "BTAudioProviderSession"
+
+#include "BluetoothAudioSession.h"
+
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+
+using ::android::hardware::audio::common::V5_0::AudioContentType;
+using ::android::hardware::audio::common::V5_0::AudioUsage;
+using ::android::hardware::audio::common::V5_0::PlaybackTrackMetadata;
+using ::android::hardware::audio::common::V5_0::SourceMetadata;
+using ::android::hardware::bluetooth::audio::V2_0::CodecType;
+using ::android::hardware::bluetooth::audio::V2_0::TimeSpec;
+
+const CodecConfiguration BluetoothAudioSession::kInvalidCodecConfiguration = {
+ .codecType = CodecType::UNKNOWN,
+ .encodedAudioBitrate = 0x00000000,
+ .peerMtu = 0xffff,
+ .isScmstEnabled = false,
+ .config = {}};
+AudioConfiguration BluetoothAudioSession::invalidSoftwareAudioConfiguration =
+ {};
+AudioConfiguration BluetoothAudioSession::invalidOffloadAudioConfiguration = {};
+
+static constexpr int kFmqSendTimeoutMs = 1000; // 1000 ms timeout for sending
+static constexpr int kFmqReceiveTimeoutMs =
+ 1000; // 1000 ms timeout for receiving
+static constexpr int kWritePollMs = 1; // polled non-blocking interval
+static constexpr int kReadPollMs = 1; // polled non-blocking interval
+
+static inline timespec timespec_convert_from_hal(const TimeSpec& TS) {
+ return {.tv_sec = static_cast<long>(TS.tvSec),
+ .tv_nsec = static_cast<long>(TS.tvNSec)};
+}
+
+BluetoothAudioSession::BluetoothAudioSession(const SessionType& session_type)
+ : session_type_(session_type), stack_iface_(nullptr), mDataMQ(nullptr) {
+ invalidSoftwareAudioConfiguration.pcmConfig(kInvalidPcmParameters);
+ invalidOffloadAudioConfiguration.codecConfig(kInvalidCodecConfiguration);
+}
+
+// The report function is used to report that the Bluetooth stack has started
+// this session without any failure, and will invoke session_changed_cb_ to
+// notify those registered bluetooth_audio outputs
+void BluetoothAudioSession::OnSessionStarted(
+ const sp<IBluetoothAudioPort> stack_iface, const DataMQ::Descriptor* dataMQ,
+ const AudioConfiguration& audio_config) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (stack_iface == nullptr) {
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", IBluetoothAudioPort Invalid";
+ } else if (!UpdateAudioConfig(audio_config)) {
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", AudioConfiguration=" << toString(audio_config)
+ << " Invalid";
+ } else if (!UpdateDataPath(dataMQ)) {
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_)
+ << " DataMQ Invalid";
+ audio_config_ =
+ (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH
+ ? kInvalidOffloadAudioConfiguration
+ : kInvalidSoftwareAudioConfiguration);
+ } else {
+ stack_iface_ = stack_iface;
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", AudioConfiguration=" << toString(audio_config);
+ ReportSessionStatus();
+ }
+}
+
+// The report function is used to report that the Bluetooth stack has ended the
+// session, and will invoke session_changed_cb_ to notify registered
+// bluetooth_audio outputs
+void BluetoothAudioSession::OnSessionEnded() {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ bool toggled = IsSessionReady();
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_);
+ audio_config_ = (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH
+ ? kInvalidOffloadAudioConfiguration
+ : kInvalidSoftwareAudioConfiguration);
+ stack_iface_ = nullptr;
+ UpdateDataPath(nullptr);
+ if (toggled) {
+ ReportSessionStatus();
+ }
+}
+
+// invoking the registered session_changed_cb_
+void BluetoothAudioSession::ReportSessionStatus() {
+ // This is locked already by OnSessionStarted / OnSessionEnded
+ if (observers_.empty()) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO port state observer";
+ return;
+ }
+ for (auto& observer : observers_) {
+ uint16_t cookie = observer.first;
+ std::shared_ptr<struct PortStatusCallbacks> cb = observer.second;
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " notify to bluetooth_audio=0x"
+ << android::base::StringPrintf("%04x", cookie);
+ cb->session_changed_cb_(cookie);
+ }
+}
+
+// The report function is used to report that the Bluetooth stack has notified
+// the result of startStream or suspendStream, and will invoke
+// control_result_cb_ to notify registered bluetooth_audio outputs
+void BluetoothAudioSession::ReportControlStatus(
+ bool start_resp, const BluetoothAudioStatus& status) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (observers_.empty()) {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO port state observer";
+ return;
+ }
+ for (auto& observer : observers_) {
+ uint16_t cookie = observer.first;
+ std::shared_ptr<struct PortStatusCallbacks> cb = observer.second;
+ LOG(INFO) << __func__ << " - status=" << toString(status)
+ << " for SessionType=" << toString(session_type_)
+ << ", bluetooth_audio=0x"
+ << android::base::StringPrintf("%04x", cookie)
+ << (start_resp ? " started" : " suspended");
+ cb->control_result_cb_(cookie, start_resp, status);
+ }
+}
+
+// The function helps to check if this session is ready or not
+// @return: true if the Bluetooth stack has started the specified session
+bool BluetoothAudioSession::IsSessionReady() {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ bool dataMQ_valid =
+ (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH ||
+ (mDataMQ != nullptr && mDataMQ->isValid()));
+ return stack_iface_ != nullptr && dataMQ_valid;
+}
+
+bool BluetoothAudioSession::UpdateDataPath(const DataMQ::Descriptor* dataMQ) {
+ if (dataMQ == nullptr) {
+ // usecase of reset by nullptr
+ mDataMQ = nullptr;
+ return true;
+ }
+ std::unique_ptr<DataMQ> tempDataMQ;
+ tempDataMQ.reset(new DataMQ(*dataMQ));
+ if (!tempDataMQ || !tempDataMQ->isValid()) {
+ mDataMQ = nullptr;
+ return false;
+ }
+ mDataMQ = std::move(tempDataMQ);
+ return true;
+}
+
+bool BluetoothAudioSession::UpdateAudioConfig(
+ const AudioConfiguration& audio_config) {
+ bool is_software_session =
+ (session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ == SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ == SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH);
+ bool is_offload_session =
+ (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
+ auto audio_config_discriminator = audio_config.getDiscriminator();
+ bool is_software_audio_config =
+ (is_software_session &&
+ audio_config_discriminator ==
+ AudioConfiguration::hidl_discriminator::pcmConfig);
+ bool is_offload_audio_config =
+ (is_offload_session &&
+ audio_config_discriminator ==
+ AudioConfiguration::hidl_discriminator::codecConfig);
+ if (!is_software_audio_config && !is_offload_audio_config) {
+ return false;
+ }
+ audio_config_ = audio_config;
+ return true;
+}
+
+// The control function helps the bluetooth_audio module to register
+// PortStatusCallbacks
+// @return: cookie - the assigned number to this bluetooth_audio output
+uint16_t BluetoothAudioSession::RegisterStatusCback(
+ const PortStatusCallbacks& cbacks) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ uint16_t cookie = ObserversCookieGetInitValue(session_type_);
+ uint16_t cookie_upper_bound = ObserversCookieGetUpperBound(session_type_);
+
+ while (cookie < cookie_upper_bound) {
+ if (observers_.find(cookie) == observers_.end()) {
+ break;
+ }
+ ++cookie;
+ }
+ if (cookie >= cookie_upper_bound) {
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has " << observers_.size()
+ << " observers already (No Resource)";
+ return kObserversCookieUndefined;
+ }
+ std::shared_ptr<struct PortStatusCallbacks> cb =
+ std::make_shared<struct PortStatusCallbacks>();
+ *cb = cbacks;
+ observers_[cookie] = cb;
+ return cookie;
+}
+
+// The control function helps the bluetooth_audio module to unregister
+// PortStatusCallbacks
+// @param: cookie - indicates which bluetooth_audio output is
+void BluetoothAudioSession::UnregisterStatusCback(uint16_t cookie) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (observers_.erase(cookie) != 1) {
+ LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_)
+ << " no such provider=0x"
+ << android::base::StringPrintf("%04x", cookie);
+ }
+}
+
+// The control function is for the bluetooth_audio module to get the current
+// AudioConfiguration
+const AudioConfiguration& BluetoothAudioSession::GetAudioConfig() {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (IsSessionReady()) {
+ return audio_config_;
+ } else if (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ return kInvalidOffloadAudioConfiguration;
+ } else {
+ return kInvalidSoftwareAudioConfiguration;
+ }
+}
+
+// Those control functions are for the bluetooth_audio module to start, suspend,
+// stop stream, to check position, and to update metadata.
+bool BluetoothAudioSession::StartStream() {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (!IsSessionReady()) {
+ LOG(DEBUG) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return false;
+ }
+ auto hal_retval = stack_iface_->startStream();
+ if (!hal_retval.isOk()) {
+ LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
+ << toString(session_type_) << " failed";
+ return false;
+ }
+ return true;
+}
+
+bool BluetoothAudioSession::SuspendStream() {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (!IsSessionReady()) {
+ LOG(DEBUG) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return false;
+ }
+ auto hal_retval = stack_iface_->suspendStream();
+ if (!hal_retval.isOk()) {
+ LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
+ << toString(session_type_) << " failed";
+ return false;
+ }
+ return true;
+}
+
+void BluetoothAudioSession::StopStream() {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (!IsSessionReady()) {
+ return;
+ }
+ auto hal_retval = stack_iface_->stopStream();
+ if (!hal_retval.isOk()) {
+ LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
+ << toString(session_type_) << " failed";
+ }
+}
+
+bool BluetoothAudioSession::GetPresentationPosition(
+ uint64_t* remote_delay_report_ns, uint64_t* total_bytes_readed,
+ timespec* data_position) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (!IsSessionReady()) {
+ LOG(DEBUG) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return false;
+ }
+ bool retval = false;
+ auto hal_retval = stack_iface_->getPresentationPosition(
+ [&retval, &remote_delay_report_ns, &total_bytes_readed, &data_position](
+ BluetoothAudioStatus status,
+ const uint64_t& remoteDeviceAudioDelayNanos,
+ uint64_t transmittedOctets,
+ const TimeSpec& transmittedOctetsTimeStamp) {
+ if (status == BluetoothAudioStatus::SUCCESS) {
+ if (remote_delay_report_ns)
+ *remote_delay_report_ns = remoteDeviceAudioDelayNanos;
+ if (total_bytes_readed) *total_bytes_readed = transmittedOctets;
+ if (data_position)
+ *data_position =
+ timespec_convert_from_hal(transmittedOctetsTimeStamp);
+ retval = true;
+ }
+ });
+ if (!hal_retval.isOk()) {
+ LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
+ << toString(session_type_) << " failed";
+ return false;
+ }
+ return retval;
+}
+
+void BluetoothAudioSession::UpdateTracksMetadata(
+ const struct source_metadata* source_metadata) {
+ std::lock_guard<std::recursive_mutex> guard(mutex_);
+ if (!IsSessionReady()) {
+ LOG(DEBUG) << __func__ << " - SessionType=" << toString(session_type_)
+ << " has NO session";
+ return;
+ }
+
+ ssize_t track_count = source_metadata->track_count;
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << ", "
+ << track_count << " track(s)";
+ if (session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ return;
+ }
+
+ struct playback_track_metadata* track = source_metadata->tracks;
+ SourceMetadata sourceMetadata;
+ PlaybackTrackMetadata* halMetadata;
+
+ sourceMetadata.tracks.resize(track_count);
+ halMetadata = sourceMetadata.tracks.data();
+ while (track_count && track) {
+ halMetadata->usage = static_cast<AudioUsage>(track->usage);
+ halMetadata->contentType =
+ static_cast<AudioContentType>(track->content_type);
+ halMetadata->gain = track->gain;
+ LOG(VERBOSE) << __func__ << " - SessionType=" << toString(session_type_)
+ << ", usage=" << toString(halMetadata->usage)
+ << ", content=" << toString(halMetadata->contentType)
+ << ", gain=" << halMetadata->gain;
+ --track_count;
+ ++track;
+ ++halMetadata;
+ }
+ auto hal_retval = stack_iface_->updateMetadata(sourceMetadata);
+ if (!hal_retval.isOk()) {
+ LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
+ << toString(session_type_) << " failed";
+ }
+}
+
+// The control function writes stream to FMQ
+size_t BluetoothAudioSession::OutWritePcmData(const void* buffer,
+ size_t bytes) {
+ if (buffer == nullptr || !bytes) return 0;
+ size_t totalWritten = 0;
+ int ms_timeout = kFmqSendTimeoutMs;
+ do {
+ std::unique_lock<std::recursive_mutex> lock(mutex_);
+ if (!IsSessionReady()) break;
+ size_t availableToWrite = mDataMQ->availableToWrite();
+ if (availableToWrite) {
+ if (availableToWrite > (bytes - totalWritten)) {
+ availableToWrite = bytes - totalWritten;
+ }
+
+ if (!mDataMQ->write(static_cast<const uint8_t*>(buffer) + totalWritten,
+ availableToWrite)) {
+ ALOGE("FMQ datapath writing %zu/%zu failed", totalWritten, bytes);
+ return totalWritten;
+ }
+ totalWritten += availableToWrite;
+ } else if (ms_timeout >= kWritePollMs) {
+ lock.unlock();
+ usleep(kWritePollMs * 1000);
+ ms_timeout -= kWritePollMs;
+ } else {
+ ALOGD("out data %zu/%zu overflow %d ms", totalWritten, bytes,
+ (kFmqSendTimeoutMs - ms_timeout));
+ return totalWritten;
+ }
+ } while (totalWritten < bytes);
+ return totalWritten;
+}
+
+// The control function reads stream from FMQ
+size_t BluetoothAudioSession::InReadPcmData(void* buffer, size_t bytes) {
+ if (buffer == nullptr || !bytes) return 0;
+ size_t totalRead = 0;
+ int ms_timeout = kFmqReceiveTimeoutMs;
+ do {
+ std::unique_lock<std::recursive_mutex> lock(mutex_);
+ if (!IsSessionReady()) break;
+ size_t availableToRead = mDataMQ->availableToRead();
+ if (availableToRead) {
+ if (availableToRead > (bytes - totalRead)) {
+ availableToRead = bytes - totalRead;
+ }
+ if (!mDataMQ->read(static_cast<uint8_t*>(buffer) + totalRead,
+ availableToRead)) {
+ ALOGE("FMQ datapath reading %zu/%zu failed", totalRead, bytes);
+ return totalRead;
+ }
+ totalRead += availableToRead;
+ } else if (ms_timeout >= kReadPollMs) {
+ lock.unlock();
+ usleep(kReadPollMs * 1000);
+ ms_timeout -= kReadPollMs;
+ continue;
+ } else {
+ ALOGD("in data %zu/%zu overflow %d ms", totalRead, bytes,
+ (kFmqReceiveTimeoutMs - ms_timeout));
+ return totalRead;
+ }
+ } while (totalRead < bytes);
+ return totalRead;
+}
+
+std::unique_ptr<BluetoothAudioSessionInstance>
+ BluetoothAudioSessionInstance::instance_ptr =
+ std::unique_ptr<BluetoothAudioSessionInstance>(
+ new BluetoothAudioSessionInstance());
+
+// API to fetch the session
+std::shared_ptr<BluetoothAudioSession>
+BluetoothAudioSessionInstance::GetSessionInstance(
+ const SessionType& session_type) {
+ std::lock_guard<std::mutex> guard(instance_ptr->mutex_);
+ if (!instance_ptr->sessions_map_.empty()) {
+ auto entry = instance_ptr->sessions_map_.find(session_type);
+ if (entry != instance_ptr->sessions_map_.end()) {
+ return entry->second;
+ }
+ }
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ std::make_shared<BluetoothAudioSession>(session_type);
+ instance_ptr->sessions_map_[session_type] = session_ptr;
+ return session_ptr;
+}
+
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/session/BluetoothAudioSession.h b/bluetooth/audio/2.1/default/session/BluetoothAudioSession.h
new file mode 100644
index 0000000..7bc12e6
--- /dev/null
+++ b/bluetooth/audio/2.1/default/session/BluetoothAudioSession.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <mutex>
+#include <unordered_map>
+
+#include <android/hardware/bluetooth/audio/2.0/IBluetoothAudioPort.h>
+#include <android/hardware/bluetooth/audio/2.1/types.h>
+#include <fmq/MessageQueue.h>
+#include <hardware/audio.h>
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+
+using ::android::sp;
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample;
+using ::android::hardware::bluetooth::audio::V2_0::ChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::CodecConfiguration;
+using ::android::hardware::bluetooth::audio::V2_0::IBluetoothAudioPort;
+using ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration;
+using ::android::hardware::bluetooth::audio::V2_1::PcmParameters;
+using ::android::hardware::bluetooth::audio::V2_1::SampleRate;
+using ::android::hardware::bluetooth::audio::V2_1::SessionType;
+
+using BluetoothAudioStatus =
+ ::android::hardware::bluetooth::audio::V2_0::Status;
+
+using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+
+static constexpr uint16_t kObserversCookieSize = 0x0010; // 0x0000 ~ 0x000f
+constexpr uint16_t kObserversCookieUndefined =
+ (static_cast<uint16_t>(SessionType::UNKNOWN) << 8 & 0xff00);
+inline SessionType ObserversCookieGetSessionType(uint16_t cookie) {
+ return static_cast<SessionType>(cookie >> 8 & 0x00ff);
+}
+inline uint16_t ObserversCookieGetInitValue(SessionType session_type) {
+ return (static_cast<uint16_t>(session_type) << 8 & 0xff00);
+}
+inline uint16_t ObserversCookieGetUpperBound(SessionType session_type) {
+ return (static_cast<uint16_t>(session_type) << 8 & 0xff00) +
+ kObserversCookieSize;
+}
+
+// This presents the callbacks of started / suspended and session changed,
+// and the bluetooth_audio module uses to receive the status notification
+struct PortStatusCallbacks {
+ // control_result_cb_ - when the Bluetooth stack reports results of
+ // streamStarted or streamSuspended, the BluetoothAudioProvider will invoke
+ // this callback to report to the bluetooth_audio module.
+ // @param: cookie - indicates which bluetooth_audio output should handle
+ // @param: start_resp - this report is for startStream or not
+ // @param: status - the result of startStream
+ std::function<void(uint16_t cookie, bool start_resp,
+ const BluetoothAudioStatus& status)>
+ control_result_cb_;
+ // session_changed_cb_ - when the Bluetooth stack start / end session, the
+ // BluetoothAudioProvider will invoke this callback to notify to the
+ // bluetooth_audio module.
+ // @param: cookie - indicates which bluetooth_audio output should handle
+ std::function<void(uint16_t cookie)> session_changed_cb_;
+};
+
+class BluetoothAudioSession {
+ private:
+ // using recursive_mutex to allow hwbinder to re-enter again.
+ std::recursive_mutex mutex_;
+ SessionType session_type_;
+
+ // audio control path to use for both software and offloading
+ sp<IBluetoothAudioPort> stack_iface_;
+ // Audio path (FMQ) for software encoding/decoded data
+ std::unique_ptr<DataMQ> mDataMQ;
+ // audio data configuration for both software and offloading
+ AudioConfiguration audio_config_;
+
+ static AudioConfiguration invalidSoftwareAudioConfiguration;
+ static AudioConfiguration invalidOffloadAudioConfiguration;
+
+ // saving those registered bluetooth_audio's callbacks
+ std::unordered_map<uint16_t, std::shared_ptr<struct PortStatusCallbacks>>
+ observers_;
+
+ bool UpdateDataPath(const DataMQ::Descriptor* dataMQ);
+ bool UpdateAudioConfig(const AudioConfiguration& audio_config);
+ // invoking the registered session_changed_cb_
+ void ReportSessionStatus();
+
+ public:
+ BluetoothAudioSession(const SessionType& session_type);
+
+ // The function helps to check if this session is ready or not
+ // @return: true if the Bluetooth stack has started the specified session
+ bool IsSessionReady();
+
+ // The report function is used to report that the Bluetooth stack has started
+ // this session without any failure, and will invoke session_changed_cb_ to
+ // notify those registered bluetooth_audio outputs
+ void OnSessionStarted(const sp<IBluetoothAudioPort> stack_iface,
+ const DataMQ::Descriptor* dataMQ,
+ const AudioConfiguration& audio_config);
+
+ // The report function is used to report that the Bluetooth stack has ended
+ // the session, and will invoke session_changed_cb_ to notify registered
+ // bluetooth_audio outputs
+ void OnSessionEnded();
+
+ // The report function is used to report that the Bluetooth stack has notified
+ // the result of startStream or suspendStream, and will invoke
+ // control_result_cb_ to notify registered bluetooth_audio outputs
+ void ReportControlStatus(bool start_resp, const BluetoothAudioStatus& status);
+
+ // The control function helps the bluetooth_audio module to register
+ // PortStatusCallbacks
+ // @return: cookie - the assigned number to this bluetooth_audio output
+ uint16_t RegisterStatusCback(const PortStatusCallbacks& cbacks);
+
+ // The control function helps the bluetooth_audio module to unregister
+ // PortStatusCallbacks
+ // @param: cookie - indicates which bluetooth_audio output is
+ void UnregisterStatusCback(uint16_t cookie);
+
+ // The control function is for the bluetooth_audio module to get the current
+ // AudioConfiguration
+ const AudioConfiguration& GetAudioConfig();
+
+ // Those control functions are for the bluetooth_audio module to start,
+ // suspend, stop stream, to check position, and to update metadata.
+ bool StartStream();
+ bool SuspendStream();
+ void StopStream();
+ bool GetPresentationPosition(uint64_t* remote_delay_report_ns,
+ uint64_t* total_bytes_readed,
+ timespec* data_position);
+ void UpdateTracksMetadata(const struct source_metadata* source_metadata);
+
+ // The control function writes stream to FMQ
+ size_t OutWritePcmData(const void* buffer, size_t bytes);
+ // The control function read stream from FMQ
+ size_t InReadPcmData(void* buffer, size_t bytes);
+
+ static constexpr PcmParameters kInvalidPcmParameters = {
+ .sampleRate = SampleRate::RATE_UNKNOWN,
+ .channelMode = ChannelMode::UNKNOWN,
+ .bitsPerSample = BitsPerSample::BITS_UNKNOWN,
+ .dataIntervalUs = 0,
+ };
+ // can't be constexpr because of non-literal type
+ static const CodecConfiguration kInvalidCodecConfiguration;
+
+ static constexpr AudioConfiguration& kInvalidSoftwareAudioConfiguration =
+ invalidSoftwareAudioConfiguration;
+ static constexpr AudioConfiguration& kInvalidOffloadAudioConfiguration =
+ invalidOffloadAudioConfiguration;
+};
+
+class BluetoothAudioSessionInstance {
+ public:
+ // The API is to fetch the specified session
+ static std::shared_ptr<BluetoothAudioSession> GetSessionInstance(
+ const SessionType& session_type);
+
+ private:
+ static std::unique_ptr<BluetoothAudioSessionInstance> instance_ptr;
+ std::mutex mutex_;
+ std::unordered_map<SessionType, std::shared_ptr<BluetoothAudioSession>>
+ sessions_map_;
+};
+
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/session/BluetoothAudioSessionControl.h b/bluetooth/audio/2.1/default/session/BluetoothAudioSessionControl.h
new file mode 100644
index 0000000..017a611
--- /dev/null
+++ b/bluetooth/audio/2.1/default/session/BluetoothAudioSessionControl.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "BluetoothAudioSession.h"
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+
+class BluetoothAudioSessionControl {
+ public:
+ // The control API helps to check if session is ready or not
+ // @return: true if the Bluetooth stack has started th specified session
+ static bool IsSessionReady(const SessionType& session_type) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->IsSessionReady();
+ }
+ return false;
+ }
+
+ // The control API helps the bluetooth_audio module to register
+ // PortStatusCallbacks
+ // @return: cookie - the assigned number to this bluetooth_audio output
+ static uint16_t RegisterControlResultCback(
+ const SessionType& session_type, const PortStatusCallbacks& cbacks) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->RegisterStatusCback(cbacks);
+ }
+ return kObserversCookieUndefined;
+ }
+
+ // The control API helps the bluetooth_audio module to unregister
+ // PortStatusCallbacks
+ // @param: cookie - indicates which bluetooth_audio output is
+ static void UnregisterControlResultCback(const SessionType& session_type,
+ uint16_t cookie) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->UnregisterStatusCback(cookie);
+ }
+ }
+
+ // The control API for the bluetooth_audio module to get current
+ // AudioConfiguration
+ static const AudioConfiguration& GetAudioConfig(
+ const SessionType& session_type) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioConfig();
+ } else if (session_type == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ return BluetoothAudioSession::kInvalidOffloadAudioConfiguration;
+ } else {
+ return BluetoothAudioSession::kInvalidSoftwareAudioConfiguration;
+ }
+ }
+
+ // Those control APIs for the bluetooth_audio module to start / suspend / stop
+ // stream, to check position, and to update metadata.
+ static bool StartStream(const SessionType& session_type) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->StartStream();
+ }
+ return false;
+ }
+
+ static bool SuspendStream(const SessionType& session_type) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->SuspendStream();
+ }
+ return false;
+ }
+
+ static void StopStream(const SessionType& session_type) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->StopStream();
+ }
+ }
+
+ static bool GetPresentationPosition(const SessionType& session_type,
+ uint64_t* remote_delay_report_ns,
+ uint64_t* total_bytes_readed,
+ timespec* data_position) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetPresentationPosition(
+ remote_delay_report_ns, total_bytes_readed, data_position);
+ }
+ return false;
+ }
+
+ static void UpdateTracksMetadata(
+ const SessionType& session_type,
+ const struct source_metadata* source_metadata) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->UpdateTracksMetadata(source_metadata);
+ }
+ }
+
+ // The control API writes stream to FMQ
+ static size_t OutWritePcmData(const SessionType& session_type,
+ const void* buffer, size_t bytes) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->OutWritePcmData(buffer, bytes);
+ }
+ return 0;
+ }
+
+ // The control API reads stream from FMQ
+ static size_t InReadPcmData(const SessionType& session_type, void* buffer,
+ size_t bytes) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->InReadPcmData(buffer, bytes);
+ }
+ return 0;
+ }
+};
+
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/session/BluetoothAudioSessionReport.h b/bluetooth/audio/2.1/default/session/BluetoothAudioSessionReport.h
new file mode 100644
index 0000000..267bf8f
--- /dev/null
+++ b/bluetooth/audio/2.1/default/session/BluetoothAudioSessionReport.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "BluetoothAudioSession.h"
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+
+class BluetoothAudioSessionReport {
+ public:
+ // The API reports the Bluetooth stack has started the session, and will
+ // inform registered bluetooth_audio session
+ static void OnSessionStarted(const SessionType& session_type,
+ const sp<IBluetoothAudioPort> host_iface,
+ const DataMQ::Descriptor* dataMQ,
+ const AudioConfiguration& audio_config) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->OnSessionStarted(host_iface, dataMQ, audio_config);
+ }
+ }
+ // The API reports the Bluetooth stack has ended the session, and will
+ // inform registered bluetooth_audio outputs
+ static void OnSessionEnded(const SessionType& session_type) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->OnSessionEnded();
+ }
+ }
+ // The API reports the Bluetooth stack has replied the result of startStream
+ // or suspendStream, and will inform registered bluetooth_audio outputs
+ static void ReportControlStatus(const SessionType& session_type,
+ const bool& start_resp,
+ const BluetoothAudioStatus& status) {
+ std::shared_ptr<BluetoothAudioSession> session_ptr =
+ BluetoothAudioSessionInstance::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->ReportControlStatus(start_resp, status);
+ }
+ }
+};
+
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/session/BluetoothAudioSupportedCodecsDB.cpp b/bluetooth/audio/2.1/default/session/BluetoothAudioSupportedCodecsDB.cpp
new file mode 100644
index 0000000..d15db49
--- /dev/null
+++ b/bluetooth/audio/2.1/default/session/BluetoothAudioSupportedCodecsDB.cpp
@@ -0,0 +1,487 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "BTAudioProviderSessionCodecsDB"
+
+#include "BluetoothAudioSupportedCodecsDB.h"
+
+#include <android-base/logging.h>
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+
+using ::android::hardware::bluetooth::audio::V2_0::AacObjectType;
+using ::android::hardware::bluetooth::audio::V2_0::AacParameters;
+using ::android::hardware::bluetooth::audio::V2_0::AacVariableBitRate;
+using ::android::hardware::bluetooth::audio::V2_0::AptxParameters;
+using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample;
+using ::android::hardware::bluetooth::audio::V2_0::ChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::CodecType;
+using ::android::hardware::bluetooth::audio::V2_0::LdacChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::LdacParameters;
+using ::android::hardware::bluetooth::audio::V2_0::LdacQualityIndex;
+using ::android::hardware::bluetooth::audio::V2_0::SbcAllocMethod;
+using ::android::hardware::bluetooth::audio::V2_0::SbcBlockLength;
+using ::android::hardware::bluetooth::audio::V2_0::SbcChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::SbcNumSubbands;
+using ::android::hardware::bluetooth::audio::V2_0::SbcParameters;
+using ::android::hardware::bluetooth::audio::V2_1::SampleRate;
+
+// Default Supported PCM Parameters
+static const ::android::hardware::bluetooth::audio::V2_0::PcmParameters
+ kDefaultSoftwarePcmCapabilities = {
+ .sampleRate = static_cast<
+ android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_48000 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_88200 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_96000 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_16000),
+ .channelMode =
+ static_cast<ChannelMode>(ChannelMode::MONO | ChannelMode::STEREO),
+ .bitsPerSample = static_cast<BitsPerSample>(BitsPerSample::BITS_16 |
+ BitsPerSample::BITS_24 |
+ BitsPerSample::BITS_32)};
+
+static const PcmParameters kDefaultSoftwarePcmCapabilities_2_1 = {
+ .sampleRate = static_cast<SampleRate>(
+ SampleRate::RATE_48000 | SampleRate::RATE_44100 |
+ SampleRate::RATE_32000 | SampleRate::RATE_24000 |
+ SampleRate::RATE_16000 | SampleRate::RATE_8000),
+ .channelMode =
+ static_cast<ChannelMode>(ChannelMode::MONO | ChannelMode::STEREO),
+ .bitsPerSample = static_cast<BitsPerSample>(BitsPerSample::BITS_16)};
+
+// Default Supported Codecs
+// SBC: mSampleRate:(44100), mBitsPerSample:(16), mChannelMode:(MONO|STEREO)
+// all blocks | subbands 8 | Loudness
+static const SbcParameters kDefaultOffloadSbcCapability = {
+ .sampleRate =
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100,
+ .channelMode = static_cast<SbcChannelMode>(SbcChannelMode::MONO |
+ SbcChannelMode::JOINT_STEREO),
+ .blockLength = static_cast<SbcBlockLength>(
+ SbcBlockLength::BLOCKS_4 | SbcBlockLength::BLOCKS_8 |
+ SbcBlockLength::BLOCKS_12 | SbcBlockLength::BLOCKS_16),
+ .numSubbands = SbcNumSubbands::SUBBAND_8,
+ .allocMethod = SbcAllocMethod::ALLOC_MD_L,
+ .bitsPerSample = BitsPerSample::BITS_16,
+ .minBitpool = 2,
+ .maxBitpool = 53};
+
+// AAC: mSampleRate:(44100), mBitsPerSample:(16), mChannelMode:(STEREO)
+static const AacParameters kDefaultOffloadAacCapability = {
+ .objectType = AacObjectType::MPEG2_LC,
+ .sampleRate =
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100,
+ .channelMode = ChannelMode::STEREO,
+ .variableBitRateEnabled = AacVariableBitRate::ENABLED,
+ .bitsPerSample = BitsPerSample::BITS_16};
+
+// LDAC: mSampleRate:(44100|48000|88200|96000), mBitsPerSample:(16|24|32),
+// mChannelMode:(DUAL|STEREO)
+static const LdacParameters kDefaultOffloadLdacCapability = {
+ .sampleRate =
+ static_cast<android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_48000 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_88200 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_96000),
+ .channelMode = static_cast<LdacChannelMode>(LdacChannelMode::DUAL |
+ LdacChannelMode::STEREO),
+ .qualityIndex = LdacQualityIndex::QUALITY_HIGH,
+ .bitsPerSample = static_cast<BitsPerSample>(BitsPerSample::BITS_16 |
+ BitsPerSample::BITS_24 |
+ BitsPerSample::BITS_32)};
+
+// aptX: mSampleRate:(44100|48000), mBitsPerSample:(16), mChannelMode:(STEREO)
+static const AptxParameters kDefaultOffloadAptxCapability = {
+ .sampleRate =
+ static_cast<android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_48000),
+ .channelMode = ChannelMode::STEREO,
+ .bitsPerSample = BitsPerSample::BITS_16,
+};
+
+// aptX HD: mSampleRate:(44100|48000), mBitsPerSample:(24),
+// mChannelMode:(STEREO)
+static const AptxParameters kDefaultOffloadAptxHdCapability = {
+ .sampleRate =
+ static_cast<android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100 |
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_48000),
+ .channelMode = ChannelMode::STEREO,
+ .bitsPerSample = BitsPerSample::BITS_24,
+};
+
+const std::vector<CodecCapabilities> kDefaultOffloadA2dpCodecCapabilities = {
+ {.codecType = CodecType::SBC, .capabilities = {}},
+ {.codecType = CodecType::AAC, .capabilities = {}},
+ {.codecType = CodecType::LDAC, .capabilities = {}},
+ {.codecType = CodecType::APTX, .capabilities = {}},
+ {.codecType = CodecType::APTX_HD, .capabilities = {}}};
+
+static bool IsSingleBit(uint32_t bitmasks, uint32_t bitfield) {
+ bool single = false;
+ uint32_t test_bit = 0x00000001;
+ while (test_bit <= bitmasks && test_bit <= bitfield) {
+ if (bitfield & test_bit && bitmasks & test_bit) {
+ if (single) return false;
+ single = true;
+ }
+ if (test_bit == 0x80000000) break;
+ test_bit <<= 1;
+ }
+ return single;
+}
+
+static bool IsOffloadSbcConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific);
+static bool IsOffloadAacConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific);
+static bool IsOffloadLdacConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific);
+static bool IsOffloadAptxConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific);
+static bool IsOffloadAptxHdConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific);
+
+static bool IsOffloadSbcConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific) {
+ if (codec_specific.getDiscriminator() !=
+ CodecConfiguration::CodecSpecific::hidl_discriminator::sbcConfig) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ }
+ const SbcParameters sbc_data = codec_specific.sbcConfig();
+ if (!IsSingleBit(static_cast<uint32_t>(sbc_data.sampleRate), 0xff) ||
+ !IsSingleBit(static_cast<uint32_t>(sbc_data.channelMode), 0x0f) ||
+ !IsSingleBit(static_cast<uint32_t>(sbc_data.blockLength), 0xf0) ||
+ !IsSingleBit(static_cast<uint32_t>(sbc_data.numSubbands), 0x0c) ||
+ !IsSingleBit(static_cast<uint32_t>(sbc_data.allocMethod), 0x03) ||
+ !IsSingleBit(static_cast<uint32_t>(sbc_data.bitsPerSample), 0x07) ||
+ sbc_data.minBitpool > sbc_data.maxBitpool) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ } else if ((sbc_data.sampleRate & kDefaultOffloadSbcCapability.sampleRate) &&
+ (sbc_data.channelMode &
+ kDefaultOffloadSbcCapability.channelMode) &&
+ (sbc_data.blockLength &
+ kDefaultOffloadSbcCapability.blockLength) &&
+ (sbc_data.numSubbands &
+ kDefaultOffloadSbcCapability.numSubbands) &&
+ (sbc_data.allocMethod &
+ kDefaultOffloadSbcCapability.allocMethod) &&
+ (sbc_data.bitsPerSample &
+ kDefaultOffloadSbcCapability.bitsPerSample) &&
+ (kDefaultOffloadSbcCapability.minBitpool <= sbc_data.minBitpool &&
+ sbc_data.maxBitpool <= kDefaultOffloadSbcCapability.maxBitpool)) {
+ return true;
+ }
+ LOG(WARNING) << __func__
+ << ": Unsupported CodecSpecific=" << toString(codec_specific);
+ return false;
+}
+
+static bool IsOffloadAacConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific) {
+ if (codec_specific.getDiscriminator() !=
+ CodecConfiguration::CodecSpecific::hidl_discriminator::aacConfig) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ }
+ const AacParameters aac_data = codec_specific.aacConfig();
+ if (!IsSingleBit(static_cast<uint32_t>(aac_data.objectType), 0xf0) ||
+ !IsSingleBit(static_cast<uint32_t>(aac_data.sampleRate), 0xff) ||
+ !IsSingleBit(static_cast<uint32_t>(aac_data.channelMode), 0x03) ||
+ !IsSingleBit(static_cast<uint32_t>(aac_data.bitsPerSample), 0x07)) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ } else if ((aac_data.objectType & kDefaultOffloadAacCapability.objectType) &&
+ (aac_data.sampleRate & kDefaultOffloadAacCapability.sampleRate) &&
+ (aac_data.channelMode &
+ kDefaultOffloadAacCapability.channelMode) &&
+ (aac_data.variableBitRateEnabled == AacVariableBitRate::DISABLED ||
+ kDefaultOffloadAacCapability.variableBitRateEnabled ==
+ AacVariableBitRate::ENABLED) &&
+ (aac_data.bitsPerSample &
+ kDefaultOffloadAacCapability.bitsPerSample)) {
+ return true;
+ }
+ LOG(WARNING) << __func__
+ << ": Unsupported CodecSpecific=" << toString(codec_specific);
+ return false;
+}
+
+static bool IsOffloadLdacConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific) {
+ if (codec_specific.getDiscriminator() !=
+ CodecConfiguration::CodecSpecific::hidl_discriminator::ldacConfig) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ }
+ const LdacParameters ldac_data = codec_specific.ldacConfig();
+ if (!IsSingleBit(static_cast<uint32_t>(ldac_data.sampleRate), 0xff) ||
+ !IsSingleBit(static_cast<uint32_t>(ldac_data.channelMode), 0x07) ||
+ (ldac_data.qualityIndex > LdacQualityIndex::QUALITY_LOW &&
+ ldac_data.qualityIndex != LdacQualityIndex::QUALITY_ABR) ||
+ !IsSingleBit(static_cast<uint32_t>(ldac_data.bitsPerSample), 0x07)) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ } else if ((ldac_data.sampleRate &
+ kDefaultOffloadLdacCapability.sampleRate) &&
+ (ldac_data.channelMode &
+ kDefaultOffloadLdacCapability.channelMode) &&
+ (ldac_data.bitsPerSample &
+ kDefaultOffloadLdacCapability.bitsPerSample)) {
+ return true;
+ }
+ LOG(WARNING) << __func__
+ << ": Unsupported CodecSpecific=" << toString(codec_specific);
+ return false;
+}
+
+static bool IsOffloadAptxConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific) {
+ if (codec_specific.getDiscriminator() !=
+ CodecConfiguration::CodecSpecific::hidl_discriminator::aptxConfig) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ }
+ const AptxParameters aptx_data = codec_specific.aptxConfig();
+ if (!IsSingleBit(static_cast<uint32_t>(aptx_data.sampleRate), 0xff) ||
+ !IsSingleBit(static_cast<uint32_t>(aptx_data.channelMode), 0x03) ||
+ !IsSingleBit(static_cast<uint32_t>(aptx_data.bitsPerSample), 0x07)) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ } else if ((aptx_data.sampleRate &
+ kDefaultOffloadAptxCapability.sampleRate) &&
+ (aptx_data.channelMode &
+ kDefaultOffloadAptxCapability.channelMode) &&
+ (aptx_data.bitsPerSample &
+ kDefaultOffloadAptxCapability.bitsPerSample)) {
+ return true;
+ }
+ LOG(WARNING) << __func__
+ << ": Unsupported CodecSpecific=" << toString(codec_specific);
+ return false;
+}
+
+static bool IsOffloadAptxHdConfigurationValid(
+ const CodecConfiguration::CodecSpecific& codec_specific) {
+ if (codec_specific.getDiscriminator() !=
+ CodecConfiguration::CodecSpecific::hidl_discriminator::aptxConfig) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ }
+ const AptxParameters aptx_data = codec_specific.aptxConfig();
+ if (!IsSingleBit(static_cast<uint32_t>(aptx_data.sampleRate), 0xff) ||
+ !IsSingleBit(static_cast<uint32_t>(aptx_data.channelMode), 0x03) ||
+ !IsSingleBit(static_cast<uint32_t>(aptx_data.bitsPerSample), 0x07)) {
+ LOG(WARNING) << __func__
+ << ": Invalid CodecSpecific=" << toString(codec_specific);
+ return false;
+ } else if ((aptx_data.sampleRate &
+ kDefaultOffloadAptxHdCapability.sampleRate) &&
+ (aptx_data.channelMode &
+ kDefaultOffloadAptxHdCapability.channelMode) &&
+ (aptx_data.bitsPerSample &
+ kDefaultOffloadAptxHdCapability.bitsPerSample)) {
+ return true;
+ }
+ LOG(WARNING) << __func__
+ << ": Unsupported CodecSpecific=" << toString(codec_specific);
+ return false;
+}
+
+std::vector<::android::hardware::bluetooth::audio::V2_0::PcmParameters>
+GetSoftwarePcmCapabilities() {
+ return std::vector<
+ ::android::hardware::bluetooth::audio::V2_0::PcmParameters>(
+ 1, kDefaultSoftwarePcmCapabilities);
+}
+
+std::vector<PcmParameters> GetSoftwarePcmCapabilities_2_1() {
+ return std::vector<PcmParameters>(1, kDefaultSoftwarePcmCapabilities_2_1);
+}
+
+std::vector<CodecCapabilities> GetOffloadCodecCapabilities(
+ const ::android::hardware::bluetooth::audio::V2_0::SessionType&
+ session_type) {
+ return GetOffloadCodecCapabilities(static_cast<SessionType>(session_type));
+}
+
+std::vector<CodecCapabilities> GetOffloadCodecCapabilities(
+ const SessionType& session_type) {
+ if (session_type != SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ return std::vector<CodecCapabilities>(0);
+ }
+ std::vector<CodecCapabilities> offload_a2dp_codec_capabilities =
+ kDefaultOffloadA2dpCodecCapabilities;
+ for (auto& codec_capability : offload_a2dp_codec_capabilities) {
+ switch (codec_capability.codecType) {
+ case CodecType::SBC:
+ codec_capability.capabilities.sbcCapabilities(
+ kDefaultOffloadSbcCapability);
+ break;
+ case CodecType::AAC:
+ codec_capability.capabilities.aacCapabilities(
+ kDefaultOffloadAacCapability);
+ break;
+ case CodecType::LDAC:
+ codec_capability.capabilities.ldacCapabilities(
+ kDefaultOffloadLdacCapability);
+ break;
+ case CodecType::APTX:
+ codec_capability.capabilities.aptxCapabilities(
+ kDefaultOffloadAptxCapability);
+ break;
+ case CodecType::APTX_HD:
+ codec_capability.capabilities.aptxCapabilities(
+ kDefaultOffloadAptxHdCapability);
+ break;
+ case CodecType::UNKNOWN:
+ codec_capability = {};
+ break;
+ }
+ }
+ return offload_a2dp_codec_capabilities;
+}
+
+bool IsSoftwarePcmConfigurationValid(
+ const ::android::hardware::bluetooth::audio::V2_0::PcmParameters&
+ pcm_config) {
+ if ((pcm_config.sampleRate !=
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100 &&
+ pcm_config.sampleRate !=
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_48000 &&
+ pcm_config.sampleRate !=
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_88200 &&
+ pcm_config.sampleRate !=
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_96000 &&
+ pcm_config.sampleRate !=
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_16000 &&
+ pcm_config.sampleRate !=
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_24000) ||
+ (pcm_config.bitsPerSample != BitsPerSample::BITS_16 &&
+ pcm_config.bitsPerSample != BitsPerSample::BITS_24 &&
+ pcm_config.bitsPerSample != BitsPerSample::BITS_32) ||
+ (pcm_config.channelMode != ChannelMode::MONO &&
+ pcm_config.channelMode != ChannelMode::STEREO)) {
+ LOG(WARNING) << __func__
+ << ": Invalid PCM Configuration=" << toString(pcm_config);
+ return false;
+ } else if (pcm_config.sampleRate &
+ kDefaultSoftwarePcmCapabilities.sampleRate &&
+ pcm_config.bitsPerSample &
+ kDefaultSoftwarePcmCapabilities.bitsPerSample &&
+ pcm_config.channelMode &
+ kDefaultSoftwarePcmCapabilities.channelMode) {
+ return true;
+ }
+ LOG(WARNING) << __func__
+ << ": Unsupported PCM Configuration=" << toString(pcm_config);
+ return false;
+}
+
+bool IsSoftwarePcmConfigurationValid_2_1(const PcmParameters& pcm_config) {
+ if ((pcm_config.sampleRate != SampleRate::RATE_44100 &&
+ pcm_config.sampleRate != SampleRate::RATE_48000 &&
+ pcm_config.sampleRate != SampleRate::RATE_88200 &&
+ pcm_config.sampleRate != SampleRate::RATE_96000 &&
+ pcm_config.sampleRate != SampleRate::RATE_16000 &&
+ pcm_config.sampleRate != SampleRate::RATE_24000) ||
+ (pcm_config.bitsPerSample != BitsPerSample::BITS_16 &&
+ pcm_config.bitsPerSample != BitsPerSample::BITS_24 &&
+ pcm_config.bitsPerSample != BitsPerSample::BITS_32) ||
+ (pcm_config.channelMode != ChannelMode::MONO &&
+ pcm_config.channelMode != ChannelMode::STEREO)) {
+ LOG(WARNING) << __func__
+ << ": Invalid PCM Configuration=" << toString(pcm_config);
+ return false;
+ } else if (pcm_config.sampleRate &
+ kDefaultSoftwarePcmCapabilities_2_1.sampleRate &&
+ pcm_config.bitsPerSample &
+ kDefaultSoftwarePcmCapabilities_2_1.bitsPerSample &&
+ pcm_config.channelMode &
+ kDefaultSoftwarePcmCapabilities_2_1.channelMode &&
+ pcm_config.dataIntervalUs != 0) {
+ return true;
+ }
+ LOG(WARNING) << __func__
+ << ": Unsupported PCM Configuration=" << toString(pcm_config);
+ return false;
+}
+
+bool IsOffloadCodecConfigurationValid(const SessionType& session_type,
+ const CodecConfiguration& codec_config) {
+ if (session_type != SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ LOG(ERROR) << __func__
+ << ": Invalid SessionType=" << toString(session_type);
+ return false;
+ } else if (codec_config.encodedAudioBitrate < 0x00000001 ||
+ 0x00ffffff < codec_config.encodedAudioBitrate) {
+ LOG(ERROR) << __func__ << ": Unsupported Codec Configuration="
+ << toString(codec_config);
+ return false;
+ }
+ const CodecConfiguration::CodecSpecific& codec_specific = codec_config.config;
+ switch (codec_config.codecType) {
+ case CodecType::SBC:
+ if (IsOffloadSbcConfigurationValid(codec_specific)) {
+ return true;
+ }
+ return false;
+ case CodecType::AAC:
+ if (IsOffloadAacConfigurationValid(codec_specific)) {
+ return true;
+ }
+ return false;
+ case CodecType::LDAC:
+ if (IsOffloadLdacConfigurationValid(codec_specific)) {
+ return true;
+ }
+ return false;
+ case CodecType::APTX:
+ if (IsOffloadAptxConfigurationValid(codec_specific)) {
+ return true;
+ }
+ return false;
+ case CodecType::APTX_HD:
+ if (IsOffloadAptxHdConfigurationValid(codec_specific)) {
+ return true;
+ }
+ return false;
+ case CodecType::UNKNOWN:
+ return false;
+ }
+ return false;
+}
+
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
diff --git a/bluetooth/audio/2.1/default/session/BluetoothAudioSupportedCodecsDB.h b/bluetooth/audio/2.1/default/session/BluetoothAudioSupportedCodecsDB.h
new file mode 100644
index 0000000..9b2f680
--- /dev/null
+++ b/bluetooth/audio/2.1/default/session/BluetoothAudioSupportedCodecsDB.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <android/hardware/bluetooth/audio/2.0/types.h>
+#include <android/hardware/bluetooth/audio/2.1/types.h>
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+
+using ::android::hardware::bluetooth::audio::V2_0::CodecCapabilities;
+using ::android::hardware::bluetooth::audio::V2_0::CodecConfiguration;
+using ::android::hardware::bluetooth::audio::V2_1::PcmParameters;
+using ::android::hardware::bluetooth::audio::V2_1::SessionType;
+
+std::vector<::android::hardware::bluetooth::audio::V2_0::PcmParameters>
+GetSoftwarePcmCapabilities();
+std::vector<PcmParameters> GetSoftwarePcmCapabilities_2_1();
+std::vector<CodecCapabilities> GetOffloadCodecCapabilities(
+ const SessionType& session_type);
+std::vector<CodecCapabilities> GetOffloadCodecCapabilities(
+ const ::android::hardware::bluetooth::audio::V2_0::SessionType&
+ session_type);
+
+bool IsSoftwarePcmConfigurationValid_2_1(const PcmParameters& pcm_config);
+bool IsSoftwarePcmConfigurationValid(
+ const ::android::hardware::bluetooth::audio::V2_0::PcmParameters&
+ pcm_config);
+bool IsOffloadCodecConfigurationValid(const SessionType& session_type,
+ const CodecConfiguration& codec_config);
+
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
diff --git a/bluetooth/audio/2.1/types.hal b/bluetooth/audio/2.1/types.hal
new file mode 100644
index 0000000..5604c38
--- /dev/null
+++ b/bluetooth/audio/2.1/types.hal
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio@2.1;
+
+import @2.0::PcmParameters;
+import @2.0::SessionType;
+import @2.0::SampleRate;
+import @2.0::ChannelMode;
+import @2.0::BitsPerSample;
+import @2.0::CodecConfiguration;
+import @2.0::CodecCapabilities;
+
+enum SessionType : @2.0::SessionType {
+ /** Used when encoded by Bluetooth Stack and streaming to LE Audio device */
+ LE_AUDIO_SOFTWARE_ENCODING_DATAPATH,
+ /** Used when decoded by Bluetooth Stack and streaming to audio framework */
+ LE_AUDIO_SOFTWARE_DECODED_DATAPATH,
+ /** Encoding is done by HW an there is control only */
+ LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
+ /** Decoding is done by HW an there is control only */
+ LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH,
+};
+
+enum SampleRate : @2.0::SampleRate {
+ RATE_8000 = 0x100,
+ RATE_32000 = 0x200,
+};
+
+/** Used for Software Encoding audio feed parameters */
+struct PcmParameters {
+ SampleRate sampleRate;
+ ChannelMode channelMode;
+ BitsPerSample bitsPerSample;
+ /** Data interval for data transfer */
+ uint32_t dataIntervalUs;
+};
+
+/** Used to configure either a Hardware or Software Encoding session based on session type */
+safe_union AudioConfiguration {
+ PcmParameters pcmConfig;
+ CodecConfiguration codecConfig;
+};
+
+/** Used to specify the capabilities of the different session types */
+safe_union AudioCapabilities {
+ PcmParameters pcmCapabilities;
+ CodecCapabilities codecCapabilities;
+};
diff --git a/bluetooth/audio/2.1/vts/OWNERS b/bluetooth/audio/2.1/vts/OWNERS
new file mode 100644
index 0000000..b6c0813
--- /dev/null
+++ b/bluetooth/audio/2.1/vts/OWNERS
@@ -0,0 +1,3 @@
+include platform/system/bt:/OWNERS
+
+cheneyni@google.com
diff --git a/bluetooth/audio/2.1/vts/functional/Android.bp b/bluetooth/audio/2.1/vts/functional/Android.bp
new file mode 100644
index 0000000..6ec5537
--- /dev/null
+++ b/bluetooth/audio/2.1/vts/functional/Android.bp
@@ -0,0 +1,14 @@
+cc_test {
+ name: "VtsHalBluetoothAudioV2_1TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["VtsHalBluetoothAudioV2_1TargetTest.cpp"],
+ static_libs: [
+ "android.hardware.audio.common@5.0",
+ "android.hardware.bluetooth.audio@2.1",
+ "android.hardware.bluetooth.audio@2.0",
+ ],
+ shared_libs: [
+ "libfmq",
+ ],
+ test_suites: ["general-tests", "vts"],
+}
diff --git a/bluetooth/audio/2.1/vts/functional/VtsHalBluetoothAudioV2_1TargetTest.cpp b/bluetooth/audio/2.1/vts/functional/VtsHalBluetoothAudioV2_1TargetTest.cpp
new file mode 100644
index 0000000..c0ec907
--- /dev/null
+++ b/bluetooth/audio/2.1/vts/functional/VtsHalBluetoothAudioV2_1TargetTest.cpp
@@ -0,0 +1,1209 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "bluetooth_audio_hidl_hal_test"
+
+#include <VtsHalHidlTargetCallbackBase.h>
+#include <android-base/logging.h>
+#include <android/hardware/bluetooth/audio/2.0/IBluetoothAudioPort.h>
+#include <android/hardware/bluetooth/audio/2.1/IBluetoothAudioProvider.h>
+#include <android/hardware/bluetooth/audio/2.1/IBluetoothAudioProvidersFactory.h>
+#include <fmq/MessageQueue.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/ServiceManagement.h>
+#include <utils/Log.h>
+
+using ::android::sp;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::MessageQueue;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::audio::common::V5_0::SourceMetadata;
+using ::android::hardware::bluetooth::audio::V2_0::AacObjectType;
+using ::android::hardware::bluetooth::audio::V2_0::AacParameters;
+using ::android::hardware::bluetooth::audio::V2_0::AacVariableBitRate;
+using ::android::hardware::bluetooth::audio::V2_0::AptxParameters;
+using ::android::hardware::bluetooth::audio::V2_0::AudioCapabilities;
+using ::android::hardware::bluetooth::audio::V2_0::AudioConfiguration;
+using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample;
+using ::android::hardware::bluetooth::audio::V2_0::ChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::CodecCapabilities;
+using ::android::hardware::bluetooth::audio::V2_0::CodecConfiguration;
+using ::android::hardware::bluetooth::audio::V2_0::CodecType;
+using ::android::hardware::bluetooth::audio::V2_0::IBluetoothAudioPort;
+using ::android::hardware::bluetooth::audio::V2_0::IBluetoothAudioProvider;
+using ::android::hardware::bluetooth::audio::V2_0::LdacChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::LdacParameters;
+using ::android::hardware::bluetooth::audio::V2_0::LdacQualityIndex;
+using ::android::hardware::bluetooth::audio::V2_0::PcmParameters;
+using ::android::hardware::bluetooth::audio::V2_0::SbcAllocMethod;
+using ::android::hardware::bluetooth::audio::V2_0::SbcBlockLength;
+using ::android::hardware::bluetooth::audio::V2_0::SbcChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::SbcNumSubbands;
+using ::android::hardware::bluetooth::audio::V2_0::SbcParameters;
+using ::android::hardware::bluetooth::audio::V2_0::SessionType;
+using ::android::hardware::bluetooth::audio::V2_1::
+ IBluetoothAudioProvidersFactory;
+using ::android::hardware::bluetooth::audio::V2_1::SampleRate;
+
+using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+using BluetoothAudioStatus =
+ ::android::hardware::bluetooth::audio::V2_0::Status;
+using CodecSpecificConfig = ::android::hardware::bluetooth::audio::V2_0::
+ CodecConfiguration::CodecSpecific;
+
+namespace {
+constexpr android::hardware::bluetooth::audio::V2_0::SampleRate
+ a2dp_sample_rates[5] = {
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_UNKNOWN,
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_44100,
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_48000,
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_88200,
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_96000};
+constexpr BitsPerSample a2dp_bits_per_samples[4] = {
+ BitsPerSample::BITS_UNKNOWN, BitsPerSample::BITS_16, BitsPerSample::BITS_24,
+ BitsPerSample::BITS_32};
+constexpr ChannelMode a2dp_channel_modes[3] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+constexpr CodecType a2dp_codec_types[6] = {CodecType::UNKNOWN, CodecType::SBC,
+ CodecType::AAC, CodecType::APTX,
+ CodecType::APTX_HD, CodecType::LDAC};
+
+template <typename T>
+std::vector<T> ExtractValuesFromBitmask(T bitmasks, uint32_t bitfield,
+ bool supported) {
+ std::vector<T> retval;
+ if (!supported) {
+ retval.push_back(static_cast<T>(bitfield));
+ }
+ uint32_t test_bit = 0x00000001;
+ while (test_bit <= static_cast<uint32_t>(bitmasks) && test_bit <= bitfield) {
+ if ((bitfield & test_bit)) {
+ if ((!(bitmasks & test_bit) && !supported) ||
+ ((bitmasks & test_bit) && supported)) {
+ retval.push_back(static_cast<T>(test_bit));
+ }
+ }
+ if (test_bit == 0x80000000) {
+ break;
+ }
+ test_bit <<= 1;
+ }
+ return retval;
+}
+} // namespace
+
+// The base test class for Bluetooth Audio HAL.
+class BluetoothAudioProvidersFactoryHidlTest
+ : public ::testing::TestWithParam<std::string> {
+ public:
+ virtual void SetUp() override {
+ providers_factory_ =
+ IBluetoothAudioProvidersFactory::getService(GetParam());
+ ASSERT_NE(providers_factory_, nullptr);
+ }
+
+ virtual void TearDown() override { providers_factory_ = nullptr; }
+
+ // A simple test implementation of IBluetoothAudioPort.
+ class BluetoothAudioPort : public ::testing::VtsHalHidlTargetCallbackBase<
+ BluetoothAudioProvidersFactoryHidlTest>,
+ public IBluetoothAudioPort {
+ BluetoothAudioProvidersFactoryHidlTest& parent_;
+
+ public:
+ BluetoothAudioPort(BluetoothAudioProvidersFactoryHidlTest& parent)
+ : parent_(parent) {}
+ virtual ~BluetoothAudioPort() = default;
+
+ Return<void> startStream() override {
+ parent_.audio_provider_->streamStarted(BluetoothAudioStatus::SUCCESS);
+ return Void();
+ }
+
+ Return<void> suspendStream() override {
+ parent_.audio_provider_->streamSuspended(BluetoothAudioStatus::SUCCESS);
+ return Void();
+ }
+
+ Return<void> stopStream() override { return Void(); }
+
+ Return<void> getPresentationPosition(getPresentationPosition_cb _hidl_cb) {
+ _hidl_cb(BluetoothAudioStatus::SUCCESS, 0, 0, {.tvSec = 0, .tvNSec = 0});
+ return Void();
+ }
+
+ Return<void> updateMetadata(const SourceMetadata& sourceMetadata __unused) {
+ return Void();
+ }
+ };
+
+ void GetProviderCapabilitiesHelper(const SessionType& session_type) {
+ temp_provider_capabilities_.clear();
+ auto hidl_cb = [&temp_capabilities = this->temp_provider_capabilities_](
+ const hidl_vec<AudioCapabilities>& audioCapabilities) {
+ for (auto audioCapability : audioCapabilities)
+ temp_capabilities.push_back(audioCapability);
+ };
+ auto hidl_retval =
+ providers_factory_->getProviderCapabilities(session_type, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ if (session_type == SessionType::UNKNOWN) {
+ ASSERT_TRUE(temp_provider_capabilities_.empty());
+ } else if (session_type != SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ // All software paths are mandatory and must have exact 1 "PcmParameters"
+ ASSERT_EQ(temp_provider_capabilities_.size(), 1);
+ ASSERT_EQ(temp_provider_capabilities_[0].getDiscriminator(),
+ AudioCapabilities::hidl_discriminator::pcmCapabilities);
+ } else {
+ uint32_t codec_type_bitmask = 0x00000000;
+ // empty capability means offload is unsupported
+ for (auto audio_capability : temp_provider_capabilities_) {
+ ASSERT_EQ(audio_capability.getDiscriminator(),
+ AudioCapabilities::hidl_discriminator::codecCapabilities);
+ const CodecCapabilities& codec_capabilities =
+ audio_capability.codecCapabilities();
+ // Every codec can present once at most
+ ASSERT_EQ(codec_type_bitmask &
+ static_cast<uint32_t>(codec_capabilities.codecType),
+ 0);
+ switch (codec_capabilities.codecType) {
+ case CodecType::SBC:
+ ASSERT_EQ(codec_capabilities.capabilities.getDiscriminator(),
+ CodecCapabilities::Capabilities::hidl_discriminator::
+ sbcCapabilities);
+ break;
+ case CodecType::AAC:
+ ASSERT_EQ(codec_capabilities.capabilities.getDiscriminator(),
+ CodecCapabilities::Capabilities::hidl_discriminator::
+ aacCapabilities);
+ break;
+ case CodecType::APTX:
+ FALLTHROUGH_INTENDED;
+ case CodecType::APTX_HD:
+ ASSERT_EQ(codec_capabilities.capabilities.getDiscriminator(),
+ CodecCapabilities::Capabilities::hidl_discriminator::
+ aptxCapabilities);
+ break;
+ case CodecType::LDAC:
+ ASSERT_EQ(codec_capabilities.capabilities.getDiscriminator(),
+ CodecCapabilities::Capabilities::hidl_discriminator::
+ ldacCapabilities);
+ break;
+ case CodecType::UNKNOWN:
+ break;
+ }
+ codec_type_bitmask |= codec_capabilities.codecType;
+ }
+ }
+ }
+
+ void GetProviderCapabilitiesHelper_2_1(
+ const android::hardware::bluetooth::audio::V2_1::SessionType&
+ session_type) {
+ temp_provider_capabilities_2_1_.clear();
+ auto hidl_cb =
+ [&temp_capabilities = this->temp_provider_capabilities_2_1_](
+ const hidl_vec<
+ android::hardware::bluetooth::audio::V2_1::AudioCapabilities>&
+ audioCapabilities) {
+ for (auto audioCapability : audioCapabilities)
+ temp_capabilities.push_back(audioCapability);
+ };
+ auto hidl_retval =
+ providers_factory_->getProviderCapabilities_2_1(session_type, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+
+ // All software paths are mandatory and must have exact 1 "PcmParameters"
+ ASSERT_EQ(temp_provider_capabilities_2_1_.size(), 1);
+ ASSERT_EQ(temp_provider_capabilities_2_1_[0].getDiscriminator(),
+ android::hardware::bluetooth::audio::V2_1::AudioCapabilities::
+ hidl_discriminator::pcmCapabilities);
+ }
+
+ // This helps to open the specified provider and check the openProvider()
+ // has corruct return values. BUT, to keep it simple, it does not consider
+ // the capability, and please do so at the SetUp of each session's test.
+ void OpenProviderHelper(const SessionType& session_type) {
+ BluetoothAudioStatus cb_status;
+ auto hidl_cb = [&cb_status, &local_provider = this->audio_provider_](
+ BluetoothAudioStatus status,
+ const sp<IBluetoothAudioProvider>& provider) {
+ cb_status = status;
+ local_provider = provider;
+ };
+ auto hidl_retval = providers_factory_->openProvider(session_type, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ if (cb_status == BluetoothAudioStatus::SUCCESS) {
+ ASSERT_NE(session_type, SessionType::UNKNOWN);
+ ASSERT_NE(audio_provider_, nullptr);
+ audio_port_ = new BluetoothAudioPort(*this);
+ } else {
+ // A2DP_HARDWARE_OFFLOAD_DATAPATH is optional
+ ASSERT_TRUE(session_type == SessionType::UNKNOWN ||
+ session_type == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
+ ASSERT_EQ(cb_status, BluetoothAudioStatus::FAILURE);
+ ASSERT_EQ(audio_provider_, nullptr);
+ }
+ }
+
+ // This helps to open the specified provider and check the openProvider_2_1()
+ // has corruct return values. BUT, to keep it simple, it does not consider
+ // the capability, and please do so at the SetUp of each session's test.
+ void OpenProviderHelper_2_1(
+ const android::hardware::bluetooth::audio::V2_1::SessionType&
+ session_type) {
+ BluetoothAudioStatus cb_status;
+ auto hidl_cb = [&cb_status, &local_provider = this->audio_provider_2_1_](
+ BluetoothAudioStatus status,
+ const sp<android::hardware::bluetooth::audio::V2_1::
+ IBluetoothAudioProvider>& provider) {
+ cb_status = status;
+ local_provider = provider;
+ };
+ auto hidl_retval =
+ providers_factory_->openProvider_2_1(session_type, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ if (cb_status == BluetoothAudioStatus::SUCCESS) {
+ ASSERT_NE(
+ session_type,
+ android::hardware::bluetooth::audio::V2_1::SessionType::UNKNOWN);
+ ASSERT_NE(audio_provider_2_1_, nullptr);
+ audio_port_ = new BluetoothAudioPort(*this);
+ } else {
+ ASSERT_TRUE(
+ session_type ==
+ android::hardware::bluetooth::audio::V2_1::SessionType::UNKNOWN);
+ ASSERT_EQ(cb_status, BluetoothAudioStatus::FAILURE);
+ ASSERT_EQ(audio_provider_2_1_, nullptr);
+ }
+ }
+
+ bool IsPcmParametersSupported(const PcmParameters& pcm_parameters) {
+ if (temp_provider_capabilities_.size() != 1 ||
+ temp_provider_capabilities_[0].getDiscriminator() !=
+ AudioCapabilities::hidl_discriminator::pcmCapabilities) {
+ return false;
+ }
+ auto pcm_capability = temp_provider_capabilities_[0].pcmCapabilities();
+ bool is_parameter_valid =
+ (pcm_parameters.sampleRate != android::hardware::bluetooth::audio::
+ V2_0::SampleRate::RATE_UNKNOWN &&
+ pcm_parameters.channelMode != ChannelMode::UNKNOWN &&
+ pcm_parameters.bitsPerSample != BitsPerSample::BITS_UNKNOWN);
+ bool is_parameter_in_capability =
+ (pcm_capability.sampleRate & pcm_parameters.sampleRate &&
+ pcm_capability.channelMode & pcm_parameters.channelMode &&
+ pcm_capability.bitsPerSample & pcm_parameters.bitsPerSample);
+ return is_parameter_valid && is_parameter_in_capability;
+ }
+
+ bool IsPcmParametersSupported_2_1(
+ const android::hardware::bluetooth::audio::V2_1::PcmParameters&
+ pcm_parameters) {
+ if (temp_provider_capabilities_2_1_.size() != 1 ||
+ temp_provider_capabilities_2_1_[0].getDiscriminator() !=
+ android::hardware::bluetooth::audio::V2_1::AudioCapabilities::
+ hidl_discriminator::pcmCapabilities) {
+ return false;
+ }
+ auto pcm_capability = temp_provider_capabilities_2_1_[0].pcmCapabilities();
+ bool is_parameter_valid =
+ (pcm_parameters.sampleRate != SampleRate::RATE_UNKNOWN &&
+ pcm_parameters.channelMode != ChannelMode::UNKNOWN &&
+ pcm_parameters.bitsPerSample != BitsPerSample::BITS_UNKNOWN &&
+ pcm_parameters.dataIntervalUs != 0);
+ bool is_parameter_in_capability =
+ (pcm_capability.sampleRate & pcm_parameters.sampleRate &&
+ pcm_capability.channelMode & pcm_parameters.channelMode &&
+ pcm_capability.bitsPerSample & pcm_parameters.bitsPerSample);
+ return is_parameter_valid && is_parameter_in_capability;
+ }
+
+ sp<IBluetoothAudioProvidersFactory> providers_factory_;
+
+ // temp storage saves the specified provider capability by
+ // GetProviderCapabilitiesHelper()
+ std::vector<AudioCapabilities> temp_provider_capabilities_;
+ std::vector<android::hardware::bluetooth::audio::V2_1::AudioCapabilities>
+ temp_provider_capabilities_2_1_;
+
+ // audio_provider_ is for the Bluetooth stack to report session started/ended
+ // and handled audio stream started / suspended
+ sp<IBluetoothAudioProvider> audio_provider_;
+ sp<android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvider>
+ audio_provider_2_1_;
+
+ // audio_port_ is for the Audio HAL to send stream start/suspend/stop commands
+ // to Bluetooth stack
+ sp<IBluetoothAudioPort> audio_port_;
+
+ static constexpr SessionType session_types_[4] = {
+ SessionType::UNKNOWN, SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH,
+ SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH,
+ SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH};
+};
+
+/**
+ * Test whether we can get the FactoryService from HIDL
+ */
+TEST_P(BluetoothAudioProvidersFactoryHidlTest, GetProvidersFactoryService) {}
+
+/**
+ * Test whether we can open a provider for each provider returned by
+ * getProviderCapabilities() with non-empty capabalities
+ */
+TEST_P(BluetoothAudioProvidersFactoryHidlTest,
+ OpenProviderAndCheckCapabilitiesBySession) {
+ for (auto session_type : session_types_) {
+ GetProviderCapabilitiesHelper(session_type);
+ OpenProviderHelper(session_type);
+ // We must be able to open a provider if its getProviderCapabilities()
+ // returns non-empty list.
+ EXPECT_TRUE(temp_provider_capabilities_.empty() ||
+ audio_provider_ != nullptr);
+ }
+}
+
+/**
+ * openProvider A2DP_SOFTWARE_ENCODING_DATAPATH
+ */
+class BluetoothAudioProviderA2dpSoftwareHidlTest
+ : public BluetoothAudioProvidersFactoryHidlTest {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProvidersFactoryHidlTest::SetUp();
+ GetProviderCapabilitiesHelper(SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH);
+ OpenProviderHelper(SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH);
+ ASSERT_NE(audio_provider_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProvidersFactoryHidlTest::TearDown();
+ }
+};
+
+/**
+ * Test whether we can open a provider of type
+ */
+TEST_P(BluetoothAudioProviderA2dpSoftwareHidlTest, OpenA2dpSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH can be started and stopped with
+ * different PCM config
+ */
+TEST_P(BluetoothAudioProviderA2dpSoftwareHidlTest,
+ StartAndEndA2dpSoftwareSessionWithPossiblePcmConfig) {
+ bool is_codec_config_valid;
+ std::unique_ptr<DataMQ> tempDataMQ;
+ auto hidl_cb = [&is_codec_config_valid, &tempDataMQ](
+ BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ if (is_codec_config_valid) {
+ ASSERT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ ASSERT_TRUE(dataMQ.isHandleValid());
+ tempDataMQ.reset(new DataMQ(dataMQ));
+ } else {
+ EXPECT_EQ(status, BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ }
+ };
+ AudioConfiguration audio_config = {};
+ PcmParameters pcm_parameters = {};
+ for (auto sample_rate : a2dp_sample_rates) {
+ pcm_parameters.sampleRate = sample_rate;
+ for (auto bits_per_sample : a2dp_bits_per_samples) {
+ pcm_parameters.bitsPerSample = bits_per_sample;
+ for (auto channel_mode : a2dp_channel_modes) {
+ pcm_parameters.channelMode = channel_mode;
+ is_codec_config_valid = IsPcmParametersSupported(pcm_parameters);
+ audio_config.pcmConfig(pcm_parameters);
+ auto hidl_retval =
+ audio_provider_->startSession(audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(tempDataMQ != nullptr && tempDataMQ->isValid());
+ }
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ } // ChannelMode
+ } // BitsPerSampple
+ } // SampleRate
+}
+
+/**
+ * openProvider A2DP_HARDWARE_OFFLOAD_DATAPATH
+ */
+class BluetoothAudioProviderA2dpHardwareHidlTest
+ : public BluetoothAudioProvidersFactoryHidlTest {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProvidersFactoryHidlTest::SetUp();
+ GetProviderCapabilitiesHelper(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
+ OpenProviderHelper(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
+ ASSERT_TRUE(temp_provider_capabilities_.empty() ||
+ audio_provider_ != nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProvidersFactoryHidlTest::TearDown();
+ }
+
+ bool IsOffloadSupported() { return (temp_provider_capabilities_.size() > 0); }
+
+ void GetOffloadCodecCapabilityHelper(const CodecType& codec_type) {
+ temp_codec_capabilities_ = {};
+ for (auto codec_capability : temp_provider_capabilities_) {
+ if (codec_capability.codecCapabilities().codecType != codec_type) {
+ continue;
+ }
+ temp_codec_capabilities_ = codec_capability.codecCapabilities();
+ }
+ }
+
+ std::vector<CodecSpecificConfig> GetSbcCodecSpecificSupportedList(
+ bool supported) {
+ std::vector<CodecSpecificConfig> sbc_codec_specifics;
+ GetOffloadCodecCapabilityHelper(CodecType::SBC);
+ if (temp_codec_capabilities_.codecType != CodecType::SBC) {
+ return sbc_codec_specifics;
+ }
+ // parse the capability
+ SbcParameters sbc_capability =
+ temp_codec_capabilities_.capabilities.sbcCapabilities();
+ if (sbc_capability.minBitpool > sbc_capability.maxBitpool) {
+ return sbc_codec_specifics;
+ }
+ std::vector<android::hardware::bluetooth::audio::V2_0::SampleRate>
+ sample_rates = ExtractValuesFromBitmask<
+ android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ sbc_capability.sampleRate, 0xff, supported);
+ std::vector<SbcChannelMode> channel_modes =
+ ExtractValuesFromBitmask<SbcChannelMode>(sbc_capability.channelMode,
+ 0x0f, supported);
+ std::vector<SbcBlockLength> block_lengths =
+ ExtractValuesFromBitmask<SbcBlockLength>(sbc_capability.blockLength,
+ 0xf0, supported);
+ std::vector<SbcNumSubbands> num_subbandss =
+ ExtractValuesFromBitmask<SbcNumSubbands>(sbc_capability.numSubbands,
+ 0x0c, supported);
+ std::vector<SbcAllocMethod> alloc_methods =
+ ExtractValuesFromBitmask<SbcAllocMethod>(sbc_capability.allocMethod,
+ 0x03, supported);
+ std::vector<BitsPerSample> bits_per_samples =
+ ExtractValuesFromBitmask<BitsPerSample>(sbc_capability.bitsPerSample,
+ 0x07, supported);
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ CodecSpecificConfig codec_specific = {};
+ SbcParameters sbc_data;
+ for (auto sample_rate : sample_rates) {
+ for (auto channel_mode : channel_modes) {
+ for (auto block_length : block_lengths) {
+ for (auto num_subbands : num_subbandss) {
+ for (auto alloc_method : alloc_methods) {
+ for (auto bits_per_sample : bits_per_samples) {
+ sbc_data = {.sampleRate = sample_rate,
+ .channelMode = channel_mode,
+ .blockLength = block_length,
+ .numSubbands = num_subbands,
+ .allocMethod = alloc_method,
+ .bitsPerSample = bits_per_sample,
+ .minBitpool = sbc_capability.minBitpool,
+ .maxBitpool = sbc_capability.maxBitpool};
+ codec_specific.sbcConfig(sbc_data);
+ sbc_codec_specifics.push_back(codec_specific);
+ }
+ }
+ }
+ }
+ }
+ }
+ return sbc_codec_specifics;
+ }
+
+ std::vector<CodecSpecificConfig> GetAacCodecSpecificSupportedList(
+ bool supported) {
+ std::vector<CodecSpecificConfig> aac_codec_specifics;
+ GetOffloadCodecCapabilityHelper(CodecType::AAC);
+ if (temp_codec_capabilities_.codecType != CodecType::AAC) {
+ return aac_codec_specifics;
+ }
+ // parse the capability
+ AacParameters aac_capability =
+ temp_codec_capabilities_.capabilities.aacCapabilities();
+ std::vector<AacObjectType> object_types =
+ ExtractValuesFromBitmask<AacObjectType>(aac_capability.objectType, 0xf0,
+ supported);
+ std::vector<android::hardware::bluetooth::audio::V2_0::SampleRate>
+ sample_rates = ExtractValuesFromBitmask<
+ android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ aac_capability.sampleRate, 0xff, supported);
+ std::vector<ChannelMode> channel_modes =
+ ExtractValuesFromBitmask<ChannelMode>(aac_capability.channelMode, 0x03,
+ supported);
+ std::vector<AacVariableBitRate> variable_bit_rate_enableds = {
+ AacVariableBitRate::DISABLED};
+ if (aac_capability.variableBitRateEnabled == AacVariableBitRate::ENABLED) {
+ variable_bit_rate_enableds.push_back(AacVariableBitRate::ENABLED);
+ }
+ std::vector<BitsPerSample> bits_per_samples =
+ ExtractValuesFromBitmask<BitsPerSample>(aac_capability.bitsPerSample,
+ 0x07, supported);
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ CodecSpecificConfig codec_specific = {};
+ AacParameters aac_data;
+ for (auto object_type : object_types) {
+ for (auto sample_rate : sample_rates) {
+ for (auto channel_mode : channel_modes) {
+ for (auto variable_bit_rate_enabled : variable_bit_rate_enableds) {
+ for (auto bits_per_sample : bits_per_samples) {
+ aac_data = {.objectType = object_type,
+ .sampleRate = sample_rate,
+ .channelMode = channel_mode,
+ .variableBitRateEnabled = variable_bit_rate_enabled,
+ .bitsPerSample = bits_per_sample};
+ codec_specific.aacConfig(aac_data);
+ aac_codec_specifics.push_back(codec_specific);
+ }
+ }
+ }
+ }
+ }
+ return aac_codec_specifics;
+ }
+
+ std::vector<CodecSpecificConfig> GetLdacCodecSpecificSupportedList(
+ bool supported) {
+ std::vector<CodecSpecificConfig> ldac_codec_specifics;
+ GetOffloadCodecCapabilityHelper(CodecType::LDAC);
+ if (temp_codec_capabilities_.codecType != CodecType::LDAC) {
+ return ldac_codec_specifics;
+ }
+ // parse the capability
+ LdacParameters ldac_capability =
+ temp_codec_capabilities_.capabilities.ldacCapabilities();
+ std::vector<android::hardware::bluetooth::audio::V2_0::SampleRate>
+ sample_rates = ExtractValuesFromBitmask<
+ android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ ldac_capability.sampleRate, 0xff, supported);
+ std::vector<LdacChannelMode> channel_modes =
+ ExtractValuesFromBitmask<LdacChannelMode>(ldac_capability.channelMode,
+ 0x07, supported);
+ std::vector<LdacQualityIndex> quality_indexes = {
+ LdacQualityIndex::QUALITY_HIGH, LdacQualityIndex::QUALITY_MID,
+ LdacQualityIndex::QUALITY_LOW, LdacQualityIndex::QUALITY_ABR};
+ std::vector<BitsPerSample> bits_per_samples =
+ ExtractValuesFromBitmask<BitsPerSample>(ldac_capability.bitsPerSample,
+ 0x07, supported);
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ CodecSpecificConfig codec_specific = {};
+ LdacParameters ldac_data;
+ for (auto sample_rate : sample_rates) {
+ for (auto channel_mode : channel_modes) {
+ for (auto quality_index : quality_indexes) {
+ for (auto bits_per_sample : bits_per_samples) {
+ ldac_data = {.sampleRate = sample_rate,
+ .channelMode = channel_mode,
+ .qualityIndex = quality_index,
+ .bitsPerSample = bits_per_sample};
+ codec_specific.ldacConfig(ldac_data);
+ ldac_codec_specifics.push_back(codec_specific);
+ }
+ }
+ }
+ }
+ return ldac_codec_specifics;
+ }
+
+ std::vector<CodecSpecificConfig> GetAptxCodecSpecificSupportedList(
+ bool is_hd, bool supported) {
+ std::vector<CodecSpecificConfig> aptx_codec_specifics;
+ GetOffloadCodecCapabilityHelper(
+ (is_hd ? CodecType::APTX_HD : CodecType::APTX));
+ if ((is_hd && temp_codec_capabilities_.codecType != CodecType::APTX_HD) ||
+ (!is_hd && temp_codec_capabilities_.codecType != CodecType::APTX)) {
+ return aptx_codec_specifics;
+ }
+ // parse the capability
+ AptxParameters aptx_capability =
+ temp_codec_capabilities_.capabilities.aptxCapabilities();
+ std::vector<android::hardware::bluetooth::audio::V2_0::SampleRate>
+ sample_rates = ExtractValuesFromBitmask<
+ android::hardware::bluetooth::audio::V2_0::SampleRate>(
+ aptx_capability.sampleRate, 0xff, supported);
+ std::vector<ChannelMode> channel_modes =
+ ExtractValuesFromBitmask<ChannelMode>(aptx_capability.channelMode, 0x03,
+ supported);
+ std::vector<BitsPerSample> bits_per_samples =
+ ExtractValuesFromBitmask<BitsPerSample>(aptx_capability.bitsPerSample,
+ 0x07, supported);
+ // combine those parameters into one list of
+ // CodecConfiguration::CodecSpecific
+ CodecSpecificConfig codec_specific = {};
+ AptxParameters aptx_data;
+ for (auto sample_rate : sample_rates) {
+ for (auto channel_mode : channel_modes) {
+ for (auto bits_per_sample : bits_per_samples) {
+ aptx_data = {.sampleRate = sample_rate,
+ .channelMode = channel_mode,
+ .bitsPerSample = bits_per_sample};
+ codec_specific.aptxConfig(aptx_data);
+ aptx_codec_specifics.push_back(codec_specific);
+ }
+ }
+ }
+ return aptx_codec_specifics;
+ }
+
+ // temp storage saves the specified codec capability by
+ // GetOffloadCodecCapabilityHelper()
+ CodecCapabilities temp_codec_capabilities_;
+};
+
+/**
+ * Test whether we can open a provider of type
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareHidlTest, OpenA2dpHardwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * SBC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareHidlTest,
+ StartAndEndA2dpSbcHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ CodecConfiguration codec_config = {};
+ codec_config.codecType = CodecType::SBC;
+ codec_config.encodedAudioBitrate = 328000;
+ codec_config.peerMtu = 1005;
+ codec_config.isScmstEnabled = false;
+ AudioConfiguration audio_config = {};
+ std::vector<CodecSpecificConfig> sbc_codec_specifics =
+ GetSbcCodecSpecificSupportedList(true);
+ auto hidl_cb = [](BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ EXPECT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ };
+ for (auto codec_specific : sbc_codec_specifics) {
+ codec_config.config = codec_specific;
+ audio_config.codecConfig(codec_config);
+ auto hidl_retval =
+ audio_provider_->startSession(audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * AAC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareHidlTest,
+ StartAndEndA2dpAacHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ CodecConfiguration codec_config = {};
+ codec_config.codecType = CodecType::AAC;
+ codec_config.encodedAudioBitrate = 320000;
+ codec_config.peerMtu = 1005;
+ codec_config.isScmstEnabled = false;
+ AudioConfiguration audio_config = {};
+ std::vector<CodecSpecificConfig> aac_codec_specifics =
+ GetAacCodecSpecificSupportedList(true);
+ auto hidl_cb = [](BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ EXPECT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ };
+ for (auto codec_specific : aac_codec_specifics) {
+ codec_config.config = codec_specific;
+ audio_config.codecConfig(codec_config);
+ auto hidl_retval =
+ audio_provider_->startSession(audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * LDAC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareHidlTest,
+ StartAndEndA2dpLdacHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ CodecConfiguration codec_config = {};
+ codec_config.codecType = CodecType::LDAC;
+ codec_config.encodedAudioBitrate = 990000;
+ codec_config.peerMtu = 1005;
+ codec_config.isScmstEnabled = false;
+ AudioConfiguration audio_config = {};
+ std::vector<CodecSpecificConfig> ldac_codec_specifics =
+ GetLdacCodecSpecificSupportedList(true);
+ auto hidl_cb = [](BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ EXPECT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ };
+ for (auto codec_specific : ldac_codec_specifics) {
+ codec_config.config = codec_specific;
+ audio_config.codecConfig(codec_config);
+ auto hidl_retval =
+ audio_provider_->startSession(audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * AptX hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareHidlTest,
+ StartAndEndA2dpAptxHardwareSession) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+
+ for (auto codec_type : {CodecType::APTX, CodecType::APTX_HD}) {
+ CodecConfiguration codec_config = {};
+ codec_config.codecType = codec_type;
+ codec_config.encodedAudioBitrate =
+ (codec_type == CodecType::APTX ? 352000 : 576000);
+ codec_config.peerMtu = 1005;
+ codec_config.isScmstEnabled = false;
+ AudioConfiguration audio_config = {};
+ std::vector<CodecSpecificConfig> aptx_codec_specifics =
+ GetAptxCodecSpecificSupportedList(
+ (codec_type == CodecType::APTX_HD ? true : false), true);
+ auto hidl_cb = [](BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ EXPECT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ };
+ for (auto codec_specific : aptx_codec_specifics) {
+ codec_config.config = codec_specific;
+ audio_config.codecConfig(codec_config);
+ auto hidl_retval =
+ audio_provider_->startSession(audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+}
+
+/**
+ * Test whether each provider of type
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
+ * an invalid codec config
+ */
+TEST_P(BluetoothAudioProviderA2dpHardwareHidlTest,
+ StartAndEndA2dpHardwareSessionInvalidCodecConfig) {
+ if (!IsOffloadSupported()) {
+ return;
+ }
+ ASSERT_NE(audio_provider_, nullptr);
+
+ std::vector<CodecSpecificConfig> codec_specifics;
+ for (auto codec_type : a2dp_codec_types) {
+ switch (codec_type) {
+ case CodecType::SBC:
+ codec_specifics = GetSbcCodecSpecificSupportedList(false);
+ break;
+ case CodecType::AAC:
+ codec_specifics = GetAacCodecSpecificSupportedList(false);
+ break;
+ case CodecType::LDAC:
+ codec_specifics = GetLdacCodecSpecificSupportedList(false);
+ break;
+ case CodecType::APTX:
+ codec_specifics = GetAptxCodecSpecificSupportedList(false, false);
+ break;
+ case CodecType::APTX_HD:
+ codec_specifics = GetAptxCodecSpecificSupportedList(true, false);
+ break;
+ case CodecType::UNKNOWN:
+ codec_specifics.clear();
+ break;
+ }
+ if (codec_specifics.empty()) {
+ continue;
+ }
+
+ CodecConfiguration codec_config = {};
+ codec_config.codecType = codec_type;
+ codec_config.encodedAudioBitrate = 328000;
+ codec_config.peerMtu = 1005;
+ codec_config.isScmstEnabled = false;
+ AudioConfiguration audio_config = {};
+ auto hidl_cb = [](BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ EXPECT_EQ(status, BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ };
+ for (auto codec_specific : codec_specifics) {
+ codec_config.config = codec_specific;
+ audio_config.codecConfig(codec_config);
+ auto hidl_retval =
+ audio_provider_->startSession(audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ }
+ }
+}
+
+/**
+ * openProvider HEARING_AID_SOFTWARE_ENCODING_DATAPATH
+ */
+class BluetoothAudioProviderHearingAidSoftwareHidlTest
+ : public BluetoothAudioProvidersFactoryHidlTest {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProvidersFactoryHidlTest::SetUp();
+ GetProviderCapabilitiesHelper(
+ SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH);
+ OpenProviderHelper(SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH);
+ ASSERT_NE(audio_provider_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_ = nullptr;
+ BluetoothAudioProvidersFactoryHidlTest::TearDown();
+ }
+
+ static constexpr android::hardware::bluetooth::audio::V2_0::SampleRate
+ hearing_aid_sample_rates_[3] = {
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_UNKNOWN,
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_16000,
+ android::hardware::bluetooth::audio::V2_0::SampleRate::RATE_24000};
+ static constexpr BitsPerSample hearing_aid_bits_per_samples_[3] = {
+ BitsPerSample::BITS_UNKNOWN, BitsPerSample::BITS_16,
+ BitsPerSample::BITS_24};
+ static constexpr ChannelMode hearing_aid_channel_modes_[3] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::HEARING_AID_HARDWARE_ENCODING_DATAPATH can be started and
+ * stopped with SBC hardware encoding config
+ */
+TEST_P(BluetoothAudioProviderHearingAidSoftwareHidlTest,
+ OpenHearingAidSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped with different PCM config
+ */
+TEST_P(BluetoothAudioProviderHearingAidSoftwareHidlTest,
+ StartAndEndHearingAidSessionWithPossiblePcmConfig) {
+ bool is_codec_config_valid;
+ std::unique_ptr<DataMQ> tempDataMQ;
+ auto hidl_cb = [&is_codec_config_valid, &tempDataMQ](
+ BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ if (is_codec_config_valid) {
+ ASSERT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ ASSERT_TRUE(dataMQ.isHandleValid());
+ tempDataMQ.reset(new DataMQ(dataMQ));
+ } else {
+ EXPECT_EQ(status, BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ }
+ };
+ AudioConfiguration audio_config = {};
+ PcmParameters pcm_parameters = {};
+ for (auto sample_rate : hearing_aid_sample_rates_) {
+ pcm_parameters.sampleRate = sample_rate;
+ for (auto bits_per_sample : hearing_aid_bits_per_samples_) {
+ pcm_parameters.bitsPerSample = bits_per_sample;
+ for (auto channel_mode : hearing_aid_channel_modes_) {
+ pcm_parameters.channelMode = channel_mode;
+ is_codec_config_valid = IsPcmParametersSupported(pcm_parameters);
+ audio_config.pcmConfig(pcm_parameters);
+ auto hidl_retval =
+ audio_provider_->startSession(audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(tempDataMQ != nullptr && tempDataMQ->isValid());
+ }
+ EXPECT_TRUE(audio_provider_->endSession().isOk());
+ } // ChannelMode
+ } // BitsPerSampple
+ } // SampleRate
+}
+
+/**
+ * openProvider LE_AUDIO_SOFTWARE_ENCODING_DATAPATH
+ */
+class BluetoothAudioProviderLeAudioOutputSoftwareHidlTest
+ : public BluetoothAudioProvidersFactoryHidlTest {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProvidersFactoryHidlTest::SetUp();
+ GetProviderCapabilitiesHelper_2_1(
+ android::hardware::bluetooth::audio::V2_1::SessionType::
+ LE_AUDIO_SOFTWARE_ENCODING_DATAPATH);
+ OpenProviderHelper_2_1(
+ android::hardware::bluetooth::audio::V2_1::SessionType::
+ LE_AUDIO_SOFTWARE_ENCODING_DATAPATH);
+ ASSERT_NE(audio_provider_2_1_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_2_1_ = nullptr;
+ BluetoothAudioProvidersFactoryHidlTest::TearDown();
+ }
+
+ static constexpr SampleRate le_audio_output_sample_rates_[3] = {
+ SampleRate::RATE_UNKNOWN, SampleRate::RATE_16000, SampleRate::RATE_24000};
+ static constexpr BitsPerSample le_audio_output_bits_per_samples_[3] = {
+ BitsPerSample::BITS_UNKNOWN, BitsPerSample::BITS_16,
+ BitsPerSample::BITS_24};
+ static constexpr ChannelMode le_audio_output_channel_modes_[3] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+ static constexpr uint32_t le_audio_output_data_interval_us_[2] = {
+ 0 /* Invalid */, 10000 /* Valid 10ms */};
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped
+ */
+TEST_P(BluetoothAudioProviderLeAudioOutputSoftwareHidlTest,
+ OpenLeAudioOutputSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH can be started and
+ * stopped with different PCM config
+ */
+TEST_P(BluetoothAudioProviderLeAudioOutputSoftwareHidlTest,
+ StartAndEndLeAudioOutputSessionWithPossiblePcmConfig) {
+ bool is_codec_config_valid;
+ std::unique_ptr<DataMQ> tempDataMQ;
+ auto hidl_cb = [&is_codec_config_valid, &tempDataMQ](
+ BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ if (is_codec_config_valid) {
+ ASSERT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ ASSERT_TRUE(dataMQ.isHandleValid());
+ tempDataMQ.reset(new DataMQ(dataMQ));
+ } else {
+ EXPECT_EQ(status, BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ }
+ };
+ android::hardware::bluetooth::audio::V2_1::AudioConfiguration audio_config =
+ {};
+ android::hardware::bluetooth::audio::V2_1::PcmParameters pcm_parameters = {};
+ for (auto sample_rate : le_audio_output_sample_rates_) {
+ pcm_parameters.sampleRate = sample_rate;
+ for (auto bits_per_sample : le_audio_output_bits_per_samples_) {
+ pcm_parameters.bitsPerSample = bits_per_sample;
+ for (auto channel_mode : le_audio_output_channel_modes_) {
+ pcm_parameters.channelMode = channel_mode;
+ for (auto data_interval_us : le_audio_output_data_interval_us_) {
+ pcm_parameters.dataIntervalUs = data_interval_us;
+ is_codec_config_valid = IsPcmParametersSupported_2_1(pcm_parameters);
+ audio_config.pcmConfig(pcm_parameters);
+ auto hidl_retval = audio_provider_2_1_->startSession_2_1(
+ audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(tempDataMQ != nullptr && tempDataMQ->isValid());
+ }
+ EXPECT_TRUE(audio_provider_2_1_->endSession().isOk());
+ } // uint32_t (data interval in microseconds)
+ } // ChannelMode
+ } // BitsPerSampple
+ } // SampleRate
+}
+
+/**
+ * openProvider LE_AUDIO_SOFTWARE_DECODED_DATAPATH
+ */
+class BluetoothAudioProviderLeAudioInputSoftwareHidlTest
+ : public BluetoothAudioProvidersFactoryHidlTest {
+ public:
+ virtual void SetUp() override {
+ BluetoothAudioProvidersFactoryHidlTest::SetUp();
+ GetProviderCapabilitiesHelper_2_1(
+ android::hardware::bluetooth::audio::V2_1::SessionType::
+ LE_AUDIO_SOFTWARE_DECODED_DATAPATH);
+ OpenProviderHelper_2_1(android::hardware::bluetooth::audio::V2_1::
+ SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH);
+ ASSERT_NE(audio_provider_2_1_, nullptr);
+ }
+
+ virtual void TearDown() override {
+ audio_port_ = nullptr;
+ audio_provider_2_1_ = nullptr;
+ BluetoothAudioProvidersFactoryHidlTest::TearDown();
+ }
+
+ static constexpr SampleRate le_audio_output_sample_rates_[3] = {
+ SampleRate::RATE_UNKNOWN, SampleRate::RATE_16000, SampleRate::RATE_24000};
+ static constexpr BitsPerSample le_audio_output_bits_per_samples_[3] = {
+ BitsPerSample::BITS_UNKNOWN, BitsPerSample::BITS_16,
+ BitsPerSample::BITS_24};
+ static constexpr ChannelMode le_audio_output_channel_modes_[3] = {
+ ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
+ static constexpr uint32_t le_audio_output_data_interval_us_[2] = {
+ 0 /* Invalid */, 10000 /* Valid 10ms */};
+};
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH can be started and
+ * stopped
+ */
+TEST_P(BluetoothAudioProviderLeAudioInputSoftwareHidlTest,
+ OpenLeAudioInputSoftwareProvider) {}
+
+/**
+ * Test whether each provider of type
+ * SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH can be started and
+ * stopped with different PCM config
+ */
+TEST_P(BluetoothAudioProviderLeAudioInputSoftwareHidlTest,
+ StartAndEndLeAudioInputSessionWithPossiblePcmConfig) {
+ bool is_codec_config_valid;
+ std::unique_ptr<DataMQ> tempDataMQ;
+ auto hidl_cb = [&is_codec_config_valid, &tempDataMQ](
+ BluetoothAudioStatus status,
+ const DataMQ::Descriptor& dataMQ) {
+ if (is_codec_config_valid) {
+ ASSERT_EQ(status, BluetoothAudioStatus::SUCCESS);
+ ASSERT_TRUE(dataMQ.isHandleValid());
+ tempDataMQ.reset(new DataMQ(dataMQ));
+ } else {
+ EXPECT_EQ(status, BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION);
+ EXPECT_FALSE(dataMQ.isHandleValid());
+ }
+ };
+ android::hardware::bluetooth::audio::V2_1::AudioConfiguration audio_config =
+ {};
+ android::hardware::bluetooth::audio::V2_1::PcmParameters pcm_parameters = {};
+ for (auto sample_rate : le_audio_output_sample_rates_) {
+ pcm_parameters.sampleRate = sample_rate;
+ for (auto bits_per_sample : le_audio_output_bits_per_samples_) {
+ pcm_parameters.bitsPerSample = bits_per_sample;
+ for (auto channel_mode : le_audio_output_channel_modes_) {
+ pcm_parameters.channelMode = channel_mode;
+ for (auto data_interval_us : le_audio_output_data_interval_us_) {
+ pcm_parameters.dataIntervalUs = data_interval_us;
+ is_codec_config_valid = IsPcmParametersSupported_2_1(pcm_parameters);
+ audio_config.pcmConfig(pcm_parameters);
+ auto hidl_retval = audio_provider_2_1_->startSession_2_1(
+ audio_port_, audio_config, hidl_cb);
+ // HIDL calls should not be failed and callback has to be executed
+ ASSERT_TRUE(hidl_retval.isOk());
+ if (is_codec_config_valid) {
+ EXPECT_TRUE(tempDataMQ != nullptr && tempDataMQ->isValid());
+ } else {
+ EXPECT_TRUE(tempDataMQ == nullptr);
+ }
+ EXPECT_TRUE(audio_provider_2_1_->endSession().isOk());
+ } // uint32_t (data interval in microseconds)
+ } // ChannelMode
+ } // BitsPerSampple
+ } // SampleRate
+}
+
+static const std::vector<std::string> kAudioInstances =
+ android::hardware::getAllHalInstanceNames(
+ IBluetoothAudioProvidersFactory::descriptor);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProvidersFactoryHidlTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAudioProvidersFactoryHidlTest,
+ testing::ValuesIn(kAudioInstances),
+ android::hardware::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderA2dpSoftwareHidlTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderA2dpSoftwareHidlTest,
+ testing::ValuesIn(kAudioInstances),
+ android::hardware::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderA2dpHardwareHidlTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderA2dpHardwareHidlTest,
+ testing::ValuesIn(kAudioInstances),
+ android::hardware::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderHearingAidSoftwareHidlTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderHearingAidSoftwareHidlTest,
+ testing::ValuesIn(kAudioInstances),
+ android::hardware::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderLeAudioOutputSoftwareHidlTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderLeAudioOutputSoftwareHidlTest,
+ testing::ValuesIn(kAudioInstances),
+ android::hardware::PrintInstanceNameToString);
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(
+ BluetoothAudioProviderLeAudioInputSoftwareHidlTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance,
+ BluetoothAudioProviderLeAudioInputSoftwareHidlTest,
+ testing::ValuesIn(kAudioInstances),
+ android::hardware::PrintInstanceNameToString);
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
index 627ddf4..bbb21c7 100644
--- a/camera/provider/2.4/default/Android.bp
+++ b/camera/provider/2.4/default/Android.bp
@@ -76,7 +76,7 @@
header_libs: [
"camera.device@3.4-external-impl_headers",
"camera.device@3.5-external-impl_headers",
- "camera.device@3.6-external-impl_headers"
+ "camera.device@3.6-external-impl_headers",
],
export_include_dirs: ["."],
}
@@ -150,6 +150,7 @@
"android.hidl.memory@1.0",
"libbinder",
"libcamera_metadata",
+ "libcutils",
"libhardware",
"libhidlbase",
"liblog",
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index 4475f7d..84f4839 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -22,6 +22,8 @@
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
#include <binder/ProcessState.h>
+#include <cutils/memory.h>
+#include <cutils/properties.h>
#include <hidl/LegacySupport.h>
using android::status_t;
@@ -41,6 +43,12 @@
// The camera HAL may communicate to other vendor components via
// /dev/vndbinder
android::ProcessState::initWithDriver("/dev/vndbinder");
+
+ // b/166675194
+ if (property_get_bool("ro.vendor.camera.provider24.disable_mem_init", false)) {
+ process_disable_memory_mitigations();
+ }
+
status_t status;
if (kLazyService) {
status = defaultLazyPassthroughServiceImplementation<ICameraProvider>("legacy/0",
diff --git a/common/aidl/Android.bp b/common/aidl/Android.bp
index 9ea4cdf..8029efa 100644
--- a/common/aidl/Android.bp
+++ b/common/aidl/Android.bp
@@ -6,13 +6,14 @@
enabled: true,
support_system_process: true,
},
+ vndk_use_version: "2",
srcs: [
"android/hardware/common/*.aidl",
],
stability: "vintf",
backend: {
java: {
- enabled: false,
+ sdk_version: "module_current",
},
cpp: {
enabled: false,
diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp
new file mode 100644
index 0000000..004adab
--- /dev/null
+++ b/common/fmq/aidl/Android.bp
@@ -0,0 +1,21 @@
+aidl_interface {
+ name: "android.hardware.common.fmq",
+ host_supported: true,
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
+ srcs: [
+ "android/hardware/common/fmq/*.aidl",
+ ],
+ stability: "vintf",
+ backend: {
+ java: {
+ enabled: false,
+ },
+ cpp: {
+ enabled: false,
+ },
+ },
+}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/GrantorDescriptor.aidl
similarity index 96%
rename from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
rename to common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/GrantorDescriptor.aidl
index 07bceb0..7ac1930 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
+++ b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/GrantorDescriptor.aidl
@@ -15,7 +15,7 @@
// 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.common;
+package android.hardware.common.fmq;
@VintfStability
parcelable GrantorDescriptor {
int offset;
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/MQDescriptor.aidl
similarity index 91%
rename from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
rename to common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/MQDescriptor.aidl
index c9fe1d7..2607369 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
+++ b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/MQDescriptor.aidl
@@ -15,10 +15,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.common;
+package android.hardware.common.fmq;
@VintfStability
parcelable MQDescriptor {
- android.hardware.common.GrantorDescriptor[] grantors;
+ android.hardware.common.fmq.GrantorDescriptor[] grantors;
ParcelFileDescriptor fileDescriptor;
int quantum;
int flags;
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/SynchronizedReadWrite.aidl b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/SynchronizedReadWrite.aidl
similarity index 96%
rename from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/SynchronizedReadWrite.aidl
rename to common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/SynchronizedReadWrite.aidl
index aec3d6d..2142bdb 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/SynchronizedReadWrite.aidl
+++ b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/SynchronizedReadWrite.aidl
@@ -15,7 +15,7 @@
// 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.common;
+package android.hardware.common.fmq;
@VintfStability
enum SynchronizedReadWrite {
EMPTY = 0,
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/UnsynchronizedWrite.aidl b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/UnsynchronizedWrite.aidl
similarity index 96%
rename from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/UnsynchronizedWrite.aidl
rename to common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/UnsynchronizedWrite.aidl
index e390d20..1220674 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/UnsynchronizedWrite.aidl
+++ b/common/fmq/aidl/aidl_api/android.hardware.common.fmq/current/android/hardware/common/fmq/UnsynchronizedWrite.aidl
@@ -15,7 +15,7 @@
// 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.common;
+package android.hardware.common.fmq;
@VintfStability
enum UnsynchronizedWrite {
EMPTY = 0,
diff --git a/common/aidl/android/hardware/common/GrantorDescriptor.aidl b/common/fmq/aidl/android/hardware/common/fmq/GrantorDescriptor.aidl
similarity index 95%
rename from common/aidl/android/hardware/common/GrantorDescriptor.aidl
rename to common/fmq/aidl/android/hardware/common/fmq/GrantorDescriptor.aidl
index 3552e9e..ca69d94 100644
--- a/common/aidl/android/hardware/common/GrantorDescriptor.aidl
+++ b/common/fmq/aidl/android/hardware/common/fmq/GrantorDescriptor.aidl
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.hardware.common;
+package android.hardware.common.fmq;
/*
* Included in MQDescriptor, for use with libfmq.
diff --git a/common/aidl/android/hardware/common/MQDescriptor.aidl b/common/fmq/aidl/android/hardware/common/fmq/MQDescriptor.aidl
similarity index 94%
rename from common/aidl/android/hardware/common/MQDescriptor.aidl
rename to common/fmq/aidl/android/hardware/common/fmq/MQDescriptor.aidl
index 7e89b15..82917d6 100644
--- a/common/aidl/android/hardware/common/MQDescriptor.aidl
+++ b/common/fmq/aidl/android/hardware/common/fmq/MQDescriptor.aidl
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package android.hardware.common;
+package android.hardware.common.fmq;
-import android.hardware.common.GrantorDescriptor;
+import android.hardware.common.fmq.GrantorDescriptor;
/*
* For use with libfmq. This is created from an instance of AidlMessageQueue,
diff --git a/common/aidl/android/hardware/common/SynchronizedReadWrite.aidl b/common/fmq/aidl/android/hardware/common/fmq/SynchronizedReadWrite.aidl
similarity index 95%
rename from common/aidl/android/hardware/common/SynchronizedReadWrite.aidl
rename to common/fmq/aidl/android/hardware/common/fmq/SynchronizedReadWrite.aidl
index ef93bf2..8c33442 100644
--- a/common/aidl/android/hardware/common/SynchronizedReadWrite.aidl
+++ b/common/fmq/aidl/android/hardware/common/fmq/SynchronizedReadWrite.aidl
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.hardware.common;
+package android.hardware.common.fmq;
/*
* For use with android.hardware.common.MQDescriptor to specify which type of
diff --git a/common/aidl/android/hardware/common/UnsynchronizedWrite.aidl b/common/fmq/aidl/android/hardware/common/fmq/UnsynchronizedWrite.aidl
similarity index 95%
rename from common/aidl/android/hardware/common/UnsynchronizedWrite.aidl
rename to common/fmq/aidl/android/hardware/common/fmq/UnsynchronizedWrite.aidl
index aa27c8d..24c4cce 100644
--- a/common/aidl/android/hardware/common/UnsynchronizedWrite.aidl
+++ b/common/fmq/aidl/android/hardware/common/fmq/UnsynchronizedWrite.aidl
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.hardware.common;
+package android.hardware.common.fmq;
/*
* For use with android.hardware.common.MQDescriptor to specify which type of
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index d22aa68..b2a815f 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -13,46 +13,6 @@
// limitations under the License.
vintf_compatibility_matrix {
- name: "framework_compatibility_matrix.legacy.xml",
- stem: "compatibility_matrix.legacy.xml",
- srcs: [
- "compatibility_matrix.legacy.xml",
- ],
- kernel_configs: [
- // legacy uses O kernel requirements
- "kernel_config_o_3.18",
- "kernel_config_o_4.4",
- "kernel_config_o_4.9",
- ],
-}
-
-vintf_compatibility_matrix {
- name: "framework_compatibility_matrix.1.xml",
- stem: "compatibility_matrix.1.xml",
- srcs: [
- "compatibility_matrix.1.xml",
- ],
- kernel_configs: [
- "kernel_config_o_3.18",
- "kernel_config_o_4.4",
- "kernel_config_o_4.9",
- ],
-}
-
-vintf_compatibility_matrix {
- name: "framework_compatibility_matrix.2.xml",
- stem: "compatibility_matrix.2.xml",
- srcs: [
- "compatibility_matrix.2.xml",
- ],
- kernel_configs: [
- "kernel_config_o_mr1_3.18",
- "kernel_config_o_mr1_4.4",
- "kernel_config_o_mr1_4.9",
- ],
-}
-
-vintf_compatibility_matrix {
name: "framework_compatibility_matrix.3.xml",
stem: "compatibility_matrix.3.xml",
srcs: [
diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk
index b88d40b..3951666 100644
--- a/compatibility_matrices/Android.mk
+++ b/compatibility_matrices/Android.mk
@@ -92,9 +92,6 @@
endif # DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
my_system_matrix_deps := \
- framework_compatibility_matrix.legacy.xml \
- framework_compatibility_matrix.1.xml \
- framework_compatibility_matrix.2.xml \
framework_compatibility_matrix.3.xml \
framework_compatibility_matrix.4.xml \
framework_compatibility_matrix.5.xml \
diff --git a/compatibility_matrices/CleanSpec.mk b/compatibility_matrices/CleanSpec.mk
index 9b150ed..5b351a5 100644
--- a/compatibility_matrices/CleanSpec.mk
+++ b/compatibility_matrices/CleanSpec.mk
@@ -45,3 +45,6 @@
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vintf/compatibility_matrix.device.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vintf/compatibility_matrix.legacy.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vintf/compatibility_matrix.1.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/vintf/compatibility_matrix.2.xml)
diff --git a/compatibility_matrices/compatibility_matrix.1.xml b/compatibility_matrices/compatibility_matrix.1.xml
deleted file mode 100644
index cccf24f..0000000
--- a/compatibility_matrices/compatibility_matrix.1.xml
+++ /dev/null
@@ -1,326 +0,0 @@
-<compatibility-matrix version="1.0" type="framework" level="1">
- <hal format="hidl" optional="false">
- <name>android.hardware.audio</name>
- <version>2.0</version>
- <interface>
- <name>IDevicesFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.audio.effect</name>
- <version>2.0</version>
- <interface>
- <name>IEffectsFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.evs</name>
- <version>1.0</version>
- <interface>
- <name>IEvsEnumerator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.vehicle</name>
- <version>2.0</version>
- <interface>
- <name>IVehicle</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.biometrics.fingerprint</name>
- <version>2.1</version>
- <interface>
- <name>IBiometricsFingerprint</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.bluetooth</name>
- <version>1.0</version>
- <interface>
- <name>IBluetoothHci</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.boot</name>
- <version>1.0</version>
- <interface>
- <name>IBootControl</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.broadcastradio</name>
- <version>1.0</version>
- <interface>
- <name>IBroadcastRadioFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.camera.provider</name>
- <version>2.4</version>
- <interface>
- <name>ICameraProvider</name>
- <instance>legacy/0</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.configstore</name>
- <version>1.0</version>
- <interface>
- <name>ISurfaceFlingerConfigs</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.contexthub</name>
- <version>1.0</version>
- <interface>
- <name>IContexthub</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.drm</name>
- <version>1.0</version>
- <interface>
- <name>ICryptoFactory</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDrmFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.dumpstate</name>
- <version>1.0</version>
- <interface>
- <name>IDumpstateDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.gatekeeper</name>
- <version>1.0</version>
- <interface>
- <name>IGatekeeper</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.gnss</name>
- <version>1.0</version>
- <interface>
- <name>IGnss</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.allocator</name>
- <version>2.0</version>
- <interface>
- <name>IAllocator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.composer</name>
- <version>2.1</version>
- <interface>
- <name>IComposer</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.mapper</name>
- <version>2.0</version>
- <interface>
- <name>IMapper</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.health</name>
- <version>1.0</version>
- <interface>
- <name>IHealth</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.ir</name>
- <version>1.0</version>
- <interface>
- <name>IConsumerIr</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.keymaster</name>
- <version>3.0</version>
- <interface>
- <name>IKeymasterDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.light</name>
- <version>2.0</version>
- <interface>
- <name>ILight</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.media.omx</name>
- <version>1.0</version>
- <interface>
- <name>IOmx</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IOmxStore</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.memtrack</name>
- <version>1.0</version>
- <interface>
- <name>IMemtrack</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.nfc</name>
- <version>1.0</version>
- <interface>
- <name>INfc</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.power</name>
- <version>1.0</version>
- <interface>
- <name>IPower</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.radio</name>
- <version>1.0</version>
- <interface>
- <name>IRadio</name>
- <instance>slot1</instance>
- </interface>
- <interface>
- <name>ISap</name>
- <instance>slot1</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.radio.deprecated</name>
- <version>1.0</version>
- <interface>
- <name>IOemHook</name>
- <instance>slot1</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.renderscript</name>
- <version>1.0</version>
- <interface>
- <name>IDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.sensors</name>
- <version>1.0</version>
- <interface>
- <name>ISensors</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.soundtrigger</name>
- <version>2.0</version>
- <interface>
- <name>ISoundTriggerHw</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.thermal</name>
- <version>1.0</version>
- <interface>
- <name>IThermal</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tv.cec</name>
- <version>1.0</version>
- <interface>
- <name>IHdmiCec</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tv.input</name>
- <version>1.0</version>
- <interface>
- <name>ITvInput</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.usb</name>
- <version>1.0</version>
- <interface>
- <name>IUsb</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.vibrator</name>
- <version>1.0</version>
- <interface>
- <name>IVibrator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.vr</name>
- <version>1.0</version>
- <interface>
- <name>IVr</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi</name>
- <version>1.0</version>
- <interface>
- <name>IWifi</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.supplicant</name>
- <version>1.0</version>
- <interface>
- <name>ISupplicant</name>
- <instance>default</instance>
- </interface>
- </hal>
-</compatibility-matrix>
diff --git a/compatibility_matrices/compatibility_matrix.2.xml b/compatibility_matrices/compatibility_matrix.2.xml
deleted file mode 100644
index d4f9809..0000000
--- a/compatibility_matrices/compatibility_matrix.2.xml
+++ /dev/null
@@ -1,374 +0,0 @@
-<compatibility-matrix version="1.0" type="framework" level="2">
- <hal format="hidl" optional="false">
- <name>android.hardware.audio</name>
- <version>2.0</version>
- <interface>
- <name>IDevicesFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.audio.effect</name>
- <version>2.0</version>
- <interface>
- <name>IEffectsFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.evs</name>
- <version>1.0</version>
- <interface>
- <name>IEvsEnumerator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.vehicle</name>
- <version>2.0</version>
- <interface>
- <name>IVehicle</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.biometrics.fingerprint</name>
- <version>2.1</version>
- <interface>
- <name>IBiometricsFingerprint</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.bluetooth</name>
- <version>1.0</version>
- <interface>
- <name>IBluetoothHci</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.boot</name>
- <version>1.0</version>
- <interface>
- <name>IBootControl</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.broadcastradio</name>
- <version>1.0-1</version>
- <interface>
- <name>IBroadcastRadioFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.camera.provider</name>
- <version>2.4</version>
- <interface>
- <name>ICameraProvider</name>
- <instance>legacy/0</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.cas</name>
- <version>1.0</version>
- <interface>
- <name>IMediaCasService</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.configstore</name>
- <version>1.0</version>
- <interface>
- <name>ISurfaceFlingerConfigs</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.contexthub</name>
- <version>1.0</version>
- <interface>
- <name>IContexthub</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.drm</name>
- <version>1.0</version>
- <interface>
- <name>ICryptoFactory</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDrmFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.dumpstate</name>
- <version>1.0</version>
- <interface>
- <name>IDumpstateDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.gatekeeper</name>
- <version>1.0</version>
- <interface>
- <name>IGatekeeper</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.gnss</name>
- <version>1.0</version>
- <interface>
- <name>IGnss</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.allocator</name>
- <version>2.0</version>
- <interface>
- <name>IAllocator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.composer</name>
- <version>2.1</version>
- <interface>
- <name>IComposer</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.mapper</name>
- <version>2.0</version>
- <interface>
- <name>IMapper</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.health</name>
- <version>1.0</version>
- <interface>
- <name>IHealth</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.ir</name>
- <version>1.0</version>
- <interface>
- <name>IConsumerIr</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.keymaster</name>
- <version>3.0</version>
- <interface>
- <name>IKeymasterDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.light</name>
- <version>2.0</version>
- <interface>
- <name>ILight</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.media.omx</name>
- <version>1.0</version>
- <interface>
- <name>IOmx</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IOmxStore</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.memtrack</name>
- <version>1.0</version>
- <interface>
- <name>IMemtrack</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.nfc</name>
- <version>1.0</version>
- <interface>
- <name>INfc</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.oemlock</name>
- <version>1.0</version>
- <interface>
- <name>IOemLock</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.power</name>
- <version>1.0-1</version>
- <interface>
- <name>IPower</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.radio</name>
- <version>1.0-1</version>
- <interface>
- <name>IRadio</name>
- <instance>slot1</instance>
- </interface>
- <interface>
- <name>ISap</name>
- <instance>slot1</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.radio.deprecated</name>
- <version>1.0</version>
- <interface>
- <name>IOemHook</name>
- <instance>slot1</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.renderscript</name>
- <version>1.0</version>
- <interface>
- <name>IDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.sensors</name>
- <version>1.0</version>
- <interface>
- <name>ISensors</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.soundtrigger</name>
- <version>2.0</version>
- <interface>
- <name>ISoundTriggerHw</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tetheroffload.config</name>
- <version>1.0</version>
- <interface>
- <name>IOffloadConfig</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tetheroffload.control</name>
- <version>1.0</version>
- <interface>
- <name>IOffloadControl</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.thermal</name>
- <version>1.0-1</version>
- <interface>
- <name>IThermal</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tv.cec</name>
- <version>1.0</version>
- <interface>
- <name>IHdmiCec</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tv.input</name>
- <version>1.0</version>
- <interface>
- <name>ITvInput</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.usb</name>
- <version>1.0-1</version>
- <interface>
- <name>IUsb</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.vibrator</name>
- <version>1.0-1</version>
- <interface>
- <name>IVibrator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.vr</name>
- <version>1.0</version>
- <interface>
- <name>IVr</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.weaver</name>
- <version>1.0</version>
- <interface>
- <name>IWeaver</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi</name>
- <version>1.0-1</version>
- <interface>
- <name>IWifi</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.offload</name>
- <version>1.0</version>
- <interface>
- <name>IOffload</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.supplicant</name>
- <version>1.0</version>
- <interface>
- <name>ISupplicant</name>
- <instance>default</instance>
- </interface>
- </hal>
-</compatibility-matrix>
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index dc0051c..d1d254b 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -96,6 +96,13 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true">
+ <name>android.hardware.biometrics.face</name>
+ <interface>
+ <name>IFace</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="true">
<name>android.hardware.biometrics.fingerprint</name>
<version>2.1-3</version>
@@ -121,7 +128,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.bluetooth.audio</name>
- <version>2.0</version>
+ <version>2.0-1</version>
<interface>
<name>IBluetoothAudioProvidersFactory</name>
<instance>default</instance>
diff --git a/compatibility_matrices/compatibility_matrix.legacy.xml b/compatibility_matrices/compatibility_matrix.legacy.xml
deleted file mode 100644
index 8a4d2ee..0000000
--- a/compatibility_matrices/compatibility_matrix.legacy.xml
+++ /dev/null
@@ -1,326 +0,0 @@
-<compatibility-matrix version="1.0" type="framework" level="legacy">
- <hal format="hidl" optional="false">
- <name>android.hardware.audio</name>
- <version>2.0</version>
- <interface>
- <name>IDevicesFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.audio.effect</name>
- <version>2.0</version>
- <interface>
- <name>IEffectsFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.evs</name>
- <version>1.0</version>
- <interface>
- <name>IEvsEnumerator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.vehicle</name>
- <version>2.0</version>
- <interface>
- <name>IVehicle</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.biometrics.fingerprint</name>
- <version>2.1</version>
- <interface>
- <name>IBiometricsFingerprint</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.bluetooth</name>
- <version>1.0</version>
- <interface>
- <name>IBluetoothHci</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.boot</name>
- <version>1.0</version>
- <interface>
- <name>IBootControl</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.broadcastradio</name>
- <version>1.0</version>
- <interface>
- <name>IBroadcastRadioFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.camera.provider</name>
- <version>2.4</version>
- <interface>
- <name>ICameraProvider</name>
- <instance>legacy/0</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.configstore</name>
- <version>1.0</version>
- <interface>
- <name>ISurfaceFlingerConfigs</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.contexthub</name>
- <version>1.0</version>
- <interface>
- <name>IContexthub</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.drm</name>
- <version>1.0</version>
- <interface>
- <name>ICryptoFactory</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDrmFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.dumpstate</name>
- <version>1.0</version>
- <interface>
- <name>IDumpstateDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.gatekeeper</name>
- <version>1.0</version>
- <interface>
- <name>IGatekeeper</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.gnss</name>
- <version>1.0</version>
- <interface>
- <name>IGnss</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.allocator</name>
- <version>2.0</version>
- <interface>
- <name>IAllocator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.composer</name>
- <version>2.1</version>
- <interface>
- <name>IComposer</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.graphics.mapper</name>
- <version>2.0</version>
- <interface>
- <name>IMapper</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.health</name>
- <version>1.0</version>
- <interface>
- <name>IHealth</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.ir</name>
- <version>1.0</version>
- <interface>
- <name>IConsumerIr</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.keymaster</name>
- <version>3.0</version>
- <interface>
- <name>IKeymasterDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.light</name>
- <version>2.0</version>
- <interface>
- <name>ILight</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="false">
- <name>android.hardware.media.omx</name>
- <version>1.0</version>
- <interface>
- <name>IOmx</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IOmxStore</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.memtrack</name>
- <version>1.0</version>
- <interface>
- <name>IMemtrack</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.nfc</name>
- <version>1.0</version>
- <interface>
- <name>INfc</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.power</name>
- <version>1.0</version>
- <interface>
- <name>IPower</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.radio</name>
- <version>1.0</version>
- <interface>
- <name>IRadio</name>
- <instance>slot1</instance>
- </interface>
- <interface>
- <name>ISap</name>
- <instance>slot1</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.radio.deprecated</name>
- <version>1.0</version>
- <interface>
- <name>IOemHook</name>
- <instance>slot1</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.renderscript</name>
- <version>1.0</version>
- <interface>
- <name>IDevice</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.sensors</name>
- <version>1.0</version>
- <interface>
- <name>ISensors</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.soundtrigger</name>
- <version>2.0</version>
- <interface>
- <name>ISoundTriggerHw</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.thermal</name>
- <version>1.0</version>
- <interface>
- <name>IThermal</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tv.cec</name>
- <version>1.0</version>
- <interface>
- <name>IHdmiCec</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tv.input</name>
- <version>1.0</version>
- <interface>
- <name>ITvInput</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.usb</name>
- <version>1.0</version>
- <interface>
- <name>IUsb</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.vibrator</name>
- <version>1.0</version>
- <interface>
- <name>IVibrator</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.vr</name>
- <version>1.0</version>
- <interface>
- <name>IVr</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi</name>
- <version>1.0</version>
- <interface>
- <name>IWifi</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.wifi.supplicant</name>
- <version>1.0</version>
- <interface>
- <name>ISupplicant</name>
- <instance>default</instance>
- </interface>
- </hal>
-</compatibility-matrix>
diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp
index 8ec37a1..6725a98 100644
--- a/compatibility_matrices/exclude/fcm_exclude.cpp
+++ b/compatibility_matrices/exclude/fcm_exclude.cpp
@@ -53,6 +53,7 @@
// AIDL
"android.hardware.biometrics.common",
"android.hardware.common",
+ "android.hardware.common.fmq",
"android.hardware.graphics.common",
"android.hardware.keymaster",
@@ -60,6 +61,18 @@
// does not depend on this HAL, hence it is not declared in any manifests or matrices.
"android.hardware.fastboot@1.0",
"android.hardware.fastboot@1.1",
+
+ // Deprecated HALs.
+ // HIDL
+ // TODO(b/171260360) Remove when HAL definition is removed
+ "android.hardware.audio.effect@2.0",
+ "android.hardware.audio@2.0",
+ // TODO(b/171260613) Remove when HAL definition is removed
+ "android.hardware.health@1.0",
+ // TODO(b/171260670) Remove when HAL definition is removed
+ "android.hardware.nfc@1.0",
+ // TODO(b/171260715) Remove when HAL definition is removed
+ "android.hardware.radio.deprecated@1.0",
};
auto package_has_prefix = [&](const std::string& prefix) {
diff --git a/contexthub/1.0/vts/functional/OWNERS b/contexthub/1.0/vts/functional/OWNERS
index 161b2f0..1a33a9e 100644
--- a/contexthub/1.0/vts/functional/OWNERS
+++ b/contexthub/1.0/vts/functional/OWNERS
@@ -5,4 +5,3 @@
#VTS team
dshi@google.com
-trong@google.com
diff --git a/contexthub/1.1/vts/functional/OWNERS b/contexthub/1.1/vts/functional/OWNERS
index 161b2f0..1a33a9e 100644
--- a/contexthub/1.1/vts/functional/OWNERS
+++ b/contexthub/1.1/vts/functional/OWNERS
@@ -5,4 +5,3 @@
#VTS team
dshi@google.com
-trong@google.com
diff --git a/contexthub/1.2/vts/functional/OWNERS b/contexthub/1.2/vts/functional/OWNERS
index 161b2f0..1a33a9e 100644
--- a/contexthub/1.2/vts/functional/OWNERS
+++ b/contexthub/1.2/vts/functional/OWNERS
@@ -5,4 +5,3 @@
#VTS team
dshi@google.com
-trong@google.com
diff --git a/current.txt b/current.txt
index 9f03b7f..d8ca42c 100644
--- a/current.txt
+++ b/current.txt
@@ -780,7 +780,3 @@
# NOTE: new HALs are recommended to be in AIDL
6e64b33f1b720b66b0deb5e08dee37a99deaa94e2e9ebf7806703cabab56e21d android.hardware.contexthub@1.2::IContexthub
3fb83f4539cab2c7bf9fdbecf7265d1c1dd6e8de9694046fe512b493c127ccea android.hardware.contexthub@1.2::types
-57d183b10b13ec0a8e542c0b3d61991ae541c60e85dbbc5499bb21dfd068cbb8 android.hardware.wifi.supplicant@1.4::types
-17818b6b1952a75e4364ae82c534b9d2f5c0a9765a56256b16faa5a5cf45d3a8 android.hardware.wifi.supplicant@1.4::ISupplicant
-8342b5f6ec8f48ad2b741128aede010995d0b5709257b7ec09bb469b4f61ef1a android.hardware.wifi.supplicant@1.4::ISupplicantStaIface
-6f969b191f0b699ceab0573548f1ac505853e56e704711edc51b51976d4f87ad android.hardware.wifi.supplicant@1.4::ISupplicantStaNetwork
diff --git a/gnss/1.1/default/GnssDebug.cpp b/gnss/1.1/default/GnssDebug.cpp
index 471ed24..252f4e6 100644
--- a/gnss/1.1/default/GnssDebug.cpp
+++ b/gnss/1.1/default/GnssDebug.cpp
@@ -20,6 +20,7 @@
#include "Constants.h"
#include "GnssDebug.h"
+#include "MockLocation.h"
using namespace ::android::hardware::gnss::common;
@@ -32,17 +33,17 @@
// Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
Return<void> GnssDebug::getDebugData(V1_0::IGnssDebug::getDebugData_cb _hidl_cb) {
PositionDebug positionDebug = {
- .valid = true,
- .latitudeDegrees = kMockLatitudeDegrees,
- .longitudeDegrees = kMockLongitudeDegrees,
- .altitudeMeters = kMockAltitudeMeters,
- .speedMetersPerSec = kMockSpeedMetersPerSec,
- .bearingDegrees = kMockBearingDegrees,
- .horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
- .verticalAccuracyMeters = kMockVerticalAccuracyMeters,
- .speedAccuracyMetersPerSecond = kMockSpeedAccuracyMetersPerSecond,
- .bearingAccuracyDegrees = kMockBearingAccuracyDegrees,
- .ageSeconds = 0.99};
+ .valid = true,
+ .latitudeDegrees = gMockLatitudeDegrees,
+ .longitudeDegrees = gMockLongitudeDegrees,
+ .altitudeMeters = gMockAltitudeMeters,
+ .speedMetersPerSec = kMockSpeedMetersPerSec,
+ .bearingDegrees = kMockBearingDegrees,
+ .horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
+ .verticalAccuracyMeters = kMockVerticalAccuracyMeters,
+ .speedAccuracyMetersPerSecond = kMockSpeedAccuracyMetersPerSecond,
+ .bearingAccuracyDegrees = kMockBearingAccuracyDegrees,
+ .ageSeconds = 0.99};
TimeDebug timeDebug = {.timeEstimate = kMockTimestamp,
.timeUncertaintyNs = 1000,
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl
similarity index 87%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
copy to gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl
index 07bceb0..89f5d53 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl
@@ -15,9 +15,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.common;
+package android.hardware.gnss;
@VintfStability
-parcelable GrantorDescriptor {
- int offset;
- long extent;
+parcelable BlocklistedSource {
+ android.hardware.gnss.GnssConstellationType constellation;
+ int svid;
}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssConstellationType.aidl
similarity index 82%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
copy to gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssConstellationType.aidl
index c9fe1d7..30d0227 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/MQDescriptor.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssConstellationType.aidl
@@ -15,11 +15,15 @@
// 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.common;
-@VintfStability
-parcelable MQDescriptor {
- android.hardware.common.GrantorDescriptor[] grantors;
- ParcelFileDescriptor fileDescriptor;
- int quantum;
- int flags;
+package android.hardware.gnss;
+@Backing(type="int") @VintfStability
+enum GnssConstellationType {
+ UNKNOWN = 0,
+ GPS = 1,
+ SBAS = 2,
+ GLONASS = 3,
+ QZSS = 4,
+ BEIDOU = 5,
+ GALILEO = 6,
+ IRNSS = 7,
}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
index 33377ca..146577e 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
@@ -18,5 +18,9 @@
package android.hardware.gnss;
@VintfStability
interface IGnss {
+ void setCallback(in android.hardware.gnss.IGnssCallback callback);
+ void close();
android.hardware.gnss.IGnssPsds getExtensionPsds();
+ android.hardware.gnss.IGnssConfiguration getExtensionGnssConfiguration();
+ const int ERROR_INVALID_ARGUMENT = 1;
}
diff --git a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
similarity index 86%
copy from common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
copy to gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
index 07bceb0..62870d6 100644
--- a/common/aidl/aidl_api/android.hardware.common/current/android/hardware/common/GrantorDescriptor.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
@@ -15,9 +15,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.common;
+package android.hardware.gnss;
@VintfStability
-parcelable GrantorDescriptor {
- int offset;
- long extent;
+interface IGnssCallback {
+ void gnssSetCapabilitiesCb(in int capabilities);
+ const int CAPABILITY_SATELLITE_BLOCKLIST = 1;
}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl
new file mode 100644
index 0000000..5af30cf
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl
@@ -0,0 +1,35 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+interface IGnssConfiguration {
+ void setSuplVersion(in int version);
+ void setSuplMode(in int mode);
+ void setLppProfile(in int lppProfile);
+ void setGlonassPositioningProtocol(in int protocol);
+ void setEmergencySuplPdn(in boolean enable);
+ void setEsExtensionSec(in int emergencyExtensionSeconds);
+ void setBlocklist(in android.hardware.gnss.BlocklistedSource[] blocklist);
+ const int SUPL_MODE_MSB = 1;
+ const int SUPL_MODE_MSA = 2;
+ const int LPP_PROFILE_USER_PLANE = 1;
+ const int LPP_PROFILE_CONTROL_PLANE = 2;
+ const int GLONASS_POS_PROTOCOL_RRC_CPLANE = 1;
+ const int GLONASS_POS_PROTOCOL_RRLP_UPLANE = 2;
+ const int GLONASS_POS_PROTOCOL_LPP_UPLANE = 4;
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl
index 352a694..ddef928 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl
@@ -18,6 +18,6 @@
package android.hardware.gnss;
@VintfStability
interface IGnssPsds {
- boolean injectPsdsData(in android.hardware.gnss.PsdsType psdsType, in byte[] psdsData);
- boolean setCallback(in android.hardware.gnss.IGnssPsdsCallback callback);
+ void injectPsdsData(in android.hardware.gnss.PsdsType psdsType, in byte[] psdsData);
+ void setCallback(in android.hardware.gnss.IGnssPsdsCallback callback);
}
diff --git a/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl
new file mode 100644
index 0000000..2fde5b2
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.GnssConstellationType;
+
+/**
+ * Represents a blocklisted source.
+ */
+@VintfStability
+parcelable BlocklistedSource {
+ /**
+ * Defines the constellation of the given satellite(s).
+ */
+ GnssConstellationType constellation;
+
+ /**
+ * Satellite (space vehicle) ID number, as defined in GnssSvInfo::svid, or 0 to blocklist all
+ * svid's for the specified constellation.
+ */
+ int svid;
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/GnssConstellationType.aidl b/gnss/aidl/android/hardware/gnss/GnssConstellationType.aidl
new file mode 100644
index 0000000..af3e089
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/GnssConstellationType.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+/**
+ * GNSS constellation type
+ *
+ * This is to specify the navigation satellite system, for example, as listed in Section 3.5 in
+ * RINEX Version 3.04.
+ */
+@VintfStability
+@Backing(type="int")
+enum GnssConstellationType {
+ UNKNOWN = 0,
+ /** Global Positioning System. */
+ GPS = 1,
+ /** Satellite-Based Augmentation System. */
+ SBAS = 2,
+ /** Global Navigation Satellite System. */
+ GLONASS = 3,
+ /** Quasi-Zenith Satellite System. */
+ QZSS = 4,
+ /** BeiDou Navigation Satellite System. */
+ BEIDOU = 5,
+ /** Galileo Navigation Satellite System. */
+ GALILEO = 6,
+ /** Indian Regional Navigation Satellite System. */
+ IRNSS = 7,
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 1da254c..24632aa 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -16,7 +16,9 @@
package android.hardware.gnss;
+import android.hardware.gnss.IGnssCallback;
import android.hardware.gnss.IGnssPsds;
+import android.hardware.gnss.IGnssConfiguration;
/**
* Represents the standard GNSS (Global Navigation Satellite System) interface.
@@ -25,9 +27,52 @@
interface IGnss {
/**
+ * All GNSS Binder calls may return a ServiceSpecificException with the following error
+ * codes.
+ */
+ const int ERROR_INVALID_ARGUMENT = 1;
+
+ /**
+ * Opens the interface and provides the callback routines to the implementation of this
+ * interface.
+ *
+ * The framework calls this method to instruct the GPS engine to prepare for serving requests
+ * from the framework. The GNSS HAL implementation must respond to all GNSS requests from the
+ * framework upon successful return from this method until cleanup() method is called to
+ * close this interface.
+ *
+ * @param callback Callback interface for IGnss.
+ */
+ void setCallback(in IGnssCallback callback);
+
+ /**
+ * Closes the interface.
+ *
+ * The close() method is called by the framework to tell the GNSS HAL implementation to
+ * clear the callback and not expect any GNSS requests in the immediate future - e.g. this may
+ * be called when location is disabled by a user setting or low battery conditions. The GNSS HAL
+ * implementation must immediately stop responding to any existing requests until the
+ * setCallback() method is called again and the requests are re-initiated by the framework.
+ *
+ * After this method is called, the GNSS HAL implementation may choose to modify GNSS hardware
+ * states to save power. It is expected that when setCallback() method is called again to
+ * reopen this interface, to serve requests, there may be some minor delays in GNSS response
+ * requests as hardware readiness states are restored, not to exceed those that occur on normal
+ * device boot up.
+ */
+ void close();
+
+ /**
* This method returns the IGnssPsds interface.
*
* @return Handle to the IGnssPsds interface.
*/
IGnssPsds getExtensionPsds();
+
+ /**
+ * This method returns the IGnssConfiguration interface.
+ *
+ * @return Handle to the IGnssConfiguration interface.
+ */
+ IGnssConfiguration getExtensionGnssConfiguration();
}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
new file mode 100644
index 0000000..a46a018
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.IGnssPsds;
+import android.hardware.gnss.IGnssConfiguration;
+
+/**
+ * This interface is required for the HAL to communicate certain information
+ * like status and location info back to the framework, the framework implements
+ * the interfaces and passes a handle to the HAL.
+ */
+@VintfStability
+interface IGnssCallback {
+
+ /** Capability bit mask indicating GNSS supports blocklisting satellites */
+ const int CAPABILITY_SATELLITE_BLOCKLIST = 1 << 0;
+
+ /**
+ * Callback to inform framework of the GNSS HAL implementation's capabilities.
+ *
+ * @param capabilities Capability parameter is a bit field of the Capability bit masks.
+ */
+ void gnssSetCapabilitiesCb(in int capabilities);
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/IGnssConfiguration.aidl b/gnss/aidl/android/hardware/gnss/IGnssConfiguration.aidl
new file mode 100644
index 0000000..e0ad357
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IGnssConfiguration.aidl
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss;
+
+import android.hardware.gnss.BlocklistedSource;
+
+/**
+ * Extended interface for GNSS Configuration support.
+ */
+@VintfStability
+interface IGnssConfiguration {
+
+ /** SUPL mode bitmask for Mobile Station Based. */
+ const int SUPL_MODE_MSB = 0x01;
+
+ /** SUPL mode bitmask for Mobile Station Assisted. */
+ const int SUPL_MODE_MSA = 0x02;
+
+ /** LPP profile settings bitmask for enabling LTE Positioning Protocol User Plane. */
+ const int LPP_PROFILE_USER_PLANE = 0x01;
+
+ /** LPP profile settings bitmask for enabling LTE Positioning Protocol Control Plane. */
+ const int LPP_PROFILE_CONTROL_PLANE = 0x02;
+
+ /** A-Glonass positioning protocol bitmask for Radio Resource Control (RRC) Control Plane. */
+ const int GLONASS_POS_PROTOCOL_RRC_CPLANE = 0x01;
+
+ /** A-Glonass positioning protocol bitmask for Radio Resource Location User Plane. */
+ const int GLONASS_POS_PROTOCOL_RRLP_UPLANE = 0x02;
+
+ /** A-Glonass positioning protocol bitmask for LTE Positioning Protocol User Plane. */
+ const int GLONASS_POS_PROTOCOL_LPP_UPLANE = 0x04;
+
+ /**
+ * This method sets the SUPL version requested by Carrier. The GNSS HAL must use this version
+ * of the SUPL protocol if supported.
+ *
+ * @param version SUPL version requested by carrier. This is a bit mask with bits 0:7
+ * representing a service indicator field, bits 8:15 representing the minor version and bits
+ * 16:23 representing the major version.
+ */
+ void setSuplVersion(in int version);
+
+ /**
+ * This method sets the SUPL mode.
+ *
+ * @param mode Bitmask that specifies the SUPL mode which is set with the SUPL_MODE_* constants.
+ */
+ void setSuplMode(in int mode);
+
+ /**
+ * This method sets the LTE Positioning Profile configuration.
+ *
+ * @param lppProfile Bitmask that specifies the LTE Positioning Profile configuration to be set
+ * as per the LPP_PROFILE_* constants. If none of the bits are set, the default setting is
+ * Radio Resource Location Protocol (RRLP).
+ */
+ void setLppProfile(in int lppProfile);
+
+ /**
+ * This method selects positioning protocol on A-Glonass system.
+ *
+ * @param protocol Bitmask that specifies the positioning protocol to be set as per
+ * GLONASS_POS_PROTOCOL_* constants.
+ */
+ void setGlonassPositioningProtocol(in int protocol);
+
+ /**
+ * This method configures which PDN to use.
+ *
+ * @param enable Use emergency PDN if true and regular PDN if false.
+ */
+ void setEmergencySuplPdn(in boolean enable);
+
+ /**
+ * This method sets the emergency session extension duration. The GNSS HAL
+ * implementation must serve emergency SUPL and Control Plane network initiated
+ * location requests for this extra duration after the user initiated emergency
+ * session ends.
+ *
+ * @param emergencyExtensionSeconds Number of seconds to extend the emergency
+ * session duration post emergency call.
+ */
+ void setEsExtensionSec(in int emergencyExtensionSeconds);
+
+ /**
+ * Injects a vector of BlocklistedSource(s) which the HAL must not use to calculate the
+ * GNSS location output.
+ *
+ * The superset of all satellite sources provided, including wildcards, in the latest call
+ * to this method, is the set of satellites sources that must not be used in calculating
+ * location.
+ *
+ * All measurements from the specified satellites, across frequency bands, are blocklisted
+ * together.
+ *
+ * If this method is never called after the IGnssConfiguration.hal connection is made on boot,
+ * or is called with an empty vector, then no satellites are to be blocklisted as a result of
+ * this API.
+ *
+ * This blocklist must be considered as an additional source of which satellites
+ * should not be trusted for location on top of existing sources of similar information
+ * such as satellite broadcast health being unhealthy and measurement outlier removal.
+ *
+ * @param blocklist The BlocklistedSource(s) of satellites the HAL must not use.
+ */
+ void setBlocklist(in BlocklistedSource[] blocklist);
+}
\ No newline at end of file
diff --git a/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl b/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl
index 6f53d6f..7c46096 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl
@@ -32,18 +32,14 @@
* @param psdsType Type of PSDS data.
* @param psdsData GNSS PSDS data. Framework must not parse the data since the data format is
* opaque to framework.
- *
- * @return True if the operation is successful.
*/
- boolean injectPsdsData(in PsdsType psdsType, in byte[] psdsData);
+ void injectPsdsData(in PsdsType psdsType, in byte[] psdsData);
/**
* Opens the PSDS interface and provides the callback routines to the implementation of this
* interface.
*
* @param callback Handle to the IGnssPsdsCallback interface.
- *
- * @return True if the operation is successful.
*/
- boolean setCallback(in IGnssPsdsCallback callback);
+ void setCallback(in IGnssPsdsCallback callback);
}
\ No newline at end of file
diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp
index 8c4ee40..1fe43c3 100644
--- a/gnss/aidl/default/Android.bp
+++ b/gnss/aidl/default/Android.bp
@@ -17,8 +17,13 @@
cc_binary {
name: "android.hardware.gnss-service.example",
relative_install_path: "hw",
- init_rc: ["gnss-default.rc"],
- vintf_fragments: ["gnss-default.xml"],
+ init_rc: [
+ "gnss-default.rc",
+ ],
+ vintf_fragments: [
+ "gnss-default.xml",
+ "gnss@2.1-service.xml",
+ ],
vendor: true,
cflags: [
"-Wall",
@@ -27,12 +32,26 @@
shared_libs: [
"libbase",
"libbinder_ndk",
+ "libhidlbase",
+ "libutils",
"liblog",
+ "android.hardware.gnss@2.1",
+ "android.hardware.gnss@2.0",
+ "android.hardware.gnss@1.1",
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss.measurement_corrections@1.1",
+ "android.hardware.gnss.measurement_corrections@1.0",
+ "android.hardware.gnss.visibility_control@1.0",
"android.hardware.gnss-ndk_platform",
],
srcs: [
"Gnss.cpp",
+ "GnssHidlHal.cpp",
"GnssPsds.cpp",
+ "GnssConfiguration.cpp",
"service.cpp",
],
+ static_libs: [
+ "android.hardware.gnss@common-default-lib",
+ ],
}
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 2a35924..b4d92fd 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -18,14 +18,51 @@
#include "Gnss.h"
#include <log/log.h>
+#include "GnssConfiguration.h"
#include "GnssPsds.h"
namespace aidl::android::hardware::gnss {
+std::shared_ptr<IGnssCallback> Gnss::sGnssCallback = nullptr;
+
+ndk::ScopedAStatus Gnss::setCallback(const std::shared_ptr<IGnssCallback>& callback) {
+ ALOGD("Gnss::setCallback");
+ if (callback == nullptr) {
+ ALOGE("%s: Null callback ignored", __func__);
+ return ndk::ScopedAStatus::fromExceptionCode(STATUS_INVALID_OPERATION);
+ }
+
+ sGnssCallback = callback;
+
+ int capabilities = (int)IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST;
+ auto status = sGnssCallback->gnssSetCapabilitiesCb(capabilities);
+ if (!status.isOk()) {
+ ALOGE("%s: Unable to invoke callback.gnssSetCapabilities", __func__);
+ }
+
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Gnss::close() {
+ ALOGD("Gnss::close");
+ sGnssCallback = nullptr;
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus Gnss::getExtensionPsds(std::shared_ptr<IGnssPsds>* iGnssPsds) {
ALOGD("Gnss::getExtensionPsds");
*iGnssPsds = SharedRefBase::make<GnssPsds>();
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Gnss::getExtensionGnssConfiguration(
+ std::shared_ptr<IGnssConfiguration>* iGnssConfiguration) {
+ ALOGD("Gnss::getExtensionGnssConfiguration");
+ if (mGnssConfiguration == nullptr) {
+ mGnssConfiguration = SharedRefBase::make<GnssConfiguration>();
+ }
+ *iGnssConfiguration = mGnssConfiguration;
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index 9864e9d..61d7cf7 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -17,12 +17,24 @@
#pragma once
#include <aidl/android/hardware/gnss/BnGnss.h>
+#include <aidl/android/hardware/gnss/BnGnssConfiguration.h>
#include <aidl/android/hardware/gnss/BnGnssPsds.h>
+#include "GnssConfiguration.h"
namespace aidl::android::hardware::gnss {
class Gnss : public BnGnss {
+ public:
+ ndk::ScopedAStatus setCallback(const std::shared_ptr<IGnssCallback>& callback) override;
+ ndk::ScopedAStatus close() override;
ndk::ScopedAStatus getExtensionPsds(std::shared_ptr<IGnssPsds>* iGnssPsds) override;
+ ndk::ScopedAStatus getExtensionGnssConfiguration(
+ std::shared_ptr<IGnssConfiguration>* iGnssConfiguration) override;
+
+ std::shared_ptr<GnssConfiguration> mGnssConfiguration;
+
+ private:
+ static std::shared_ptr<IGnssCallback> sGnssCallback;
};
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssConfiguration.cpp b/gnss/aidl/default/GnssConfiguration.cpp
new file mode 100644
index 0000000..30e0d8c
--- /dev/null
+++ b/gnss/aidl/default/GnssConfiguration.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssConfigurationAidl"
+
+#include "GnssConfiguration.h"
+#include <log/log.h>
+
+namespace aidl::android::hardware::gnss {
+
+ndk::ScopedAStatus GnssConfiguration::setBlocklist(const vector<BlocklistedSource>& sourceList) {
+ ALOGD("GnssConfiguration::setBlocklist");
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ mBlocklistedConstellationSet.clear();
+ mBlocklistedSourceSet.clear();
+ for (const auto& source : sourceList) {
+ if (source.svid == 0) {
+ // Wildcard blocklist, i.e., blocklist entire constellation.
+ mBlocklistedConstellationSet.insert(source.constellation);
+ } else {
+ mBlocklistedSourceSet.insert(source);
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+bool GnssConfiguration::isBlocklistedV2_1(const GnssSvInfoV2_1& gnssSvInfo) const {
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ if (mBlocklistedConstellationSet.find(static_cast<GnssConstellationType>(
+ gnssSvInfo.v2_0.constellation)) != mBlocklistedConstellationSet.end()) {
+ return true;
+ }
+ BlocklistedSource source = {
+ .constellation = static_cast<GnssConstellationType>(gnssSvInfo.v2_0.constellation),
+ .svid = gnssSvInfo.v2_0.v1_0.svid};
+ return (mBlocklistedSourceSet.find(source) != mBlocklistedSourceSet.end());
+}
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssConfiguration.h b/gnss/aidl/default/GnssConfiguration.h
new file mode 100644
index 0000000..25fa16e
--- /dev/null
+++ b/gnss/aidl/default/GnssConfiguration.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/gnss/BnGnssConfiguration.h>
+#include <android/hardware/gnss/2.1/IGnssCallback.h>
+#include <mutex>
+#include <unordered_set>
+#include <vector>
+
+namespace aidl::android::hardware::gnss {
+
+using android::hardware::gnss::GnssConstellationType;
+
+struct BlocklistedSourceHash {
+ inline int operator()(const BlocklistedSource& source) const {
+ return int(source.constellation) * 1000 + int(source.svid);
+ }
+};
+
+struct BlocklistedSourceEqual {
+ inline bool operator()(const BlocklistedSource& s1, const BlocklistedSource& s2) const {
+ return (s1.constellation == s2.constellation) && (s1.svid == s2.svid);
+ }
+};
+
+using GnssSvInfoV2_1 = ::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo;
+using std::vector;
+using BlocklistedSourceSet =
+ std::unordered_set<BlocklistedSource, BlocklistedSourceHash, BlocklistedSourceEqual>;
+using BlocklistedConstellationSet = std::unordered_set<GnssConstellationType>;
+
+struct GnssConfiguration : public BnGnssConfiguration {
+ public:
+ ndk::ScopedAStatus setSuplVersion(int) override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus setSuplMode(int) override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus setLppProfile(int) override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus setGlonassPositioningProtocol(int) override {
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus setEmergencySuplPdn(bool) override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus setEsExtensionSec(int) override { return ndk::ScopedAStatus::ok(); }
+
+ ndk::ScopedAStatus setBlocklist(const vector<BlocklistedSource>& blocklist) override;
+
+ bool isBlocklistedV2_1(const GnssSvInfoV2_1& gnssSvInfo) const;
+
+ private:
+ BlocklistedSourceSet mBlocklistedSourceSet;
+ BlocklistedConstellationSet mBlocklistedConstellationSet;
+ mutable std::recursive_mutex mMutex;
+};
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssHidlHal.cpp b/gnss/aidl/default/GnssHidlHal.cpp
new file mode 100644
index 0000000..11fc806
--- /dev/null
+++ b/gnss/aidl/default/GnssHidlHal.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssHidlHal"
+
+#include "GnssHidlHal.h"
+//#include <android/hardware/gnss/1.0/IGnssCallback.h>
+
+namespace aidl::android::hardware::gnss {
+
+namespace V1_0 = ::android::hardware::gnss::V1_0;
+
+GnssHidlHal::GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl) : mGnssAidl(gnssAidl) {
+ Gnss* iGnss = mGnssAidl.get();
+ std::shared_ptr<IGnssConfiguration> iGnssConfiguration;
+ auto status = iGnss->getExtensionGnssConfiguration(&iGnssConfiguration);
+ if (!status.isOk()) {
+ ALOGE("Failed to getExtensionGnssConfiguration.");
+ } else {
+ mGnssConfigurationAidl = iGnss->mGnssConfiguration;
+ }
+};
+
+hidl_vec<GnssSvInfo> GnssHidlHal::filterBlocklistedSatellitesV2_1(
+ hidl_vec<GnssSvInfo> gnssSvInfoList) {
+ ALOGD("filterBlocklistSatellitesV2_1 - overridden by GnssHidlHal class");
+ if (mGnssConfigurationAidl == nullptr) {
+ ALOGE("Handle to AIDL GnssConfiguration is not available.");
+ return gnssSvInfoList;
+ }
+ for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) {
+ if (mGnssConfigurationAidl->isBlocklistedV2_1(gnssSvInfoList[i])) {
+ ALOGD("Blocklisted constellation: %d, svid: %d",
+ (int)gnssSvInfoList[i].v2_0.constellation, gnssSvInfoList[i].v2_0.v1_0.svid);
+ gnssSvInfoList[i].v2_0.v1_0.svFlag &=
+ ~static_cast<uint8_t>(V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX);
+ }
+ }
+ return gnssSvInfoList;
+}
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssHidlHal.h b/gnss/aidl/default/GnssHidlHal.h
new file mode 100644
index 0000000..50aad3a
--- /dev/null
+++ b/gnss/aidl/default/GnssHidlHal.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "Gnss.h"
+#include "GnssConfiguration.h"
+#include "v2_1/GnssTemplate.h"
+
+namespace aidl::android::hardware::gnss {
+
+using ::android::hardware::gnss::common::implementation::GnssTemplate;
+using GnssSvInfo = ::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo;
+
+class GnssHidlHal : public GnssTemplate<::android::hardware::gnss::V2_1::IGnss> {
+ public:
+ GnssHidlHal(const std::shared_ptr<Gnss>& gnssAidl);
+
+ private:
+ hidl_vec<GnssSvInfo> filterBlocklistedSatellitesV2_1(
+ hidl_vec<GnssSvInfo> gnssSvInfoList) override;
+
+ std::shared_ptr<Gnss> mGnssAidl;
+ std::shared_ptr<GnssConfiguration> mGnssConfigurationAidl;
+};
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssPsds.cpp b/gnss/aidl/default/GnssPsds.cpp
index c354217..6512af6 100644
--- a/gnss/aidl/default/GnssPsds.cpp
+++ b/gnss/aidl/default/GnssPsds.cpp
@@ -17,27 +17,28 @@
#define LOG_TAG "GnssPsdsAidl"
#include "GnssPsds.h"
-
+#include <aidl/android/hardware/gnss/BnGnss.h>
#include <log/log.h>
namespace aidl::android::hardware::gnss {
std::shared_ptr<IGnssPsdsCallback> GnssPsds::sCallback = nullptr;
-ndk::ScopedAStatus GnssPsds::setCallback(const std::shared_ptr<IGnssPsdsCallback>& callback,
- bool* success) {
+ndk::ScopedAStatus GnssPsds::setCallback(const std::shared_ptr<IGnssPsdsCallback>& callback) {
ALOGD("setCallback");
std::unique_lock<std::mutex> lock(mMutex);
sCallback = callback;
- *success = true;
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus GnssPsds::injectPsdsData(PsdsType psdsType, const std::vector<uint8_t>& psdsData,
- bool* success) {
+ndk::ScopedAStatus GnssPsds::injectPsdsData(PsdsType psdsType,
+ const std::vector<uint8_t>& psdsData) {
ALOGD("injectPsdsData. psdsType: %d, psdsData: %d bytes", static_cast<int>(psdsType),
static_cast<int>(psdsData.size()));
- *success = (psdsData.size() > 0);
- return ndk::ScopedAStatus::ok();
+ if (psdsData.size() > 0) {
+ return ndk::ScopedAStatus::ok();
+ } else {
+ return ndk::ScopedAStatus::fromServiceSpecificError(IGnss::ERROR_INVALID_ARGUMENT);
+ }
}
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssPsds.h b/gnss/aidl/default/GnssPsds.h
index fc65bc1..de9e68f 100644
--- a/gnss/aidl/default/GnssPsds.h
+++ b/gnss/aidl/default/GnssPsds.h
@@ -22,10 +22,9 @@
struct GnssPsds : public BnGnssPsds {
public:
- ndk::ScopedAStatus setCallback(const std::shared_ptr<IGnssPsdsCallback>& callback,
- bool* success) override;
- ndk::ScopedAStatus injectPsdsData(PsdsType psdsType, const std::vector<uint8_t>& psdsData,
- bool* success) override;
+ ndk::ScopedAStatus setCallback(const std::shared_ptr<IGnssPsdsCallback>& callback) override;
+ ndk::ScopedAStatus injectPsdsData(PsdsType psdsType,
+ const std::vector<uint8_t>& psdsData) override;
private:
// Guarded by mMutex
diff --git a/gnss/aidl/default/gnss@2.1-service.xml b/gnss/aidl/default/gnss@2.1-service.xml
new file mode 100644
index 0000000..12a1fdf
--- /dev/null
+++ b/gnss/aidl/default/gnss@2.1-service.xml
@@ -0,0 +1,12 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.gnss</name>
+ <transport>hwbinder</transport>
+ <version>2.1</version>
+ <version>1.1</version>
+ <interface>
+ <name>IGnss</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/gnss/aidl/default/service.cpp b/gnss/aidl/default/service.cpp
index c79a271..09f1ad2 100644
--- a/gnss/aidl/default/service.cpp
+++ b/gnss/aidl/default/service.cpp
@@ -14,22 +14,45 @@
* limitations under the License.
*/
-#include "Gnss.h"
+#define LOG_TAG "Gnss-main"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+#include <log/log.h>
+#include <pthread.h>
+#include "Gnss.h"
+#include "GnssHidlHal.h"
using aidl::android::hardware::gnss::Gnss;
+using aidl::android::hardware::gnss::GnssHidlHal;
+using ::android::OK;
+using ::android::sp;
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::hardware::gnss::V2_1::IGnss;
int main() {
- ABinderProcess_setThreadPoolMaxThreadCount(0);
- std::shared_ptr<Gnss> vib = ndk::SharedRefBase::make<Gnss>();
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ std::shared_ptr<Gnss> gnssAidl = ndk::SharedRefBase::make<Gnss>();
const std::string instance = std::string() + Gnss::descriptor + "/default";
- binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str());
+ binder_status_t status =
+ AServiceManager_addService(gnssAidl->asBinder().get(), instance.c_str());
CHECK(status == STATUS_OK);
+ sp<IGnss> gnss = new GnssHidlHal(gnssAidl);
+ configureRpcThreadpool(1, true /* will join */);
+ if (gnss->registerAsService() != OK) {
+ ALOGE("Could not register gnss 2.1 service.");
+ return 0;
+ }
+
+ joinRpcThreadpool();
ABinderProcess_joinThreadPool();
+
return EXIT_FAILURE; // should not reach
}
diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp
index e57b421..48a0e21 100644
--- a/gnss/aidl/vts/Android.bp
+++ b/gnss/aidl/vts/Android.bp
@@ -18,14 +18,25 @@
"VtsHalTargetTestDefaults",
"use_libaidlvintf_gtest_helper_static",
],
- srcs: ["VtsHalGnssTargetTest.cpp"],
+ srcs: [
+ "gnss_hal_test.cpp",
+ "gnss_hal_test_cases.cpp",
+ "GnssCallbackAidl.cpp",
+ "VtsHalGnssTargetTest.cpp",
+ ],
shared_libs: [
+ "android.hardware.gnss@2.1",
+ "android.hardware.gnss@2.0",
+ "android.hardware.gnss@1.1",
+ "android.hardware.gnss@1.0",
"libbinder",
],
static_libs: [
"android.hardware.gnss-cpp",
+ "android.hardware.gnss@common-vts-lib",
],
test_suites: [
+ "general-tests",
"vts",
],
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IGenerateChallengeCallback.aidl b/gnss/aidl/vts/GnssCallbackAidl.cpp
similarity index 68%
rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IGenerateChallengeCallback.aidl
rename to gnss/aidl/vts/GnssCallbackAidl.cpp
index a51b188..f5c745b 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IGenerateChallengeCallback.aidl
+++ b/gnss/aidl/vts/GnssCallbackAidl.cpp
@@ -14,13 +14,11 @@
* limitations under the License.
*/
-package android.hardware.biometrics.fingerprint;
+#include "GnssCallbackAidl.h"
+#include <log/log.h>
-@VintfStability
-oneway interface IGenerateChallengeCallback {
- /**
- * Notifies the framework when a challenge is successfully generated.
- */
- void onChallengeGenerated(in int sensorId, in int userId, in long challenge);
+android::binder::Status GnssCallbackAidl::gnssSetCapabilitiesCb(const int capabilities) {
+ ALOGI("Capabilities received %d", capabilities);
+ capabilities_cbq_.store(capabilities);
+ return android::binder::Status::ok();
}
-
diff --git a/gnss/aidl/vts/GnssCallbackAidl.h b/gnss/aidl/vts/GnssCallbackAidl.h
new file mode 100644
index 0000000..7f802ea
--- /dev/null
+++ b/gnss/aidl/vts/GnssCallbackAidl.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <android/hardware/gnss/BnGnssCallback.h>
+#include "GnssCallbackEventQueue.h"
+
+/* Callback class for data & Event. */
+class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback {
+ public:
+ GnssCallbackAidl() : capabilities_cbq_("capabilities"){};
+ ~GnssCallbackAidl(){};
+
+ android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override;
+
+ int last_capabilities_;
+ android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
+};
\ No newline at end of file
diff --git a/gnss/aidl/vts/VtsHalGnssTargetTest.cpp b/gnss/aidl/vts/VtsHalGnssTargetTest.cpp
index e7ffc05..4bba92b 100644
--- a/gnss/aidl/vts/VtsHalGnssTargetTest.cpp
+++ b/gnss/aidl/vts/VtsHalGnssTargetTest.cpp
@@ -13,60 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <aidl/Gtest.h>
-#include <aidl/Vintf.h>
+
+#include "gnss_hal_test.h"
#include <android/hardware/gnss/IGnss.h>
-#include <android/hardware/gnss/IGnssPsds.h>
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
using android::ProcessState;
-using android::sp;
-using android::String16;
-using android::binder::Status;
-using android::hardware::gnss::IGnss;
-using android::hardware::gnss::IGnssPsds;
-using android::hardware::gnss::PsdsType;
-class GnssAidlHalTest : public testing::TestWithParam<std::string> {
- public:
- virtual void SetUp() override {
- gnss_hal_ = android::waitForDeclaredService<IGnss>(String16(GetParam().c_str()));
- ASSERT_NE(gnss_hal_, nullptr);
- }
-
- sp<IGnss> gnss_hal_;
-};
-
-/*
- * SetupTeardownCreateCleanup:
- * Requests the gnss HAL then calls cleanup
- *
- * Empty test fixture to verify basic Setup & Teardown
- */
-TEST_P(GnssAidlHalTest, SetupTeardownCreateCleanup) {}
-
-/*
- * TestPsdsExtension:
- * 1. Gets the PsdsExtension and verifies that it returns a non-null extension.
- * 2. Injects empty PSDS data and verifies that it returns false.
- */
-TEST_P(GnssAidlHalTest, TestPsdsExtension) {
- sp<IGnssPsds> iGnssPsds;
- auto status = gnss_hal_->getExtensionPsds(&iGnssPsds);
- ASSERT_TRUE(status.isOk());
- ASSERT_TRUE(iGnssPsds != nullptr);
-
- bool success;
- status = iGnssPsds->injectPsdsData(PsdsType::LONG_TERM, std::vector<uint8_t>(), &success);
- ASSERT_TRUE(status.isOk());
- ASSERT_FALSE(success);
-}
-
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GnssAidlHalTest);
-INSTANTIATE_TEST_SUITE_P(, GnssAidlHalTest,
- testing::ValuesIn(android::getAidlHalInstanceNames(IGnss::descriptor)),
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GnssHalTest);
+INSTANTIATE_TEST_SUITE_P(, GnssHalTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IGnssAidl::descriptor)),
android::PrintInstanceNameToString);
int main(int argc, char** argv) {
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
new file mode 100644
index 0000000..2447bf8
--- /dev/null
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gnss_hal_test.h"
+#include <hidl/ServiceManagement.h>
+
+using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
+
+void GnssHalTest::SetUp() {
+ // Get AIDL handle
+ aidl_gnss_hal_ = android::waitForDeclaredService<IGnssAidl>(String16(GetParam().c_str()));
+ ASSERT_NE(aidl_gnss_hal_, nullptr);
+
+ const auto& hidlInstanceNames = android::hardware::getAllHalInstanceNames(
+ android::hardware::gnss::V2_1::IGnss::descriptor);
+ gnss_hal_ = IGnss_V2_1::getService(hidlInstanceNames[0]);
+ ASSERT_NE(gnss_hal_, nullptr);
+
+ SetUpGnssCallback();
+}
+
+void GnssHalTest::SetUpGnssCallback() {
+ aidl_gnss_cb_ = new GnssCallbackAidl();
+ ASSERT_NE(aidl_gnss_cb_, nullptr);
+
+ auto status = aidl_gnss_hal_->setCallback(aidl_gnss_cb_);
+ if (!status.isOk()) {
+ ALOGE("Failed to setCallback");
+ }
+
+ ASSERT_TRUE(status.isOk());
+
+ /*
+ * Capabilities callback should trigger.
+ */
+ EXPECT_TRUE(aidl_gnss_cb_->capabilities_cbq_.retrieve(aidl_gnss_cb_->last_capabilities_,
+ TIMEOUT_SEC));
+
+ EXPECT_EQ(aidl_gnss_cb_->capabilities_cbq_.calledCount(), 1);
+
+ // Invoke the super method.
+ GnssHalTestTemplate<IGnss_V2_1>::SetUpGnssCallback();
+}
diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h
new file mode 100644
index 0000000..eb5301e
--- /dev/null
+++ b/gnss/aidl/vts/gnss_hal_test.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+
+#include <android/hardware/gnss/IGnss.h>
+#include <binder/IServiceManager.h>
+
+#include <android/hardware/gnss/2.1/IGnss.h>
+#include "GnssCallbackAidl.h"
+#include "v2_1/gnss_hal_test_template.h"
+
+using IGnss_V2_1 = android::hardware::gnss::V2_1::IGnss;
+
+using android::ProcessState;
+using android::sp;
+using android::String16;
+using IGnssAidl = android::hardware::gnss::IGnss;
+using android::hardware::gnss::BlocklistedSource;
+using android::hardware::gnss::IGnssConfiguration;
+
+// The main test class for GNSS HAL.
+class GnssHalTest : public GnssHalTestTemplate<IGnss_V2_1> {
+ public:
+ GnssHalTest(){};
+ ~GnssHalTest(){};
+ virtual void SetUp() override;
+ virtual void SetUpGnssCallback() override;
+
+ sp<IGnssAidl> aidl_gnss_hal_;
+ sp<GnssCallbackAidl> aidl_gnss_cb_; // Primary callback interface
+};
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
new file mode 100644
index 0000000..2b8a447
--- /dev/null
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -0,0 +1,450 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssHalTestCases"
+
+#include <android/hardware/gnss/IGnssPsds.h>
+#include "gnss_hal_test.h"
+
+using android::sp;
+using android::hardware::gnss::BlocklistedSource;
+using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType;
+using android::hardware::gnss::IGnssConfiguration;
+using android::hardware::gnss::IGnssPsds;
+using android::hardware::gnss::PsdsType;
+
+/*
+ * SetupTeardownCreateCleanup:
+ * Requests the gnss HAL then calls cleanup
+ *
+ * Empty test fixture to verify basic Setup & Teardown
+ */
+TEST_P(GnssHalTest, SetupTeardownCreateCleanup) {}
+
+/*
+ * TestPsdsExtension:
+ * 1. Gets the PsdsExtension and verifies that it returns a non-null extension.
+ * 2. Injects empty PSDS data and verifies that it returns false.
+ */
+TEST_P(GnssHalTest, TestPsdsExtension) {
+ sp<IGnssPsds> iGnssPsds;
+ auto status = aidl_gnss_hal_->getExtensionPsds(&iGnssPsds);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssPsds != nullptr);
+
+ status = iGnssPsds->injectPsdsData(PsdsType::LONG_TERM, std::vector<uint8_t>());
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
+ * FindStrongFrequentNonGpsSource:
+ *
+ * Search through a GnssSvStatus list for the strongest non-GPS satellite observed enough times
+ *
+ * returns the strongest source,
+ * or a source with constellation == UNKNOWN if none are found sufficient times
+ */
+BlocklistedSource FindStrongFrequentNonGpsSource(
+ const std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_list,
+ const int min_observations) {
+ struct ComparableBlocklistedSource {
+ BlocklistedSource id;
+
+ ComparableBlocklistedSource() {
+ id.constellation = GnssConstellationTypeAidl::UNKNOWN;
+ id.svid = 0;
+ }
+
+ bool operator<(const ComparableBlocklistedSource& compare) const {
+ return ((id.svid < compare.id.svid) || ((id.svid == compare.id.svid) &&
+ (id.constellation < compare.id.constellation)));
+ }
+ };
+
+ struct SignalCounts {
+ int observations;
+ float max_cn0_dbhz;
+ };
+
+ std::map<ComparableBlocklistedSource, SignalCounts> mapSignals;
+
+ for (const auto& sv_info_vec : sv_info_list) {
+ for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
+ const auto& gnss_sv = sv_info_vec[iSv];
+ if ((gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX) &&
+ (gnss_sv.v2_0.constellation != GnssConstellationType::GPS)) {
+ ComparableBlocklistedSource source;
+ source.id.svid = gnss_sv.v2_0.v1_0.svid;
+ source.id.constellation =
+ static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation);
+
+ const auto& itSignal = mapSignals.find(source);
+ if (itSignal == mapSignals.end()) {
+ SignalCounts counts;
+ counts.observations = 1;
+ counts.max_cn0_dbhz = gnss_sv.v2_0.v1_0.cN0Dbhz;
+ mapSignals.insert(
+ std::pair<ComparableBlocklistedSource, SignalCounts>(source, counts));
+ } else {
+ itSignal->second.observations++;
+ if (itSignal->second.max_cn0_dbhz < gnss_sv.v2_0.v1_0.cN0Dbhz) {
+ itSignal->second.max_cn0_dbhz = gnss_sv.v2_0.v1_0.cN0Dbhz;
+ }
+ }
+ }
+ }
+ }
+
+ float max_cn0_dbhz_with_sufficient_count = 0.;
+ int total_observation_count = 0;
+ int blocklisted_source_count_observation = 0;
+
+ ComparableBlocklistedSource source_to_blocklist; // initializes to zero = UNKNOWN constellation
+ for (auto const& pairSignal : mapSignals) {
+ total_observation_count += pairSignal.second.observations;
+ if ((pairSignal.second.observations >= min_observations) &&
+ (pairSignal.second.max_cn0_dbhz > max_cn0_dbhz_with_sufficient_count)) {
+ source_to_blocklist = pairSignal.first;
+ blocklisted_source_count_observation = pairSignal.second.observations;
+ max_cn0_dbhz_with_sufficient_count = pairSignal.second.max_cn0_dbhz;
+ }
+ }
+ ALOGD("Among %d observations, chose svid %d, constellation %d, "
+ "with %d observations at %.1f max CNo",
+ total_observation_count, source_to_blocklist.id.svid,
+ (int)source_to_blocklist.id.constellation, blocklisted_source_count_observation,
+ max_cn0_dbhz_with_sufficient_count);
+
+ return source_to_blocklist.id;
+}
+
+/*
+ * BlocklistIndividualSatellites:
+ *
+ * 1) Turns on location, waits for 3 locations, ensuring they are valid, and checks corresponding
+ * GnssStatus for common satellites (strongest and one other.)
+ * 2a & b) Turns off location, and blocklists common satellites.
+ * 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
+ * GnssStatus does not use those satellites.
+ * 4a & b) Turns off location, and send in empty blocklist.
+ * 5a) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
+ * GnssStatus does re-use at least the previously strongest satellite
+ * 5b) Retry a few times, in case GNSS search strategy takes a while to reacquire even the
+ * formerly strongest satellite
+ */
+TEST_P(GnssHalTest, BlocklistIndividualSatellites) {
+ if (!(aidl_gnss_cb_->last_capabilities_ &
+ (int)GnssCallbackAidl::CAPABILITY_SATELLITE_BLOCKLIST)) {
+ ALOGI("Test BlocklistIndividualSatellites skipped. SATELLITE_BLOCKLIST capability not "
+ "supported.");
+ return;
+ }
+
+ const int kLocationsToAwait = 3;
+ const int kRetriesToUnBlocklist = 10;
+
+ gnss_cb_->location_cbq_.reset();
+ StartAndCheckLocations(kLocationsToAwait);
+ int location_called_count = gnss_cb_->location_cbq_.calledCount();
+
+ // Tolerate 1 less sv status to handle edge cases in reporting.
+ int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size();
+ EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
+ ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)",
+ sv_info_list_cbq_size, kLocationsToAwait, location_called_count);
+
+ /*
+ * Identify strongest SV seen at least kLocationsToAwait -1 times
+ * Why -1? To avoid test flakiness in case of (plausible) slight flakiness in strongest signal
+ * observability (one epoch RF null)
+ */
+
+ const int kGnssSvInfoListTimeout = 2;
+ std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_vec_list;
+ int count = gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec_list, sv_info_list_cbq_size,
+ kGnssSvInfoListTimeout);
+
+ ASSERT_EQ(count, sv_info_list_cbq_size);
+
+ BlocklistedSource source_to_blocklist =
+ FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1);
+
+ if (source_to_blocklist.constellation == GnssConstellationTypeAidl::UNKNOWN) {
+ // Cannot find a non-GPS satellite. Let the test pass.
+ ALOGD("Cannot find a non-GPS satellite. Letting the test pass.");
+ return;
+ }
+
+ // Stop locations, blocklist the common SV
+ StopAndClearLocations();
+
+ sp<IGnssConfiguration> gnss_configuration_hal;
+ auto status = aidl_gnss_hal_->getExtensionGnssConfiguration(&gnss_configuration_hal);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_NE(gnss_configuration_hal, nullptr);
+
+ std::vector<BlocklistedSource> sources;
+ sources.resize(1);
+ sources[0] = source_to_blocklist;
+
+ status = gnss_configuration_hal->setBlocklist(sources);
+ ASSERT_TRUE(status.isOk());
+
+ // retry and ensure satellite not used
+ gnss_cb_->sv_info_list_cbq_.reset();
+
+ gnss_cb_->location_cbq_.reset();
+ StartAndCheckLocations(kLocationsToAwait);
+
+ // early exit if test is being run with insufficient signal
+ location_called_count = gnss_cb_->location_cbq_.calledCount();
+ if (location_called_count == 0) {
+ ALOGE("0 Gnss locations received - ensure sufficient signal and retry");
+ }
+ ASSERT_TRUE(location_called_count > 0);
+
+ // Tolerate 1 less sv status to handle edge cases in reporting.
+ sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size();
+ EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
+ ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)",
+ sv_info_list_cbq_size, kLocationsToAwait, location_called_count);
+ for (int i = 0; i < sv_info_list_cbq_size; ++i) {
+ hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
+ gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
+ for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
+ const auto& gnss_sv = sv_info_vec[iSv];
+ EXPECT_FALSE((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
+ (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ source_to_blocklist.constellation) &&
+ (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
+ }
+ }
+
+ // clear blocklist and restart - this time updating the blocklist while location is still on
+ sources.resize(0);
+
+ status = gnss_configuration_hal->setBlocklist(sources);
+ ASSERT_TRUE(status.isOk());
+
+ bool strongest_sv_is_reobserved = false;
+ // do several loops awaiting a few locations, allowing non-immediate reacquisition strategies
+ int unblocklist_loops_remaining = kRetriesToUnBlocklist;
+ while (!strongest_sv_is_reobserved && (unblocklist_loops_remaining-- > 0)) {
+ StopAndClearLocations();
+ gnss_cb_->sv_info_list_cbq_.reset();
+
+ gnss_cb_->location_cbq_.reset();
+ StartAndCheckLocations(kLocationsToAwait);
+
+ // early exit loop if test is being run with insufficient signal
+ location_called_count = gnss_cb_->location_cbq_.calledCount();
+ if (location_called_count == 0) {
+ ALOGE("0 Gnss locations received - ensure sufficient signal and retry");
+ }
+ ASSERT_TRUE(location_called_count > 0);
+
+ // Tolerate 1 less sv status to handle edge cases in reporting.
+ sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size();
+ EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
+ ALOGD("Clear blocklist, observed %d GnssSvInfo, while awaiting %d Locations"
+ ", tries remaining %d",
+ sv_info_list_cbq_size, kLocationsToAwait, unblocklist_loops_remaining);
+
+ for (int i = 0; i < sv_info_list_cbq_size; ++i) {
+ hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
+ gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
+ for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
+ const auto& gnss_sv = sv_info_vec[iSv];
+ if ((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
+ (static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ source_to_blocklist.constellation) &&
+ (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) {
+ strongest_sv_is_reobserved = true;
+ break;
+ }
+ }
+ if (strongest_sv_is_reobserved) break;
+ }
+ }
+ EXPECT_TRUE(strongest_sv_is_reobserved);
+ StopAndClearLocations();
+}
+
+/*
+ * BlocklistConstellationLocationOff:
+ *
+ * 1) Turns on location, waits for 3 locations, ensuring they are valid, and checks corresponding
+ * GnssStatus for any non-GPS constellations.
+ * 2a & b) Turns off location, and blocklist first non-GPS constellations.
+ * 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
+ * GnssStatus does not use any constellation but GPS.
+ * 4a & b) Clean up by turning off location, and send in empty blocklist.
+ */
+TEST_P(GnssHalTest, BlocklistConstellationLocationOff) {
+ if (!(aidl_gnss_cb_->last_capabilities_ &
+ (int)GnssCallbackAidl::CAPABILITY_SATELLITE_BLOCKLIST)) {
+ ALOGI("Test BlocklistConstellationLocationOff skipped. SATELLITE_BLOCKLIST capability not "
+ "supported.");
+ return;
+ }
+
+ const int kLocationsToAwait = 3;
+ const int kGnssSvInfoListTimeout = 2;
+
+ // Find first non-GPS constellation to blocklist
+ GnssConstellationTypeAidl constellation_to_blocklist = static_cast<GnssConstellationTypeAidl>(
+ startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
+
+ // Turns off location
+ StopAndClearLocations();
+
+ BlocklistedSource source_to_blocklist_1;
+ source_to_blocklist_1.constellation = constellation_to_blocklist;
+ source_to_blocklist_1.svid = 0; // documented wildcard for all satellites in this constellation
+
+ // IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is
+ // supported.
+ BlocklistedSource source_to_blocklist_2;
+ source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS;
+ source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation
+
+ sp<IGnssConfiguration> gnss_configuration_hal;
+ auto status = aidl_gnss_hal_->getExtensionGnssConfiguration(&gnss_configuration_hal);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_NE(gnss_configuration_hal, nullptr);
+
+ hidl_vec<BlocklistedSource> sources;
+ sources.resize(2);
+ sources[0] = source_to_blocklist_1;
+ sources[1] = source_to_blocklist_2;
+
+ status = gnss_configuration_hal->setBlocklist(sources);
+ ASSERT_TRUE(status.isOk());
+
+ // retry and ensure constellation not used
+ gnss_cb_->sv_info_list_cbq_.reset();
+
+ gnss_cb_->location_cbq_.reset();
+ StartAndCheckLocations(kLocationsToAwait);
+
+ // Tolerate 1 less sv status to handle edge cases in reporting.
+ int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size();
+ EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
+ ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations", sv_info_list_cbq_size,
+ kLocationsToAwait);
+ for (int i = 0; i < sv_info_list_cbq_size; ++i) {
+ hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
+ gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
+ for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
+ const auto& gnss_sv = sv_info_vec[iSv];
+ EXPECT_FALSE((static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ source_to_blocklist_1.constellation) &&
+ (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
+ EXPECT_FALSE((static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ source_to_blocklist_2.constellation) &&
+ (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
+ }
+ }
+
+ // clean up
+ StopAndClearLocations();
+ sources.resize(0);
+ status = gnss_configuration_hal->setBlocklist(sources);
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
+ * BlocklistConstellationLocationOn:
+ *
+ * 1) Turns on location, waits for 3 locations, ensuring they are valid, and checks corresponding
+ * GnssStatus for any non-GPS constellations.
+ * 2a & b) Blocklist first non-GPS constellation, and turn off location.
+ * 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
+ * GnssStatus does not use any constellation but GPS.
+ * 4a & b) Clean up by turning off location, and send in empty blocklist.
+ */
+TEST_P(GnssHalTest, BlocklistConstellationLocationOn) {
+ if (!(aidl_gnss_cb_->last_capabilities_ &
+ (int)GnssCallbackAidl::CAPABILITY_SATELLITE_BLOCKLIST)) {
+ ALOGI("Test BlocklistConstellationLocationOn skipped. SATELLITE_BLOCKLIST capability not "
+ "supported.");
+ return;
+ }
+
+ const int kLocationsToAwait = 3;
+ const int kGnssSvInfoListTimeout = 2;
+
+ // Find first non-GPS constellation to blocklist
+ GnssConstellationTypeAidl constellation_to_blocklist = static_cast<GnssConstellationTypeAidl>(
+ startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
+
+ BlocklistedSource source_to_blocklist_1;
+ source_to_blocklist_1.constellation = constellation_to_blocklist;
+ source_to_blocklist_1.svid = 0; // documented wildcard for all satellites in this constellation
+
+ // IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is
+ // supported.
+ BlocklistedSource source_to_blocklist_2;
+ source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS;
+ source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation
+
+ sp<IGnssConfiguration> gnss_configuration_hal;
+ auto status = aidl_gnss_hal_->getExtensionGnssConfiguration(&gnss_configuration_hal);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_NE(gnss_configuration_hal, nullptr);
+
+ hidl_vec<BlocklistedSource> sources;
+ sources.resize(2);
+ sources[0] = source_to_blocklist_1;
+ sources[1] = source_to_blocklist_2;
+
+ status = gnss_configuration_hal->setBlocklist(sources);
+ ASSERT_TRUE(status.isOk());
+
+ // Turns off location
+ StopAndClearLocations();
+
+ // retry and ensure constellation not used
+ gnss_cb_->sv_info_list_cbq_.reset();
+
+ gnss_cb_->location_cbq_.reset();
+ StartAndCheckLocations(kLocationsToAwait);
+
+ // Tolerate 1 less sv status to handle edge cases in reporting.
+ int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size();
+ EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
+ ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations", sv_info_list_cbq_size,
+ kLocationsToAwait);
+ for (int i = 0; i < sv_info_list_cbq_size; ++i) {
+ hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
+ gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
+ for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
+ const auto& gnss_sv = sv_info_vec[iSv];
+ EXPECT_FALSE((static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ source_to_blocklist_1.constellation) &&
+ (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
+ EXPECT_FALSE((static_cast<GnssConstellationTypeAidl>(gnss_sv.v2_0.constellation) ==
+ source_to_blocklist_2.constellation) &&
+ (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
+ }
+ }
+
+ // clean up
+ StopAndClearLocations();
+ sources.resize(0);
+ status = gnss_configuration_hal->setBlocklist(sources);
+ ASSERT_TRUE(status.isOk());
+}
diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp
index 8d9d4d4..730de4b 100644
--- a/gnss/common/utils/default/Android.bp
+++ b/gnss/common/utils/default/Android.bp
@@ -29,6 +29,7 @@
"v2_1/GnssDebug.cpp",
"v2_1/GnssMeasurement.cpp",
"v2_1/GnssMeasurementCorrections.cpp",
+ "MockLocation.cpp",
"Utils.cpp",
"NmeaFixInfo.cpp",
],
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl b/gnss/common/utils/default/MockLocation.cpp
similarity index 69%
copy from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl
copy to gnss/common/utils/default/MockLocation.cpp
index eadba52..2d8e7c5 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IRevokeChallengeCallback.aidl
+++ b/gnss/common/utils/default/MockLocation.cpp
@@ -14,13 +14,12 @@
* limitations under the License.
*/
-package android.hardware.biometrics.fingerprint;
+#include "MockLocation.h"
-@VintfStability
-oneway interface IRevokeChallengeCallback {
- /**
- * Notifies the framework when a challenge has been revoked.
- */
- void onChallengeRevoked(in int sensorId, in int userId, in long challenge);
-}
+namespace android::hardware::gnss::common {
+float gMockLatitudeDegrees{37.4219999};
+float gMockLongitudeDegrees{-122.0840575};
+float gMockAltitudeMeters{1.60062531};
+
+} // namespace android::hardware::gnss::common
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index 386090e..fa83634 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -15,6 +15,7 @@
*/
#include <Constants.h>
+#include <MockLocation.h>
#include <Utils.h>
#include <utils/SystemClock.h>
@@ -141,9 +142,9 @@
V1_0::GnssLocation Utils::getMockLocationV1_0() {
V1_0::GnssLocation location = {
.gnssLocationFlags = 0xFF,
- .latitudeDegrees = kMockLatitudeDegrees,
- .longitudeDegrees = kMockLongitudeDegrees,
- .altitudeMeters = kMockAltitudeMeters,
+ .latitudeDegrees = gMockLatitudeDegrees,
+ .longitudeDegrees = gMockLongitudeDegrees,
+ .altitudeMeters = gMockAltitudeMeters,
.speedMetersPerSec = kMockSpeedMetersPerSec,
.bearingDegrees = kMockBearingDegrees,
.horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
diff --git a/gnss/common/utils/default/include/Constants.h b/gnss/common/utils/default/include/Constants.h
index 000a9ec..ad4e0eb 100644
--- a/gnss/common/utils/default/include/Constants.h
+++ b/gnss/common/utils/default/include/Constants.h
@@ -24,9 +24,6 @@
namespace gnss {
namespace common {
-const float kMockLatitudeDegrees = 37.4219999;
-const float kMockLongitudeDegrees = -122.0840575;
-const float kMockAltitudeMeters = 1.60062531;
const float kMockSpeedMetersPerSec = 0;
const float kMockBearingDegrees = 0;
const float kMockHorizontalAccuracyMeters = 5;
diff --git a/gnss/common/utils/default/include/MockLocation.h b/gnss/common/utils/default/include/MockLocation.h
new file mode 100644
index 0000000..cd8cb5d
--- /dev/null
+++ b/gnss/common/utils/default/include/MockLocation.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef android_hardware_gnss_common_MockLocation_H_
+#define android_hardware_gnss_common_MockLocation_H_
+
+#include <cstdint>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace common {
+
+extern float gMockLatitudeDegrees;
+extern float gMockLongitudeDegrees;
+extern float gMockAltitudeMeters;
+
+} // namespace common
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_gnss_common_MockLocation_H_
diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
index 1fe6c3e..7c3c58a 100644
--- a/gnss/common/utils/default/include/v2_1/GnssTemplate.h
+++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
@@ -33,6 +33,7 @@
#include "GnssDebug.h"
#include "GnssMeasurement.h"
#include "GnssMeasurementCorrections.h"
+#include "MockLocation.h"
#include "NmeaFixInfo.h"
#include "Utils.h"
@@ -113,12 +114,17 @@
getExtensionMeasurementCorrections_1_1() override;
Return<sp<V2_1::IGnssAntennaInfo>> getExtensionGnssAntennaInfo() override;
+ Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
+
private:
std::unique_ptr<V2_0::GnssLocation> getLocationFromHW();
void reportLocation(const V2_0::GnssLocation&) const;
void reportLocation(const V1_0::GnssLocation&) const;
void reportSvStatus(const hidl_vec<GnssSvInfo>&) const;
+ Return<void> help(const hidl_handle& fd);
+ Return<void> setLocation(const hidl_handle& fd, const hidl_vec<hidl_string>& options);
+
static sp<V2_1::IGnssCallback> sGnssCallback_2_1;
static sp<V2_0::IGnssCallback> sGnssCallback_2_0;
static sp<V1_1::IGnssCallback> sGnssCallback_1_1;
@@ -127,12 +133,13 @@
std::atomic<long> mMinIntervalMs;
sp<GnssConfiguration> mGnssConfiguration;
std::atomic<bool> mIsActive;
- std::atomic<bool> mHardwareModeOn;
+ std::atomic<bool> mHardwareModeChecked;
std::atomic<int> mGnssFd;
std::thread mThread;
mutable std::mutex mMutex;
- hidl_vec<GnssSvInfo> filterBlacklistedSatellitesV2_1(hidl_vec<GnssSvInfo> gnssSvInfoList);
+ virtual hidl_vec<GnssSvInfo> filterBlocklistedSatellitesV2_1(
+ hidl_vec<GnssSvInfo> gnssSvInfoList);
};
template <class T_IGnss>
@@ -148,7 +155,7 @@
GnssTemplate<T_IGnss>::GnssTemplate()
: mMinIntervalMs(1000),
mGnssConfiguration{new GnssConfiguration()},
- mHardwareModeOn(false),
+ mHardwareModeChecked(false),
mGnssFd(-1) {}
template <class T_IGnss>
@@ -159,16 +166,18 @@
template <class T_IGnss>
std::unique_ptr<V2_0::GnssLocation> GnssTemplate<T_IGnss>::getLocationFromHW() {
char inputBuffer[INPUT_BUFFER_SIZE];
- if (mGnssFd == -1) {
+ if (!mHardwareModeChecked) {
mGnssFd = open(GNSS_PATH, O_RDWR | O_NONBLOCK);
+ if (mGnssFd == -1) {
+ ALOGW("Failed to open /dev/gnss0 errno: %d", errno);
+ }
+ mHardwareModeChecked = true;
}
if (mGnssFd == -1) {
- ALOGW("Failed to open /dev/gnss0 errno: %d", errno);
return nullptr;
}
- // Indicates it is a hardwareMode, don't report the default location.
- mHardwareModeOn = true;
+
int bytes_write = write(mGnssFd, CMD_GET_LOCATION, strlen(CMD_GET_LOCATION));
if (bytes_write <= 0) {
return nullptr;
@@ -206,14 +215,12 @@
mIsActive = true;
mThread = std::thread([this]() {
while (mIsActive == true) {
- auto svStatus = filterBlacklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1());
+ auto svStatus = filterBlocklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1());
this->reportSvStatus(svStatus);
auto currentLocation = getLocationFromHW();
- if (mHardwareModeOn) {
- if (currentLocation != nullptr) {
- // Only report location if the return from hardware is valid
- this->reportLocation(*currentLocation);
- }
+ if (mGnssFd != -1 && currentLocation != nullptr) {
+ // Only report location if the return from hardware is valid
+ this->reportLocation(*currentLocation);
} else {
if (sGnssCallback_2_1 != nullptr || sGnssCallback_2_0 != nullptr) {
const auto location = Utils::getMockLocationV2_0();
@@ -230,8 +237,9 @@
}
template <class T_IGnss>
-hidl_vec<GnssSvInfo> GnssTemplate<T_IGnss>::filterBlacklistedSatellitesV2_1(
+hidl_vec<GnssSvInfo> GnssTemplate<T_IGnss>::filterBlocklistedSatellitesV2_1(
hidl_vec<GnssSvInfo> gnssSvInfoList) {
+ ALOGD("filterBlocklistedSatellitesV2_1");
for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) {
if (mGnssConfiguration->isBlacklistedV2_1(gnssSvInfoList[i])) {
gnssSvInfoList[i].v2_0.v1_0.svFlag &=
@@ -637,4 +645,59 @@
}
}
+template <class T_IGnss>
+Return<void> GnssTemplate<T_IGnss>::setLocation(const hidl_handle& fd,
+ const hidl_vec<hidl_string>& options) {
+ auto lat = gMockLatitudeDegrees;
+ auto lon = gMockLongitudeDegrees;
+ auto ele = gMockAltitudeMeters;
+
+ for (size_t i = 1; i < options.size(); ++i) {
+ std::string option = options[i];
+ if (option.rfind("lat=", 0) == 0) {
+ option = option.substr(4);
+ lat = stof(option);
+ } else if (option.rfind("lon=", 0) == 0) {
+ option = option.substr(4);
+ lon = stof(option);
+ } else if (option.rfind("ele=", 0) == 0) {
+ option = option.substr(4);
+ ele = stof(option);
+ } else {
+ dprintf(fd->data[0], "unsupported location argument: %s\n", option.c_str());
+ }
+ }
+
+ gMockLatitudeDegrees = lat;
+ gMockLongitudeDegrees = lon;
+ gMockAltitudeMeters = ele;
+
+ dprintf(fd->data[0], "mock location updated to lat=%f lon=%f ele=%f\n", gMockLatitudeDegrees,
+ gMockLongitudeDegrees, gMockAltitudeMeters);
+
+ return Void();
+}
+
+template <class T_IGnss>
+Return<void> GnssTemplate<T_IGnss>::help(const hidl_handle& fd) {
+ dprintf(fd->data[0],
+ "invalid option for Gnss HAL; valid options are:\n"
+ "location lat=.. lon=.. ele=..\n");
+ return Void();
+}
+
+template <class T_IGnss>
+Return<void> GnssTemplate<T_IGnss>::debug(const hidl_handle& fd,
+ const hidl_vec<hidl_string>& options) {
+ if (options.size() == 0) {
+ return help(fd);
+ } else if (options[0] == "location") {
+ return setLocation(fd, options);
+ } else {
+ return help(fd);
+ }
+
+ return Void();
+}
+
} // namespace android::hardware::gnss::common::implementation
diff --git a/gnss/common/utils/default/v2_1/GnssDebug.cpp b/gnss/common/utils/default/v2_1/GnssDebug.cpp
index 492b970..d78b0b6 100644
--- a/gnss/common/utils/default/v2_1/GnssDebug.cpp
+++ b/gnss/common/utils/default/v2_1/GnssDebug.cpp
@@ -19,6 +19,7 @@
#include <log/log.h>
#include "Constants.h"
+#include "MockLocation.h"
#include "v2_1/GnssDebug.h"
using namespace ::android::hardware::gnss::common;
@@ -29,9 +30,9 @@
Return<void> GnssDebug::getDebugData(V1_0::IGnssDebug::getDebugData_cb _hidl_cb) {
PositionDebug positionDebug = {
.valid = true,
- .latitudeDegrees = kMockLatitudeDegrees,
- .longitudeDegrees = kMockLongitudeDegrees,
- .altitudeMeters = kMockAltitudeMeters,
+ .latitudeDegrees = gMockLatitudeDegrees,
+ .longitudeDegrees = gMockLongitudeDegrees,
+ .altitudeMeters = gMockAltitudeMeters,
.speedMetersPerSec = kMockSpeedMetersPerSec,
.bearingDegrees = kMockBearingDegrees,
.horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
diff --git a/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h b/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h
index d057c61..1439158 100644
--- a/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h
+++ b/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h
@@ -119,7 +119,7 @@
* SetUpGnssCallback:
* Set GnssCallback and verify the result.
*/
- void SetUpGnssCallback();
+ virtual void SetUpGnssCallback();
/*
* StartAndCheckFirstLocation:
diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp
index e594233..22e609d 100644
--- a/graphics/common/aidl/Android.bp
+++ b/graphics/common/aidl/Android.bp
@@ -6,6 +6,7 @@
enabled: true,
support_system_process: true,
},
+ vndk_use_version: "2",
srcs: [
"android/hardware/graphics/common/*.aidl",
],
diff --git a/graphics/mapper/2.0/utils/hal/include/mapper-hal/2.0/Mapper.h b/graphics/mapper/2.0/utils/hal/include/mapper-hal/2.0/Mapper.h
index 8134174..0067105 100644
--- a/graphics/mapper/2.0/utils/hal/include/mapper-hal/2.0/Mapper.h
+++ b/graphics/mapper/2.0/utils/hal/include/mapper-hal/2.0/Mapper.h
@@ -85,11 +85,7 @@
return Error::BAD_BUFFER;
}
- Error error = mHal->freeBuffer(bufferHandle);
- if (error == Error::NONE) {
- removeImportedBuffer(buffer);
- }
- return error;
+ return freeImportedBuffer(bufferHandle);
}
Return<void> lock(void* buffer, uint64_t cpuUsage, const V2_0::IMapper::Rect& accessRegion,
@@ -160,8 +156,8 @@
return static_cast<void*>(bufferHandle);
}
- virtual native_handle_t* removeImportedBuffer(void* buffer) {
- return static_cast<native_handle_t*>(buffer);
+ virtual Error freeImportedBuffer(native_handle_t* bufferHandle) {
+ return mHal->freeBuffer(bufferHandle);
}
virtual native_handle_t* getImportedBuffer(void* buffer) const {
diff --git a/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/GrallocLoader.h b/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/GrallocLoader.h
index 85a91c3..f2e0064 100644
--- a/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/GrallocLoader.h
+++ b/graphics/mapper/2.0/utils/passthrough/include/mapper-passthrough/2.0/GrallocLoader.h
@@ -56,17 +56,14 @@
return *singleton;
}
+ std::mutex* getMutex() { return &mMutex; }
+
void* add(native_handle_t* bufferHandle) {
std::lock_guard<std::mutex> lock(mMutex);
return mBufferHandles.insert(bufferHandle).second ? bufferHandle : nullptr;
}
- native_handle_t* remove(void* buffer) {
- auto bufferHandle = static_cast<native_handle_t*>(buffer);
-
- std::lock_guard<std::mutex> lock(mMutex);
- return mBufferHandles.erase(bufferHandle) == 1 ? bufferHandle : nullptr;
- }
+ void removeLocked(native_handle* bufferHandle) { mBufferHandles.erase(bufferHandle); }
native_handle_t* get(void* buffer) {
auto bufferHandle = static_cast<native_handle_t*>(buffer);
@@ -95,8 +92,13 @@
return GrallocImportedBufferPool::getInstance().add(bufferHandle);
}
- native_handle_t* removeImportedBuffer(void* buffer) override {
- return GrallocImportedBufferPool::getInstance().remove(buffer);
+ Error freeImportedBuffer(native_handle_t* bufferHandle) override {
+ std::lock_guard<std::mutex> lock(*GrallocImportedBufferPool::getInstance().getMutex());
+ Error error = this->mHal->freeBuffer(bufferHandle);
+ if (error == Error::NONE) {
+ GrallocImportedBufferPool::getInstance().removeLocked(bufferHandle);
+ }
+ return error;
}
native_handle_t* getImportedBuffer(void* buffer) const override {
diff --git a/graphics/mapper/2.1/utils/hal/include/mapper-hal/2.1/Mapper.h b/graphics/mapper/2.1/utils/hal/include/mapper-hal/2.1/Mapper.h
index 038f572..b4a2bedc 100644
--- a/graphics/mapper/2.1/utils/hal/include/mapper-hal/2.1/Mapper.h
+++ b/graphics/mapper/2.1/utils/hal/include/mapper-hal/2.1/Mapper.h
@@ -46,7 +46,7 @@
return Error::BAD_BUFFER;
}
- return mHal->validateBufferSize(bufferHandle, descriptorInfo, stride);
+ return this->mHal->validateBufferSize(bufferHandle, descriptorInfo, stride);
}
Return<void> getTransportSize(void* buffer, IMapper::getTransportSize_cb hidl_cb) {
@@ -58,7 +58,7 @@
uint32_t numFds = 0;
uint32_t numInts = 0;
- Error error = mHal->getTransportSize(bufferHandle, &numFds, &numInts);
+ Error error = this->mHal->getTransportSize(bufferHandle, &numFds, &numInts);
hidl_cb(error, numFds, numInts);
return Void();
}
@@ -66,7 +66,7 @@
Return<void> createDescriptor_2_1(const IMapper::BufferDescriptorInfo& descriptorInfo,
IMapper::createDescriptor_2_1_cb hidl_cb) override {
BufferDescriptor descriptor;
- Error error = mHal->createDescriptor_2_1(descriptorInfo, &descriptor);
+ Error error = this->mHal->createDescriptor_2_1(descriptorInfo, &descriptor);
hidl_cb(error, descriptor);
return Void();
}
@@ -74,7 +74,6 @@
private:
using BaseType2_0 = V2_0::hal::detail::MapperImpl<Interface, Hal>;
using BaseType2_0::getImportedBuffer;
- using BaseType2_0::mHal;
};
} // namespace detail
diff --git a/graphics/mapper/4.0/vts/functional/Android.bp b/graphics/mapper/4.0/vts/functional/Android.bp
index 03abc89..8bda425 100644
--- a/graphics/mapper/4.0/vts/functional/Android.bp
+++ b/graphics/mapper/4.0/vts/functional/Android.bp
@@ -19,7 +19,7 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalGraphicsMapperV4_0TargetTest.cpp"],
static_libs: [
- "android.hardware.graphics.common-ndk_platform",
+ "android.hardware.graphics.common-unstable-ndk_platform",
"android.hardware.graphics.mapper@4.0-vts",
"libgralloctypes",
"libsync",
diff --git a/health/1.0/default/Android.bp b/health/1.0/default/Android.bp
index b815eae..aab9cc7 100644
--- a/health/1.0/default/Android.bp
+++ b/health/1.0/default/Android.bp
@@ -4,7 +4,7 @@
recovery_available: true,
srcs: ["convert.cpp"],
include_dirs: [
- "system/core/base/include",
+ "system/libbase/include",
],
header_libs: ["libhealthd_headers"],
export_header_lib_headers: ["libhealthd_headers"],
diff --git a/health/1.0/default/android.hardware.health@1.0-service.rc b/health/1.0/default/android.hardware.health@1.0-service.rc
index 405784f..569dc88 100644
--- a/health/1.0/default/android.hardware.health@1.0-service.rc
+++ b/health/1.0/default/android.hardware.health@1.0-service.rc
@@ -2,4 +2,4 @@
class hal
user system
group system
- capabilities WAKE_ALARM
+ capabilities WAKE_ALARM BLOCK_SUSPEND
diff --git a/health/1.0/default/libhealthd/Android.bp b/health/1.0/default/libhealthd/Android.bp
index a90d50d..43463eb 100644
--- a/health/1.0/default/libhealthd/Android.bp
+++ b/health/1.0/default/libhealthd/Android.bp
@@ -6,6 +6,6 @@
vendor_available: true,
recovery_available: true,
cflags: ["-Werror"],
- include_dirs: ["system/core/base/include"],
+ include_dirs: ["system/libbase/include"],
header_libs: ["libhealthd_headers"],
}
diff --git a/health/2.1/default/android.hardware.health@2.1-service.rc b/health/2.1/default/android.hardware.health@2.1-service.rc
index b6d9e3b..8728257 100644
--- a/health/2.1/default/android.hardware.health@2.1-service.rc
+++ b/health/2.1/default/android.hardware.health@2.1-service.rc
@@ -2,5 +2,5 @@
class hal charger
user system
group system
- capabilities WAKE_ALARM
+ capabilities WAKE_ALARM BLOCK_SUSPEND
file /dev/kmsg w
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_api.cpp b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp
index 6c7870d..5359a87 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_api.cpp
+++ b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp
@@ -61,10 +61,11 @@
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
- ASSERT_TRUE(
- CheckAnyOfErrors(sapCb->sapResultCode,
- {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_ALREADY_POWERED_OFF,
- SapResultCode::CARD_NOT_ACCESSSIBLE, SapResultCode::CARD_REMOVED}));
+ ASSERT_TRUE(CheckAnyOfErrors(
+ sapCb->sapResultCode,
+ {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_ALREADY_POWERED_OFF,
+ SapResultCode::CARD_NOT_ACCESSSIBLE, SapResultCode::CARD_REMOVED,
+ SapResultCode::SUCCESS}));
LOG(DEBUG) << "apduReq finished";
}
@@ -79,10 +80,10 @@
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
- ASSERT_TRUE(
- CheckAnyOfErrors(sapCb->sapResultCode,
- {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE,
- SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED}));
+ ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode,
+ {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE,
+ SapResultCode::CARD_ALREADY_POWERED_OFF,
+ SapResultCode::CARD_REMOVED, SapResultCode::SUCCESS}));
LOG(DEBUG) << "transferAtrReq finished";
}
@@ -98,10 +99,11 @@
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
- ASSERT_TRUE(CheckAnyOfErrors(
- sapCb->sapResultCode, {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE,
- SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED,
- SapResultCode::CARD_ALREADY_POWERED_ON}));
+ ASSERT_TRUE(
+ CheckAnyOfErrors(sapCb->sapResultCode,
+ {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE,
+ SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED,
+ SapResultCode::CARD_ALREADY_POWERED_ON, SapResultCode::SUCCESS}));
LOG(DEBUG) << "powerReq finished";
}
@@ -117,9 +119,10 @@
EXPECT_EQ(sapCb->sapResponseToken, token);
ASSERT_TRUE(
- CheckAnyOfErrors(sapCb->sapResultCode,
- {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE,
- SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED}));
+ CheckAnyOfErrors(sapCb->sapResultCode,
+ {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE,
+ SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED,
+ SapResultCode::SUCCESS}));
LOG(DEBUG) << "resetSimReq finished";
}
@@ -134,8 +137,9 @@
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
- ASSERT_TRUE(CheckAnyOfErrors(
- sapCb->sapResultCode, {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE}));
+ ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode,
+ {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE,
+ SapResultCode::SUCCESS}));
LOG(DEBUG) << "transferCardReaderStatusReq finished";
}
@@ -151,6 +155,7 @@
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
- EXPECT_EQ(SapResultCode::NOT_SUPPORTED, sapCb->sapResultCode);
+ ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode,
+ {SapResultCode::NOT_SUPPORTED, SapResultCode::SUCCESS}));
LOG(DEBUG) << "setTransferProtocolReq finished";
}
diff --git a/radio/1.6/IRadio.hal b/radio/1.6/IRadio.hal
index c3f15f4..ca40a17 100644
--- a/radio/1.6/IRadio.hal
+++ b/radio/1.6/IRadio.hal
@@ -16,6 +16,9 @@
package android.hardware.radio@1.6;
+
+import @1.0::CdmaSmsMessage;
+import @1.0::GsmSmsMessage;
import @1.2::DataRequestReason;
import @1.5::IRadio;
import @1.5::AccessNetwork;
@@ -32,6 +35,36 @@
*/
interface IRadio extends @1.5::IRadio {
/**
+ * Toggle radio on and off (for "airplane" mode)
+ * If the radio is turned off/on the radio modem subsystem
+ * is expected return to an initialized state. For instance,
+ * any voice and data calls must be terminated and all associated
+ * lists emptied.
+ *
+ * When setting radio power on to exit from airplane mode to place an emergency call on this
+ * logical modem, powerOn, forEmergencyCall and preferredForEmergencyCall must be true. In
+ * this case, this modem is optimized to scan only emergency call bands, until:
+ * 1) Emergency call is completed; or
+ * 2) Another setRadioPower_1_5 is issued with forEmergencyCall being false or
+ * preferredForEmergencyCall being false; or
+ * 3) Timeout after 30 seconds if dial or emergencyDial is not called.
+ * Once one of these conditions is reached, the modem should move into normal operation.
+ *
+ * @param serial Serial number of request.
+ * @param powerOn To turn on radio -> on = true, to turn off radio -> on = false.
+ * @param forEmergencyCall To indication to radio if this request is due to emergency call.
+ * No effect if powerOn is false.
+ * @param preferredForEmergencyCall indicate whether the following emergency call will be sent
+ * on this modem or not. No effect if forEmergencyCall is false, or powerOn is false.
+ *
+ * Response callback is IRadioConfigResponse. setRadioPowerResponse_1_6.
+
+ * Note this API is the same as the 1.5
+ */
+ oneway setRadioPower_1_6(int32_t serial, bool powerOn, bool forEmergencyCall,
+ bool preferredForEmergencyCall);
+
+ /**
* Returns the data call list. An entry is added when a setupDataCall() is issued and removed
* on a deactivateDataCall(). The list is emptied when setRadioPower() off/on issued or when
* the vendor HAL or modem crashes.
@@ -87,4 +120,89 @@
oneway setupDataCall_1_6(int32_t serial, AccessNetwork accessNetwork,
DataProfileInfo dataProfileInfo, bool roamingAllowed,
DataRequestReason reason, vec<LinkAddress> addresses, vec<string> dnses);
+
+ /**
+ * Send an SMS message
+ *
+ * @param serial Serial number of request.
+ * @param message GsmSmsMessage as defined in types.hal
+ *
+ * Response function is IRadioResponse.sendSmsResponse_1_6()
+ *
+ * Note this API is the same as the 1.0
+ *
+ * Based on the return error, caller decides to resend if sending sms
+ * fails. RadioError:SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332)
+ * and RadioError:GENERIC_FAILURE means no retry (i.e. error cause is 500)
+ */
+ oneway sendSms_1_6(int32_t serial, GsmSmsMessage message);
+
+ /**
+ * Send an SMS message. Identical to sendSms_1_6,
+ * except that more messages are expected to be sent soon. If possible,
+ * keep SMS relay protocol link open (eg TS 27.005 AT+CMMS command)
+ *
+ * @param serial Serial number of request.
+ * @param message GsmSmsMessage as defined in types.hal
+ *
+ * Response function is IRadioResponse.sendSMSExpectMoreResponse_1_6()
+ *
+ * Note this API is the same as the 1.0
+ *
+ * Based on the return error, caller decides to resend if sending sms
+ * fails. RadioError:SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332)
+ * and RadioError:GENERIC_FAILURE means no retry (i.e. error cause is 500)
+ */
+ oneway sendSMSExpectMore_1_6(int32_t serial, GsmSmsMessage message);
+
+ /**
+ * Send a CDMA SMS message
+ *
+ * @param serial Serial number of request.
+ * @param sms Cdma Sms to be sent described by CdmaSmsMessage in types.hal
+ *
+ * Response callback is IRadioResponse.sendCdmaSmsResponse_1_6()
+ *
+ * Note this API is the same as the 1.0
+ *
+ */
+ oneway sendCdmaSms_1_6(int32_t serial, CdmaSmsMessage sms);
+
+ /**
+ * Send an SMS message. Identical to sendCdmaSms_1_6,
+ * except that more messages are expected to be sent soon.
+ *
+ * @param serial Serial number of request.
+ * @param sms Cdma Sms to be sent described by CdmaSmsMessage in types.hal
+ *
+ * Response callback is IRadioResponse.sendCdmaSMSExpectMoreResponse_1_6()
+ *
+ * Note this API is the same as the 1.5
+ *
+ */
+ oneway sendCdmaSmsExpectMore_1_6(int32_t serial, CdmaSmsMessage sms);
+
+ /**
+ * Enable or disable E-UTRA-NR dual connectivity. If disabled then UE will not connect
+ * to secondary carrier.
+ *
+ * @param serial Serial number of request.
+ * @param nrDualConnectivityState expected NR dual connectivity state.
+ * 1. Enable NR dual connectivity {NrDualConnectivityState:ENABLE}
+ * 2. Disable NR dual connectivity {NrDualConnectivityState:DISABLE}
+ * 3. Disable NR dual connectivity and force secondary cell to be released
+ * {NrDualConnectivityState:DISABLE_IMMEDIATE}
+
+ * Response callback is IRadioResponse.enableNRDualConnectivityResponse()
+ */
+ oneway enableNrDualConnectivity(int32_t serial,
+ NrDualConnectivityState nrDualConnectivityState);
+
+ /**
+ * Is E-UTRA-NR Dual Connectivity enabled
+ *
+ * @param serial Serial number of request.
+ * Response callback is IRadioResponse.isNRDualConnectivityEnabledResponse()
+ */
+ oneway isNrDualConnectivityEnabled(int32_t serial);
};
diff --git a/radio/1.6/IRadioResponse.hal b/radio/1.6/IRadioResponse.hal
index e91b9c1..4ff7e47 100644
--- a/radio/1.6/IRadioResponse.hal
+++ b/radio/1.6/IRadioResponse.hal
@@ -16,7 +16,8 @@
package android.hardware.radio@1.6;
-import @1.0::RadioResponseInfo;
+import @1.0::SendSmsResult;
+import @1.6::RadioResponseInfo;
import @1.5::IRadioResponse;
import @1.6::SetupDataCallResult;
@@ -26,6 +27,18 @@
interface IRadioResponse extends @1.5::IRadioResponse {
/**
* @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:RF_HARDWARE_ISSUE
+ * RadioError:NO_RF_CALIBRATION_INFO
+ */
+ oneway setRadioPowerResponse_1_6(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
* @param dcResponse SetupDataCallResult defined in types.hal
*
* Valid errors returned:
@@ -54,4 +67,159 @@
* RadioError:SIM_ABSENT
*/
oneway getDataCallListResponse_1_6(RadioResponseInfo info, vec<SetupDataCallResult> dcResponse);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param sms Response to sms sent as defined by SendSmsResult in types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SMS_SEND_FAIL_RETRY
+ * RadioError:NETWORK_REJECT
+ * RadioError:INVALID_STATE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_MEMORY
+ * RadioError:REQUEST_RATE_LIMITED
+ * RadioError:INVALID_SMS_FORMAT
+ * RadioError:SYSTEM_ERR
+ * RadioError:ENCODING_ERR
+ * RadioError:INVALID_SMSC_ADDRESS
+ * RadioError:MODEM_ERR
+ * RadioError:NETWORK_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:NETWORK_NOT_READY
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:SIM_ABSENT
+ * RadioError:ACCESS_BARRED
+ * RadioError:BLOCKED_DUE_TO_CALL
+ */
+ oneway sendSmsResponse_1_6(RadioResponseInfo info, SendSmsResult sms);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param sms Response to sms sent as defined by SendSmsResult in types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SMS_SEND_FAIL_RETRY
+ * RadioError:NETWORK_REJECT
+ * RadioError:INVALID_STATE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_MEMORY
+ * RadioError:REQUEST_RATE_LIMITED
+ * RadioError:INVALID_SMS_FORMAT
+ * RadioError:SYSTEM_ERR
+ * RadioError:FDN_CHECK_FAILURE
+ * RadioError:ENCODING_ERR
+ * RadioError:INVALID_SMSC_ADDRESS
+ * RadioError:MODEM_ERR
+ * RadioError:NETWORK_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:NETWORK_NOT_READY
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:SIM_ABSENT
+ * RadioError:ACCESS_BARRED
+ * RadioError:BLOCKED_DUE_TO_CALL
+ */
+ oneway sendSMSExpectMoreResponse_1_6(RadioResponseInfo info, SendSmsResult sms);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param sms Sms result struct as defined by SendSmsResult in types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:SMS_SEND_FAIL_RETRY
+ * RadioError:NETWORK_REJECT
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:REQUEST_RATE_LIMITED
+ * RadioError:INVALID_SMS_FORMAT
+ * RadioError:SYSTEM_ERR
+ * RadioError:FDN_CHECK_FAILURE
+ * RadioError:MODEM_ERR
+ * RadioError:NETWORK_ERR
+ * RadioError:ENCODING_ERR
+ * RadioError:INVALID_SMSC_ADDRESS
+ * RadioError:INTERNAL_ERR
+ * RadioError:SYSTEM_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:ENCODING_ERR
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:SIM_ABSENT
+ * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
+ * RadioError:ACCESS_BARRED
+ * RadioError:BLOCKED_DUE_TO_CALL
+ */
+ oneway sendCdmaSmsResponse_1_6(RadioResponseInfo info, SendSmsResult sms);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param sms Response to sms sent as defined by SendSmsResult in types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SMS_SEND_FAIL_RETRY
+ * RadioError:NETWORK_REJECT
+ * RadioError:INVALID_STATE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_MEMORY
+ * RadioError:REQUEST_RATE_LIMITED
+ * RadioError:INVALID_SMS_FORMAT
+ * RadioError:SYSTEM_ERR
+ * RadioError:FDN_CHECK_FAILURE
+ * RadioError:ENCODING_ERR
+ * RadioError:INVALID_SMSC_ADDRESS
+ * RadioError:MODEM_ERR
+ * RadioError:NETWORK_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:NETWORK_NOT_READY
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:SIM_ABSENT
+ * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED
+ * RadioError:ACCESS_BARRED
+ * RadioError:BLOCKED_DUE_TO_CALL
+ */
+ oneway sendCdmaSmsExpectMoreResponse_1_6(RadioResponseInfo info, SendSmsResult sms);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ */
+ oneway enableNrDualConnectivityResponse(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * @param isEnabled Indicates whether NR dual connectivity is enabled or not, True if enabled
+ * else false.
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ */
+ oneway isNrDualConnectivityEnabledResponse(RadioResponseInfo info, bool isEnabled);
};
diff --git a/radio/1.6/types.hal b/radio/1.6/types.hal
index 4bd3cd6..07b4977 100644
--- a/radio/1.6/types.hal
+++ b/radio/1.6/types.hal
@@ -16,6 +16,8 @@
package android.hardware.radio@1.6;
+import @1.0::RadioError;
+import @1.0::RadioResponseType;
import @1.5::SetupDataCallResult;
import android.hidl.safe_union@1.0::Monostate;
@@ -98,6 +100,44 @@
MAX = 65535
};
+enum RadioError : @1.0::RadioError {
+ /** 1X voice and SMS are not allowed simulteneously. */
+ SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED = 67,
+
+ /** Access is barred. */
+ ACCESS_BARRED = 68,
+
+ /**
+ * SMS is blocked due to call control, e.g., resource unavailable
+ * in the SMR entity.
+ */
+ BLOCKED_DUE_TO_CALL = 69,
+
+ /**
+ * Returned from setRadioPowerResponse when detecting RF HW issues. Some RF
+ * Front-End(RFFE) components like antenna are considered critical for modem
+ * to provide telephony service. This RadioError is used when modem detect
+ * such RFFE problem.
+ */
+ RF_HARDWARE_ISSUE = 70,
+
+ /**
+ * Returned from setRadioPowerResponse when detecting no RF calibration
+ * issue. Unlike RF_HARDWARE_ISSUE, this is a SW problem and no HW repair is
+ * needed.
+ */
+ NO_RF_CALIBRATION_INFO = 71,
+};
+
+/**
+ * Overwritten from @1.0::RadioResponseInfo in order to update the RadioError to 1.6 version.
+ */
+struct RadioResponseInfo {
+ RadioResponseType type; // Response type
+ int32_t serial; // Serial number of the request
+ RadioError error; // Response error
+};
+
/**
* Defines range of ports. start and end are the first and last port numbers
* (inclusive) in the range. Both start and end are in QosPortRange.MIN to
@@ -215,3 +255,24 @@
/** Specifies the fallback mode on an IWLAN handover failure. */
HandoverFailureMode handoverFailureMode;
};
+
+/**
+ * NR Dual connectivity state
+ */
+enum NrDualConnectivityState: int32_t {
+ /**
+ * Enable NR dual connectivity. Enabled state does not mean dual connectivity
+ * is active. It means device is allowed to connect to both primary and secondary.
+ */
+ ENABLE = 1,
+ /**
+ * Disable NR dual connectivity. Disabled state does not mean secondary cell is released.
+ * Modem will release it only if current bearer is released to avoid radio link failure.
+ */
+ DISABLE = 2,
+ /**
+ * Disable NR dual connectivity and force secondary cell to be released if dual connectivity
+ * was active. This may result in radio link failure.
+ */
+ DISABLE_IMMEDIATE= 3,
+};
diff --git a/radio/1.6/vts/functional/Android.bp b/radio/1.6/vts/functional/Android.bp
index a6cfc6f..db90f88 100644
--- a/radio/1.6/vts/functional/Android.bp
+++ b/radio/1.6/vts/functional/Android.bp
@@ -23,6 +23,7 @@
"radio_response.cpp",
"radio_indication.cpp",
"VtsHalRadioV1_6TargetTest.cpp",
+ "vts_test_util_v1_6.cpp",
],
static_libs: [
"RadioVtsTestUtilBase",
@@ -37,5 +38,8 @@
"android.hardware.radio.config@1.1",
],
header_libs: ["radio.util.header@1.0"],
- test_suites: ["general-tests", "vts"]
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
}
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
index 0bfce4d..01236c6 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
@@ -63,14 +63,235 @@
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+ if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::SIM_ABSENT,
+ ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
+ ::android::hardware::radio::V1_6::RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::NONE,
+ ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
+ ::android::hardware::radio::V1_6::RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ }
+}
+
+/*
+ * Test IRadio_1_6.sendSms() for the response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, sendSms_1_6) {
+ LOG(DEBUG) << "sendSms";
+ serial = GetRandomSerialNumber();
+ GsmSmsMessage msg;
+ msg.smscPdu = "";
+ msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+
+ radio_v1_6->sendSms(serial, msg);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
- {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
- } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) {
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
- {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
- RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS,
+ ::android::hardware::radio::V1_6::RadioError::INVALID_STATE,
+ ::android::hardware::radio::V1_6::RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ EXPECT_EQ(0, radioRsp_v1_6->sendSmsResult.errorCode);
}
+ LOG(DEBUG) << "sendSms finished";
+}
+
+/*
+ * Test IRadio_1_6.sendSMSExpectMore() for the response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, sendSMSExpectMore_1_6) {
+ LOG(DEBUG) << "sendSMSExpectMore";
+ serial = GetRandomSerialNumber();
+ GsmSmsMessage msg;
+ msg.smscPdu = "";
+ msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+
+ radio_v1_6->sendSMSExpectMore(serial, msg);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+
+ if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS,
+ ::android::hardware::radio::V1_6::RadioError::INVALID_STATE,
+ ::android::hardware::radio::V1_6::RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendSMSExpectMore finished";
+}
+
+/*
+ * Test IRadio_1_6.sendCdmaSms() for the response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, sendCdmaSms_1_6) {
+ LOG(DEBUG) << "sendCdmaSms";
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
+ cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
+ cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::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 = CdmaSmsSubaddressType::NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ android::hardware::radio::V1_0::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_v1_6->sendCdmaSms(serial, cdmaSmsMessage);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+
+ if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS,
+ ::android::hardware::radio::V1_6::RadioError::INVALID_STATE,
+ ::android::hardware::radio::V1_6::RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+ LOG(DEBUG) << "sendCdmaSms finished";
+}
+
+/*
+ * Test IRadio_1_6.sendCdmaSmsExpectMore() for the response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, sendCdmaSmsExpectMore_1_6) {
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
+ cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
+ cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::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 = CdmaSmsSubaddressType::NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ android::hardware::radio::V1_0::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_v1_6->sendCdmaSmsExpectMore(serial, cdmaSmsMessage);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+
+ if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS,
+ ::android::hardware::radio::V1_6::RadioError::INVALID_STATE,
+ ::android::hardware::radio::V1_6::RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+}
+
+/*
+ * Test IRadio.setRadioPower_1_6() for the response returned by
+ * IRadio.setRadioPowerResponse_1_6().
+ */
+TEST_P(RadioHidlTest_v1_6, setRadioPower_1_6_emergencyCall_cancelled) {
+ // Set radio power to off.
+ serial = GetRandomSerialNumber();
+ radio_v1_6->setRadioPower_1_6(serial, false, false, false);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+ EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error);
+
+ // Set radio power to on with forEmergencyCall being true. This should put modem to only scan
+ // emergency call bands.
+ serial = GetRandomSerialNumber();
+ radio_v1_6->setRadioPower_1_6(serial, true, true, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+ EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error);
+
+ // Set radio power to on with forEmergencyCall being false. This should put modem in regular
+ // operation modem.
+ serial = GetRandomSerialNumber();
+ radio_v1_6->setRadioPower_1_6(serial, true, false, false);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+ EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error);
+}
+
+/*
+ * Test IRadio.enableNrDualConnectivity() for the response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, enableNrDualConnectivity) {
+ serial = GetRandomSerialNumber();
+
+ Return<void> res =
+ radio_v1_6->enableNrDualConnectivity(serial, NrDualConnectivityState::DISABLE);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
+ ::android::hardware::radio::V1_6::RadioError::INTERNAL_ERR,
+ ::android::hardware::radio::V1_6::RadioError::NONE}));
+}
+
+/*
+ * Test IRadio.isNrDualConnectivityEnabled() for the response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, isNrDualConnectivityEnabled) {
+ serial = GetRandomSerialNumber();
+
+ Return<void> res = radio_v1_6->isNrDualConnectivityEnabled(serial);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
+ ::android::hardware::radio::V1_6::RadioError::INTERNAL_ERR,
+ ::android::hardware::radio::V1_6::RadioError::NONE}));
}
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_test.cpp b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp
index 114fd1a..79c3cde 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp
@@ -30,10 +30,11 @@
radio_v1_6->setResponseFunctions(radioRsp_v1_6, radioInd_v1_6);
- getDataCallList();
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
- EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
- EXPECT_EQ(RadioError::NONE, radioRsp_v1_6->rspInfo.error);
+ updateSimCardStatus();
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo_v1_0.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo_v1_0.serial);
+ EXPECT_EQ(::android::hardware::radio::V1_0::RadioError::NONE,
+ radioRsp_v1_6->rspInfo_v1_0.error);
sp<::android::hardware::radio::config::V1_1::IRadioConfig> radioConfig =
::android::hardware::radio::config::V1_1::IRadioConfig::getService();
@@ -73,6 +74,12 @@
return status;
}
+void RadioHidlTest_v1_6::updateSimCardStatus() {
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getIccCardStatus(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+}
+
void RadioHidlTest_v1_6::getDataCallList() {
serial = GetRandomSerialNumber();
radio_v1_6->getDataCallList_1_6(serial);
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
index 95a2d09..784bcd9 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
+++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
@@ -33,7 +33,7 @@
#include <android/hardware/radio/1.6/IRadioResponse.h>
#include <android/hardware/radio/1.6/types.h>
-#include "vts_test_util.h"
+#include "vts_test_util_v1_6.h"
using namespace ::android::hardware::radio::V1_6;
using namespace ::android::hardware::radio::V1_5;
@@ -66,14 +66,19 @@
public:
hidl_vec<RadioBandMode> radioBandModes;
- RadioResponseInfo rspInfo;
+ ::android::hardware::radio::V1_0::RadioResponseInfo rspInfo_v1_0;
+ ::android::hardware::radio::V1_6::RadioResponseInfo rspInfo;
// Call
hidl_vec<::android::hardware::radio::V1_2::Call> currentCalls;
+ // Sms
+ SendSmsResult sendSmsResult;
+
// Modem
bool isModemEnabled;
bool enableModemResponseToggle;
+ bool isNRDualConnectivityEnabled;
::android::hardware::hidl_bitfield<::android::hardware::radio::V1_4::RadioAccessFamily>
networkTypeBitmapResponse;
@@ -99,516 +104,673 @@
virtual ~RadioResponse_v1_6() = default;
Return<void> getIccCardStatusResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_0::CardStatus& cardStatus);
- Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
- int32_t remainingRetries);
+ Return<void> supplyIccPinForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries);
- Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
- int32_t remainingRetries);
+ Return<void> supplyIccPukForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries);
- Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
- int32_t remainingRetries);
+ Return<void> supplyIccPin2ForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries);
- Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
- int32_t remainingRetries);
+ Return<void> supplyIccPuk2ForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries);
- Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
- int32_t remainingRetries);
+ Return<void> changeIccPinForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries);
- Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
- int32_t remainingRetries);
+ Return<void> changeIccPin2ForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries);
- Return<void> supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info,
- int32_t remainingRetries);
+ Return<void> supplyNetworkDepersonalizationResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries);
Return<void> getCurrentCallsResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::Call>& calls);
- Return<void> dialResponse(const RadioResponseInfo& info);
+ Return<void> dialResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getIMSIForAppResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_string& imsi);
+ Return<void> getIMSIForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& imsi);
- Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
+ Return<void> hangupConnectionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info);
+ Return<void> hangupWaitingOrBackgroundResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> hangupForegroundResumeBackgroundResponse(const RadioResponseInfo& info);
+ Return<void> hangupForegroundResumeBackgroundResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo& info);
+ Return<void> switchWaitingOrHoldingAndActiveResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> conferenceResponse(const RadioResponseInfo& info);
+ Return<void> conferenceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> rejectCallResponse(const RadioResponseInfo& info);
+ Return<void> rejectCallResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info,
- const LastCallFailCauseInfo& failCauseInfo);
+ Return<void> getLastCallFailCauseResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const LastCallFailCauseInfo& failCauseInfo);
Return<void> getSignalStrengthResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_0::SignalStrength& sigStrength);
Return<void> getVoiceRegistrationStateResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_0::VoiceRegStateResult& voiceRegResponse);
Return<void> getDataRegistrationStateResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_0::DataRegStateResult& dataRegResponse);
- Return<void> getOperatorResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_string& longName,
- const ::android::hardware::hidl_string& shortName,
- const ::android::hardware::hidl_string& numeric);
+ Return<void> getOperatorResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& longName,
+ const ::android::hardware::hidl_string& shortName,
+ const ::android::hardware::hidl_string& numeric);
- Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
+ Return<void> setRadioPowerResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> sendDtmfResponse(const RadioResponseInfo& info);
+ Return<void> sendDtmfResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> sendSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+ Return<void> sendSmsResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const SendSmsResult& sms);
- Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+ Return<void> sendSMSExpectMoreResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const SendSmsResult& sms);
Return<void> setupDataCallResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const android::hardware::radio::V1_0::SetupDataCallResult& dcResponse);
- Return<void> iccIOForAppResponse(const RadioResponseInfo& info, const IccIoResult& iccIo);
+ Return<void> iccIOForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const IccIoResult& iccIo);
- Return<void> sendUssdResponse(const RadioResponseInfo& info);
+ Return<void> sendUssdResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
+ Return<void> cancelPendingUssdResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m);
+ Return<void> getClirResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ int32_t n, int32_t m);
- Return<void> setClirResponse(const RadioResponseInfo& info);
+ Return<void> setClirResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getCallForwardStatusResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
- Return<void> setCallForwardResponse(const RadioResponseInfo& info);
+ Return<void> setCallForwardResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getCallWaitingResponse(const RadioResponseInfo& info, bool enable,
- int32_t serviceClass);
+ Return<void> getCallWaitingResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, bool enable,
+ int32_t serviceClass);
- Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
+ Return<void> setCallWaitingResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info);
+ Return<void> acknowledgeLastIncomingGsmSmsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> acceptCallResponse(const RadioResponseInfo& info);
+ Return<void> acceptCallResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
+ Return<void> deactivateDataCallResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t response);
+ Return<void> getFacilityLockForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, int32_t response);
- Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t retry);
+ Return<void> setFacilityLockForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, int32_t retry);
- Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
+ Return<void> setBarringPasswordResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info, bool manual);
+ Return<void> getNetworkSelectionModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, bool manual);
- Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info);
+ Return<void> setNetworkSelectionModeAutomaticResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info);
+ Return<void> setNetworkSelectionModeManualResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getAvailableNetworksResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
- Return<void> startDtmfResponse(const RadioResponseInfo& info);
+ Return<void> startDtmfResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> stopDtmfResponse(const RadioResponseInfo& info);
+ Return<void> stopDtmfResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getBasebandVersionResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_string& version);
+ Return<void> getBasebandVersionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& version);
- Return<void> separateConnectionResponse(const RadioResponseInfo& info);
+ Return<void> separateConnectionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setMuteResponse(const RadioResponseInfo& info);
+ Return<void> setMuteResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
+ Return<void> getMuteResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ bool enable);
- Return<void> getClipResponse(const RadioResponseInfo& info, ClipStatus status);
+ Return<void> getClipResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ ClipStatus status);
Return<void> getDataCallListResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<
android::hardware::radio::V1_0::SetupDataCallResult>& dcResponse);
- Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_vec<uint8_t>& data);
+ Return<void> sendOemRilRequestRawResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<uint8_t>& data);
Return<void> sendOemRilRequestStringsResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data);
- Return<void> setSuppServiceNotificationsResponse(const RadioResponseInfo& info);
+ Return<void> setSuppServiceNotificationsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index);
+ Return<void> writeSmsToSimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, int32_t index);
- Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
+ Return<void> deleteSmsOnSimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setBandModeResponse(const RadioResponseInfo& info);
+ Return<void> setBandModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getAvailableBandModesResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
- Return<void> sendEnvelopeResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_string& commandResponse);
+ Return<void> sendEnvelopeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& commandResponse);
- Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
+ Return<void> sendTerminalResponseToSimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> handleStkCallSetupRequestFromSimResponse(const RadioResponseInfo& info);
+ Return<void> handleStkCallSetupRequestFromSimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
+ Return<void> explicitCallTransferResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
+ Return<void> setPreferredNetworkTypeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
- PreferredNetworkType nwType);
+ Return<void> getPreferredNetworkTypeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ PreferredNetworkType nwType);
Return<void> getNeighboringCidsResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<NeighboringCell>& cells);
- Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
+ Return<void> setLocationUpdatesResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
+ Return<void> setCdmaSubscriptionSourceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
+ Return<void> setCdmaRoamingPreferenceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
- CdmaRoamingType type);
+ Return<void> getCdmaRoamingPreferenceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, CdmaRoamingType type);
- Return<void> setTTYModeResponse(const RadioResponseInfo& info);
+ Return<void> setTTYModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
+ Return<void> getTTYModeResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ TtyMode mode);
- Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
+ Return<void> setPreferredVoicePrivacyResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable);
+ Return<void> getPreferredVoicePrivacyResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, bool enable);
- Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
+ Return<void> sendCDMAFeatureCodeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
+ Return<void> sendBurstDtmfResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+ Return<void> sendCdmaSmsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const SendSmsResult& sms);
- Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info);
+ Return<void> acknowledgeLastIncomingCdmaSmsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getGsmBroadcastConfigResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
- Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
+ Return<void> setGsmBroadcastConfigResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
+ Return<void> setGsmBroadcastActivationResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getCdmaBroadcastConfigResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
- Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
+ Return<void> setCdmaBroadcastConfigResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info);
+ Return<void> setCdmaBroadcastActivationResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_string& mdn,
- const ::android::hardware::hidl_string& hSid,
- const ::android::hardware::hidl_string& hNid,
- const ::android::hardware::hidl_string& min,
- const ::android::hardware::hidl_string& prl);
+ Return<void> getCDMASubscriptionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& mdn,
+ const ::android::hardware::hidl_string& hSid,
+ const ::android::hardware::hidl_string& hNid,
+ const ::android::hardware::hidl_string& min,
+ const ::android::hardware::hidl_string& prl);
- Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index);
+ Return<void> writeSmsToRuimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, uint32_t index);
- Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
+ Return<void> deleteSmsOnRuimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_string& imei,
- const ::android::hardware::hidl_string& imeisv,
- const ::android::hardware::hidl_string& esn,
- const ::android::hardware::hidl_string& meid);
+ Return<void> getDeviceIdentityResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& imei,
+ const ::android::hardware::hidl_string& imeisv,
+ const ::android::hardware::hidl_string& esn,
+ const ::android::hardware::hidl_string& meid);
- Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
+ Return<void> exitEmergencyCallbackModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getSmscAddressResponse(const RadioResponseInfo& info,
- const ::android::hardware::hidl_string& smsc);
+ Return<void> getSmscAddressResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& smsc);
- Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
+ Return<void> setSmscAddressResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
+ Return<void> reportSmsMemoryStatusResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
+ Return<void> reportStkServiceIsRunningResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
- CdmaSubscriptionSource source);
+ Return<void> getCdmaSubscriptionSourceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ CdmaSubscriptionSource source);
Return<void> requestIsimAuthenticationResponse(
- const RadioResponseInfo& info, const ::android::hardware::hidl_string& response);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& response);
- Return<void> acknowledgeIncomingGsmSmsWithPduResponse(const RadioResponseInfo& info);
+ Return<void> acknowledgeIncomingGsmSmsWithPduResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
- const IccIoResult& iccIo);
+ Return<void> sendEnvelopeWithStatusResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const IccIoResult& iccIo);
Return<void> getVoiceRadioTechnologyResponse(
- const RadioResponseInfo& info, ::android::hardware::radio::V1_0::RadioTechnology rat);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ ::android::hardware::radio::V1_0::RadioTechnology rat);
Return<void> getCellInfoListResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::CellInfo>&
cellInfo);
- Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
+ Return<void> setCellInfoListRateResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
+ Return<void> setInitialAttachApnResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info, bool isRegistered,
- RadioTechnologyFamily ratFamily);
+ Return<void> getImsRegistrationStateResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, bool isRegistered,
+ RadioTechnologyFamily ratFamily);
- Return<void> sendImsSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+ Return<void> sendImsSmsResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const SendSmsResult& sms);
- Return<void> iccTransmitApduBasicChannelResponse(const RadioResponseInfo& info,
- const IccIoResult& result);
+ Return<void> iccTransmitApduBasicChannelResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const IccIoResult& result);
Return<void> iccOpenLogicalChannelResponse(
- const RadioResponseInfo& info, int32_t channelId,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, int32_t channelId,
const ::android::hardware::hidl_vec<int8_t>& selectResponse);
- Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
+ Return<void> iccCloseLogicalChannelResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> iccTransmitApduLogicalChannelResponse(const RadioResponseInfo& info,
- const IccIoResult& result);
+ Return<void> iccTransmitApduLogicalChannelResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const IccIoResult& result);
- Return<void> nvReadItemResponse(const RadioResponseInfo& info,
+ Return<void> nvReadItemResponse(const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_string& result);
- Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
+ Return<void> nvWriteItemResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
+ Return<void> nvWriteCdmaPrlResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
+ Return<void> nvResetConfigResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
+ Return<void> setUiccSubscriptionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
+ Return<void> setDataAllowedResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getHardwareConfigResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<HardwareConfig>& config);
- Return<void> requestIccSimAuthenticationResponse(const RadioResponseInfo& info,
- const IccIoResult& result);
+ Return<void> requestIccSimAuthenticationResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const IccIoResult& result);
- Return<void> setDataProfileResponse(const RadioResponseInfo& info);
+ Return<void> setDataProfileResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> requestShutdownResponse(const RadioResponseInfo& info);
+ Return<void> requestShutdownResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getRadioCapabilityResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const android::hardware::radio::V1_0::RadioCapability& rc);
Return<void> setRadioCapabilityResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const android::hardware::radio::V1_0::RadioCapability& rc);
- Return<void> startLceServiceResponse(const RadioResponseInfo& info,
- const LceStatusInfo& statusInfo);
+ Return<void> startLceServiceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const LceStatusInfo& statusInfo);
- Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
- const LceStatusInfo& statusInfo);
+ Return<void> stopLceServiceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const LceStatusInfo& statusInfo);
- Return<void> pullLceDataResponse(const RadioResponseInfo& info, const LceDataInfo& lceInfo);
+ Return<void> pullLceDataResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const LceDataInfo& lceInfo);
- Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info,
- const ActivityStatsInfo& activityInfo);
+ Return<void> getModemActivityInfoResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ActivityStatsInfo& activityInfo);
- Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info, int32_t numAllowed);
+ Return<void> setAllowedCarriersResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, int32_t numAllowed);
- Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info, bool allAllowed,
- const CarrierRestrictions& carriers);
+ Return<void> getAllowedCarriersResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, bool allAllowed,
+ const CarrierRestrictions& carriers);
- Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
+ Return<void> sendDeviceStateResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
+ Return<void> setIndicationFilterResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
+ Return<void> setSimCardPowerResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> acknowledgeRequest(int32_t serial);
/* 1.1 Api */
- Return<void> setCarrierInfoForImsiEncryptionResponse(const RadioResponseInfo& info);
+ Return<void> setCarrierInfoForImsiEncryptionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setSimCardPowerResponse_1_1(const RadioResponseInfo& info);
+ Return<void> setSimCardPowerResponse_1_1(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> startNetworkScanResponse(const RadioResponseInfo& info);
+ Return<void> startNetworkScanResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> stopNetworkScanResponse(const RadioResponseInfo& info);
+ Return<void> stopNetworkScanResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> startKeepaliveResponse(const RadioResponseInfo& info,
- const KeepaliveStatus& status);
+ Return<void> startKeepaliveResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const KeepaliveStatus& status);
- Return<void> stopKeepaliveResponse(const RadioResponseInfo& info);
+ Return<void> stopKeepaliveResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
/* 1.2 Api */
- Return<void> setSignalStrengthReportingCriteriaResponse(const RadioResponseInfo& info);
+ Return<void> setSignalStrengthReportingCriteriaResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setLinkCapacityReportingCriteriaResponse(const RadioResponseInfo& info);
+ Return<void> setLinkCapacityReportingCriteriaResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getIccCardStatusResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::CardStatus& card_status);
Return<void> getCurrentCallsResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& calls);
Return<void> getSignalStrengthResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::SignalStrength& sig_strength);
Return<void> getSignalStrengthResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_4::SignalStrength& sig_strength);
Return<void> getCellInfoListResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>&
cellInfo);
Return<void> getVoiceRegistrationStateResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::VoiceRegStateResult& voiceRegResponse);
Return<void> getDataRegistrationStateResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::DataRegStateResult& dataRegResponse);
/* 1.3 Api */
- Return<void> setSystemSelectionChannelsResponse(const RadioResponseInfo& info);
+ Return<void> setSystemSelectionChannelsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> enableModemResponse(const RadioResponseInfo& info);
+ Return<void> enableModemResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getModemStackStatusResponse(const RadioResponseInfo& info, const bool enabled);
+ Return<void> getModemStackStatusResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, const bool enabled);
/* 1.4 Api */
- Return<void> emergencyDialResponse(const RadioResponseInfo& info);
+ Return<void> emergencyDialResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> startNetworkScanResponse_1_4(const RadioResponseInfo& info);
+ Return<void> startNetworkScanResponse_1_4(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getCellInfoListResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_4::CellInfo>&
cellInfo);
Return<void> getDataRegistrationStateResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_4::DataRegStateResult& dataRegResponse);
Return<void> getIccCardStatusResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_4::CardStatus& card_status);
Return<void> getPreferredNetworkTypeBitmapResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_bitfield<
::android::hardware::radio::V1_4::RadioAccessFamily>
networkTypeBitmap);
- Return<void> setPreferredNetworkTypeBitmapResponse(const RadioResponseInfo& info);
+ Return<void> setPreferredNetworkTypeBitmapResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getDataCallListResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<
::android::hardware::radio::V1_4::SetupDataCallResult>& dcResponse);
Return<void> setupDataCallResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const android::hardware::radio::V1_4::SetupDataCallResult& dcResponse);
- Return<void> setAllowedCarriersResponse_1_4(const RadioResponseInfo& info);
+ Return<void> setAllowedCarriersResponse_1_4(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> getAllowedCarriersResponse_1_4(const RadioResponseInfo& info,
- const CarrierRestrictionsWithPriority& carriers,
- SimLockMultiSimPolicy multiSimPolicy);
+ Return<void> getAllowedCarriersResponse_1_4(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const CarrierRestrictionsWithPriority& carriers, SimLockMultiSimPolicy multiSimPolicy);
/* 1.5 Api */
- Return<void> setSignalStrengthReportingCriteriaResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setSignalStrengthReportingCriteriaResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setLinkCapacityReportingCriteriaResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setLinkCapacityReportingCriteriaResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> enableUiccApplicationsResponse(const RadioResponseInfo& info);
+ Return<void> enableUiccApplicationsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> areUiccApplicationsEnabledResponse(const RadioResponseInfo& info, bool enabled);
+ Return<void> areUiccApplicationsEnabledResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, bool enabled);
- Return<void> canToggleUiccApplicationsEnablementResponse(const RadioResponseInfo& info,
- bool canToggle);
+ Return<void> canToggleUiccApplicationsEnablementResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info, bool canToggle);
- Return<void> setSystemSelectionChannelsResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setSystemSelectionChannelsResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> startNetworkScanResponse_1_5(const RadioResponseInfo& info);
+ Return<void> startNetworkScanResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> setupDataCallResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const android::hardware::radio::V1_5::SetupDataCallResult& dcResponse);
Return<void> getDataCallListResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const hidl_vec<::android::hardware::radio::V1_5::SetupDataCallResult>& dcResponse);
- Return<void> setInitialAttachApnResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setInitialAttachApnResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setDataProfileResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setDataProfileResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setRadioPowerResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setRadioPowerResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> setIndicationFilterResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setIndicationFilterResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
Return<void> getBarringInfoResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_5::CellIdentity& cellIdentity,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::BarringInfo>&
barringInfos);
Return<void> getVoiceRegistrationStateResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_5::RegStateResult& regResponse);
Return<void> getDataRegistrationStateResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_5::RegStateResult& regResponse);
Return<void> getCellInfoListResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::CellInfo>&
cellInfo);
- Return<void> setNetworkSelectionModeManualResponse_1_5(const RadioResponseInfo& info);
+ Return<void> setNetworkSelectionModeManualResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info);
- Return<void> sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info,
- const SendSmsResult& sms);
+ Return<void> sendCdmaSmsExpectMoreResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const SendSmsResult& sms);
Return<void> supplySimDepersonalizationResponse(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
::android::hardware::radio::V1_5::PersoSubstate persoType, int32_t remainingRetries);
Return<void> getIccCardStatusResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_5::CardStatus& card_status);
/* 1.6 Api */
+ Return<void> setRadioPowerResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info);
+
Return<void> setupDataCallResponse_1_6(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
const android::hardware::radio::V1_6::SetupDataCallResult& dcResponse);
Return<void> getDataCallListResponse_1_6(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
const hidl_vec<::android::hardware::radio::V1_6::SetupDataCallResult>& dcResponse);
+
+ Return<void> sendSmsResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms);
+
+ Return<void> sendSMSExpectMoreResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms);
+
+ Return<void> sendCdmaSmsResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms);
+
+ Return<void> sendCdmaSmsExpectMoreResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms);
+
+ Return<void> enableNrDualConnectivityResponse(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info);
+ Return<void> isNrDualConnectivityEnabledResponse(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info, bool isEnabled);
};
/* Callback class for radio indication */
@@ -843,6 +1005,9 @@
/* Clear Potential Established Calls */
void clearPotentialEstablishedCalls();
+ /* Update Sim Card Status */
+ void updateSimCardStatus();
+
/* Get current data call list */
void getDataCallList();
diff --git a/radio/1.6/vts/functional/radio_response.cpp b/radio/1.6/vts/functional/radio_response.cpp
index f53e199..ffa384e 100644
--- a/radio/1.6/vts/functional/radio_response.cpp
+++ b/radio/1.6/vts/functional/radio_response.cpp
@@ -22,435 +22,478 @@
/* 1.0 Apis */
Return<void> RadioResponse_v1_6::getIccCardStatusResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_0::CardStatus& /*card_status*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*remainingRetries*/) {
+Return<void> RadioResponse_v1_6::supplyIccPinForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*remainingRetries*/) {
+Return<void> RadioResponse_v1_6::supplyIccPukForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*remainingRetries*/) {
+Return<void> RadioResponse_v1_6::supplyIccPin2ForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*remainingRetries*/) {
+Return<void> RadioResponse_v1_6::supplyIccPuk2ForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*remainingRetries*/) {
+Return<void> RadioResponse_v1_6::changeIccPinForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*remainingRetries*/) {
+Return<void> RadioResponse_v1_6::changeIccPin2ForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
return Void();
}
Return<void> RadioResponse_v1_6::supplyNetworkDepersonalizationResponse(
- const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCurrentCallsResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::Call>& /*calls*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::dialResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::dialResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getIMSIForAppResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imsi*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*imsi*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::hangupConnectionResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::hangupConnectionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::hangupWaitingOrBackgroundResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::hangupForegroundResumeBackgroundResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::switchWaitingOrHoldingAndActiveResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::conferenceResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::conferenceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::rejectCallResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::rejectCallResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getLastCallFailCauseResponse(
- const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const LastCallFailCauseInfo& /*failCauseInfo*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getSignalStrengthResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_0::SignalStrength& /*sig_strength*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getVoiceRegistrationStateResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_0::VoiceRegStateResult& /*voiceRegResponse*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_0::DataRegStateResult& /*dataRegResponse*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getOperatorResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*longName*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*longName*/,
const ::android::hardware::hidl_string& /*shortName*/,
const ::android::hardware::hidl_string& /*numeric*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setRadioPowerResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setRadioPowerResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendDtmfResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::sendDtmfResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendSmsResponse(const RadioResponseInfo& /*info*/,
- const SendSmsResult& /*sms*/) {
+Return<void> RadioResponse_v1_6::sendSmsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendSMSExpectMoreResponse(const RadioResponseInfo& /*info*/,
- const SendSmsResult& /*sms*/) {
+Return<void> RadioResponse_v1_6::sendSMSExpectMoreResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setupDataCallResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const android::hardware::radio::V1_0::SetupDataCallResult& /*dcResponse*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::iccIOForAppResponse(const RadioResponseInfo& /*info*/,
- const IccIoResult& /*iccIo*/) {
+Return<void> RadioResponse_v1_6::iccIOForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const IccIoResult& /*iccIo*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendUssdResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::sendUssdResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::cancelPendingUssdResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::cancelPendingUssdResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getClirResponse(const RadioResponseInfo& /*info*/, int32_t /*n*/,
- int32_t /*m*/) {
+Return<void> RadioResponse_v1_6::getClirResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, int32_t /*n*/,
+ int32_t /*m*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setClirResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setClirResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCallForwardStatusResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<CallForwardInfo>&
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<CallForwardInfo>&
/*callForwardInfos*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setCallForwardResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setCallForwardResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getCallWaitingResponse(const RadioResponseInfo& /*info*/,
- bool /*enable*/, int32_t /*serviceClass*/) {
+Return<void> RadioResponse_v1_6::getCallWaitingResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*enable*/,
+ int32_t /*serviceClass*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setCallWaitingResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setCallWaitingResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::acknowledgeLastIncomingGsmSmsResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::acceptCallResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::acceptCallResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::deactivateDataCallResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::deactivateDataCallResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*response*/) {
+Return<void> RadioResponse_v1_6::getFacilityLockForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, int32_t /*response*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
- int32_t /*retry*/) {
+Return<void> RadioResponse_v1_6::setFacilityLockForAppResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, int32_t /*retry*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setBarringPasswordResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setBarringPasswordResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getNetworkSelectionModeResponse(const RadioResponseInfo& /*info*/,
- bool /*manual*/) {
+Return<void> RadioResponse_v1_6::getNetworkSelectionModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*manual*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setNetworkSelectionModeAutomaticResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setNetworkSelectionModeManualResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getAvailableNetworksResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::startDtmfResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::startDtmfResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::stopDtmfResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::stopDtmfResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getBasebandVersionResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*version*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*version*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::separateConnectionResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::separateConnectionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setMuteResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setMuteResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getMuteResponse(const RadioResponseInfo& /*info*/,
- bool /*enable*/) {
+Return<void> RadioResponse_v1_6::getMuteResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*enable*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getClipResponse(const RadioResponseInfo& /*info*/,
- ClipStatus /*status*/) {
+Return<void> RadioResponse_v1_6::getClipResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ ClipStatus /*status*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getDataCallListResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<android::hardware::radio::V1_0::SetupDataCallResult>&
/*dcResponse*/) {
return Void();
}
Return<void> RadioResponse_v1_6::sendOemRilRequestRawResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
return Void();
}
Return<void> RadioResponse_v1_6::sendOemRilRequestStringsResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& /*data*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setSuppServiceNotificationsResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::writeSmsToSimResponse(const RadioResponseInfo& /*info*/,
- int32_t /*index*/) {
+Return<void> RadioResponse_v1_6::writeSmsToSimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, int32_t /*index*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::deleteSmsOnSimResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::deleteSmsOnSimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setBandModeResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setBandModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getAvailableBandModesResponse(
- const RadioResponseInfo& info,
- const ::android::hardware::hidl_vec<RadioBandMode>& bandModes) {
- rspInfo = info;
- radioBandModes = bandModes;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<RadioBandMode>& /*bandModes*/) {
return Void();
}
Return<void> RadioResponse_v1_6::sendEnvelopeResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_string& /*commandResponse*/) {
return Void();
}
Return<void> RadioResponse_v1_6::sendTerminalResponseToSimResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::handleStkCallSetupRequestFromSimResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::explicitCallTransferResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::explicitCallTransferResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setPreferredNetworkTypeResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getPreferredNetworkTypeResponse(const RadioResponseInfo& /*info*/,
- PreferredNetworkType /*nw_type*/) {
+Return<void> RadioResponse_v1_6::getPreferredNetworkTypeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ PreferredNetworkType /*nw_type*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getNeighboringCidsResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setLocationUpdatesResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setLocationUpdatesResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setCdmaSubscriptionSourceResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setCdmaRoamingPreferenceResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getCdmaRoamingPreferenceResponse(const RadioResponseInfo& /*info*/,
- CdmaRoamingType /*type*/) {
+Return<void> RadioResponse_v1_6::getCdmaRoamingPreferenceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ CdmaRoamingType /*type*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setTTYModeResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setTTYModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getTTYModeResponse(const RadioResponseInfo& /*info*/,
- TtyMode /*mode*/) {
+Return<void> RadioResponse_v1_6::getTTYModeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, TtyMode /*mode*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setPreferredVoicePrivacyResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getPreferredVoicePrivacyResponse(const RadioResponseInfo& /*info*/,
- bool /*enable*/) {
+Return<void> RadioResponse_v1_6::getPreferredVoicePrivacyResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*enable*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendCDMAFeatureCodeResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::sendCDMAFeatureCodeResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::sendBurstDtmfResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendCdmaSmsResponse(const RadioResponseInfo& /*info*/,
- const SendSmsResult& /*sms*/) {
+Return<void> RadioResponse_v1_6::sendCdmaSmsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
return Void();
}
Return<void> RadioResponse_v1_6::acknowledgeLastIncomingCdmaSmsResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getGsmBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& /*configs*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setGsmBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setGsmBroadcastConfigResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setGsmBroadcastActivationResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCdmaBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setCdmaBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setCdmaBroadcastConfigResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setCdmaBroadcastActivationResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCDMASubscriptionResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*mdn*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*mdn*/,
const ::android::hardware::hidl_string& /*hSid*/,
const ::android::hardware::hidl_string& /*hNid*/,
const ::android::hardware::hidl_string& /*min*/,
@@ -458,17 +501,19 @@
return Void();
}
-Return<void> RadioResponse_v1_6::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/,
- uint32_t /*index*/) {
+Return<void> RadioResponse_v1_6::writeSmsToRuimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, uint32_t /*index*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::deleteSmsOnRuimResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::deleteSmsOnRuimResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getDeviceIdentityResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imei*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*imei*/,
const ::android::hardware::hidl_string& /*imeisv*/,
const ::android::hardware::hidl_string& /*esn*/,
const ::android::hardware::hidl_string& /*meid*/) {
@@ -476,202 +521,225 @@
}
Return<void> RadioResponse_v1_6::exitEmergencyCallbackModeResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getSmscAddressResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*smsc*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*smsc*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setSmscAddressResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setSmscAddressResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::reportSmsMemoryStatusResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::reportSmsMemoryStatusResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::reportStkServiceIsRunningResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCdmaSubscriptionSourceResponse(
- const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ CdmaSubscriptionSource /*source*/) {
return Void();
}
Return<void> RadioResponse_v1_6::requestIsimAuthenticationResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*response*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*response*/) {
return Void();
}
Return<void> RadioResponse_v1_6::acknowledgeIncomingGsmSmsWithPduResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendEnvelopeWithStatusResponse(const RadioResponseInfo& /*info*/,
- const IccIoResult& /*iccIo*/) {
+Return<void> RadioResponse_v1_6::sendEnvelopeWithStatusResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const IccIoResult& /*iccIo*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getVoiceRadioTechnologyResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
::android::hardware::radio::V1_0::RadioTechnology /*rat*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCellInfoListResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<
::android::hardware::radio::V1_0::CellInfo>& /*cellInfo*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setCellInfoListRateResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setCellInfoListRateResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setInitialAttachApnResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setInitialAttachApnResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getImsRegistrationStateResponse(
- const RadioResponseInfo& /*info*/, bool /*isRegistered*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*isRegistered*/,
RadioTechnologyFamily /*ratFamily*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendImsSmsResponse(const RadioResponseInfo& /*info*/,
- const SendSmsResult& /*sms*/) {
+Return<void> RadioResponse_v1_6::sendImsSmsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
return Void();
}
Return<void> RadioResponse_v1_6::iccTransmitApduBasicChannelResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const IccIoResult& /*result*/) {
return Void();
}
Return<void> RadioResponse_v1_6::iccOpenLogicalChannelResponse(
- const RadioResponseInfo& /*info*/, int32_t /*channelId*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, int32_t /*channelId*/,
const ::android::hardware::hidl_vec<int8_t>& /*selectResponse*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::iccCloseLogicalChannelResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::iccCloseLogicalChannelResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::iccTransmitApduLogicalChannelResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const IccIoResult& /*result*/) {
return Void();
}
Return<void> RadioResponse_v1_6::nvReadItemResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*result*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*result*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::nvWriteItemResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::nvWriteCdmaPrlResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::nvResetConfigResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setUiccSubscriptionResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setUiccSubscriptionResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setDataAllowedResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getHardwareConfigResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) {
return Void();
}
Return<void> RadioResponse_v1_6::requestIccSimAuthenticationResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const IccIoResult& /*result*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setDataProfileResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setDataProfileResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::requestShutdownResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getRadioCapabilityResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const android::hardware::radio::V1_0::RadioCapability& /*rc*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setRadioCapabilityResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const android::hardware::radio::V1_0::RadioCapability& /*rc*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::startLceServiceResponse(const RadioResponseInfo& /*info*/,
- const LceStatusInfo& /*statusInfo*/) {
+Return<void> RadioResponse_v1_6::startLceServiceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const LceStatusInfo& /*statusInfo*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::stopLceServiceResponse(const RadioResponseInfo& /*info*/,
- const LceStatusInfo& /*statusInfo*/) {
+Return<void> RadioResponse_v1_6::stopLceServiceResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const LceStatusInfo& /*statusInfo*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::pullLceDataResponse(const RadioResponseInfo& /*info*/,
- const LceDataInfo& /*lceInfo*/) {
+Return<void> RadioResponse_v1_6::pullLceDataResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const LceDataInfo& /*lceInfo*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getModemActivityInfoResponse(
- const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ActivityStatsInfo& /*activityInfo*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/,
- int32_t /*numAllowed*/) {
+Return<void> RadioResponse_v1_6::setAllowedCarriersResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ int32_t /*numAllowed*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getAllowedCarriersResponse(
- const RadioResponseInfo& /*info*/, bool /*allAllowed*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*allAllowed*/,
const CarrierRestrictions& /*carriers*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::sendDeviceStateResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setIndicationFilterResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setIndicationFilterResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setSimCardPowerResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setSimCardPowerResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
@@ -681,378 +749,367 @@
/* 1.1 Apis */
Return<void> RadioResponse_v1_6::setCarrierInfoForImsiEncryptionResponse(
- const RadioResponseInfo& /*info*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setSimCardPowerResponse_1_1(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::setSimCardPowerResponse_1_1(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::startNetworkScanResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::startNetworkScanResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::stopNetworkScanResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::stopNetworkScanResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
- const KeepaliveStatus& /*status*/) {
+Return<void> RadioResponse_v1_6::startKeepaliveResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const KeepaliveStatus& /*status*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_6::stopKeepaliveResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
/* 1.2 Apis */
Return<void> RadioResponse_v1_6::setSignalStrengthReportingCriteriaResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setLinkCapacityReportingCriteriaResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getIccCardStatusResponse_1_2(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_2::CardStatus& /*card_status*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCurrentCallsResponse_1_2(
- const RadioResponseInfo& info,
- const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& calls) {
- rspInfo = info;
- currentCalls = calls;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& /*calls*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getSignalStrengthResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_2::SignalStrength& /*sig_strength*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getSignalStrengthResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_4::SignalStrength& /*sig_strength*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getCellInfoListResponse_1_2(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<
::android::hardware::radio::V1_2::CellInfo>& /*cellInfo*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getVoiceRegistrationStateResponse_1_2(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_2::VoiceRegStateResult& /*voiceRegResponse*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse_1_2(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_2::DataRegStateResult& /*dataRegResponse*/) {
return Void();
}
/* 1.3 Apis */
-Return<void> RadioResponse_v1_6::setSystemSelectionChannelsResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setSystemSelectionChannelsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::enableModemResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::enableModemResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::getModemStackStatusResponse(const RadioResponseInfo& info,
- const bool enabled) {
- rspInfo = info;
- isModemEnabled = enabled;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::getModemStackStatusResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const bool /*enabled*/) {
return Void();
}
/* 1.4 Apis */
-Return<void> RadioResponse_v1_6::emergencyDialResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::emergencyDialResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::startNetworkScanResponse_1_4(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::startNetworkScanResponse_1_4(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse_1_4(
- const RadioResponseInfo& info,
- const ::android::hardware::radio::V1_4::DataRegStateResult& dataRegResponse) {
- rspInfo = info;
- dataRegResp = dataRegResponse;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_4::DataRegStateResult& /*dataRegResponse*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getCellInfoListResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<
::android::hardware::radio::V1_4::CellInfo>& /*cellInfo*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getIccCardStatusResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_4::CardStatus& /*card_status*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getPreferredNetworkTypeBitmapResponse(
- const RadioResponseInfo& info, const ::android::hardware::hidl_bitfield<
- ::android::hardware::radio::V1_4::RadioAccessFamily>
- networkTypeBitmap) {
- rspInfo = info;
- networkTypeBitmapResponse = networkTypeBitmap;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_bitfield<
+ ::android::hardware::radio::V1_4::RadioAccessFamily>
+ /*networkTypeBitmap*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setPreferredNetworkTypeBitmapResponse(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getDataCallListResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_4::SetupDataCallResult>&
/*dcResponse*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::setupDataCallResponse_1_4(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const android::hardware::radio::V1_4::SetupDataCallResult& /*dcResponse*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
-Return<void> RadioResponse_v1_6::setAllowedCarriersResponse_1_4(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setAllowedCarriersResponse_1_4(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getAllowedCarriersResponse_1_4(
- const RadioResponseInfo& info, const CarrierRestrictionsWithPriority& carriers,
- SimLockMultiSimPolicy multiSimPolicy) {
- rspInfo = info;
- carrierRestrictionsResp = carriers;
- multiSimPolicyResp = multiSimPolicy;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const CarrierRestrictionsWithPriority& /*carriers*/,
+ SimLockMultiSimPolicy /*multiSimPolicy*/) {
return Void();
}
/* 1.5 Apis */
Return<void> RadioResponse_v1_6::setSignalStrengthReportingCriteriaResponse_1_5(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setLinkCapacityReportingCriteriaResponse_1_5(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::enableUiccApplicationsResponse(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::enableUiccApplicationsResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::areUiccApplicationsEnabledResponse(const RadioResponseInfo& info,
- bool enabled) {
- rspInfo = info;
- areUiccApplicationsEnabled = enabled;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::areUiccApplicationsEnabledResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*enabled*/) {
return Void();
}
Return<void> RadioResponse_v1_6::canToggleUiccApplicationsEnablementResponse(
- const RadioResponseInfo& info, bool canToggle) {
- rspInfo = info;
- canToggleUiccApplicationsEnablement = canToggle;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/, bool /*canToggle*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setSystemSelectionChannelsResponse_1_5(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::startNetworkScanResponse_1_5(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::startNetworkScanResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setupDataCallResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const android::hardware::radio::V1_5::SetupDataCallResult& /* dcResponse */) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getDataCallListResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const hidl_vec<::android::hardware::radio::V1_5::SetupDataCallResult>& /* dcResponse */) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
-Return<void> RadioResponse_v1_6::setInitialAttachApnResponse_1_5(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setInitialAttachApnResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setDataProfileResponse_1_5(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setDataProfileResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setRadioPowerResponse_1_5(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setRadioPowerResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::setIndicationFilterResponse_1_5(const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::setIndicationFilterResponse_1_5(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getBarringInfoResponse(
- const RadioResponseInfo& info,
- const ::android::hardware::radio::V1_5::CellIdentity& cellIdentity,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_5::CellIdentity& /*cellIdentity*/,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::BarringInfo>&
- barringInfos) {
- this->barringCellIdentity = cellIdentity;
- this->barringInfos = barringInfos;
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ /*barringInfos*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getVoiceRegistrationStateResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_5::RegStateResult& /*regResponse*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::radio::V1_5::RegStateResult& /*regResponse*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::getCellInfoListResponse_1_5(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
const ::android::hardware::hidl_vec<
::android::hardware::radio::V1_5::CellInfo>& /*cellInfo*/) {
return Void();
}
Return<void> RadioResponse_v1_6::setNetworkSelectionModeManualResponse_1_5(
- const RadioResponseInfo& info) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/) {
return Void();
}
-Return<void> RadioResponse_v1_6::sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info,
- const SendSmsResult& /*sms*/) {
- rspInfo = info;
- parent_v1_6.notify(info.serial);
+Return<void> RadioResponse_v1_6::sendCdmaSmsExpectMoreResponse(
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
return Void();
}
Return<void> RadioResponse_v1_6::supplySimDepersonalizationResponse(
- const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
::android::hardware::radio::V1_5::PersoSubstate /*persoType*/,
int32_t /*remainingRetries*/) {
return Void();
}
Return<void> RadioResponse_v1_6::getIccCardStatusResponse_1_5(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
const ::android::hardware::radio::V1_5::CardStatus& card_status) {
- rspInfo = info;
+ rspInfo_v1_0 = info;
cardStatus = card_status;
parent_v1_6.notify(info.serial);
return Void();
}
/* 1.6 Apis */
+Return<void> RadioResponse_v1_6::setRadioPowerResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_6.notify(info.serial);
+ return Void();
+}
+
Return<void> RadioResponse_v1_6::setupDataCallResponse_1_6(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
const android::hardware::radio::V1_6::SetupDataCallResult& /* dcResponse */) {
rspInfo = info;
parent_v1_6.notify(info.serial);
return Void();
}
+Return<void> RadioResponse_v1_6::enableNrDualConnectivityResponse(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_6.notify(info.serial);
+ return Void();
+}
Return<void> RadioResponse_v1_6::getDataCallListResponse_1_6(
- const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
const hidl_vec<::android::hardware::radio::V1_6::SetupDataCallResult>& /* dcResponse */) {
rspInfo = info;
parent_v1_6.notify(info.serial);
return Void();
}
+
+Return<void> RadioResponse_v1_6::sendSmsResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_v1_6.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_6::sendSMSExpectMoreResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_v1_6.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_6::sendCdmaSmsResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_v1_6.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_6::sendCdmaSmsExpectMoreResponse_1_6(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
+ const SendSmsResult& sms) {
+ rspInfo = info;
+ sendSmsResult = sms;
+ parent_v1_6.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_6::isNrDualConnectivityEnabledResponse(
+ const ::android::hardware::radio::V1_6::RadioResponseInfo& info, bool isEnabled) {
+ rspInfo = info;
+ isNRDualConnectivityEnabled = isEnabled;
+ parent_v1_6.notify(info.serial);
+ return Void();
+}
diff --git a/radio/1.6/vts/functional/vts_test_util_v1_6.cpp b/radio/1.6/vts/functional/vts_test_util_v1_6.cpp
new file mode 100644
index 0000000..2653865
--- /dev/null
+++ b/radio/1.6/vts/functional/vts_test_util_v1_6.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "RadioTest"
+
+#include <vts_test_util_v1_6.h>
+#include <iostream>
+#include "VtsCoreUtil.h"
+
+::testing::AssertionResult CheckAnyOfErrors(
+ ::android::hardware::radio::V1_6::RadioError err,
+ std::vector<::android::hardware::radio::V1_6::RadioError> errors, CheckFlag flag) {
+ const static vector<::android::hardware::radio::V1_6::RadioError> generalErrors = {
+ ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
+ ::android::hardware::radio::V1_6::RadioError::NO_MEMORY,
+ ::android::hardware::radio::V1_6::RadioError::INTERNAL_ERR,
+ ::android::hardware::radio::V1_6::RadioError::SYSTEM_ERR,
+ ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED,
+ ::android::hardware::radio::V1_6::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 >= ::android::hardware::radio::V1_6::RadioError::OEM_ERROR_1 &&
+ err <= ::android::hardware::radio::V1_6::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";
+}
diff --git a/radio/1.6/vts/functional/vts_test_util_v1_6.h b/radio/1.6/vts/functional/vts_test_util_v1_6.h
new file mode 100644
index 0000000..e04d201
--- /dev/null
+++ b/radio/1.6/vts/functional/vts_test_util_v1_6.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android/hardware/radio/1.6/types.h>
+
+#include "vts_test_util.h"
+
+/*
+ * 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(
+ ::android::hardware::radio::V1_6::RadioError err,
+ std::vector<::android::hardware::radio::V1_6::RadioError> generalError,
+ CheckFlag flag = CHECK_DEFAULT);
diff --git a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h
index 2e5aca4..e674ddb 100644
--- a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h
+++ b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h
@@ -226,6 +226,7 @@
void activateAllSensors(bool enable);
std::vector<SensorInfoType> getNonOneShotSensors();
std::vector<SensorInfoType> getNonOneShotAndNonSpecialSensors();
+ std::vector<SensorInfoType> getNonOneShotAndNonOnChangeAndNonSpecialSensors();
std::vector<SensorInfoType> getOneShotSensors();
std::vector<SensorInfoType> getInjectEventSensors();
int32_t getInvalidSensorHandle();
@@ -326,6 +327,19 @@
return sensors;
}
+std::vector<SensorInfoType> SensorsHidlTest::getNonOneShotAndNonOnChangeAndNonSpecialSensors() {
+ std::vector<SensorInfoType> sensors;
+ for (const SensorInfoType& info : getSensorsList()) {
+ SensorFlagBits reportMode = extractReportMode(info.flags);
+ if (reportMode != SensorFlagBits::ONE_SHOT_MODE &&
+ reportMode != SensorFlagBits::ON_CHANGE_MODE &&
+ reportMode != SensorFlagBits::SPECIAL_REPORTING_MODE) {
+ sensors.push_back(info);
+ }
+ }
+ return sensors;
+}
+
std::vector<SensorInfoType> SensorsHidlTest::getOneShotSensors() {
std::vector<SensorInfoType> sensors;
for (const SensorInfoType& info : getSensorsList()) {
@@ -726,8 +740,8 @@
EventCallback callback;
getEnvironment()->registerCallback(&callback);
- // This test is not valid for one-shot or special-report-mode sensors
- const std::vector<SensorInfoType> sensors = getNonOneShotAndNonSpecialSensors();
+ // This test is not valid for one-shot, on-change or special-report-mode sensors
+ const std::vector<SensorInfoType> sensors = getNonOneShotAndNonOnChangeAndNonSpecialSensors();
milliseconds maxMinDelay(0);
for (const SensorInfoType& sensor : sensors) {
milliseconds minDelay = duration_cast<milliseconds>(microseconds(sensor.minDelay));
@@ -750,10 +764,7 @@
<< " handle=0x" << std::hex << std::setw(8) << std::setfill('0')
<< sensor.sensorHandle << std::dec << " type=" << static_cast<int>(sensor.type)
<< " name=" << sensor.name);
- // Some on-change sensors may not report an event without stimulus
- if (extractReportMode(sensor.flags) != SensorFlagBits::ON_CHANGE_MODE) {
- ASSERT_GE(callback.getEvents(sensor.sensorHandle).size(), 1);
- }
+
if (callback.getEvents(sensor.sensorHandle).size() >= 1) {
lastEventTimestampMap[sensor.sensorHandle] =
callback.getEvents(sensor.sensorHandle).back().timestamp;
@@ -779,10 +790,7 @@
if (lastEventTimestampMap.find(sensor.sensorHandle) == lastEventTimestampMap.end()) {
continue;
}
- // Skip on-change sensors that do not consistently report an initial event
- if (callback.getEvents(sensor.sensorHandle).size() < 1) {
- continue;
- }
+
// Ensure that the first event received is not stale by ensuring that its timestamp is
// sufficiently different from the previous event
const EventType newEvent = callback.getEvents(sensor.sensorHandle).front();
diff --git a/tests/msgq/1.0/default/Android.bp b/tests/msgq/1.0/default/Android.bp
index 9c1b3f9..6e7cd44 100644
--- a/tests/msgq/1.0/default/Android.bp
+++ b/tests/msgq/1.0/default/Android.bp
@@ -93,7 +93,7 @@
static_libs: [
"android.hardware.tests.msgq@1.0",
"android.fmq.test-ndk_platform",
- "android.hardware.common-unstable-ndk_platform",
+ "android.hardware.common.fmq-unstable-ndk_platform",
],
whole_static_libs: [
"android.hardware.tests.msgq@1.0-impl",
diff --git a/tv/tuner/1.1/IFilter.hal b/tv/tuner/1.1/IFilter.hal
index 2ba9bb7..df736aa 100644
--- a/tv/tuner/1.1/IFilter.hal
+++ b/tv/tuner/1.1/IFilter.hal
@@ -70,4 +70,32 @@
* memory is not initialized.
*/
getAvSharedHandle() generates (Result result, handle avMemory, uint64_t avMemSize);
+
+ /**
+ * Configure A/V filter’s stream type. This API only applies to A/V filters.
+ *
+ * @param avStreamType the stream type for A/V.
+ * @return return result Result status of the operation.
+ * SUCCESS if successful,
+ * INVALID_STATE if configure can't be applied,
+ * UNKNOWN_ERROR if failed for other reasons.
+ */
+ configureAvStreamType(AvStreamType avStreamType) generates (Result result);
+
+ /**
+ * Configure the filter to monitor specific Scrambling Status.
+ *
+ * Scrambling Status should be sent through the filer callback at the following two scenarios:
+ * 1. When this method is called, the first detected scrambling status should be sent.
+ * 2. When the filter transits into the monitored statuses configured through this method,
+ * event should be sent.
+ *
+ * @param statuses Scrambling Statuses to monitor. Set corresponding bit to monitor. Reset to
+ * stop monitoring.
+ * @return result Result status of the operation.
+ * SUCCESS if successful,
+ * INVALID_STATE if configure can't be applied,
+ * UNKNOWN_ERROR if failed for other reasons.
+ */
+ configureScramblingEvent(bitfield<ScramblingStatus> statuses) generates (Result result);
};
diff --git a/tv/tuner/1.1/IFrontend.hal b/tv/tuner/1.1/IFrontend.hal
index e9c5e19..63f0655 100644
--- a/tv/tuner/1.1/IFrontend.hal
+++ b/tv/tuner/1.1/IFrontend.hal
@@ -77,11 +77,22 @@
* directly from the frontend.
*
* @param ciCamId specify CI-CAM Id to link.
+ * @return ltsId Local Transport Stream Id.
* @return result Result status of the operation.
* SUCCESS if successful,
* UNKNOWN_ERROR if failed for other reasons.
*/
- linkCiCam(uint32_t ciCamId) generates (Result result);
+ linkCiCam(uint32_t ciCamId) generates (Result result, uint32_t ltsId);
+
+ /**
+ * Unlink Conditional Access Modules (CAM) to Frontend.
+ *
+ * @param ciCamId specify CI-CAM Id to unlink.
+ * @return result Result status of the operation.
+ * SUCCESS if successful,
+ * UNKNOWN_ERROR if failed for other reasons.
+ */
+ unlinkCiCam(uint32_t ciCamId) generates (Result result);
/**
* Get the v1_1 extended statuses of the frontend.
diff --git a/tv/tuner/1.1/default/Filter.cpp b/tv/tuner/1.1/default/Filter.cpp
index c69beca..4c37729 100644
--- a/tv/tuner/1.1/default/Filter.cpp
+++ b/tv/tuner/1.1/default/Filter.cpp
@@ -228,6 +228,49 @@
return Void();
}
+Return<Result> Filter::configureAvStreamType(const V1_1::AvStreamType& avStreamType) {
+ ALOGV("%s", __FUNCTION__);
+
+ if (!mIsMediaFilter) {
+ return Result::UNAVAILABLE;
+ }
+
+ switch (avStreamType.getDiscriminator()) {
+ case V1_1::AvStreamType::hidl_discriminator::audio:
+ mAudioStreamType = static_cast<uint32_t>(avStreamType.audio());
+ break;
+ case V1_1::AvStreamType::hidl_discriminator::video:
+ mVideoStreamType = static_cast<uint32_t>(avStreamType.video());
+ break;
+ default:
+ break;
+ }
+
+ return Result::SUCCESS;
+}
+
+Return<Result> Filter::configureScramblingEvent(uint32_t statuses) {
+ ALOGV("%s", __FUNCTION__);
+
+ mStatuses = statuses;
+ if (mCallback_1_1 != nullptr) {
+ // Assuming current status is always NOT_SCRAMBLED
+ V1_1::DemuxFilterEventExt filterEventExt;
+ V1_1::DemuxFilterEventExt::Event event;
+ event.scramblingStatus(V1_1::ScramblingStatus::NOT_SCRAMBLED);
+ int size = filterEventExt.events.size();
+ filterEventExt.events.resize(size + 1);
+ filterEventExt.events[size] = event;
+ DemuxFilterEvent emptyFilterEvent;
+
+ mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, filterEventExt);
+ mFilterEventExt.events.resize(0);
+ } else {
+ return Result::INVALID_STATE;
+ }
+ return Result::SUCCESS;
+}
+
bool Filter::createFilterMQ() {
ALOGV("%s", __FUNCTION__);
@@ -319,17 +362,17 @@
while (mFilterThreadRunning) {
std::lock_guard<std::mutex> lock(mFilterEventLock);
- if (mFilterEvent.events.size() == 0) {
+ if (mFilterEvent.events.size() == 0 && mFilterEventExt.events.size() == 0) {
continue;
}
// After successfully write, send a callback and wait for the read to be done
- if (mCallback != nullptr) {
- mCallback->onFilterEvent(mFilterEvent);
- mFilterEvent.events.resize(0);
- } else if (mCallback_1_1 != nullptr) {
+ if (mCallback_1_1 != nullptr) {
mCallback_1_1->onFilterEvent_1_1(mFilterEvent, mFilterEventExt);
mFilterEventExt.events.resize(0);
+ } else if (mCallback != nullptr) {
+ mCallback->onFilterEvent(mFilterEvent);
}
+ mFilterEvent.events.resize(0);
break;
}
// We do not wait for the last read to be done
@@ -638,6 +681,8 @@
V1_1::DemuxFilterRecordEventExt recordEventExt;
recordEventExt = {
.pts = (mPts == 0) ? time(NULL) * 900000 : mPts,
+ .firstMbInSlice = 0, // random address
+ .mpuSequenceNumber = 1, // random sequence number
};
int size;
diff --git a/tv/tuner/1.1/default/Filter.h b/tv/tuner/1.1/default/Filter.h
index f677666..522db35 100644
--- a/tv/tuner/1.1/default/Filter.h
+++ b/tv/tuner/1.1/default/Filter.h
@@ -82,6 +82,10 @@
virtual Return<void> getAvSharedHandle(getAvSharedHandle_cb _hidl_cb) override;
+ virtual Return<Result> configureAvStreamType(const V1_1::AvStreamType& avStreamType) override;
+
+ virtual Return<Result> configureScramblingEvent(uint32_t statuses) override;
+
/**
* To create a FilterMQ and its Event Flag.
*
@@ -225,6 +229,12 @@
hidl_handle mSharedAvMemHandle;
bool mUsingSharedAvMem = true;
uint32_t mSharedAvMemOffset = 0;
+
+ uint32_t mAudioStreamType;
+ uint32_t mVideoStreamType;
+
+ // Scrambling status to be monitored
+ uint32_t mStatuses = 0;
};
} // namespace implementation
diff --git a/tv/tuner/1.1/default/Frontend.cpp b/tv/tuner/1.1/default/Frontend.cpp
index 7c6f8c6..6956f30 100644
--- a/tv/tuner/1.1/default/Frontend.cpp
+++ b/tv/tuner/1.1/default/Frontend.cpp
@@ -302,6 +302,12 @@
status.codeRates(codeRates);
break;
}
+ case V1_1::FrontendStatusTypeExt1_1::BANDWIDTH: {
+ V1_1::FrontendBandwidth bandwidth;
+ bandwidth.dvbt(FrontendDvbtBandwidth::BANDWIDTH_8MHZ);
+ status.bandwidth(bandwidth);
+ break;
+ }
case V1_1::FrontendStatusTypeExt1_1::GUARD_INTERVAL: {
V1_1::FrontendGuardInterval interval;
interval.dvbt(FrontendDvbtGuardInterval::INTERVAL_1_32); // value = 1 << 1
@@ -339,6 +345,24 @@
status.tsDataRate(dataRates);
break;
}
+ case V1_1::FrontendStatusTypeExt1_1::ROLL_OFF: {
+ V1_1::FrontendRollOff rollOff;
+ rollOff.dvbs(FrontendDvbsRolloff::ROLLOFF_0_35);
+ status.rollOff(rollOff);
+ break;
+ }
+ case V1_1::FrontendStatusTypeExt1_1::IS_MISO: {
+ status.isMiso(true);
+ break;
+ }
+ case V1_1::FrontendStatusTypeExt1_1::IS_LINEAR: {
+ status.isLinear(true);
+ break;
+ }
+ case V1_1::FrontendStatusTypeExt1_1::IS_SHORT_FRAMES: {
+ status.isShortFrames(true);
+ break;
+ }
default: {
continue;
}
@@ -364,10 +388,19 @@
return Result::SUCCESS;
}
-Return<Result> Frontend::linkCiCam(uint32_t ciCamId) {
+Return<void> Frontend::linkCiCam(uint32_t ciCamId, linkCiCam_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__);
mCiCamId = ciCamId;
+ _hidl_cb(Result::SUCCESS, 0 /*ltsId*/);
+
+ return Void();
+}
+
+Return<Result> Frontend::unlinkCiCam(uint32_t /*ciCamId*/) {
+ ALOGV("%s", __FUNCTION__);
+
+ mCiCamId = -1;
return Result::SUCCESS;
}
diff --git a/tv/tuner/1.1/default/Frontend.h b/tv/tuner/1.1/default/Frontend.h
index 4c35718..a28fb64 100644
--- a/tv/tuner/1.1/default/Frontend.h
+++ b/tv/tuner/1.1/default/Frontend.h
@@ -66,7 +66,9 @@
virtual Return<Result> setLnb(uint32_t lnb) override;
- virtual Return<Result> linkCiCam(uint32_t ciCamId) override;
+ virtual Return<void> linkCiCam(uint32_t ciCamId, linkCiCam_cb _hidl_cb) override;
+
+ virtual Return<Result> unlinkCiCam(uint32_t ciCamId) override;
FrontendType getFrontendType();
diff --git a/tv/tuner/1.1/types.hal b/tv/tuner/1.1/types.hal
index f8fe2aa..defc99b 100644
--- a/tv/tuner/1.1/types.hal
+++ b/tv/tuner/1.1/types.hal
@@ -19,14 +19,19 @@
import @1.0::Constant;
import @1.0::DemuxFilterMmtpRecordEvent;
import @1.0::DemuxFilterTsRecordEvent;
+import @1.0::DemuxScIndex;
+import @1.0::FrontendIsdbs3Rolloff;
import @1.0::FrontendAtsc3Bandwidth;
import @1.0::FrontendAtsc3Modulation;
import @1.0::FrontendAtsc3TimeInterleaveMode;
+import @1.0::FrontendIsdbsRolloff;
import @1.0::FrontendAtscModulation;
+import @1.0::FrontendDvbcAnnex;
import @1.0::FrontendDvbcModulation;
-import @1.0::FrontendDvbtBandwidth;
import @1.0::FrontendDvbcSpectralInversion;
import @1.0::FrontendDvbsModulation;
+import @1.0::FrontendDvbsRolloff;
+import @1.0::FrontendDvbtBandwidth;
import @1.0::FrontendDvbtConstellation;
import @1.0::FrontendDvbtTransmissionMode;
import @1.0::FrontendDvbtGuardInterval;
@@ -46,10 +51,14 @@
@export
enum Constant : @1.0::Constant {
/**
- * An invalid mpuSequenceNumber in DemuxFilterMmtpRecordEvent.
+ * An invalid mpuSequenceNumber in DemuxFilterRecordEventExt.
*/
INVALID_MMTP_RECORD_EVENT_MPT_SEQUENCE_NUM = 0xFFFFFFFF,
/**
+ * An invalid first macroblock address in DemuxFilterRecordEventExt.
+ */
+ INVALID_FIRST_MACROBLOCK_IN_SLICE = 0xFFFFFFFF,
+ /**
* An invalid frenquency that can be used as the default value of the frontend setting.
*/
INVALID_FRONTEND_SETTING_FREQUENCY = 0xFFFFFFFF,
@@ -58,6 +67,11 @@
* be used to reset the configured ip context id.
*/
INVALID_IP_FILTER_CONTEXT_ID = 0xFFFFFFFF,
+ /**
+ * An invalid local transport stream id used as the return value on a failed operation of
+ * IFrontend.linkCiCam.
+ */
+ INVALID_LTS_ID = 0xFFFFFFFF,
};
@export
@@ -71,7 +85,7 @@
*/
INVALID_AV_SYNC_ID_64BIT = 0xFFFFFFFFFFFFFFFF,
/**
- * An invalid pts in the DemuxFilterTsRecordEvent or DemuxFilterMmtpRecordEvent.
+ * An invalid pts.
*/
INVALID_PRESENTATION_TIME_STAMP = 0xFFFFFFFFFFFFFFFF,
};
@@ -90,6 +104,11 @@
* MPU sequence number of the filtered data. This is only used for MMTP.
*/
uint32_t mpuSequenceNumber;
+
+ /**
+ * Specifies the address of the first macroblock in the slice defined in ITU-T Rec. H.264.
+ */
+ uint32_t firstMbInSlice;
};
/**
@@ -106,6 +125,8 @@
DemuxFilterRecordEventExt tsRecord;
DemuxFilterRecordEventExt mmtpRecord;
+
+ ScramblingStatus scramblingStatus;
};
/**
@@ -114,6 +135,25 @@
vec<Event> events;
};
+/**
+ * Scrambling Status Type.
+ */
+@export
+enum ScramblingStatus : uint32_t {
+ /**
+ * Content’s scrambling status is unknown
+ */
+ UNKNOWN = 1 << 0,
+ /**
+ * Content is not scrambled.
+ */
+ NOT_SCRAMBLED = 1 << 1,
+ /**
+ * Content is scrambled.
+ */
+ SCRAMBLED = 1 << 2,
+};
+
typedef FrontendDvbcSpectralInversion FrontendSpectralInversion;
/**
@@ -207,6 +247,8 @@
*/
struct FrontendDvbcSettingsExt1_1 {
FrontendCableTimeInterleaveMode interleaveMode;
+
+ FrontendDvbcBandwidth bandwidth;
};
/**
@@ -244,6 +286,18 @@
};
/**
+ * Bandwidth Type for Cable Frontend.
+ */
+@export
+enum FrontendDvbcBandwidth : uint32_t {
+ UNDEFINED = 0,
+ BANDWIDTH_5MHZ = 1 << 0,
+ BANDWIDTH_6MHZ = 1 << 1,
+ BANDWIDTH_7MHZ = 1 << 2,
+ BANDWIDTH_8MHZ = 1 << 3,
+};
+
+/**
* Bandwidth Type for DTMB.
*/
@export
@@ -423,6 +477,8 @@
safe_union FrontendBandwidth {
@1.0::FrontendAtsc3Bandwidth atsc3;
+ FrontendDvbcBandwidth dvbc;
+
@1.0::FrontendDvbtBandwidth dvbt;
@1.0::FrontendIsdbtBandwidth isdbt;
@@ -446,6 +502,14 @@
FrontendDtmbTransmissionMode dtmb;
};
+safe_union FrontendRollOff {
+ @1.0::FrontendDvbsRolloff dvbs;
+
+ @1.0::FrontendIsdbsRolloff isdbs;
+
+ @1.0::FrontendIsdbs3Rolloff isdbs3;
+};
+
@export
enum FrontendStatusTypeExt1_1 : uint32_t {
/**
@@ -493,6 +557,22 @@
* Transport Stream Data Rate in BPS of the current channel.
*/
TS_DATA_RATES,
+ /**
+ * Roll Off Type status of the frontend.
+ */
+ ROLL_OFF,
+ /**
+ * If the frontend currently supports MISO or not.
+ */
+ IS_MISO,
+ /**
+ * If the frontend code rate is linear or not.
+ */
+ IS_LINEAR,
+ /**
+ * If short frames is enabled or not.
+ */
+ IS_SHORT_FRAMES,
};
safe_union FrontendStatusExt1_1 {
@@ -551,15 +631,188 @@
* Transport Stream Data Rate in BPS of the current channel.
*/
vec<uint32_t> tsDataRate;
+ /**
+ * Roll Off Type status of the frontend.
+ */
+ FrontendRollOff rollOff;
+ /**
+ * If the frontend currently supports MISO or not.
+ */
+ bool isMiso;
+ /**
+ * If the frontend code rate is linear or not.
+ */
+ bool isLinear;
+ /**
+ * If short frames is enabled or not.
+ */
+ bool isShortFrames;
};
enum FrontendScanMessageTypeExt1_1 : uint32_t {
MODULATION = @1.0::FrontendScanMessageType:ATSC3_PLP_INFO + 1,
+ DVBC_ANNEX,
HIGH_PRIORITY,
};
safe_union FrontendScanMessageExt1_1 {
FrontendModulation modulation;
+ @1.0::FrontendDvbcAnnex annex;
+
bool isHighPriority;
};
+
+@export
+enum VideoStreamType : uint32_t {
+ UNDEFINED,
+ /*
+ * ITU-T | ISO/IEC Reserved
+ */
+ RESERVED,
+ /*
+ * ISO/IEC 11172
+ */
+ MPEG1,
+ /*
+ * ITU-T Rec.H.262 and ISO/IEC 13818-2
+ */
+ MPEG2,
+ /*
+ * ISO/IEC 14496-2 (MPEG-4 H.263 based video)
+ */
+ MPEG4P2,
+ /*
+ * ITU-T Rec.H.264 and ISO/IEC 14496-10
+ */
+ AVC,
+ /*
+ * ITU-T Rec. H.265 and ISO/IEC 23008-2
+ */
+ HEVC,
+ /*
+ * Microsoft VC.1
+ */
+ VC1,
+ /*
+ * Google VP8
+ */
+ VP8,
+ /*
+ * Google VP9
+ */
+ VP9,
+ /*
+ * AOMedia Video 1
+ */
+ AV1,
+ /*
+ * Chinese Standard
+ */
+ AVS,
+ /*
+ * New Chinese Standard
+ */
+ AVS2,
+};
+
+@export
+enum AudioStreamType : uint32_t {
+ UNDEFINED,
+ /*
+ * Uncompressed Audio
+ */
+ PCM,
+ /*
+ * MPEG Audio Layer III versions
+ */
+ MP3,
+ /*
+ * ISO/IEC 11172 Audio
+ */
+ MPEG1,
+ /*
+ * ISO/IEC 13818-3
+ */
+ MPEG2,
+ /*
+ * ISO/IEC 23008-3 (MPEG-H Part 3)
+ */
+ MPEGH,
+ /*
+ * ISO/IEC 14496-3
+ */
+ AAC,
+ /*
+ * Dolby Digital
+ */
+ AC3,
+ /*
+ * Dolby Digital Plus
+ */
+ EAC3,
+ /*
+ * Dolby AC-4
+ */
+ AC4,
+ /*
+ * Basic DTS
+ */
+ DTS,
+ /*
+ * High Resolution DTS
+ */
+ DTS_HD,
+ /*
+ * Windows Media Audio
+ */
+ WMA,
+ /*
+ * Opus Interactive Audio Codec
+ */
+ OPUS,
+ /*
+ * VORBIS Interactive Audio Codec
+ */
+ VORBIS,
+ /*
+ * SJ/T 11368-2006
+ */
+ DRA,
+};
+
+/**
+ * Stream type for A/V filter.
+ */
+safe_union AvStreamType {
+ VideoStreamType video;
+
+ AudioStreamType audio;
+};
+
+/**
+ * Indexes can be tagged by start point of slice groups according to ISO/IEC 14496-10.
+ */
+@export
+enum DemuxScIndex : @1.0::DemuxScIndex {
+ /**
+ * All blocks are coded as I blocks.
+ */
+ I_SLICE = 1 << 4,
+ /**
+ * Blocks are coded as I or P blocks.
+ */
+ P_SLICE = 1 << 5,
+ /**
+ * Blocks are coded as I, P or B blocks.
+ */
+ B_SLICE = 1 << 6,
+ /**
+ * A so-called switching I slice that is coded.
+ */
+ SI_SLICE = 1 << 7,
+ /**
+ * A so-called switching P slice that is coded.
+ */
+ SP_SLICE = 1 << 8,
+};
diff --git a/tv/tuner/1.1/vts/functional/DvrTests.cpp b/tv/tuner/1.1/vts/functional/DvrTests.cpp
index 0dfc032..1e478f5 100644
--- a/tv/tuner/1.1/vts/functional/DvrTests.cpp
+++ b/tv/tuner/1.1/vts/functional/DvrTests.cpp
@@ -192,9 +192,10 @@
bool DvrCallback::readRecordFMQ() {
android::Mutex::Autolock autoLock(mMsgLock);
bool result = false;
+ int readSize = mRecordMQ->availableToRead();
mDataOutputBuffer.clear();
- mDataOutputBuffer.resize(mRecordMQ->availableToRead());
- result = mRecordMQ->read(mDataOutputBuffer.data(), mRecordMQ->availableToRead());
+ mDataOutputBuffer.resize(readSize);
+ result = mRecordMQ->read(mDataOutputBuffer.data(), readSize);
EXPECT_TRUE(result) << "can't read from Record MQ";
mMsgCondition.signal();
return result;
diff --git a/tv/tuner/1.1/vts/functional/FilterTests.cpp b/tv/tuner/1.1/vts/functional/FilterTests.cpp
index 5a8985d..f114a66 100644
--- a/tv/tuner/1.1/vts/functional/FilterTests.cpp
+++ b/tv/tuner/1.1/vts/functional/FilterTests.cpp
@@ -28,6 +28,18 @@
ALOGW("[vts] pass and stop");
}
+void FilterCallback::testFilterScramblingEvent() {
+ android::Mutex::Autolock autoLock(mMsgLock);
+ while (mScramblingStatusEvent < 1) {
+ if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) {
+ EXPECT_TRUE(false) << "scrambling event does not output within timeout";
+ return;
+ }
+ }
+ mScramblingStatusEvent = 0;
+ ALOGW("[vts] pass and stop");
+}
+
void FilterCallback::readFilterEventData() {
ALOGW("[vts] reading filter event");
// todo separate filter handlers
@@ -47,8 +59,17 @@
auto eventExt = mFilterEventExt.events[i];
switch (eventExt.getDiscriminator()) {
case DemuxFilterEventExt::Event::hidl_discriminator::tsRecord:
- ALOGD("[vts] Extended TS record filter event, pts=%" PRIu64 ".",
- eventExt.tsRecord().pts);
+ ALOGD("[vts] Extended TS record filter event, pts=%" PRIu64 ", firstMbInSlice=%d",
+ eventExt.tsRecord().pts, eventExt.tsRecord().firstMbInSlice);
+ break;
+ case DemuxFilterEventExt::Event::hidl_discriminator::mmtpRecord:
+ ALOGD("[vts] Extended MMTP record filter event, pts=%" PRIu64
+ ", firstMbInSlice=%d, mpuSequenceNumber=%d",
+ eventExt.mmtpRecord().pts, eventExt.mmtpRecord().firstMbInSlice,
+ eventExt.mmtpRecord().mpuSequenceNumber);
+ break;
+ case DemuxFilterEventExt::Event::hidl_discriminator::scramblingStatus:
+ mScramblingStatusEvent++;
break;
default:
break;
@@ -164,6 +185,20 @@
return AssertionResult(status == Result::SUCCESS);
}
+AssertionResult FilterTests::configAvFilterStreamType(AvStreamType type, uint64_t filterId) {
+ Result status;
+ EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first.";
+ sp<android::hardware::tv::tuner::V1_1::IFilter> filter_v1_1 =
+ android::hardware::tv::tuner::V1_1::IFilter::castFrom(mFilters[filterId]);
+ if (filter_v1_1 != NULL) {
+ status = filter_v1_1->configureAvStreamType(type);
+ } else {
+ ALOGW("[vts] Can't cast IFilter into v1_1.");
+ return failure();
+ }
+ return AssertionResult(status == Result::SUCCESS);
+}
+
AssertionResult FilterTests::configIpFilterCid(uint32_t ipCid, uint64_t filterId) {
Result status;
EXPECT_TRUE(mFilters[filterId]) << "Open Ip filter first.";
@@ -220,3 +255,19 @@
}
return AssertionResult(status == Result::SUCCESS);
}
+
+AssertionResult FilterTests::configureScramblingEvent(uint64_t filterId, uint32_t statuses) {
+ EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first.";
+ Result status;
+
+ sp<android::hardware::tv::tuner::V1_1::IFilter> filter_v1_1 =
+ android::hardware::tv::tuner::V1_1::IFilter::castFrom(mFilters[filterId]);
+ if (filter_v1_1 != NULL) {
+ status = filter_v1_1->configureScramblingEvent(statuses);
+ mFilterCallbacks[filterId]->testFilterScramblingEvent();
+ } else {
+ ALOGW("[vts] Can't cast IFilter into v1_1.");
+ return failure();
+ }
+ return AssertionResult(status == Result::SUCCESS);
+}
diff --git a/tv/tuner/1.1/vts/functional/FilterTests.h b/tv/tuner/1.1/vts/functional/FilterTests.h
index bc6db86..d88f171 100644
--- a/tv/tuner/1.1/vts/functional/FilterTests.h
+++ b/tv/tuner/1.1/vts/functional/FilterTests.h
@@ -54,6 +54,7 @@
using android::hardware::tv::tuner::V1_0::IDemux;
using android::hardware::tv::tuner::V1_0::IFilter;
using android::hardware::tv::tuner::V1_0::Result;
+using android::hardware::tv::tuner::V1_1::AvStreamType;
using android::hardware::tv::tuner::V1_1::DemuxFilterEventExt;
using android::hardware::tv::tuner::V1_1::IFilterCallback;
using android::hardware::tv::tuner::V1_1::ITuner;
@@ -116,6 +117,7 @@
void setMemSize(uint64_t size) { mAvSharedMemSize = size; }
void testFilterDataOutput();
+ void testFilterScramblingEvent();
void readFilterEventData();
bool dumpAvData(DemuxFilterMediaEvent event);
@@ -135,6 +137,7 @@
android::Condition mMsgCondition;
int mPidFilterOutputCount = 0;
+ int mScramblingStatusEvent = 0;
};
class FilterTests {
@@ -150,7 +153,9 @@
AssertionResult getSharedAvMemoryHandle(uint64_t filterId);
AssertionResult releaseShareAvHandle(uint64_t filterId);
AssertionResult configFilter(DemuxFilterSettings setting, uint64_t filterId);
+ AssertionResult configAvFilterStreamType(AvStreamType type, uint64_t filterId);
AssertionResult configIpFilterCid(uint32_t ipCid, uint64_t filterId);
+ AssertionResult configureScramblingEvent(uint64_t filterId, uint32_t statuses);
AssertionResult getFilterMQDescriptor(uint64_t filterId);
AssertionResult startFilter(uint64_t filterId);
AssertionResult stopFilter(uint64_t filterId);
diff --git a/tv/tuner/1.1/vts/functional/FrontendTests.cpp b/tv/tuner/1.1/vts/functional/FrontendTests.cpp
index e5793c1..0948f74 100644
--- a/tv/tuner/1.1/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/1.1/vts/functional/FrontendTests.cpp
@@ -58,6 +58,9 @@
case FrontendScanMessageExt1_1::hidl_discriminator::isHighPriority:
ALOGD("[vts] frontend ext1_1 scan message high priority: %d", message.isHighPriority());
break;
+ case FrontendScanMessageExt1_1::hidl_discriminator::annex:
+ ALOGD("[vts] frontend ext1_1 scan message dvbc annex: %hhu", message.annex());
+ break;
default:
break;
}
@@ -374,6 +377,22 @@
expectStatuses[i].tsDataRate().begin()));
break;
}
+ case FrontendStatusTypeExt1_1::ROLL_OFF: {
+ // TODO: verify roll off
+ break;
+ }
+ case FrontendStatusTypeExt1_1::IS_MISO: {
+ ASSERT_TRUE(realStatuses[i].isMiso() == expectStatuses[i].isMiso());
+ break;
+ }
+ case FrontendStatusTypeExt1_1::IS_LINEAR: {
+ ASSERT_TRUE(realStatuses[i].isLinear() == expectStatuses[i].isLinear());
+ break;
+ }
+ case FrontendStatusTypeExt1_1::IS_SHORT_FRAMES: {
+ ASSERT_TRUE(realStatuses[i].isShortFrames() == expectStatuses[i].isShortFrames());
+ break;
+ }
default: {
continue;
}
diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp
index 263b0e9..17abf49 100644
--- a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp
+++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp
@@ -22,6 +22,10 @@
return filterDataOutputTestBase(mFilterTests);
}
+AssertionResult TunerRecordHidlTest::filterDataOutputTest() {
+ return filterDataOutputTestBase(mFilterTests);
+}
+
void TunerFilterHidlTest::configSingleFilterInDemuxTest(FilterConfig filterConf,
FrontendConfig frontendConf) {
uint32_t feId;
@@ -42,6 +46,9 @@
if (filterConf.type.mainType == DemuxFilterMainType::IP) {
ASSERT_TRUE(mFilterTests.configIpFilterCid(filterConf.ipCid, filterId));
}
+ if (filterConf.statuses > 0) {
+ ASSERT_TRUE(mFilterTests.configureScramblingEvent(filterId, filterConf.statuses));
+ }
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
ASSERT_TRUE(mFilterTests.startFilter(filterId));
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
@@ -69,6 +76,7 @@
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(filterId));
ASSERT_TRUE(mFilterTests.getSharedAvMemoryHandle(filterId));
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
+ ASSERT_TRUE(mFilterTests.configAvFilterStreamType(filterConf.streamType, filterId));
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
ASSERT_TRUE(mFilterTests.startFilter(filterId));
// tune test
@@ -114,6 +122,7 @@
ASSERT_TRUE(mFilterTests.startFilter(filterId));
ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/));
mDvrTests.testRecordOutput();
+ ASSERT_TRUE(filterDataOutputTest());
mDvrTests.stopRecordThread();
ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.h b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.h
index f77a740..773224e 100644
--- a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.h
+++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.h
@@ -87,6 +87,7 @@
void recordSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf,
DvrConfig dvrConf);
+ AssertionResult filterDataOutputTest();
sp<ITuner> mService;
FrontendTests mFrontendTests;
diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h
index a3bfa1f..76bf765 100644
--- a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h
+++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h
@@ -46,9 +46,12 @@
using android::hardware::tv::tuner::V1_0::FrontendType;
using android::hardware::tv::tuner::V1_0::PlaybackSettings;
using android::hardware::tv::tuner::V1_0::RecordSettings;
+using android::hardware::tv::tuner::V1_1::AudioStreamType;
+using android::hardware::tv::tuner::V1_1::AvStreamType;
using android::hardware::tv::tuner::V1_1::FrontendSettingsExt1_1;
using android::hardware::tv::tuner::V1_1::FrontendStatusExt1_1;
using android::hardware::tv::tuner::V1_1::FrontendStatusTypeExt1_1;
+using android::hardware::tv::tuner::V1_1::VideoStreamType;
using namespace std;
@@ -91,7 +94,9 @@
uint32_t bufferSize;
DemuxFilterType type;
DemuxFilterSettings settings;
+ AvStreamType streamType;
uint32_t ipCid;
+ uint32_t statuses;
bool operator<(const FilterConfig& /*c*/) const { return false; }
};
@@ -134,10 +139,14 @@
frontendArray[DVBT].type = FrontendType::DVBT, frontendArray[DVBT].settings.dvbt(dvbtSettings);
vector<FrontendStatusTypeExt1_1> types;
types.push_back(FrontendStatusTypeExt1_1::UEC);
+ types.push_back(FrontendStatusTypeExt1_1::IS_MISO);
+ vector<FrontendStatusExt1_1> statuses;
FrontendStatusExt1_1 status;
status.uec(4);
- vector<FrontendStatusExt1_1> statuses;
statuses.push_back(status);
+ status.isMiso(true);
+ statuses.push_back(status);
+
frontendArray[DVBT].tuneStatusTypes = types;
frontendArray[DVBT].expectTuneStatuses = statuses;
frontendArray[DVBT].isSoftwareFe = true;
@@ -179,11 +188,13 @@
filterArray[TS_VIDEO0].bufferSize = FMQ_SIZE_16M;
filterArray[TS_VIDEO0].settings.ts().tpid = 256;
filterArray[TS_VIDEO0].settings.ts().filterSettings.av({.isPassthrough = false});
+ filterArray[TS_VIDEO0].statuses = 1;
filterArray[TS_VIDEO1].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_VIDEO1].type.subType.tsFilterType(DemuxTsFilterType::VIDEO);
filterArray[TS_VIDEO1].bufferSize = FMQ_SIZE_16M;
filterArray[TS_VIDEO1].settings.ts().tpid = 256;
filterArray[TS_VIDEO1].settings.ts().filterSettings.av({.isPassthrough = false});
+ filterArray[TS_VIDEO1].streamType.video(VideoStreamType::MPEG1);
// TS AUDIO filter setting
filterArray[TS_AUDIO0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_AUDIO0].type.subType.tsFilterType(DemuxTsFilterType::AUDIO);
@@ -195,6 +206,7 @@
filterArray[TS_AUDIO1].bufferSize = FMQ_SIZE_16M;
filterArray[TS_AUDIO1].settings.ts().tpid = 257;
filterArray[TS_AUDIO1].settings.ts().filterSettings.av({.isPassthrough = false});
+ filterArray[TS_VIDEO1].streamType.audio(AudioStreamType::MP3);
// TS PES filter setting
filterArray[TS_PES0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_PES0].type.subType.tsFilterType(DemuxTsFilterType::PES);
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index cad54fe..30512a9 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -73,6 +73,11 @@
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
"android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
+ "android.hardware.wifi@1.4",
+ "android.hardware.wifi@1.5",
"libwifi-system-iface",
],
test_suites: [
diff --git a/wifi/1.0/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_nan_iface_hidl_test.cpp
index 17abbd7..a74987c 100644
--- a/wifi/1.0/vts/functional/wifi_nan_iface_hidl_test.cpp
+++ b/wifi/1.0/vts/functional/wifi_nan_iface_hidl_test.cpp
@@ -20,6 +20,7 @@
#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/1.0/IWifiNanIface.h>
#include <android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h>
+#include <android/hardware/wifi/1.5/IWifiNanIface.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -483,6 +484,16 @@
TEST_P(WifiNanIfaceHidlTest, getCapabilitiesRequest) {
uint16_t inputCmdId = 10;
callbackType = INVALID;
+ sp<::android::hardware::wifi::V1_5::IWifiNanIface> iface_converted =
+ ::android::hardware::wifi::V1_5::IWifiNanIface::castFrom(iwifiNanIface);
+ if (iface_converted != nullptr) {
+ ASSERT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
+ HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest, inputCmdId)
+ .code);
+ // Skip this test since this API is deprecated in this newer HAL version
+ return;
+ }
+
ASSERT_EQ(
WifiStatusCode::SUCCESS,
HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest, inputCmdId).code);
diff --git a/wifi/1.4/vts/functional/Android.bp b/wifi/1.4/vts/functional/Android.bp
index 59a35e0..0051d27 100644
--- a/wifi/1.4/vts/functional/Android.bp
+++ b/wifi/1.4/vts/functional/Android.bp
@@ -52,6 +52,7 @@
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
"android.hardware.wifi@1.4",
+ "android.hardware.wifi@1.5",
"libwifi-system-iface",
],
test_suites: [
diff --git a/wifi/1.4/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.4/vts/functional/wifi_nan_iface_hidl_test.cpp
index 9b69f57..3ac047d 100644
--- a/wifi/1.4/vts/functional/wifi_nan_iface_hidl_test.cpp
+++ b/wifi/1.4/vts/functional/wifi_nan_iface_hidl_test.cpp
@@ -20,6 +20,7 @@
#include <android/hardware/wifi/1.2/IWifiNanIfaceEventCallback.h>
#include <android/hardware/wifi/1.4/IWifi.h>
#include <android/hardware/wifi/1.4/IWifiNanIface.h>
+#include <android/hardware/wifi/1.5/IWifiNanIface.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -488,6 +489,17 @@
callbackType = INVALID;
::android::hardware::wifi::V1_4::NanEnableRequest nanEnableRequest = {};
NanConfigRequestSupplemental nanConfigRequestSupp = {};
+
+ sp<::android::hardware::wifi::V1_5::IWifiNanIface> iface_converted =
+ ::android::hardware::wifi::V1_5::IWifiNanIface::castFrom(iwifiNanIface);
+ if (iface_converted != nullptr) {
+ ASSERT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
+ HIDL_INVOKE(iwifiNanIface, enableRequest_1_4, inputCmdId,
+ nanEnableRequest, nanConfigRequestSupp)
+ .code);
+ // Skip this test since this API is deprecated in this newer HAL version
+ return;
+ }
ASSERT_EQ(WifiStatusCode::SUCCESS,
HIDL_INVOKE(iwifiNanIface, enableRequest_1_4, inputCmdId,
nanEnableRequest, nanConfigRequestSupp)
@@ -509,6 +521,17 @@
nanEnableRequest.configParams.numberOfPublishServiceIdsInBeacon =
128; // must be <= 127
NanConfigRequestSupplemental nanConfigRequestSupp = {};
+
+ sp<::android::hardware::wifi::V1_5::IWifiNanIface> iface_converted =
+ ::android::hardware::wifi::V1_5::IWifiNanIface::castFrom(iwifiNanIface);
+ if (iface_converted != nullptr) {
+ ASSERT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
+ HIDL_INVOKE(iwifiNanIface, enableRequest_1_4, inputCmdId,
+ nanEnableRequest, nanConfigRequestSupp)
+ .code);
+ // Skip this test since this API is deprecated in this newer HAL version
+ return;
+ }
ASSERT_EQ(WifiStatusCode::ERROR_INVALID_ARGS,
HIDL_INVOKE(iwifiNanIface, enableRequest_1_4, inputCmdId,
nanEnableRequest, nanConfigRequestSupp)
@@ -523,6 +546,17 @@
callbackType = INVALID;
::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {};
NanConfigRequestSupplemental nanConfigRequestSupp = {};
+
+ sp<::android::hardware::wifi::V1_5::IWifiNanIface> iface_converted =
+ ::android::hardware::wifi::V1_5::IWifiNanIface::castFrom(iwifiNanIface);
+ if (iface_converted != nullptr) {
+ ASSERT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
+ HIDL_INVOKE(iwifiNanIface, configRequest_1_4, inputCmdId,
+ nanConfigRequest, nanConfigRequestSupp)
+ .code);
+ // Skip this test since this API is deprecated in this newer HAL version
+ return;
+ }
ASSERT_EQ(WifiStatusCode::SUCCESS,
HIDL_INVOKE(iwifiNanIface, configRequest_1_4, inputCmdId,
nanConfigRequest, nanConfigRequestSupp)
@@ -543,6 +577,18 @@
::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {};
nanConfigRequest.numberOfPublishServiceIdsInBeacon = 128; // must be <= 127
NanConfigRequestSupplemental nanConfigRequestSupp = {};
+
+ sp<::android::hardware::wifi::V1_5::IWifiNanIface> iface_converted =
+ ::android::hardware::wifi::V1_5::IWifiNanIface::castFrom(iwifiNanIface);
+ if (iface_converted != nullptr) {
+ ASSERT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
+ HIDL_INVOKE(iwifiNanIface, configRequest_1_4, inputCmdId,
+ nanConfigRequest, nanConfigRequestSupp)
+ .code);
+ // Skip this test since this API is deprecated in this newer HAL version
+ return;
+ }
+
ASSERT_EQ(WifiStatusCode::ERROR_INVALID_ARGS,
HIDL_INVOKE(iwifiNanIface, configRequest_1_4, inputCmdId,
nanConfigRequest, nanConfigRequestSupp)
diff --git a/wifi/1.5/Android.bp b/wifi/1.5/Android.bp
index 5304760..ecb0a35 100644
--- a/wifi/1.5/Android.bp
+++ b/wifi/1.5/Android.bp
@@ -7,6 +7,8 @@
"types.hal",
"IWifi.hal",
"IWifiChip.hal",
+ "IWifiNanIface.hal",
+ "IWifiNanIfaceEventCallback.hal",
],
interfaces: [
"android.hardware.wifi@1.0",
diff --git a/wifi/1.5/IWifiNanIface.hal b/wifi/1.5/IWifiNanIface.hal
new file mode 100644
index 0000000..93257b5
--- /dev/null
+++ b/wifi/1.5/IWifiNanIface.hal
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.5;
+
+import @1.0::CommandIdShort;
+import @1.0::WifiStatus;
+import @1.4::IWifiNanIface;
+import @1.4::NanConfigRequest;
+import @1.4::NanEnableRequest;
+import IWifiNanIfaceEventCallback;
+import NanConfigRequestSupplemental;
+
+/**
+ * Interface used to represent a single NAN (Neighbour Aware Network) iface.
+ *
+ * References to "NAN Spec" are to the Wi-Fi Alliance "Wi-Fi Neighbor Awareness
+ * Networking (NAN) Technical Specification".
+ */
+interface IWifiNanIface extends @1.4::IWifiNanIface {
+ /**
+ * Enable NAN: configures and activates NAN clustering (does not start
+ * a discovery session or set up data-interfaces or data-paths). Use the
+ * |IWifiNanIface.configureRequest| method to change the configuration of an already enabled
+ * NAN interface.
+ * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyEnableResponse|.
+ *
+ * Note: supersedes the @1.4::IWifiNanIface.enableRequest() method which is deprecated as of
+ * HAL version 1.5.
+ *
+ * @param cmdId command Id to use for this invocation.
+ * @param msg1 Instance of |NanEnableRequest|.
+ * @param msg2 Instance of |NanConfigRequestSupplemental|.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+ * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|,
+ * |WifiStatusCode.ERROR_UNKNOWN|
+ */
+ enableRequest_1_5(CommandIdShort cmdId, NanEnableRequest msg1,
+ NanConfigRequestSupplemental msg2) generates (WifiStatus status);
+
+ /**
+ * Configure NAN: configures an existing NAN functionality (i.e. assumes
+ * |IWifiNanIface.enableRequest| already submitted and succeeded).
+ * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyConfigResponse|.
+ *
+ * Note: supersedes the @1.4::IWifiNanIface.configRequest() method which is deprecated as of
+ * HAL version 1.5.
+ *
+ * @param cmdId command Id to use for this invocation.
+ * @param msg1 Instance of |NanConfigRequest|.
+ * @param msg2 Instance of |NanConfigRequestSupplemental|.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+ * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|,
+ * |WifiStatusCode.ERROR_UNKNOWN|
+ */
+ configRequest_1_5(CommandIdShort cmdId, NanConfigRequest msg1,
+ NanConfigRequestSupplemental msg2) generates (WifiStatus status);
+
+ /**
+ * Requests notifications of significant events on this iface. Multiple calls
+ * to this must register multiple callbacks each of which must receive all
+ * events.
+ *
+ * Note: supersedes the @1.2::IWifiNanIface.registerEventCallback() method which is deprecated
+ * as of HAL version 1.5.
+ *
+ * @param callback An instance of the |IWifiNanIfaceEventCallback| HIDL interface
+ * object.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
+ */
+ registerEventCallback_1_5(IWifiNanIfaceEventCallback callback)
+ generates (WifiStatus status);
+
+ /**
+ * Get NAN capabilities. Asynchronous response is with
+ * |IWifiNanIfaceEventCallback.notifyCapabilitiesResponse|.
+
+ * Note: supersedes the @1.0::IWifiNanIface.getCapabilitiesRequest() method which is deprecated
+ * as of HAL version 1.5.
+ *
+ * @param cmdId command Id to use for this invocation.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+ * |WifiStatusCode.ERROR_UNKNOWN|
+ */
+ getCapabilitiesRequest_1_5(CommandIdShort cmdId) generates (WifiStatus status);
+};
\ No newline at end of file
diff --git a/wifi/1.5/IWifiNanIfaceEventCallback.hal b/wifi/1.5/IWifiNanIfaceEventCallback.hal
new file mode 100644
index 0000000..867c03c
--- /dev/null
+++ b/wifi/1.5/IWifiNanIfaceEventCallback.hal
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.5;
+
+import @1.0::CommandIdShort;
+import @1.0::WifiNanStatus;
+import @1.2::IWifiNanIfaceEventCallback;
+
+/**
+ * NAN Response and Asynchronous Event Callbacks.
+ *
+ * References to "NAN Spec" are to the Wi-Fi Alliance "Wi-Fi Neighbor Awareness
+ * Networking (NAN) Technical Specification".
+ */
+interface IWifiNanIfaceEventCallback extends @1.2::IWifiNanIfaceEventCallback {
+ /**
+ * Asynchronous callback invoked in response to a capability request
+ * |IWifiNanIface.getCapabilitiesRequest|.
+ *
+ * Note: supersedes the @1.2::IWifiNanIfaceEventCallback.notifyCapabilitiesResponse() method
+ * which is deprecated as of HAL version 1.5.
+ *
+ * @param cmdId command Id corresponding to the original request.
+ * @param status WifiNanStatus of the operation. Possible status codes are:
+ * |NanStatusType.SUCCESS|
+ * @param capabilities Capability data.
+ */
+ oneway notifyCapabilitiesResponse_1_5(CommandIdShort id, WifiNanStatus status,
+ NanCapabilities capabilities);
+};
\ No newline at end of file
diff --git a/wifi/1.5/default/hidl_struct_util.cpp b/wifi/1.5/default/hidl_struct_util.cpp
index 91a82a7..578f3e2 100644
--- a/wifi/1.5/default/hidl_struct_util.cpp
+++ b/wifi/1.5/default/hidl_struct_util.cpp
@@ -1280,7 +1280,7 @@
bool convertHidlNanEnableRequest_1_4ToLegacy(
const V1_4::NanEnableRequest& hidl_request1,
- const V1_2::NanConfigRequestSupplemental& hidl_request2,
+ const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanEnableRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR)
@@ -1295,14 +1295,60 @@
legacy_request->config_discovery_beacon_int = 1;
legacy_request->discovery_beacon_interval =
- hidl_request2.discoveryBeaconIntervalMs;
+ hidl_request2.V1_2.discoveryBeaconIntervalMs;
legacy_request->config_nss = 1;
- legacy_request->nss = hidl_request2.numberOfSpatialStreamsInDiscovery;
+ legacy_request->nss = hidl_request2.V1_2.numberOfSpatialStreamsInDiscovery;
legacy_request->config_dw_early_termination = 1;
legacy_request->enable_dw_termination =
- hidl_request2.enableDiscoveryWindowEarlyTermination;
+ hidl_request2.V1_2.enableDiscoveryWindowEarlyTermination;
legacy_request->config_enable_ranging = 1;
- legacy_request->enable_ranging = hidl_request2.enableRanging;
+ legacy_request->enable_ranging = hidl_request2.V1_2.enableRanging;
+
+ return true;
+}
+
+bool convertHidlNanEnableRequest_1_5ToLegacy(
+ const V1_4::NanEnableRequest& hidl_request1,
+ const NanConfigRequestSupplemental& hidl_request2,
+ legacy_hal::NanEnableRequest* legacy_request) {
+ if (!legacy_request) {
+ LOG(ERROR)
+ << "convertHidlNanEnableRequest_1_5ToLegacy: null legacy_request";
+ return false;
+ }
+
+ *legacy_request = {};
+ if (!convertHidlNanEnableRequest_1_4ToLegacy(hidl_request1, hidl_request2,
+ legacy_request)) {
+ return false;
+ }
+
+ legacy_request->config_enable_instant_mode = 1;
+ legacy_request->enable_instant_mode =
+ hidl_request2.enableInstantCommunicationMode;
+
+ return true;
+}
+
+bool convertHidlNanConfigRequest_1_5ToLegacy(
+ const V1_4::NanConfigRequest& hidl_request1,
+ const NanConfigRequestSupplemental& hidl_request2,
+ legacy_hal::NanConfigRequest* legacy_request) {
+ if (!legacy_request) {
+ LOG(ERROR)
+ << "convertHidlNanConfigRequest_1_5ToLegacy: null legacy_request";
+ return false;
+ }
+
+ *legacy_request = {};
+ if (!convertHidlNanConfigRequest_1_4ToLegacy(hidl_request1, hidl_request2,
+ legacy_request)) {
+ return false;
+ }
+
+ legacy_request->config_enable_instant_mode = 1;
+ legacy_request->enable_instant_mode =
+ hidl_request2.enableInstantCommunicationMode;
return true;
}
@@ -1794,7 +1840,7 @@
bool convertHidlNanConfigRequest_1_4ToLegacy(
const V1_4::NanConfigRequest& hidl_request1,
- const V1_2::NanConfigRequestSupplemental& hidl_request2,
+ const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanConfigRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanConfigRequest_1_4ToLegacy: legacy_request "
@@ -1809,14 +1855,14 @@
legacy_request->config_discovery_beacon_int = 1;
legacy_request->discovery_beacon_interval =
- hidl_request2.discoveryBeaconIntervalMs;
+ hidl_request2.V1_2.discoveryBeaconIntervalMs;
legacy_request->config_nss = 1;
- legacy_request->nss = hidl_request2.numberOfSpatialStreamsInDiscovery;
+ legacy_request->nss = hidl_request2.V1_2.numberOfSpatialStreamsInDiscovery;
legacy_request->config_dw_early_termination = 1;
legacy_request->enable_dw_termination =
- hidl_request2.enableDiscoveryWindowEarlyTermination;
+ hidl_request2.V1_2.enableDiscoveryWindowEarlyTermination;
legacy_request->config_enable_ranging = 1;
- legacy_request->enable_ranging = hidl_request2.enableRanging;
+ legacy_request->enable_ranging = hidl_request2.V1_2.enableRanging;
return true;
}
@@ -2023,27 +2069,31 @@
}
*hidl_response = {};
- hidl_response->maxConcurrentClusters =
+ hidl_response->V1_0.maxConcurrentClusters =
legacy_response.max_concurrent_nan_clusters;
- hidl_response->maxPublishes = legacy_response.max_publishes;
- hidl_response->maxSubscribes = legacy_response.max_subscribes;
- hidl_response->maxServiceNameLen = legacy_response.max_service_name_len;
- hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len;
- hidl_response->maxTotalMatchFilterLen =
+ hidl_response->V1_0.maxPublishes = legacy_response.max_publishes;
+ hidl_response->V1_0.maxSubscribes = legacy_response.max_subscribes;
+ hidl_response->V1_0.maxServiceNameLen =
+ legacy_response.max_service_name_len;
+ hidl_response->V1_0.maxMatchFilterLen =
+ legacy_response.max_match_filter_len;
+ hidl_response->V1_0.maxTotalMatchFilterLen =
legacy_response.max_total_match_filter_len;
- hidl_response->maxServiceSpecificInfoLen =
+ hidl_response->V1_0.maxServiceSpecificInfoLen =
legacy_response.max_service_specific_info_len;
- hidl_response->maxExtendedServiceSpecificInfoLen =
+ hidl_response->V1_0.maxExtendedServiceSpecificInfoLen =
legacy_response.max_sdea_service_specific_info_len;
- hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces;
- hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions;
- hidl_response->maxAppInfoLen = legacy_response.max_app_info_len;
- hidl_response->maxQueuedTransmitFollowupMsgs =
+ hidl_response->V1_0.maxNdiInterfaces = legacy_response.max_ndi_interfaces;
+ hidl_response->V1_0.maxNdpSessions = legacy_response.max_ndp_sessions;
+ hidl_response->V1_0.maxAppInfoLen = legacy_response.max_app_info_len;
+ hidl_response->V1_0.maxQueuedTransmitFollowupMsgs =
legacy_response.max_queued_transmit_followup_msgs;
- hidl_response->maxSubscribeInterfaceAddresses =
+ hidl_response->V1_0.maxSubscribeInterfaceAddresses =
legacy_response.max_subscribe_address;
- hidl_response->supportedCipherSuites =
+ hidl_response->V1_0.supportedCipherSuites =
legacy_response.cipher_suites_supported;
+ hidl_response->instantCommunicationModeSupportFlag =
+ legacy_response.is_instant_mode_supported;
return true;
}
diff --git a/wifi/1.5/default/hidl_struct_util.h b/wifi/1.5/default/hidl_struct_util.h
index c6dc692..b0b1d22 100644
--- a/wifi/1.5/default/hidl_struct_util.h
+++ b/wifi/1.5/default/hidl_struct_util.h
@@ -26,6 +26,7 @@
#include <android/hardware/wifi/1.4/IWifiChipEventCallback.h>
#include <android/hardware/wifi/1.4/types.h>
#include <android/hardware/wifi/1.5/IWifiChip.h>
+#include <android/hardware/wifi/1.5/types.h>
#include "wifi_legacy_hal.h"
@@ -122,11 +123,19 @@
legacy_hal::NanConfigRequest* legacy_request);
bool convertHidlNanEnableRequest_1_4ToLegacy(
const V1_4::NanEnableRequest& hidl_request1,
- const V1_2::NanConfigRequestSupplemental& hidl_request2,
+ const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanEnableRequest* legacy_request);
bool convertHidlNanConfigRequest_1_4ToLegacy(
const V1_4::NanConfigRequest& hidl_request1,
- const V1_2::NanConfigRequestSupplemental& hidl_request2,
+ const NanConfigRequestSupplemental& hidl_request2,
+ legacy_hal::NanConfigRequest* legacy_request);
+bool convertHidlNanEnableRequest_1_5ToLegacy(
+ const V1_4::NanEnableRequest& hidl_request1,
+ const NanConfigRequestSupplemental& hidl_request2,
+ legacy_hal::NanEnableRequest* legacy_request);
+bool convertHidlNanConfigRequest_1_5ToLegacy(
+ const V1_4::NanConfigRequest& hidl_request1,
+ const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanConfigRequest* legacy_request);
bool convertHidlNanPublishRequestToLegacy(
const NanPublishRequest& hidl_request,
diff --git a/wifi/1.5/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/1.5/default/tests/wifi_nan_iface_unit_tests.cpp
index 411190b..52f0c2b 100644
--- a/wifi/1.5/default/tests/wifi_nan_iface_unit_tests.cpp
+++ b/wifi/1.5/default/tests/wifi_nan_iface_unit_tests.cpp
@@ -41,7 +41,6 @@
namespace V1_5 {
namespace implementation {
-using android::hardware::wifi::V1_2::IWifiNanIfaceEventCallback;
using android::hardware::wifi::V1_2::NanDataPathConfirmInd;
bool CaptureIfaceEventHandlers(
@@ -56,9 +55,10 @@
public:
MockNanIfaceEventCallback() = default;
- MOCK_METHOD3(notifyCapabilitiesResponse,
- Return<void>(uint16_t, const WifiNanStatus&,
- const NanCapabilities&));
+ MOCK_METHOD3(
+ notifyCapabilitiesResponse,
+ Return<void>(uint16_t, const WifiNanStatus&,
+ const android::hardware::wifi::V1_0::NanCapabilities&));
MOCK_METHOD2(notifyEnableResponse,
Return<void>(uint16_t, const WifiNanStatus&));
MOCK_METHOD2(notifyConfigResponse,
@@ -108,6 +108,9 @@
Return<void>(const NanDataPathConfirmInd&));
MOCK_METHOD1(eventDataPathScheduleUpdate,
Return<void>(const NanDataPathScheduleUpdateInd&));
+ MOCK_METHOD3(notifyCapabilitiesResponse_1_5,
+ Return<void>(uint16_t, const WifiNanStatus&,
+ const NanCapabilities&));
};
class WifiNanIfaceTest : public Test {
diff --git a/wifi/1.5/default/wifi_nan_iface.cpp b/wifi/1.5/default/wifi_nan_iface.cpp
index e2b0332..0cc6cd5 100644
--- a/wifi/1.5/default/wifi_nan_iface.cpp
+++ b/wifi/1.5/default/wifi_nan_iface.cpp
@@ -166,10 +166,10 @@
return;
}
for (const auto& callback :
- shared_ptr_this->getEventCallbacks()) {
+ shared_ptr_this->getEventCallbacks_1_5()) {
if (!callback
- ->notifyCapabilitiesResponse(id, wifiNanStatus,
- hidl_struct)
+ ->notifyCapabilitiesResponse_1_5(id, wifiNanStatus,
+ hidl_struct)
.isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -545,6 +545,7 @@
legacy_hal_.reset();
event_cb_handler_.invalidate();
event_cb_handler_1_2_.invalidate();
+ event_cb_handler_1_5_.invalidate();
is_valid_ = false;
if (is_dedicated_iface_) {
// If using a dedicated iface, set the iface down.
@@ -566,6 +567,10 @@
return event_cb_handler_1_2_.getCallbacks();
}
+std::set<sp<IWifiNanIfaceEventCallback>> WifiNanIface::getEventCallbacks_1_5() {
+ return event_cb_handler_1_5_.getCallbacks();
+}
+
Return<void> WifiNanIface::getName(getName_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::getNameInternal, hidl_status_cb);
@@ -738,6 +743,39 @@
hidl_status_cb, cmd_id, msg1, msg2);
}
+Return<void> WifiNanIface::registerEventCallback_1_5(
+ const sp<IWifiNanIfaceEventCallback>& callback,
+ registerEventCallback_1_5_cb hidl_status_cb) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+ &WifiNanIface::registerEventCallback_1_5Internal,
+ hidl_status_cb, callback);
+}
+
+Return<void> WifiNanIface::enableRequest_1_5(
+ uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
+ const NanConfigRequestSupplemental& msg2,
+ enableRequest_1_5_cb hidl_status_cb) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+ &WifiNanIface::enableRequest_1_5Internal,
+ hidl_status_cb, cmd_id, msg1, msg2);
+}
+
+Return<void> WifiNanIface::configRequest_1_5(
+ uint16_t cmd_id, const V1_4::NanConfigRequest& msg1,
+ const NanConfigRequestSupplemental& msg2,
+ configRequest_1_5_cb hidl_status_cb) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+ &WifiNanIface::configRequest_1_5Internal,
+ hidl_status_cb, cmd_id, msg1, msg2);
+}
+
+Return<void> WifiNanIface::getCapabilitiesRequest_1_5(
+ uint16_t cmd_id, getCapabilitiesRequest_1_5_cb hidl_status_cb) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+ &WifiNanIface::getCapabilitiesRequest_1_5Internal,
+ hidl_status_cb, cmd_id);
+}
+
std::pair<WifiStatus, std::string> WifiNanIface::getNameInternal() {
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
}
@@ -754,10 +792,8 @@
return createWifiStatus(WifiStatusCode::SUCCESS);
}
-WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t cmd_id) {
- legacy_hal::wifi_error legacy_status =
- legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id);
- return createWifiStatusFromLegacyError(legacy_status);
+WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t /* cmd_id */) {
+ return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}
WifiStatus WifiNanIface::enableRequestInternal(
@@ -890,7 +926,7 @@
WifiStatus WifiNanIface::enableRequest_1_2Internal(
uint16_t /* cmd_id */, const V1_0::NanEnableRequest& /* msg1 */,
- const V1_2::NanConfigRequestSupplemental& /*msg2 */) {
+ const V1_2::NanConfigRequestSupplemental& /* msg2 */) {
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}
@@ -901,10 +937,44 @@
}
WifiStatus WifiNanIface::enableRequest_1_4Internal(
+ uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */,
+ const V1_2::NanConfigRequestSupplemental& /* msg2 */) {
+ return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
+}
+
+WifiStatus WifiNanIface::configRequest_1_4Internal(
+ uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */,
+ const V1_2::NanConfigRequestSupplemental& /* msg2 */) {
+ return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
+}
+
+WifiStatus WifiNanIface::registerEventCallback_1_5Internal(
+ const sp<IWifiNanIfaceEventCallback>& callback) {
+ sp<V1_0::IWifiNanIfaceEventCallback> callback_1_0 = callback;
+ if (!event_cb_handler_.addCallback(callback_1_0)) {
+ return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+ }
+ sp<V1_2::IWifiNanIfaceEventCallback> callback_1_2 = callback;
+ if (!event_cb_handler_1_2_.addCallback(callback_1_2)) {
+ return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+ }
+ if (!event_cb_handler_1_5_.addCallback(callback)) {
+ return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+ }
+ return createWifiStatus(WifiStatusCode::SUCCESS);
+}
+
+WifiStatus WifiNanIface::getCapabilitiesRequest_1_5Internal(uint16_t cmd_id) {
+ legacy_hal::wifi_error legacy_status =
+ legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id);
+ return createWifiStatusFromLegacyError(legacy_status);
+}
+
+WifiStatus WifiNanIface::enableRequest_1_5Internal(
uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
- const V1_2::NanConfigRequestSupplemental& msg2) {
+ const NanConfigRequestSupplemental& msg2) {
legacy_hal::NanEnableRequest legacy_msg;
- if (!hidl_struct_util::convertHidlNanEnableRequest_1_4ToLegacy(
+ if (!hidl_struct_util::convertHidlNanEnableRequest_1_5ToLegacy(
msg1, msg2, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
@@ -913,11 +983,11 @@
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiNanIface::configRequest_1_4Internal(
+WifiStatus WifiNanIface::configRequest_1_5Internal(
uint16_t cmd_id, const V1_4::NanConfigRequest& msg1,
- const V1_2::NanConfigRequestSupplemental& msg2) {
+ const NanConfigRequestSupplemental& msg2) {
legacy_hal::NanConfigRequest legacy_msg;
- if (!hidl_struct_util::convertHidlNanConfigRequest_1_4ToLegacy(
+ if (!hidl_struct_util::convertHidlNanConfigRequest_1_5ToLegacy(
msg1, msg2, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
diff --git a/wifi/1.5/default/wifi_nan_iface.h b/wifi/1.5/default/wifi_nan_iface.h
index efdb2da..fb9c047 100644
--- a/wifi/1.5/default/wifi_nan_iface.h
+++ b/wifi/1.5/default/wifi_nan_iface.h
@@ -18,8 +18,8 @@
#define WIFI_NAN_IFACE_H_
#include <android-base/macros.h>
-#include <android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h>
-#include <android/hardware/wifi/1.4/IWifiNanIface.h>
+#include <android/hardware/wifi/1.5/IWifiNanIface.h>
+#include <android/hardware/wifi/1.5/IWifiNanIfaceEventCallback.h>
#include "hidl_callback_util.h"
#include "wifi_iface_util.h"
@@ -36,7 +36,7 @@
/**
* HIDL interface object used to control a NAN Iface instance.
*/
-class WifiNanIface : public V1_4::IWifiNanIface {
+class WifiNanIface : public V1_5::IWifiNanIface {
public:
WifiNanIface(const std::string& ifname, bool is_dedicated_iface,
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
@@ -112,6 +112,19 @@
uint16_t cmd_id, const V1_4::NanConfigRequest& msg1,
const V1_2::NanConfigRequestSupplemental& msg2,
configRequest_1_4_cb hidl_status_cb) override;
+ Return<void> registerEventCallback_1_5(
+ const sp<IWifiNanIfaceEventCallback>& callback,
+ registerEventCallback_1_5_cb hidl_status_cb) override;
+ Return<void> enableRequest_1_5(
+ uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
+ const NanConfigRequestSupplemental& msg2,
+ enableRequest_1_4_cb hidl_status_cb) override;
+ Return<void> configRequest_1_5(
+ uint16_t cmd_id, const V1_4::NanConfigRequest& msg1,
+ const NanConfigRequestSupplemental& msg2,
+ configRequest_1_4_cb hidl_status_cb) override;
+ Return<void> getCapabilitiesRequest_1_5(
+ uint16_t cmd_id, getCapabilitiesRequest_cb hidl_status_cb) override;
private:
// Corresponding worker functions for the HIDL methods.
@@ -158,11 +171,22 @@
WifiStatus configRequest_1_4Internal(
uint16_t cmd_id, const V1_4::NanConfigRequest& msg,
const V1_2::NanConfigRequestSupplemental& msg2);
+ WifiStatus registerEventCallback_1_5Internal(
+ const sp<IWifiNanIfaceEventCallback>& callback);
+ WifiStatus enableRequest_1_5Internal(
+ uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
+ const NanConfigRequestSupplemental& msg2);
+ WifiStatus configRequest_1_5Internal(
+ uint16_t cmd_id, const V1_4::NanConfigRequest& msg,
+ const NanConfigRequestSupplemental& msg2);
+ WifiStatus getCapabilitiesRequest_1_5Internal(uint16_t cmd_id);
// all 1_0 and descendant callbacks
std::set<sp<V1_0::IWifiNanIfaceEventCallback>> getEventCallbacks();
// all 1_2 and descendant callbacks
std::set<sp<V1_2::IWifiNanIfaceEventCallback>> getEventCallbacks_1_2();
+ // all 1_5 and descendant callbacks
+ std::set<sp<IWifiNanIfaceEventCallback>> getEventCallbacks_1_5();
std::string ifname_;
bool is_dedicated_iface_;
@@ -173,6 +197,8 @@
event_cb_handler_;
hidl_callback_util::HidlCallbackHandler<V1_2::IWifiNanIfaceEventCallback>
event_cb_handler_1_2_;
+ hidl_callback_util::HidlCallbackHandler<IWifiNanIfaceEventCallback>
+ event_cb_handler_1_5_;
DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
};
diff --git a/wifi/1.5/types.hal b/wifi/1.5/types.hal
index 71f0679..5873f79 100644
--- a/wifi/1.5/types.hal
+++ b/wifi/1.5/types.hal
@@ -17,6 +17,9 @@
package android.hardware.wifi@1.5;
import @1.0::WifiBand;
+import @1.0::NanCipherSuiteType;
+import @1.0::NanCapabilities;
+import @1.2::NanConfigRequestSupplemental;
/**
* Wifi bands defined in 80211 spec.
@@ -35,3 +38,32 @@
*/
BAND_24GHZ_5GHZ_WITH_DFS_6GHZ_60GHZ = 31,
};
+
+/**
+ * NAN configuration request parameters added in the 1.2 HAL. These are supplemental to previous
+ * versions.
+ */
+struct NanConfigRequestSupplemental {
+ /**
+ * Baseline information as defined in HAL 1.2.
+ */
+ @1.2::NanConfigRequestSupplemental V1_2;
+ /**
+ * Controls whether NAN instant communication mode is enabled.
+ */
+ bool enableInstantCommunicationMode;
+};
+
+/**
+ * NDP Capabilities response.
+ */
+struct NanCapabilities {
+ /**
+ * Baseline information as defined in HAL 1.0.
+ */
+ @1.0::NanCapabilities V1_0;
+ /**
+ * Flag to indicate id instant communication mode is supported.
+ */
+ bool instantCommunicationModeSupportFlag;
+};
\ No newline at end of file
diff --git a/wifi/1.5/vts/OWNERS b/wifi/1.5/vts/OWNERS
new file mode 100644
index 0000000..8bfb148
--- /dev/null
+++ b/wifi/1.5/vts/OWNERS
@@ -0,0 +1,2 @@
+rpius@google.com
+etancohen@google.com
diff --git a/wifi/1.5/vts/functional/Android.bp b/wifi/1.5/vts/functional/Android.bp
new file mode 100644
index 0000000..a7ba498
--- /dev/null
+++ b/wifi/1.5/vts/functional/Android.bp
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// These tests are split out so that they can be conditioned on presence of the
+// "android.hardware.wifi.aware" feature.
+cc_test {
+ name: "VtsHalWifiNanV1_5TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "wifi_nan_iface_hidl_test.cpp",
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
+ "android.hardware.wifi@1.4",
+ "android.hardware.wifi@1.5",
+ "libwifi-system-iface",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/wifi/1.5/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.5/vts/functional/wifi_nan_iface_hidl_test.cpp
new file mode 100644
index 0000000..803d39d
--- /dev/null
+++ b/wifi/1.5/vts/functional/wifi_nan_iface_hidl_test.cpp
@@ -0,0 +1,628 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Nanache 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-base/logging.h>
+
+#include <VtsCoreUtil.h>
+#include <android/hardware/wifi/1.5/IWifi.h>
+#include <android/hardware/wifi/1.5/IWifiNanIface.h>
+#include <android/hardware/wifi/1.5/IWifiNanIfaceEventCallback.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+#include "wifi_hidl_call_util.h"
+#include "wifi_hidl_test_utils.h"
+
+using namespace ::android::hardware::wifi::V1_0;
+using namespace ::android::hardware::wifi::V1_2;
+using namespace ::android::hardware::wifi::V1_4;
+using namespace ::android::hardware::wifi::V1_5;
+
+using ::android::sp;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+#define TIMEOUT_PERIOD 10
+
+android::sp<android::hardware::wifi::V1_5::IWifiNanIface> getWifiNanIface_1_5(
+ const std::string& instance_name) {
+ return android::hardware::wifi::V1_5::IWifiNanIface::castFrom(
+ getWifiNanIface(instance_name));
+}
+
+/**
+ * Fixture to use for all NAN Iface HIDL interface tests.
+ */
+class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> {
+ public:
+ virtual void SetUp() override {
+ if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware"))
+ GTEST_SKIP() << "Skipping this test since NAN is not supported.";
+ // Make sure to start with a clean state
+ stopWifi(GetInstanceName());
+
+ iwifiNanIface = getWifiNanIface_1_5(GetInstanceName());
+ ASSERT_NE(nullptr, iwifiNanIface.get());
+ ASSERT_EQ(WifiStatusCode::SUCCESS,
+ HIDL_INVOKE(iwifiNanIface, registerEventCallback_1_5,
+ new WifiNanIfaceEventCallback(*this))
+ .code);
+ }
+
+ virtual void TearDown() override { stopWifi(GetInstanceName()); }
+
+ /* Used as a mechanism to inform the test about data/event callback */
+ inline void notify() {
+ std::unique_lock<std::mutex> lock(mtx_);
+ count_++;
+ cv_.notify_one();
+ }
+
+ enum CallbackType {
+ INVALID = -2,
+ ANY_CALLBACK = -1,
+
+ NOTIFY_CAPABILITIES_RESPONSE = 0,
+ NOTIFY_ENABLE_RESPONSE,
+ NOTIFY_CONFIG_RESPONSE,
+ NOTIFY_DISABLE_RESPONSE,
+ NOTIFY_START_PUBLISH_RESPONSE,
+ NOTIFY_STOP_PUBLISH_RESPONSE,
+ NOTIFY_START_SUBSCRIBE_RESPONSE,
+ NOTIFY_STOP_SUBSCRIBE_RESPONSE,
+ NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE,
+ NOTIFY_CREATE_DATA_INTERFACE_RESPONSE,
+ NOTIFY_DELETE_DATA_INTERFACE_RESPONSE,
+ NOTIFY_INITIATE_DATA_PATH_RESPONSE,
+ NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE,
+ NOTIFY_TERMINATE_DATA_PATH_RESPONSE,
+ NOTIFY_CAPABILITIES_RESPONSE_1_5,
+
+ EVENT_CLUSTER_EVENT,
+ EVENT_DISABLED,
+ EVENT_PUBLISH_TERMINATED,
+ EVENT_SUBSCRIBE_TERMINATED,
+ EVENT_MATCH,
+ EVENT_MATCH_EXPIRED,
+ EVENT_FOLLOWUP_RECEIVED,
+ EVENT_TRANSMIT_FOLLOWUP,
+ EVENT_DATA_PATH_REQUEST,
+ EVENT_DATA_PATH_CONFIRM,
+ EVENT_DATA_PATH_TERMINATED,
+ EVENT_DATA_PATH_CONFIRM_1_2,
+ EVENT_DATA_PATH_SCHEDULE_UPDATE
+ };
+
+ /* Test code calls this function to wait for data/event callback */
+ /* Must set callbackType = INVALID before call this function */
+ inline std::cv_status wait(CallbackType waitForCallbackType) {
+ std::unique_lock<std::mutex> lock(mtx_);
+
+ EXPECT_NE(INVALID, waitForCallbackType); // can't ASSERT in a
+ // non-void-returning method
+
+ 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(TIMEOUT_PERIOD));
+ if (status == std::cv_status::timeout) return status;
+ if (waitForCallbackType != ANY_CALLBACK &&
+ callbackType != INVALID &&
+ callbackType != waitForCallbackType) {
+ count_--;
+ }
+ }
+ count_--;
+ return status;
+ }
+
+ class WifiNanIfaceEventCallback
+ : public ::android::hardware::wifi::V1_5::IWifiNanIfaceEventCallback {
+ WifiNanIfaceHidlTest& parent_;
+
+ public:
+ WifiNanIfaceEventCallback(WifiNanIfaceHidlTest& parent)
+ : parent_(parent){};
+
+ virtual ~WifiNanIfaceEventCallback() = default;
+
+ Return<void> notifyCapabilitiesResponse(
+ uint16_t id, const WifiNanStatus& status,
+ const ::android::hardware::wifi::V1_0::NanCapabilities&
+ capabilities) override {
+ parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+ parent_.capabilities = capabilities;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyCapabilitiesResponse_1_5(
+ uint16_t id, const WifiNanStatus& status,
+ const ::android::hardware::wifi::V1_5::NanCapabilities&
+ capabilities) override {
+ parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_5;
+
+ parent_.id = id;
+ parent_.status = status;
+ parent_.capabilities_1_5 = capabilities;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyEnableResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_ENABLE_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyConfigResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_CONFIG_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyDisableResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_DISABLE_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyStartPublishResponse(uint16_t id,
+ const WifiNanStatus& status,
+ uint8_t sessionId) override {
+ parent_.callbackType = NOTIFY_START_PUBLISH_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+ parent_.sessionId = sessionId;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyStopPublishResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_STOP_PUBLISH_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyStartSubscribeResponse(uint16_t id,
+ const WifiNanStatus& status,
+ uint8_t sessionId) override {
+ parent_.callbackType = NOTIFY_START_SUBSCRIBE_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+ parent_.sessionId = sessionId;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyStopSubscribeResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_STOP_SUBSCRIBE_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyTransmitFollowupResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyCreateDataInterfaceResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyDeleteDataInterfaceResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyInitiateDataPathResponse(
+ uint16_t id, const WifiNanStatus& status,
+ uint32_t ndpInstanceId) override {
+ parent_.callbackType = NOTIFY_INITIATE_DATA_PATH_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+ parent_.ndpInstanceId = ndpInstanceId;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyRespondToDataPathIndicationResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType =
+ NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> notifyTerminateDataPathResponse(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = NOTIFY_TERMINATE_DATA_PATH_RESPONSE;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventClusterEvent(
+ const NanClusterEventInd& event) override {
+ parent_.callbackType = EVENT_CLUSTER_EVENT;
+
+ parent_.nanClusterEventInd = event;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventDisabled(const WifiNanStatus& status) override {
+ parent_.callbackType = EVENT_DISABLED;
+
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventPublishTerminated(
+ uint8_t sessionId, const WifiNanStatus& status) override {
+ parent_.callbackType = EVENT_PUBLISH_TERMINATED;
+
+ parent_.sessionId = sessionId;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventSubscribeTerminated(
+ uint8_t sessionId, const WifiNanStatus& status) override {
+ parent_.callbackType = EVENT_SUBSCRIBE_TERMINATED;
+
+ parent_.sessionId = sessionId;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventMatch(const NanMatchInd& event) override {
+ parent_.callbackType = EVENT_MATCH;
+
+ parent_.nanMatchInd = event;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventMatchExpired(uint8_t discoverySessionId,
+ uint32_t peerId) override {
+ parent_.callbackType = EVENT_MATCH_EXPIRED;
+
+ parent_.sessionId = discoverySessionId;
+ parent_.peerId = peerId;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventFollowupReceived(
+ const NanFollowupReceivedInd& event) override {
+ parent_.callbackType = EVENT_FOLLOWUP_RECEIVED;
+
+ parent_.nanFollowupReceivedInd = event;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventTransmitFollowup(
+ uint16_t id, const WifiNanStatus& status) override {
+ parent_.callbackType = EVENT_TRANSMIT_FOLLOWUP;
+
+ parent_.id = id;
+ parent_.status = status;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventDataPathRequest(
+ const NanDataPathRequestInd& event) override {
+ parent_.callbackType = EVENT_DATA_PATH_REQUEST;
+
+ parent_.nanDataPathRequestInd = event;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventDataPathConfirm(
+ const ::android::hardware::wifi::V1_0::NanDataPathConfirmInd& event)
+ override {
+ parent_.callbackType = EVENT_DATA_PATH_CONFIRM;
+
+ parent_.nanDataPathConfirmInd = event;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventDataPathTerminated(uint32_t ndpInstanceId) override {
+ parent_.callbackType = EVENT_DATA_PATH_TERMINATED;
+
+ parent_.ndpInstanceId = ndpInstanceId;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventDataPathConfirm_1_2(
+ const ::android::hardware::wifi::V1_2::NanDataPathConfirmInd& event)
+ override {
+ parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_2;
+
+ parent_.nanDataPathConfirmInd_1_2 = event;
+
+ parent_.notify();
+ return Void();
+ }
+
+ Return<void> eventDataPathScheduleUpdate(
+ const NanDataPathScheduleUpdateInd& event) override {
+ parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE;
+
+ parent_.nanDataPathScheduleUpdateInd = event;
+
+ parent_.notify();
+ return Void();
+ }
+ };
+
+ private:
+ // synchronization objects
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int count_ = 0;
+
+ protected:
+ android::sp<::android::hardware::wifi::V1_5::IWifiNanIface> iwifiNanIface;
+
+ // Data from IWifiNanIfaceEventCallback callbacks: this is the collection of
+ // all arguments to all callbacks. They are set by the callback
+ // (notifications or events) and can be retrieved by tests.
+ CallbackType callbackType;
+ uint16_t id;
+ WifiNanStatus status;
+ uint8_t sessionId;
+ uint32_t ndpInstanceId;
+ NanClusterEventInd nanClusterEventInd;
+ NanMatchInd nanMatchInd;
+ uint32_t peerId;
+ NanFollowupReceivedInd nanFollowupReceivedInd;
+ NanDataPathRequestInd nanDataPathRequestInd;
+ ::android::hardware::wifi::V1_0::NanCapabilities capabilities;
+ ::android::hardware::wifi::V1_5::NanCapabilities capabilities_1_5;
+ ::android::hardware::wifi::V1_0::NanDataPathConfirmInd
+ nanDataPathConfirmInd;
+ ::android::hardware::wifi::V1_2::NanDataPathConfirmInd
+ nanDataPathConfirmInd_1_2;
+ NanDataPathScheduleUpdateInd nanDataPathScheduleUpdateInd;
+
+ std::string GetInstanceName() { return GetParam(); }
+};
+
+/*
+ * Create:
+ * Ensures that an instance of the IWifiNanIface proxy object is
+ * successfully created.
+ */
+TEST_P(WifiNanIfaceHidlTest, Create) {
+ // The creation of a proxy object is tested as part of SetUp method.
+}
+
+/*
+ * enableRequest_1_5InvalidArgs: validate that fails with invalid arguments
+ */
+TEST_P(WifiNanIfaceHidlTest, enableRequest_1_5InvalidArgs) {
+ uint16_t inputCmdId = 10;
+ callbackType = INVALID;
+ ::android::hardware::wifi::V1_4::NanEnableRequest nanEnableRequest = {};
+ ::android::hardware::wifi::V1_5::NanConfigRequestSupplemental
+ nanConfigRequestSupp = {};
+ const auto& halStatus =
+ HIDL_INVOKE(iwifiNanIface, enableRequest_1_5, inputCmdId,
+ nanEnableRequest, nanConfigRequestSupp);
+ if (halStatus.code != WifiStatusCode::ERROR_NOT_SUPPORTED) {
+ ASSERT_EQ(WifiStatusCode::SUCCESS, halStatus.code);
+
+ // wait for a callback
+ ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE));
+ ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType);
+ ASSERT_EQ(id, inputCmdId);
+ ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
+ }
+}
+
+/*
+ * enableRequest_1_5ShimInvalidArgs: validate that fails with invalid arguments
+ * to the shim
+ */
+TEST_P(WifiNanIfaceHidlTest, enableRequest_1_5ShimInvalidArgs) {
+ uint16_t inputCmdId = 10;
+ ::android::hardware::wifi::V1_4::NanEnableRequest nanEnableRequest = {};
+ nanEnableRequest.configParams.numberOfPublishServiceIdsInBeacon =
+ 128; // must be <= 127
+ ::android::hardware::wifi::V1_5::NanConfigRequestSupplemental
+ nanConfigRequestSupp = {};
+ const auto& halStatus =
+ HIDL_INVOKE(iwifiNanIface, enableRequest_1_5, inputCmdId,
+ nanEnableRequest, nanConfigRequestSupp);
+ if (halStatus.code != WifiStatusCode::ERROR_NOT_SUPPORTED) {
+ ASSERT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, halStatus.code);
+ }
+}
+
+/*
+ * configRequest_1_5InvalidArgs: validate that fails with invalid arguments
+ */
+TEST_P(WifiNanIfaceHidlTest, configRequest_1_5InvalidArgs) {
+ uint16_t inputCmdId = 10;
+ callbackType = INVALID;
+ ::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {};
+ ::android::hardware::wifi::V1_5::NanConfigRequestSupplemental
+ nanConfigRequestSupp = {};
+ const auto& halStatus =
+ HIDL_INVOKE(iwifiNanIface, configRequest_1_5, inputCmdId,
+ nanConfigRequest, nanConfigRequestSupp);
+
+ if (halStatus.code != WifiStatusCode::ERROR_NOT_SUPPORTED) {
+ ASSERT_EQ(WifiStatusCode::SUCCESS, halStatus.code);
+
+ // wait for a callback
+ ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE));
+ ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callbackType);
+ ASSERT_EQ(id, inputCmdId);
+ ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
+ }
+}
+
+/*
+ * configRequest_1_5ShimInvalidArgs: validate that fails with invalid arguments
+ * to the shim
+ */
+TEST_P(WifiNanIfaceHidlTest, configRequest_1_5ShimInvalidArgs) {
+ uint16_t inputCmdId = 10;
+ ::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {};
+ nanConfigRequest.numberOfPublishServiceIdsInBeacon = 128; // must be <= 127
+ ::android::hardware::wifi::V1_5::NanConfigRequestSupplemental
+ nanConfigRequestSupp = {};
+ const auto& halStatus =
+ HIDL_INVOKE(iwifiNanIface, configRequest_1_5, inputCmdId,
+ nanConfigRequest, nanConfigRequestSupp);
+ if (halStatus.code != WifiStatusCode::ERROR_NOT_SUPPORTED) {
+ ASSERT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, halStatus.code);
+ }
+}
+
+/*
+ * getCapabilitiesRequest: validate that returns capabilities.
+ */
+TEST_P(WifiNanIfaceHidlTest, getCapabilitiesRequest_1_5) {
+ uint16_t inputCmdId = 10;
+ callbackType = INVALID;
+ const auto& halStatus =
+ HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest_1_5, inputCmdId).code;
+ ASSERT_EQ(WifiStatusCode::SUCCESS, halStatus);
+ // wait for a callback
+ ASSERT_EQ(std::cv_status::no_timeout,
+ wait(NOTIFY_CAPABILITIES_RESPONSE_1_5));
+ ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE_1_5, callbackType);
+ ASSERT_EQ(id, inputCmdId);
+
+ // check for reasonable capability values
+ EXPECT_GT(capabilities_1_5.V1_0.maxConcurrentClusters, (unsigned int)0);
+ EXPECT_GT(capabilities_1_5.V1_0.maxPublishes, (unsigned int)0);
+ EXPECT_GT(capabilities_1_5.V1_0.maxSubscribes, (unsigned int)0);
+ EXPECT_EQ(capabilities_1_5.V1_0.maxServiceNameLen, (unsigned int)255);
+ EXPECT_EQ(capabilities_1_5.V1_0.maxMatchFilterLen, (unsigned int)255);
+ EXPECT_GT(capabilities_1_5.V1_0.maxTotalMatchFilterLen, (unsigned int)255);
+ EXPECT_EQ(capabilities_1_5.V1_0.maxServiceSpecificInfoLen,
+ (unsigned int)255);
+ EXPECT_GE(capabilities_1_5.V1_0.maxExtendedServiceSpecificInfoLen,
+ (unsigned int)255);
+ EXPECT_GT(capabilities_1_5.V1_0.maxNdiInterfaces, (unsigned int)0);
+ EXPECT_GT(capabilities_1_5.V1_0.maxNdpSessions, (unsigned int)0);
+ EXPECT_GT(capabilities_1_5.V1_0.maxAppInfoLen, (unsigned int)0);
+ EXPECT_GT(capabilities_1_5.V1_0.maxQueuedTransmitFollowupMsgs,
+ (unsigned int)0);
+ EXPECT_GT(capabilities_1_5.V1_0.maxSubscribeInterfaceAddresses,
+ (unsigned int)0);
+ EXPECT_NE(capabilities_1_5.V1_0.supportedCipherSuites, (unsigned int)0);
+ EXPECT_TRUE(capabilities_1_5.instantCommunicationModeSupportFlag ||
+ !capabilities_1_5.instantCommunicationModeSupportFlag);
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiNanIfaceHidlTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, WifiNanIfaceHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(
+ ::android::hardware::wifi::V1_5::IWifi::descriptor)),
+ android::hardware::PrintInstanceNameToString);
diff --git a/wifi/supplicant/1.4/Android.bp b/wifi/supplicant/1.4/Android.bp
index df0b23a..0a039de 100644
--- a/wifi/supplicant/1.4/Android.bp
+++ b/wifi/supplicant/1.4/Android.bp
@@ -6,8 +6,10 @@
srcs: [
"types.hal",
"ISupplicant.hal",
+ "ISupplicantP2pIface.hal",
"ISupplicantStaIface.hal",
"ISupplicantStaNetwork.hal",
+ "ISupplicantStaNetworkCallback.hal",
],
interfaces: [
"android.hardware.wifi.supplicant@1.0",
diff --git a/wifi/supplicant/1.4/ISupplicantP2pIface.hal b/wifi/supplicant/1.4/ISupplicantP2pIface.hal
new file mode 100644
index 0000000..7c41d1c
--- /dev/null
+++ b/wifi/supplicant/1.4/ISupplicantP2pIface.hal
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant@1.4;
+
+import @1.2::ISupplicantP2pIface;
+import @1.0::SupplicantStatus;
+
+/**
+ * Interface exposed by the supplicant for each P2P mode network
+ * interface (e.g p2p0) it controls.
+ * To use 1.4 features you must cast specific interfaces returned from the
+ * 1.4 HAL. For example V1_4::ISupplicant::addIface() adds V1_4::ISupplicantIface,
+ * which can be cast to V1_4::ISupplicantP2pIface.
+ */
+interface ISupplicantP2pIface extends @1.2::ISupplicantP2pIface {
+ /**
+ * Set whether to enable EDMG(802.11ay). Only allowed if hw mode is |HOSTAPD_MODE_IEEE80211AD|
+ *
+ * @param enable true to set, false otherwise.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+ */
+ setEdmg(bool enable) generates (SupplicantStatus status);
+
+ /**
+ * Get whether EDMG(802.11ay) is enabled for this network.
+ *
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+ * @return enabled true if set, false otherwise.
+ */
+ getEdmg() generates (SupplicantStatus status, bool enabled);
+};
diff --git a/wifi/supplicant/1.4/ISupplicantStaNetwork.hal b/wifi/supplicant/1.4/ISupplicantStaNetwork.hal
index 7b043d0..f12ace4 100644
--- a/wifi/supplicant/1.4/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.4/ISupplicantStaNetwork.hal
@@ -17,6 +17,7 @@
package android.hardware.wifi.supplicant@1.4;
import @1.3::ISupplicantStaNetwork;
+import @1.4::ISupplicantStaNetworkCallback;
import @1.0::SupplicantStatus;
/**
@@ -123,4 +124,23 @@
* @return enabled true if set, false otherwise.
*/
getEdmg() generates (SupplicantStatus status, bool enabled);
+
+ /**
+ * Register for callbacks from this network.
+ *
+ * These callbacks are invoked for events that are specific to this network.
+ * Registration of multiple callback objects is supported. These objects must
+ * be automatically deleted when the corresponding client process is dead or
+ * if this network is removed.
+ *
+ * @param callback An instance of the |ISupplicantStaNetworkCallback| HIDL
+ * interface object.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+ */
+ registerCallback_1_4(ISupplicantStaNetworkCallback callback)
+ generates (SupplicantStatus status);
};
diff --git a/wifi/supplicant/1.4/ISupplicantStaNetworkCallback.hal b/wifi/supplicant/1.4/ISupplicantStaNetworkCallback.hal
new file mode 100644
index 0000000..38cdcf9
--- /dev/null
+++ b/wifi/supplicant/1.4/ISupplicantStaNetworkCallback.hal
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant@1.4;
+
+import @1.0::ISupplicantStaNetworkCallback;
+
+/**
+ * Callback Interface exposed by the supplicant service
+ * for each network (ISupplicantStaNetwork).
+ *
+ * Clients need to host an instance of this HIDL interface object and
+ * pass a reference of the object to the supplicant via the
+ * corresponding |ISupplicantStaNetwork.registerCallback_1_4| method.
+ */
+interface ISupplicantStaNetworkCallback extends @1.0::ISupplicantStaNetworkCallback {
+ /**
+ * WPA3™ Specification Addendum for WPA3 R3 - Table 3.
+ * Transition Disable Indication filled in the third
+ * 4-way handshake message.
+ */
+ enum TransitionDisableIndication : uint32_t {
+ USE_WPA3_PERSONAL = 1 << 0,
+ USE_SAE_PK = 1 << 1,
+ USE_WPA3_ENTERPRISE = 1 << 2,
+ USE_ENHANCED_OPEN = 1 << 3,
+ };
+
+ /**
+ * Used to notify WPA3 transition disable.
+ */
+ oneway onTransitionDisable(bitfield<TransitionDisableIndication> ind);
+};
diff --git a/wifi/supplicant/1.4/vts/functional/Android.bp b/wifi/supplicant/1.4/vts/functional/Android.bp
index 7f2ba70..d6af0a0 100644
--- a/wifi/supplicant/1.4/vts/functional/Android.bp
+++ b/wifi/supplicant/1.4/vts/functional/Android.bp
@@ -44,6 +44,38 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
"supplicant_sta_iface_hidl_test.cpp",
+ "supplicant_sta_network_hidl_test.cpp",
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_1TargetTestUtil",
+ "VtsHalWifiSupplicantV1_2TargetTestUtil",
+ "VtsHalWifiSupplicantV1_3TargetTestUtil",
+ "VtsHalWifiSupplicantV1_4TargetTestUtil",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
+ "android.hardware.wifi.supplicant@1.2",
+ "android.hardware.wifi.supplicant@1.3",
+ "android.hardware.wifi.supplicant@1.4",
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "libgmock",
+ "libwifi-system",
+ "libwifi-system-iface",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+ disable_framework: true,
+}
+
+cc_test {
+ name: "VtsHalWifiSupplicantP2pV1_4TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "supplicant_p2p_iface_hidl_test.cpp",
],
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.cpp
index 3a59bd6..7e7a465 100644
--- a/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.cpp
+++ b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.cpp
@@ -21,6 +21,7 @@
using ::android::sp;
using ::android::hardware::wifi::supplicant::V1_4::ISupplicant;
+using ::android::hardware::wifi::supplicant::V1_4::ISupplicantP2pIface;
using ::android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface;
sp<ISupplicantStaIface> getSupplicantStaIface_1_4(
@@ -29,6 +30,12 @@
return ISupplicantStaIface::castFrom(getSupplicantStaIface(supplicant));
}
+sp<ISupplicantP2pIface> getSupplicantP2pIface_1_4(
+ const android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicant>&
+ supplicant) {
+ return ISupplicantP2pIface::castFrom(getSupplicantP2pIface(supplicant));
+}
+
sp<ISupplicant> getSupplicant_1_4(const std::string& supplicant_instance_name,
bool isP2pOn) {
return ISupplicant::castFrom(
diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.h b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.h
index 60fe1dc..b3b6990 100644
--- a/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.h
+++ b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.h
@@ -18,12 +18,17 @@
#define SUPPLICANT_HIDL_TEST_UTILS_1_4_H
#include <android/hardware/wifi/supplicant/1.4/ISupplicant.h>
+#include <android/hardware/wifi/supplicant/1.4/ISupplicantP2pIface.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaIface.h>
android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface>
getSupplicantStaIface_1_4(
const android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicant>&
supplicant);
+android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicantP2pIface>
+getSupplicantP2pIface_1_4(
+ const android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicant>&
+ supplicant);
android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicant>
getSupplicant_1_4(const std::string& supplicant_instance_name, bool isP2pOn);
diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_p2p_iface_hidl_test.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_p2p_iface_hidl_test.cpp
new file mode 100644
index 0000000..17e1b9f
--- /dev/null
+++ b/wifi/supplicant/1.4/vts/functional/supplicant_p2p_iface_hidl_test.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <VtsCoreUtil.h>
+#include <android/hardware/wifi/1.1/IWifi.h>
+#include <android/hardware/wifi/supplicant/1.4/ISupplicant.h>
+#include <android/hardware/wifi/supplicant/1.4/ISupplicantP2pIface.h>
+#include <android/hardware/wifi/supplicant/1.4/types.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/HidlSupport.h>
+#include <hidl/ServiceManagement.h>
+
+#include "supplicant_hidl_test_utils.h"
+#include "supplicant_hidl_test_utils_1_4.h"
+
+using ::android::sp;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+using ::android::hardware::wifi::supplicant::V1_4::ISupplicantP2pIface;
+
+class SupplicantP2pIfaceHidlTest : public SupplicantHidlTestBaseV1_4 {
+ public:
+ virtual void SetUp() override {
+ SupplicantHidlTestBaseV1_4::SetUp();
+ p2p_iface_ = getSupplicantP2pIface_1_4(supplicant_);
+ ASSERT_NE(p2p_iface_.get(), nullptr);
+ }
+
+ protected:
+ // ISupplicantP2pIface object used for all tests in this fixture.
+ sp<ISupplicantP2pIface> p2p_iface_;
+};
+
+/*
+ * SetGetEdmg
+ */
+TEST_P(SupplicantP2pIfaceHidlTest, SetGetEdmg) {
+ p2p_iface_->setEdmg(true, [&](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+ p2p_iface_->getEdmg([&](const SupplicantStatus& status, bool enable) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(true, enable);
+ });
+ p2p_iface_->setEdmg(false, [&](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+ p2p_iface_->getEdmg([&](const SupplicantStatus& status, bool enable) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(false, enable);
+ });
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantP2pIfaceHidlTest);
+INSTANTIATE_TEST_CASE_P(
+ PerInstance, SupplicantP2pIfaceHidlTest,
+ testing::Combine(
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(
+ android::hardware::wifi::V1_0::IWifi::descriptor)),
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(
+ android::hardware::wifi::supplicant::V1_4::ISupplicant::
+ descriptor))),
+ android::hardware::PrintInstanceTupleNameToString<>);
diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_sta_network_hidl_test.cpp
new file mode 100644
index 0000000..32e4f17
--- /dev/null
+++ b/wifi/supplicant/1.4/vts/functional/supplicant_sta_network_hidl_test.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+
+#include <VtsCoreUtil.h>
+#include <android/hardware/wifi/1.0/IWifi.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaNetwork.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+
+#include "supplicant_hidl_test_utils.h"
+#include "supplicant_hidl_test_utils_1_4.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicant;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+using ::android::hardware::wifi::supplicant::V1_4::
+ ISupplicantStaNetworkCallback;
+using ::android::hardware::wifi::V1_0::IWifi;
+
+class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBaseV1_4 {
+ public:
+ virtual void SetUp() override {
+ SupplicantHidlTestBaseV1_4::SetUp();
+ sta_network_ = createSupplicantStaNetwork(supplicant_);
+ ASSERT_NE(sta_network_.get(), nullptr);
+ /* variable used to check if the underlying HAL version is 1.4 or
+ * higher. This is to skip tests which are using deprecated methods.
+ */
+ v1_4 = ::android::hardware::wifi::supplicant::V1_4::
+ ISupplicantStaNetwork::castFrom(sta_network_);
+ }
+
+ protected:
+ sp<::android::hardware::wifi::supplicant::V1_4::ISupplicantStaNetwork>
+ v1_4 = nullptr;
+ // ISupplicantStaNetwork object used for all tests in this fixture.
+ sp<ISupplicantStaNetwork> sta_network_;
+};
+
+class NetworkCallback : public ISupplicantStaNetworkCallback {
+ Return<void> onNetworkEapSimGsmAuthRequest(
+ const ISupplicantStaNetworkCallback::NetworkRequestEapSimGsmAuthParams&
+ /* params */) override {
+ return Void();
+ }
+ Return<void> onNetworkEapSimUmtsAuthRequest(
+ const ISupplicantStaNetworkCallback::NetworkRequestEapSimUmtsAuthParams&
+ /* params */) override {
+ return Void();
+ }
+ Return<void> onNetworkEapIdentityRequest() override { return Void(); }
+ Return<void> onTransitionDisable(uint32_t /* params */) override {
+ return Void();
+ }
+};
+
+/*
+ * RegisterCallback
+ */
+TEST_P(SupplicantStaNetworkHidlTest, RegisterCallback_1_4) {
+ v1_4->registerCallback_1_4(
+ new NetworkCallback(), [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkHidlTest);
+INSTANTIATE_TEST_CASE_P(
+ PerInstance, SupplicantStaNetworkHidlTest,
+ testing::Combine(
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(
+ ISupplicant::descriptor))),
+ android::hardware::PrintInstanceTupleNameToString<>);