Merge "bug fix: handle OMX_EventBufferFlag events" into oc-mr1-dev
diff --git a/audio/2.0/config/audio_policy_configuration.xsd b/audio/2.0/config/audio_policy_configuration.xsd
index 48b9a9b..c94da80 100644
--- a/audio/2.0/config/audio_policy_configuration.xsd
+++ b/audio/2.0/config/audio_policy_configuration.xsd
@@ -188,6 +188,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="gains" type="gains" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:token" use="required"/>
<xs:attribute name="role" type="role" use="required"/>
@@ -199,6 +200,10 @@
<xs:field xpath="samplingRate"/>
<xs:field xpath="channelMasks"/>
</xs:unique>
+ <xs:unique name="mixPortGainUniqueness">
+ <xs:selector xpath="gains/gain"/>
+ <xs:field xpath="@name"/>
+ </xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
@@ -365,16 +370,42 @@
<xs:attribute name="samplingRates" type="samplingRates" use="required"/>
<xs:attribute name="channelMasks" type="channelMask" use="required"/>
</xs:complexType>
+ <xs:simpleType name="gainMode">
+ <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: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="channel_mask" type="channelMask" use="optional"/>
+ <xs:attribute name="minValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="maxValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="defaultValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="stepValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="minRampMs" type="xs:int" use="optional"/>
+ <xs:attribute name="maxRampMs" type="xs:int" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="devicePorts">
<xs:sequence>
<xs:element name="devicePort" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="gains" type="gains" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="tagName" type="xs:token" use="required"/>
<xs:attribute name="type" type="audioDevice" use="required"/>
<xs:attribute name="role" type="role" use="required"/>
+ <xs:attribute name="address" type="xs:string" use="optional"/>
</xs:complexType>
<xs:unique name="devicePortProfileUniqueness">
<xs:selector xpath="profile"/>
@@ -382,6 +413,10 @@
<xs:field xpath="samplingRate"/>
<xs:field xpath="channelMasks"/>
</xs:unique>
+ <xs:unique name="devicePortGainUniqueness">
+ <xs:selector xpath="gains/gain"/>
+ <xs:field xpath="@name"/>
+ </xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
diff --git a/automotive/vehicle/2.1/Android.mk b/automotive/vehicle/2.1/Android.mk
index 095a1c7..3001da0 100644
--- a/automotive/vehicle/2.1/Android.mk
+++ b/automotive/vehicle/2.1/Android.mk
@@ -18,9 +18,9 @@
#
-# Build types.hal (CommonIgnitionMonitors)
+# Build types.hal (DiagnosticFloatSensorIndex)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/CommonIgnitionMonitors.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/DiagnosticFloatSensorIndex.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -30,16 +30,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.CommonIgnitionMonitors
+ android.hardware.automotive.vehicle@2.1::types.DiagnosticFloatSensorIndex
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (CompressionIgnitionMonitors)
+# Build types.hal (DiagnosticIntegerSensorIndex)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/CompressionIgnitionMonitors.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/DiagnosticIntegerSensorIndex.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -49,16 +49,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.CompressionIgnitionMonitors
+ android.hardware.automotive.vehicle@2.1::types.DiagnosticIntegerSensorIndex
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (FuelSystemStatus)
+# Build types.hal (Obd2CommonIgnitionMonitors)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/FuelSystemStatus.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2CommonIgnitionMonitors.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -68,16 +68,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.FuelSystemStatus
+ android.hardware.automotive.vehicle@2.1::types.Obd2CommonIgnitionMonitors
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (FuelType)
+# Build types.hal (Obd2CompressionIgnitionMonitors)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/FuelType.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2CompressionIgnitionMonitors.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -87,16 +87,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.FuelType
+ android.hardware.automotive.vehicle@2.1::types.Obd2CompressionIgnitionMonitors
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (IgnitionMonitorKind)
+# Build types.hal (Obd2FuelSystemStatus)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/IgnitionMonitorKind.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2FuelSystemStatus.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -106,16 +106,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.IgnitionMonitorKind
+ android.hardware.automotive.vehicle@2.1::types.Obd2FuelSystemStatus
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (Obd2FloatSensorIndex)
+# Build types.hal (Obd2FuelType)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2FloatSensorIndex.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2FuelType.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -125,16 +125,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.Obd2FloatSensorIndex
+ android.hardware.automotive.vehicle@2.1::types.Obd2FuelType
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (Obd2IntegerSensorIndex)
+# Build types.hal (Obd2IgnitionMonitorKind)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2IntegerSensorIndex.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2IgnitionMonitorKind.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -144,16 +144,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.Obd2IntegerSensorIndex
+ android.hardware.automotive.vehicle@2.1::types.Obd2IgnitionMonitorKind
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (SecondaryAirStatus)
+# Build types.hal (Obd2SecondaryAirStatus)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/SecondaryAirStatus.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2SecondaryAirStatus.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -163,16 +163,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.SecondaryAirStatus
+ android.hardware.automotive.vehicle@2.1::types.Obd2SecondaryAirStatus
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (SparkIgnitionMonitors)
+# Build types.hal (Obd2SparkIgnitionMonitors)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/SparkIgnitionMonitors.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2SparkIgnitionMonitors.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -182,7 +182,7 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.SparkIgnitionMonitors
+ android.hardware.automotive.vehicle@2.1::types.Obd2SparkIgnitionMonitors
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
@@ -208,6 +208,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (VmsAvailabilityStateIntegerValuesIndex)
+#
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsAvailabilityStateIntegerValuesIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.automotive.vehicle@2.1::types.VmsAvailabilityStateIntegerValuesIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (VmsBaseMessageIntegerValuesIndex)
#
GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsBaseMessageIntegerValuesIndex.java
@@ -227,25 +246,6 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (VmsDataMessageIntegerValuesIndex)
-#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsDataMessageIntegerValuesIndex.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.VmsDataMessageIntegerValuesIndex
-
-$(GEN): $(LOCAL_PATH)/types.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
# Build types.hal (VmsMessageType)
#
GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsMessageType.java
@@ -265,6 +265,44 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (VmsMessageWithLayerAndPublisherIdIntegerValuesIndex)
+#
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.automotive.vehicle@2.1::types.VmsMessageWithLayerAndPublisherIdIntegerValuesIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VmsMessageWithLayerIntegerValuesIndex)
+#
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsMessageWithLayerIntegerValuesIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.automotive.vehicle@2.1::types.VmsMessageWithLayerIntegerValuesIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (VmsOfferingMessageIntegerValuesIndex)
#
GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsOfferingMessageIntegerValuesIndex.java
@@ -284,9 +322,9 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (VmsSimpleMessageIntegerValuesIndex)
+# Build types.hal (VmsSubscriptionsStateIntegerValuesIndex)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsSimpleMessageIntegerValuesIndex.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsSubscriptionsStateIntegerValuesIndex.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -296,26 +334,7 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.VmsSimpleMessageIntegerValuesIndex
-
-$(GEN): $(LOCAL_PATH)/types.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (VmsSubscriptionResponseFormat)
-#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsSubscriptionResponseFormat.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.VmsSubscriptionResponseFormat
+ android.hardware.automotive.vehicle@2.1::types.VmsSubscriptionsStateIntegerValuesIndex
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
@@ -358,9 +377,9 @@
#
-# Build types.hal (CommonIgnitionMonitors)
+# Build types.hal (DiagnosticFloatSensorIndex)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/CommonIgnitionMonitors.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/DiagnosticFloatSensorIndex.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -370,16 +389,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.CommonIgnitionMonitors
+ android.hardware.automotive.vehicle@2.1::types.DiagnosticFloatSensorIndex
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (CompressionIgnitionMonitors)
+# Build types.hal (DiagnosticIntegerSensorIndex)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/CompressionIgnitionMonitors.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/DiagnosticIntegerSensorIndex.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -389,16 +408,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.CompressionIgnitionMonitors
+ android.hardware.automotive.vehicle@2.1::types.DiagnosticIntegerSensorIndex
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (FuelSystemStatus)
+# Build types.hal (Obd2CommonIgnitionMonitors)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/FuelSystemStatus.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2CommonIgnitionMonitors.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -408,16 +427,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.FuelSystemStatus
+ android.hardware.automotive.vehicle@2.1::types.Obd2CommonIgnitionMonitors
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (FuelType)
+# Build types.hal (Obd2CompressionIgnitionMonitors)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/FuelType.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2CompressionIgnitionMonitors.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -427,16 +446,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.FuelType
+ android.hardware.automotive.vehicle@2.1::types.Obd2CompressionIgnitionMonitors
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (IgnitionMonitorKind)
+# Build types.hal (Obd2FuelSystemStatus)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/IgnitionMonitorKind.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2FuelSystemStatus.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -446,16 +465,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.IgnitionMonitorKind
+ android.hardware.automotive.vehicle@2.1::types.Obd2FuelSystemStatus
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (Obd2FloatSensorIndex)
+# Build types.hal (Obd2FuelType)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2FloatSensorIndex.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2FuelType.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -465,16 +484,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.Obd2FloatSensorIndex
+ android.hardware.automotive.vehicle@2.1::types.Obd2FuelType
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (Obd2IntegerSensorIndex)
+# Build types.hal (Obd2IgnitionMonitorKind)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2IntegerSensorIndex.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2IgnitionMonitorKind.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -484,16 +503,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.Obd2IntegerSensorIndex
+ android.hardware.automotive.vehicle@2.1::types.Obd2IgnitionMonitorKind
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (SecondaryAirStatus)
+# Build types.hal (Obd2SecondaryAirStatus)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/SecondaryAirStatus.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2SecondaryAirStatus.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -503,16 +522,16 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.SecondaryAirStatus
+ android.hardware.automotive.vehicle@2.1::types.Obd2SecondaryAirStatus
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (SparkIgnitionMonitors)
+# Build types.hal (Obd2SparkIgnitionMonitors)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/SparkIgnitionMonitors.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/Obd2SparkIgnitionMonitors.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -522,7 +541,7 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.SparkIgnitionMonitors
+ android.hardware.automotive.vehicle@2.1::types.Obd2SparkIgnitionMonitors
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
@@ -548,6 +567,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (VmsAvailabilityStateIntegerValuesIndex)
+#
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsAvailabilityStateIntegerValuesIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.automotive.vehicle@2.1::types.VmsAvailabilityStateIntegerValuesIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (VmsBaseMessageIntegerValuesIndex)
#
GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsBaseMessageIntegerValuesIndex.java
@@ -567,25 +605,6 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (VmsDataMessageIntegerValuesIndex)
-#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsDataMessageIntegerValuesIndex.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.VmsDataMessageIntegerValuesIndex
-
-$(GEN): $(LOCAL_PATH)/types.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
# Build types.hal (VmsMessageType)
#
GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsMessageType.java
@@ -605,6 +624,44 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (VmsMessageWithLayerAndPublisherIdIntegerValuesIndex)
+#
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.automotive.vehicle@2.1::types.VmsMessageWithLayerAndPublisherIdIntegerValuesIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VmsMessageWithLayerIntegerValuesIndex)
+#
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsMessageWithLayerIntegerValuesIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.automotive.vehicle@2.1::types.VmsMessageWithLayerIntegerValuesIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (VmsOfferingMessageIntegerValuesIndex)
#
GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsOfferingMessageIntegerValuesIndex.java
@@ -624,9 +681,9 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (VmsSimpleMessageIntegerValuesIndex)
+# Build types.hal (VmsSubscriptionsStateIntegerValuesIndex)
#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsSimpleMessageIntegerValuesIndex.java
+GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsSubscriptionsStateIntegerValuesIndex.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -636,26 +693,7 @@
-Ljava \
-randroid.hardware:hardware/interfaces \
-randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.VmsSimpleMessageIntegerValuesIndex
-
-$(GEN): $(LOCAL_PATH)/types.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (VmsSubscriptionResponseFormat)
-#
-GEN := $(intermediates)/android/hardware/automotive/vehicle/V2_1/VmsSubscriptionResponseFormat.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.automotive.vehicle@2.1::types.VmsSubscriptionResponseFormat
+ android.hardware.automotive.vehicle@2.1::types.VmsSubscriptionsStateIntegerValuesIndex
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
diff --git a/automotive/vehicle/2.1/default/common/include/vhal_v2_1/Obd2SensorStore.h b/automotive/vehicle/2.1/default/common/include/vhal_v2_1/Obd2SensorStore.h
index 6c44626..8000695 100644
--- a/automotive/vehicle/2.1/default/common/include/vhal_v2_1/Obd2SensorStore.h
+++ b/automotive/vehicle/2.1/default/common/include/vhal_v2_1/Obd2SensorStore.h
@@ -38,12 +38,12 @@
size_t numVendorFloatSensors);
// Stores an integer-valued sensor.
- V2_0::StatusCode setIntegerSensor(Obd2IntegerSensorIndex index, int32_t value);
+ V2_0::StatusCode setIntegerSensor(DiagnosticIntegerSensorIndex index, int32_t value);
// Stores an integer-valued sensor.
V2_0::StatusCode setIntegerSensor(size_t index, int32_t value);
// Stores a float-valued sensor.
- V2_0::StatusCode setFloatSensor(Obd2FloatSensorIndex index, float value);
+ V2_0::StatusCode setFloatSensor(DiagnosticFloatSensorIndex index, float value);
// Stores a float-valued sensor.
V2_0::StatusCode setFloatSensor(size_t index, float value);
diff --git a/automotive/vehicle/2.1/default/common/src/Obd2SensorStore.cpp b/automotive/vehicle/2.1/default/common/src/Obd2SensorStore.cpp
index f4c63a9..8705e00 100644
--- a/automotive/vehicle/2.1/default/common/src/Obd2SensorStore.cpp
+++ b/automotive/vehicle/2.1/default/common/src/Obd2SensorStore.cpp
@@ -56,9 +56,12 @@
Obd2SensorStore::Obd2SensorStore(size_t numVendorIntegerSensors,
size_t numVendorFloatSensors) {
+ using V2_0::toInt;
// because the last index is valid *inclusive*
- const size_t numSystemIntegerSensors = V2_0::toInt(Obd2IntegerSensorIndex::LAST_SYSTEM_INDEX)+1;
- const size_t numSystemFloatSensors = V2_0::toInt(Obd2FloatSensorIndex::LAST_SYSTEM_INDEX)+1;
+ const size_t numSystemIntegerSensors =
+ toInt(DiagnosticIntegerSensorIndex::LAST_SYSTEM_INDEX)+1;
+ const size_t numSystemFloatSensors =
+ toInt(DiagnosticFloatSensorIndex::LAST_SYSTEM_INDEX)+1;
mIntegerSensors = std::vector<int32_t>(
numSystemIntegerSensors+numVendorIntegerSensors, 0);
mFloatSensors = std::vector<float>(
@@ -66,11 +69,11 @@
mSensorsBitmask.resize(mIntegerSensors.size()+mFloatSensors.size());
}
-V2_0::StatusCode Obd2SensorStore::setIntegerSensor(Obd2IntegerSensorIndex index,
+V2_0::StatusCode Obd2SensorStore::setIntegerSensor(DiagnosticIntegerSensorIndex index,
int32_t value) {
return setIntegerSensor(V2_0::toInt(index), value);
}
-V2_0::StatusCode Obd2SensorStore::setFloatSensor(Obd2FloatSensorIndex index,
+V2_0::StatusCode Obd2SensorStore::setFloatSensor(DiagnosticFloatSensorIndex index,
float value) {
return setFloatSensor(V2_0::toInt(index), value);
}
diff --git a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h
index d024a55..701317b 100644
--- a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h
+++ b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h
@@ -86,7 +86,8 @@
{
.prop = OBD2_FREEZE_FRAME_CLEAR,
.access = V2_0::VehiclePropertyAccess::WRITE,
- .changeMode = V2_0::VehiclePropertyChangeMode::ON_CHANGE
+ .changeMode = V2_0::VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {1}
},
{
diff --git a/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp b/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
index 4faccbd..568d623 100644
--- a/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
@@ -37,85 +37,86 @@
static std::unique_ptr<Obd2SensorStore> fillDefaultObd2Frame(
size_t numVendorIntegerSensors,
size_t numVendorFloatSensors) {
+ using V2_0::toInt;
std::unique_ptr<Obd2SensorStore> sensorStore(new Obd2SensorStore(
numVendorIntegerSensors, numVendorFloatSensors));
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::FUEL_SYSTEM_STATUS,
- V2_0::toInt(FuelSystemStatus::CLOSED_LOOP));
+ DiagnosticIntegerSensorIndex::FUEL_SYSTEM_STATUS,
+ toInt(Obd2FuelSystemStatus::CLOSED_LOOP));
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::MALFUNCTION_INDICATOR_LIGHT_ON, 0);
+ DiagnosticIntegerSensorIndex::MALFUNCTION_INDICATOR_LIGHT_ON, 0);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::IGNITION_MONITORS_SUPPORTED,
- V2_0::toInt(IgnitionMonitorKind::SPARK));
- sensorStore->setIntegerSensor(Obd2IntegerSensorIndex::IGNITION_SPECIFIC_MONITORS,
- CommonIgnitionMonitors::COMPONENTS_AVAILABLE |
- CommonIgnitionMonitors::MISFIRE_AVAILABLE |
- SparkIgnitionMonitors::AC_REFRIGERANT_AVAILABLE |
- SparkIgnitionMonitors::EVAPORATIVE_SYSTEM_AVAILABLE);
+ DiagnosticIntegerSensorIndex::IGNITION_MONITORS_SUPPORTED,
+ toInt(Obd2IgnitionMonitorKind::SPARK));
+ sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::IGNITION_SPECIFIC_MONITORS,
+ Obd2CommonIgnitionMonitors::COMPONENTS_AVAILABLE |
+ Obd2CommonIgnitionMonitors::MISFIRE_AVAILABLE |
+ Obd2SparkIgnitionMonitors::AC_REFRIGERANT_AVAILABLE |
+ Obd2SparkIgnitionMonitors::EVAPORATIVE_SYSTEM_AVAILABLE);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::INTAKE_AIR_TEMPERATURE, 35);
+ DiagnosticIntegerSensorIndex::INTAKE_AIR_TEMPERATURE, 35);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::COMMANDED_SECONDARY_AIR_STATUS,
- V2_0::toInt(SecondaryAirStatus::FROM_OUTSIDE_OR_OFF));
+ DiagnosticIntegerSensorIndex::COMMANDED_SECONDARY_AIR_STATUS,
+ toInt(Obd2SecondaryAirStatus::FROM_OUTSIDE_OR_OFF));
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::NUM_OXYGEN_SENSORS_PRESENT, 1);
+ DiagnosticIntegerSensorIndex::NUM_OXYGEN_SENSORS_PRESENT, 1);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::RUNTIME_SINCE_ENGINE_START, 500);
+ DiagnosticIntegerSensorIndex::RUNTIME_SINCE_ENGINE_START, 500);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON, 0);
+ DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON, 0);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::WARMUPS_SINCE_CODES_CLEARED, 51);
+ DiagnosticIntegerSensorIndex::WARMUPS_SINCE_CODES_CLEARED, 51);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::DISTANCE_TRAVELED_SINCE_CODES_CLEARED, 365);
+ DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_SINCE_CODES_CLEARED, 365);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::ABSOLUTE_BAROMETRIC_PRESSURE, 30);
+ DiagnosticIntegerSensorIndex::ABSOLUTE_BAROMETRIC_PRESSURE, 30);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::CONTROL_MODULE_VOLTAGE, 12);
+ DiagnosticIntegerSensorIndex::CONTROL_MODULE_VOLTAGE, 12);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::AMBIENT_AIR_TEMPERATURE, 18);
+ DiagnosticIntegerSensorIndex::AMBIENT_AIR_TEMPERATURE, 18);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::MAX_FUEL_AIR_EQUIVALENCE_RATIO, 1);
+ DiagnosticIntegerSensorIndex::MAX_FUEL_AIR_EQUIVALENCE_RATIO, 1);
sensorStore->setIntegerSensor(
- Obd2IntegerSensorIndex::FUEL_TYPE, V2_0::toInt(FuelType::GASOLINE));
+ DiagnosticIntegerSensorIndex::FUEL_TYPE, V2_0::toInt(Obd2FuelType::GASOLINE));
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::CALCULATED_ENGINE_LOAD, 0.153);
+ DiagnosticFloatSensorIndex::CALCULATED_ENGINE_LOAD, 0.153);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1, -0.16);
+ DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1, -0.16);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK1, -0.16);
+ DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK1, -0.16);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK2, -0.16);
+ DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK2, -0.16);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK2, -0.16);
+ DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK2, -0.16);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::INTAKE_MANIFOLD_ABSOLUTE_PRESSURE, 7.5);
+ DiagnosticFloatSensorIndex::INTAKE_MANIFOLD_ABSOLUTE_PRESSURE, 7.5);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::ENGINE_RPM, 1250.);
+ DiagnosticFloatSensorIndex::ENGINE_RPM, 1250.);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::VEHICLE_SPEED, 40.);
+ DiagnosticFloatSensorIndex::VEHICLE_SPEED, 40.);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::TIMING_ADVANCE, 2.5);
+ DiagnosticFloatSensorIndex::TIMING_ADVANCE, 2.5);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::THROTTLE_POSITION, 19.75);
+ DiagnosticFloatSensorIndex::THROTTLE_POSITION, 19.75);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::OXYGEN_SENSOR1_VOLTAGE, 0.265);
+ DiagnosticFloatSensorIndex::OXYGEN_SENSOR1_VOLTAGE, 0.265);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::FUEL_TANK_LEVEL_INPUT, 0.824);
+ DiagnosticFloatSensorIndex::FUEL_TANK_LEVEL_INPUT, 0.824);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::EVAPORATION_SYSTEM_VAPOR_PRESSURE, -0.373);
+ DiagnosticFloatSensorIndex::EVAPORATION_SYSTEM_VAPOR_PRESSURE, -0.373);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::CATALYST_TEMPERATURE_BANK1_SENSOR1, 190.);
+ DiagnosticFloatSensorIndex::CATALYST_TEMPERATURE_BANK1_SENSOR1, 190.);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::RELATIVE_THROTTLE_POSITION, 3.);
+ DiagnosticFloatSensorIndex::RELATIVE_THROTTLE_POSITION, 3.);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::ABSOLUTE_THROTTLE_POSITION_B, 0.306);
+ DiagnosticFloatSensorIndex::ABSOLUTE_THROTTLE_POSITION_B, 0.306);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::ACCELERATOR_PEDAL_POSITION_D, 0.188);
+ DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_D, 0.188);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::ACCELERATOR_PEDAL_POSITION_E, 0.094);
+ DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_E, 0.094);
sensorStore->setFloatSensor(
- Obd2FloatSensorIndex::COMMANDED_THROTTLE_ACTUATOR, 0.024);
+ DiagnosticFloatSensorIndex::COMMANDED_THROTTLE_ACTUATOR, 0.024);
return sensorStore;
}
diff --git a/automotive/vehicle/2.1/types.hal b/automotive/vehicle/2.1/types.hal
index cea7f1b..53feb23 100644
--- a/automotive/vehicle/2.1/types.hal
+++ b/automotive/vehicle/2.1/types.hal
@@ -119,6 +119,8 @@
* bytes is a serialized VMS message as defined in the vms protocol
* which is opaque to the framework;
*
+ * IVehicle#get must always return StatusCode::NOT_AVAILABLE.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -131,33 +133,40 @@
/**
* OBD2 Live Sensor Data
*
- * This property uses COMPLEX data to send a snapshot of the current (live)
- * values of the OBD2 sensors provided by the vehicle.
+ * Reports a snapshot of the current (live) values of the OBD2 sensors available.
*
- * VehiclePropConfig
- * configArray[0] : number of vendor-specific integer-valued sensors
- * that can be returned in a frame.
- * configArray[1] : number of vendor-specific float-valued sensors
- * that can be returned in a frame.
+ * The configArray is set as follows:
+ * configArray[0] = number of vendor-specific integer-valued sensors
+ * configArray[1] = number of vendor-specific float-valued sensors
*
- * The values are to be interpreted as follows:
- * the indices defined in Obd2IntegerSensorIndex are to be used to
- * read from int32Values;
- * the indices defined in Obd2FloatSensorIndex are to be used to
- * read from floatValues.
- * the elements of bytes are to be interpreted as a bitmask, such that
- * the bits 0 thru the integer value of
- * Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX + the value of configArray[0]
- * are 1 if the corresponding index is a valid sensor index whose value can
- * be read in the returned int32Values vector, 0 otherwise.
- * the bits Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX+1 thru
- * Obd2FloatingSensorIndex.LAST_SYSTEM_INDEX + the value of configArray[1]
- * are 1 if the corresponding index is a valid sensor index whose value
- * can be read in the returned floatValues vector, 0 otherwise.
+ * The values of this property are to be interpreted as in the following example.
+ * Considering a configArray = {2,3}
+ * int32Values must be a vector containing Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX + 2
+ * elements (that is, 33 elements);
+ * floatValues must be a vector containing Obd2FloatSensorIndex.LAST_SYSTEM_INDEX + 3
+ * elements (that is, 73 elements);
*
- * For example, int32Values[0] corresponds to FUEL_SYSTEM_STATUS, and
- * floatValues[0] corresponds to CALCULATED_ENGINE_LOAD, but that mapping
- * is only valid if the corresponding bits in the bytes vector are set to 1.
+ * It is possible for each frame to contain a different subset of sensor values, both system
+ * provided sensors, and vendor-specific ones. In order to support that, the bytes element
+ * of the property value is used as a bitmask,.
+ *
+ * bytes must have a sufficient number of bytes to represent the total number of possible
+ * sensors (in this case, 14 bytes to represent 106 possible values); it is to be read as
+ * a contiguous bitmask such that each bit indicates the presence or absence of a sensor
+ * from the frame, starting with as many bits as the size of int32Values, immediately
+ * followed by as many bits as the size of floatValues.
+ *
+ * For example, should bytes[0] = 0x4C (0b01001100) it would mean that:
+ * int32Values[0 and 1] are not valid sensor values
+ * int32Values[2 and 3] are valid sensor values
+ * int32Values[4 and 5] are not valid sensor values
+ * int32Values[6] is a valid sensor value
+ * int32Values[7] is not a valid sensor value
+ * Should bytes[5] = 0x61 (0b01100001) it would mean that:
+ * int32Values[32] is a valid sensor value
+ * floatValues[0 thru 3] are not valid sensor values
+ * floatValues[4 and 5] are valid sensor values
+ * floatValues[6] is not a valid sensor value
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ
@@ -171,41 +180,23 @@
/**
* OBD2 Freeze Frame Sensor Data
*
- * This property uses COMPLEX data to send a snapshot of the values of the
- * OBD2 sensors provided by the vehicle at the time that a diagnostic
- * troubleshooting code (DTC) was recorded by the vehicle.
+ * Reports a snapshot of the value of the OBD2 sensors available at the time that a fault
+ * occurred and was detected.
*
- * VehiclePropConfig
- * configArray[0] : number of vendor-specific integer-valued sensors
- * that can be returned in a frame.
- * configArray[1] : number of vendor-specific float-valued sensors
- * that can be returned in a frame.
+ * A configArray must be provided with the same meaning as defined for OBD2_LIVE_FRAME.
*
- * A get of this property must take the following form:
- * int64Values[0]: timestamp of the freeze frame to retrieve.
- * Valid timestamps are given by OBD2_DTC_INFO.
+ * The values of this property are to be interpreted in a similar fashion as those for
+ * OBD2_LIVE_FRAME, with the exception that the stringValue field may contain a non-empty
+ * diagnostic troubleshooting code (DTC).
*
- * The values are to be interpreted as follows:
- * the indices defined in Obd2IntegerSensorIndex are to be used to
- * read from int32Values;
- * the indices defined in Obd2FloatSensorIndex are to be used to
- * read from floatValues;
- * the elements of bytes are to be interpreted as a bitmask, such that
- * the bits 0 thru the integer value of
- * Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX + the value of configArray[0]
- * are 1 if the corresponding index is a valid sensor index whose value can
- * be read in the returned int32Values vector, 0 otherwise.
- * the bits Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX+1 thru
- * Obd2FloatingSensorIndex.LAST_SYSTEM_INDEX + the value of configArray[1]
- * are 1 if the corresponding index is a valid sensor index whose value
- * can be read in the returned floatValues vector, 0 otherwise.
- * stringValue is the DTC that caused this freeze frame to be recorded.
+ * A IVehicle#get request of this property must provide a value for int64Values[0].
+ * This will be interpreted as the timestamp of the freeze frame to retrieve. A list of
+ * timestamps can be obtained by a IVehicle#get of OBD2_FREEZE_FRAME_INFO.
*
- * For example, int32Values[0] corresponds to FUEL_SYSTEM_STATUS, and
- * floatValues[0] corresponds to CALCULATED_ENGINE_LOAD, but that mapping
- * is only valid if the corresponding bits in the bytes vector are set to 1,
- * and a possible valid stringValue is "P0176" to indicate a malfunction
- * of the fuel composition sensor circuit.
+ * Should no freeze frame be available at the given timestamp, a response of NOT_AVAILABLE
+ * must be returned by the implementation. Because vehicles may have limited storage for
+ * freeze frames, it is possible for a frame request to respond with NOT_AVAILABLE even if
+ * the associated timestamp has been recently obtained via OBD2_FREEZE_FRAME_INFO.
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ
@@ -223,7 +214,7 @@
* memory and available for retrieval via OBD2_FREEZE_FRAME.
*
* The values are to be interpreted as follows:
- * each element of int64Values is the timestamp at which a a fault code
+ * each element of int64Values must be the timestamp at which a a fault code
* has been detected and the corresponding freeze frame stored, and each
* such element can be used as the key to OBD2_FREEZE_FRAME to retrieve
* the corresponding freeze frame.
@@ -241,14 +232,18 @@
* OBD2 Freeze Frame Clear
*
* This property allows deletion of any of the freeze frames stored in
- * vehicle memory, as described by OBD2_DTC_INFO.
+ * vehicle memory, as described by OBD2_FREEZE_FRAME_INFO.
*
- * A set of this property is to be interpreted as follows:
- * if int64Values contains no elements, then all DTCs stored will be cleared;
- * if int64Values contains one or more elements, then DTCs at the timestamps
- * stored in int64Values will be cleared, and the others not cleared, except
- * the memory will be compacted so that all remaining DTCs are stored
- * contiguously.
+ * The configArray is set as follows:
+ * configArray[0] = 1 if the implementation is able to clear individual freeze frames
+ * by timestamp, 0 otherwise
+ *
+ * IVehicle#set of this property is to be interpreted as follows:
+ * if int64Values contains no elements, then all frames stored must be cleared;
+ * if int64Values contains one or more elements, then frames at the timestamps
+ * stored in int64Values must be cleared, and the others not cleared. Should the
+ * vehicle not support selective clearing of freeze frames, this latter mode must
+ * return NOT_AVAILABLE.
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:WRITE
@@ -260,8 +255,8 @@
| VehicleArea:GLOBAL),
};
-/** The status of a fuel system as described by the OBD2 specification. */
-enum FuelSystemStatus : int32_t {
+/** The status of the vehicle's fuel system. */
+enum Obd2FuelSystemStatus : int32_t {
OPEN_INSUFFICIENT_ENGINE_TEMPERATURE = 1,
CLOSED_LOOP = 2,
OPEN_ENGINE_LOAD_OR_DECELERATION = 4,
@@ -270,13 +265,13 @@
};
/** Defines which ignition monitors are available to be read. */
-enum IgnitionMonitorKind : int32_t {
+enum Obd2IgnitionMonitorKind : int32_t {
SPARK = 0,
COMPRESSION = 1,
};
/** These ignition monitors are common to both SPARK and COMPRESSION. */
-enum CommonIgnitionMonitors : int32_t {
+enum Obd2CommonIgnitionMonitors : int32_t {
COMPONENTS_AVAILABLE = 0x1 << 0,
COMPONENTS_INCOMPLETE = 0x1 << 1,
@@ -288,7 +283,7 @@
};
/** Ignition monitors available for SPARK vehicles. */
-enum SparkIgnitionMonitors : CommonIgnitionMonitors {
+enum Obd2SparkIgnitionMonitors : Obd2CommonIgnitionMonitors {
EGR_AVAILABLE = 0x1 << 6,
EGR_INCOMPLETE = 0x1 << 7,
@@ -315,7 +310,7 @@
};
/** Ignition monitors only available for COMPRESSION vehicles. */
-enum CompressionIgnitionMonitors : CommonIgnitionMonitors {
+enum Obd2CompressionIgnitionMonitors : Obd2CommonIgnitionMonitors {
EGR_OR_VVT_AVAILABLE = 0x1 << 6,
EGR_OR_VVT_INCOMPLETE = 0x1 << 7,
@@ -335,14 +330,16 @@
NMHC_CATALYST_INCOMPLETE = 0x1 << 17,
};
-enum SecondaryAirStatus : int32_t {
+/** The status of the vehicle's secondary air system. */
+enum Obd2SecondaryAirStatus : int32_t {
UPSTREAM = 1,
DOWNSTREAM_OF_CATALYCIC_CONVERTER = 2,
FROM_OUTSIDE_OR_OFF = 4,
PUMP_ON_FOR_DIAGNOSTICS = 8,
};
-enum FuelType : int32_t {
+/** The fuel type(s) supported by a vehicle. */
+enum Obd2FuelType : int32_t {
NOT_AVAILABLE = 0,
GASOLINE = 1,
METHANOL = 2,
@@ -376,7 +373,7 @@
* expect a comment by the property definition describing the enum to look at for the mapping.
* Any value greater than the last reserved index is available to vendors to map their extensions.
*/
-enum Obd2IntegerSensorIndex : int32_t {
+enum DiagnosticIntegerSensorIndex : int32_t {
/** refer to FuelSystemStatus for a description of this value. */
FUEL_SYSTEM_STATUS = 0,
MALFUNCTION_INDICATOR_LIGHT_ON = 1,
@@ -431,7 +428,7 @@
* The ordering of the values is taken from the OBD2 specification.
* Any value greater than the last reserved index is available to vendors to map their extensions.
*/
-enum Obd2FloatSensorIndex : int32_t {
+enum DiagnosticFloatSensorIndex : int32_t {
CALCULATED_ENGINE_LOAD = 0,
ENGINE_COOLANT_TEMPERATURE = 1,
SHORT_TERM_FUEL_TRIM_BANK1 = 2,
@@ -507,102 +504,196 @@
};
/**
- * This enum lists the types of supported VMS messages.
+ * This enum lists the types of supported VMS messages. It is used as the first
+ * integer in the vehicle property integers array and determines how the rest of
+ * the message is decoded.
*/
enum VmsMessageType : int32_t {
- /** A client subscribes to a layer. */
+ /**
+ * A request from the subscribers to the VMS service to subscribe to a layer.
+ *
+ * This message type uses enum VmsMessageWithLayerIntegerValuesIndex.
+ */
SUBSCRIBE = 1,
- /** A client unsubscribes from a layer. */
- UNSUBSCRIBE = 2,
+ /**
+ * A request from the subscribers to the VMS service to subscribe to a layer from a specific publisher.
+ *
+ * This message type uses enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.
+ */
+ SUBSCRIBE_TO_PUBLISHER = 2,
- /** A client publishes a data packet. */
- DATA = 3,
+ /**
+ * A request from the subscribers to the VMS service to unsubscribes from a layer.
+ *
+ * This message type uses enum VmsMessageWithLayerIntegerValuesIndex.
+ */
+ UNSUBSCRIBE = 3,
- /** A client declaring layers offering. */
- OFFERING = 4,
+ /**
+ * A request from the subscribers to the VMS service to unsubscribes from a layer from a specific publisher.
+ *
+ * This message type uses enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.
+ */
+ UNSUBSCRIBE_TO_PUBLISHER = 4,
- /** Requesting the list of available layers. */
- AVAILABILITY_REQUEST = 5,
+ /**
+ * Information from the publishers to the VMS service about the layers which the client can publish.
+ *
+ * This message type uses enum VmsOfferingMessageIntegerValuesIndex.
+ */
+ OFFERING = 5,
- /** Returning the list of available layers. */
- AVAILABILITY_RESPONSE = 6,
+ /**
+ * A request from the subscribers to the VMS service to get the available layers.
+ *
+ * This message type uses enum VmsBaseMessageIntegerValuesIndex.
+ */
+ AVAILABILITY_REQUEST = 6,
- /** Sending to the HAL the current list of the available layers. */
- AVAILABILITY_CHANGE = 7,
+ /**
+ * A request from the publishers to the VMS service to get the layers with subscribers.
+ *
+ * This message type uses enum VmsBaseMessageIntegerValuesIndex.
+ */
+ SUBSCRIPTIONS_REQUEST = 7,
- /** Requesting layers that have subscribers. */
- SUBSCRIPTIONS_REQUEST = 8,
+ /**
+ * A response from the VMS service to the subscribers to a VmsMessageType.AVAILABILITY_REQUEST
+ *
+ * This message type uses enum VmsAvailabilityStateIntegerValuesIndex.
+ */
+ AVAILABILITY_RESPONSE = 8,
- /** Returning layers that have subscribers. */
- SUBSCRIPTIONS_RESPONSE = 9,
+ /**
+ * A notification from the VMS service to the subscribers on a change in the available layers.
+ *
+ * This message type uses enum VmsAvailabilityStateIntegerValuesIndex.
+ */
+ AVAILABILITY_CHANGE = 9,
- /** Sending to the HAL the current list of the subscribed layers. */
- SUBSCRIPTIONS_CHANGE = 10,
+ /**
+ * A response from the VMS service to the publishers to a VmsMessageType.SUBSCRIPTIONS_REQUEST
+ *
+ * This message type uses enum VmsSubscriptionsStateIntegerValuesIndex.
+ */
+ SUBSCRIPTIONS_RESPONSE = 10,
+
+ /**
+ * A notification from the VMS service to the publishers on a change in the layers with subscribers.
+ *
+ * This message type uses enum VmsSubscriptionsStateIntegerValuesIndex.
+ */
+ SUBSCRIPTIONS_CHANGE = 11,
+
+ /**
+ * A message from the VMS service to the subscribers or from the publishers to the VMS service
+ * with a serialized VMS data packet as defined in the VMS protocol.
+ *
+ * This message type uses enum VmsBaseMessageIntegerValuesIndex.
+ */
+ DATA = 12,
};
/**
- * This enum provides the canonical mapping for VMS properties that have an
- * integer value.
+ * Every VMS message starts with the type of the message from the VmsMessageType enum.
+ * Messages with no parameters such as VmsMessageType.AVAILABILITY_REQUEST,
+ * VmsMessageType.SUBSCRIPTIONS_REQUEST and VmsMessageType.DATA are also based on this enum.
*/
enum VmsBaseMessageIntegerValuesIndex : int32_t {
/* The message type as enumerated by VmsMessageType enum. */
- VMS_MESSAGE_TYPE = 0,
+ MESSAGE_TYPE = 0,
};
/*
- * This enum provides the canonical mapping for VMS SUBMIT and UNSUBMIT
- * messages integer value properties.
+ * A VMS message with a layer is sent as part of a VmsMessageType.SUBSCRIBE or
+ * VmsMessageType.UNSUBSCRIBE messages.
+ *
+ * The layer type is defined in the VMS protocol, and the subtype and version are
+ * controlled by the implementer of the publisher.
*/
-enum VmsSimpleMessageIntegerValuesIndex : VmsBaseMessageIntegerValuesIndex {
- /* The layer ID as defined in the vms protocol. */
- VMS_LAYER_ID = 1,
+enum VmsMessageWithLayerIntegerValuesIndex : VmsBaseMessageIntegerValuesIndex {
+ LAYER_TYPE = 1,
- /* The version of the VMS layer. */
- VMS_LAYER_VERSION = 2,
+ LAYER_SUBTYPE = 2,
- /* The layer type as defined in the vms protocol */
- VMS_LAYER_SUB_TYPE = 3,
+ LAYER_VERSION = 3,
};
/*
- * This enum provides the canonical mapping for VMS DATA
- * message integer value properties.
+ * A VMS message with a layer and publisher ID is sent as part of a
+ * VmsMessageType.SUBSCRIBE_TO_PUBLISHER and VmsMessageType.UNSUBSCRIBE_TO_PUBLISHER messages.
*/
-enum VmsDataMessageIntegerValuesIndex : VmsSimpleMessageIntegerValuesIndex {
- /* A publisher ID of the client that published this message. */
- VMS_PUBLISHER_ID = 4,
+enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex : VmsMessageWithLayerIntegerValuesIndex {
+ PUBLISHER_ID = 4,
};
/*
- * This enum provides the canonical mapping for VMS offering messages integer
- * value properties
+ * An offering can be sent by publishers as part of VmsMessageType.OFFERING in order to
+ * advertise which layers they can publish and under which constraints: e.g., I can publish Layer X
+ * if someone else will publish Layer Y.
+ * The offering contains the publisher ID which was assigned to the publisher by the VMS service.
+ * A single offering is represented as:
+ * - Layer type
+ * - Layer subtype
+ * - Layer version
+ * - Number of dependencies (N)
+ * - N x (Layer type, Layer subtype, Layer version)
*/
enum VmsOfferingMessageIntegerValuesIndex : VmsBaseMessageIntegerValuesIndex {
- /* The ID assigend to the publisher by the VMS core. */
PUBLISHER_ID = 1,
- /* The number of VMS layer dependencies. */
- VMS_NUMBER_OF_LAYERS_DEPENDENCIES = 2,
+ NUMBER_OF_OFFERS = 2,
- /* The first index that contain dependencies */
- FIRST_DEPENDENCIES_INDEX = 3,
+ OFFERING_START = 3,
};
/**
- * A VMS subscription request only contains its message type. The format of a VMS subscription
- * response is described below.
+ * A subscriptions state is sent to the publishers in response to a change in the subscriptions
+ * as part of a VmsMessageType.SUBSCRIPTIONS_CHANGE, or in response to a
+ * VmsMessageType.SUBSCRIPTIONS_REQUEST message as part of VmsMessageType.SUBSCRIPTIONS_RESPONSE.
+ * The VMS service issues monotonically increasing sequence numbers, and in case a subscriber receives
+ * a smaller sequnce number it should ignore the message.
+ * The subscriptions are sent as a list of layers followed by a list of associated layers:
+ * {Sequence number, N, M, N x layer, M x associated layer}
+ * A subscribed layer is represented as three integers:
+ * - Layer type
+ * - Layer subtype
+ * - Layer version
+ * A subscribed associated layer is a layer with a list of publisher IDs. It is represented as:
+ * - Layer type
+ * - Layer subtype
+ * - Layer version
+ * - Number of publisher IDs (N)
+ * - N x publisher ID
*/
-enum VmsSubscriptionResponseFormat : VmsBaseMessageIntegerValuesIndex {
- /**
- * Recipients should ignore any packet with a sequence number that is less than the highest
- * sequence number they have seen thus far.
- */
+enum VmsSubscriptionsStateIntegerValuesIndex : VmsBaseMessageIntegerValuesIndex {
SEQUENCE_NUMBER = 1,
- /** The number of VMS layers. Each layer has two integers: type and version. */
NUMBER_OF_LAYERS = 2,
- /** The first index that contains a layer. */
- FIRST_LAYER = 3,
+ NUMBER_OF_ASSOCIATED_LAYERS = 3,
+
+ SUBSCRIPTIONS_START = 4,
+};
+
+/**
+ * An availability state is sent to the subscribers in response to a change in the available
+ * layers as part of a VmsMessageType.AVAILABILITY_CHANGE message, or in response to a
+ * VmsMessageType.AVAILABILITY_REQUEST message as part of a VmsMessageType.AVAILABILITY_RESPONSE.
+ * The VMS service issues monotonically increasing sequence numbers, and in case a subscriber receives
+ * a smaller sequnce number, it should ignore the message.
+ * An available associated layer is a layer with a list of publisher IDs:
+ * - Layer type
+ * - Layer subtype
+ * - Layer version
+ * - Number of publisher IDs (N)
+ * - N x publisher ID
+*/
+enum VmsAvailabilityStateIntegerValuesIndex : VmsBaseMessageIntegerValuesIndex {
+ SEQUENCE_NUMBER = 1,
+
+ NUMBER_OF_ASSOCIATED_LAYERS = 2,
+
+ LAYERS_START = 3,
};
diff --git a/broadcastradio/1.0/types.hal b/broadcastradio/1.0/types.hal
index e9ac4b7..8c3ec11 100644
--- a/broadcastradio/1.0/types.hal
+++ b/broadcastradio/1.0/types.hal
@@ -212,12 +212,23 @@
uint32_t channel; /** current channel. (e.g kHz for band type AM_FM) */
uint32_t subChannel; /** current sub channel. (FM_HD) */
- /** Tuned to a program (not a noise). It's the same condition that would stop scan operation. */
+ /**
+ * Tuned to a program (not a noise). It's the same condition that would
+ * stop scan operation.
+ */
bool tuned;
bool stereo; /** program is stereo or not */
bool digital; /** digital program or not (e.g HD Radio program) */
- uint32_t signalStrength; /** signal strength from 0 to 100 */
- vec<MetaData> metadata; /** non empty if meta data are present (e.g PTY, song title ...) */
+
+ /**
+ * Signal quality measured in 0% to 100% range.
+ *
+ * Despite the name, this is not a signal strength.
+ * The purpose of this field is primarily informative.
+ */
+ uint32_t signalStrength;
+
+ vec<MetaData> metadata; /** Metadata: PTY, song title etc. */
};
diff --git a/broadcastradio/1.1/ITuner.hal b/broadcastradio/1.1/ITuner.hal
index a5c569a..cc2e58d 100644
--- a/broadcastradio/1.1/ITuner.hal
+++ b/broadcastradio/1.1/ITuner.hal
@@ -84,6 +84,13 @@
* subsequent calls to startBackgroundScan, issuing a single
* backgroundScanComplete callback.
*
+ * If a device supports continuous background scanning, it may succeed
+ * (return OK and call backgroundScanComplete) without any additional
+ * operation performed.
+ *
+ * Foreground scanning may be implemented in the front end app with
+ * @1.0::ITuner scan operation.
+ *
* @return result OK if the scan was properly scheduled (this does not mean
* it successfully finished).
* UNAVAILABLE if the background scan is unavailable,
diff --git a/broadcastradio/1.1/default/BroadcastRadio.cpp b/broadcastradio/1.1/default/BroadcastRadio.cpp
index 7916407..17ec780 100644
--- a/broadcastradio/1.1/default/BroadcastRadio.cpp
+++ b/broadcastradio/1.1/default/BroadcastRadio.cpp
@@ -143,7 +143,7 @@
mTuner = nullptr;
}
- sp<Tuner> newTuner = new Tuner(callback);
+ sp<Tuner> newTuner = new Tuner(mClassId, callback);
mTuner = newTuner;
if (mClassId == Class::AM_FM) {
auto ret = newTuner->setConfiguration(config);
diff --git a/broadcastradio/1.1/default/Tuner.cpp b/broadcastradio/1.1/default/Tuner.cpp
index 133593e..f48a8db 100644
--- a/broadcastradio/1.1/default/Tuner.cpp
+++ b/broadcastradio/1.1/default/Tuner.cpp
@@ -33,7 +33,9 @@
using V1_0::Band;
using V1_0::BandConfig;
+using V1_0::Class;
using V1_0::Direction;
+using utils::HalRevision;
using std::chrono::milliseconds;
using std::lock_guard;
@@ -49,13 +51,12 @@
milliseconds tune = 150ms;
} gDefaultDelay;
-Tuner::Tuner(const sp<V1_0::ITunerCallback>& callback)
- : mCallback(callback),
+Tuner::Tuner(V1_0::Class classId, const sp<V1_0::ITunerCallback>& callback)
+ : mClassId(classId),
+ mCallback(callback),
mCallback1_1(ITunerCallback::castFrom(callback).withDefault(nullptr)),
- mVirtualFm(make_fm_radio()) {
- // TODO (b/36864090): inject this data in a more elegant way
- setCompatibilityLevel(mCallback1_1 == nullptr ? 1 : 2);
-}
+ mVirtualRadio(getRadio(classId)),
+ mIsAnalogForced(false) {}
void Tuner::forceClose() {
lock_guard<mutex> lk(mMut);
@@ -65,6 +66,12 @@
Return<Result> Tuner::setConfiguration(const BandConfig& config) {
ALOGV("%s", __func__);
+ lock_guard<mutex> lk(mMut);
+ if (mIsClosed) return Result::NOT_INITIALIZED;
+ if (mClassId != Class::AM_FM) {
+ ALOGE("Can't set AM/FM configuration on SAT/DT radio tuner");
+ return Result::INVALID_STATE;
+ }
if (config.lowerLimit >= config.upperLimit) return Result::INVALID_ARGUMENTS;
@@ -76,6 +83,12 @@
mAmfmConfig.antennaConnected = true;
mCurrentProgram = utils::make_selector(mAmfmConfig.type, mAmfmConfig.lowerLimit);
+ if (mAmfmConfig.type == Band::FM_HD || mAmfmConfig.type == Band::FM) {
+ mVirtualRadio = std::ref(getFmRadio());
+ } else {
+ mVirtualRadio = std::ref(getAmRadio());
+ }
+
mIsAmfmConfigSet = true;
mCallback->configChange(Result::OK, mAmfmConfig);
};
@@ -86,14 +99,14 @@
Return<void> Tuner::getConfiguration(getConfiguration_cb _hidl_cb) {
ALOGV("%s", __func__);
-
lock_guard<mutex> lk(mMut);
- if (mIsAmfmConfigSet) {
+
+ if (!mIsClosed && mIsAmfmConfigSet) {
_hidl_cb(Result::OK, mAmfmConfig);
} else {
_hidl_cb(Result::NOT_INITIALIZED, {});
}
- return Void();
+ return {};
}
// makes ProgramInfo that points to no program
@@ -108,21 +121,19 @@
return info11;
}
-bool Tuner::isFmLocked() {
- if (!utils::isAmFm(utils::getType(mCurrentProgram))) return false;
- return mAmfmConfig.type == Band::FM_HD || mAmfmConfig.type == Band::FM;
+HalRevision Tuner::getHalRev() const {
+ if (mCallback1_1 != nullptr) {
+ return HalRevision::V1_1;
+ } else {
+ return HalRevision::V1_0;
+ }
}
void Tuner::tuneInternalLocked(const ProgramSelector& sel) {
- VirtualRadio* virtualRadio = nullptr;
- if (isFmLocked()) {
- virtualRadio = &mVirtualFm;
- }
-
VirtualProgram virtualProgram;
- if (virtualRadio != nullptr && virtualRadio->getProgram(sel, virtualProgram)) {
+ if (mVirtualRadio.get().getProgram(sel, virtualProgram)) {
mCurrentProgram = virtualProgram.selector;
- mCurrentProgramInfo = static_cast<ProgramInfo>(virtualProgram);
+ mCurrentProgramInfo = virtualProgram.getProgramInfo(getHalRev());
} else {
mCurrentProgram = sel;
mCurrentProgramInfo = makeDummyProgramInfo(sel);
@@ -139,11 +150,9 @@
Return<Result> Tuner::scan(Direction direction, bool skipSubChannel __unused) {
ALOGV("%s", __func__);
lock_guard<mutex> lk(mMut);
- vector<VirtualProgram> list;
+ if (mIsClosed) return Result::NOT_INITIALIZED;
- if (isFmLocked()) {
- list = mVirtualFm.getProgramList();
- }
+ auto list = mVirtualRadio.get().getProgramList();
if (list.empty()) {
mIsTuneCompleted = false;
@@ -195,9 +204,10 @@
Return<Result> Tuner::step(Direction direction, bool skipSubChannel) {
ALOGV("%s", __func__);
- ALOGW_IF(!skipSubChannel, "can't step to next frequency without ignoring subChannel");
-
lock_guard<mutex> lk(mMut);
+ if (mIsClosed) return Result::NOT_INITIALIZED;
+
+ ALOGW_IF(!skipSubChannel, "can't step to next frequency without ignoring subChannel");
if (!utils::isAmFm(utils::getType(mCurrentProgram))) {
ALOGE("Can't step in anything else than AM/FM");
@@ -243,8 +253,8 @@
Return<Result> Tuner::tune_1_1(const ProgramSelector& sel) {
ALOGV("%s(%s)", __func__, toString(sel).c_str());
-
lock_guard<mutex> lk(mMut);
+ if (mIsClosed) return Result::NOT_INITIALIZED;
if (utils::isAmFm(utils::getType(mCurrentProgram))) {
ALOGW_IF(!mIsAmfmConfigSet, "AM/FM config not set");
@@ -268,12 +278,18 @@
Return<Result> Tuner::cancel() {
ALOGV("%s", __func__);
+ lock_guard<mutex> lk(mMut);
+ if (mIsClosed) return Result::NOT_INITIALIZED;
+
mThread.cancelAll();
return Result::OK;
}
Return<Result> Tuner::cancelAnnouncement() {
ALOGV("%s", __func__);
+ lock_guard<mutex> lk(mMut);
+ if (mIsClosed) return Result::NOT_INITIALIZED;
+
return Result::OK;
}
@@ -286,49 +302,59 @@
Return<void> Tuner::getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) {
ALOGV("%s", __func__);
-
lock_guard<mutex> lk(mMut);
- if (mIsTuneCompleted) {
+
+ if (mIsClosed) {
+ _hidl_cb(Result::NOT_INITIALIZED, {});
+ } else if (mIsTuneCompleted) {
_hidl_cb(Result::OK, mCurrentProgramInfo);
} else {
_hidl_cb(Result::NOT_INITIALIZED, makeDummyProgramInfo(mCurrentProgram));
}
- return Void();
+ return {};
}
Return<ProgramListResult> Tuner::startBackgroundScan() {
ALOGV("%s", __func__);
+ lock_guard<mutex> lk(mMut);
+ if (mIsClosed) return ProgramListResult::NOT_INITIALIZED;
+
return ProgramListResult::UNAVAILABLE;
}
-Return<void> Tuner::getProgramList(const hidl_string& filter __unused, getProgramList_cb _hidl_cb) {
- ALOGV("%s", __func__);
+Return<void> Tuner::getProgramList(const hidl_string& filter, getProgramList_cb _hidl_cb) {
+ ALOGV("%s(%s)", __func__, filter.c_str());
lock_guard<mutex> lk(mMut);
-
- auto& virtualRadio = mVirtualFm;
- if (!isFmLocked()) {
- ALOGI("bands other than FM are not supported yet");
- _hidl_cb(ProgramListResult::OK, {});
- return Void();
+ if (mIsClosed) {
+ _hidl_cb(ProgramListResult::NOT_INITIALIZED, {});
+ return {};
}
- auto list = virtualRadio.getProgramList();
+ auto list = mVirtualRadio.get().getProgramList();
ALOGD("returning a list of %zu programs", list.size());
- _hidl_cb(ProgramListResult::OK, vector<ProgramInfo>(list.begin(), list.end()));
- return Void();
+ _hidl_cb(ProgramListResult::OK, getProgramInfoVector(list, getHalRev()));
+ return {};
}
Return<void> Tuner::isAnalogForced(isAnalogForced_cb _hidl_cb) {
ALOGV("%s", __func__);
- // TODO(b/36864090): implement
- _hidl_cb(Result::INVALID_STATE, false);
- return Void();
+ lock_guard<mutex> lk(mMut);
+
+ if (mIsClosed) {
+ _hidl_cb(Result::NOT_INITIALIZED, false);
+ } else {
+ _hidl_cb(Result::OK, mIsAnalogForced);
+ }
+ return {};
}
-Return<Result> Tuner::setAnalogForced(bool isForced __unused) {
+Return<Result> Tuner::setAnalogForced(bool isForced) {
ALOGV("%s", __func__);
- // TODO(b/36864090): implement
- return Result::INVALID_STATE;
+ lock_guard<mutex> lk(mMut);
+ if (mIsClosed) return Result::NOT_INITIALIZED;
+
+ mIsAnalogForced = isForced;
+ return Result::OK;
}
} // namespace implementation
diff --git a/broadcastradio/1.1/default/Tuner.h b/broadcastradio/1.1/default/Tuner.h
index 2222e5a..c4efe6e 100644
--- a/broadcastradio/1.1/default/Tuner.h
+++ b/broadcastradio/1.1/default/Tuner.h
@@ -29,7 +29,7 @@
namespace implementation {
struct Tuner : public ITuner {
- Tuner(const sp<V1_0::ITunerCallback>& callback);
+ Tuner(V1_0::Class classId, const sp<V1_0::ITunerCallback>& callback);
void forceClose();
@@ -53,21 +53,22 @@
private:
std::mutex mMut;
WorkerThread mThread;
- bool mIsClosed = false; // TODO(b/36864090): use it
+ bool mIsClosed = false;
+ V1_0::Class mClassId;
const sp<V1_0::ITunerCallback> mCallback;
const sp<V1_1::ITunerCallback> mCallback1_1;
- VirtualRadio mVirtualFm;
-
+ std::reference_wrapper<VirtualRadio> mVirtualRadio;
bool mIsAmfmConfigSet = false;
V1_0::BandConfig mAmfmConfig;
bool mIsTuneCompleted = false;
ProgramSelector mCurrentProgram = {};
ProgramInfo mCurrentProgramInfo = {};
+ std::atomic<bool> mIsAnalogForced;
+ utils::HalRevision getHalRev() const;
void tuneInternalLocked(const ProgramSelector& sel);
- bool isFmLocked(); // TODO(b/36864090): make it generic, not FM only
};
} // namespace implementation
diff --git a/broadcastradio/1.1/default/VirtualProgram.cpp b/broadcastradio/1.1/default/VirtualProgram.cpp
index 4c6b3b1..1c2285d 100644
--- a/broadcastradio/1.1/default/VirtualProgram.cpp
+++ b/broadcastradio/1.1/default/VirtualProgram.cpp
@@ -25,28 +25,24 @@
namespace V1_1 {
namespace implementation {
+using std::vector;
+
using V1_0::MetaData;
using V1_0::MetadataKey;
using V1_0::MetadataType;
+using utils::HalRevision;
-// TODO (b/36864090): inject this data in a more elegant way
-static int gHalVersion = 2; // 1 = 1.0, 2 = 1.1
-
-void setCompatibilityLevel(int halversion) {
- gHalVersion = halversion;
-}
-
-static MetaData createDemoBitmap(MetadataKey key) {
+static MetaData createDemoBitmap(MetadataKey key, HalRevision halRev) {
MetaData bmp = {MetadataType::INT, key, resources::demoPngId, {}, {}, {}};
- if (gHalVersion < 2) {
+ if (halRev < HalRevision::V1_1) {
bmp.type = MetadataType::RAW;
bmp.intValue = 0;
- bmp.rawValue = std::vector<uint8_t>(resources::demoPng, std::end(resources::demoPng));
+ bmp.rawValue = hidl_vec<uint8_t>(resources::demoPng, std::end(resources::demoPng));
}
return bmp;
}
-VirtualProgram::operator ProgramInfo() const {
+ProgramInfo VirtualProgram::getProgramInfo(HalRevision halRev) const {
ProgramInfo info11 = {};
auto& info10 = info11.base;
@@ -61,8 +57,8 @@
{MetadataType::TEXT, MetadataKey::RDS_PS, {}, {}, programName, {}},
{MetadataType::TEXT, MetadataKey::TITLE, {}, {}, songTitle, {}},
{MetadataType::TEXT, MetadataKey::ARTIST, {}, {}, songArtist, {}},
- createDemoBitmap(MetadataKey::ICON),
- createDemoBitmap(MetadataKey::ART),
+ createDemoBitmap(MetadataKey::ICON, halRev),
+ createDemoBitmap(MetadataKey::ART, halRev),
});
return info11;
@@ -89,6 +85,15 @@
return false;
}
+vector<ProgramInfo> getProgramInfoVector(const vector<VirtualProgram>& vec, HalRevision halRev) {
+ vector<ProgramInfo> out;
+ out.reserve(vec.size());
+ for (auto&& program : vec) {
+ out.push_back(program.getProgramInfo(halRev));
+ }
+ return out;
+}
+
} // namespace implementation
} // namespace V1_1
} // namespace broadcastradio
diff --git a/broadcastradio/1.1/default/VirtualProgram.h b/broadcastradio/1.1/default/VirtualProgram.h
index 2ee21a7..a14830d 100644
--- a/broadcastradio/1.1/default/VirtualProgram.h
+++ b/broadcastradio/1.1/default/VirtualProgram.h
@@ -17,7 +17,7 @@
#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_VIRTUALPROGRAM_H
#include <android/hardware/broadcastradio/1.1/types.h>
-#include <cstdint>
+#include <broadcastradio-utils/Utils.h>
namespace android {
namespace hardware {
@@ -25,9 +25,12 @@
namespace V1_1 {
namespace implementation {
-// TODO (b/36864090): inject this data in a more elegant way
-void setCompatibilityLevel(int halversion);
-
+/**
+ * A radio program mock.
+ *
+ * This represents broadcast waves flying over the air,
+ * not an entry for a captured station in the radio tuner memory.
+ */
struct VirtualProgram {
ProgramSelector selector;
@@ -35,10 +38,14 @@
std::string songArtist = "";
std::string songTitle = "";
- explicit operator ProgramInfo() const;
+ ProgramInfo getProgramInfo(utils::HalRevision halRev) const;
+
friend bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs);
};
+std::vector<ProgramInfo> getProgramInfoVector(const std::vector<VirtualProgram>& vec,
+ utils::HalRevision halRev);
+
} // namespace implementation
} // namespace V1_1
} // namespace broadcastradio
diff --git a/broadcastradio/1.1/default/VirtualRadio.cpp b/broadcastradio/1.1/default/VirtualRadio.cpp
index 692e7bc..36d47a9 100644
--- a/broadcastradio/1.1/default/VirtualRadio.cpp
+++ b/broadcastradio/1.1/default/VirtualRadio.cpp
@@ -13,9 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#define LOG_TAG "BroadcastRadioDefault.VirtualRadio"
+//#define LOG_NDEBUG 0
+
#include "VirtualRadio.h"
#include <broadcastradio-utils/Utils.h>
+#include <log/log.h>
namespace android {
namespace hardware {
@@ -24,6 +28,7 @@
namespace implementation {
using V1_0::Band;
+using V1_0::Class;
using std::lock_guard;
using std::move;
@@ -32,7 +37,7 @@
using utils::make_selector;
-const vector<VirtualProgram> gInitialFmPrograms{
+static const vector<VirtualProgram> gInitialFmPrograms{
{make_selector(Band::FM, 94900), "Wild 94.9", "Drake ft. Rihanna", "Too Good"},
{make_selector(Band::FM, 96500), "KOIT", "Celine Dion", "All By Myself"},
{make_selector(Band::FM, 97300), "Alice@97.3", "Drops of Jupiter", "Train"},
@@ -42,7 +47,8 @@
{make_selector(Band::FM, 106100), "106 KMEL", "Drake", "Marvins Room"},
};
-VirtualRadio::VirtualRadio(VirtualRadio&& o) : mPrograms(move(o.mPrograms)) {}
+static VirtualRadio gEmptyRadio({});
+static VirtualRadio gFmRadio(gInitialFmPrograms);
VirtualRadio::VirtualRadio(const vector<VirtualProgram> initialList) : mPrograms(initialList) {}
@@ -62,8 +68,34 @@
return false;
}
-VirtualRadio make_fm_radio() {
- return VirtualRadio(gInitialFmPrograms);
+VirtualRadio& getRadio(V1_0::Class classId) {
+ switch (classId) {
+ case Class::AM_FM:
+ return getFmRadio();
+ case Class::SAT:
+ return getSatRadio();
+ case Class::DT:
+ return getDigitalRadio();
+ default:
+ ALOGE("Invalid class ID");
+ return gEmptyRadio;
+ }
+}
+
+VirtualRadio& getAmRadio() {
+ return gEmptyRadio;
+}
+
+VirtualRadio& getFmRadio() {
+ return gFmRadio;
+}
+
+VirtualRadio& getSatRadio() {
+ return gEmptyRadio;
+}
+
+VirtualRadio& getDigitalRadio() {
+ return gEmptyRadio;
}
} // namespace implementation
diff --git a/broadcastradio/1.1/default/VirtualRadio.h b/broadcastradio/1.1/default/VirtualRadio.h
index 4cdc72f..3c7ae5c 100644
--- a/broadcastradio/1.1/default/VirtualRadio.h
+++ b/broadcastradio/1.1/default/VirtualRadio.h
@@ -27,9 +27,16 @@
namespace V1_1 {
namespace implementation {
+/**
+ * A radio frequency space mock.
+ *
+ * This represents all broadcast waves in the air for a given radio technology,
+ * not a captured station list in the radio tuner memory.
+ *
+ * It's meant to abstract out radio content from default tuner implementation.
+ */
class VirtualRadio {
public:
- VirtualRadio(VirtualRadio&& o);
VirtualRadio(const std::vector<VirtualProgram> initialList);
std::vector<VirtualProgram> getProgramList();
@@ -40,7 +47,29 @@
std::vector<VirtualProgram> mPrograms;
};
-VirtualRadio make_fm_radio();
+/**
+ * Get virtual radio space for a given radio class.
+ *
+ * As a space, each virtual radio always exists. For example, DAB frequencies
+ * exists in US, but contains no programs.
+ *
+ * The lifetime of the virtual radio space is virtually infinite, but for the
+ * needs of default implementation, it's bound with the lifetime of default
+ * implementation process.
+ *
+ * Internally, it's a static object, so trying to access the reference during
+ * default implementation library unloading may result in segmentation fault.
+ * It's unlikely for testing purposes.
+ *
+ * @param classId A class of radio technology.
+ * @return A reference to virtual radio space for a given technology.
+ */
+VirtualRadio& getRadio(V1_0::Class classId);
+
+VirtualRadio& getAmRadio();
+VirtualRadio& getFmRadio();
+VirtualRadio& getSatRadio();
+VirtualRadio& getDigitalRadio();
} // namespace implementation
} // namespace V1_1
diff --git a/broadcastradio/1.1/utils/Utils.cpp b/broadcastradio/1.1/utils/Utils.cpp
index 8bb7691..50a407c 100644
--- a/broadcastradio/1.1/utils/Utils.cpp
+++ b/broadcastradio/1.1/utils/Utils.cpp
@@ -53,7 +53,9 @@
static bool haveEqualIds(const ProgramSelector& a, const ProgramSelector& b,
const IdentifierType type) {
if (!bothHaveId(a, b, type)) return false;
- // TODO(b/36864090): we should check all Ids of a given type (ie. other AF), not just one
+ /* We should check all Ids of a given type (ie. other AF),
+ * but it doesn't matter for default implementation.
+ */
auto aId = getId(a, type);
auto bId = getId(b, type);
return aId == bId;
diff --git a/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h b/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h
index a7da9fe..4d69c0a 100644
--- a/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h
+++ b/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h
@@ -27,6 +27,12 @@
namespace V1_1 {
namespace utils {
+// TODO(b/64115813): move it out from frameworks/base/services/core/jni/BroadcastRadio/types.h
+enum class HalRevision : uint32_t {
+ V1_0 = 1,
+ V1_1,
+};
+
/**
* Checks, if {@code pointer} tunes to {@channel}.
*
diff --git a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
index c6bc344..bd2e0a7 100644
--- a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
+++ b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
@@ -416,6 +416,52 @@
}
}
+/**
+ * Test AnalogForced switch.
+ *
+ * Verifies that:
+ * - setAnalogForced results either with INVALID_STATE, or isAnalogForced replying the same
+ */
+TEST_P(BroadcastRadioHalTest, AnalogForcedSwitch) {
+ if (skipped) return;
+ ASSERT_TRUE(openTuner());
+
+ bool forced;
+ Result halIsResult;
+ auto isCb = [&](Result result, bool isForced) {
+ halIsResult = result;
+ forced = isForced;
+ };
+
+ // set analog mode
+ auto setResult = mTuner->setAnalogForced(true);
+ ASSERT_TRUE(setResult.isOk());
+ if (Result::INVALID_STATE == setResult) {
+ // if setter fails, getter should fail too - it means the switch is not supported at all
+ auto isResult = mTuner->isAnalogForced(isCb);
+ ASSERT_TRUE(isResult.isOk());
+ EXPECT_EQ(Result::INVALID_STATE, halIsResult);
+ return;
+ }
+ ASSERT_EQ(Result::OK, setResult);
+
+ // check, if it's analog
+ auto isResult = mTuner->isAnalogForced(isCb);
+ ASSERT_TRUE(isResult.isOk());
+ EXPECT_EQ(Result::OK, halIsResult);
+ ASSERT_TRUE(forced);
+
+ // set digital mode
+ setResult = mTuner->setAnalogForced(false);
+ ASSERT_EQ(Result::OK, setResult);
+
+ // check, if it's digital
+ isResult = mTuner->isAnalogForced(isCb);
+ ASSERT_TRUE(isResult.isOk());
+ EXPECT_EQ(Result::OK, halIsResult);
+ ASSERT_FALSE(forced);
+}
+
INSTANTIATE_TEST_CASE_P(BroadcastRadioHalTestCases, BroadcastRadioHalTest,
::testing::Values(Class::AM_FM, Class::SAT, Class::DT));
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index c9f03b0..8ff9847 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -2213,7 +2213,7 @@
static_cast<uint32_t>(it.width),
static_cast<uint32_t>(it.height),
static_cast<PixelFormat>(it.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {stream};
@@ -2257,7 +2257,7 @@
static_cast<uint32_t>(0),
static_cast<uint32_t>(0),
static_cast<PixelFormat>(outputStreams[0].format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {stream};
@@ -2272,7 +2272,7 @@
static_cast<uint32_t>(UINT32_MAX),
static_cast<uint32_t>(UINT32_MAX),
static_cast<PixelFormat>(outputStreams[0].format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
streams[0] = stream;
@@ -2288,7 +2288,7 @@
static_cast<uint32_t>(it.width),
static_cast<uint32_t>(it.height),
static_cast<PixelFormat>(UINT32_MAX),
- 0,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
streams[0] = stream;
@@ -2303,7 +2303,7 @@
static_cast<uint32_t>(it.width),
static_cast<uint32_t>(it.height),
static_cast<PixelFormat>(it.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
static_cast<StreamRotation>(UINT32_MAX)};
streams[0] = stream;
@@ -2383,7 +2383,7 @@
static_cast<uint32_t>(outputIter.width),
static_cast<uint32_t>(outputIter.height),
static_cast<PixelFormat>(outputIter.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
@@ -2441,7 +2441,7 @@
static_cast<uint32_t>(previewIter.width),
static_cast<uint32_t>(previewIter.height),
static_cast<PixelFormat>(previewIter.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
Stream blobStream = {streamId++,
@@ -2449,7 +2449,7 @@
static_cast<uint32_t>(blobIter.width),
static_cast<uint32_t>(blobIter.height),
static_cast<PixelFormat>(blobIter.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_CPU_READ,
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {previewStream, blobStream};
@@ -2501,7 +2501,7 @@
static_cast<uint32_t>(hfrStream.width),
static_cast<uint32_t>(hfrStream.height),
static_cast<PixelFormat>(hfrStream.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER,
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {stream};
@@ -2520,7 +2520,7 @@
static_cast<uint32_t>(0),
static_cast<uint32_t>(0),
static_cast<PixelFormat>(hfrStream.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER,
0,
StreamRotation::ROTATION_0};
streams[0] = stream;
@@ -2535,7 +2535,7 @@
static_cast<uint32_t>(UINT32_MAX),
static_cast<uint32_t>(UINT32_MAX),
static_cast<PixelFormat>(hfrStream.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER,
0,
StreamRotation::ROTATION_0};
streams[0] = stream;
@@ -2550,7 +2550,7 @@
static_cast<uint32_t>(hfrStream.width),
static_cast<uint32_t>(hfrStream.height),
static_cast<PixelFormat>(UINT32_MAX),
- 0,
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER,
0,
StreamRotation::ROTATION_0};
streams[0] = stream;
@@ -2603,7 +2603,7 @@
static_cast<uint32_t>(videoIter.width),
static_cast<uint32_t>(videoIter.height),
static_cast<PixelFormat>(videoIter.format),
- 0,
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER,
0,
StreamRotation::ROTATION_0};
Stream blobStream = {streamId++,
@@ -2611,7 +2611,7 @@
static_cast<uint32_t>(blobIter.width),
static_cast<uint32_t>(blobIter.height),
static_cast<PixelFormat>(blobIter.format),
- GRALLOC_USAGE_HW_VIDEO_ENCODER,
+ GRALLOC1_CONSUMER_USAGE_CPU_READ,
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {videoStream, blobStream};
@@ -3291,7 +3291,7 @@
static_cast<uint32_t> (outputPreviewStreams[0].width),
static_cast<uint32_t> (outputPreviewStreams[0].height),
static_cast<PixelFormat> (outputPreviewStreams[0].format),
- 0, 0, StreamRotation::ROTATION_0};
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0, StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {*previewStream};
StreamConfiguration config = {streams,
StreamConfigurationMode::NORMAL_MODE};
diff --git a/current.txt b/current.txt
index 67f1169..2017df5 100644
--- a/current.txt
+++ b/current.txt
@@ -190,6 +190,7 @@
# ABI preserving changes to HALs released in Android O
150a338ce11fcec70757c9675d83cf6a5d7b40d0c812741b91671fecce59eac9 android.hardware.broadcastradio@1.0::types
+dc7e6d4f537b9943e27edc4f86c5a03bb643b18f18f866f8c3c71c0ac4ea8cbc android.hardware.broadcastradio@1.0::types
760485232f6cce07f8bb05e3475509956996b702f77415ee5bff05e2ec5a5bcc android.hardware.dumpstate@1.0::IDumpstateDevice
e822cb7f4a1bdd45689c5e92ccd19a2201c20b771bd4b2ec1ae627e324591f9d android.hardware.radio@1.0::IRadioResponse
28e929b453df3d9f5060af2764e6cdb123ddb893e3e86923c877f6ff7e5f02c9 android.hardware.wifi@1.0::types
@@ -220,4 +221,4 @@
c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback
b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types
c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi
-bfcf4856c7b6c66ebc56785ed3e5d181b7be859c2add672497a843b024518737 android.hardware.wifi@1.1::IWifiChip
+b056e1defab4071584214584057d0bc73a613081bf1152590549649d4582c13c android.hardware.wifi@1.1::IWifiChip
diff --git a/neuralnetworks/1.0/Android.bp b/neuralnetworks/1.0/Android.bp
new file mode 100644
index 0000000..1356d33
--- /dev/null
+++ b/neuralnetworks/1.0/Android.bp
@@ -0,0 +1,70 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+ name: "android.hardware.neuralnetworks@1.0_hal",
+ srcs: [
+ "types.hal",
+ "IDevice.hal",
+ "IPreparedModel.hal",
+ ],
+}
+
+genrule {
+ name: "android.hardware.neuralnetworks@1.0_genc++",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.neuralnetworks@1.0",
+ srcs: [
+ ":android.hardware.neuralnetworks@1.0_hal",
+ ],
+ out: [
+ "android/hardware/neuralnetworks/1.0/types.cpp",
+ "android/hardware/neuralnetworks/1.0/DeviceAll.cpp",
+ "android/hardware/neuralnetworks/1.0/PreparedModelAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.neuralnetworks@1.0_genc++_headers",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.neuralnetworks@1.0",
+ srcs: [
+ ":android.hardware.neuralnetworks@1.0_hal",
+ ],
+ out: [
+ "android/hardware/neuralnetworks/1.0/types.h",
+ "android/hardware/neuralnetworks/1.0/hwtypes.h",
+ "android/hardware/neuralnetworks/1.0/IDevice.h",
+ "android/hardware/neuralnetworks/1.0/IHwDevice.h",
+ "android/hardware/neuralnetworks/1.0/BnHwDevice.h",
+ "android/hardware/neuralnetworks/1.0/BpHwDevice.h",
+ "android/hardware/neuralnetworks/1.0/BsDevice.h",
+ "android/hardware/neuralnetworks/1.0/IPreparedModel.h",
+ "android/hardware/neuralnetworks/1.0/IHwPreparedModel.h",
+ "android/hardware/neuralnetworks/1.0/BnHwPreparedModel.h",
+ "android/hardware/neuralnetworks/1.0/BpHwPreparedModel.h",
+ "android/hardware/neuralnetworks/1.0/BsPreparedModel.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.neuralnetworks@1.0",
+ defaults: ["hidl-module-defaults"],
+ generated_sources: ["android.hardware.neuralnetworks@1.0_genc++"],
+ generated_headers: ["android.hardware.neuralnetworks@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.neuralnetworks@1.0_genc++_headers"],
+ vendor_available: true,
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "liblog",
+ "libutils",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/neuralnetworks/1.0/IDevice.hal b/neuralnetworks/1.0/IDevice.hal
new file mode 100644
index 0000000..b826b23
--- /dev/null
+++ b/neuralnetworks/1.0/IDevice.hal
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* This HAL is a work in progress */
+
+package android.hardware.neuralnetworks@1.0;
+
+import IPreparedModel;
+
+interface IDevice {
+ initialize() generates(Capabilities capabilities);
+
+ getSupportedSubgraph(Model model) generates(vec<bool> supported);
+
+ prepareModel(Model model) generates(IPreparedModel preparedModel);
+
+ getStatus() generates(DeviceStatus status);
+};
diff --git a/neuralnetworks/1.0/IPreparedModel.hal b/neuralnetworks/1.0/IPreparedModel.hal
new file mode 100644
index 0000000..566d6ac
--- /dev/null
+++ b/neuralnetworks/1.0/IPreparedModel.hal
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* This HAL is a work in progress */
+
+package android.hardware.neuralnetworks@1.0;
+
+interface IPreparedModel {
+ // TODO: The execution is synchronous. Change that to have a callback on completion.
+ // Multiple threads can call this execute function concurrently.
+ execute(Request request) generates(bool success);
+};
diff --git a/neuralnetworks/1.0/types.hal b/neuralnetworks/1.0/types.hal
new file mode 100644
index 0000000..ccc17f1
--- /dev/null
+++ b/neuralnetworks/1.0/types.hal
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* This HAL is a work in progress */
+
+package android.hardware.neuralnetworks@1.0;
+
+// The types an operand can have.
+// These values are the same as found in the NeuralNetworks.h file.
+// When modifying, be sure to update HAL_NUM_OPERAND_TYPES in HalIntefaces.h.
+enum OperandType : uint32_t {
+ FLOAT16 = 0,
+ FLOAT32 = 1,
+ INT8 = 2,
+ UINT8 = 3,
+ INT16 = 4,
+ UINT16 = 5,
+ INT32 = 6,
+ UINT32 = 7,
+ TENSOR_FLOAT16 = 8,
+ TENSOR_FLOAT32 = 9,
+ TENSOR_SYMMETRICAL_QUANT8 = 10,
+};
+
+// The type of operations. Unlike the operation types found in
+// NeuralNetworks.h file, these specify the data type they operate on.
+// This is done to simplify the work of drivers.
+// TODO: Currently they are the same. Add a conversion when finalizing the model.
+// When modifying, be sure to update HAL_NUM_OPERATION_TYPES in HalIntefaces.h.
+enum OperationType : uint32_t {
+ AVERAGE_POOL_FLOAT32 = 0,
+ CONCATENATION_FLOAT32 = 1,
+ CONV_FLOAT32 = 2,
+ DEPTHWISE_CONV_FLOAT32 = 3,
+ MAX_POOL_FLOAT32 = 4,
+ L2_POOL_FLOAT32 = 5,
+ DEPTH_TO_SPACE_FLOAT32 = 6,
+ SPACE_TO_DEPTH_FLOAT32 = 7,
+ LOCAL_RESPONSE_NORMALIZATION_FLOAT32 = 8,
+ SOFTMAX_FLOAT32 = 9,
+ RESHAPE_FLOAT32 = 10,
+ SPLIT_FLOAT32 = 11,
+ FAKE_QUANT_FLOAT32 = 12,
+ ADD_FLOAT32 = 13,
+ FULLY_CONNECTED_FLOAT32 = 14,
+ CAST_FLOAT32 = 15,
+ MUL_FLOAT32 = 16,
+ L2_NORMALIZATION_FLOAT32 = 17,
+ LOGISTIC_FLOAT32 = 18,
+ RELU_FLOAT32 = 19,
+ RELU6_FLOAT32 = 20,
+ RELU1_FLOAT32 = 21,
+ TANH_FLOAT32 = 22,
+ DEQUANTIZE_FLOAT32 = 23,
+ FLOOR_FLOAT32 = 24,
+ GATHER_FLOAT32 = 25,
+ RESIZE_BILINEAR_FLOAT32 = 26,
+ LSH_PROJECTION_FLOAT32 = 27,
+ LSTM_FLOAT32 = 28,
+ SVDF_FLOAT32 = 29,
+ RNN_FLOAT32 = 30,
+ N_GRAM_FLOAT32 = 31,
+ LOOKUP_FLOAT32 = 32,
+};
+
+// Two special values that can be used instead of a regular poolIndex.
+enum LocationValues : uint32_t {
+ // The location will be specified at runtime. It's either a temporary
+ // variable, an input, or an output.
+ LOCATION_AT_RUN_TIME = 0xFFFFFFFF,
+ // The operand's value is stored in the
+ // TODO: Only for old
+ LOCATION_SAME_BLOCK = 0xFFFFFFFE
+};
+
+// Status of a device.
+enum DeviceStatus : uint32_t {
+ AVAILABLE,
+ BUSY,
+ OFFLINE,
+ UNKNOWN // Do we need this?
+};
+
+// For the reference workload
+// Used by a driver to report its performance characteristics.
+// TODO revisit the data types and scales.
+struct PerformanceInfo {
+ float execTime; // in nanoseconds
+ float powerUsage; // in picoJoules
+};
+
+// The capabilities of a driver.
+struct Capabilities {
+ vec<OperationType> supportedOperationTypes;
+ // TODO Do the same for baseline model IDs
+ bool cachesCompilation;
+ // TODO revisit the data types and scales.
+ float bootupTime; // in nanoseconds
+ PerformanceInfo float16Performance;
+ PerformanceInfo float32Performance;
+ PerformanceInfo quantized8Performance;
+};
+
+// Describes the location of a data object.
+struct DataLocation {
+ // The index of the memory pool where this location is found.
+ // Two special values can also be used. See the LOCATION_* constants above.
+ uint32_t poolIndex;
+ // Offset in bytes from the start of the pool.
+ uint32_t offset;
+ // The length of the data, in bytes.
+ uint32_t length;
+};
+
+struct Operand {
+ OperandType type;
+ vec<uint32_t> dimensions;
+
+ // The number of operations that uses this operand as input.
+ // TODO It would be nice to track the actual consumers, e.g. vec<uint32_t> consumers;
+ uint32_t numberOfConsumers;
+
+ float scale;
+ int32_t zeroPoint;
+
+ // Where to find the data for this operand.
+ DataLocation location;
+};
+
+// Describes one operation of the graph.
+struct Operation {
+ // The type of operation.
+ OperationType type;
+ // Describes the table that contains the indexes of the inputs of the
+ // operation. The offset is the index in the operandIndexes table.
+ vec<uint32_t> inputs;
+ // Describes the table that contains the indexes of the outputs of the
+ // operation. The offset is the index in the operandIndexes table.
+ vec<uint32_t> outputs;
+};
+
+struct InputOutputInfo {
+ DataLocation location;
+ // If dimensions.size() > 0, we have updated dimensions.
+ vec<uint32_t> dimensions;
+};
+
+struct Model {
+ vec<Operand> operands;
+ vec<Operation> operations;
+ vec<uint32_t> inputIndexes;
+ vec<uint32_t> outputIndexes;
+ vec<uint8_t> operandValues;
+ vec<memory> pools;
+};
+
+struct Request {
+ vec<InputOutputInfo> inputs;
+ vec<InputOutputInfo> outputs;
+ vec<memory> pools;
+};
diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..96eb4cb
--- /dev/null
+++ b/neuralnetworks/1.0/vts/functional/Android.bp
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalNeuralnetworksV1_0TargetTest",
+ srcs: ["VtsHalNeuralnetworksV1_0TargetTest.cpp"],
+ defaults: ["hidl_defaults"],
+ shared_libs: [
+ "libbase",
+ "libhidlbase",
+ "libhidlmemory",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ "android.hardware.neuralnetworks@1.0",
+ "android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+}
diff --git a/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.cpp b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.cpp
new file mode 100644
index 0000000..9fa694d
--- /dev/null
+++ b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.cpp
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 "neuralnetworks_hidl_hal_test"
+
+#include "VtsHalNeuralnetworksV1_0TargetTest.h"
+#include <android-base/logging.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+#include <hidlmemory/mapping.h>
+#include <string>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_0 {
+namespace vts {
+namespace functional {
+
+// A class for test environment setup
+NeuralnetworksHidlEnvironment::NeuralnetworksHidlEnvironment() {}
+
+NeuralnetworksHidlEnvironment* NeuralnetworksHidlEnvironment::getInstance() {
+ // This has to return a "new" object because it is freed inside
+ // ::testing::AddGlobalTestEnvironment when the gtest is being torn down
+ static NeuralnetworksHidlEnvironment* instance = new NeuralnetworksHidlEnvironment();
+ return instance;
+}
+
+void NeuralnetworksHidlEnvironment::registerTestServices() {
+ registerTestService("android.hardware.neuralnetworks", "1.0", "IDevice");
+}
+
+// The main test class for NEURALNETWORK HIDL HAL.
+void NeuralnetworksHidlTest::SetUp() {
+ std::string instance =
+ NeuralnetworksHidlEnvironment::getInstance()->getServiceName(IDevice::descriptor);
+ LOG(INFO) << "running vts test with instance: " << instance;
+ device = ::testing::VtsHalHidlTargetTestBase::getService<IDevice>(instance);
+ ASSERT_NE(nullptr, device.get());
+}
+
+void NeuralnetworksHidlTest::TearDown() {}
+
+// create device test
+TEST_F(NeuralnetworksHidlTest, CreateDevice) {}
+
+// status test
+TEST_F(NeuralnetworksHidlTest, StatusTest) {
+ DeviceStatus status = device->getStatus();
+ EXPECT_EQ(DeviceStatus::AVAILABLE, status);
+}
+
+// initialization
+TEST_F(NeuralnetworksHidlTest, InitializeTest) {
+ Return<void> ret = device->initialize([](const Capabilities& capabilities) {
+ EXPECT_NE(nullptr, capabilities.supportedOperationTypes.data());
+ EXPECT_NE(0ull, capabilities.supportedOperationTypes.size());
+ EXPECT_EQ(0u, static_cast<uint32_t>(capabilities.cachesCompilation) & ~0x1);
+ EXPECT_LT(0.0f, capabilities.bootupTime);
+ EXPECT_LT(0.0f, capabilities.float16Performance.execTime);
+ EXPECT_LT(0.0f, capabilities.float16Performance.powerUsage);
+ EXPECT_LT(0.0f, capabilities.float32Performance.execTime);
+ EXPECT_LT(0.0f, capabilities.float32Performance.powerUsage);
+ EXPECT_LT(0.0f, capabilities.quantized8Performance.execTime);
+ EXPECT_LT(0.0f, capabilities.quantized8Performance.powerUsage);
+ });
+ EXPECT_TRUE(ret.isOk());
+}
+
+namespace {
+// create the model
+Model createTestModel() {
+ const std::vector<float> operand2Data = {5.0f, 6.0f, 7.0f, 8.0f};
+ const uint32_t size = operand2Data.size() * sizeof(float);
+
+ const uint32_t operand1 = 0;
+ const uint32_t operand2 = 1;
+ const uint32_t operand3 = 2;
+
+ const std::vector<Operand> operands = {
+ {
+ .type = OperandType::FLOAT32,
+ .dimensions = {1, 2, 2, 1},
+ .numberOfConsumers = 1,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .location = {.poolIndex = static_cast<uint32_t>(LocationValues::LOCATION_AT_RUN_TIME),
+ .offset = 0,
+ .length = 0},
+ },
+ {
+ .type = OperandType::FLOAT32,
+ .dimensions = {1, 2, 2, 1},
+ .numberOfConsumers = 1,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .location = {.poolIndex = static_cast<uint32_t>(LocationValues::LOCATION_SAME_BLOCK),
+ .offset = 0,
+ .length = size},
+ },
+ {
+ .type = OperandType::FLOAT32,
+ .dimensions = {1, 2, 2, 1},
+ .numberOfConsumers = 0,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .location = {.poolIndex = static_cast<uint32_t>(LocationValues::LOCATION_AT_RUN_TIME),
+ .offset = 0,
+ .length = 0},
+ },
+ };
+
+ const std::vector<Operation> operations = {{
+ .type = OperationType::ADD_FLOAT32, .inputs = {operand1, operand2}, .outputs = {operand3},
+ }};
+
+ const std::vector<uint32_t> inputIndexes = {operand1};
+ const std::vector<uint32_t> outputIndexes = {operand3};
+ const std::vector<uint8_t> operandValues(reinterpret_cast<const uint8_t*>(operand2Data.data()),
+ reinterpret_cast<const uint8_t*>(operand2Data.data()) +
+ operand2Data.size() * sizeof(float));
+ const std::vector<hidl_memory> pools = {};
+
+ return {
+ .operands = operands,
+ .operations = operations,
+ .inputIndexes = inputIndexes,
+ .outputIndexes = outputIndexes,
+ .operandValues = operandValues,
+ .pools = pools,
+ };
+}
+
+// allocator helper
+hidl_memory allocateSharedMemory(int64_t size, const std::string& type = "ashmem") {
+ hidl_memory memory;
+
+ sp<IAllocator> allocator = IAllocator::getService(type);
+ if (!allocator.get()) {
+ return {};
+ }
+
+ Return<void> ret = allocator->allocate(size, [&](bool success, const hidl_memory& mem) {
+ ASSERT_TRUE(success);
+ memory = mem;
+ });
+ if (!ret.isOk()) {
+ return {};
+ }
+
+ return memory;
+}
+} // anonymous namespace
+
+// supported subgraph test
+TEST_F(NeuralnetworksHidlTest, SupportedSubgraphTest) {
+ Model model = createTestModel();
+ std::vector<bool> supported;
+ Return<void> ret = device->getSupportedSubgraph(
+ model, [&](const hidl_vec<bool>& hidl_supported) { supported = hidl_supported; });
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(/*model.operations.size()*/ 0ull, supported.size());
+}
+
+// execute simple graph
+TEST_F(NeuralnetworksHidlTest, SimpleExecuteGraphTest) {
+ std::vector<float> inputData = {1.0f, 2.0f, 3.0f, 4.0f};
+ std::vector<float> outputData = {-1.0f, -1.0f, -1.0f, -1.0f};
+ std::vector<float> expectedData = {6.0f, 8.0f, 10.0f, 12.0f};
+ const uint32_t INPUT = 0;
+ const uint32_t OUTPUT = 1;
+
+ // prpeare request
+ Model model = createTestModel();
+ sp<IPreparedModel> preparedModel = device->prepareModel(model);
+ ASSERT_NE(nullptr, preparedModel.get());
+
+ // prepare inputs
+ uint32_t inputSize = static_cast<uint32_t>(inputData.size() * sizeof(float));
+ uint32_t outputSize = static_cast<uint32_t>(outputData.size() * sizeof(float));
+ std::vector<InputOutputInfo> inputs = {{
+ .location = {.poolIndex = INPUT, .offset = 0, .length = inputSize}, .dimensions = {},
+ }};
+ std::vector<InputOutputInfo> outputs = {{
+ .location = {.poolIndex = OUTPUT, .offset = 0, .length = outputSize}, .dimensions = {},
+ }};
+ std::vector<hidl_memory> pools = {allocateSharedMemory(inputSize),
+ allocateSharedMemory(outputSize)};
+ ASSERT_NE(0ull, pools[INPUT].size());
+ ASSERT_NE(0ull, pools[OUTPUT].size());
+
+ // load data
+ sp<IMemory> inputMemory = mapMemory(pools[INPUT]);
+ sp<IMemory> outputMemory = mapMemory(pools[OUTPUT]);
+ ASSERT_NE(nullptr, inputMemory.get());
+ ASSERT_NE(nullptr, outputMemory.get());
+ float* inputPtr = reinterpret_cast<float*>(static_cast<void*>(inputMemory->getPointer()));
+ float* outputPtr = reinterpret_cast<float*>(static_cast<void*>(outputMemory->getPointer()));
+ ASSERT_NE(nullptr, inputPtr);
+ ASSERT_NE(nullptr, outputPtr);
+ std::copy(inputData.begin(), inputData.end(), inputPtr);
+ std::copy(outputData.begin(), outputData.end(), outputPtr);
+ inputMemory->commit();
+ outputMemory->commit();
+
+ // execute request
+ bool success = preparedModel->execute({.inputs = inputs, .outputs = outputs, .pools = pools});
+ EXPECT_TRUE(success);
+
+ // validate results { 1+5, 2+6, 3+7, 4+8 }
+ outputMemory->update();
+ std::copy(outputPtr, outputPtr + outputData.size(), outputData.begin());
+ EXPECT_EQ(expectedData, outputData);
+}
+
+} // namespace functional
+} // namespace vts
+} // namespace V1_0
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+using android::hardware::neuralnetworks::V1_0::vts::functional::NeuralnetworksHidlEnvironment;
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(NeuralnetworksHidlEnvironment::getInstance());
+ ::testing::InitGoogleTest(&argc, argv);
+ NeuralnetworksHidlEnvironment::getInstance()->init(&argc, argv);
+
+ int status = RUN_ALL_TESTS();
+ return status;
+}
diff --git a/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.h b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.h
new file mode 100644
index 0000000..bb0cdaa
--- /dev/null
+++ b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworksV1_0TargetTest.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H
+#define VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H
+
+#include <android/hardware/neuralnetworks/1.0/IDevice.h>
+#include <android/hardware/neuralnetworks/1.0/IPreparedModel.h>
+#include <android/hardware/neuralnetworks/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+#include <gtest/gtest.h>
+#include <string>
+
+using ::android::hardware::neuralnetworks::V1_0::IDevice;
+using ::android::hardware::neuralnetworks::V1_0::IPreparedModel;
+using ::android::hardware::neuralnetworks::V1_0::Capabilities;
+using ::android::hardware::neuralnetworks::V1_0::DeviceStatus;
+using ::android::hardware::neuralnetworks::V1_0::Model;
+using ::android::hardware::neuralnetworks::V1_0::OperationType;
+using ::android::hardware::neuralnetworks::V1_0::PerformanceInfo;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::sp;
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_0 {
+namespace vts {
+namespace functional {
+
+// A class for test environment setup
+class NeuralnetworksHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ NeuralnetworksHidlEnvironment();
+ NeuralnetworksHidlEnvironment(const NeuralnetworksHidlEnvironment&) = delete;
+ NeuralnetworksHidlEnvironment(NeuralnetworksHidlEnvironment&&) = delete;
+ NeuralnetworksHidlEnvironment& operator=(const NeuralnetworksHidlEnvironment&) = delete;
+ NeuralnetworksHidlEnvironment& operator=(NeuralnetworksHidlEnvironment&&) = delete;
+
+ public:
+ static NeuralnetworksHidlEnvironment* getInstance();
+ virtual void registerTestServices() override;
+};
+
+// The main test class for NEURALNETWORKS HIDL HAL.
+class NeuralnetworksHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override;
+ virtual void TearDown() override;
+
+ sp<IDevice> device;
+};
+
+} // namespace functional
+} // namespace vts
+} // namespace V1_0
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H
diff --git a/neuralnetworks/Android.bp b/neuralnetworks/Android.bp
new file mode 100644
index 0000000..33f70eb
--- /dev/null
+++ b/neuralnetworks/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+ "1.0",
+ "1.0/vts/functional",
+]
diff --git a/radio/1.0/vts/OWNERS b/radio/1.0/vts/OWNERS
new file mode 100644
index 0000000..8236e94
--- /dev/null
+++ b/radio/1.0/vts/OWNERS
@@ -0,0 +1,7 @@
+# Telephony team
+amitmahajan@google.com
+sanketpadawe@google.com
+
+# VTS team
+yuexima@google.com
+yim@google.com
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 35d97ee..4684e0f 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -79,7 +79,7 @@
radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW ||
radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_DURING_VOICE_CALL ||
- CheckOEMError());
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT || CheckOEMError());
}
}
@@ -98,7 +98,10 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- EXPECT_EQ(RadioError::INVALID_CALL_ID, radioRsp->rspInfo.error);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT || CheckOEMError() ||
+ radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
}
}
@@ -116,7 +119,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
- radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
+ radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -220,6 +224,9 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- // TODO(shuoq): Will add error check when we know the expected error from QC
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT ||
+ radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
index 9e003e2..e56e3c8 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -317,6 +317,7 @@
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_SIM_STATE ||
radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT ||
- radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ radioRsp->rspInfo.error == RadioError::INTERNAL_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
-}
+ }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 864f844..d93b176 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -397,7 +397,8 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::EMPTY_RECORD);
}
}
@@ -675,9 +676,11 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
+ std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
- radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ radioRsp->rspInfo.error == RadioError::INTERNAL_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -695,7 +698,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
- radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -754,22 +758,24 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE || CheckGeneralError());
- }
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ }
- /* Reset back to no carrier restriction */
- memset(&carriers, 0, sizeof(carriers));
- carriers.allowedCarriers.resize(0);
- carriers.excludedCarriers.resize(0);
+ /* Reset back to no carrier restriction */
+ memset(&carriers, 0, sizeof(carriers));
+ carriers.allowedCarriers.resize(0);
+ carriers.excludedCarriers.resize(0);
- radio->setAllowedCarriers(++serial, true, carriers);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+ radio->setAllowedCarriers(++serial, true, carriers);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp->rspInfo.serial);
- if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE || CheckGeneralError());
- }
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ }
}
/*
@@ -842,4 +848,4 @@
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
-}
\ No newline at end of file
+}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
index 271a23a..7d74703 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
@@ -36,7 +36,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
}
}
@@ -62,7 +63,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -145,7 +147,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -237,7 +240,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
- radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -257,7 +261,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT);
+ radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -285,7 +290,8 @@
radioRsp->rspInfo.error == RadioError::ENCODING_ERR ||
radioRsp->rspInfo.error == RadioError::NO_RESOURCES ||
radioRsp->rspInfo.error == RadioError::NETWORK_NOT_READY ||
- radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
+ radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -308,7 +314,8 @@
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
- radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -361,7 +368,8 @@
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
- radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
+ radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -413,7 +421,8 @@
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
- radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -434,6 +443,7 @@
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
- radioRsp->rspInfo.error == RadioError::MODEM_ERR);
+ radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
index 9e51df4..da46e88 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
@@ -40,24 +40,6 @@
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
-
- // Test with sending random string
- serial = GetRandomSerialNumber();
- content = "0";
-
- radio->sendEnvelope(serial, content);
-
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-
- if (cardStatus.cardState == CardState::ABSENT) {
- std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
- ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::NONE ||
- radioRsp->rspInfo.error == RadioError::MODEM_ERR);
- }
}
/*
@@ -81,23 +63,6 @@
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE);
}
-
- serial = GetRandomSerialNumber();
-
- // Test with sending random string
- commandResponse = "0";
-
- radio->sendTerminalResponseToSim(serial, commandResponse);
-
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-
- if (cardStatus.cardState == CardState::ABSENT) {
- std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
- ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
- }
}
/*
@@ -156,22 +121,7 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::MODEM_ERR);
- }
-
- // Test with sending random string
- serial = GetRandomSerialNumber();
- contents = "0";
-
- radio->sendEnvelopeWithStatus(serial, contents);
-
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-
- if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::MODEM_ERR);
+ radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
diff --git a/radio/1.1/vts/OWNERS b/radio/1.1/vts/OWNERS
new file mode 100644
index 0000000..8236e94
--- /dev/null
+++ b/radio/1.1/vts/OWNERS
@@ -0,0 +1,7 @@
+# Telephony team
+amitmahajan@google.com
+sanketpadawe@google.com
+
+# VTS team
+yuexima@google.com
+yim@google.com
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
index c6ac8a6..36fd7c2 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp
@@ -15,6 +15,7 @@
*/
#include <radio_hidl_hal_utils_v1_1.h>
+#include <vector>
/*
* Test IRadio.setSimCardPower() for the response returned.
@@ -106,4 +107,139 @@
radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
-}
\ No newline at end of file
+}
+
+/*
+ * Test IRadio.setCarrierInfoForImsiEncryption() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_1, setCarrierInfoForImsiEncryption) {
+ int serial = GetRandomSerialNumber();
+ ImsiEncryptionInfo imsiInfo;
+ imsiInfo.mcc = "310";
+ imsiInfo.mnc = "004";
+ imsiInfo.carrierKey = (std::vector<uint8_t>){1, 2, 3, 4, 5, 6};
+ imsiInfo.keyIdentifier = "Test";
+ imsiInfo.expirationTime = 20180101;
+
+ radio_v1_1->setCarrierInfoForImsiEncryption(serial, imsiInfo);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
+ radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ }
+}
+
+/*
+ * Test IRadio.startKeepalive() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_1, startKeepalive) {
+ std::vector<KeepaliveRequest> requests = {
+ {
+ // Invalid IPv4 source address
+ KeepaliveType::NATT_IPV4,
+ {192, 168, 0 /*, 100*/},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv4 destination address
+ KeepaliveType::NATT_IPV4,
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4, 1, 2, 3, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Keepalive Type
+ static_cast<KeepaliveType>(-1),
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv6 source address
+ KeepaliveType::NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
+ 0xBE, 0xEF, 0xBD},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x88, 0x44},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid IPv6 destination address
+ KeepaliveType::NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
+ 0xBE, 0xEF},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x88,
+ /*0x44*/},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Context ID (cid), this should survive the initial
+ // range checking and fail in the modem data layer
+ KeepaliveType::NATT_IPV4,
+ {192, 168, 0, 100},
+ 1234,
+ {8, 8, 4, 4},
+ 4500,
+ 20000,
+ 0xBAD,
+ },
+ {
+ // Invalid Context ID (cid), this should survive the initial
+ // range checking and fail in the modem data layer
+ KeepaliveType::NATT_IPV6,
+ {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
+ 0xBE, 0xEF},
+ 1234,
+ {0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x88, 0x44},
+ 4500,
+ 20000,
+ 0xBAD,
+ }};
+
+ for (auto req = requests.begin(); req != requests.end(); req++) {
+ int serial = GetRandomSerialNumber();
+ radio_v1_1->startKeepalive(serial, *req);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+
+ ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+ radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ }
+}
+
+/*
+ * Test IRadio.stopKeepalive() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_1, stopKeepalive) {
+ int serial = GetRandomSerialNumber();
+
+ radio_v1_1->stopKeepalive(serial, 0xBAD);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
+
+ ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+ radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+}
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
index dd4f1ef..c797e35 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
+++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
@@ -53,6 +53,7 @@
hidl_string imsi;
IccIoResult iccIoResult;
int channelId;
+ KeepaliveStatus keepaliveStatus;
// Sms
SendSmsResult sendSmsResult;
@@ -567,4 +568,4 @@
public:
virtual void SetUp() {}
virtual void TearDown() {}
-};
\ No newline at end of file
+};
diff --git a/radio/1.1/vts/functional/radio_response.cpp b/radio/1.1/vts/functional/radio_response.cpp
index 37b80b1..400ef3c 100644
--- a/radio/1.1/vts/functional/radio_response.cpp
+++ b/radio/1.1/vts/functional/radio_response.cpp
@@ -659,7 +659,9 @@
/* 1.1 Apis */
Return<void> RadioResponse_v1_1::setCarrierInfoForImsiEncryptionResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_1.notify();
return Void();
}
@@ -681,11 +683,16 @@
return Void();
}
-Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
- const KeepaliveStatus& /*status*/) {
+Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo& info,
+ const KeepaliveStatus& status) {
+ rspInfo = info;
+ keepaliveStatus = status;
+ parent_v1_1.notify();
return Void();
}
-Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_1.notify();
return Void();
-}
\ No newline at end of file
+}
diff --git a/wifi/1.1/IWifiChip.hal b/wifi/1.1/IWifiChip.hal
index 50cd02d..1af1f71 100644
--- a/wifi/1.1/IWifiChip.hal
+++ b/wifi/1.1/IWifiChip.hal
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 The Android Open Source Project
+ * Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,24 +44,40 @@
};
/**
- * API to set TX power limit.
- * This is used for meeting SAR requirements while making VOIP calls for
- * example.
- *
- * @param powerInDbm Power level in dBm.
- * @return status WifiStatus of the operation.
- * Possible status codes:
- * |WifiStatusCode.SUCCESS|,
- * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
- * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
- * |WifiStatusCode.NOT_AVAILABLE|,
- * |WifiStatusCode.UNKNOWN|
+ * List of preset wifi radio TX power levels for different scenarios.
+ * The actual power values (typically varies based on the channel,
+ * 802.11 connection type, number of MIMO streams, etc) for each scenario
+ * is defined by the OEM as a BDF file since it varies for each wifi chip
+ * vendor and device.
*/
- setTxPowerLimit(int32_t powerInDbm) generates (WifiStatus status);
+ enum TxPowerScenario : uint32_t {
+ VOICE_CALL = 0,
+ };
/**
- * API to reset TX power limit.
- * This is used to set the power back to default values.
+ * API to select one of the preset TX power scenarios.
+ *
+ * The framework must invoke this method with the appropriate scenario to let
+ * the wifi chip change it's transmitting power levels.
+ * OEM's should define various power profiles for each of the scenarios
+ * above (defined in |TxPowerScenario|).
+ *
+ * @param scenario One of the preselected scenarios defined in
+ * |TxPowerScenario|.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+ * |WifiStatusCode.NOT_AVAILABLE|,
+ * |WifiStatusCode.UNKNOWN|
+ */
+ selectTxPowerScenario(TxPowerScenario scenario) generates (WifiStatus status);
+
+ /**
+ * API to reset TX power levels.
+ * This is used to indicate the end of the previously selected TX power
+ * scenario and let the wifi chip fall back to the default power values.
*
* @return status WifiStatus of the operation.
* Possible status codes:
@@ -71,5 +87,5 @@
* |WifiStatusCode.NOT_AVAILABLE|,
* |WifiStatusCode.UNKNOWN|
*/
- resetTxPowerLimit() generates (WifiStatus status);
+ resetTxPowerScenario() generates (WifiStatus status);
};
diff --git a/wifi/1.1/default/hidl_struct_util.cpp b/wifi/1.1/default/hidl_struct_util.cpp
index 6b93b9e..c53cdc5 100644
--- a/wifi/1.1/default/hidl_struct_util.cpp
+++ b/wifi/1.1/default/hidl_struct_util.cpp
@@ -17,9 +17,6 @@
#include <android-base/logging.h>
#include <utils/SystemClock.h>
-#include <android/hardware/wifi/1.0/IWifiChip.h>
-#include <android/hardware/wifi/1.1/IWifiChip.h>
-
#include "hidl_struct_util.h"
namespace android {
@@ -260,6 +257,15 @@
return true;
}
+legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
+ V1_1::IWifiChip::TxPowerScenario hidl_scenario) {
+ switch (hidl_scenario) {
+ case V1_1::IWifiChip::TxPowerScenario::VOICE_CALL:
+ return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL;
+ };
+ CHECK(false);
+}
+
bool convertLegacyFeaturesToHidlStaCapabilities(
uint32_t legacy_feature_set,
uint32_t legacy_logger_feature_set,
diff --git a/wifi/1.1/default/hidl_struct_util.h b/wifi/1.1/default/hidl_struct_util.h
index 7a840f9..747fd2f 100644
--- a/wifi/1.1/default/hidl_struct_util.h
+++ b/wifi/1.1/default/hidl_struct_util.h
@@ -20,6 +20,8 @@
#include <vector>
#include <android/hardware/wifi/1.0/types.h>
+#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
#include "wifi_legacy_hal.h"
@@ -51,6 +53,8 @@
bool convertLegacyWakeReasonStatsToHidl(
const legacy_hal::WakeReasonStats& legacy_stats,
WifiDebugHostWakeReasonStats* hidl_stats);
+legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
+ V1_1::IWifiChip::TxPowerScenario hidl_scenario);
// STA iface conversion methods.
bool convertLegacyFeaturesToHidlStaCapabilities(
diff --git a/wifi/1.1/default/wifi_chip.cpp b/wifi/1.1/default/wifi_chip.cpp
index 2beac26..2f40234 100644
--- a/wifi/1.1/default/wifi_chip.cpp
+++ b/wifi/1.1/default/wifi_chip.cpp
@@ -343,20 +343,20 @@
enable);
}
-Return<void> WifiChip::setTxPowerLimit(
- int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) {
+Return<void> WifiChip::selectTxPowerScenario(
+ TxPowerScenario scenario, selectTxPowerScenario_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
- &WifiChip::setTxPowerLimitInternal,
+ &WifiChip::selectTxPowerScenarioInternal,
hidl_status_cb,
- powerInDbm);
+ scenario);
}
-Return<void> WifiChip::resetTxPowerLimit(
- resetTxPowerLimit_cb hidl_status_cb) {
+Return<void> WifiChip::resetTxPowerScenario(
+ resetTxPowerScenario_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
- &WifiChip::resetTxPowerLimitInternal,
+ &WifiChip::resetTxPowerScenarioInternal,
hidl_status_cb);
}
@@ -824,13 +824,14 @@
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiChip::setTxPowerLimitInternal(int32_t powerInDbm) {
- auto legacy_status = legacy_hal_.lock()->setTxPowerLimit(powerInDbm);
+WifiStatus WifiChip::selectTxPowerScenarioInternal(TxPowerScenario scenario) {
+ auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario(
+ hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario));
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiChip::resetTxPowerLimitInternal() {
- auto legacy_status = legacy_hal_.lock()->resetTxPowerLimit();
+WifiStatus WifiChip::resetTxPowerScenarioInternal() {
+ auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario();
return createWifiStatusFromLegacyError(legacy_status);
}
diff --git a/wifi/1.1/default/wifi_chip.h b/wifi/1.1/default/wifi_chip.h
index b7dde50..e88100b 100644
--- a/wifi/1.1/default/wifi_chip.h
+++ b/wifi/1.1/default/wifi_chip.h
@@ -126,9 +126,11 @@
getDebugHostWakeReasonStats_cb hidl_status_cb) override;
Return<void> enableDebugErrorAlerts(
bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override;
- Return<void> setTxPowerLimit(
- int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) override;
- Return<void> resetTxPowerLimit(resetTxPowerLimit_cb hidl_status_cb) override;
+ Return<void> selectTxPowerScenario(
+ TxPowerScenario scenario,
+ selectTxPowerScenario_cb hidl_status_cb) override;
+ Return<void> resetTxPowerScenario(
+ resetTxPowerScenario_cb hidl_status_cb) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -180,8 +182,8 @@
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
getDebugHostWakeReasonStatsInternal();
WifiStatus enableDebugErrorAlertsInternal(bool enable);
- WifiStatus setTxPowerLimitInternal(int32_t powerInDbm);
- WifiStatus resetTxPowerLimitInternal();
+ WifiStatus selectTxPowerScenarioInternal(TxPowerScenario scenario);
+ WifiStatus resetTxPowerScenarioInternal();
WifiStatus handleChipConfiguration(ChipModeId mode_id);
WifiStatus registerDebugRingBufferCallback();
diff --git a/wifi/1.1/default/wifi_legacy_hal.cpp b/wifi/1.1/default/wifi_legacy_hal.cpp
index 052aafb..7d683d3 100644
--- a/wifi/1.1/default/wifi_legacy_hal.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal.cpp
@@ -752,13 +752,13 @@
oui_internal.data());
}
-wifi_error WifiLegacyHal::setTxPowerLimit(int32_t tx_level_dbm) {
- return global_func_table_.wifi_set_tx_power_limit(wlan_interface_handle_,
- tx_level_dbm);
+wifi_error WifiLegacyHal::selectTxPowerScenario(wifi_power_scenario scenario) {
+ return global_func_table_.wifi_select_tx_power_scenario(
+ wlan_interface_handle_, scenario);
}
-wifi_error WifiLegacyHal::resetTxPowerLimit() {
- return global_func_table_.wifi_reset_tx_power_limit(wlan_interface_handle_);
+wifi_error WifiLegacyHal::resetTxPowerScenario() {
+ return global_func_table_.wifi_reset_tx_power_scenario(wlan_interface_handle_);
}
std::pair<wifi_error, uint32_t> WifiLegacyHal::getLoggerSupportedFeatureSet() {
diff --git a/wifi/1.1/default/wifi_legacy_hal.h b/wifi/1.1/default/wifi_legacy_hal.h
index 8d9144d..caa1bd5 100644
--- a/wifi/1.1/default/wifi_legacy_hal.h
+++ b/wifi/1.1/default/wifi_legacy_hal.h
@@ -205,8 +205,8 @@
uint32_t period_in_ms);
wifi_error stopSendingOffloadedPacket(uint32_t cmd_id);
wifi_error setScanningMacOui(const std::array<uint8_t, 3>& oui);
- wifi_error setTxPowerLimit(int32_t tx_level_dbm);
- wifi_error resetTxPowerLimit();
+ wifi_error selectTxPowerScenario(wifi_power_scenario scenario);
+ wifi_error resetTxPowerScenario();
// Logger/debug functions.
std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet();
wifi_error startPktFateMonitoring();
diff --git a/wifi/1.1/default/wifi_legacy_hal_stubs.cpp b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
index 24ed548..c02e3ba 100644
--- a/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
@@ -132,8 +132,8 @@
populateStubFor(&hal_fn->wifi_get_roaming_capabilities);
populateStubFor(&hal_fn->wifi_enable_firmware_roaming);
populateStubFor(&hal_fn->wifi_configure_roaming);
- populateStubFor(&hal_fn->wifi_set_tx_power_limit);
- populateStubFor(&hal_fn->wifi_reset_tx_power_limit);
+ populateStubFor(&hal_fn->wifi_select_tx_power_scenario);
+ populateStubFor(&hal_fn->wifi_reset_tx_power_scenario);
return true;
}
} // namespace legacy_hal
diff --git a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
index 839b6c4..d3a983c 100644
--- a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
@@ -37,7 +37,8 @@
using ::android::hardware::wifi::V1_0::IWifiStaIface;
namespace {
-constexpr int32_t kFakePowerInDbm = -56;
+constexpr IWifiChip::TxPowerScenario kFakePowerScenario =
+ IWifiChip::TxPowerScenario::VOICE_CALL;
}; //namespace
/**
@@ -66,12 +67,12 @@
};
/*
- * SetTxPowerLimit
+ * SelectTxPowerScenario
*/
-TEST_F(WifiChipHidlTest, SetTxPowerLimit) {
+TEST_F(WifiChipHidlTest, SelectTxPowerScenario) {
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
const auto& status =
- HIDL_INVOKE(wifi_chip_, setTxPowerLimit, kFakePowerInDbm);
+ HIDL_INVOKE(wifi_chip_, selectTxPowerScenario, kFakePowerScenario);
if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
} else {
@@ -80,12 +81,12 @@
}
/*
- * SetTxPowerLimit
+ * ResetTxPowerScenario
*/
-TEST_F(WifiChipHidlTest, ResetTxPowerLimit) {
+TEST_F(WifiChipHidlTest, ResetTxPowerScenario) {
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
const auto& status =
- HIDL_INVOKE(wifi_chip_, resetTxPowerLimit);
+ HIDL_INVOKE(wifi_chip_, resetTxPowerScenario);
if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
} else {
diff --git a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
index 55f5a87..90c36dd 100644
--- a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
+++ b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
@@ -32,6 +32,8 @@
using ::android::hardware::wifi::offload::V1_0::IOffloadCallback;
using ::android::hardware::wifi::offload::V1_0::ScanResult;
using ::android::hardware::wifi::offload::V1_0::ScanParam;
+using ::android::hardware::wifi::offload::V1_0::Ssid;
+using ::android::hardware::wifi::offload::V1_0::NetworkInfo;
using ::android::hardware::wifi::offload::V1_0::ScanFilter;
using ::android::hardware::wifi::offload::V1_0::ScanStats;
using ::android::hardware::wifi::offload::V1_0::OffloadStatus;
@@ -45,7 +47,8 @@
constexpr char kOffloadCallbackSendError[] = "onError";
namespace {
-const uint8_t kSsid[] = {'G', 'o', 'o', 'g', 'l', 'e'};
+const uint8_t kSsid1[] = {'G', 'o', 'o', 'g', 'l', 'e'};
+const uint8_t kSsid2[] = {'X', 'f', 'i', 'n', 'i', 't', 'y'};
const uint8_t kBssid[6] = {0x12, 0xef, 0xa1, 0x2c, 0x97, 0x8b};
const int16_t kRssi = -60;
const uint32_t kFrequency = 2412;
@@ -53,6 +56,10 @@
const uint64_t kTsf = 0;
const uint16_t kCapability = 0;
const uint8_t kNetworkFlags = 0;
+const uint32_t kFrequency1 = 2412;
+const uint32_t kFrequency2 = 2437;
+const uint32_t kDisconnectedModeScanIntervalMs = 5000;
+const int16_t kRssiThreshold = -76;
}
class OffloadCallbackArgs {
@@ -133,7 +140,28 @@
*/
TEST_F(WifiOffloadHidlTest, configureScans) {
ScanParam* pScanParam = new ScanParam();
+ std::vector<uint32_t> frequencyList = {kFrequency1, kFrequency2};
+ pScanParam->disconnectedModeScanIntervalMs =
+ kDisconnectedModeScanIntervalMs;
+ pScanParam->frequencyList = frequencyList;
+ std::vector<Ssid> ssidList;
+ std::vector<std::vector<uint8_t>> ssids{kSsid1, kSsid2};
+ for (const auto& ssid : ssids) {
+ Ssid tmp = ssid;
+ ssidList.push_back(tmp);
+ }
+ pScanParam->ssidList = ssidList;
ScanFilter* pScanFilter = new ScanFilter();
+ pScanFilter->rssiThreshold = kRssiThreshold;
+ std::vector<std::vector<uint8_t>> match_ssids{kSsid1, kSsid2};
+ std::vector<uint8_t> security_flags{kNetworkFlags, kNetworkFlags};
+ std::vector<NetworkInfo> preferredNetworksList;
+ for (size_t i = 0; i < security_flags.size(); i++) {
+ NetworkInfo nwInfo;
+ nwInfo.ssid = match_ssids[i];
+ nwInfo.flags = security_flags[i];
+ preferredNetworksList.push_back(nwInfo);
+ }
const auto& result =
HIDL_INVOKE(wifi_offload_, configureScans, *pScanParam, *pScanFilter);
ASSERT_EQ(OffloadStatusCode::OK, result.code);
@@ -154,7 +182,7 @@
TEST_F(WifiOffloadHidlTest, getScanResults) {
wifi_offload_->setEventCallback(wifi_offload_cb_);
std::vector<ScanResult> scan_results;
- std::vector<uint8_t> ssid(kSsid, kSsid + sizeof(kSsid));
+ std::vector<uint8_t> ssid(kSsid1, kSsid1 + sizeof(kSsid1));
ScanResult scan_result;
scan_result.tsf = kTsf;
scan_result.rssi = kRssi;