Merge "Y16 format enablement for external provider"
diff --git a/atrace/1.0/Android.bp b/atrace/1.0/Android.bp
index f7c9078..4d73cfd 100644
--- a/atrace/1.0/Android.bp
+++ b/atrace/1.0/Android.bp
@@ -13,10 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Status",
- "TracingCategory",
- ],
gen_java: true,
}
diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp
index d6e481f..3495b1a 100644
--- a/audio/2.0/Android.bp
+++ b/audio/2.0/Android.bp
@@ -21,16 +21,6 @@
"android.hardware.audio.effect@2.0",
"android.hidl.base@1.0",
],
- types: [
- "AudioDrain",
- "DeviceAddress",
- "MessageQueueFlagBits",
- "MmapBufferInfo",
- "MmapPosition",
- "ParameterValue",
- "Result",
- "TimeSpec",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/4.0/Android.bp b/audio/4.0/Android.bp
index 6e217d9..b97fe01 100644
--- a/audio/4.0/Android.bp
+++ b/audio/4.0/Android.bp
@@ -21,27 +21,6 @@
"android.hardware.audio.effect@4.0",
"android.hidl.base@1.0",
],
- types: [
- "AudioDrain",
- "AudioFrequencyResponsePoint",
- "AudioMicrophoneChannelMapping",
- "AudioMicrophoneCoordinate",
- "AudioMicrophoneDirectionality",
- "AudioMicrophoneLocation",
- "DeviceAddress",
- "MessageQueueFlagBits",
- "MicrophoneInfo",
- "MmapBufferFlag",
- "MmapBufferInfo",
- "MmapPosition",
- "ParameterValue",
- "PlaybackTrackMetadata",
- "RecordTrackMetadata",
- "Result",
- "SinkMetadata",
- "SourceMetadata",
- "TimeSpec",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/5.0/Android.bp b/audio/5.0/Android.bp
index 7c2db1d..f6ac2eb 100644
--- a/audio/5.0/Android.bp
+++ b/audio/5.0/Android.bp
@@ -22,23 +22,6 @@
"android.hidl.base@1.0",
"android.hidl.safe_union@1.0",
],
- types: [
- "AudioDrain",
- "AudioFrequencyResponsePoint",
- "AudioMicrophoneChannelMapping",
- "AudioMicrophoneCoordinate",
- "AudioMicrophoneDirectionality",
- "AudioMicrophoneLocation",
- "MessageQueueFlagBits",
- "MicrophoneDirection",
- "MicrophoneInfo",
- "MmapBufferFlag",
- "MmapBufferInfo",
- "MmapPosition",
- "ParameterValue",
- "Result",
- "TimeSpec",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/common/2.0/Android.bp b/audio/common/2.0/Android.bp
index 878b594..a64548f 100644
--- a/audio/common/2.0/Android.bp
+++ b/audio/common/2.0/Android.bp
@@ -9,39 +9,6 @@
srcs: [
"types.hal",
],
- types: [
- "AudioChannelMask",
- "AudioConfig",
- "AudioDevice",
- "AudioFormat",
- "AudioGain",
- "AudioGainConfig",
- "AudioGainMode",
- "AudioHandleConsts",
- "AudioInputFlag",
- "AudioInterleave",
- "AudioMixLatencyClass",
- "AudioMode",
- "AudioOffloadInfo",
- "AudioOutputFlag",
- "AudioPort",
- "AudioPortConfig",
- "AudioPortConfigDeviceExt",
- "AudioPortConfigMask",
- "AudioPortConfigSessionExt",
- "AudioPortDeviceExt",
- "AudioPortMixExt",
- "AudioPortRole",
- "AudioPortSessionExt",
- "AudioPortType",
- "AudioSessionConsts",
- "AudioSource",
- "AudioStreamType",
- "AudioUsage",
- "FixedChannelCount",
- "ThreadInfo",
- "Uuid",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/common/4.0/Android.bp b/audio/common/4.0/Android.bp
index 9b737dc..cd504e5 100644
--- a/audio/common/4.0/Android.bp
+++ b/audio/common/4.0/Android.bp
@@ -9,39 +9,6 @@
srcs: [
"types.hal",
],
- types: [
- "AudioChannelMask",
- "AudioConfig",
- "AudioContentType",
- "AudioDevice",
- "AudioFormat",
- "AudioGain",
- "AudioGainConfig",
- "AudioGainMode",
- "AudioHandleConsts",
- "AudioInputFlag",
- "AudioMixLatencyClass",
- "AudioMode",
- "AudioOffloadInfo",
- "AudioOutputFlag",
- "AudioPort",
- "AudioPortConfig",
- "AudioPortConfigDeviceExt",
- "AudioPortConfigMask",
- "AudioPortConfigSessionExt",
- "AudioPortDeviceExt",
- "AudioPortMixExt",
- "AudioPortRole",
- "AudioPortSessionExt",
- "AudioPortType",
- "AudioSessionConsts",
- "AudioSource",
- "AudioStreamType",
- "AudioUsage",
- "FixedChannelCount",
- "ThreadInfo",
- "Uuid",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/common/5.0/Android.bp b/audio/common/5.0/Android.bp
index 86d9354..66c6fe8 100644
--- a/audio/common/5.0/Android.bp
+++ b/audio/common/5.0/Android.bp
@@ -12,44 +12,6 @@
interfaces: [
"android.hidl.safe_union@1.0",
],
- types: [
- "AudioChannelMask",
- "AudioConfig",
- "AudioContentType",
- "AudioDevice",
- "AudioFormat",
- "AudioGain",
- "AudioGainConfig",
- "AudioGainMode",
- "AudioHandleConsts",
- "AudioInputFlag",
- "AudioMixLatencyClass",
- "AudioMode",
- "AudioOffloadInfo",
- "AudioOutputFlag",
- "AudioPort",
- "AudioPortConfig",
- "AudioPortConfigDeviceExt",
- "AudioPortConfigMask",
- "AudioPortConfigSessionExt",
- "AudioPortDeviceExt",
- "AudioPortMixExt",
- "AudioPortRole",
- "AudioPortSessionExt",
- "AudioPortType",
- "AudioSessionConsts",
- "AudioSource",
- "AudioStreamType",
- "AudioUsage",
- "DeviceAddress",
- "FixedChannelCount",
- "PlaybackTrackMetadata",
- "RecordTrackMetadata",
- "SinkMetadata",
- "SourceMetadata",
- "ThreadInfo",
- "Uuid",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp
index c4f8b06..2dd1a0c 100644
--- a/audio/effect/2.0/Android.bp
+++ b/audio/effect/2.0/Android.bp
@@ -27,20 +27,6 @@
"android.hardware.audio.common@2.0",
"android.hidl.base@1.0",
],
- types: [
- "AudioBuffer",
- "EffectAuxChannelsConfig",
- "EffectBufferAccess",
- "EffectBufferConfig",
- "EffectConfig",
- "EffectConfigParameters",
- "EffectDescriptor",
- "EffectFeature",
- "EffectFlags",
- "EffectOffloadParameter",
- "MessageQueueFlagBits",
- "Result",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/effect/4.0/Android.bp b/audio/effect/4.0/Android.bp
index e7676a9..2c32bcb 100644
--- a/audio/effect/4.0/Android.bp
+++ b/audio/effect/4.0/Android.bp
@@ -27,20 +27,6 @@
"android.hardware.audio.common@4.0",
"android.hidl.base@1.0",
],
- types: [
- "AudioBuffer",
- "EffectAuxChannelsConfig",
- "EffectBufferAccess",
- "EffectBufferConfig",
- "EffectConfig",
- "EffectConfigParameters",
- "EffectDescriptor",
- "EffectFeature",
- "EffectFlags",
- "EffectOffloadParameter",
- "MessageQueueFlagBits",
- "Result",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/audio/effect/5.0/Android.bp b/audio/effect/5.0/Android.bp
index 78b950e..32fe652 100644
--- a/audio/effect/5.0/Android.bp
+++ b/audio/effect/5.0/Android.bp
@@ -28,20 +28,6 @@
"android.hidl.base@1.0",
"android.hidl.safe_union@1.0",
],
- types: [
- "AudioBuffer",
- "EffectAuxChannelsConfig",
- "EffectBufferAccess",
- "EffectBufferConfig",
- "EffectConfig",
- "EffectConfigParameters",
- "EffectDescriptor",
- "EffectFeature",
- "EffectFlags",
- "EffectOffloadParameter",
- "MessageQueueFlagBits",
- "Result",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/automotive/audiocontrol/1.0/Android.bp b/automotive/audiocontrol/1.0/Android.bp
index 9335a6c..7c51cf7 100644
--- a/automotive/audiocontrol/1.0/Android.bp
+++ b/automotive/audiocontrol/1.0/Android.bp
@@ -13,9 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "ContextNumber",
- ],
gen_java: true,
}
diff --git a/automotive/evs/1.0/Android.bp b/automotive/evs/1.0/Android.bp
index f620eb5..3ac67ea 100644
--- a/automotive/evs/1.0/Android.bp
+++ b/automotive/evs/1.0/Android.bp
@@ -16,13 +16,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "BufferDesc",
- "CameraDesc",
- "DisplayDesc",
- "DisplayState",
- "EvsResult",
- ],
gen_java: true,
}
diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp
index 6af774e..4163879 100644
--- a/automotive/vehicle/2.0/Android.bp
+++ b/automotive/vehicle/2.0/Android.bp
@@ -14,62 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "DiagnosticFloatSensorIndex",
- "DiagnosticIntegerSensorIndex",
- "EvConnectorType",
- "FuelType",
- "Obd2CommonIgnitionMonitors",
- "Obd2CompressionIgnitionMonitors",
- "Obd2FuelSystemStatus",
- "Obd2FuelType",
- "Obd2IgnitionMonitorKind",
- "Obd2SecondaryAirStatus",
- "Obd2SparkIgnitionMonitors",
- "PortLocationType",
- "StatusCode",
- "SubscribeFlags",
- "SubscribeOptions",
- "VehicleApPowerBootupReason",
- "VehicleApPowerStateConfigFlag",
- "VehicleApPowerStateReport",
- "VehicleApPowerStateReq",
- "VehicleApPowerStateReqIndex",
- "VehicleApPowerStateShutdownParam",
- "VehicleArea",
- "VehicleAreaConfig",
- "VehicleAreaDoor",
- "VehicleAreaMirror",
- "VehicleAreaSeat",
- "VehicleAreaWheel",
- "VehicleAreaWindow",
- "VehicleDisplay",
- "VehicleGear",
- "VehicleHvacFanDirection",
- "VehicleHwKeyInputAction",
- "VehicleIgnitionState",
- "VehicleLightState",
- "VehicleLightSwitch",
- "VehicleOilLevel",
- "VehiclePropConfig",
- "VehiclePropValue",
- "VehicleProperty",
- "VehiclePropertyAccess",
- "VehiclePropertyChangeMode",
- "VehiclePropertyGroup",
- "VehiclePropertyStatus",
- "VehiclePropertyType",
- "VehicleTurnSignal",
- "VehicleUnit",
- "VmsAvailabilityStateIntegerValuesIndex",
- "VmsBaseMessageIntegerValuesIndex",
- "VmsMessageType",
- "VmsMessageWithLayerAndPublisherIdIntegerValuesIndex",
- "VmsMessageWithLayerIntegerValuesIndex",
- "VmsOfferingMessageIntegerValuesIndex",
- "VmsPublisherInformationIntegerValuesIndex",
- "VmsSubscriptionsStateIntegerValuesIndex",
- ],
gen_java: true,
}
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 57179df..69b7628 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -2215,7 +2215,7 @@
ERROR = 4,
};
-enum VehicleApPowerStateConfigFlag : int32_t /* NOTE: type is guessed */ {
+enum VehicleApPowerStateConfigFlag : int32_t {
/**
* AP can enter deep sleep state. If not set, AP will always shutdown from
* VehicleApPowerState#SHUTDOWN_PREPARE power state.
diff --git a/biometrics/fingerprint/2.1/Android.bp b/biometrics/fingerprint/2.1/Android.bp
index dbcce92..cff43c4 100644
--- a/biometrics/fingerprint/2.1/Android.bp
+++ b/biometrics/fingerprint/2.1/Android.bp
@@ -14,17 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "FingerprintAcquired",
- "FingerprintAcquiredInfo",
- "FingerprintAuthenticated",
- "FingerprintEnroll",
- "FingerprintError",
- "FingerprintFingerId",
- "FingerprintIterator",
- "FingerprintMsgType",
- "RequestStatus",
- ],
gen_java: true,
}
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp
index 49df8a3..67f1a4f 100644
--- a/bluetooth/1.0/Android.bp
+++ b/bluetooth/1.0/Android.bp
@@ -14,9 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Status",
- ],
gen_java: true,
}
diff --git a/bluetooth/a2dp/1.0/Android.bp b/bluetooth/a2dp/1.0/Android.bp
index 5e85290..fa46a1c 100644
--- a/bluetooth/a2dp/1.0/Android.bp
+++ b/bluetooth/a2dp/1.0/Android.bp
@@ -14,14 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "BitsPerSample",
- "ChannelMode",
- "CodecConfiguration",
- "CodecType",
- "SampleRate",
- "Status",
- ],
gen_java: false,
}
diff --git a/bluetooth/audio/2.0/Android.bp b/bluetooth/audio/2.0/Android.bp
index e72b6ab..a020f22 100644
--- a/bluetooth/audio/2.0/Android.bp
+++ b/bluetooth/audio/2.0/Android.bp
@@ -17,32 +17,6 @@
"android.hidl.base@1.0",
"android.hidl.safe_union@1.0",
],
- types: [
- "AacObjectType",
- "AacParameters",
- "AacVariableBitRate",
- "AptxParameters",
- "AudioCapabilities",
- "AudioConfiguration",
- "BitsPerSample",
- "ChannelMode",
- "CodecCapabilities",
- "CodecConfiguration",
- "CodecType",
- "LdacChannelMode",
- "LdacParameters",
- "LdacQualityIndex",
- "PcmParameters",
- "SampleRate",
- "SbcAllocMethod",
- "SbcBlockLength",
- "SbcChannelMode",
- "SbcNumSubbands",
- "SbcParameters",
- "SessionType",
- "Status",
- "TimeSpec",
- ],
gen_java: false,
}
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
index 85c3b61..b580cac 100644
--- a/boot/1.0/Android.bp
+++ b/boot/1.0/Android.bp
@@ -13,10 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "BoolResult",
- "CommandResult",
- ],
gen_java: true,
}
diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp
index ecfecc4..76e580e 100644
--- a/broadcastradio/1.0/Android.bp
+++ b/broadcastradio/1.0/Android.bp
@@ -16,23 +16,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "AmBandConfig",
- "Band",
- "BandConfig",
- "Class",
- "Deemphasis",
- "Direction",
- "FmBandConfig",
- "MetaData",
- "MetaDataClock",
- "MetadataKey",
- "MetadataType",
- "ProgramInfo",
- "Properties",
- "Rds",
- "Result",
- ],
gen_java: false,
}
diff --git a/broadcastradio/1.1/Android.bp b/broadcastradio/1.1/Android.bp
index 1d59105..2186b9a 100644
--- a/broadcastradio/1.1/Android.bp
+++ b/broadcastradio/1.1/Android.bp
@@ -17,18 +17,6 @@
"android.hardware.broadcastradio@1.0",
"android.hidl.base@1.0",
],
- types: [
- "IdentifierType",
- "Modulation",
- "ProgramIdentifier",
- "ProgramInfo",
- "ProgramInfoFlags",
- "ProgramListResult",
- "ProgramSelector",
- "ProgramType",
- "Properties",
- "VendorKeyValue",
- ],
gen_java: false,
}
diff --git a/broadcastradio/2.0/Android.bp b/broadcastradio/2.0/Android.bp
index 2434fdc..93afc02 100644
--- a/broadcastradio/2.0/Android.bp
+++ b/broadcastradio/2.0/Android.bp
@@ -17,29 +17,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "AmFmBandRange",
- "AmFmRegionConfig",
- "Announcement",
- "AnnouncementType",
- "ConfigFlag",
- "Constants",
- "DabTableEntry",
- "Deemphasis",
- "IdentifierType",
- "Metadata",
- "MetadataKey",
- "ProgramFilter",
- "ProgramIdentifier",
- "ProgramInfo",
- "ProgramInfoFlags",
- "ProgramListChunk",
- "ProgramSelector",
- "Properties",
- "Rds",
- "Result",
- "VendorKeyValue",
- ],
gen_java: true,
}
diff --git a/camera/common/1.0/Android.bp b/camera/common/1.0/Android.bp
index c42e054..fe29774 100644
--- a/camera/common/1.0/Android.bp
+++ b/camera/common/1.0/Android.bp
@@ -9,17 +9,6 @@
srcs: [
"types.hal",
],
- types: [
- "CameraDeviceStatus",
- "CameraMetadataType",
- "CameraResourceCost",
- "Status",
- "TagBoundaryId",
- "TorchMode",
- "TorchModeStatus",
- "VendorTag",
- "VendorTagSection",
- ],
gen_java: true,
}
diff --git a/camera/device/1.0/Android.bp b/camera/device/1.0/Android.bp
index b08f873..a8df1ec 100644
--- a/camera/device/1.0/Android.bp
+++ b/camera/device/1.0/Android.bp
@@ -17,18 +17,6 @@
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
- types: [
- "CameraFace",
- "CameraFacing",
- "CameraFrameMetadata",
- "CameraInfo",
- "CommandType",
- "DataCallbackMsg",
- "FrameCallbackFlag",
- "HandleTimestampMessage",
- "NotifyCallbackMsg",
- "VideoFrameMessage",
- ],
gen_java: true,
}
diff --git a/camera/device/3.2/Android.bp b/camera/device/3.2/Android.bp
index a8a164e..e7546de 100644
--- a/camera/device/3.2/Android.bp
+++ b/camera/device/3.2/Android.bp
@@ -17,28 +17,6 @@
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
- types: [
- "BufferCache",
- "BufferStatus",
- "CameraBlob",
- "CameraBlobId",
- "CaptureRequest",
- "CaptureResult",
- "ErrorCode",
- "ErrorMsg",
- "HalStream",
- "HalStreamConfiguration",
- "MsgType",
- "NotifyMsg",
- "RequestTemplate",
- "ShutterMsg",
- "Stream",
- "StreamBuffer",
- "StreamConfiguration",
- "StreamConfigurationMode",
- "StreamRotation",
- "StreamType",
- ],
gen_java: false,
}
diff --git a/camera/device/3.3/Android.bp b/camera/device/3.3/Android.bp
index f006f79..e21824f 100644
--- a/camera/device/3.3/Android.bp
+++ b/camera/device/3.3/Android.bp
@@ -16,10 +16,6 @@
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
- types: [
- "HalStream",
- "HalStreamConfiguration",
- ],
gen_java: false,
}
diff --git a/camera/device/3.4/Android.bp b/camera/device/3.4/Android.bp
index 2c649ba..6a2eac5 100644
--- a/camera/device/3.4/Android.bp
+++ b/camera/device/3.4/Android.bp
@@ -18,16 +18,6 @@
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
- types: [
- "CaptureRequest",
- "CaptureResult",
- "HalStream",
- "HalStreamConfiguration",
- "PhysicalCameraMetadata",
- "PhysicalCameraSetting",
- "Stream",
- "StreamConfiguration",
- ],
gen_java: false,
}
diff --git a/camera/metadata/3.2/Android.bp b/camera/metadata/3.2/Android.bp
index bce2c9b..3271d91 100644
--- a/camera/metadata/3.2/Android.bp
+++ b/camera/metadata/3.2/Android.bp
@@ -9,72 +9,6 @@
srcs: [
"types.hal",
],
- types: [
- "CameraMetadataEnumAndroidBlackLevelLock",
- "CameraMetadataEnumAndroidColorCorrectionAberrationMode",
- "CameraMetadataEnumAndroidColorCorrectionMode",
- "CameraMetadataEnumAndroidControlAeAntibandingMode",
- "CameraMetadataEnumAndroidControlAeLock",
- "CameraMetadataEnumAndroidControlAeLockAvailable",
- "CameraMetadataEnumAndroidControlAeMode",
- "CameraMetadataEnumAndroidControlAePrecaptureTrigger",
- "CameraMetadataEnumAndroidControlAeState",
- "CameraMetadataEnumAndroidControlAfMode",
- "CameraMetadataEnumAndroidControlAfState",
- "CameraMetadataEnumAndroidControlAfTrigger",
- "CameraMetadataEnumAndroidControlAwbLock",
- "CameraMetadataEnumAndroidControlAwbLockAvailable",
- "CameraMetadataEnumAndroidControlAwbMode",
- "CameraMetadataEnumAndroidControlAwbState",
- "CameraMetadataEnumAndroidControlCaptureIntent",
- "CameraMetadataEnumAndroidControlEffectMode",
- "CameraMetadataEnumAndroidControlEnableZsl",
- "CameraMetadataEnumAndroidControlMode",
- "CameraMetadataEnumAndroidControlSceneMode",
- "CameraMetadataEnumAndroidControlVideoStabilizationMode",
- "CameraMetadataEnumAndroidDemosaicMode",
- "CameraMetadataEnumAndroidDepthAvailableDepthStreamConfigurations",
- "CameraMetadataEnumAndroidDepthDepthIsExclusive",
- "CameraMetadataEnumAndroidEdgeMode",
- "CameraMetadataEnumAndroidFlashInfoAvailable",
- "CameraMetadataEnumAndroidFlashMode",
- "CameraMetadataEnumAndroidFlashState",
- "CameraMetadataEnumAndroidHotPixelMode",
- "CameraMetadataEnumAndroidInfoSupportedHardwareLevel",
- "CameraMetadataEnumAndroidLedAvailableLeds",
- "CameraMetadataEnumAndroidLedTransmit",
- "CameraMetadataEnumAndroidLensFacing",
- "CameraMetadataEnumAndroidLensInfoFocusDistanceCalibration",
- "CameraMetadataEnumAndroidLensOpticalStabilizationMode",
- "CameraMetadataEnumAndroidLensState",
- "CameraMetadataEnumAndroidNoiseReductionMode",
- "CameraMetadataEnumAndroidQuirksPartialResult",
- "CameraMetadataEnumAndroidRequestAvailableCapabilities",
- "CameraMetadataEnumAndroidRequestMetadataMode",
- "CameraMetadataEnumAndroidRequestType",
- "CameraMetadataEnumAndroidScalerAvailableFormats",
- "CameraMetadataEnumAndroidScalerAvailableStreamConfigurations",
- "CameraMetadataEnumAndroidScalerCroppingType",
- "CameraMetadataEnumAndroidSensorInfoColorFilterArrangement",
- "CameraMetadataEnumAndroidSensorInfoLensShadingApplied",
- "CameraMetadataEnumAndroidSensorInfoTimestampSource",
- "CameraMetadataEnumAndroidSensorReferenceIlluminant1",
- "CameraMetadataEnumAndroidSensorTestPatternMode",
- "CameraMetadataEnumAndroidShadingMode",
- "CameraMetadataEnumAndroidStatisticsFaceDetectMode",
- "CameraMetadataEnumAndroidStatisticsHistogramMode",
- "CameraMetadataEnumAndroidStatisticsHotPixelMapMode",
- "CameraMetadataEnumAndroidStatisticsLensShadingMapMode",
- "CameraMetadataEnumAndroidStatisticsSceneFlicker",
- "CameraMetadataEnumAndroidStatisticsSharpnessMapMode",
- "CameraMetadataEnumAndroidSyncFrameNumber",
- "CameraMetadataEnumAndroidSyncMaxLatency",
- "CameraMetadataEnumAndroidTonemapMode",
- "CameraMetadataEnumAndroidTonemapPresetCurve",
- "CameraMetadataSection",
- "CameraMetadataSectionStart",
- "CameraMetadataTag",
- ],
gen_java: true,
}
diff --git a/camera/metadata/3.3/Android.bp b/camera/metadata/3.3/Android.bp
index ad6f141..4dddfad 100644
--- a/camera/metadata/3.3/Android.bp
+++ b/camera/metadata/3.3/Android.bp
@@ -12,20 +12,6 @@
interfaces: [
"android.hardware.camera.metadata@3.2",
],
- types: [
- "CameraMetadataEnumAndroidControlAeMode",
- "CameraMetadataEnumAndroidControlAfSceneChange",
- "CameraMetadataEnumAndroidControlCaptureIntent",
- "CameraMetadataEnumAndroidDistortionCorrectionMode",
- "CameraMetadataEnumAndroidInfoSupportedHardwareLevel",
- "CameraMetadataEnumAndroidLensPoseReference",
- "CameraMetadataEnumAndroidLogicalMultiCameraSensorSyncType",
- "CameraMetadataEnumAndroidRequestAvailableCapabilities",
- "CameraMetadataEnumAndroidStatisticsOisDataMode",
- "CameraMetadataSection",
- "CameraMetadataSectionStart",
- "CameraMetadataTag",
- ],
gen_java: true,
}
diff --git a/camera/metadata/3.3/types.hal b/camera/metadata/3.3/types.hal
index 27d82b9..539ae68 100644
--- a/camera/metadata/3.3/types.hal
+++ b/camera/metadata/3.3/types.hal
@@ -22,7 +22,6 @@
package android.hardware.camera.metadata@3.3;
-/* Include definitions from all prior minor HAL metadata revisions */
import android.hardware.camera.metadata@3.2;
/**
diff --git a/cas/1.0/Android.bp b/cas/1.0/Android.bp
index 39b36be..8d8e946 100644
--- a/cas/1.0/Android.bp
+++ b/cas/1.0/Android.bp
@@ -16,10 +16,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "HidlCasPluginDescriptor",
- "Status",
- ],
gen_java: true,
}
diff --git a/cas/native/1.0/Android.bp b/cas/native/1.0/Android.bp
index 7587416..880eccd 100644
--- a/cas/native/1.0/Android.bp
+++ b/cas/native/1.0/Android.bp
@@ -14,13 +14,6 @@
"android.hardware.cas@1.0",
"android.hidl.base@1.0",
],
- types: [
- "BufferType",
- "DestinationBuffer",
- "ScramblingControl",
- "SharedBuffer",
- "SubSample",
- ],
gen_java: false,
}
diff --git a/configstore/1.0/Android.bp b/configstore/1.0/Android.bp
index 5e98e5c..a6fd656 100644
--- a/configstore/1.0/Android.bp
+++ b/configstore/1.0/Android.bp
@@ -13,14 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "OptionalBool",
- "OptionalInt32",
- "OptionalInt64",
- "OptionalString",
- "OptionalUInt32",
- "OptionalUInt64",
- ],
gen_java: true,
}
diff --git a/configstore/1.1/Android.bp b/configstore/1.1/Android.bp
index 2b6e6fa..3900d9b 100644
--- a/configstore/1.1/Android.bp
+++ b/configstore/1.1/Android.bp
@@ -14,10 +14,6 @@
"android.hardware.configstore@1.0",
"android.hidl.base@1.0",
],
- types: [
- "DisplayOrientation",
- "OptionalDisplayOrientation",
- ],
gen_java: true,
}
diff --git a/confirmationui/1.0/Android.bp b/confirmationui/1.0/Android.bp
index 21acecb..e6b0414 100644
--- a/confirmationui/1.0/Android.bp
+++ b/confirmationui/1.0/Android.bp
@@ -15,13 +15,6 @@
"android.hardware.keymaster@4.0",
"android.hidl.base@1.0",
],
- types: [
- "MessageSize",
- "ResponseCode",
- "TestKeyBits",
- "TestModeCommands",
- "UIOption",
- ],
gen_java: false,
}
diff --git a/contexthub/1.0/Android.bp b/contexthub/1.0/Android.bp
index 77dba66..730adcb 100644
--- a/contexthub/1.0/Android.bp
+++ b/contexthub/1.0/Android.bp
@@ -14,22 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "AsyncEventType",
- "ContextHub",
- "ContextHubMsg",
- "HostEndPoint",
- "HubAppInfo",
- "HubMemoryFlag",
- "HubMemoryType",
- "MemRange",
- "NanoAppBinary",
- "NanoAppFlags",
- "PhysicalSensor",
- "Result",
- "SensorType",
- "TransactionResult",
- ],
gen_java: true,
}
diff --git a/current.txt b/current.txt
index 9b76b8d..69996dd 100644
--- a/current.txt
+++ b/current.txt
@@ -390,14 +390,16 @@
684702a60deef03a1e8093961dc0a18c555c857ad5a77ba7340b0635ae01eb70 android.hardware.camera.device@3.4::ICameraDeviceSession
f8a19622cb0cc890913b1ef3e32b675ffb26089a09e02fef4056ebad324d2b5d android.hardware.camera.device@3.4::types
291638a1b6d4e63283e9e722ab5049d9351717ffa2b66162124f84d1aa7c2835 android.hardware.camera.metadata@3.2::types
-8a075cf3a17fe99c6d23415a3e9a65612f1fee73ee052a3a8a0ca5b8877395a4 android.hardware.camera.metadata@3.3::types
+f4aca082ad436f00b3bed8b9b9dfdc01f6460afdbee7ca10fedb5e34bddcc96f android.hardware.camera.metadata@3.3::types
da33234403ff5d60f3473711917b9948e6484a4260b5247acdafb111193a9de2 android.hardware.configstore@1.0::ISurfaceFlingerConfigs
21165b8e30c4b2d52980e4728f661420adc16e38bbe73476c06b2085be908f4c android.hardware.gnss@1.0::IGnssCallback
d702fb01dc2a0733aa820b7eb65435ee3334f75632ef880bafd2fb8803a20a58 android.hardware.gnss@1.0::IGnssMeasurementCallback
+7c7721c0f773fcf422b71a4f558545e9e36acc973e58ca51e5bd53905cf46bc0 android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer
+d4fea995378bb4f421b4e24ccf68cad2734ab07fe4f874a126ba558b99df5766 android.hardware.graphics.composer@2.1::IComposerClient
b7ecf29927055ec422ec44bf776223f07d79ad9f92ccf9becf167e62c2607e7a android.hardware.keymaster@4.0::IKeymasterDevice
574e8f1499436fb4075894dcae0b36682427956ecb114f17f1fe22d116a83c6b android.hardware.neuralnetworks@1.0::IPreparedModel
417ab60fe1ef786778047e4486f3d868ebce570d91addd8fe4251515213072de android.hardware.neuralnetworks@1.0::types
-e22e8135d061d0e9c4c1a70c25c19fdba10f4d3cda9795ef25b6392fc520317c android.hardware.neuralnetworks@1.1::types
+ec8aa14fe9b03f2b3fb9845346a4005b6d098ebe2277b2564f73a548a0fd14a7 android.hardware.neuralnetworks@1.1::types
1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse
ed9da80ec0c96991fd03f0a46107815d0e50f764656e49dba4980fa5c31d5bc3 android.hardware.radio@1.0::types
1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio
@@ -444,23 +446,23 @@
2b4a14661e6a38617b7dd0c6ebb66a56a90e564674ac7697a14cb8a0cab92b2f android.hardware.health.storage@1.0::types
4880af120fc1640225abdc2c60bda6d79617d73484d5124913c7278af3b11e2d android.hardware.neuralnetworks@1.2::IBurstCallback
19877e466ad8c6ed42b38050b77bd010cf7800ff365fdc8574f45bbfda03a758 android.hardware.neuralnetworks@1.2::IBurstContext
-96249c852dabeefa3a9496ecdfc44681a071c665bfbf88527bf775c88bf1ab1b android.hardware.neuralnetworks@1.2::IDevice
+b83317b66721241887d2770b5ae95fd5af1e77c5daa7530ecb08fae8892f2b43 android.hardware.neuralnetworks@1.2::IDevice
92714960d1a53fc2ec557302b41c7cc93d2636d8364a44bd0f85be0c92927ff8 android.hardware.neuralnetworks@1.2::IExecutionCallback
-83885d366f22ada42c00d8854f0b7e7ba4cf73ddf80bb0d8e168ce132cec57ea android.hardware.neuralnetworks@1.2::IPreparedModel
+36e1064c869965dee533c537cefbe87e54db8bd8cd45be7e0e93e00e8a43863a android.hardware.neuralnetworks@1.2::IPreparedModel
e1c734d1545e1a4ae749ff1dd9704a8e594c59aea7c8363159dc258e93e0df3b android.hardware.neuralnetworks@1.2::IPreparedModelCallback
-769f8650631eef7a3ceedc8cf130f4b99eb52fe698a11609d55de32985a3dddf android.hardware.neuralnetworks@1.2::types
+209a5ee694b94328afb2af2768f1fe6a69148e2cbb85ec3c340a36eed818c697 android.hardware.neuralnetworks@1.2::types
cf7a4ba516a638f9b82a249c91fb603042c2d9ca43fd5aad9cf6c0401ed2a5d7 android.hardware.nfc@1.2::INfc
abf98c2ae08bf765db54edc8068e36d52eb558cff6706b6fd7c18c65a1f3fc18 android.hardware.nfc@1.2::types
4cb252dc6372a874aef666b92a6e9529915aa187521a700f0789065c3c702ead android.hardware.power.stats@1.0::IPowerStats
2043037d5baaff604805757d06979aa861013a1e87430db745265339a8681f79 android.hardware.power.stats@1.0::types
-11620ce020b6ef8f5b63eb2a39390de4a2fbbccc0a5e558b5b1a0e22e33f63cf android.hardware.radio@1.3::IRadio
+a1c6b0761bcb89d6bf15a156f9306b8090b3a916a15fea1689b4b0c1738e382f android.hardware.radio@1.3::IRadio
e9d0f11a52715f5a29d89e2d8e2e21db1e16a43174af6b9d51a62d705cda1455 android.hardware.radio@1.3::IRadioIndication
d233f0da44f55fdef0a95db5229231412787bb67695cd1ea197ce89a3c2908b9 android.hardware.radio@1.3::IRadioResponse
750a363c8cec70baa1aac19e275c15233c5898e93c6bb5155fa2ca7f365490dc android.hardware.radio@1.3::types
-4ac73ec1e4cfa535209e5e22547f08beb20ef812b4a29d0824780f52cbe2324d android.hardware.radio@1.4::IRadio
+ef4ab741f7e7762fb45e2e24ca83871f72006ce05f57aa9addc574893dd29872 android.hardware.radio@1.4::IRadio
33d9e6895cca98aa56296bb01720d18b8acd0e4de4960beb712e63ad147438a5 android.hardware.radio@1.4::IRadioIndication
0cc0dd87c634aad36d7df22b2832839ef7ded71909dbcde11cfdd69dc0dc52b8 android.hardware.radio@1.4::IRadioResponse
-29d34232cc3974626b08759e039fe788bded7695cdeb098458e3e11e4c7d3603 android.hardware.radio@1.4::types
+22091ad1f6cb6da1c7c1467e6412c9c1ae577b3ecc0c3e5047fc4b50cdd60c69 android.hardware.radio@1.4::types
51e696c0ceff30f74da8ff8d02fe4522ffd2f4a04cdfdbca0c68bfa64fcd306b android.hardware.radio.config@1.1::IRadioConfig
7fcf167f593b10c67b59ab70321781c26a5575eab60803e7cbb1c14c71085a3b android.hardware.radio.config@1.1::IRadioConfigIndication
b42eb3bbd5e7b519e28362340c2205aa75356de6b30f4fd09ec2ea784f250ab0 android.hardware.radio.config@1.1::IRadioConfigResponse
diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp
index aca5ae4..fea851f 100644
--- a/drm/1.0/Android.bp
+++ b/drm/1.0/Android.bp
@@ -17,22 +17,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "BufferType",
- "DestinationBuffer",
- "EventType",
- "KeyRequestType",
- "KeyStatus",
- "KeyStatusType",
- "KeyType",
- "KeyValue",
- "Mode",
- "Pattern",
- "SecureStop",
- "SharedBuffer",
- "Status",
- "SubSample",
- ],
gen_java: false,
}
diff --git a/drm/1.1/Android.bp b/drm/1.1/Android.bp
index dba3e42..739b470 100644
--- a/drm/1.1/Android.bp
+++ b/drm/1.1/Android.bp
@@ -16,13 +16,6 @@
"android.hardware.drm@1.0",
"android.hidl.base@1.0",
],
- types: [
- "DrmMetricGroup",
- "HdcpLevel",
- "KeyRequestType",
- "SecureStopRelease",
- "SecurityLevel",
- ],
gen_java: false,
}
diff --git a/fastboot/1.0/Android.bp b/fastboot/1.0/Android.bp
index 467fc6d..ea3566f 100644
--- a/fastboot/1.0/Android.bp
+++ b/fastboot/1.0/Android.bp
@@ -13,11 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "FileSystemType",
- "Result",
- "Status",
- ],
gen_java: true,
}
diff --git a/fastboot/1.0/default/Android.bp b/fastboot/1.0/default/Android.bp
new file mode 100644
index 0000000..fde7efa
--- /dev/null
+++ b/fastboot/1.0/default/Android.bp
@@ -0,0 +1,31 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_library {
+ name: "android.hardware.fastboot@1.0-impl-mock",
+ recovery: true,
+ srcs: [
+ "Fastboot.cpp",
+ ],
+ relative_install_path: "hw",
+ shared_libs: [
+ "libbase",
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "libcutils",
+ "android.hardware.fastboot@1.0",
+ ],
+}
diff --git a/fastboot/1.0/default/Fastboot.cpp b/fastboot/1.0/default/Fastboot.cpp
new file mode 100644
index 0000000..a12233d
--- /dev/null
+++ b/fastboot/1.0/default/Fastboot.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Fastboot.h"
+
+namespace android {
+namespace hardware {
+namespace fastboot {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::fastboot::V1_0::IFastboot follow.
+Return<void> Fastboot::getPartitionType(const hidl_string& /* partitionName */,
+ getPartitionType_cb _hidl_cb) {
+ _hidl_cb(FileSystemType::RAW, {Status::SUCCESS, ""});
+ return Void();
+}
+
+Return<void> Fastboot::doOemCommand(const hidl_string& /* oemCmd */, doOemCommand_cb _hidl_cb) {
+ _hidl_cb({Status::FAILURE_UNKNOWN, "Command not supported in default implementation"});
+ return Void();
+}
+
+Return<void> Fastboot::getVariant(getVariant_cb _hidl_cb) {
+ _hidl_cb("NA", {Status::SUCCESS, ""});
+ return Void();
+}
+
+Return<void> Fastboot::getOffModeChargeState(getOffModeChargeState_cb _hidl_cb) {
+ _hidl_cb(false, {Status::SUCCESS, ""});
+ return Void();
+}
+
+Return<void> Fastboot::getBatteryVoltageFlashingThreshold(
+ getBatteryVoltageFlashingThreshold_cb _hidl_cb) {
+ _hidl_cb(0, {Status::SUCCESS, ""});
+ return Void();
+}
+
+extern "C" IFastboot* HIDL_FETCH_IFastboot(const char* /* name */) {
+ return new Fastboot();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace fastboot
+} // namespace hardware
+} // namespace android
diff --git a/fastboot/1.0/default/Fastboot.h b/fastboot/1.0/default/Fastboot.h
new file mode 100644
index 0000000..3127059
--- /dev/null
+++ b/fastboot/1.0/default/Fastboot.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <android/hardware/fastboot/1.0/IFastboot.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace fastboot {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::hidl_string;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct Fastboot : public IFastboot {
+ // Methods from ::android::hardware::fastboot::V1_0::IFastboot follow.
+ Return<void> getPartitionType(const hidl_string& partitionName,
+ getPartitionType_cb _hidl_cb) override;
+ Return<void> doOemCommand(const hidl_string& oemCmd, doOemCommand_cb _hidl_cb) override;
+ Return<void> getVariant(getVariant_cb _hidl_cb) override;
+ Return<void> getOffModeChargeState(getOffModeChargeState_cb _hidl_cb) override;
+ Return<void> getBatteryVoltageFlashingThreshold(
+ getBatteryVoltageFlashingThreshold_cb _hidl_cb) override;
+};
+
+extern "C" IFastboot* HIDL_FETCH_IFastboot(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace fastboot
+} // namespace hardware
+} // namespace android
diff --git a/gatekeeper/1.0/Android.bp b/gatekeeper/1.0/Android.bp
index 7dc2133..7eff2e8 100644
--- a/gatekeeper/1.0/Android.bp
+++ b/gatekeeper/1.0/Android.bp
@@ -13,10 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "GatekeeperResponse",
- "GatekeeperStatusCode",
- ],
gen_java: true,
}
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
index dc659a3..2e3e6fd 100644
--- a/gnss/1.0/Android.bp
+++ b/gnss/1.0/Android.bp
@@ -32,12 +32,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "GnssConstellationType",
- "GnssLocation",
- "GnssLocationFlags",
- "GnssMax",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal b/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
index c59a16c..21cbc2e 100644
--- a/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
+++ b/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
@@ -546,7 +546,7 @@
*/
disconnect(
int32_t api,
- DisconnectMode mode /* = DisconnectMode::API */
+ DisconnectMode mode
) generates (
Status status
);
diff --git a/graphics/common/1.0/Android.bp b/graphics/common/1.0/Android.bp
index f88cbdf..175166d 100644
--- a/graphics/common/1.0/Android.bp
+++ b/graphics/common/1.0/Android.bp
@@ -10,15 +10,6 @@
srcs: [
"types.hal",
],
- types: [
- "BufferUsage",
- "ColorMode",
- "ColorTransform",
- "Dataspace",
- "Hdr",
- "PixelFormat",
- "Transform",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/graphics/common/1.1/Android.bp b/graphics/common/1.1/Android.bp
index 8bc68f5..0647d12d 100644
--- a/graphics/common/1.1/Android.bp
+++ b/graphics/common/1.1/Android.bp
@@ -13,13 +13,6 @@
interfaces: [
"android.hardware.graphics.common@1.0",
],
- types: [
- "BufferUsage",
- "ColorMode",
- "Dataspace",
- "PixelFormat",
- "RenderIntent",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/graphics/composer/2.1/Android.bp b/graphics/composer/2.1/Android.bp
index 8fbc8c2..38786fd 100644
--- a/graphics/composer/2.1/Android.bp
+++ b/graphics/composer/2.1/Android.bp
@@ -16,9 +16,6 @@
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
- types: [
- "Error",
- ],
gen_java: false,
}
diff --git a/graphics/composer/2.1/IComposerClient.hal b/graphics/composer/2.1/IComposerClient.hal
index 5ad46f0..e036ce9 100644
--- a/graphics/composer/2.1/IComposerClient.hal
+++ b/graphics/composer/2.1/IComposerClient.hal
@@ -992,10 +992,10 @@
*
* setLayerDataspace(Dataspace dataspace);
*
- * Sets the dataspace that the current buffer on this layer is in.
+ * Sets the dataspace of the layer.
*
- * The dataspace provides more information about how to interpret the
- * buffer contents, such as the encoding standard and color transform.
+ * The dataspace provides more information about how to interpret the buffer
+ * or solid color, such as the encoding standard and color transform.
*
* See the values of Dataspace for more information.
*
diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp
index 2f9a344..96e812b 100644
--- a/graphics/mapper/2.0/Android.bp
+++ b/graphics/mapper/2.0/Android.bp
@@ -15,10 +15,6 @@
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
- types: [
- "Error",
- "YCbCrLayout",
- ],
gen_java: false,
}
diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp
index dcbaf58..e03b142 100644
--- a/health/1.0/Android.bp
+++ b/health/1.0/Android.bp
@@ -13,13 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "BatteryHealth",
- "BatteryStatus",
- "HealthConfig",
- "HealthInfo",
- "Result",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/health/2.0/Android.bp b/health/2.0/Android.bp
index 0325467..f472b27 100644
--- a/health/2.0/Android.bp
+++ b/health/2.0/Android.bp
@@ -15,13 +15,6 @@
"android.hardware.health@1.0",
"android.hidl.base@1.0",
],
- types: [
- "DiskStats",
- "HealthInfo",
- "Result",
- "StorageAttribute",
- "StorageInfo",
- ],
gen_java: true,
}
diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp
index 3544e5f..b090548 100644
--- a/health/2.0/vts/functional/Android.bp
+++ b/health/2.0/vts/functional/Android.bp
@@ -19,6 +19,7 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalHealthV2_0TargetTest.cpp"],
static_libs: [
+ "libgflags",
"android.hardware.health@1.0",
"android.hardware.health@2.0",
],
diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
index f895aec..74fe4fb 100644
--- a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
+++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp
@@ -17,11 +17,14 @@
#define LOG_TAG "health_hidl_hal_test"
#include <mutex>
+#include <set>
+#include <string>
#include <VtsHalHidlTargetTestBase.h>
#include <android-base/logging.h>
#include <android/hardware/health/2.0/IHealth.h>
#include <android/hardware/health/2.0/types.h>
+#include <gflags/gflags.h>
using ::testing::AssertionFailure;
using ::testing::AssertionResult;
@@ -29,6 +32,41 @@
using ::testing::VtsHalHidlTargetTestBase;
using ::testing::VtsHalHidlTargetTestEnvBase;
+DEFINE_bool(force, false, "Force test healthd even when the default instance is present.");
+
+// If GTEST_SKIP is not implemented, use our own skipping mechanism
+#ifndef GTEST_SKIP
+static std::mutex gSkippedTestsMutex;
+static std::set<std::string> gSkippedTests;
+static std::string GetCurrentTestName() {
+ const auto& info = ::testing::UnitTest::GetInstance()->current_test_info();
+#ifdef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
+ std::string test_suite = info->test_suite_name();
+#else
+ std::string test_suite = info->test_case_name();
+#endif
+ return test_suite + "." + info->name();
+}
+
+#define GTEST_SKIP() \
+ do { \
+ std::unique_lock<std::mutex> lock(gSkippedTestsMutex); \
+ gSkippedTests.insert(GetCurrentTestName()); \
+ return; \
+ } while (0)
+
+#define SKIP_IF_SKIPPED() \
+ do { \
+ std::unique_lock<std::mutex> lock(gSkippedTestsMutex); \
+ if (gSkippedTests.find(GetCurrentTestName()) != gSkippedTests.end()) { \
+ std::cerr << "[ SKIPPED ] " << GetCurrentTestName() << std::endl; \
+ return; \
+ } \
+ } while (0)
+#else
+#define SKIP_IF_SKIPPED()
+#endif
+
namespace android {
namespace hardware {
namespace health {
@@ -57,6 +95,14 @@
public:
virtual void SetUp() override {
std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName<IHealth>();
+
+ if (serviceName == "backup" && !FLAGS_force &&
+ ::testing::VtsHalHidlTargetTestBase::getService<IHealth>() != nullptr) {
+ LOG(INFO) << "Skipping tests on healthd because the default instance is present. "
+ << "Use --force if you really want to test healthd.";
+ GTEST_SKIP();
+ }
+
LOG(INFO) << "get service with name:" << serviceName;
ASSERT_FALSE(serviceName.empty());
mHealth = ::testing::VtsHalHidlTargetTestBase::getService<IHealth>(serviceName);
@@ -111,6 +157,7 @@
* unregisterCallback, and update.
*/
TEST_F(HealthHidlTest, Callbacks) {
+ SKIP_IF_SKIPPED();
using namespace std::chrono_literals;
sp<Callback> firstCallback = new Callback();
sp<Callback> secondCallback = new Callback();
@@ -147,6 +194,7 @@
}
TEST_F(HealthHidlTest, UnregisterNonExistentCallback) {
+ SKIP_IF_SKIPPED();
sp<Callback> callback = new Callback();
auto ret = mHealth->unregisterCallback(callback);
ASSERT_OK(ret);
@@ -225,6 +273,7 @@
* Tests the values returned by getChargeCounter() from interface IHealth.
*/
TEST_F(HealthHidlTest, getChargeCounter) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getChargeCounter([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value > 0);
}));
@@ -234,6 +283,7 @@
* Tests the values returned by getCurrentNow() from interface IHealth.
*/
TEST_F(HealthHidlTest, getCurrentNow) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getCurrentNow([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN);
}));
@@ -243,6 +293,7 @@
* Tests the values returned by getCurrentAverage() from interface IHealth.
*/
TEST_F(HealthHidlTest, getCurrentAverage) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getCurrentAverage([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN);
}));
@@ -252,6 +303,7 @@
* Tests the values returned by getCapacity() from interface IHealth.
*/
TEST_F(HealthHidlTest, getCapacity) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getCapacity([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), 0 <= value && value <= 100);
}));
@@ -261,6 +313,7 @@
* Tests the values returned by getEnergyCounter() from interface IHealth.
*/
TEST_F(HealthHidlTest, getEnergyCounter) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getEnergyCounter([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT64_MIN);
}));
@@ -270,6 +323,7 @@
* Tests the values returned by getChargeStatus() from interface IHealth.
*/
TEST_F(HealthHidlTest, getChargeStatus) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getChargeStatus([](auto result, auto value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(
result, toString(value),
@@ -281,6 +335,7 @@
* Tests the values returned by getStorageInfo() from interface IHealth.
*/
TEST_F(HealthHidlTest, getStorageInfo) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getStorageInfo([](auto result, auto& value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyStorageInfo(value));
}));
@@ -290,6 +345,7 @@
* Tests the values returned by getDiskStats() from interface IHealth.
*/
TEST_F(HealthHidlTest, getDiskStats) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getDiskStats([](auto result, auto& value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), true);
}));
@@ -299,6 +355,7 @@
* Tests the values returned by getHealthInfo() from interface IHealth.
*/
TEST_F(HealthHidlTest, getHealthInfo) {
+ SKIP_IF_SKIPPED();
EXPECT_OK(mHealth->getHealthInfo([](auto result, auto& value) {
EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyHealthInfo(value));
}));
@@ -314,6 +371,7 @@
::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
HealthHidlEnvironment::Instance()->init(&argc, argv);
+ gflags::ParseCommandLineFlags(&argc, &argv, true /* remove flags */);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/health/storage/1.0/Android.bp b/health/storage/1.0/Android.bp
index 35ee34f..45fa01f 100644
--- a/health/storage/1.0/Android.bp
+++ b/health/storage/1.0/Android.bp
@@ -14,9 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Result",
- ],
gen_java: true,
}
diff --git a/ir/1.0/Android.bp b/ir/1.0/Android.bp
index 272acb3..5f25172 100644
--- a/ir/1.0/Android.bp
+++ b/ir/1.0/Android.bp
@@ -13,9 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "ConsumerIrFreqRange",
- ],
gen_java: true,
}
diff --git a/keymaster/3.0/Android.bp b/keymaster/3.0/Android.bp
index e0f1b94..ca17a9b 100644
--- a/keymaster/3.0/Android.bp
+++ b/keymaster/3.0/Android.bp
@@ -13,26 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Algorithm",
- "BlockMode",
- "Digest",
- "EcCurve",
- "ErrorCode",
- "HardwareAuthToken",
- "HardwareAuthenticatorType",
- "KeyBlobUsageRequirements",
- "KeyCharacteristics",
- "KeyDerivationFunction",
- "KeyFormat",
- "KeyOrigin",
- "KeyParameter",
- "KeyPurpose",
- "PaddingMode",
- "SecurityLevel",
- "Tag",
- "TagType",
- ],
gen_java: false,
}
diff --git a/keymaster/4.0/Android.bp b/keymaster/4.0/Android.bp
index 2daad41..cd46fd9 100644
--- a/keymaster/4.0/Android.bp
+++ b/keymaster/4.0/Android.bp
@@ -14,29 +14,6 @@
"android.hardware.keymaster@3.0",
"android.hidl.base@1.0",
],
- types: [
- "Algorithm",
- "BlockMode",
- "Constants",
- "Digest",
- "EcCurve",
- "ErrorCode",
- "HardwareAuthToken",
- "HardwareAuthenticatorType",
- "HmacSharingParameters",
- "KeyBlobUsageRequirements",
- "KeyCharacteristics",
- "KeyDerivationFunction",
- "KeyFormat",
- "KeyOrigin",
- "KeyParameter",
- "KeyPurpose",
- "PaddingMode",
- "SecurityLevel",
- "Tag",
- "TagType",
- "VerificationToken",
- ],
gen_java: false,
}
diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp
index ee58f93..6068752 100644
--- a/light/2.0/Android.bp
+++ b/light/2.0/Android.bp
@@ -13,13 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Brightness",
- "Flash",
- "LightState",
- "Status",
- "Type",
- ],
gen_java: true,
}
diff --git a/media/1.0/Android.bp b/media/1.0/Android.bp
index 45fedb9..844cfa2 100644
--- a/media/1.0/Android.bp
+++ b/media/1.0/Android.bp
@@ -12,11 +12,6 @@
interfaces: [
"android.hardware.graphics.common@1.0",
],
- types: [
- "AnwBuffer",
- "AnwBufferAttributes",
- "Rect",
- ],
gen_java: true,
}
diff --git a/media/bufferpool/1.0/Android.bp b/media/bufferpool/1.0/Android.bp
index 986da8a..86297d3 100644
--- a/media/bufferpool/1.0/Android.bp
+++ b/media/bufferpool/1.0/Android.bp
@@ -15,12 +15,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Buffer",
- "BufferStatus",
- "BufferStatusMessage",
- "ResultStatus",
- ],
gen_java: false,
}
diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp
index 89709bd..ee51d5d 100644
--- a/media/omx/1.0/Android.bp
+++ b/media/omx/1.0/Android.bp
@@ -21,13 +21,6 @@
"android.hardware.media@1.0",
"android.hidl.base@1.0",
],
- types: [
- "CodecBuffer",
- "ColorAspects",
- "Message",
- "PortMode",
- "Status",
- ],
gen_java: false,
}
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
index d56aa64..0f24977 100644
--- a/memtrack/1.0/Android.bp
+++ b/memtrack/1.0/Android.bp
@@ -13,12 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "MemtrackFlag",
- "MemtrackRecord",
- "MemtrackStatus",
- "MemtrackType",
- ],
gen_java: true,
}
diff --git a/neuralnetworks/1.0/Android.bp b/neuralnetworks/1.0/Android.bp
index e8600d3..63b5b98 100644
--- a/neuralnetworks/1.0/Android.bp
+++ b/neuralnetworks/1.0/Android.bp
@@ -16,22 +16,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Capabilities",
- "DataLocation",
- "DeviceStatus",
- "ErrorStatus",
- "FusedActivationFunc",
- "Model",
- "Operand",
- "OperandLifeTime",
- "OperandType",
- "Operation",
- "OperationType",
- "PerformanceInfo",
- "Request",
- "RequestArgument",
- ],
gen_java: false,
}
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
index 7eea7fc..106f332 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
@@ -52,6 +52,7 @@
using ::test_helper::MixedTyped;
using ::test_helper::MixedTypedExample;
using ::test_helper::resize_accordingly;
+using HidlToken = hidl_array<uint8_t, static_cast<uint32_t>(Constant::BYTE_SIZE_OF_CACHE_TOKEN)>;
template <typename T>
void copy_back_(std::map<int, std::vector<T>>* dst, const std::vector<RequestArgument>& ra,
@@ -77,6 +78,13 @@
"Number of types in MixedTyped changed, but copy_back function wasn't updated");
}
+static bool isZeroSized(const MixedTyped& example, uint32_t index) {
+ for (auto i : example.operandDimensions.at(index)) {
+ if (i == 0) return true;
+ }
+ return false;
+}
+
// Top level driver for models and examples generated by test_generator.py
// Test driver for those generated from ml/nn/runtime/test/spec
static Return<ErrorStatus> ExecutePreparedModel(sp<V1_0::IPreparedModel>& preparedModel,
@@ -178,17 +186,18 @@
// Go through all outputs, initialize RequestArgument descriptors
resize_accordingly(golden, test);
bool sizeLargerThanOne = true;
- for_all(golden, [&outputs_info, &outputSize, &outputType, &sizeLargerThanOne](
+ for_all(golden, [&golden, &outputs_info, &outputSize, &outputType, &sizeLargerThanOne](
int index, auto, auto s) {
if (outputs_info.size() <= static_cast<size_t>(index)) outputs_info.resize(index + 1);
if (index == 0) {
// On OutputType::INSUFFICIENT, set the output operand with index 0 with
// buffer size one byte less than needed.
if (outputType == OutputType::INSUFFICIENT) {
- if (s > 1)
+ if (s > 1 && !isZeroSized(golden, index)) {
s -= 1;
- else
+ } else {
sizeLargerThanOne = false;
+ }
}
}
RequestArgument arg = {
@@ -532,7 +541,8 @@
sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
ASSERT_NE(nullptr, preparedModelCallback.get());
Return<ErrorStatus> prepareLaunchStatus = device->prepareModel_1_2(
- model, ExecutionPreference::FAST_SINGLE_ANSWER, preparedModelCallback);
+ model, ExecutionPreference::FAST_SINGLE_ANSWER, hidl_vec<hidl_handle>(),
+ hidl_vec<hidl_handle>(), HidlToken(), preparedModelCallback);
ASSERT_TRUE(prepareLaunchStatus.isOk());
ASSERT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(prepareLaunchStatus));
diff --git a/neuralnetworks/1.1/Android.bp b/neuralnetworks/1.1/Android.bp
index 24d8396..1158a90 100644
--- a/neuralnetworks/1.1/Android.bp
+++ b/neuralnetworks/1.1/Android.bp
@@ -14,13 +14,6 @@
"android.hardware.neuralnetworks@1.0",
"android.hidl.base@1.0",
],
- types: [
- "Capabilities",
- "ExecutionPreference",
- "Model",
- "Operation",
- "OperationType",
- ],
gen_java: false,
}
diff --git a/neuralnetworks/1.1/types.hal b/neuralnetworks/1.1/types.hal
index c9de76b..99f873a 100644
--- a/neuralnetworks/1.1/types.hal
+++ b/neuralnetworks/1.1/types.hal
@@ -186,7 +186,8 @@
* must be >= 1.
* * 2: A 2-D Tensor of {@link OperandType::TENSOR_INT32}, the paddings
* for each spatial dimension of the input tensor. All values must be
- * >= 0. The shape of the tensor must be {rank(input0), 2}.
+ * >= 0. The shape of the tensor must be {M, 2}, where M is the number
+ * of spatial dimensions.
* padding[i, 0] specifies the number of element to be padded in the
* front of dimension i.
* padding[i, 1] specifies the number of element to be padded after the
diff --git a/neuralnetworks/1.2/Android.bp b/neuralnetworks/1.2/Android.bp
index daf0c18..085bda1 100644
--- a/neuralnetworks/1.2/Android.bp
+++ b/neuralnetworks/1.2/Android.bp
@@ -21,24 +21,6 @@
"android.hidl.base@1.0",
"android.hidl.safe_union@1.0",
],
- types: [
- "Constant",
- "DeviceType",
- "Extension",
- "FmqRequestDatum",
- "FmqResultDatum",
- "MeasureTiming",
- "Model",
- "Operand",
- "OperandType",
- "OperandTypeRange",
- "Operation",
- "OperationType",
- "OperationTypeRange",
- "OutputShape",
- "SymmPerChannelQuantParams",
- "Timing",
- ],
gen_java: false,
}
diff --git a/neuralnetworks/1.2/IDevice.hal b/neuralnetworks/1.2/IDevice.hal
index b9fa388..d83f9e6 100644
--- a/neuralnetworks/1.2/IDevice.hal
+++ b/neuralnetworks/1.2/IDevice.hal
@@ -76,6 +76,17 @@
getType() generates (ErrorStatus status, DeviceType type);
/**
+ * Gets the capabilities of a driver.
+ *
+ * @return status Error status of the call, must be:
+ * - NONE if successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if there is an unspecified error
+ * @return capabilities Capabilities of the driver.
+ */
+ getCapabilities_1_2() generates (ErrorStatus status, Capabilities capabilities);
+
+ /**
* Gets information about extensions supported by the driver implementation.
*
* All extension operations and operands must be fully supported for the
@@ -113,44 +124,83 @@
generates (ErrorStatus status, vec<bool> supportedOperations);
/**
- * Gets whether the driver supports compilation caching.
+ * Gets the caching requirements of the driver implementation.
*
- * isCachingSupported indicates whether the driver supports compilation caching.
- * Even if so, the driver may still choose not to cache certain compiled models.
+ * There are two types of cache file descriptors provided to the driver: model cache
+ * and data cache.
*
- * If the device reports the caching is not supported, the user may avoid calling
- * IDevice::prepareModelFromCache and IPreparedModel::saveToCache.
+ * The data cache is for caching constant data, possibly including preprocessed
+ * and transformed tensor buffers. Any modification to the data cache should
+ * have no worse effect than generating bad output values at execution time.
+ *
+ * The model cache is for caching security-sensitive data such as compiled
+ * executable machine code in the device's native binary format. A modification
+ * to the model cache may affect the driver's execution behavior, and a malicious
+ * client could make use of this to execute beyond the granted permission. Thus,
+ * the driver must always check whether the model cache is corrupted before
+ * preparing the model from cache.
+ *
+ * getNumberOfCacheFilesNeeded returns how many of each type of cache files the driver
+ * implementation needs to cache a single prepared model. Returning 0 for both types
+ * indicates compilation caching is not supported by this driver. The driver may
+ * still choose not to cache certain compiled models even if it reports that caching
+ * is supported.
+ *
+ * If the device reports that caching is not supported, the user may avoid calling
+ * IDevice::prepareModelFromCache or providing cache file descriptors to
+ * IDevice::prepareModel_1_2.
*
* @return status Error status of the call, must be:
* - NONE if successful
* - DEVICE_UNAVAILABLE if driver is offline or busy
* - GENERAL_FAILURE if there is an unspecified error
- * @return supported A boolean indicating whether the driver supports compilation
- * caching. Even on returning true, the driver may still choose
- * not to cache certain compiled models.
+ * @return numModelCache An unsigned integer indicating how many files for model cache
+ * the driver needs to cache a single prepared model. It must
+ * be less than or equal to Constant::MAX_NUMBER_OF_CACHE_FILES.
+ * @return numDataCache An unsigned integer indicating how many files for data cache
+ * the driver needs to cache a single prepared model. It must
+ * be less than or equal to Constant::MAX_NUMBER_OF_CACHE_FILES.
*/
- isCachingSupported() generates (ErrorStatus status, bool supported);
+ getNumberOfCacheFilesNeeded()
+ generates (ErrorStatus status, uint32_t numModelCache, uint32_t numDataCache);
/**
- * Creates a prepared model for execution.
+ * Asynchronously creates a prepared model for execution and optionally saves it
+ * into cache files.
*
- * prepareModel is used to make any necessary transformations or alternative
+ * prepareModel is used to make any necessary transformations to or alternative
* representations to a model for execution, possibly including
* transformations on the constant data, optimization on the model's graph,
* or compilation into the device's native binary format. The model itself
* is not changed.
*
+ * Optionally, caching information may be provided for the driver to save
+ * the prepared model to cache files for faster model compilation time
+ * when the same model preparation is requested in the future. There are
+ * two types of cache file handles provided to the driver: model cache
+ * and data cache. For more information on the two types of cache handles,
+ * refer to getNumberOfCacheFilesNeeded.
+ *
+ * The file descriptors must be opened with read and write permission. A file may
+ * have any size, and the corresponding file descriptor may have any offset. The
+ * driver must truncate a file to zero size before writing to that file. The file
+ * descriptors may be closed by the client once the asynchronous preparation has
+ * finished. The driver must dup a file descriptor if it wants to get access to
+ * the cache file later.
+ *
* The model is prepared asynchronously with respect to the caller. The
- * prepareModel function must verify the inputs to the prepareModel function
- * are correct. If there is an error, prepareModel must immediately invoke
+ * prepareModel function must verify the inputs to the preparedModel function
+ * related to preparing the model (as opposed to saving the prepared model to
+ * cache) are correct. If there is an error, prepareModel must immediately invoke
* the callback with the appropriate ErrorStatus value and nullptr for the
- * IPreparedModel, then return with the same ErrorStatus. If the inputs to
- * the prepareModel function are valid and there is no error, prepareModel
- * must launch an asynchronous task to prepare the model in the background,
- * and immediately return from prepareModel with ErrorStatus::NONE. If the
- * asynchronous task fails to launch, prepareModel must immediately invoke
- * the callback with ErrorStatus::GENERAL_FAILURE and nullptr for the
- * IPreparedModel, then return with ErrorStatus::GENERAL_FAILURE.
+ * IPreparedModel, then return with the same ErrorStatus. If the inputs to the
+ * prepareModel function that are related to preparing the model are valid and
+ * there is no error, prepareModel must launch an asynchronous task
+ * to prepare the model in the background, and immediately return from
+ * prepareModel with ErrorStatus::NONE. If the asynchronous task fails to launch,
+ * prepareModel must immediately invoke the callback with
+ * ErrorStatus::GENERAL_FAILURE and nullptr for the IPreparedModel, then return
+ * with ErrorStatus::GENERAL_FAILURE.
*
* When the asynchronous task has finished preparing the model, it must
* immediately invoke the callback function provided as an input to
@@ -160,6 +210,14 @@
* the callback object must be invoked with the appropriate ErrorStatus
* value and nullptr for the IPreparedModel.
*
+ * Optionally, the driver may save the prepared model to cache during the
+ * asynchronous preparation. Any error that occurs when saving to cache must
+ * not affect the status of preparing the model. Even if the input arguments
+ * related to the cache may be invalid, or the driver may fail to save to cache,
+ * the prepareModel function must finish preparing the model. The driver
+ * may choose not to save to cache even if the caching information is
+ * provided and valid.
+ *
* The only information that may be unknown to the model at this stage is
* the shape of the tensors, which may only be known at execution time. As
* such, some driver services may return partially prepared models, where
@@ -173,6 +231,26 @@
* @param model The model to be prepared for execution.
* @param preference Indicates the intended execution behavior of a prepared
* model.
+ * @param modelCache A vector of handles with each entry holding exactly one
+ * cache file descriptor for the security-sensitive cache. The length of
+ * the vector must either be 0 indicating that caching information is not provided,
+ * or match the numModelCache returned from getNumberOfCacheFilesNeeded. The cache
+ * handles will be provided in the same order when retrieving the
+ * preparedModel from cache files with prepareModelFromCache.
+ * @param dataCache A vector of handles with each entry holding exactly one
+ * cache file descriptor for the constants' cache. The length of
+ * the vector must either be 0 indicating that caching information is not provided,
+ * or match the numDataCache returned from getNumberOfCacheFilesNeeded. The cache
+ * handles will be provided in the same order when retrieving the
+ * preparedModel from cache files with prepareModelFromCache.
+ * @param token A caching token of length Constant::BYTE_SIZE_OF_CACHE_TOKEN
+ * identifying the prepared model. The same token will be provided when retrieving
+ * the prepared model from the cache files with prepareModelFromCache.
+ * Tokens should be chosen to have a low rate of collision for a particular
+ * application. The driver cannot detect a collision; a collision will result
+ * in a failed execution or in a successful execution that produces incorrect
+ * output values. If both modelCache and dataCache are empty indicating that
+ * caching information is not provided, this token must be ignored.
* @param callback A callback object used to return the error status of
* preparing the model for execution and the prepared model if
* successful, nullptr otherwise. The callback object's notify function
@@ -182,9 +260,12 @@
* - NONE if preparation task is successfully launched
* - DEVICE_UNAVAILABLE if driver is offline or busy
* - GENERAL_FAILURE if there is an unspecified error
- * - INVALID_ARGUMENT if one of the input arguments is invalid
+ * - INVALID_ARGUMENT if one of the input arguments related to preparing the
+ * model is invalid
*/
prepareModel_1_2(Model model, ExecutionPreference preference,
+ vec<handle> modelCache, vec<handle> dataCache,
+ uint8_t[Constant:BYTE_SIZE_OF_CACHE_TOKEN] token,
IPreparedModelCallback callback)
generates (ErrorStatus status);
@@ -192,22 +273,17 @@
* Creates a prepared model from cache files for execution.
*
* prepareModelFromCache is used to retrieve a prepared model directly from
- * cache files to avoid slow model compilation time. There are exactly two
- * cache file descriptors provided to the driver: modelCache and dataCache.
+ * cache files to avoid slow model compilation time. There are
+ * two types of cache file handles provided to the driver: model cache
+ * and data cache. For more information on the two types of cache handles,
+ * refer to getNumberOfCacheFilesNeeded.
*
- * The dataCache is for caching constant data, possibly including preprocessed
- * and transformed tensor buffers. Any modification to the dataCache should
- * have no worse effect than generating bad output values at execution time.
- *
- * The modelCache is for caching security-sensitive data such as compiled
- * executable machine code in the device's native binary format. A modification
- * to the modelCache may affect the driver's execution behavior, and a malicious
- * client could make use of this to execute beyond the granted permission. Thus,
- * the driver must always check whether the modelCache is corrupted before preparing
- * the model from cache.
- *
- * The two file descriptors may be closed by the client once the asynchronous
- * preparation has finished. The driver has to copy all the data it needs.
+ * The file descriptors must be opened with read and write permission. A file may
+ * have any size, and the corresponding file descriptor may have any offset. The
+ * driver must truncate a file to zero size before writing to that file. The file
+ * descriptors may be closed by the client once the asynchronous preparation has
+ * finished. The driver must dup a file descriptor if it wants to get access to
+ * the cache file later.
*
* The model is prepared asynchronously with respect to the caller. The
* prepareModelFromCache function must verify the inputs to the
@@ -241,13 +317,17 @@
* used with different shapes of inputs on different (possibly concurrent)
* executions.
*
- * @param modelCache A handle holding exactly one cache file descriptor for the
- * security-sensitive cache.
- * @param dataCache A handle holding exactly one cache file descriptor for the
- * constants' cache.
+ * @param modelCache A vector of handles with each entry holding exactly one
+ * cache file descriptor for the security-sensitive cache. The length of
+ * the vector must match the numModelCache returned from getNumberOfCacheFilesNeeded.
+ * The cache handles will be provided in the same order as with prepareModel_1_2.
+ * @param dataCache A vector of handles with each entry holding exactly one
+ * cache file descriptor for the constants' cache. The length of the vector
+ * must match the numDataCache returned from getNumberOfCacheFilesNeeded.
+ * The cache handles will be provided in the same order as with prepareModel_1_2.
* @param token A caching token of length Constant::BYTE_SIZE_OF_CACHE_TOKEN
* identifying the prepared model. It is the same token provided when saving
- * the cache files with IPreparedModel::saveToCache. Tokens should be chosen
+ * the cache files with prepareModel_1_2. Tokens should be chosen
* to have a low rate of collision for a particular application. The driver
* cannot detect a collision; a collision will result in a failed execution
* or in a successful execution that produces incorrect output values.
@@ -263,7 +343,7 @@
* unspecified error
* - INVALID_ARGUMENT if one of the input arguments is invalid
*/
- prepareModelFromCache(handle modelCache, handle dataCache,
+ prepareModelFromCache(vec<handle> modelCache, vec<handle> dataCache,
uint8_t[Constant:BYTE_SIZE_OF_CACHE_TOKEN] token,
IPreparedModelCallback callback)
generates (ErrorStatus status);
diff --git a/neuralnetworks/1.2/IPreparedModel.hal b/neuralnetworks/1.2/IPreparedModel.hal
index 757d5f1..5d2d80f 100644
--- a/neuralnetworks/1.2/IPreparedModel.hal
+++ b/neuralnetworks/1.2/IPreparedModel.hal
@@ -157,62 +157,4 @@
fmq_sync<FmqRequestDatum> requestChannel,
fmq_sync<FmqResultDatum> resultChannel)
generates (ErrorStatus status, IBurstContext context);
-
- /*
- * Saves the prepared model to cache files.
- *
- * saveToCache is used to save a prepared model to cache files for faster
- * model compilation time when the same model preparation is requested in
- * the future. There are exactly two cache file descriptors provided to the
- * driver: modelCache and dataCache.
- *
- * The dataCache is for caching constant data, possibly including preprocessed
- * and transformed tensor buffers. Any modification to the dataCache should
- * have no worse effect than generating bad output values at execution time.
- *
- * The modelCache is for caching security-sensitive data such as compiled
- * executable machine code in the device's native binary format. A modification
- * to the modelCache may affect the driver's execution behavior, and a malicious
- * client could make use of this to execute beyond the granted permission. Thus,
- * the driver must always check whether the modelCache is corrupted before preparing
- * the model from cache.
- *
- * The two file descriptors must point to two zero-length files with offset
- * positioned at the beginning of the file. The file descriptors may be closed
- * by the client once the method has returned.
- *
- * If the driver decides not to save the prepared model without looking at the
- * input arguments to the saveToCache function, saveToCache must return with
- * ErrorStatus::GENERAL_FAILURE. Otherwise, the saveToCache function must verify
- * the input arguments to the saveToCache function are valid, and return with
- * ErrorStatus::INVALID_ARGUMENT if not. If the inputs are valid but the driver
- * could not save the prepared model, saveToCache must return with the appropriate
- * ErrorStatus. Otherwise, it must write the cache files and return
- * ErrorStatus::NONE. Unless saveToCache returns ErrorStatus::NONE, the contents
- * of the cache files are undefined.
- *
- * @param modelCache A handle holding exactly one cache file descriptor for the
- * security-sensitive cache.
- * @param dataCache A handle holding exactly one cache file descriptor for the
- * constants' cache.
- * @param token A caching token of length Constant::BYTE_SIZE_OF_CACHE_TOKEN
- * identifying the prepared model. The same token will be provided
- * when retrieving the prepared model from cache files with
- * IDevice::prepareModelFromCache. Tokens should be chosen to have
- * a low rate of collision for a particular application. The driver
- * cannot detect a collision; a collision will result in a failed
- * execution or in a successful execution that produces incorrect
- * output values.
- * @return status Error status of saveToCache, must be:
- * - NONE if saveToCache is performed successfully
- * - DEVICE_UNAVAILABLE if driver is offline or busy
- * - GENERAL_FAILURE if the driver could not save the
- * prepared model or if there is an unspecified error
- * - INVALID_ARGUMENT if one of the input arguments is invalid,
- * unless the driver decides not to save the prepared model
- * without looking at the input arguments
- */
- saveToCache(handle modelCache, handle dataCache,
- uint8_t[Constant:BYTE_SIZE_OF_CACHE_TOKEN] token)
- generates (ErrorStatus status);
};
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index ab17598..8c57796 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -30,6 +30,11 @@
* The byte size of the cache token.
*/
BYTE_SIZE_OF_CACHE_TOKEN = 32,
+
+ /**
+ * The maximum number of files for each type of cache in compilation caching.
+ */
+ MAX_NUMBER_OF_CACHE_FILES = 32,
};
enum OperandType : @1.0::OperandType {
@@ -182,6 +187,10 @@
* input2.dimension = {5, 4, 3, 1}
* output.dimension = {5, 4, 3, 2}
*
+ * Since API level 29, generic zero-sized input tensor is supported. Zero
+ * dimension is only compatible with 0 or 1. The size of the output
+ * dimension is zero if either of corresponding input dimension is zero.
+ *
* Supported tensor {@link OperandType}:
* * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
@@ -218,6 +227,7 @@
* ) / sum(1)
*
* Supported tensor {@link OperandType}:
+ * * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
* * {@link OperandType::TENSOR_QUANT8_ASYMM}
*
@@ -230,7 +240,8 @@
*
* Inputs (explicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Since API level 29, zero batches is supported for this
+ * tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the padding on
* the left, in the ‘width’ dimension.
* * 2: An {@link OperandType::INT32} scalar, specifying the padding on
@@ -256,7 +267,8 @@
*
* Inputs (implicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Since API level 29, zero batches is supported for this
+ * tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the implicit
* padding scheme, has to be one of the
* following values: {0 (NONE), 1 (SAME), 2 (VALID)}.
@@ -303,6 +315,7 @@
* Before API level 29, all input tensors of
* {@link OperandType::TENSOR_QUANT8_ASYMM}
* must have the same scale and zeroPoint as the output tensor.
+ * Since API level 29, zero-sized tensors are supported.
* * n: An {@link OperandType::INT32} scalar, specifying the
* concatenation axis.
*
@@ -333,7 +346,7 @@
* ) + bias[channel]
*
* Supported tensor {@link OperandType} configurations:
- * * 32 bit Floating point :
+ * * 32 bit floating point:
* * * {@link OperandType::TENSOR_FLOAT32} for input, filter, output, and bias.
*
* * Quantized:
@@ -342,15 +355,15 @@
* * * input.scale * filter.scale).
*
* Available since API level 29:
+ * * 16 bit floating point:
+ * * * {@link OperandType::TENSOR_FLOAT16} for input, filter, output, and bias.
+ *
* * Quantized with symmetric per channel quantization for the filter:
* * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, and output.
* * * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} for filter.
* * * {@link OperandType::TENSOR_INT32} for bias (scale set to 0.0,
* * * each value scaling is separate and equal to input.scale * filter.scales[channel]).
*
- * * 16 bit Floating point:
- * * {@link OperandType::TENSOR_FLOAT16} for input, filter, output, and bias.
- *
* Supported tensor rank: 4, with "NHWC" or "NCHW" data layout.
* With the default data layout NHWC, the data is stored in the order of:
* [batch, height, width, channels]. Alternatively, the data layout could
@@ -360,7 +373,8 @@
*
* Inputs (explicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth_in],
- * specifying the input.
+ * specifying the input. Since API level 29, zero batches is supported
+ * for this tensor.
* * 1: A 4-D tensor, of shape
* [depth_out, filter_height, filter_width, depth_in], specifying the
* filter. For tensor of type
@@ -407,7 +421,8 @@
*
* Inputs (implicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth_in],
- * specifying the input.
+ * specifying the input. Since API level 29, zero batches is supported
+ * for this tensor.
* * 1: A 4-D tensor, of shape
* [depth_out, filter_height, filter_width, depth_in], specifying the
* filter. For tensor of type
@@ -449,11 +464,10 @@
*
* Outputs:
* * 0: The output 4-D tensor, of shape
- * [batches, out_height, out_width, depth_out]. For output tensor of
- * {@link OperandType::TENSOR_QUANT8_ASYMM}, the following condition
- * must be satisfied: output_scale > input_scale * filter_scale (for
- * filter tensor of {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL}
- * this condition must be true for all filter scales).
+ * [batches, out_height, out_width, depth_out]. Before API level 29,
+ * for output tensor of {@link OperandType::TENSOR_QUANT8_ASYMM}, the
+ * following condition must be satisfied:
+ * output_scale > input_scale * filter_scale
*
* Available since API level 27.
*/
@@ -482,7 +496,7 @@
* ) + bias[k * channel_multiplier + q]
*
* Supported tensor {@link OperandType} configurations:
- * * 32 bit Floating point :
+ * * 32 bit floating point:
* * * {@link OperandType::TENSOR_FLOAT32} for input, filter, output, and bias.
*
* * Quantized:
@@ -491,6 +505,9 @@
* * * input.scale * filter.scale).
*
* Available since API level 29:
+ * * 16 bit floating point:
+ * * * {@link OperandType::TENSOR_FLOAT16} for input, filter, output, and bias.
+ *
* * Quantized with symmetric per channel quantization for the filter:
* * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, and output.
* * * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} for filter.
@@ -596,11 +613,10 @@
*
* Outputs:
* * 0: The output 4-D tensor, of shape
- * [batches, out_height, out_width, depth_out]. For output tensor of
- * {@link OperandType::TENSOR_QUANT8_ASYMM}, the following condition
- * must be satisfied: output_scale > input_scale * filter_scale (for
- * filter tensor of {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL}
- * this condition must be true for all filter scales).
+ * [batches, out_height, out_width, depth_out]. Before API level 29,
+ * for output tensor of {@link OperandType::TENSOR_QUANT8_ASYMM}, the
+ * following condition must be satisfied:
+ * output_scale > input_scale * filter_scale
*
* Available since API level 27.
*/
@@ -668,7 +684,7 @@
* Supported tensor rank: up to 4
*
* Inputs:
- * * 0: A tensor.
+ * * 0: A tensor. Since API level 29, this tensor may be zero-sized.
*
* Outputs:
* * 0: A tensor with the same shape as input0.
@@ -761,7 +777,8 @@
* [batch_size, input_size], where "input_size" corresponds to the
* number of inputs to the layer, matching the second dimension of
* weights, and "batch_size" is calculated by dividing the number of
- * elements by "input_size".
+ * elements by "input_size". Since API level 29, zero batch_size is
+ * supported for this tensor.
* * 1: A 2-D tensor, specifying the weights, of shape
* [num_units, input_size], where "num_units" corresponds to the number
* of output nodes.
@@ -776,10 +793,10 @@
* invoke on the result.
*
* Outputs:
- * * 0: The output tensor, of shape [batch_size, num_units]. For output
- * tensor of {@link OperandType::TENSOR_QUANT8_ASYMM}, the following
- * condition must be satisfied:
- * output_scale > input_scale * filter_scale.
+ * * 0: The output tensor, of shape [batch_size, num_units]. Before API
+ * level 29, For output tensor of {@link
+ * OperandType::TENSOR_QUANT8_ASYMM}, the following condition must be
+ * satisfied: output_scale > input_scale * filter_scale.
*
* Available since API level 27.
*/
@@ -857,6 +874,7 @@
* Supported tensor {@link OperandType}:
* * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
+ * * {@link OperandType::TENSOR_QUANT8_ASYMM} (since API level 29)
*
* Supported tensor rank: up to 4
* Tensors with rank less than 4 are only supported since API level 29.
@@ -871,6 +889,8 @@
*
* Outputs:
* * 0: A tensor of the same {@link OperandType} and same shape as input0.
+ * For {@link OperandType::TENSOR_QUANT8_ASYMM},
+ * the scale must be 1.f / 128 and the zeroPoint must be 128.
*
* Available since API level 27.
*/
@@ -901,7 +921,8 @@
*
* Inputs (explicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Since API level 29, zero batches is supported for this
+ * tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the padding on
* the left, in the ‘width’ dimension.
* * 2: An {@link OperandType::INT32} scalar, specifying the padding on
@@ -927,7 +948,8 @@
*
* Inputs (implicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Since API level 29, zero batches is supported for this
+ * tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the implicit
* padding scheme, has to be one of the
* following values: {0 (NONE), 1 (SAME), 2 (VALID)}.
@@ -1010,13 +1032,15 @@
* output = 1 / (1 + exp(-input))
*
* Supported tensor {@link OperandType}:
+ * * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
* * {@link OperandType::TENSOR_QUANT8_ASYMM}
*
* Supported tensor rank: up to 4.
*
* Inputs:
- * * 0: A tensor, specifying the input.
+ * * 0: A tensor, specifying the input. Since API level 29, this tensor may
+ * be zero-sized.
*
* Outputs:
* * 0: The output tensor of same shape as input0.
@@ -1315,6 +1339,7 @@
* )
*
* Supported tensor {@link OperandType}:
+ * * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
* * {@link OperandType::TENSOR_QUANT8_ASYMM}
*
@@ -1327,7 +1352,8 @@
*
* Inputs (explicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Since API level 29, zero batches is supported for this
+ * tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the padding on
* the left, in the ‘width’ dimension.
* * 2: An {@link OperandType::INT32} scalar, specifying the padding on
@@ -1353,7 +1379,8 @@
*
* Inputs (implicit padding):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Since API level 29, zero batches is supported for this
+ * tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the implicit
* padding scheme, has to be one of the
* following values: {0 (NONE), 1 (SAME), 2 (VALID)}.
@@ -1400,6 +1427,10 @@
* * {@link OperandType::TENSOR_FLOAT32}
* * {@link OperandType::TENSOR_QUANT8_ASYMM}
*
+ * Since API level 29, generic zero-sized input tensor is supported. Zero
+ * dimension is only compatible with 0 or 1. The size of the output
+ * dimension is zero if either of corresponding input dimension is zero.
+ *
* Supported tensor rank: up to 4
*
* Inputs:
@@ -1435,7 +1466,8 @@
* Supported tensor rank: up to 4.
*
* Inputs:
- * * 0: A tensor, specifying the input.
+ * * 0: A tensor, specifying the input. Since API level 29, this tensor may
+ * be zero-sized.
*
* Outputs:
* * 0: The output tensor of same shape as input0.
@@ -1459,7 +1491,8 @@
* Supported tensor rank: up to 4.
*
* Inputs:
- * * 0: A tensor, specifying the input.
+ * * 0: A tensor, specifying the input. Since API level 29, this tensor may
+ * be zero-sized.
*
* Outputs:
* * 0: The output tensor of same shape as input0.
@@ -1483,7 +1516,8 @@
* Supported tensor rank: up to 4.
*
* Inputs:
- * * 0: A tensor, specifying the input.
+ * * 0: A tensor, specifying the input. Since API level 29, this tensor may
+ * be zero-sized.
*
* Outputs:
* * 0: The output tensor of same shape as input0.
@@ -1535,9 +1569,12 @@
* [batch, height, width, channels]. Alternatively, the data layout could
* be NCHW, the data storage order of: [batch, channels, height, width].
*
- * Inputs:
+ * Both resizing by shape and resizing by scale are supported.
+ *
+ * Inputs (resizing by shape):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Since API level 29, zero batches is supported for this
+ * tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the output
* height of the output tensor.
* * 2: An {@link OperandType::INT32} scalar, specifying the output
@@ -1546,6 +1583,24 @@
* Set to true to specify NCHW data layout for input0 and output0.
* Available since API level 29.
*
+ * Inputs (resizing by scale, since API level 29):
+ * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
+ * the input. Zero batches is supported for this tensor.
+ * * 1: A scalar, specifying height_scale, the scaling factor of the height
+ * dimension from the input tensor to the output tensor. The output
+ * height is calculated as new_height = floor(height * height_scale).
+ * The scalar must be of {@link OperandType::FLOAT16} if input0 is
+ * of {@link OperandType::TENSOR_FLOAT16} and of
+ * {@link OperandType::FLOAT32} otherwise.
+ * * 2: A scalar, specifying width_scale, the scaling factor of the width
+ * dimension from the input tensor to the output tensor. The output
+ * width is calculated as new_width = floor(width * width_scale).
+ * The scalar must be of {@link OperandType::FLOAT16} if input0 is
+ * of {@link OperandType::TENSOR_FLOAT16} and of
+ * {@link OperandType::FLOAT32} otherwise.
+ * * 3: An optional {@link OperandType::BOOL} scalar, default to false.
+ * Set to true to specify NCHW data layout for input0 and output0.
+ *
* Outputs:
* * 0: The output 4-D tensor, of shape
* [batches, new_height, new_width, depth].
@@ -1623,6 +1678,7 @@
* independently on each 1-D slice along specified dimension.
*
* Supported tensor {@link OperandType}:
+ * * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
* * {@link OperandType::TENSOR_QUANT8_ASYMM}
*
@@ -1630,9 +1686,14 @@
* Tensors with rank other than 2 or 4 are only supported since API level 29.
*
* Inputs:
- * * 0: A 2-D or 4-D tensor, specifying the tensor to be reshaped.
- * * 1: An {@link OperandType::FLOAT32} scalar, specifying the positive
- * scaling factor for the exponent, beta.
+ * * 0: A 2-D or 4-D tensor, specifying the tensor to be reshaped. Since
+ * API level 29, this tensor may be zero-sized.
+ * * 1: A scalar, specifying the positive scaling factor for the exponent,
+ * beta. If input0 is of {@link OperandType::TENSOR_FLOAT32} or
+ * {@link OperandType::TENSOR_QUANT8_ASYMM}, the scalar must be of
+ * {@link OperandType::FLOAT32}. If input0 is of {@link
+ * OperandType::TENSOR_FLOAT16}, then the scalar must be of {@link
+ * OperandType::FLOAT16}.
* * 2: An optional {@link OperandType::INT32} scalar, default to -1,
* specifying the dimension the activation would be performed on.
* Negative index is used to specify axis from the end (e.g. -1 for
@@ -1784,7 +1845,8 @@
* Supported tensor rank: up to 4.
*
* Inputs:
- * * 0: A tensor, specifying the input.
+ * * 0: A tensor, specifying the input. Since API level 29, this tensor may
+ * be zero-sized.
*
* Outputs:
* * 0: The output tensor of same shape as input0.
@@ -1851,6 +1913,10 @@
* input2.dimension = {5, 4, 3, 1}
* output.dimension = {5, 4, 3, 2}
*
+ * Since API level 29, generic zero-sized input tensor is supported. Zero
+ * dimension is only compatible with 0 or 1. The size of the output
+ * dimension is zero if either of corresponding input dimension is zero.
+ *
* Supported tensor {@link OperandType}:
* * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
@@ -1968,7 +2034,8 @@
* must be >= 1.
* * 2: A 2-D Tensor of {@link OperandType::TENSOR_INT32}, the paddings
* for each spatial dimension of the input tensor. All values must be
- * >= 0. The shape of the tensor must be {rank(input0), 2}.
+ * >= 0. The shape of the tensor must be {M, 2}, where M is the number
+ * of spatial dimensions.
* padding[i, 0] specifies the number of element to be padded in the
* front of dimension i.
* padding[i, 1] specifies the number of element to be padded after the
@@ -2083,6 +2150,10 @@
* input2.dimension = {5, 4, 3, 1}
* output.dimension = {5, 4, 3, 2}
*
+ * Since API level 29, generic zero-sized input tensor is supported. Zero
+ * dimension is only compatible with 0 or 1. The size of the output
+ * dimension is zero if either of corresponding input dimension is zero.
+ *
* Supported tensor {@link OperandType}:
* * {@link OperandType::TENSOR_FLOAT16} (since API level 29)
* * {@link OperandType::TENSOR_FLOAT32}
@@ -2123,6 +2194,7 @@
*
* Inputs:
* * 0: An n-D tensor, specifying the tensor to be transposed.
+ * Since API level 29, this tensor may be zero-sized.
* * 1: An optional 1-D Tensor of {@link OperandType::TENSOR_INT32},
* the permutation of the dimensions of the input tensor.
*
@@ -2219,7 +2291,8 @@
* * 0: A 2-D Tensor of shape [num_rois, 4], specifying the locations of the
* bounding box proposals, each line with format [x1, y1, x2, y2].
* For tensor of type {@link OperandType::TENSOR_QUANT16_ASYMM},
- * the zeroPoint must be 0 and the scale must be 0.125.
+ * the zeroPoint must be 0 and the scale must be 0.125. Zero num_rois
+ * is supported for this tensor.
* * 1: A 2-D Tensor of shape [num_rois, num_classes * 4], specifying the
* bounding box delta for each region of interest and each class. The
* bounding box deltas are organized in the following order
@@ -2228,10 +2301,12 @@
* and height, dw and dh is the log-scale relative correction factor
* for the width and height. For input0 of type
* {@link OperandType::TENSOR_QUANT16_ASYMM}, this tensor should be
- * of {@link OperandType::TENSOR_QUANT8_ASYMM}.
+ * of {@link OperandType::TENSOR_QUANT8_ASYMM}. Zero num_rois is
+ * supported for this tensor.
* * 2: An 1-D {@link OperandType::TENSOR_INT32} tensor, of shape
* [num_rois], specifying the batch index of each box. Boxes with
- * the same batch index are grouped together.
+ * the same batch index are grouped together. Zero num_rois is
+ * supported for this tensor.
* * 3: A 2-D Tensor of shape [batches, 2], specifying the information of
* each image in the batch, each line with format
* [image_height, image_width].
@@ -2260,113 +2335,113 @@
* Inputs:
* * 0: The input.
* A 3-D tensor of shape:
- * If time-major: [max_time, batch_size, output_size]
- * If batch-major: [batch_size, max_time, output_size]
+ * If time-major: [max_time, batch_size, input_size]
+ * If batch-major: [batch_size, max_time, input_size]
* where "max_time" is the number of timesteps (sequence length),
* "batch_size" corresponds to the batching dimension, and
* "input_size" is the size of the input.
* * 1: The forward input-to-input weights. Optional.
- * A 2-D tensor of shape [num_units, input_size], where “num_units”
- * corresponds to the number of cell units.
+ * A 2-D tensor of shape [fw_num_units, input_size], where “fw_num_units”
+ * corresponds to the number of forward cell units.
* * 2: The forward input-to-forget weights.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [fw_num_units, input_size].
* * 3: The forward input-to-cell weights.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [fw_num_units, input_size].
* * 4: The forward input-to-output weights.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [fw_num_units, input_size].
* * 5: The forward recurrent-to-input weights. Optional.
- * A 2-D tensor of shape [num_units, output_size], where “output_size”
- * corresponds to either the number of cell units (i.e., “num_units”),
- * or the second dimension of the “projection_weights”, if defined.
+ * A 2-D tensor of shape [fw_num_units, fw_output_size], where “fw_output_size”
+ * corresponds to either the number of cell units (i.e., fw_num_units),
+ * or the second dimension of the “fw_projection_weights”, if defined.
* * 6: The forward recurrent-to-forget weights.
- * A 2-D tensor of shape [num_units, output_size].
+ * A 2-D tensor of shape [fw_num_units, fw_output_size].
* * 7: The forward recurrent-to-cell weights.
- * A 2-D tensor of shape [num_units, output_size].
+ * A 2-D tensor of shape [fw_num_units, fw_output_size].
* * 8: The forward recurrent-to-output weights.
- * A 2-D tensor of shape [num_units, output_size].
+ * A 2-D tensor of shape [fw_num_units, fw_output_size].
* * 9: The forward cell-to-input weights. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [fw_num_units].
* * 10: The forward cell-to-forget weights. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [fw_num_units].
* * 11: The forward cell-to-output weights. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [fw_num_units].
* * 12: The forward input gate bias. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [fw_num_units].
* * 13: The forward forget gate bias.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [fw_num_units].
* * 14: The forward cell gate bias.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [fw_num_units].
* * 15: The forward output gate bias.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [fw_num_units].
* * 16: The forward projection weights. Optional.
- * A 2-D tensor of shape [output_size, num_units].
+ * A 2-D tensor of shape [fw_output_size, fw_num_units].
* * 17: The forward projection bias. Optional.
- * A 1-D tensor of shape [output_size].
+ * A 1-D tensor of shape [fw_output_size].
* * 18: The backward input-to-input weights. Optional.
- * A 2-D tensor of shape [num_units, input_size], where “num_units”
- * corresponds to the number of cell units.
+ * A 2-D tensor of shape [bw_num_units, input_size], where “bw_num_units”
+ * corresponds to the number of backward cell units.
* * 19: The backward input-to-forget weights.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [bw_num_units, input_size].
* * 20: The backward input-to-cell weights.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [bw_num_units, input_size].
* * 21: The backward input-to-output weights.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [bw_num_units, input_size].
* * 22: The backward recurrent-to-input weights. Optional.
- * A 2-D tensor of shape [num_units, output_size], where “output_size”
- * corresponds to either the number of cell units (i.e., “num_units”),
- * or the second dimension of the “projection_weights”, if defined.
+ * A 2-D tensor of shape [bw_num_units, bw_output_size], where “bw_output_size”
+ * corresponds to either the number of cell units (i.e., “bw_num_units”),
+ * or the second dimension of the “bw_projection_weights”, if defined.
* * 23: The backward recurrent-to-forget weights.
- * A 2-D tensor of shape [num_units, output_size].
+ * A 2-D tensor of shape [bw_num_units, bw_output_size].
* * 24: The backward recurrent-to-cell weights.
- * A 2-D tensor of shape [num_units, output_size].
+ * A 2-D tensor of shape [bw_num_units, bw_output_size].
* * 25: The backward recurrent-to-output weights.
- * A 2-D tensor of shape [num_units, output_size].
+ * A 2-D tensor of shape [bw_num_units, bw_output_size].
* * 26: The backward cell-to-input weights. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [bw_num_units].
* * 27: The backward cell-to-forget weights. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [bw_num_units].
* * 28: The backward cell-to-output weights. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [bw_num_units].
* * 29: The backward input gate bias. Optional.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [bw_num_units].
* * 30: The backward forget gate bias.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [bw_num_units].
* * 31: The backward cell gate bias.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [bw_num_units].
* * 32: The backward output gate bias.
- * A 1-D tensor of shape [num_units].
+ * A 1-D tensor of shape [bw_num_units].
* * 33: The backward projection weights. Optional.
- * A 2-D tensor of shape [output_size, num_units].
+ * A 2-D tensor of shape [bw_output_size, bw_num_units].
* * 34: The backward projection bias. Optional.
- * A 1-D tensor of shape [output_size].
+ * A 1-D tensor of shape [bw_output_size].
* * 35: The forward input activation state.
- * A 2-D tensor of shape [batch_size, output_size].
+ * A 2-D tensor of shape [batch_size, bw_output_size].
* * 36: The forward input cell state.
- * A 2-D tensor of shape [batch_size, num_units].
+ * A 2-D tensor of shape [batch_size, bw_num_units].
* * 37: The backward input activation state.
- * A 2-D tensor of shape [batch_size, output_size].
+ * A 2-D tensor of shape [batch_size, bw_output_size].
* * 38: The backward input cell state.
- * A 2-D tensor of shape [batch_size, num_units].
+ * A 2-D tensor of shape [batch_size, bw_num_units].
* * 39: The auxiliary input. Optional.
* A 3-D tensor of shape [max_time, batch_size, input_size], where “batch_size”
* corresponds to the batching dimension, and “input_size” is the size
* of the input.
* * 40: The forward auxiliary input-to-input weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [fw_num_units, input_size].
* * 41: The forward auxiliary input-to-forget weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [fw_num_units, input_size].
* * 42: The forward auxiliary input-to-cell weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [fw_num_units, input_size].
* * 43: The forward auxiliary input-to-output weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [fw_num_units, input_size].
* * 44: The backward auxiliary input-to-input weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [bw_num_units, input_size].
* * 45: The backward auxiliary input-to-forget weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [bw_num_units, input_size].
* * 46: The backward auxiliary input-to-cell weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [bw_num_units, input_size].
* * 47: The backward auxiliary input-to-output weights. Optional.
- * A 2-D tensor of shape [num_units, input_size].
+ * A 2-D tensor of shape [bw_num_units, input_size].
* * 48: The activation function.
* A value indicating the activation function:
* <ul>
@@ -2398,16 +2473,46 @@
* * 52: time_major
* An {@link OperandType::BOOL} scalar specifying the shape format
* of input and output tensors.
+ * * 53: The forward input layer normalization weights. Optional.
+ * A 1-D tensor of shape [fw_num_units]. Used to rescale normalized inputs
+ * to activation at input gate.
+ * * 54: The forward forget layer normalization weights. Optional.
+ * A 1-D tensor of shape [fw_num_units]. Used to rescale normalized inputs
+ * to activation at forget gate.
+ * * 55: The forward cell layer normalization weights. Optional.
+ * A 1-D tensor of shape [fw_num_units]. Used to rescale normalized inputs
+ * to activation at cell gate.
+ * * 56: The forward output layer normalization weights. Optional.
+ * A 1-D tensor of shape [fw_num_units]. Used to rescale normalized inputs
+ * to activation at output gate.
+ * * 57: The backward input layer normalization weights. Optional.
+ * A 1-D tensor of shape [bw_num_units]. Used to rescale normalized inputs
+ * to activation at input gate.
+ * * 58: The backward forget layer normalization weights. Optional.
+ * A 1-D tensor of shape [bw_num_units]. Used to rescale normalized inputs
+ * to activation at forget gate.
+ * * 59: The backward cell layer normalization weights. Optional.
+ * A 1-D tensor of shape [bw_num_units]. Used to rescale normalized inputs
+ * to activation at cell gate.
+ * * 60: The backward output layer normalization weights. Optional.
+ * A 1-D tensor of shape [bw_num_units]. Used to rescale normalized inputs
+ * to activation at output gate.
*
* Outputs:
* * 0: The forward output.
* A 3-D tensor of shape:
- * If time-major: [max_time, batch_size, output_size]
- * If batch-major: [batch_size, max_time, output_size]
+ * If time-major and not merge_outputs:
+ * [max_time, batch_size, fw_output_size]
+ * If time-major and merge_outputs:
+ * [max_time, batch_size, fw_output_size + bw_output_size]
+ * If batch-major and not merge_outputs:
+ * [batch_size, max_time, fw_output_size]
+ * If batch-major and merge_outputs:
+ * [batch_size, max_time, fw_output_size + bw_output_size]
* * 1: The backward output. Unused if merge_outputs is true.
* A 3-D tensor of shape:
- * If time-major: [max_time, batch_size, output_size]
- * If batch-major: [batch_size, max_time, output_size]
+ * If time-major: [max_time, batch_size, bw_output_size]
+ * If batch-major: [batch_size, max_time, bw_output_size]
*
* Available since API level 29.
*/
@@ -2535,10 +2640,17 @@
/**
* Greedily selects a subset of bounding boxes in descending order of score.
*
- * This op applies hard NMS algorithm to each class. In each loop of
- * execution, the box with maximum score gets selected, and any boxes with
- * the intersection-over-union (IOU) greater than a threshold are removed
- * from the pending set.
+ * This op applies NMS algorithm to each class. In each loop of execution,
+ * the box with maximum score gets selected and removed from the pending set.
+ * The scores of the rest of boxes are lowered according to the
+ * intersection-over-union (IOU) overlapping with the previously selected
+ * boxes and a specified NMS kernel method. Any boxes with score less
+ * than a threshold are removed from the pending set.
+ *
+ * Three NMS kernels are supported:
+ * * Hard: score_new = score_old * (1 if IoU < threshold else 0)
+ * * Linear: score_new = score_old * (1 if IoU < threshold else 1 - IoU)
+ * * Gaussian: score_new = score_old * exp(- IoU^2 / sigma)
*
* Axis-aligned bounding boxes are represented by its upper-left corner
* coordinate (x1,y1) and lower-right corner coordinate (x2,y2). A valid
@@ -2552,25 +2664,34 @@
* Inputs:
* * 0: A 2-D Tensor of shape [num_rois, num_classes], specifying the score
* of each bounding box proposal. The boxes are grouped by batches in the
- * first dimension.
+ * first dimension. Zero num_rois is supported for this tensor.
* * 1: A 2-D Tensor specifying the bounding boxes of shape
* [num_rois, num_classes * 4], organized in the order [x1, y1, x2, y2].
* The boxes are grouped by batches in the first dimension. The sequential
* order of the boxes corresponds with input0. For input0 of type
* {@link OperandType::TENSOR_QUANT8_ASYMM}, this tensor should be of
* {@link OperandType::TENSOR_QUANT16_ASYMM}, with zeroPoint of 0 and
- * scale of 0.125.
+ * scale of 0.125. Zero num_rois is supported for this tensor.
* * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor, of shape
* [num_rois], specifying the batch index of each box. Boxes with
* the same batch index are grouped together.
* * 3: An {@link OperandType::FLOAT32} scalar, score_threshold. Boxes
* with scores lower than the threshold are filtered before sending
* to the NMS algorithm.
- * * 4: An {@link OperandType::FLOAT32} scalar, specifying the IoU
- * threshold.
- * * 5: An {@link OperandType::INT32} scalar, specifying the maximum
+ * * 4: An {@link OperandType::INT32} scalar, specifying the maximum
* number of selected bounding boxes for each image. Set to a negative
* value for unlimited number of output bounding boxes.
+ * * 5: An {@link OperandType::INT32} scalar, specifying the NMS
+ * kernel method, options are 0:hard, 1:linear, 2:gaussian.
+ * * 6: An {@link OperandType::FLOAT32} scalar, specifying the IoU
+ * threshold in hard and linear NMS kernel. This field is ignored if
+ * gaussian kernel is selected.
+ * * 7: An {@link OperandType::FLOAT32} scalar, specifying the sigma in
+ * gaussian NMS kernel. This field is ignored if gaussian kernel is
+ * not selected.
+ * * 8: An {@link OperandType::FLOAT32} scalar, nms_score_threshold.
+ * Boxes with scores lower than the threshold are dropped during the
+ * score updating phase in soft NMS.
*
* Outputs:
* * 0: A 1-D Tensor of the same {@link OperandType} as input0, with shape
@@ -2588,8 +2709,8 @@
* [num_output_rois], specifying the class of each output box. The
* sequential order of the boxes corresponds with output0.
* * 3: A 1-D {@link OperandType::TENSOR_INT32} tensor, of shape
- * [num_rois], specifying the batch index of each box. Boxes with
- * the same batch index are grouped together.
+ * [num_output_rois], specifying the batch index of each box. Boxes
+ * with the same batch index are grouped together.
*
* Available since API level 29.
*/
@@ -2706,11 +2827,17 @@
* * 10: An {@link OperandType::INT32} scalar, only used when input7 is
* set to true, specifying the maximum number of detections when
* applying NMS algorithm for each single class.
- * * 11: An {@link OperandType::FLOAT32} scalar, score_threshold. Boxes
- * with scores lower than the threshold are filtered before sending
- * to the NMS algorithm.
- * * 12: An {@link OperandType::FLOAT32} scalar, specifying the IoU
- * threshold for hard NMS.
+ * * 11: A scalar, score_threshold. Boxes with scores lower than the
+ * threshold are filtered before sending to the NMS algorithm. The
+ * scalar must be of {@link OperandType::FLOAT16} if input0 is of
+ * {@link OperandType::TENSOR_FLOAT16} and of {@link
+ * OperandType::FLOAT32} if input0 is of {@link
+ * OperandType::TENSOR_FLOAT32}.
+ * * 12: A scalar, specifying the IoU threshold for hard NMS. The scalar
+ * must be of {@link OperandType::FLOAT16} if input0 is of {@link
+ * OperandType::TENSOR_FLOAT16} and of {@link
+ * OperandType::FLOAT32} if input0 is of {@link
+ * OperandType::TENSOR_FLOAT32}.
* * 13: An {@link OperandType::BOOL} scalar, set to true to include
* background class in the list of label map for the output, set
* to false to not include the background. When the background
@@ -2919,8 +3046,8 @@
* For type of {@link OperandType::TENSOR_QUANT16_ASYMM}, the
* scale must be 0.125 and the zero point must be 0.
* * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor, of shape
- * [num_rois], specifying the batch index of each box. Boxes with
- * the same batch index are grouped together.
+ * [num_output_rois], specifying the batch index of each box. Boxes
+ * with the same batch index are grouped together.
*
* Available since API level 29.
*/
@@ -3007,11 +3134,11 @@
* where channel_multiplier = depth_out / num_groups
*
* Supported tensor {@link OperandType} configurations:
- * * 32 bit Floating point :
- * * * {@link OperandType::TENSOR_FLOAT32} for input, filter, output, and bias.
+ * * 16 bit floating point:
+ * * * {@link OperandType::TENSOR_FLOAT16} for input, filter, output, and bias.
*
- * * 16 bit Floating point:
- * * {@link OperandType::TENSOR_FLOAT16} for input, filter, output, and bias.
+ * * 32 bit floating point:
+ * * * {@link OperandType::TENSOR_FLOAT32} for input, filter, output, and bias.
*
* * Quantized:
* * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, filter, and output.
@@ -3104,11 +3231,7 @@
*
* Outputs:
* * 0: The output 4-D tensor, of shape
- * [batches, out_height, out_width, depth_out]. For output tensor of
- * {@link OperandType::TENSOR_QUANT8_ASYMM}, the following condition
- * must be satisfied: output_scale > input_scale * filter_scale (for
- * filter tensor of type {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL}
- * this condition must be true for all filter scales).
+ * [batches, out_height, out_width, depth_out].
*
* Available since API level 29.
*/
@@ -3188,12 +3311,21 @@
*
* Inputs:
* * 0: An n-D tensor, specifying the tensor to be normalized.
- * * 1: An {@link OperandType::FLOAT32} scalar, specifying gamma, the
- * scale applied to the normalized tensor.
- * * 2: An {@link OperandType::FLOAT32} scalar, specifying beta, the
- * offset applied to the normalized tensor.
- * * 3: An {@link OperandType::FLOAT32} scalar, specifying epsilon, the
- * small value added to variance to avoid dividing by zero.
+ * * 1: A scalar, specifying gamma, the scale applied to the normalized
+ * tensor. The scalar must be of {@link OperandType::FLOAT16} if
+ * input0 is of {@link OperandType::TENSOR_FLOAT16} and of {@link
+ * OperandType::FLOAT32} if input0 is of {@link
+ * OperandType::TENSOR_FLOAT32}.
+ * * 2: A scalar, specifying beta, the offset applied to the normalized
+ * tensor. The scalar must be of {@link OperandType::FLOAT16} if
+ * input0 is of {@link OperandType::TENSOR_FLOAT16} and of {@link
+ * OperandType::FLOAT32} if input0 is of {@link
+ * OperandType::TENSOR_FLOAT32}.
+ * * 3: A scalar, specifying epsilon, the small value added to variance to
+ * avoid dividing by zero. The scalar must be of {@link OperandType::FLOAT16} if
+ * input0 is of {@link OperandType::TENSOR_FLOAT16} and of {@link
+ * OperandType::FLOAT32} if input0 is of {@link
+ * OperandType::TENSOR_FLOAT32}.
* * 4: An {@link OperandType::BOOL} scalar, set to true to specify
* NCHW data layout for input0 and output0. Set to false for NHWC.
*
@@ -3475,10 +3607,12 @@
* padding[i, 1] specifies the number of elements to be padded after
* the end of dimension i.
* * 2: An scalar specifying the value to use for padding input0.
+ * For input tensor of {@link OperandType::TENSOR_FLOAT16}, the
+ * pad value must be of {@link OperandType::FLOAT16}.
* For input tensor of {@link OperandType::TENSOR_FLOAT32}, the
- * pad value should be of {@link OperandType::FLOAT32}.
+ * pad value must be of {@link OperandType::FLOAT32}.
* For input tensor of {@link OperandType::TENSOR_QUANT8_ASYMM},
- * the pad value should be of {@link OperandType::INT32}. The
+ * the pad value must be of {@link OperandType::INT32}. The
* scale and zeroPoint are assumed to be the same as in input0.
*
* Outputs:
@@ -3579,7 +3713,7 @@
* Supported tensor rank: from 1
*
* Inputs:
- * * 0: A tensor.
+ * * 0: A tensor, may be zero-sized.
*
* Outputs:
* * 0: The output tensor of same shape as input0, but with
@@ -3627,25 +3761,25 @@
* weights.
* * 5: The recurrent-to-input weights.
* A 2-D tensor of type {@link OperandType::TENSOR_QUANT8_ASYMM}
- * and shape [outputSize, inputSize] specifying recurrent-to-input part
+ * and shape [outputSize, outputSize] specifying recurrent-to-input part
* of weights for fully-connected layer inside the LSTM cell.
* Quantization zero point and scale must be the same across all the
* weights.
* * 6: The recurrent-to-forget weights.
* A 2-D tensor of type {@link OperandType::TENSOR_QUANT8_ASYMM}
- * and shape [outputSize, inputSize] specifying recurrent-to-forget
+ * and shape [outputSize, outputSize] specifying recurrent-to-forget
* part of weights for fully-connected layer inside the LSTM cell.
* Quantization zero point and scale must be the same across all the
* weights.
* * 7: The recurrent-to-cell weights.
* A 2-D tensor of type {@link OperandType::TENSOR_QUANT8_ASYMM}
- * and shape [outputSize, inputSize] specifying recurrent-to-cell part
+ * and shape [outputSize, outputSize] specifying recurrent-to-cell part
* of weights for fully-connected layer inside the LSTM cell.
* Quantization zero point and scale must be the same across all the
* weights.
* * 8: The recurrent-to-output weights.
* A 2-D tensor of type {@link OperandType::TENSOR_QUANT8_ASYMM}
- * and shape [outputSize, inputSize] specifying recurrent-to-output
+ * and shape [outputSize, outputSize] specifying recurrent-to-output
* part of weights for fully-connected layer inside the LSTM cell.
* Quantization zero point and scale must be the same across all the
* weights.
@@ -3911,10 +4045,12 @@
* the regions of interest, each line with format [x1, y1, x2, y2].
* For input0 of type {@link OperandType::TENSOR_QUANT8_ASYMM},
* this tensor should be of {@link OperandType::TENSOR_QUANT16_ASYMM},
- * with zeroPoint of 0 and scale of 0.125.
+ * with zeroPoint of 0 and scale of 0.125. Zero num_rois is
+ * supported for this tensor.
* * 2: An 1-D {@link OperandType::TENSOR_INT32} tensor, of shape
* [num_rois], specifying the batch index of each box. Boxes with
- * the same batch index are grouped together.
+ * the same batch index are grouped together. Zero num_rois is
+ * supported for this tensor.
* * 3: An {@link OperandType::INT32} scalar, specifying the output
* height of the output tensor.
* * 4: An {@link OperandType::INT32} scalar, specifying the output
@@ -4079,7 +4215,7 @@
* Supported tensor rank: from 1
*
* Inputs:
- * * 0: An n-D tensor to take slice from.
+ * * 0: An n-D tensor to take slice from, may be zero-sized.
* * 1: A 1-D tensor of type {@link OperandType::TENSOR_INT32} specifying
* the beginning indices of the slice in each dimension.
* * 2: A 1-D tensor of type {@link OperandType::TENSOR_INT32} specifying
@@ -4195,7 +4331,7 @@
TOPK_V2 = 90,
/**
- * Performs the tranpose of 2-D convolution operation.
+ * Performs the transpose of 2-D convolution operation.
*
* This operation is sometimes called "deconvolution" after Deconvolutional
* Networks, but is actually the transpose (gradient) of
@@ -4205,7 +4341,10 @@
* padding.
*
* Supported tensor {@link OperandCode} configurations:
- * * 32 bit Floating point :
+ * * 16 bit floating point:
+ * * * {@link OperandType::TENSOR_FLOAT16} for input, filter, output, and bias.
+ *
+ * * 32 bit floating point:
* * * {@link OperandType::TENSOR_FLOAT32} for input, filter, output, and bias.
*
* * Quantized:
@@ -4213,7 +4352,6 @@
* * * {@link OperandType::TENSOR_INT32} for bias (with scale set to
* * * input.scale * filter.scale).
*
- * Available since API level 29:
* * Quantized with symmetric per channel quantization for the filter:
* * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, and output.
* * * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} for filter.
@@ -4300,11 +4438,7 @@
*
* Outputs:
* * 0: The output 4-D tensor, of shape
- * [batches, out_height, out_width, depth_out]. For output tensor of
- * {@link OperandType::TENSOR_QUANT8_ASYMM}, the following condition
- * must be satisfied: output_scale > input_scale * filter_scale (for
- * filter tensor of {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL}
- * this condition must be true for all filter scales).
+ * [batches, out_height, out_width, depth_out].
*
* Available since API level 29.
*/
@@ -4336,9 +4470,9 @@
* Inputs:
* * 0: The input (\f$x_t\f$).
* A 3-D tensor of shape:
- * If time-major: [max_time, batch_size, output_size]
- * If batch-major: [batch_size, max_time, output_size]
- * where “max_size” is the number of timesteps (sequence length),
+ * If time-major: [max_time, batch_size, input_size]
+ * If batch-major: [batch_size, max_time, input_size]
+ * where “max_time” is the number of timesteps (sequence length),
* “batch_size” corresponds to the batching dimension, and
* “input_size” is the size of the input.
* * 1: The input-to-input weights (\f$W_{xi}\f$). Optional.
@@ -4398,16 +4532,16 @@
* projection layer, such that values are bound within
* [-proj_clip, proj_clip]. If set to 0.0 then clipping is disabled.
* * 23:Time-major if true, batch-major if false.
- * * 24:The input layer normalization weights.
+ * * 24:The input layer normalization weights. Optional.
* A 1-D tensor of shape [num_units]. Used to rescale normalized inputs
* to activation at input gate.
- * * 25:The forget layer normalization weights.
+ * * 25:The forget layer normalization weights. Optional.
* A 1-D tensor of shape [num_units]. Used to rescale normalized inputs
* to activation at forget gate.
- * * 26:The cell layer normalization weights.
+ * * 26:The cell layer normalization weights. Optional.
* A 1-D tensor of shape [num_units]. Used to rescale normalized inputs
* to activation at cell gate.
- * * 27:The output layer normalization weights.
+ * * 27:The output layer normalization weights. Optional.
* A 1-D tensor of shape [num_units]. Used to rescale normalized inputs
* to activation at output gate.
*
@@ -4495,9 +4629,11 @@
* [batch, height, width, channels]. Alternatively, the data layout could
* be NCHW, the data storage order of: [batch, channels, height, width].
*
- * Inputs:
+ * Both resizing by shape and resizing by scale are supported.
+ *
+ * Inputs (resizing by shape):
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
- * the input.
+ * the input. Zero batches is supported for this tensor.
* * 1: An {@link OperandType::INT32} scalar, specifying the output
* height of the output tensor.
* * 2: An {@link OperandType::INT32} scalar, specifying the output
@@ -4505,6 +4641,24 @@
* * 3: An {@link OperandType::BOOL} scalar, default to false.
* Set to true to specify NCHW data layout for input0 and output0.
*
+ * Inputs (resizing by scale):
+ * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying
+ * the input. Zero batches is supported for this tensor.
+ * * 1: A scalar, specifying height_scale, the scaling factor of the height
+ * dimension from the input tensor to the output tensor. The output
+ * height is calculated as new_height = floor(height * height_scale).
+ * The scalar must be of {@link OperandType::FLOAT16} if input0 is
+ * of {@link OperandType::TENSOR_FLOAT16} and of
+ * {@link OperandType::FLOAT32} otherwise.
+ * * 2: A scalar, specifying width_scale, the scaling factor of the width
+ * dimension from the input tensor to the output tensor. The output
+ * width is calculated as new_width = floor(width * width_scale).
+ * The scalar must be of {@link OperandType::FLOAT16} if input0 is
+ * of {@link OperandType::TENSOR_FLOAT16} and of
+ * {@link OperandType::FLOAT32} otherwise.
+ * * 3: An {@link OperandType::BOOL} scalar, default to false.
+ * Set to true to specify NCHW data layout for input0 and output0.
+ *
* Outputs:
* * 0: The output 4-D tensor, of shape
* [batches, new_height, new_width, depth].
@@ -4562,6 +4716,39 @@
};
/**
+ * The capabilities of a driver.
+ *
+ * Performance of an operation comes from the type of its first operand.
+ * This represents performance for non extension operand types.
+ */
+struct Capabilities {
+ /**
+ * Driver performance when operating on float32 data but performing
+ * calculations with range and/or precision as low as that of the IEEE
+ * 754 16-bit floating-point format.
+ */
+ PerformanceInfo relaxedFloat32toFloat16PerformanceScalar;
+ PerformanceInfo relaxedFloat32toFloat16PerformanceTensor;
+
+ /**
+ * Driver performance when operating on a particular data type.
+ * In the case of float32 data, this is used when the calculations
+ * are not relaxed.
+ */
+ struct OperandPerformance {
+ OperandType type;
+ PerformanceInfo info;
+ };
+
+ /**
+ * Performance by operand type. Must be sorted by OperandType.
+ * If a particular OperandType is not present in operandPerformance,
+ * its performance is treated as { .execTime = FLT_MAX, .powerUsage = FLT_MAX }.
+ */
+ vec<OperandPerformance> operandPerformance;
+};
+
+/**
* Describes one operation of the model's graph.
*/
struct Operation {
@@ -4814,7 +5001,7 @@
/**
* The extension name.
*
- * See {@link Extension::name}.
+ * See {@link Extension::name} for the format specification.
*/
string name;
@@ -5098,7 +5285,11 @@
/**
* The extension name.
*
+ * The name must consist of lowercase latin letters, numbers, periods, and
+ * underscore signs. The name must contain at least one period.
+ *
* The name must start with the reverse domain name of the vendor.
+ *
* Example: com.google.test_extension
*/
string name;
diff --git a/neuralnetworks/1.2/vts/functional/BasicTests.cpp b/neuralnetworks/1.2/vts/functional/BasicTests.cpp
index 2b88edd..5c269df 100644
--- a/neuralnetworks/1.2/vts/functional/BasicTests.cpp
+++ b/neuralnetworks/1.2/vts/functional/BasicTests.cpp
@@ -25,7 +25,7 @@
namespace vts {
namespace functional {
-using V1_1::Capabilities;
+using V1_0::PerformanceInfo;
// create device test
TEST_F(NeuralnetworksHidlTest, CreateDevice) {}
@@ -37,6 +37,31 @@
EXPECT_EQ(DeviceStatus::AVAILABLE, static_cast<DeviceStatus>(status));
}
+// initialization
+TEST_F(NeuralnetworksHidlTest, GetCapabilitiesTest) {
+ using OperandPerformance = Capabilities::OperandPerformance;
+ Return<void> ret = device->getCapabilities_1_2([](ErrorStatus status,
+ const Capabilities& capabilities) {
+ EXPECT_EQ(ErrorStatus::NONE, status);
+
+ auto isPositive = [](const PerformanceInfo& perf) {
+ return perf.execTime > 0.0f && perf.powerUsage > 0.0f;
+ };
+
+ EXPECT_TRUE(isPositive(capabilities.relaxedFloat32toFloat16PerformanceScalar));
+ EXPECT_TRUE(isPositive(capabilities.relaxedFloat32toFloat16PerformanceTensor));
+ const auto& opPerf = capabilities.operandPerformance;
+ EXPECT_TRUE(std::all_of(
+ opPerf.begin(), opPerf.end(),
+ [isPositive](const OperandPerformance& a) { return isPositive(a.info); }));
+ EXPECT_TRUE(std::is_sorted(opPerf.begin(), opPerf.end(),
+ [](const OperandPerformance& a, const OperandPerformance& b) {
+ return a.type < b.type;
+ }));
+ });
+ EXPECT_TRUE(ret.isOk());
+}
+
// device version test
TEST_F(NeuralnetworksHidlTest, GetDeviceVersionStringTest) {
Return<void> ret = device->getVersionString([](ErrorStatus status, const hidl_string& version) {
@@ -64,7 +89,12 @@
for (auto& extension : extensions) {
std::string extensionName = extension.name;
EXPECT_FALSE(extensionName.empty());
- EXPECT_NE(extensionName.find("."), std::string::npos)
+ for (char c : extensionName) {
+ EXPECT_TRUE(('a' <= c && c <= 'z') || ('0' <= c && c <= '9') || c == '_' ||
+ c == '.')
+ << "Extension name contains an illegal character: " << c;
+ }
+ EXPECT_NE(extensionName.find('.'), std::string::npos)
<< "Extension name must start with the reverse domain name of the "
"vendor";
}
@@ -72,10 +102,15 @@
EXPECT_TRUE(ret.isOk());
}
-// isCachingSupported test
-TEST_F(NeuralnetworksHidlTest, IsCachingSupported) {
- Return<void> ret = device->isCachingSupported(
- [](ErrorStatus status, bool) { EXPECT_EQ(ErrorStatus::NONE, status); });
+// getNumberOfCacheFilesNeeded test
+TEST_F(NeuralnetworksHidlTest, getNumberOfCacheFilesNeeded) {
+ Return<void> ret = device->getNumberOfCacheFilesNeeded(
+ [](ErrorStatus status, uint32_t numModelCache, uint32_t numDataCache) {
+ EXPECT_EQ(ErrorStatus::NONE, status);
+ EXPECT_LE(numModelCache,
+ static_cast<uint32_t>(Constant::MAX_NUMBER_OF_CACHE_FILES));
+ EXPECT_LE(numDataCache, static_cast<uint32_t>(Constant::MAX_NUMBER_OF_CACHE_FILES));
+ });
EXPECT_TRUE(ret.isOk());
}
} // namespace functional
diff --git a/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp
index 00989e5..167fc09 100644
--- a/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp
+++ b/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp
@@ -54,29 +54,39 @@
[[maybe_unused]] auto dummy_createTestModel = createTestModel_dynamic_output_shape;
[[maybe_unused]] auto dummy_get_examples = get_examples_dynamic_output_shape;
-enum class AccessMode { READ_ONLY, WRITE_ONLY };
+enum class AccessMode { READ_WRITE, READ_ONLY, WRITE_ONLY };
-void createCacheHandle(const std::vector<std::string>& files, AccessMode mode,
- hidl_handle* handle) {
- std::vector<int> fds;
- for (const auto& file : files) {
- int fd;
- if (mode == AccessMode::READ_ONLY) {
- fd = open(file.c_str(), O_RDONLY);
- } else if (mode == AccessMode::WRITE_ONLY) {
- fd = open(file.c_str(), O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR);
- } else {
- FAIL();
+// Creates cache handles based on provided file groups.
+// The outer vector corresponds to handles and the inner vector is for fds held by each handle.
+void createCacheHandles(const std::vector<std::vector<std::string>>& fileGroups,
+ const std::vector<AccessMode>& mode, hidl_vec<hidl_handle>* handles) {
+ handles->resize(fileGroups.size());
+ for (uint32_t i = 0; i < fileGroups.size(); i++) {
+ std::vector<int> fds;
+ for (const auto& file : fileGroups[i]) {
+ int fd;
+ if (mode[i] == AccessMode::READ_ONLY) {
+ fd = open(file.c_str(), O_RDONLY);
+ } else if (mode[i] == AccessMode::WRITE_ONLY) {
+ fd = open(file.c_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
+ } else if (mode[i] == AccessMode::READ_WRITE) {
+ fd = open(file.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ } else {
+ FAIL();
+ }
+ ASSERT_GE(fd, 0);
+ fds.push_back(fd);
}
- ASSERT_GE(fd, 0);
- fds.push_back(fd);
+ native_handle_t* cacheNativeHandle = native_handle_create(fds.size(), 0);
+ ASSERT_NE(cacheNativeHandle, nullptr);
+ std::copy(fds.begin(), fds.end(), &cacheNativeHandle->data[0]);
+ (*handles)[i].setTo(cacheNativeHandle, /*shouldOwn=*/true);
}
- native_handle_t* cacheNativeHandle = native_handle_create(fds.size(), 0);
- ASSERT_NE(cacheNativeHandle, nullptr);
- for (uint32_t i = 0; i < fds.size(); i++) {
- cacheNativeHandle->data[i] = fds[i];
- }
- handle->setTo(cacheNativeHandle, /*shouldOwn=*/true);
+}
+
+void createCacheHandles(const std::vector<std::vector<std::string>>& fileGroups, AccessMode mode,
+ hidl_vec<hidl_handle>* handles) {
+ createCacheHandles(fileGroups, std::vector<AccessMode>(fileGroups.size(), mode), handles);
}
} // namespace
@@ -88,38 +98,43 @@
NeuralnetworksHidlTest::SetUp();
ASSERT_NE(device.get(), nullptr);
- // Create cache directory. The cache directory and cache files are always created to test
- // the behavior of prepareModelFromCache, even when caching is not supported.
+ // Create cache directory. The cache directory and a temporary cache file is always created
+ // to test the behavior of prepareModelFromCache, even when caching is not supported.
char cacheDirTemp[] = "/data/local/tmp/TestCompilationCachingXXXXXX";
char* cacheDir = mkdtemp(cacheDirTemp);
ASSERT_NE(cacheDir, nullptr);
mCacheDir = cacheDir;
+ mCacheDir.push_back('/');
- // Create empty cache files.
- mCache1 = mCacheDir + "/cache1";
- mCache2 = mCacheDir + "/cache2";
- mCache3 = mCacheDir + "/cache3";
- // A dummy handle, use AccessMode::WRITE_ONLY for createCacheHandle to create files.
- hidl_handle handle;
- createCacheHandle({mCache1, mCache2, mCache3}, AccessMode::WRITE_ONLY, &handle);
-
- // Check if caching is supported.
- bool isCachingSupported;
- Return<void> ret = device->isCachingSupported(
- [&isCachingSupported](ErrorStatus status, bool supported) {
+ Return<void> ret = device->getNumberOfCacheFilesNeeded(
+ [this](ErrorStatus status, uint32_t numModelCache, uint32_t numDataCache) {
EXPECT_EQ(ErrorStatus::NONE, status);
- isCachingSupported = supported;
+ mNumModelCache = numModelCache;
+ mNumDataCache = numDataCache;
});
EXPECT_TRUE(ret.isOk());
- if (isCachingSupported) {
- mIsCachingSupported = true;
- } else {
+ mIsCachingSupported = mNumModelCache > 0 || mNumDataCache > 0;
+
+ // Create empty cache files.
+ mTmpCache = mCacheDir + "tmp";
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ mModelCache.push_back({mCacheDir + "model" + std::to_string(i)});
+ }
+ for (uint32_t i = 0; i < mNumDataCache; i++) {
+ mDataCache.push_back({mCacheDir + "data" + std::to_string(i)});
+ }
+ // Dummy handles, use AccessMode::WRITE_ONLY for createCacheHandles to create files.
+ hidl_vec<hidl_handle> modelHandle, dataHandle, tmpHandle;
+ createCacheHandles(mModelCache, AccessMode::WRITE_ONLY, &modelHandle);
+ createCacheHandles(mDataCache, AccessMode::WRITE_ONLY, &dataHandle);
+ createCacheHandles({{mTmpCache}}, AccessMode::WRITE_ONLY, &tmpHandle);
+
+ if (!mIsCachingSupported) {
LOG(INFO) << "NN VTS: Early termination of test because vendor service does not "
"support compilation caching.";
std::cout << "[ ] Early termination of test because vendor service does not "
"support compilation caching."
<< std::endl;
- mIsCachingSupported = false;
}
}
@@ -127,22 +142,49 @@
// The tmp directory is only removed when the driver reports caching not supported,
// otherwise it is kept for debugging purpose.
if (!mIsCachingSupported) {
- remove(mCache1.c_str());
- remove(mCache2.c_str());
- remove(mCache3.c_str());
+ remove(mTmpCache.c_str());
rmdir(mCacheDir.c_str());
}
NeuralnetworksHidlTest::TearDown();
}
- void saveModelToCache(sp<IPreparedModel> preparedModel, const hidl_handle& cache1,
- const hidl_handle& cache2, ErrorStatus* status) {
- // Save IPreparedModel to cache.
+ void saveModelToCache(const V1_2::Model& model, const hidl_vec<hidl_handle>& modelCache,
+ const hidl_vec<hidl_handle>& dataCache, bool* supported,
+ sp<IPreparedModel>* preparedModel = nullptr) {
+ if (preparedModel != nullptr) *preparedModel = nullptr;
+
+ // See if service can handle model.
+ bool fullySupportsModel = false;
+ Return<void> supportedCall = device->getSupportedOperations_1_2(
+ model,
+ [&fullySupportsModel, &model](ErrorStatus status, const hidl_vec<bool>& supported) {
+ ASSERT_EQ(ErrorStatus::NONE, status);
+ ASSERT_EQ(supported.size(), model.operations.size());
+ fullySupportsModel = std::all_of(supported.begin(), supported.end(),
+ [](bool valid) { return valid; });
+ });
+ ASSERT_TRUE(supportedCall.isOk());
+ *supported = fullySupportsModel;
+ if (!fullySupportsModel) return;
+
+ // Launch prepare model.
+ sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
+ ASSERT_NE(nullptr, preparedModelCallback.get());
hidl_array<uint8_t, sizeof(mToken)> cacheToken(mToken);
- Return<ErrorStatus> saveToCacheStatus =
- preparedModel->saveToCache(cache1, cache2, cacheToken);
- ASSERT_TRUE(saveToCacheStatus.isOk());
- *status = static_cast<ErrorStatus>(saveToCacheStatus);
+ Return<ErrorStatus> prepareLaunchStatus =
+ device->prepareModel_1_2(model, ExecutionPreference::FAST_SINGLE_ANSWER, modelCache,
+ dataCache, cacheToken, preparedModelCallback);
+ ASSERT_TRUE(prepareLaunchStatus.isOk());
+ ASSERT_EQ(static_cast<ErrorStatus>(prepareLaunchStatus), ErrorStatus::NONE);
+
+ // Retrieve prepared model.
+ preparedModelCallback->wait();
+ ASSERT_EQ(preparedModelCallback->getStatus(), ErrorStatus::NONE);
+ if (preparedModel != nullptr) {
+ *preparedModel =
+ V1_2::IPreparedModel::castFrom(preparedModelCallback->getPreparedModel())
+ .withDefault(nullptr);
+ }
}
bool checkEarlyTermination(ErrorStatus status) {
@@ -157,14 +199,27 @@
return false;
}
- void prepareModelFromCache(const hidl_handle& cache1, const hidl_handle& cache2,
+ bool checkEarlyTermination(bool supported) {
+ if (!supported) {
+ LOG(INFO) << "NN VTS: Early termination of test because vendor service cannot "
+ "prepare model that it does not support.";
+ std::cout << "[ ] Early termination of test because vendor service cannot "
+ "prepare model that it does not support."
+ << std::endl;
+ return true;
+ }
+ return false;
+ }
+
+ void prepareModelFromCache(const hidl_vec<hidl_handle>& modelCache,
+ const hidl_vec<hidl_handle>& dataCache,
sp<IPreparedModel>* preparedModel, ErrorStatus* status) {
// Launch prepare model from cache.
sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
ASSERT_NE(nullptr, preparedModelCallback.get());
hidl_array<uint8_t, sizeof(mToken)> cacheToken(mToken);
- Return<ErrorStatus> prepareLaunchStatus =
- device->prepareModelFromCache(cache1, cache2, cacheToken, preparedModelCallback);
+ Return<ErrorStatus> prepareLaunchStatus = device->prepareModelFromCache(
+ modelCache, dataCache, cacheToken, preparedModelCallback);
ASSERT_TRUE(prepareLaunchStatus.isOk());
if (static_cast<ErrorStatus>(prepareLaunchStatus) != ErrorStatus::NONE) {
*preparedModel = nullptr;
@@ -179,49 +234,54 @@
.withDefault(nullptr);
}
+ // Absolute path to the temporary cache directory.
std::string mCacheDir;
- std::string mCache1;
- std::string mCache2;
- std::string mCache3;
+
+ // Groups of file paths for model and data cache in the tmp cache directory, initialized with
+ // outer_size = mNum{Model|Data}Cache, inner_size = 1. The outer vector corresponds to handles
+ // and the inner vector is for fds held by each handle.
+ std::vector<std::vector<std::string>> mModelCache;
+ std::vector<std::vector<std::string>> mDataCache;
+
+ // A separate temporary file path in the tmp cache directory.
+ std::string mTmpCache;
+
uint8_t mToken[static_cast<uint32_t>(Constant::BYTE_SIZE_OF_CACHE_TOKEN)] = {};
- bool mIsCachingSupported;
+ uint32_t mNumModelCache;
+ uint32_t mNumDataCache;
+ uint32_t mIsCachingSupported;
};
TEST_F(CompilationCachingTest, CacheSavingAndRetrieval) {
// Create test HIDL model and compile.
Model testModel = createTestModel();
sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
// Save the compilation to cache.
{
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (!mIsCachingSupported) {
- EXPECT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- } else {
- if (checkEarlyTermination(status)) return;
- ASSERT_EQ(status, ErrorStatus::NONE);
- }
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
}
// Retrieve preparedModel from cache.
{
preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
if (!mIsCachingSupported) {
ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
ASSERT_EQ(preparedModel, nullptr);
return;
+ } else if (checkEarlyTermination(status)) {
+ ASSERT_EQ(preparedModel, nullptr);
+ return;
} else {
ASSERT_EQ(status, ErrorStatus::NONE);
ASSERT_NE(preparedModel, nullptr);
@@ -238,41 +298,54 @@
// Create test HIDL model and compile.
Model testModel = createTestModel();
sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
// Save the compilation to cache.
{
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (!mIsCachingSupported) {
- EXPECT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- } else {
- if (checkEarlyTermination(status)) return;
- ASSERT_EQ(status, ErrorStatus::NONE);
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ uint8_t dummyBytes[] = {0, 0};
+ // Write a dummy integer to the cache.
+ // The driver should be able to handle non-empty cache and non-zero fd offset.
+ for (uint32_t i = 0; i < modelCache.size(); i++) {
+ ASSERT_EQ(write(modelCache[i].getNativeHandle()->data[0], &dummyBytes,
+ sizeof(dummyBytes)),
+ sizeof(dummyBytes));
}
+ for (uint32_t i = 0; i < dataCache.size(); i++) {
+ ASSERT_EQ(
+ write(dataCache[i].getNativeHandle()->data[0], &dummyBytes, sizeof(dummyBytes)),
+ sizeof(dummyBytes));
+ }
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
}
// Retrieve preparedModel from cache.
{
preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
uint8_t dummyByte = 0;
- // Advance offset by one byte.
- ASSERT_GE(read(cache1.getNativeHandle()->data[0], &dummyByte, 1), 0);
- ASSERT_GE(read(cache2.getNativeHandle()->data[0], &dummyByte, 1), 0);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
+ // Advance the offset of each handle by one byte.
+ // The driver should be able to handle non-zero fd offset.
+ for (uint32_t i = 0; i < modelCache.size(); i++) {
+ ASSERT_GE(read(modelCache[i].getNativeHandle()->data[0], &dummyByte, 1), 0);
+ }
+ for (uint32_t i = 0; i < dataCache.size(); i++) {
+ ASSERT_GE(read(dataCache[i].getNativeHandle()->data[0], &dummyByte, 1), 0);
+ }
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
if (!mIsCachingSupported) {
ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
ASSERT_EQ(preparedModel, nullptr);
return;
+ } else if (checkEarlyTermination(status)) {
+ ASSERT_EQ(preparedModel, nullptr);
+ return;
} else {
ASSERT_EQ(status, ErrorStatus::NONE);
ASSERT_NE(preparedModel, nullptr);
@@ -285,234 +358,512 @@
/*testDynamicOutputShape=*/false);
}
+TEST_F(CompilationCachingTest, SaveToCacheInvalidNumCache) {
+ // Create test HIDL model and compile.
+ Model testModel = createTestModel();
+
+ // Test with number of model cache files greater than mNumModelCache.
+ {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pass an additional cache file for model cache.
+ mModelCache.push_back({mTmpCache});
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache.pop_back();
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
+ ErrorStatus status;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Test with number of model cache files smaller than mNumModelCache.
+ if (mModelCache.size() > 0) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pop out the last cache file.
+ auto tmp = mModelCache.back();
+ mModelCache.pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache.push_back(tmp);
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
+ ErrorStatus status;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Test with number of data cache files greater than mNumDataCache.
+ {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pass an additional cache file for data cache.
+ mDataCache.push_back({mTmpCache});
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache.pop_back();
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
+ ErrorStatus status;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Test with number of data cache files smaller than mNumDataCache.
+ if (mDataCache.size() > 0) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pop out the last cache file.
+ auto tmp = mDataCache.back();
+ mDataCache.pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache.push_back(tmp);
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
+ ErrorStatus status;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+}
+
+TEST_F(CompilationCachingTest, PrepareModelFromCacheInvalidNumCache) {
+ // Create test HIDL model and compile.
+ Model testModel = createTestModel();
+
+ // Save the compilation to cache.
+ {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
+ }
+
+ // Test with number of model cache files greater than mNumModelCache.
+ {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ mModelCache.push_back({mTmpCache});
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache.pop_back();
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::GENERAL_FAILURE) {
+ ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Test with number of model cache files smaller than mNumModelCache.
+ if (mModelCache.size() > 0) {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ auto tmp = mModelCache.back();
+ mModelCache.pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache.push_back(tmp);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::GENERAL_FAILURE) {
+ ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Test with number of data cache files greater than mNumDataCache.
+ {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ mDataCache.push_back({mTmpCache});
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache.pop_back();
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::GENERAL_FAILURE) {
+ ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Test with number of data cache files smaller than mNumDataCache.
+ if (mDataCache.size() > 0) {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ auto tmp = mDataCache.back();
+ mDataCache.pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache.push_back(tmp);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::GENERAL_FAILURE) {
+ ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+}
+
TEST_F(CompilationCachingTest, SaveToCacheInvalidNumFd) {
// Create test HIDL model and compile.
Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
- // cache1 with invalid NumFd.
- {
+ // Go through each handle in model cache, test with NumFd greater than 1.
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pass an invalid number of fds for handle i.
+ mModelCache[i].push_back(mTmpCache);
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache[i].pop_back();
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1, mCache3}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (status != ErrorStatus::GENERAL_FAILURE) {
- ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
}
+ ASSERT_EQ(preparedModel, nullptr);
}
- // cache2 with invalid NumFd.
- {
+ // Go through each handle in model cache, test with NumFd equal to 0.
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pass an invalid number of fds for handle i.
+ auto tmp = mModelCache[i].back();
+ mModelCache[i].pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache[i].push_back(tmp);
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2, mCache3}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (status != ErrorStatus::GENERAL_FAILURE) {
- ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
}
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Go through each handle in data cache, test with NumFd greater than 1.
+ for (uint32_t i = 0; i < mNumDataCache; i++) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pass an invalid number of fds for handle i.
+ mDataCache[i].push_back(mTmpCache);
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache[i].pop_back();
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
+ ErrorStatus status;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Go through each handle in data cache, test with NumFd equal to 0.
+ for (uint32_t i = 0; i < mNumDataCache; i++) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ // Pass an invalid number of fds for handle i.
+ auto tmp = mDataCache[i].back();
+ mDataCache[i].pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache[i].push_back(tmp);
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
+ ErrorStatus status;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
}
}
TEST_F(CompilationCachingTest, PrepareModelFromCacheInvalidNumFd) {
// Create test HIDL model and compile.
Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
// Save the compilation to cache.
{
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (status != ErrorStatus::GENERAL_FAILURE) {
- ASSERT_EQ(status, ErrorStatus::NONE);
- }
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
}
- // cache1 with invalid NumFd.
- {
- preparedModel = nullptr;
+ // Go through each handle in model cache, test with NumFd greater than 1.
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ sp<IPreparedModel> preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1, mCache3}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ mModelCache[i].push_back(mTmpCache);
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache[i].pop_back();
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
if (status != ErrorStatus::GENERAL_FAILURE) {
ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
- ASSERT_EQ(preparedModel, nullptr);
}
+ ASSERT_EQ(preparedModel, nullptr);
}
- // cache2 with invalid NumFd.
- {
- preparedModel = nullptr;
+ // Go through each handle in model cache, test with NumFd equal to 0.
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ sp<IPreparedModel> preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2, mCache3}, AccessMode::READ_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ auto tmp = mModelCache[i].back();
+ mModelCache[i].pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mModelCache[i].push_back(tmp);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
if (status != ErrorStatus::GENERAL_FAILURE) {
ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
- ASSERT_EQ(preparedModel, nullptr);
}
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Go through each handle in data cache, test with NumFd greater than 1.
+ for (uint32_t i = 0; i < mNumDataCache; i++) {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ mDataCache[i].push_back(mTmpCache);
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache[i].pop_back();
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::GENERAL_FAILURE) {
+ ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
+ }
+
+ // Go through each handle in data cache, test with NumFd equal to 0.
+ for (uint32_t i = 0; i < mNumDataCache; i++) {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ auto tmp = mDataCache[i].back();
+ mDataCache[i].pop_back();
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ mDataCache[i].push_back(tmp);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::GENERAL_FAILURE) {
+ ASSERT_EQ(status, ErrorStatus::INVALID_ARGUMENT);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
}
}
TEST_F(CompilationCachingTest, SaveToCacheInvalidAccessMode) {
// Create test HIDL model and compile.
Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
+ std::vector<AccessMode> modelCacheMode(mNumModelCache, AccessMode::READ_WRITE);
+ std::vector<AccessMode> dataCacheMode(mNumDataCache, AccessMode::READ_WRITE);
- // cache1 with invalid access mode.
- {
+ // Go through each handle in model cache, test with invalid access mode.
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ modelCacheMode[i] = AccessMode::READ_ONLY;
+ createCacheHandles(mModelCache, modelCacheMode, &modelCache);
+ createCacheHandles(mDataCache, dataCacheMode, &dataCache);
+ modelCacheMode[i] = AccessMode::READ_WRITE;
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
}
- // cache2 with invalid access mode.
- {
+ // Go through each handle in data cache, test with invalid access mode.
+ for (uint32_t i = 0; i < mNumDataCache; i++) {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ dataCacheMode[i] = AccessMode::READ_ONLY;
+ createCacheHandles(mModelCache, modelCacheMode, &modelCache);
+ createCacheHandles(mDataCache, dataCacheMode, &dataCache);
+ dataCacheMode[i] = AccessMode::READ_WRITE;
+ sp<IPreparedModel> preparedModel = nullptr;
+ saveModelToCache(testModel, modelCache, dataCache, &supported, &preparedModel);
+ if (checkEarlyTermination(supported)) return;
+ ASSERT_NE(preparedModel, nullptr);
+ // Execute and verify results.
+ generated_tests::EvaluatePreparedModel(preparedModel, [](int) { return false; },
+ get_examples(),
+ testModel.relaxComputationFloat32toFloat16,
+ /*testDynamicOutputShape=*/false);
+ // Check if prepareModelFromCache fails.
+ preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ if (status != ErrorStatus::INVALID_ARGUMENT) {
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ }
+ ASSERT_EQ(preparedModel, nullptr);
}
}
TEST_F(CompilationCachingTest, PrepareModelFromCacheInvalidAccessMode) {
// Create test HIDL model and compile.
Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
+ std::vector<AccessMode> modelCacheMode(mNumModelCache, AccessMode::READ_WRITE);
+ std::vector<AccessMode> dataCacheMode(mNumDataCache, AccessMode::READ_WRITE);
// Save the compilation to cache.
{
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (status != ErrorStatus::GENERAL_FAILURE) {
- ASSERT_EQ(status, ErrorStatus::NONE);
- }
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
}
- // cache1 with invalid access mode.
- {
- preparedModel = nullptr;
+ // Go through each handle in model cache, test with invalid access mode.
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ sp<IPreparedModel> preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ modelCacheMode[i] = AccessMode::WRITE_ONLY;
+ createCacheHandles(mModelCache, modelCacheMode, &modelCache);
+ createCacheHandles(mDataCache, dataCacheMode, &dataCache);
+ modelCacheMode[i] = AccessMode::READ_WRITE;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
ASSERT_EQ(preparedModel, nullptr);
}
- // cache2 with invalid access mode.
- {
- preparedModel = nullptr;
+ // Go through each handle in data cache, test with invalid access mode.
+ for (uint32_t i = 0; i < mNumDataCache; i++) {
+ sp<IPreparedModel> preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ dataCacheMode[i] = AccessMode::WRITE_ONLY;
+ createCacheHandles(mModelCache, modelCacheMode, &modelCache);
+ createCacheHandles(mDataCache, dataCacheMode, &dataCache);
+ dataCacheMode[i] = AccessMode::READ_WRITE;
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
ASSERT_EQ(preparedModel, nullptr);
}
}
-TEST_F(CompilationCachingTest, SaveToCacheInvalidOffset) {
- // Create test HIDL model and compile.
- Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
-
- // cache1 with invalid file descriptor offset.
- {
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- uint8_t dummyByte = 0;
- // Advance offset by one byte.
- ASSERT_EQ(write(cache1.getNativeHandle()->data[0], &dummyByte, 1), 1);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- }
-
- // cache2 with invalid file descriptor offset.
- {
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- uint8_t dummyByte = 0;
- // Advance offset by one byte.
- ASSERT_EQ(write(cache2.getNativeHandle()->data[0], &dummyByte, 1), 1);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- }
-}
-
-TEST_F(CompilationCachingTest, SaveToCacheInvalidFileSize) {
- // Create test HIDL model and compile.
- Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
-
- // cache1 with invalid file size.
- {
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- uint8_t dummyByte = 0;
- // Write one byte and seek back to the beginning.
- ASSERT_EQ(write(cache1.getNativeHandle()->data[0], &dummyByte, 1), 1);
- ASSERT_EQ(lseek(cache1.getNativeHandle()->data[0], 0, SEEK_SET), 0);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- }
-
- // cache2 with invalid file size.
- {
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- uint8_t dummyByte = 0;
- // Write one byte and seek back to the beginning.
- ASSERT_EQ(write(cache2.getNativeHandle()->data[0], &dummyByte, 1), 1);
- ASSERT_EQ(lseek(cache2.getNativeHandle()->data[0], 0, SEEK_SET), 0);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- }
-}
-
class CompilationCachingSecurityTest : public CompilationCachingTest,
public ::testing::WithParamInterface<uint32_t> {
protected:
@@ -537,44 +888,44 @@
// Create test HIDL model and compile.
Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
- // Save the compilation to cache.
- {
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (checkEarlyTermination(status)) return;
- ASSERT_EQ(status, ErrorStatus::NONE);
- }
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ // Save the compilation to cache.
+ {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
+ }
- // Randomly flip one single bit of the cache entry.
- FILE* pFile = fopen(mCache1.c_str(), "r+");
- ASSERT_EQ(fseek(pFile, 0, SEEK_END), 0);
- long int fileSize = ftell(pFile);
- ASSERT_GT(fileSize, 0);
- ASSERT_EQ(fseek(pFile, getRandomInt(0l, fileSize - 1), SEEK_SET), 0);
- int readByte = fgetc(pFile);
- ASSERT_NE(readByte, EOF);
- ASSERT_EQ(fseek(pFile, -1, SEEK_CUR), 0);
- ASSERT_NE(fputc(static_cast<uint8_t>(readByte) ^ (1U << getRandomInt(0, 7)), pFile), EOF);
- fclose(pFile);
+ // Randomly flip one single bit of the cache entry.
+ FILE* pFile = fopen(mModelCache[i][0].c_str(), "r+");
+ ASSERT_EQ(fseek(pFile, 0, SEEK_END), 0);
+ long int fileSize = ftell(pFile);
+ if (fileSize == 0) {
+ fclose(pFile);
+ continue;
+ }
+ ASSERT_EQ(fseek(pFile, getRandomInt(0l, fileSize - 1), SEEK_SET), 0);
+ int readByte = fgetc(pFile);
+ ASSERT_NE(readByte, EOF);
+ ASSERT_EQ(fseek(pFile, -1, SEEK_CUR), 0);
+ ASSERT_NE(fputc(static_cast<uint8_t>(readByte) ^ (1U << getRandomInt(0, 7)), pFile), EOF);
+ fclose(pFile);
- // Retrieve preparedModel from cache, expect failure.
- {
- preparedModel = nullptr;
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- ASSERT_EQ(preparedModel, nullptr);
+ // Retrieve preparedModel from cache, expect failure.
+ {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ ASSERT_EQ(preparedModel, nullptr);
+ }
}
}
@@ -583,40 +934,37 @@
// Create test HIDL model and compile.
Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
- // Save the compilation to cache.
- {
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (checkEarlyTermination(status)) return;
- ASSERT_EQ(status, ErrorStatus::NONE);
- }
+ for (uint32_t i = 0; i < mNumModelCache; i++) {
+ // Save the compilation to cache.
+ {
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
+ }
- // Randomly append bytes to the cache entry.
- FILE* pFile = fopen(mCache1.c_str(), "a");
- uint32_t appendLength = getRandomInt(1, 256);
- for (uint32_t i = 0; i < appendLength; i++) {
- ASSERT_NE(fputc(getRandomInt<uint8_t>(0, 255), pFile), EOF);
- }
- fclose(pFile);
+ // Randomly append bytes to the cache entry.
+ FILE* pFile = fopen(mModelCache[i][0].c_str(), "a");
+ uint32_t appendLength = getRandomInt(1, 256);
+ for (uint32_t i = 0; i < appendLength; i++) {
+ ASSERT_NE(fputc(getRandomInt<uint8_t>(0, 255), pFile), EOF);
+ }
+ fclose(pFile);
- // Retrieve preparedModel from cache, expect failure.
- {
- preparedModel = nullptr;
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
- ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
- ASSERT_EQ(preparedModel, nullptr);
+ // Retrieve preparedModel from cache, expect failure.
+ {
+ sp<IPreparedModel> preparedModel = nullptr;
+ ErrorStatus status;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
+ ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
+ ASSERT_EQ(preparedModel, nullptr);
+ }
}
}
@@ -625,20 +973,15 @@
// Create test HIDL model and compile.
Model testModel = createTestModel();
- sp<IPreparedModel> preparedModel = nullptr;
- generated_tests::PrepareModel(device, testModel, &preparedModel);
- // Terminate early if the driver cannot prepare the model.
- if (preparedModel == nullptr) return;
// Save the compilation to cache.
{
- ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::WRITE_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::WRITE_ONLY, &cache2);
- saveModelToCache(preparedModel, cache1, cache2, &status);
- if (checkEarlyTermination(status)) return;
- ASSERT_EQ(status, ErrorStatus::NONE);
+ bool supported;
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ saveModelToCache(testModel, modelCache, dataCache, &supported);
+ if (checkEarlyTermination(supported)) return;
}
// Randomly flip one single bit in mToken.
@@ -647,12 +990,12 @@
// Retrieve the preparedModel from cache, expect failure.
{
- preparedModel = nullptr;
+ sp<IPreparedModel> preparedModel = nullptr;
ErrorStatus status;
- hidl_handle cache1, cache2;
- createCacheHandle({mCache1}, AccessMode::READ_ONLY, &cache1);
- createCacheHandle({mCache2}, AccessMode::READ_ONLY, &cache2);
- prepareModelFromCache(cache1, cache2, &preparedModel, &status);
+ hidl_vec<hidl_handle> modelCache, dataCache;
+ createCacheHandles(mModelCache, AccessMode::READ_WRITE, &modelCache);
+ createCacheHandles(mDataCache, AccessMode::READ_WRITE, &dataCache);
+ prepareModelFromCache(modelCache, dataCache, &preparedModel, &status);
ASSERT_EQ(status, ErrorStatus::GENERAL_FAILURE);
ASSERT_EQ(preparedModel, nullptr);
}
diff --git a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
index 7f4d385..dc452e9 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
@@ -33,6 +33,7 @@
using ::android::hardware::neuralnetworks::V1_2::implementation::ExecutionCallback;
using ::android::hardware::neuralnetworks::V1_2::implementation::PreparedModelCallback;
+using HidlToken = hidl_array<uint8_t, static_cast<uint32_t>(Constant::BYTE_SIZE_OF_CACHE_TOKEN)>;
///////////////////////// UTILITY FUNCTIONS /////////////////////////
@@ -54,7 +55,8 @@
sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
ASSERT_NE(nullptr, preparedModelCallback.get());
Return<ErrorStatus> prepareLaunchStatus =
- device->prepareModel_1_2(model, preference, preparedModelCallback);
+ device->prepareModel_1_2(model, preference, hidl_vec<hidl_handle>(),
+ hidl_vec<hidl_handle>(), HidlToken(), preparedModelCallback);
ASSERT_TRUE(prepareLaunchStatus.isOk());
ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(prepareLaunchStatus));
@@ -388,8 +390,9 @@
case OperationType::GROUPED_CONV_2D:
case OperationType::DEPTHWISE_CONV_2D:
case OperationType::CONV_2D: {
- if (operand == 1 && (type == OperandType::TENSOR_QUANT8_ASYMM ||
- type == OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL)) {
+ if (operand == operation.inputs[1] &&
+ (type == OperandType::TENSOR_QUANT8_ASYMM ||
+ type == OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL)) {
return true;
}
} break;
diff --git a/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp b/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
index d411da4..b15f657 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
@@ -37,6 +37,7 @@
using ::android::hardware::neuralnetworks::V1_2::implementation::ExecutionCallback;
using ::android::hardware::neuralnetworks::V1_2::implementation::PreparedModelCallback;
using ::android::hidl::memory::V1_0::IMemory;
+using HidlToken = hidl_array<uint8_t, static_cast<uint32_t>(Constant::BYTE_SIZE_OF_CACHE_TOKEN)>;
using test_helper::for_all;
using test_helper::MixedTyped;
using test_helper::MixedTypedExample;
@@ -66,7 +67,8 @@
sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
ASSERT_NE(nullptr, preparedModelCallback.get());
Return<ErrorStatus> prepareLaunchStatus = device->prepareModel_1_2(
- model, ExecutionPreference::FAST_SINGLE_ANSWER, preparedModelCallback);
+ model, ExecutionPreference::FAST_SINGLE_ANSWER, hidl_vec<hidl_handle>(),
+ hidl_vec<hidl_handle>(), HidlToken(), preparedModelCallback);
ASSERT_TRUE(prepareLaunchStatus.isOk());
ASSERT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(prepareLaunchStatus));
diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp
index f821355..e0625d0 100644
--- a/nfc/1.0/Android.bp
+++ b/nfc/1.0/Android.bp
@@ -14,10 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "NfcEvent",
- "NfcStatus",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/nfc/1.1/Android.bp b/nfc/1.1/Android.bp
index 9a1392e..bbf49b2 100644
--- a/nfc/1.1/Android.bp
+++ b/nfc/1.1/Android.bp
@@ -15,13 +15,6 @@
"android.hardware.nfc@1.0",
"android.hidl.base@1.0",
],
- types: [
- "Constant",
- "NfcConfig",
- "NfcEvent",
- "PresenceCheckAlgorithm",
- "ProtocolDiscoveryConfig",
- ],
gen_java: true,
}
diff --git a/nfc/1.2/Android.bp b/nfc/1.2/Android.bp
index c338e02..cfb8b85 100644
--- a/nfc/1.2/Android.bp
+++ b/nfc/1.2/Android.bp
@@ -15,9 +15,6 @@
"android.hardware.nfc@1.1",
"android.hidl.base@1.0",
],
- types: [
- "NfcConfig",
- ],
gen_java: true,
}
diff --git a/oemlock/1.0/Android.bp b/oemlock/1.0/Android.bp
index c4ad989..894188b 100644
--- a/oemlock/1.0/Android.bp
+++ b/oemlock/1.0/Android.bp
@@ -13,10 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "OemLockSecureStatus",
- "OemLockStatus",
- ],
gen_java: true,
}
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
index 92c9483..dbc0a36 100644
--- a/power/1.0/Android.bp
+++ b/power/1.0/Android.bp
@@ -13,13 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Feature",
- "PowerHint",
- "PowerStatePlatformSleepState",
- "PowerStateVoter",
- "Status",
- ],
gen_java: true,
}
diff --git a/power/1.1/Android.bp b/power/1.1/Android.bp
index d1d8021..de55396 100644
--- a/power/1.1/Android.bp
+++ b/power/1.1/Android.bp
@@ -14,10 +14,6 @@
"android.hardware.power@1.0",
"android.hidl.base@1.0",
],
- types: [
- "PowerStateSubsystem",
- "PowerStateSubsystemSleepState",
- ],
gen_java: true,
}
diff --git a/power/1.2/Android.bp b/power/1.2/Android.bp
index 0eb73e7..284e736 100644
--- a/power/1.2/Android.bp
+++ b/power/1.2/Android.bp
@@ -15,9 +15,6 @@
"android.hardware.power@1.1",
"android.hidl.base@1.0",
],
- types: [
- "PowerHint",
- ],
gen_java: true,
}
diff --git a/power/1.3/Android.bp b/power/1.3/Android.bp
index 1869b56..320f1e6 100644
--- a/power/1.3/Android.bp
+++ b/power/1.3/Android.bp
@@ -16,9 +16,6 @@
"android.hardware.power@1.2",
"android.hidl.base@1.0",
],
- types: [
- "PowerHint",
- ],
gen_java: true,
}
diff --git a/power/stats/1.0/Android.bp b/power/stats/1.0/Android.bp
index 9a956e4..9cf24cf 100644
--- a/power/stats/1.0/Android.bp
+++ b/power/stats/1.0/Android.bp
@@ -13,17 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "EnergyData",
- "PowerEntityInfo",
- "PowerEntityStateInfo",
- "PowerEntityStateResidencyData",
- "PowerEntityStateResidencyResult",
- "PowerEntityStateSpace",
- "PowerEntityType",
- "RailInfo",
- "Status",
- ],
gen_java: false,
}
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
index 72a3ca6..f023471 100644
--- a/radio/1.0/Android.bp
+++ b/radio/1.0/Android.bp
@@ -17,162 +17,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "ActivityStatsInfo",
- "ApnAuthType",
- "ApnTypes",
- "AppState",
- "AppStatus",
- "AppType",
- "Call",
- "CallForwardInfo",
- "CallForwardInfoStatus",
- "CallPresentation",
- "CallState",
- "CardState",
- "CardStatus",
- "Carrier",
- "CarrierMatchType",
- "CarrierRestrictions",
- "CdmaBroadcastSmsConfigInfo",
- "CdmaCallWaiting",
- "CdmaCallWaitingNumberPlan",
- "CdmaCallWaitingNumberPresentation",
- "CdmaCallWaitingNumberType",
- "CdmaDisplayInfoRecord",
- "CdmaInfoRecName",
- "CdmaInformationRecord",
- "CdmaInformationRecords",
- "CdmaLineControlInfoRecord",
- "CdmaNumberInfoRecord",
- "CdmaOtaProvisionStatus",
- "CdmaRedirectingNumberInfoRecord",
- "CdmaRedirectingReason",
- "CdmaRoamingType",
- "CdmaSignalInfoRecord",
- "CdmaSignalStrength",
- "CdmaSmsAck",
- "CdmaSmsAddress",
- "CdmaSmsDigitMode",
- "CdmaSmsErrorClass",
- "CdmaSmsMessage",
- "CdmaSmsNumberMode",
- "CdmaSmsNumberPlan",
- "CdmaSmsNumberType",
- "CdmaSmsSubaddress",
- "CdmaSmsSubaddressType",
- "CdmaSmsWriteArgs",
- "CdmaSmsWriteArgsStatus",
- "CdmaSubscriptionSource",
- "CdmaT53AudioControlInfoRecord",
- "CdmaT53ClirInfoRecord",
- "CellIdentity",
- "CellIdentityCdma",
- "CellIdentityGsm",
- "CellIdentityLte",
- "CellIdentityTdscdma",
- "CellIdentityWcdma",
- "CellInfo",
- "CellInfoCdma",
- "CellInfoGsm",
- "CellInfoLte",
- "CellInfoTdscdma",
- "CellInfoType",
- "CellInfoWcdma",
- "CfData",
- "ClipStatus",
- "Clir",
- "DataCallFailCause",
- "DataProfileId",
- "DataProfileInfo",
- "DataProfileInfoType",
- "DataRegStateResult",
- "DeviceStateType",
- "Dial",
- "EvdoSignalStrength",
- "GsmBroadcastSmsConfigInfo",
- "GsmSignalStrength",
- "GsmSmsMessage",
- "HardwareConfig",
- "HardwareConfigModem",
- "HardwareConfigSim",
- "HardwareConfigState",
- "HardwareConfigType",
- "IccIo",
- "IccIoResult",
- "ImsSmsMessage",
- "IndicationFilter",
- "LastCallFailCause",
- "LastCallFailCauseInfo",
- "LceDataInfo",
- "LceStatus",
- "LceStatusInfo",
- "LteSignalStrength",
- "MvnoType",
- "NeighboringCell",
- "NvItem",
- "NvWriteItem",
- "OperatorInfo",
- "OperatorStatus",
- "P2Constant",
- "PcoDataInfo",
- "PersoSubstate",
- "PhoneRestrictedState",
- "PinState",
- "PreferredNetworkType",
- "RadioAccessFamily",
- "RadioBandMode",
- "RadioCapability",
- "RadioCapabilityPhase",
- "RadioCapabilityStatus",
- "RadioCdmaSmsConst",
- "RadioConst",
- "RadioError",
- "RadioIndicationType",
- "RadioResponseInfo",
- "RadioResponseType",
- "RadioState",
- "RadioTechnology",
- "RadioTechnologyFamily",
- "RegState",
- "ResetNvType",
- "RestrictedState",
- "SapApduType",
- "SapConnectRsp",
- "SapDisconnectType",
- "SapResultCode",
- "SapStatus",
- "SapTransferProtocol",
- "SelectUiccSub",
- "SendSmsResult",
- "SetupDataCallResult",
- "SignalStrength",
- "SimApdu",
- "SimRefreshResult",
- "SimRefreshType",
- "SmsAcknowledgeFailCause",
- "SmsWriteArgs",
- "SmsWriteArgsStatus",
- "SrvccState",
- "SsInfoData",
- "SsRequestType",
- "SsServiceType",
- "SsTeleserviceType",
- "StkCcUnsolSsResult",
- "SubscriptionType",
- "SuppServiceClass",
- "SuppSvcNotification",
- "TdScdmaSignalStrength",
- "TimeStampType",
- "TtyMode",
- "UiccSubActStatus",
- "UssdModeType",
- "UusDcs",
- "UusInfo",
- "UusType",
- "VoiceRegStateResult",
- "WcdmaSignalStrength",
- ],
gen_java: true,
}
diff --git a/radio/1.1/Android.bp b/radio/1.1/Android.bp
index 5eecb31..4375d8c 100644
--- a/radio/1.1/Android.bp
+++ b/radio/1.1/Android.bp
@@ -17,23 +17,6 @@
"android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
- types: [
- "CardPowerState",
- "EutranBands",
- "GeranBands",
- "ImsiEncryptionInfo",
- "KeepaliveRequest",
- "KeepaliveStatus",
- "KeepaliveStatusCode",
- "KeepaliveType",
- "NetworkScanRequest",
- "NetworkScanResult",
- "RadioAccessNetworks",
- "RadioAccessSpecifier",
- "ScanStatus",
- "ScanType",
- "UtranBands",
- ],
gen_java: true,
}
diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp
index c90a03c..b7364a8 100644
--- a/radio/1.2/Android.bp
+++ b/radio/1.2/Android.bp
@@ -18,41 +18,6 @@
"android.hardware.radio@1.1",
"android.hidl.base@1.0",
],
- types: [
- "AccessNetwork",
- "AudioQuality",
- "Call",
- "CardStatus",
- "CellConnectionStatus",
- "CellIdentity",
- "CellIdentityCdma",
- "CellIdentityGsm",
- "CellIdentityLte",
- "CellIdentityOperatorNames",
- "CellIdentityTdscdma",
- "CellIdentityWcdma",
- "CellInfo",
- "CellInfoCdma",
- "CellInfoGsm",
- "CellInfoLte",
- "CellInfoTdscdma",
- "CellInfoWcdma",
- "DataRegStateResult",
- "DataRequestReason",
- "IncrementalResultsPeriodicityRange",
- "IndicationFilter",
- "LinkCapacityEstimate",
- "MaxSearchTimeRange",
- "NetworkScanRequest",
- "NetworkScanResult",
- "PhysicalChannelConfig",
- "RadioConst",
- "ScanIntervalRange",
- "SignalStrength",
- "TdscdmaSignalStrength",
- "VoiceRegStateResult",
- "WcdmaSignalStrength",
- ],
gen_java: true,
}
diff --git a/radio/1.3/Android.bp b/radio/1.3/Android.bp
index 63056cc..de2a3e5 100644
--- a/radio/1.3/Android.bp
+++ b/radio/1.3/Android.bp
@@ -18,9 +18,6 @@
"android.hardware.radio@1.2",
"android.hidl.base@1.0",
],
- types: [
- "RadioResponseInfoModem",
- ],
gen_java: true,
}
diff --git a/radio/1.3/IRadio.hal b/radio/1.3/IRadio.hal
index cc5b860..922b35d 100644
--- a/radio/1.3/IRadio.hal
+++ b/radio/1.3/IRadio.hal
@@ -49,10 +49,13 @@
vec<RadioAccessSpecifier> specifiers);
/**
- * Toggle logical modem on and off. It should put the logical modem in low power
- * mode without any activity, while the SIM card remains visible. The difference
- * with setRadioPower is, setRadioPower affects all logical modem while this controls
- * just one.
+ * Toggle logical modem on/off. This is similar to @1.0::IRadio.setRadioPower(), however that
+ * does not enforce that radio power is toggled only for the corresponding radio and certain
+ * vendor implementations do it for all radios. This new API should affect only the modem for
+ * which it is called. A modem stack must be on/active only when both setRadioPower() and
+ * enableModem() are set to on for it.
+ *
+ * SIM must be read if available even if modem is off/inactive.
*
* @param serial Serial number of request.
* @param on True to turn on the logical modem, otherwise turn it off.
@@ -62,9 +65,8 @@
oneway enableModem(int32_t serial, bool on);
/**
- * Request status of logical modem associated with the given serial number. It returns
- * isEnabled=true if the logical modem is in low power mode without any activity, while
- * the SIM card remains visible.
+ * Request status of logical modem. It returns isEnabled=true if the logical modem is on.
+ * This method is the getter method for enableModem.
*
* @param serial Serial number of request.
*
diff --git a/radio/1.3/vts/functional/radio_hidl_hal_api.cpp b/radio/1.3/vts/functional/radio_hidl_hal_api.cpp
index 6208c67..1bebae7 100644
--- a/radio/1.3/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.3/vts/functional/radio_hidl_hal_api.cpp
@@ -75,3 +75,36 @@
radioRsp_v1_3->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR}));
}
+
+/*
+ * Test IRadio.setSystemSelectionChannels() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_3, setSystemSelectionChannels) {
+ serial = GetRandomSerialNumber();
+
+ RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN,
+ .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480},
+ .channels = {1, 2}};
+
+ Return<void> res = radio_v1_3->setSystemSelectionChannels(serial, true, {specifier});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
+ ALOGI("setSystemSelectionChannels, rspInfo.error = %s\n",
+ toString(radioRsp_v1_3->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_3->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+
+ if (radioRsp_v1_3->rspInfo.error == RadioError::NONE) {
+ Return<void> res = radio_v1_3->setSystemSelectionChannels(serial, false, {specifier});
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
+ ALOGI("setSystemSelectionChannels, rspInfo.error = %s\n",
+ toString(radioRsp_v1_3->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_3->rspInfo.error);
+ }
+}
\ No newline at end of file
diff --git a/radio/1.3/vts/functional/radio_response.cpp b/radio/1.3/vts/functional/radio_response.cpp
index 900794e..84a9890 100644
--- a/radio/1.3/vts/functional/radio_response.cpp
+++ b/radio/1.3/vts/functional/radio_response.cpp
@@ -769,12 +769,14 @@
/* 1.3 Api */
Return<void> RadioResponse_v1_3::setSystemSelectionChannelsResponse(const RadioResponseInfo& info) {
rspInfo = info;
+ parent_v1_3.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_3::enableModemResponse(const RadioResponseInfo& info) {
rspInfo = info;
enableModemResponseToggle = !enableModemResponseToggle;
+ parent_v1_3.notify(info.serial);
return Void();
}
@@ -782,5 +784,6 @@
const bool enabled) {
rspInfo = info;
isModemEnabled = enabled;
+ parent_v1_3.notify(info.serial);
return Void();
}
diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp
index e8b8777..9f5f2f9 100644
--- a/radio/1.4/Android.bp
+++ b/radio/1.4/Android.bp
@@ -20,38 +20,6 @@
"android.hidl.base@1.0",
"android.hidl.safe_union@1.0",
],
- types: [
- "AccessNetwork",
- "CardStatus",
- "CarrierRestrictionsWithPriority",
- "CellConfigLte",
- "CellIdentityNr",
- "CellInfo",
- "CellInfoLte",
- "CellInfoNr",
- "DataCallFailCause",
- "DataConnActiveStatus",
- "DataProfileInfo",
- "DataRegStateResult",
- "EmergencyCallRouting",
- "EmergencyNumber",
- "EmergencyNumberSource",
- "EmergencyServiceCategory",
- "FrequencyRange",
- "LteVopsInfo",
- "NetworkScanResult",
- "NrIndicators",
- "NrSignalStrength",
- "PdpProtocolType",
- "PhysicalChannelConfig",
- "RadioAccessFamily",
- "RadioCapability",
- "RadioFrequencyInfo",
- "RadioTechnology",
- "SetupDataCallResult",
- "SignalStrength",
- "SimLockMultiSimPolicy",
- ],
gen_java: true,
}
diff --git a/radio/1.4/IRadio.hal b/radio/1.4/IRadio.hal
index 046f074..3f28ebb 100644
--- a/radio/1.4/IRadio.hal
+++ b/radio/1.4/IRadio.hal
@@ -207,7 +207,7 @@
* as defined in types.hal
* @param multiSimPolicy Policy to be used for devices with multiple SIMs.
*
- * Response callback is IRadioResponse.setAllowedCarriersResponse()
+ * Response callback is IRadioResponse.setAllowedCarriersResponse_1_4()
*/
oneway setAllowedCarriers_1_4(int32_t serial, CarrierRestrictionsWithPriority carriers,
SimLockMultiSimPolicy multiSimPolicy);
@@ -217,7 +217,7 @@
*
* @param serial Serial number of request.
*
- * Response callback is IRadioResponse.getAllowedCarriersResponse_1_3()
+ * Response callback is IRadioResponse.getAllowedCarriersResponse_1_4()
*/
oneway getAllowedCarriers_1_4(int32_t serial);
diff --git a/radio/1.4/types.hal b/radio/1.4/types.hal
index dc3bba0..393716b 100644
--- a/radio/1.4/types.hal
+++ b/radio/1.4/types.hal
@@ -64,6 +64,15 @@
UNKNOWN = 0,
};
+enum ApnTypes : @1.0::ApnTypes {
+ /**
+ * Due to the addition of this new value, the value ALL defined in 1.0::ApnTypes is now
+ * deprecated and should not be used.
+ */
+ MCX = 1 << 10, // APN type for Mission Critical Service
+ // Reference: 3GPP TS 22.280 V15.3.0
+};
+
/**
* Emergency number contains information of number, one or more service category(s), zero or more
* emergency uniform resource names, mobile country code (mcc), mobile network country (mnc) and
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
index 52eb277..ac78462 100644
--- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
@@ -96,6 +96,56 @@
}
/*
+ * Test IRadio.getPreferredNetworkTypeBitmap() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, getPreferredNetworkTypeBitmap) {
+ serial = GetRandomSerialNumber();
+
+ Return<void> res = radio_v1_4->getPreferredNetworkTypeBitmap(serial);
+
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+ ALOGI("getPreferredNetworkTypeBitmap, rspInfo.error = %s\n",
+ toString(radioRsp_v1_4->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+}
+
+TEST_F(RadioHidlTest_v1_4, setPreferredNetworkTypeBitmap) {
+ serial = GetRandomSerialNumber();
+ ::android::hardware::hidl_bitfield<::android::hardware::radio::V1_4::RadioAccessFamily>
+ network_type_bitmap{};
+
+ network_type_bitmap |= ::android::hardware::radio::V1_4::RadioAccessFamily::LTE;
+
+ Return<void> res = radio_v1_4->setPreferredNetworkTypeBitmap(serial, network_type_bitmap);
+
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+ ALOGI("setPreferredNetworkTypeBitmap, rspInfo.error = %s\n",
+ toString(radioRsp_v1_4->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+ if (radioRsp_v1_4->rspInfo.error == RadioError::NONE) {
+ // give some time for modem to set the value.
+ sleep(3);
+ serial = GetRandomSerialNumber();
+ Return<void> res = radio_v1_4->getPreferredNetworkTypeBitmap(serial);
+
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+ ALOGI("getPreferredNetworkTypeBitmap, rspInfo.error = %s\n",
+ toString(radioRsp_v1_4->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+ EXPECT_EQ(network_type_bitmap, radioRsp_v1_4->networkTypeBitmapResponse);
+ }
+}
+
+/*
* Test IRadio.startNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_4, startNetworkScan) {
@@ -439,6 +489,26 @@
{RadioError::NONE, RadioError::INVALID_ARGUMENTS}));
}
}
+
+/*
+ * Test IRadio.getSignalStrength_1_4() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, getSignalStrength_1_4) {
+ serial = GetRandomSerialNumber();
+
+ radio_v1_4->getSignalStrength_1_4(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ if (cardStatus.base.base.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+ } else if (cardStatus.base.base.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
+ }
+}
+
/*
* Test IRadio.setupDataCall_1_4() for the response returned.
*/
@@ -452,8 +522,8 @@
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileId::DEFAULT;
dataProfileInfo.apn = hidl_string("internet");
- dataProfileInfo.protocol = PdpProtocolType::IPV4V6;
- dataProfileInfo.roamingProtocol = PdpProtocolType::IPV4V6;
+ dataProfileInfo.protocol = PdpProtocolType::IP;
+ dataProfileInfo.roamingProtocol = PdpProtocolType::IP;
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = hidl_string("username");
dataProfileInfo.password = hidl_string("password");
@@ -493,3 +563,116 @@
RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
}
}
+
+/*
+ * Test IRadio.getAllowedCarriers_1_4() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, getAllowedCarriers_1_4) {
+ serial = GetRandomSerialNumber();
+
+ radio_v1_4->getAllowedCarriers_1_4(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/**
+ * Test IRadio.setAllowedCarriers_1_4() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, setAllowedCarriers_1_4) {
+ serial = GetRandomSerialNumber();
+ CarrierRestrictionsWithPriority carrierRestrictions;
+ memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
+ carrierRestrictions.allowedCarriers.resize(1);
+ carrierRestrictions.excludedCarriers.resize(0);
+ carrierRestrictions.allowedCarriers[0].mcc = hidl_string("123");
+ carrierRestrictions.allowedCarriers[0].mnc = hidl_string("456");
+ carrierRestrictions.allowedCarriers[0].matchType = CarrierMatchType::ALL;
+ carrierRestrictions.allowedCarriers[0].matchData = hidl_string();
+ carrierRestrictions.allowedCarriersPrioritized = true;
+ SimLockMultiSimPolicy multisimPolicy = SimLockMultiSimPolicy::NO_MULTISIM_POLICY;
+
+ radio_v1_4->setAllowedCarriers_1_4(serial, carrierRestrictions, multisimPolicy);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+
+ if (radioRsp_v1_4->rspInfo.error == RadioError::NONE) {
+ /* Verify the update of the SIM status. This might need some time */
+ if (cardStatus.base.base.cardState != CardState::ABSENT) {
+ updateSimCardStatus();
+ auto startTime = std::chrono::system_clock::now();
+ while (cardStatus.base.base.cardState != CardState::RESTRICTED &&
+ std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
+ startTime)
+ .count() < 10) {
+ /* Set 2 seconds as interval to check card status */
+ sleep(2);
+ updateSimCardStatus();
+ }
+ EXPECT_EQ(CardState::RESTRICTED, cardStatus.base.base.cardState);
+ }
+
+ /* Verify that configuration was set correctly, retrieving it from the modem */
+ serial = GetRandomSerialNumber();
+
+ radio_v1_4->getAllowedCarriers_1_4(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+
+ EXPECT_EQ(1, radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers.size());
+ EXPECT_EQ(0, radioRsp_v1_4->carrierRestrictionsResp.excludedCarriers.size());
+ ASSERT_TRUE(hidl_string("123") ==
+ radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers[0].mcc);
+ ASSERT_TRUE(hidl_string("456") ==
+ radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers[0].mnc);
+ EXPECT_EQ(CarrierMatchType::ALL,
+ radioRsp_v1_4->carrierRestrictionsResp.allowedCarriers[0].matchType);
+ ASSERT_TRUE(radioRsp_v1_4->carrierRestrictionsResp.allowedCarriersPrioritized);
+ EXPECT_EQ(SimLockMultiSimPolicy::NO_MULTISIM_POLICY, radioRsp_v1_4->multiSimPolicyResp);
+
+ sleep(10);
+
+ /**
+ * Another test case of the API to cover to allow carrier.
+ * If the API is supported, this is also used to reset to no carrier restriction
+ * status for cardStatus.
+ */
+ memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
+ carrierRestrictions.allowedCarriers.resize(0);
+ carrierRestrictions.excludedCarriers.resize(0);
+ carrierRestrictions.allowedCarriersPrioritized = false;
+
+ serial = GetRandomSerialNumber();
+ radio_v1_4->setAllowedCarriers_1_4(serial, carrierRestrictions, multisimPolicy);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+
+ if (cardStatus.base.base.cardState != CardState::ABSENT) {
+ /* Resetting back to no carrier restriction needs some time */
+ updateSimCardStatus();
+ auto startTime = std::chrono::system_clock::now();
+ while (cardStatus.base.base.cardState == CardState::RESTRICTED &&
+ std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
+ startTime)
+ .count() < 10) {
+ /* Set 2 seconds as interval to check card status */
+ sleep(2);
+ updateSimCardStatus();
+ }
+ EXPECT_NE(CardState::RESTRICTED, cardStatus.base.base.cardState);
+ sleep(10);
+ }
+ }
+}
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h
index b77814f..de7742c 100644
--- a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h
+++ b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h
@@ -61,9 +61,16 @@
bool isModemEnabled;
bool enableModemResponseToggle;
+ ::android::hardware::hidl_bitfield<::android::hardware::radio::V1_4::RadioAccessFamily>
+ networkTypeBitmapResponse;
+
// Data
::android::hardware::radio::V1_4::DataRegStateResult dataRegResp;
+ // SimLock status
+ ::android::hardware::radio::V1_4::CarrierRestrictionsWithPriority carrierRestrictionsResp;
+ ::android::hardware::radio::V1_4::SimLockMultiSimPolicy multiSimPolicyResp;
+
RadioResponse_v1_4(RadioHidlTest_v1_4& parent_v1_4);
virtual ~RadioResponse_v1_4() = default;
diff --git a/radio/1.4/vts/functional/radio_response.cpp b/radio/1.4/vts/functional/radio_response.cpp
index 10ecead..eac0c68 100644
--- a/radio/1.4/vts/functional/radio_response.cpp
+++ b/radio/1.4/vts/functional/radio_response.cpp
@@ -533,7 +533,9 @@
return Void();
}
-Return<void> RadioResponse_v1_4::setInitialAttachApnResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_4::setInitialAttachApnResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_4.notify(info.serial);
return Void();
}
@@ -604,7 +606,9 @@
return Void();
}
-Return<void> RadioResponse_v1_4::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_4::setDataProfileResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_4.notify(info.serial);
return Void();
}
@@ -776,7 +780,6 @@
Return<void> RadioResponse_v1_4::enableModemResponse(const RadioResponseInfo& info) {
rspInfo = info;
- enableModemResponseToggle = !enableModemResponseToggle;
parent_v1_4.notify(info.serial);
return Void();
}
@@ -832,9 +835,9 @@
Return<void> RadioResponse_v1_4::getPreferredNetworkTypeBitmapResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_bitfield<
::android::hardware::radio::V1_4::RadioAccessFamily>
- /*networkTypeBitmap*/) {
+ networkTypeBitmap) {
rspInfo = info;
- // TODO: may need a new member for bitfield networkTypeBitmap.
+ networkTypeBitmapResponse = networkTypeBitmap;
parent_v1_4.notify(info.serial);
return Void();
}
@@ -863,12 +866,18 @@
return Void();
}
-Return<void> RadioResponse_v1_4::setAllowedCarriersResponse_1_4(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse_v1_4::setAllowedCarriersResponse_1_4(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_4.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_4::getAllowedCarriersResponse_1_4(
- const RadioResponseInfo& /*info*/, const CarrierRestrictionsWithPriority& /*carriers*/,
- SimLockMultiSimPolicy /*multiSimPolicy*/) {
+ const RadioResponseInfo& info, const CarrierRestrictionsWithPriority& carriers,
+ SimLockMultiSimPolicy multiSimPolicy) {
+ rspInfo = info;
+ carrierRestrictionsResp = carriers;
+ multiSimPolicyResp = multiSimPolicy;
+ parent_v1_4.notify(info.serial);
return Void();
}
diff --git a/radio/config/1.0/Android.bp b/radio/config/1.0/Android.bp
index c50e71c..7fb0ea1 100644
--- a/radio/config/1.0/Android.bp
+++ b/radio/config/1.0/Android.bp
@@ -16,10 +16,6 @@
"android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
- types: [
- "SimSlotStatus",
- "SlotState",
- ],
gen_java: true,
}
diff --git a/radio/config/1.1/Android.bp b/radio/config/1.1/Android.bp
index 151a0a3..5c9ad7c 100644
--- a/radio/config/1.1/Android.bp
+++ b/radio/config/1.1/Android.bp
@@ -17,11 +17,6 @@
"android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
- types: [
- "ModemInfo",
- "ModemsConfig",
- "PhoneCapability",
- ],
gen_java: true,
}
diff --git a/radio/config/1.1/vts/functional/radio_config_hidl_hal_api.cpp b/radio/config/1.1/vts/functional/radio_config_hidl_hal_api.cpp
index a8e939c..bd6265c 100644
--- a/radio/config/1.1/vts/functional/radio_config_hidl_hal_api.cpp
+++ b/radio/config/1.1/vts/functional/radio_config_hidl_hal_api.cpp
@@ -69,3 +69,89 @@
ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
+
+/*
+ * Test IRadioConfig.getPhoneCapability()
+ */
+TEST_F(RadioConfigHidlTest, getPhoneCapability) {
+ serial = GetRandomSerialNumber();
+ Return<void> res = radioConfig->getPhoneCapability(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ ALOGI("getPhoneCapability, rspInfo.error = %s\n",
+ toString(radioConfigRsp->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioConfigRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+
+ if (radioConfigRsp->rspInfo.error == RadioError ::NONE) {
+ // maxActiveData should be greater than or equal to maxActiveInternetData.
+ EXPECT_GE(radioConfigRsp->phoneCap.maxActiveData,
+ radioConfigRsp->phoneCap.maxActiveInternetData);
+ // maxActiveData and maxActiveInternetData should be 0 or positive numbers.
+ EXPECT_GE(radioConfigRsp->phoneCap.maxActiveInternetData, 0);
+ }
+}
+
+/*
+ * Test IRadioConfig.getPhoneCapability()
+ */
+TEST_F(RadioConfigHidlTest, setPreferredDataModem) {
+ serial = GetRandomSerialNumber();
+ Return<void> res = radioConfig->getPhoneCapability(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ ALOGI("getPhoneCapability, rspInfo.error = %s\n",
+ toString(radioConfigRsp->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioConfigRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+
+ if (radioConfigRsp->rspInfo.error != RadioError ::NONE) {
+ return;
+ }
+
+ if (radioConfigRsp->phoneCap.logicalModemList.size() == 0) {
+ return;
+ }
+
+ // We get phoneCapability. send setPreferredDataModem command
+ serial = GetRandomSerialNumber();
+ uint8_t modemId = radioConfigRsp->phoneCap.logicalModemList[0].modemId;
+ res = radioConfig->setPreferredDataModem(serial, modemId);
+
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ ALOGI("getModemsConfig, rspInfo.error = %s\n", toString(radioConfigRsp->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioConfigRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
+}
+
+/*
+ * Test IRadioConfig.getPhoneCapability()
+ */
+TEST_F(RadioConfigHidlTest, setPreferredDataModem_invalidArgument) {
+ serial = GetRandomSerialNumber();
+ uint8_t modemId = -1;
+ Return<void> res = radioConfig->setPreferredDataModem(serial, modemId);
+
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ ALOGI("getModemsConfig, rspInfo.error = %s\n", toString(radioConfigRsp->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::INTERNAL_ERR}));
+}
diff --git a/radio/config/1.1/vts/functional/radio_config_hidl_hal_utils.h b/radio/config/1.1/vts/functional/radio_config_hidl_hal_utils.h
index 592555f..d986c9a 100644
--- a/radio/config/1.1/vts/functional/radio_config_hidl_hal_utils.h
+++ b/radio/config/1.1/vts/functional/radio_config_hidl_hal_utils.h
@@ -51,6 +51,7 @@
public:
RadioResponseInfo rspInfo;
+ PhoneCapability phoneCap;
RadioConfigResponse(RadioConfigHidlTest& parent);
virtual ~RadioConfigResponse() = default;
diff --git a/radio/config/1.1/vts/functional/radio_config_response.cpp b/radio/config/1.1/vts/functional/radio_config_response.cpp
index 6e41aeb..09ee57f 100644
--- a/radio/config/1.1/vts/functional/radio_config_response.cpp
+++ b/radio/config/1.1/vts/functional/radio_config_response.cpp
@@ -31,7 +31,10 @@
}
Return<void> RadioConfigResponse::getPhoneCapabilityResponse(
- const RadioResponseInfo& /* info */, const PhoneCapability& /* phoneCapability */) {
+ const RadioResponseInfo& info, const PhoneCapability& phoneCapability) {
+ rspInfo = info;
+ phoneCap = phoneCapability;
+ parent.notify(info.serial);
return Void();
}
diff --git a/radio/config/1.2/Android.bp b/radio/config/1.2/Android.bp
index 3e6a425..e69be40 100644
--- a/radio/config/1.2/Android.bp
+++ b/radio/config/1.2/Android.bp
@@ -17,9 +17,6 @@
"android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
- types: [
- "SimSlotStatus",
- ],
gen_java: true,
}
diff --git a/renderscript/1.0/Android.bp b/renderscript/1.0/Android.bp
index 79b2ff7..1d7efad 100644
--- a/renderscript/1.0/Android.bp
+++ b/renderscript/1.0/Android.bp
@@ -15,23 +15,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "AllocationCubemapFace",
- "AllocationMipmapControl",
- "AllocationUsageType",
- "ContextFlags",
- "ContextType",
- "DataKind",
- "DataType",
- "ForEachStrategy",
- "MessageToClientType",
- "MetadataSignatureBitval",
- "SamplerValue",
- "ScriptCall",
- "ScriptIntrinsicID",
- "ThreadPriorities",
- "YuvFormat",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/secure_element/1.0/Android.bp b/secure_element/1.0/Android.bp
index e8081df..c6fa6a9 100644
--- a/secure_element/1.0/Android.bp
+++ b/secure_element/1.0/Android.bp
@@ -14,10 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "LogicalChannelResponse",
- "SecureElementStatus",
- ],
gen_java: true,
}
diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp
index 92c3c1b..3a41f9c 100644
--- a/sensors/1.0/Android.bp
+++ b/sensors/1.0/Android.bp
@@ -13,31 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "AdditionalInfo",
- "AdditionalInfoType",
- "DynamicSensorInfo",
- "Event",
- "EventPayload",
- "HeartRate",
- "MetaData",
- "MetaDataEventType",
- "OperationMode",
- "RateLevel",
- "Result",
- "SensorFlagBits",
- "SensorFlagShift",
- "SensorInfo",
- "SensorStatus",
- "SensorType",
- "SensorsEventFormatOffset",
- "SharedMemFormat",
- "SharedMemInfo",
- "SharedMemType",
- "Uncal",
- "Vec3",
- "Vec4",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp
index 92f031a..b805be8 100644
--- a/soundtrigger/2.0/Android.bp
+++ b/soundtrigger/2.0/Android.bp
@@ -15,12 +15,6 @@
"android.hardware.audio.common@2.0",
"android.hidl.base@1.0",
],
- types: [
- "ConfidenceLevel",
- "PhraseRecognitionExtra",
- "RecognitionMode",
- "SoundModelType",
- ],
gen_java: false,
}
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index 45c84bc..a1b6b88 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -15,9 +15,6 @@
"android.hardware.tests.foo@1.0",
"android.hidl.base@1.0",
],
- types: [
- "Def",
- ],
gen_java: false,
}
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index edf8fe6..618f4f8 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -13,8 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- ],
gen_java: true,
}
diff --git a/tests/extension/light/2.0/Android.bp b/tests/extension/light/2.0/Android.bp
index 58c8392..916af71 100644
--- a/tests/extension/light/2.0/Android.bp
+++ b/tests/extension/light/2.0/Android.bp
@@ -11,11 +11,6 @@
"android.hardware.light@2.0",
"android.hidl.base@1.0",
],
- types: [
- "Brightness",
- "Default",
- "LightState",
- ],
gen_java: true,
}
diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp
index 769de2d..1c3b3c5 100644
--- a/tests/foo/1.0/Android.bp
+++ b/tests/foo/1.0/Android.bp
@@ -14,13 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Abc",
- "Def",
- "EnumIterators",
- "Outer",
- "Unrelated",
- ],
gen_java: false,
}
diff --git a/tests/trie/1.0/Android.bp b/tests/trie/1.0/Android.bp
index 870a350..0795f66 100644
--- a/tests/trie/1.0/Android.bp
+++ b/tests/trie/1.0/Android.bp
@@ -10,15 +10,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "A",
- "B",
- "E1",
- "E2",
- "S",
- "TrieEdge",
- "TrieNode",
- ],
gen_java: false,
}
diff --git a/tetheroffload/control/1.0/Android.bp b/tetheroffload/control/1.0/Android.bp
index 8e3fd27..dc2487b 100644
--- a/tetheroffload/control/1.0/Android.bp
+++ b/tetheroffload/control/1.0/Android.bp
@@ -14,12 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "IPv4AddrPortPair",
- "NatTimeoutUpdate",
- "NetworkProtocol",
- "OffloadCallbackEvent",
- ],
gen_java: true,
}
diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp
index e764e28..8428977 100644
--- a/thermal/1.0/Android.bp
+++ b/thermal/1.0/Android.bp
@@ -13,15 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "CoolingDevice",
- "CoolingType",
- "CpuUsage",
- "Temperature",
- "TemperatureType",
- "ThermalStatus",
- "ThermalStatusCode",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/tv/cec/1.0/Android.bp b/tv/cec/1.0/Android.bp
index 2aa155e..7626dc0 100644
--- a/tv/cec/1.0/Android.bp
+++ b/tv/cec/1.0/Android.bp
@@ -14,20 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "AbortReason",
- "CecDeviceType",
- "CecLogicalAddress",
- "CecMessage",
- "CecMessageType",
- "HdmiPortInfo",
- "HdmiPortType",
- "HotplugEvent",
- "MaxLength",
- "OptionKey",
- "Result",
- "SendMessageResult",
- ],
gen_java: true,
}
diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp
index 1bf3930..a6c1959 100644
--- a/tv/input/1.0/Android.bp
+++ b/tv/input/1.0/Android.bp
@@ -15,15 +15,6 @@
"android.hardware.audio.common@2.0",
"android.hidl.base@1.0",
],
- types: [
- "CableConnectionStatus",
- "Result",
- "TvInputDeviceInfo",
- "TvInputEvent",
- "TvInputEventType",
- "TvInputType",
- "TvStreamConfig",
- ],
gen_java: false,
gen_java_constants: true,
}
diff --git a/update-makefiles.sh b/update-makefiles.sh
index 14c5b01..c58240f 100755
--- a/update-makefiles.sh
+++ b/update-makefiles.sh
@@ -13,9 +13,3 @@
do_makefiles_update \
"android.hardware:hardware/interfaces" \
"android.hidl:system/libhidl/transport"
-
-echo "Updating files at $ANDROID_BUILD_TOP/test/vts-testcase/hal"
-pushd $ANDROID_BUILD_TOP/test/vts-testcase/hal
-./script/update_makefiles.py
-popd
-
diff --git a/usb/1.0/Android.bp b/usb/1.0/Android.bp
index 6676fa5..a00b671 100644
--- a/usb/1.0/Android.bp
+++ b/usb/1.0/Android.bp
@@ -14,15 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "PortDataRole",
- "PortMode",
- "PortPowerRole",
- "PortRole",
- "PortRoleType",
- "PortStatus",
- "Status",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/usb/1.1/Android.bp b/usb/1.1/Android.bp
index c398f94..fb2cc4e 100644
--- a/usb/1.1/Android.bp
+++ b/usb/1.1/Android.bp
@@ -15,10 +15,6 @@
"android.hardware.usb@1.0",
"android.hidl.base@1.0",
],
- types: [
- "PortMode_1_1",
- "PortStatus_1_1",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/usb/gadget/1.0/Android.bp b/usb/gadget/1.0/Android.bp
index f38002f..7ee432b 100644
--- a/usb/gadget/1.0/Android.bp
+++ b/usb/gadget/1.0/Android.bp
@@ -14,10 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "GadgetFunction",
- "Status",
- ],
gen_java: true,
}
diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp
index 6913c88..acc97d4 100644
--- a/vibrator/1.0/Android.bp
+++ b/vibrator/1.0/Android.bp
@@ -13,11 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Effect",
- "EffectStrength",
- "Status",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/vibrator/1.1/Android.bp b/vibrator/1.1/Android.bp
index 810797b..2055e5a 100644
--- a/vibrator/1.1/Android.bp
+++ b/vibrator/1.1/Android.bp
@@ -14,9 +14,6 @@
"android.hardware.vibrator@1.0",
"android.hidl.base@1.0",
],
- types: [
- "Effect_1_1",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/vibrator/1.2/Android.bp b/vibrator/1.2/Android.bp
index 88192c1..481adee 100644
--- a/vibrator/1.2/Android.bp
+++ b/vibrator/1.2/Android.bp
@@ -15,9 +15,6 @@
"android.hardware.vibrator@1.1",
"android.hidl.base@1.0",
],
- types: [
- "Effect",
- ],
gen_java: true,
}
diff --git a/weaver/1.0/Android.bp b/weaver/1.0/Android.bp
index e088a16..7f93b10 100644
--- a/weaver/1.0/Android.bp
+++ b/weaver/1.0/Android.bp
@@ -13,12 +13,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "WeaverConfig",
- "WeaverReadResponse",
- "WeaverReadStatus",
- "WeaverStatus",
- ],
gen_java: true,
}
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 096fb6c..c5ee1bb 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -25,90 +25,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "IfaceType",
- "NanBandIndex",
- "NanBandSpecificConfig",
- "NanCapabilities",
- "NanCipherSuiteType",
- "NanClusterEventInd",
- "NanClusterEventType",
- "NanConfigRequest",
- "NanDataPathChannelCfg",
- "NanDataPathConfirmInd",
- "NanDataPathRequestInd",
- "NanDataPathSecurityConfig",
- "NanDataPathSecurityType",
- "NanDebugConfig",
- "NanDiscoveryCommonConfig",
- "NanEnableRequest",
- "NanFollowupReceivedInd",
- "NanInitiateDataPathRequest",
- "NanMatchAlg",
- "NanMatchInd",
- "NanParamSizeLimits",
- "NanPublishRequest",
- "NanPublishType",
- "NanRangingIndication",
- "NanRespondToDataPathIndicationRequest",
- "NanSrfType",
- "NanStatusType",
- "NanSubscribeRequest",
- "NanSubscribeType",
- "NanTransmitFollowupRequest",
- "NanTxType",
- "RttBw",
- "RttCapabilities",
- "RttConfig",
- "RttLciInformation",
- "RttLcrInformation",
- "RttMotionPattern",
- "RttPeerType",
- "RttPreamble",
- "RttResponder",
- "RttResult",
- "RttStatus",
- "RttType",
- "StaApfPacketFilterCapabilities",
- "StaBackgroundScanBucketEventReportSchemeMask",
- "StaBackgroundScanBucketParameters",
- "StaBackgroundScanCapabilities",
- "StaBackgroundScanParameters",
- "StaLinkLayerIfacePacketStats",
- "StaLinkLayerIfaceStats",
- "StaLinkLayerRadioStats",
- "StaLinkLayerStats",
- "StaRoamingCapabilities",
- "StaRoamingConfig",
- "StaRoamingState",
- "StaScanData",
- "StaScanDataFlagMask",
- "StaScanLimits",
- "StaScanResult",
- "WifiBand",
- "WifiChannelInfo",
- "WifiChannelWidthInMhz",
- "WifiDebugHostWakeReasonRxIcmpPacketDetails",
- "WifiDebugHostWakeReasonRxMulticastPacketDetails",
- "WifiDebugHostWakeReasonRxPacketDetails",
- "WifiDebugHostWakeReasonStats",
- "WifiDebugPacketFateFrameInfo",
- "WifiDebugPacketFateFrameType",
- "WifiDebugRingBufferFlags",
- "WifiDebugRingBufferStatus",
- "WifiDebugRingBufferVerboseLevel",
- "WifiDebugRxPacketFate",
- "WifiDebugRxPacketFateReport",
- "WifiDebugTxPacketFate",
- "WifiDebugTxPacketFateReport",
- "WifiInformationElement",
- "WifiNanStatus",
- "WifiRateInfo",
- "WifiRateNss",
- "WifiRatePreamble",
- "WifiStatus",
- "WifiStatusCode",
- ],
gen_java: true,
gen_java_constants: true,
}
diff --git a/wifi/1.2/Android.bp b/wifi/1.2/Android.bp
index c144f22..1863eaf 100644
--- a/wifi/1.2/Android.bp
+++ b/wifi/1.2/Android.bp
@@ -20,12 +20,6 @@
"android.hardware.wifi@1.1",
"android.hidl.base@1.0",
],
- types: [
- "NanConfigRequestSupplemental",
- "NanDataPathChannelInfo",
- "NanDataPathConfirmInd",
- "NanDataPathScheduleUpdateInd",
- ],
gen_java: true,
}
diff --git a/wifi/1.2/default/wifi_chip.cpp b/wifi/1.2/default/wifi_chip.cpp
index 3bd0557..8c2d3cb 100644
--- a/wifi/1.2/default/wifi_chip.cpp
+++ b/wifi/1.2/default/wifi_chip.cpp
@@ -113,7 +113,7 @@
const time_t delete_files_before = now - kMaxRingBufferFileAgeSeconds;
DIR* dir_dump = opendir(kTombstoneFolderPath);
if (!dir_dump) {
- LOG(ERROR) << "Failed to open directory: " << strerror(errno);
+ PLOG(ERROR) << "Failed to open directory";
return false;
}
unique_fd dir_auto_closer(dirfd(dir_dump));
@@ -128,8 +128,7 @@
struct stat cur_file_stat;
std::string cur_file_path = kTombstoneFolderPath + cur_file_name;
if (stat(cur_file_path.c_str(), &cur_file_stat) == -1) {
- LOG(ERROR) << "Failed to get file stat for " << cur_file_path
- << ": " << strerror(errno);
+ PLOG(ERROR) << "Failed to get file stat for " << cur_file_path;
success = false;
continue;
}
@@ -144,7 +143,7 @@
if (cur_file_count > kMaxRingBufferFileNum ||
cur_file.first < delete_files_before) {
if (unlink(cur_file.second.c_str()) != 0) {
- LOG(ERROR) << "Error deleting file " << strerror(errno);
+ PLOG(ERROR) << "Error deleting file";
success = false;
}
cur_file_count--;
@@ -168,13 +167,11 @@
major(st.st_dev), minor(st.st_dev), major(st.st_rdev),
minor(st.st_rdev), static_cast<uint32_t>(file_name_len), 0);
if (write(out_fd, read_buf.data(), llen) == -1) {
- LOG(ERROR) << "Error writing cpio header to file " << file_name << " "
- << strerror(errno);
+ PLOG(ERROR) << "Error writing cpio header to file " << file_name;
return false;
}
if (write(out_fd, file_name, file_name_len) == -1) {
- LOG(ERROR) << "Error writing filename to file " << file_name << " "
- << strerror(errno);
+ PLOG(ERROR) << "Error writing filename to file " << file_name;
return false;
}
@@ -183,8 +180,7 @@
if (llen != 0) {
const uint32_t zero = 0;
if (write(out_fd, &zero, 4 - llen) == -1) {
- LOG(ERROR) << "Error padding 0s to file " << file_name << " "
- << strerror(errno);
+ PLOG(ERROR) << "Error padding 0s to file " << file_name;
return false;
}
}
@@ -200,17 +196,17 @@
while (llen > 0) {
ssize_t bytes_read = read(fd_read, read_buf.data(), read_buf.size());
if (bytes_read == -1) {
- LOG(ERROR) << "Error reading file " << strerror(errno);
+ PLOG(ERROR) << "Error reading file";
return ++n_error;
}
llen -= bytes_read;
if (write(out_fd, read_buf.data(), bytes_read) == -1) {
- LOG(ERROR) << "Error writing data to file " << strerror(errno);
+ PLOG(ERROR) << "Error writing data to file";
return ++n_error;
}
if (bytes_read == 0) { // this should never happen, but just in case
// to unstuck from while loop
- LOG(ERROR) << "Unexpected read result for " << strerror(errno);
+ PLOG(ERROR) << "Unexpected read result";
n_error++;
break;
}
@@ -219,7 +215,7 @@
if (llen != 0) {
const uint32_t zero = 0;
if (write(out_fd, &zero, 4 - llen) == -1) {
- LOG(ERROR) << "Error padding 0s to file " << strerror(errno);
+ PLOG(ERROR) << "Error padding 0s to file";
return ++n_error;
}
}
@@ -234,7 +230,7 @@
sprintf(read_buf.data(), "070701%040X%056X%08XTRAILER!!!", 1,
0x0b, 0) +
4) == -1) {
- LOG(ERROR) << "Error writing trailing bytes " << strerror(errno);
+ PLOG(ERROR) << "Error writing trailing bytes";
return false;
}
return true;
@@ -248,7 +244,7 @@
size_t n_error = 0;
DIR* dir_dump = opendir(input_dir);
if (!dir_dump) {
- LOG(ERROR) << "Failed to open directory: " << strerror(errno);
+ PLOG(ERROR) << "Failed to open directory";
return ++n_error;
}
unique_fd dir_auto_closer(dirfd(dir_dump));
@@ -263,15 +259,13 @@
struct stat st;
const std::string cur_file_path = kTombstoneFolderPath + cur_file_name;
if (stat(cur_file_path.c_str(), &st) == -1) {
- LOG(ERROR) << "Failed to get file stat for " << cur_file_path
- << ": " << strerror(errno);
+ PLOG(ERROR) << "Failed to get file stat for " << cur_file_path;
n_error++;
continue;
}
const int fd_read = open(cur_file_path.c_str(), O_RDONLY);
if (fd_read == -1) {
- LOG(ERROR) << "Failed to open file " << cur_file_path << " "
- << strerror(errno);
+ PLOG(ERROR) << "Failed to open file " << cur_file_path;
n_error++;
continue;
}
@@ -1400,14 +1394,14 @@
kTombstoneFolderPath + item.first + "XXXXXXXXXX";
const int dump_fd = mkstemp(makeCharVec(file_path_raw).data());
if (dump_fd == -1) {
- LOG(ERROR) << "create file failed: " << strerror(errno);
+ PLOG(ERROR) << "create file failed";
return false;
}
unique_fd file_auto_closer(dump_fd);
for (const auto& cur_block : cur_buffer.getData()) {
if (write(dump_fd, cur_block.data(),
sizeof(cur_block[0]) * cur_block.size()) == -1) {
- LOG(ERROR) << "Error writing to file " << strerror(errno);
+ PLOG(ERROR) << "Error writing to file";
}
}
}
diff --git a/wifi/hostapd/1.0/Android.bp b/wifi/hostapd/1.0/Android.bp
index a17e153..9ee976e 100644
--- a/wifi/hostapd/1.0/Android.bp
+++ b/wifi/hostapd/1.0/Android.bp
@@ -14,10 +14,6 @@
"android.hardware.wifi.supplicant@1.0",
"android.hidl.base@1.0",
],
- types: [
- "HostapdStatus",
- "HostapdStatusCode",
- ],
gen_java: true,
}
diff --git a/wifi/offload/1.0/Android.bp b/wifi/offload/1.0/Android.bp
index c6c0e7a..1a9ae73 100644
--- a/wifi/offload/1.0/Android.bp
+++ b/wifi/offload/1.0/Android.bp
@@ -14,20 +14,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "Capability",
- "LogRecord",
- "NetworkInfo",
- "OffloadStatus",
- "OffloadStatusCode",
- "RecordName",
- "ScanFilter",
- "ScanParam",
- "ScanRecord",
- "ScanResult",
- "ScanStats",
- "SecurityMode",
- ],
gen_java: false,
}
diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp
index fc7ce55..c99706d 100644
--- a/wifi/supplicant/1.0/Android.bp
+++ b/wifi/supplicant/1.0/Android.bp
@@ -24,13 +24,6 @@
interfaces: [
"android.hidl.base@1.0",
],
- types: [
- "IfaceType",
- "P2pGroupCapabilityMask",
- "SupplicantStatus",
- "SupplicantStatusCode",
- "WpsConfigMethods",
- ],
gen_java: true,
}