diff options
author | android-build-team Robot | 2018-04-11 02:26:00 -0500 |
---|---|---|
committer | android-build-team Robot | 2018-04-11 02:26:00 -0500 |
commit | 22448b385f7e3c06fba57a7228080e9a84c27818 (patch) | |
tree | f9e2d639163308cbeec9ce98accce3bfebdd0681 | |
parent | 862b4d93fb2009a6e81a5cfd5e1041eae2510fc4 (diff) | |
parent | 862d844370300ac6efbe93bb73d076939b8eb9a5 (diff) | |
download | platform-hardware-interfaces-22448b385f7e3c06fba57a7228080e9a84c27818.tar.gz platform-hardware-interfaces-22448b385f7e3c06fba57a7228080e9a84c27818.tar.xz platform-hardware-interfaces-22448b385f7e3c06fba57a7228080e9a84c27818.zip |
Snap for 4713750 from 862d844370300ac6efbe93bb73d076939b8eb9a5 to pi-release
Change-Id: I87361c3d8080f55e2e38808b029c24bfc51aa140
-rw-r--r-- | audio/4.0/config/audio_policy_configuration.xsd | 12 | ||||
-rw-r--r-- | audio/effect/4.0/types.hal | 20 | ||||
-rw-r--r-- | audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h | 5 | ||||
-rw-r--r-- | camera/provider/2.4/vts/functional/Android.bp | 3 | ||||
-rw-r--r-- | camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp | 122 | ||||
-rw-r--r-- | cas/1.0/default/MediaCasService.cpp | 2 | ||||
-rw-r--r-- | current.txt | 2 | ||||
-rw-r--r-- | health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp | 16 | ||||
-rw-r--r-- | keymaster/4.0/vts/functional/HmacKeySharingTest.cpp | 7 | ||||
-rw-r--r-- | sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp | 27 | ||||
-rw-r--r-- | wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp | 10 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_nan_iface.cpp | 29 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_nan_iface.h | 11 | ||||
-rw-r--r-- | wifi/1.2/vts/functional/Android.bp | 15 | ||||
-rw-r--r-- | wifi/1.2/vts/functional/wifi_nan_iface_hidl_test.cpp | 538 |
15 files changed, 726 insertions, 93 deletions
diff --git a/audio/4.0/config/audio_policy_configuration.xsd b/audio/4.0/config/audio_policy_configuration.xsd index 34c2b111..14e4fd61 100644 --- a/audio/4.0/config/audio_policy_configuration.xsd +++ b/audio/4.0/config/audio_policy_configuration.xsd | |||
@@ -218,24 +218,20 @@ | |||
218 | 218 | ||
219 | <xs:enumeration value="AUDIO_DEVICE_OUT_EARPIECE"/> | 219 | <xs:enumeration value="AUDIO_DEVICE_OUT_EARPIECE"/> |
220 | <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER"/> | 220 | <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER"/> |
221 | <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER_SAFE"/> | ||
222 | <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADSET"/> | 221 | <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADSET"/> |
223 | <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADPHONE"/> | 222 | <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADPHONE"/> |
224 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO"/> | 223 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO"/> |
225 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET"/> | 224 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET"/> |
226 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT"/> | 225 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT"/> |
227 | <xs:enumeration value="AUDIO_DEVICE_OUT_ALL_SCO"/> | ||
228 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP"/> | 226 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP"/> |
229 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES"/> | 227 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES"/> |
230 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER"/> | 228 | <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER"/> |
231 | <xs:enumeration value="AUDIO_DEVICE_OUT_ALL_A2DP"/> | ||
232 | <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/> | 229 | <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/> |
233 | <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/> | 230 | <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/> |
234 | <xs:enumeration value="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET"/> | 231 | <xs:enumeration value="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET"/> |
235 | <xs:enumeration value="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET"/> | 232 | <xs:enumeration value="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET"/> |
236 | <xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/> | 233 | <xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/> |
237 | <xs:enumeration value="AUDIO_DEVICE_OUT_USB_DEVICE"/> | 234 | <xs:enumeration value="AUDIO_DEVICE_OUT_USB_DEVICE"/> |
238 | <xs:enumeration value="AUDIO_DEVICE_OUT_ALL_USB"/> | ||
239 | <xs:enumeration value="AUDIO_DEVICE_OUT_REMOTE_SUBMIX"/> | 235 | <xs:enumeration value="AUDIO_DEVICE_OUT_REMOTE_SUBMIX"/> |
240 | <xs:enumeration value="AUDIO_DEVICE_OUT_TELEPHONY_TX"/> | 236 | <xs:enumeration value="AUDIO_DEVICE_OUT_TELEPHONY_TX"/> |
241 | <xs:enumeration value="AUDIO_DEVICE_OUT_LINE"/> | 237 | <xs:enumeration value="AUDIO_DEVICE_OUT_LINE"/> |
@@ -243,10 +239,13 @@ | |||
243 | <xs:enumeration value="AUDIO_DEVICE_OUT_SPDIF"/> | 239 | <xs:enumeration value="AUDIO_DEVICE_OUT_SPDIF"/> |
244 | <xs:enumeration value="AUDIO_DEVICE_OUT_FM"/> | 240 | <xs:enumeration value="AUDIO_DEVICE_OUT_FM"/> |
245 | <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_LINE"/> | 241 | <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_LINE"/> |
242 | <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER_SAFE"/> | ||
246 | <xs:enumeration value="AUDIO_DEVICE_OUT_IP"/> | 243 | <xs:enumeration value="AUDIO_DEVICE_OUT_IP"/> |
247 | <xs:enumeration value="AUDIO_DEVICE_OUT_BUS"/> | 244 | <xs:enumeration value="AUDIO_DEVICE_OUT_BUS"/> |
248 | <xs:enumeration value="AUDIO_DEVICE_OUT_PROXY"/> | 245 | <xs:enumeration value="AUDIO_DEVICE_OUT_PROXY"/> |
249 | <xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/> | 246 | <xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/> |
247 | <xs:enumeration value="AUDIO_DEVICE_OUT_HEARING_AID"/> | ||
248 | <xs:enumeration value="AUDIO_DEVICE_OUT_ECHO_CANCELLER"/> | ||
250 | <xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/> | 249 | <xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/> |
251 | <xs:enumeration value="AUDIO_DEVICE_OUT_STUB"/> | 250 | <xs:enumeration value="AUDIO_DEVICE_OUT_STUB"/> |
252 | 251 | ||
@@ -255,19 +254,17 @@ | |||
255 | <xs:enumeration value="AUDIO_DEVICE_IN_AMBIENT"/> | 254 | <xs:enumeration value="AUDIO_DEVICE_IN_AMBIENT"/> |
256 | <xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/> | 255 | <xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/> |
257 | <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/> | 256 | <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/> |
258 | <xs:enumeration value="AUDIO_DEVICE_IN_ALL_SCO"/> | ||
259 | <xs:enumeration value="AUDIO_DEVICE_IN_WIRED_HEADSET"/> | 257 | <xs:enumeration value="AUDIO_DEVICE_IN_WIRED_HEADSET"/> |
260 | <xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/> | 258 | <xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/> |
261 | <xs:enumeration value="AUDIO_DEVICE_IN_HDMI"/> | 259 | <xs:enumeration value="AUDIO_DEVICE_IN_HDMI"/> |
262 | <xs:enumeration value="AUDIO_DEVICE_IN_TELEPHONY_RX"/> | ||
263 | <xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/> | 260 | <xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/> |
261 | <xs:enumeration value="AUDIO_DEVICE_IN_TELEPHONY_RX"/> | ||
264 | <xs:enumeration value="AUDIO_DEVICE_IN_BACK_MIC"/> | 262 | <xs:enumeration value="AUDIO_DEVICE_IN_BACK_MIC"/> |
265 | <xs:enumeration value="AUDIO_DEVICE_IN_REMOTE_SUBMIX"/> | 263 | <xs:enumeration value="AUDIO_DEVICE_IN_REMOTE_SUBMIX"/> |
266 | <xs:enumeration value="AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET"/> | 264 | <xs:enumeration value="AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET"/> |
267 | <xs:enumeration value="AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET"/> | 265 | <xs:enumeration value="AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET"/> |
268 | <xs:enumeration value="AUDIO_DEVICE_IN_USB_ACCESSORY"/> | 266 | <xs:enumeration value="AUDIO_DEVICE_IN_USB_ACCESSORY"/> |
269 | <xs:enumeration value="AUDIO_DEVICE_IN_USB_DEVICE"/> | 267 | <xs:enumeration value="AUDIO_DEVICE_IN_USB_DEVICE"/> |
270 | <xs:enumeration value="AUDIO_DEVICE_IN_ALL_USB"/> | ||
271 | <xs:enumeration value="AUDIO_DEVICE_IN_FM_TUNER"/> | 268 | <xs:enumeration value="AUDIO_DEVICE_IN_FM_TUNER"/> |
272 | <xs:enumeration value="AUDIO_DEVICE_IN_TV_TUNER"/> | 269 | <xs:enumeration value="AUDIO_DEVICE_IN_TV_TUNER"/> |
273 | <xs:enumeration value="AUDIO_DEVICE_IN_LINE"/> | 270 | <xs:enumeration value="AUDIO_DEVICE_IN_LINE"/> |
@@ -278,6 +275,7 @@ | |||
278 | <xs:enumeration value="AUDIO_DEVICE_IN_BUS"/> | 275 | <xs:enumeration value="AUDIO_DEVICE_IN_BUS"/> |
279 | <xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/> | 276 | <xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/> |
280 | <xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/> | 277 | <xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/> |
278 | <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/> | ||
281 | <xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/> | 279 | <xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/> |
282 | <xs:enumeration value="AUDIO_DEVICE_IN_STUB"/> | 280 | <xs:enumeration value="AUDIO_DEVICE_IN_STUB"/> |
283 | </xs:restriction> | 281 | </xs:restriction> |
diff --git a/audio/effect/4.0/types.hal b/audio/effect/4.0/types.hal index 0f766014..2a8f4b86 100644 --- a/audio/effect/4.0/types.hal +++ b/audio/effect/4.0/types.hal | |||
@@ -200,16 +200,16 @@ enum EffectFlags : int32_t { | |||
200 | * enumeration of the effect engines present in a library. | 200 | * enumeration of the effect engines present in a library. |
201 | */ | 201 | */ |
202 | struct EffectDescriptor { | 202 | struct EffectDescriptor { |
203 | Uuid type; // UUID of to the OpenSL ES interface implemented | 203 | Uuid type; // UUID of to the OpenSL ES interface implemented |
204 | // by this effect | 204 | // by this effect |
205 | Uuid uuid; // UUID for this particular implementation | 205 | Uuid uuid; // UUID for this particular implementation |
206 | EffectFlags flags; // effect engine capabilities/requirements flags | 206 | bitfield<EffectFlags> flags; // effect engine capabilities/requirements flags |
207 | uint16_t cpuLoad; // CPU load indication expressed in 0.1 MIPS units | 207 | uint16_t cpuLoad; // CPU load indication expressed in 0.1 MIPS units |
208 | // as estimated on an ARM9E core (ARMv5TE) with 0 WS | 208 | // as estimated on an ARM9E core (ARMv5TE) with 0 WS |
209 | uint16_t memoryUsage; // data memory usage expressed in KB and includes | 209 | uint16_t memoryUsage; // data memory usage expressed in KB and includes |
210 | // only dynamically allocated memory | 210 | // only dynamically allocated memory |
211 | uint8_t[64] name; // human readable effect name | 211 | uint8_t[64] name; // human readable effect name |
212 | uint8_t[64] implementor; // human readable effect implementor name | 212 | uint8_t[64] implementor; // human readable effect implementor name |
213 | }; | 213 | }; |
214 | 214 | ||
215 | /** | 215 | /** |
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h b/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h index 44adf4b2..de67d89d 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h +++ b/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h | |||
@@ -19,7 +19,10 @@ | |||
19 | #include <memory.h> | 19 | #include <memory.h> |
20 | #include <stdio.h> | 20 | #include <stdio.h> |
21 | 21 | ||
22 | #include <common/all-versions/VersionUtils.h> | ||
23 | |||
22 | using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils; | 24 | using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils; |
25 | using ::android::hardware::audio::common::utils::mkEnumConverter; | ||
23 | 26 | ||
24 | namespace android { | 27 | namespace android { |
25 | namespace hardware { | 28 | namespace hardware { |
@@ -32,7 +35,7 @@ void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor, | |||
32 | EffectDescriptor* descriptor) { | 35 | EffectDescriptor* descriptor) { |
33 | HidlUtils::uuidFromHal(halDescriptor.type, &descriptor->type); | 36 | HidlUtils::uuidFromHal(halDescriptor.type, &descriptor->type); |
34 | HidlUtils::uuidFromHal(halDescriptor.uuid, &descriptor->uuid); | 37 | HidlUtils::uuidFromHal(halDescriptor.uuid, &descriptor->uuid); |
35 | descriptor->flags = EffectFlags(halDescriptor.flags); | 38 | descriptor->flags = mkEnumConverter<EffectFlags>(halDescriptor.flags); |
36 | descriptor->cpuLoad = halDescriptor.cpuLoad; | 39 | descriptor->cpuLoad = halDescriptor.cpuLoad; |
37 | descriptor->memoryUsage = halDescriptor.memoryUsage; | 40 | descriptor->memoryUsage = halDescriptor.memoryUsage; |
38 | memcpy(descriptor->name.data(), halDescriptor.name, descriptor->name.size()); | 41 | memcpy(descriptor->name.data(), halDescriptor.name, descriptor->name.size()); |
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp index 08b9222e..ead4083e 100644 --- a/camera/provider/2.4/vts/functional/Android.bp +++ b/camera/provider/2.4/vts/functional/Android.bp | |||
@@ -38,8 +38,11 @@ cc_test { | |||
38 | "android.hardware.camera.device@3.3", | 38 | "android.hardware.camera.device@3.3", |
39 | "android.hardware.camera.device@3.4", | 39 | "android.hardware.camera.device@3.4", |
40 | "android.hardware.camera.provider@2.4", | 40 | "android.hardware.camera.provider@2.4", |
41 | "android.hardware.graphics.allocator@2.0", | ||
41 | "android.hardware.graphics.common@1.0", | 42 | "android.hardware.graphics.common@1.0", |
42 | "android.hardware.graphics.mapper@2.0", | 43 | "android.hardware.graphics.mapper@2.0", |
44 | "android.hidl.allocator@1.0", | ||
43 | "libgrallocusage", | 45 | "libgrallocusage", |
46 | "libhidlmemory", | ||
44 | ], | 47 | ], |
45 | } | 48 | } |
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 5feec87a..637e2808 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp | |||
@@ -48,6 +48,13 @@ | |||
48 | #include <system/camera_metadata.h> | 48 | #include <system/camera_metadata.h> |
49 | #include <ui/GraphicBuffer.h> | 49 | #include <ui/GraphicBuffer.h> |
50 | 50 | ||
51 | #include <android/hardware/graphics/allocator/2.0/IAllocator.h> | ||
52 | #include <android/hardware/graphics/mapper/2.0/IMapper.h> | ||
53 | #include <android/hardware/graphics/mapper/2.0/types.h> | ||
54 | #include <android/hidl/allocator/1.0/IAllocator.h> | ||
55 | #include <android/hidl/memory/1.0/IMapper.h> | ||
56 | #include <android/hidl/memory/1.0/IMemory.h> | ||
57 | |||
51 | #include <VtsHalHidlTargetTestBase.h> | 58 | #include <VtsHalHidlTargetTestBase.h> |
52 | #include <VtsHalHidlTargetTestEnvBase.h> | 59 | #include <VtsHalHidlTargetTestEnvBase.h> |
53 | 60 | ||
@@ -105,6 +112,9 @@ using ::android::hardware::camera::device::V1_0::FrameCallbackFlag; | |||
105 | using ::android::hardware::camera::device::V1_0::HandleTimestampMessage; | 112 | using ::android::hardware::camera::device::V1_0::HandleTimestampMessage; |
106 | using ::android::hardware::MessageQueue; | 113 | using ::android::hardware::MessageQueue; |
107 | using ::android::hardware::kSynchronizedReadWrite; | 114 | using ::android::hardware::kSynchronizedReadWrite; |
115 | using ::android::hidl::allocator::V1_0::IAllocator; | ||
116 | using ::android::hidl::memory::V1_0::IMemory; | ||
117 | using ::android::hidl::memory::V1_0::IMapper; | ||
108 | using ResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>; | 118 | using ResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>; |
109 | using ::android::hidl::manager::V1_0::IServiceManager; | 119 | using ::android::hidl::manager::V1_0::IServiceManager; |
110 | 120 | ||
@@ -621,6 +631,8 @@ public: | |||
621 | void setParameters( | 631 | void setParameters( |
622 | const sp<::android::hardware::camera::device::V1_0::ICameraDevice> &device, | 632 | const sp<::android::hardware::camera::device::V1_0::ICameraDevice> &device, |
623 | const CameraParameters &cameraParams); | 633 | const CameraParameters &cameraParams); |
634 | void allocateGraphicBuffer(uint32_t width, uint32_t height, uint64_t usage, | ||
635 | PixelFormat format, hidl_handle *buffer_handle /*out*/); | ||
624 | void waitForFrameLocked(DataCallbackMsg msgFrame, | 636 | void waitForFrameLocked(DataCallbackMsg msgFrame, |
625 | std::unique_lock<std::mutex> &l); | 637 | std::unique_lock<std::mutex> &l); |
626 | void openEmptyDeviceSession(const std::string &name, | 638 | void openEmptyDeviceSession(const std::string &name, |
@@ -3297,15 +3309,15 @@ TEST_F(CameraHidlTest, processCaptureRequestPreview) { | |||
3297 | }); | 3309 | }); |
3298 | ASSERT_TRUE(ret.isOk()); | 3310 | ASSERT_TRUE(ret.isOk()); |
3299 | 3311 | ||
3300 | sp<GraphicBuffer> gb = new GraphicBuffer( | 3312 | hidl_handle buffer_handle; |
3301 | previewStream.width, previewStream.height, | 3313 | allocateGraphicBuffer(previewStream.width, previewStream.height, |
3302 | static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat), 1, | 3314 | android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage, |
3303 | android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage, | 3315 | halStreamConfig.streams[0].consumerUsage), |
3304 | halStreamConfig.streams[0].consumerUsage)); | 3316 | halStreamConfig.streams[0].overrideFormat, &buffer_handle); |
3305 | ASSERT_NE(nullptr, gb.get()); | 3317 | |
3306 | StreamBuffer outputBuffer = {halStreamConfig.streams[0].id, | 3318 | StreamBuffer outputBuffer = {halStreamConfig.streams[0].id, |
3307 | bufferId, | 3319 | bufferId, |
3308 | hidl_handle(gb->getNativeBuffer()->handle), | 3320 | buffer_handle, |
3309 | BufferStatus::OK, | 3321 | BufferStatus::OK, |
3310 | nullptr, | 3322 | nullptr, |
3311 | nullptr}; | 3323 | nullptr}; |
@@ -3497,20 +3509,20 @@ TEST_F(CameraHidlTest, processMultiCaptureRequestPreview) { | |||
3497 | InFlightRequest inflightReq = {static_cast<ssize_t> (halStreamConfig.streams.size()), false, | 3509 | InFlightRequest inflightReq = {static_cast<ssize_t> (halStreamConfig.streams.size()), false, |
3498 | supportsPartialResults, partialResultCount, resultQueue}; | 3510 | supportsPartialResults, partialResultCount, resultQueue}; |
3499 | 3511 | ||
3500 | std::vector<sp<GraphicBuffer>> graphicBuffers; | 3512 | std::vector<hidl_handle> graphicBuffers; |
3501 | graphicBuffers.reserve(halStreamConfig.streams.size()); | 3513 | graphicBuffers.reserve(halStreamConfig.streams.size()); |
3502 | ::android::hardware::hidl_vec<StreamBuffer> outputBuffers; | 3514 | ::android::hardware::hidl_vec<StreamBuffer> outputBuffers; |
3503 | outputBuffers.resize(halStreamConfig.streams.size()); | 3515 | outputBuffers.resize(halStreamConfig.streams.size()); |
3504 | size_t k = 0; | 3516 | size_t k = 0; |
3505 | for (const auto& halStream : halStreamConfig.streams) { | 3517 | for (const auto& halStream : halStreamConfig.streams) { |
3506 | sp<GraphicBuffer> gb = new GraphicBuffer(previewStream.width, previewStream.height, | 3518 | hidl_handle buffer_handle; |
3507 | static_cast<int32_t>(halStream.v3_3.v3_2.overrideFormat), 1, | 3519 | allocateGraphicBuffer(previewStream.width, previewStream.height, |
3508 | android_convertGralloc1To0Usage( | 3520 | android_convertGralloc1To0Usage(halStream.v3_3.v3_2.producerUsage, |
3509 | halStream.v3_3.v3_2.producerUsage, halStream.v3_3.v3_2.consumerUsage)); | 3521 | halStream.v3_3.v3_2.consumerUsage), |
3510 | ASSERT_NE(nullptr, gb.get()); | 3522 | halStream.v3_3.v3_2.overrideFormat, &buffer_handle); |
3511 | graphicBuffers.push_back(gb); | 3523 | graphicBuffers.push_back(buffer_handle); |
3512 | outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, | 3524 | outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, buffer_handle, |
3513 | hidl_handle(gb->getNativeBuffer()->handle), BufferStatus::OK, nullptr, nullptr}; | 3525 | BufferStatus::OK, nullptr, nullptr}; |
3514 | bufferId++; | 3526 | bufferId++; |
3515 | k++; | 3527 | k++; |
3516 | } | 3528 | } |
@@ -3689,7 +3701,7 @@ TEST_F(CameraHidlTest, processCaptureRequestBurstISO) { | |||
3689 | 3701 | ||
3690 | ::android::hardware::camera::common::V1_0::helper::CameraMetadata requestMeta; | 3702 | ::android::hardware::camera::common::V1_0::helper::CameraMetadata requestMeta; |
3691 | StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr}; | 3703 | StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr}; |
3692 | sp<GraphicBuffer> buffers[kBurstFrameCount]; | 3704 | hidl_handle buffers[kBurstFrameCount]; |
3693 | StreamBuffer outputBuffers[kBurstFrameCount]; | 3705 | StreamBuffer outputBuffers[kBurstFrameCount]; |
3694 | CaptureRequest requests[kBurstFrameCount]; | 3706 | CaptureRequest requests[kBurstFrameCount]; |
3695 | InFlightRequest inflightReqs[kBurstFrameCount]; | 3707 | InFlightRequest inflightReqs[kBurstFrameCount]; |
@@ -3699,15 +3711,13 @@ TEST_F(CameraHidlTest, processCaptureRequestBurstISO) { | |||
3699 | std::unique_lock<std::mutex> l(mLock); | 3711 | std::unique_lock<std::mutex> l(mLock); |
3700 | 3712 | ||
3701 | isoValues[i] = ((i % 2) == 0) ? isoRange.data.i32[0] : isoRange.data.i32[1]; | 3713 | isoValues[i] = ((i % 2) == 0) ? isoRange.data.i32[0] : isoRange.data.i32[1]; |
3702 | buffers[i] = new GraphicBuffer( previewStream.width, previewStream.height, | 3714 | allocateGraphicBuffer(previewStream.width, previewStream.height, |
3703 | static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat), 1, | 3715 | android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage, |
3704 | android_convertGralloc1To0Usage( halStreamConfig.streams[0].producerUsage, | 3716 | halStreamConfig.streams[0].consumerUsage), |
3705 | halStreamConfig.streams[0].consumerUsage)); | 3717 | halStreamConfig.streams[0].overrideFormat, &buffers[i]); |
3706 | ASSERT_NE(nullptr, buffers[i].get()); | ||
3707 | 3718 | ||
3708 | outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i, | 3719 | outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i, |
3709 | hidl_handle( buffers[i]->getNativeBuffer()->handle), BufferStatus::OK, nullptr, | 3720 | buffers[i], BufferStatus::OK, nullptr, nullptr}; |
3710 | nullptr}; | ||
3711 | requestMeta.append(reinterpret_cast<camera_metadata_t *> (settings.data())); | 3721 | requestMeta.append(reinterpret_cast<camera_metadata_t *> (settings.data())); |
3712 | 3722 | ||
3713 | // Disable all 3A routines | 3723 | // Disable all 3A routines |
@@ -3795,15 +3805,15 @@ TEST_F(CameraHidlTest, processCaptureRequestInvalidSinglePreview) { | |||
3795 | &supportsPartialResults /*out*/, | 3805 | &supportsPartialResults /*out*/, |
3796 | &partialResultCount /*out*/); | 3806 | &partialResultCount /*out*/); |
3797 | 3807 | ||
3798 | sp<GraphicBuffer> gb = new GraphicBuffer( | 3808 | hidl_handle buffer_handle; |
3799 | previewStream.width, previewStream.height, | 3809 | allocateGraphicBuffer(previewStream.width, previewStream.height, |
3800 | static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat), 1, | 3810 | android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage, |
3801 | android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage, | 3811 | halStreamConfig.streams[0].consumerUsage), |
3802 | halStreamConfig.streams[0].consumerUsage)); | 3812 | halStreamConfig.streams[0].overrideFormat, &buffer_handle); |
3803 | 3813 | ||
3804 | StreamBuffer outputBuffer = {halStreamConfig.streams[0].id, | 3814 | StreamBuffer outputBuffer = {halStreamConfig.streams[0].id, |
3805 | bufferId, | 3815 | bufferId, |
3806 | hidl_handle(gb->getNativeBuffer()->handle), | 3816 | buffer_handle, |
3807 | BufferStatus::OK, | 3817 | BufferStatus::OK, |
3808 | nullptr, | 3818 | nullptr, |
3809 | nullptr}; | 3819 | nullptr}; |
@@ -3953,15 +3963,15 @@ TEST_F(CameraHidlTest, flushPreviewRequest) { | |||
3953 | }); | 3963 | }); |
3954 | ASSERT_TRUE(ret.isOk()); | 3964 | ASSERT_TRUE(ret.isOk()); |
3955 | 3965 | ||
3956 | sp<GraphicBuffer> gb = new GraphicBuffer( | 3966 | hidl_handle buffer_handle; |
3957 | previewStream.width, previewStream.height, | 3967 | allocateGraphicBuffer(previewStream.width, previewStream.height, |
3958 | static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat), 1, | 3968 | android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage, |
3959 | android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage, | 3969 | halStreamConfig.streams[0].consumerUsage), |
3960 | halStreamConfig.streams[0].consumerUsage)); | 3970 | halStreamConfig.streams[0].overrideFormat, &buffer_handle); |
3961 | ASSERT_NE(nullptr, gb.get()); | 3971 | |
3962 | StreamBuffer outputBuffer = {halStreamConfig.streams[0].id, | 3972 | StreamBuffer outputBuffer = {halStreamConfig.streams[0].id, |
3963 | bufferId, | 3973 | bufferId, |
3964 | hidl_handle(gb->getNativeBuffer()->handle), | 3974 | buffer_handle, |
3965 | BufferStatus::OK, | 3975 | BufferStatus::OK, |
3966 | nullptr, | 3976 | nullptr, |
3967 | nullptr}; | 3977 | nullptr}; |
@@ -4794,6 +4804,44 @@ void CameraHidlTest::setParameters( | |||
4794 | ASSERT_EQ(Status::OK, returnStatus); | 4804 | ASSERT_EQ(Status::OK, returnStatus); |
4795 | } | 4805 | } |
4796 | 4806 | ||
4807 | void CameraHidlTest::allocateGraphicBuffer(uint32_t width, uint32_t height, uint64_t usage, | ||
4808 | PixelFormat format, hidl_handle *buffer_handle /*out*/) { | ||
4809 | ASSERT_NE(buffer_handle, nullptr); | ||
4810 | |||
4811 | sp<android::hardware::graphics::allocator::V2_0::IAllocator> allocator = | ||
4812 | android::hardware::graphics::allocator::V2_0::IAllocator::getService(); | ||
4813 | ASSERT_NE(nullptr, allocator.get()); | ||
4814 | |||
4815 | sp<android::hardware::graphics::mapper::V2_0::IMapper> mapper = | ||
4816 | android::hardware::graphics::mapper::V2_0::IMapper::getService(); | ||
4817 | ASSERT_NE(mapper.get(), nullptr); | ||
4818 | |||
4819 | android::hardware::graphics::mapper::V2_0::IMapper::BufferDescriptorInfo descriptorInfo {}; | ||
4820 | descriptorInfo.width = width; | ||
4821 | descriptorInfo.height = height; | ||
4822 | descriptorInfo.layerCount = 1; | ||
4823 | descriptorInfo.format = format; | ||
4824 | descriptorInfo.usage = usage; | ||
4825 | |||
4826 | ::android::hardware::hidl_vec<uint32_t> descriptor; | ||
4827 | auto ret = mapper->createDescriptor( | ||
4828 | descriptorInfo, [&descriptor](android::hardware::graphics::mapper::V2_0::Error err, | ||
4829 | ::android::hardware::hidl_vec<uint32_t> desc) { | ||
4830 | ASSERT_EQ(err, android::hardware::graphics::mapper::V2_0::Error::NONE); | ||
4831 | descriptor = desc; | ||
4832 | }); | ||
4833 | ASSERT_TRUE(ret.isOk()); | ||
4834 | |||
4835 | ret = allocator->allocate(descriptor, 1u, | ||
4836 | [&](android::hardware::graphics::mapper::V2_0::Error err, uint32_t /*stride*/, | ||
4837 | const ::android::hardware::hidl_vec<::android::hardware::hidl_handle>& buffers) { | ||
4838 | ASSERT_EQ(android::hardware::graphics::mapper::V2_0::Error::NONE, err); | ||
4839 | ASSERT_EQ(buffers.size(), 1u); | ||
4840 | *buffer_handle = buffers[0]; | ||
4841 | }); | ||
4842 | ASSERT_TRUE(ret.isOk()); | ||
4843 | } | ||
4844 | |||
4797 | int main(int argc, char **argv) { | 4845 | int main(int argc, char **argv) { |
4798 | ::testing::AddGlobalTestEnvironment(CameraHidlEnvironment::Instance()); | 4846 | ::testing::AddGlobalTestEnvironment(CameraHidlEnvironment::Instance()); |
4799 | ::testing::InitGoogleTest(&argc, argv); | 4847 | ::testing::InitGoogleTest(&argc, argv); |
diff --git a/cas/1.0/default/MediaCasService.cpp b/cas/1.0/default/MediaCasService.cpp index ca432246..dbdd0087 100644 --- a/cas/1.0/default/MediaCasService.cpp +++ b/cas/1.0/default/MediaCasService.cpp | |||
@@ -69,7 +69,7 @@ Return<sp<ICas>> MediaCasService::createPlugin( | |||
69 | if (mCasLoader.findFactoryForScheme(CA_system_id, &library, &factory)) { | 69 | if (mCasLoader.findFactoryForScheme(CA_system_id, &library, &factory)) { |
70 | CasPlugin *plugin = NULL; | 70 | CasPlugin *plugin = NULL; |
71 | sp<CasImpl> casImpl = new CasImpl(listener); | 71 | sp<CasImpl> casImpl = new CasImpl(listener); |
72 | if (factory->createPlugin(CA_system_id, (uint64_t)casImpl.get(), | 72 | if (factory->createPlugin(CA_system_id, casImpl.get(), |
73 | &CasImpl::OnEvent, &plugin) == OK && plugin != NULL) { | 73 | &CasImpl::OnEvent, &plugin) == OK && plugin != NULL) { |
74 | casImpl->init(library, plugin); | 74 | casImpl->init(library, plugin); |
75 | result = casImpl; | 75 | result = casImpl; |
diff --git a/current.txt b/current.txt index 0d792720..f7447970 100644 --- a/current.txt +++ b/current.txt | |||
@@ -286,7 +286,7 @@ a91b547f5922f39fe4231d97fac1c3825c1c1b0c8ef7a5136689ceed37e8bfe9 android.hardwar | |||
286 | 3661fa0623056922fdc4235ac5a9c91a2d066ab6f1ab4297e3b240fe302ba500 android.hardware.audio.effect@4.0::IPresetReverbEffect | 286 | 3661fa0623056922fdc4235ac5a9c91a2d066ab6f1ab4297e3b240fe302ba500 android.hardware.audio.effect@4.0::IPresetReverbEffect |
287 | e88e520f8c98a62fccd8d5316c6687808f775de145d1405a7a9a66587ee6a001 android.hardware.audio.effect@4.0::IVirtualizerEffect | 287 | e88e520f8c98a62fccd8d5316c6687808f775de145d1405a7a9a66587ee6a001 android.hardware.audio.effect@4.0::IVirtualizerEffect |
288 | fe28829dab10d171783b79ac9cc45412739f8ff275e90228d7c6370ef189b859 android.hardware.audio.effect@4.0::IVisualizerEffect | 288 | fe28829dab10d171783b79ac9cc45412739f8ff275e90228d7c6370ef189b859 android.hardware.audio.effect@4.0::IVisualizerEffect |
289 | 5d92f6fd58d40c56611bb12f03be6af9bcf2bb73dfb35b77a99bbf2c3ea5439b android.hardware.audio.effect@4.0::types | 289 | 21c8a702579356480236c6851b5b2c16b9bd369ce12bdd6ffdc4626a89f34f73 android.hardware.audio.effect@4.0::types |
290 | 42a06dc288f61b0690580f3d37b30b663c31d74d50bb58d0772386b550d5faab android.hardware.authsecret@1.0::IAuthSecret | 290 | 42a06dc288f61b0690580f3d37b30b663c31d74d50bb58d0772386b550d5faab android.hardware.authsecret@1.0::IAuthSecret |
291 | a0f93c768c353cecee6237fe479bce47404eb10b629fafe07e32a054fd67f2af android.hardware.automotive.audiocontrol@1.0::IAudioControl | 291 | a0f93c768c353cecee6237fe479bce47404eb10b629fafe07e32a054fd67f2af android.hardware.automotive.audiocontrol@1.0::IAudioControl |
292 | ca515ff4b63c80cf5ad7b3395c997c57d6c56157361f6c367d1c96f23cc4860a android.hardware.automotive.audiocontrol@1.0::types | 292 | ca515ff4b63c80cf5ad7b3395c997c57d6c56157361f6c367d1c96f23cc4860a android.hardware.automotive.audiocontrol@1.0::types |
diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp index 972bc7f6..c5431e45 100644 --- a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp +++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp | |||
@@ -190,18 +190,6 @@ bool verifyStorageInfo(const hidl_vec<struct StorageInfo>& info) { | |||
190 | return true; | 190 | return true; |
191 | } | 191 | } |
192 | 192 | ||
193 | bool verifyDiskStats(const hidl_vec<struct DiskStats>& stats) { | ||
194 | for (size_t i = 0; i < stats.size(); i++) { | ||
195 | if (!(stats[i].reads > 0 && stats[i].readMerges > 0 && stats[i].readSectors > 0 && | ||
196 | stats[i].readTicks > 0 && stats[i].writes > 0 && stats[i].writeMerges > 0 && | ||
197 | stats[i].writeSectors > 0 && stats[i].writeTicks > 0 && stats[i].ioTicks > 0)) { | ||
198 | return false; | ||
199 | } | ||
200 | } | ||
201 | |||
202 | return true; | ||
203 | } | ||
204 | |||
205 | template <typename T> | 193 | template <typename T> |
206 | bool verifyEnum(T value) { | 194 | bool verifyEnum(T value) { |
207 | for (auto it : hidl_enum_iterator<T>()) { | 195 | for (auto it : hidl_enum_iterator<T>()) { |
@@ -214,7 +202,7 @@ bool verifyEnum(T value) { | |||
214 | } | 202 | } |
215 | 203 | ||
216 | bool verifyHealthInfo(const HealthInfo& health_info) { | 204 | bool verifyHealthInfo(const HealthInfo& health_info) { |
217 | if (!verifyStorageInfo(health_info.storageInfos) || !verifyDiskStats(health_info.diskStats)) { | 205 | if (!verifyStorageInfo(health_info.storageInfos)) { |
218 | return false; | 206 | return false; |
219 | } | 207 | } |
220 | 208 | ||
@@ -264,7 +252,7 @@ TEST_F(HealthHidlTest, Properties) { | |||
264 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyStorageInfo(value)); | 252 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyStorageInfo(value)); |
265 | })); | 253 | })); |
266 | EXPECT_OK(mHealth->getDiskStats([](auto result, auto& value) { | 254 | EXPECT_OK(mHealth->getDiskStats([](auto result, auto& value) { |
267 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyDiskStats(value)); | 255 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), true); |
268 | })); | 256 | })); |
269 | EXPECT_OK(mHealth->getHealthInfo([](auto result, auto& value) { | 257 | EXPECT_OK(mHealth->getHealthInfo([](auto result, auto& value) { |
270 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyHealthInfo(value)); | 258 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyHealthInfo(value)); |
diff --git a/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp b/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp index 96c47a8d..f1597969 100644 --- a/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp +++ b/keymaster/4.0/vts/functional/HmacKeySharingTest.cpp | |||
@@ -136,6 +136,7 @@ TEST_F(HmacKeySharingTest, ComputeSharedHmac) { | |||
136 | 136 | ||
137 | responses = computeSharedHmac(all_keymasters(), params); | 137 | responses = computeSharedHmac(all_keymasters(), params); |
138 | ASSERT_GT(responses.size(), 0U); | 138 | ASSERT_GT(responses.size(), 0U); |
139 | ASSERT_EQ(32U, responses[0].sharing_check.size()); | ||
139 | verifyResponses(responses[0].sharing_check, responses); | 140 | verifyResponses(responses[0].sharing_check, responses); |
140 | } | 141 | } |
141 | 142 | ||
@@ -216,7 +217,11 @@ TEST_F(HmacKeySharingTest, ComputeSharedHmacCorruptSeed) { | |||
216 | // matter what value is in the additional byte; it changes the seed regardless. | 217 | // matter what value is in the additional byte; it changes the seed regardless. |
217 | auto param_to_tweak = rand() % params.size(); | 218 | auto param_to_tweak = rand() % params.size(); |
218 | auto& to_tweak = params[param_to_tweak].seed; | 219 | auto& to_tweak = params[param_to_tweak].seed; |
219 | to_tweak.resize(to_tweak.size() + 1); | 220 | ASSERT_TRUE(to_tweak.size() == 32 || to_tweak.size() == 0); |
221 | if (!to_tweak.size()) { | ||
222 | to_tweak.resize(32); // Contents don't matter; a little randomization is nice. | ||
223 | } | ||
224 | to_tweak[0]++; | ||
220 | 225 | ||
221 | responses = computeSharedHmac(all_keymasters(), params); | 226 | responses = computeSharedHmac(all_keymasters(), params); |
222 | for (size_t i = 0; i < responses.size(); ++i) { | 227 | for (size_t i = 0; i < responses.size(); ++i) { |
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp index 24b58a78..c18eedd1 100644 --- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp +++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp | |||
@@ -956,6 +956,7 @@ void SensorsHidlTest::testStreamingOperation(SensorType type, | |||
956 | std::chrono::seconds duration, | 956 | std::chrono::seconds duration, |
957 | const SensorEventsChecker &checker) { | 957 | const SensorEventsChecker &checker) { |
958 | std::vector<Event> events; | 958 | std::vector<Event> events; |
959 | std::vector<Event> sensorEvents; | ||
959 | 960 | ||
960 | const int64_t samplingPeriodInNs = samplingPeriod.count(); | 961 | const int64_t samplingPeriodInNs = samplingPeriod.count(); |
961 | const int64_t batchingPeriodInNs = 0; // no batching | 962 | const int64_t batchingPeriodInNs = 0; // no batching |
@@ -985,7 +986,6 @@ void SensorsHidlTest::testStreamingOperation(SensorType type, | |||
985 | 986 | ||
986 | ASSERT_GT(events.size(), 0u); | 987 | ASSERT_GT(events.size(), 0u); |
987 | 988 | ||
988 | size_t nRealEvent = 0; | ||
989 | bool handleMismatchReported = false; | 989 | bool handleMismatchReported = false; |
990 | bool metaSensorTypeErrorReported = false; | 990 | bool metaSensorTypeErrorReported = false; |
991 | for (auto & e : events) { | 991 | for (auto & e : events) { |
@@ -996,7 +996,7 @@ void SensorsHidlTest::testStreamingOperation(SensorType type, | |||
996 | << (handleMismatchReported = true, | 996 | << (handleMismatchReported = true, |
997 | "Event of the same type must come from the sensor registered"); | 997 | "Event of the same type must come from the sensor registered"); |
998 | } | 998 | } |
999 | ++ nRealEvent; | 999 | sensorEvents.push_back(e); |
1000 | } else { | 1000 | } else { |
1001 | // avoid generating hundreds of error | 1001 | // avoid generating hundreds of error |
1002 | if (!metaSensorTypeErrorReported) { | 1002 | if (!metaSensorTypeErrorReported) { |
@@ -1008,9 +1008,10 @@ void SensorsHidlTest::testStreamingOperation(SensorType type, | |||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | std::string s; | 1010 | std::string s; |
1011 | EXPECT_TRUE(checker.check(events, &s)) << s; | 1011 | EXPECT_TRUE(checker.check(sensorEvents, &s)) << s; |
1012 | 1012 | ||
1013 | EXPECT_GE(nRealEvent, minNEvent / 2); // make sure returned events are not all meta | 1013 | EXPECT_GE(sensorEvents.size(), |
1014 | minNEvent / 2); // make sure returned events are not all meta | ||
1014 | } | 1015 | } |
1015 | 1016 | ||
1016 | // Test if sensor hal can do UI speed accelerometer streaming properly | 1017 | // Test if sensor hal can do UI speed accelerometer streaming properly |
@@ -1367,16 +1368,24 @@ void SensorsHidlTest::testDirectReportOperation( | |||
1367 | bool typeErrorReported = false; | 1368 | bool typeErrorReported = false; |
1368 | bool tokenErrorReported = false; | 1369 | bool tokenErrorReported = false; |
1369 | bool timestampErrorReported = false; | 1370 | bool timestampErrorReported = false; |
1371 | std::vector<Event> sensorEvents; | ||
1370 | for (auto &e : events) { | 1372 | for (auto &e : events) { |
1371 | if (!typeErrorReported) { | ||
1372 | EXPECT_EQ(type, e.sensorType) | ||
1373 | << (typeErrorReported = true, "Type in event does not match type of sensor registered."); | ||
1374 | } | ||
1375 | if (!tokenErrorReported) { | 1373 | if (!tokenErrorReported) { |
1376 | EXPECT_EQ(eventToken, e.sensorHandle) | 1374 | EXPECT_EQ(eventToken, e.sensorHandle) |
1377 | << (tokenErrorReported = true, | 1375 | << (tokenErrorReported = true, |
1378 | "Event token does not match that retured from configDirectReport"); | 1376 | "Event token does not match that retured from configDirectReport"); |
1379 | } | 1377 | } |
1378 | |||
1379 | if (isMetaSensorType(e.sensorType)) { | ||
1380 | continue; | ||
1381 | } | ||
1382 | sensorEvents.push_back(e); | ||
1383 | |||
1384 | if (!typeErrorReported) { | ||
1385 | EXPECT_EQ(type, e.sensorType) | ||
1386 | << (typeErrorReported = true, | ||
1387 | "Type in event does not match type of sensor registered."); | ||
1388 | } | ||
1380 | if (!timestampErrorReported) { | 1389 | if (!timestampErrorReported) { |
1381 | EXPECT_GT(e.timestamp, lastTimestamp) | 1390 | EXPECT_GT(e.timestamp, lastTimestamp) |
1382 | << (timestampErrorReported = true, "Timestamp not monotonically increasing"); | 1391 | << (timestampErrorReported = true, "Timestamp not monotonically increasing"); |
@@ -1385,7 +1394,7 @@ void SensorsHidlTest::testDirectReportOperation( | |||
1385 | } | 1394 | } |
1386 | 1395 | ||
1387 | std::string s; | 1396 | std::string s; |
1388 | EXPECT_TRUE(checker.check(events, &s)) << s; | 1397 | EXPECT_TRUE(checker.check(sensorEvents, &s)) << s; |
1389 | 1398 | ||
1390 | // stop sensor and unregister channel | 1399 | // stop sensor and unregister channel |
1391 | configDirectReport(sensor.sensorHandle, channelHandle, RateLevel::STOP, | 1400 | configDirectReport(sensor.sensorHandle, channelHandle, RateLevel::STOP, |
diff --git a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp index 0c5bd45f..d16f1e77 100644 --- a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp +++ b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp | |||
@@ -88,7 +88,10 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase { | |||
88 | uint32_t configureChipForStaIfaceAndGetCapabilities() { | 88 | uint32_t configureChipForStaIfaceAndGetCapabilities() { |
89 | configureChipForIfaceType(IfaceType::STA, true); | 89 | configureChipForIfaceType(IfaceType::STA, true); |
90 | const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities); | 90 | const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities); |
91 | EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); | 91 | if (status_and_caps.first.code != WifiStatusCode::SUCCESS) { |
92 | EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status_and_caps.first.code); | ||
93 | return 0; | ||
94 | } | ||
92 | return status_and_caps.second; | 95 | return status_and_caps.second; |
93 | } | 96 | } |
94 | 97 | ||
@@ -193,7 +196,10 @@ TEST_F(WifiChipHidlTest, ConfigureChip) { | |||
193 | TEST_F(WifiChipHidlTest, GetCapabilities) { | 196 | TEST_F(WifiChipHidlTest, GetCapabilities) { |
194 | configureChipForIfaceType(IfaceType::STA, true); | 197 | configureChipForIfaceType(IfaceType::STA, true); |
195 | const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities); | 198 | const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities); |
196 | EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); | 199 | if (status_and_caps.first.code != WifiStatusCode::SUCCESS) { |
200 | EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status_and_caps.first.code); | ||
201 | return; | ||
202 | } | ||
197 | EXPECT_NE(0u, status_and_caps.second); | 203 | EXPECT_NE(0u, status_and_caps.second); |
198 | } | 204 | } |
199 | 205 | ||
diff --git a/wifi/1.2/default/wifi_nan_iface.cpp b/wifi/1.2/default/wifi_nan_iface.cpp index 535e3d3d..566d36e7 100644 --- a/wifi/1.2/default/wifi_nan_iface.cpp +++ b/wifi/1.2/default/wifi_nan_iface.cpp | |||
@@ -427,7 +427,8 @@ WifiNanIface::WifiNanIface( | |||
427 | return; | 427 | return; |
428 | } | 428 | } |
429 | 429 | ||
430 | for (const auto& callback : shared_ptr_this->getEventCallbacks()) { | 430 | for (const auto& callback : |
431 | shared_ptr_this->getEventCallbacks_1_2()) { | ||
431 | if (!callback->eventDataPathConfirm_1_2(hidl_struct).isOk()) { | 432 | if (!callback->eventDataPathConfirm_1_2(hidl_struct).isOk()) { |
432 | LOG(ERROR) << "Failed to invoke the callback"; | 433 | LOG(ERROR) << "Failed to invoke the callback"; |
433 | } | 434 | } |
@@ -483,7 +484,7 @@ WifiNanIface::WifiNanIface( | |||
483 | return; | 484 | return; |
484 | } | 485 | } |
485 | 486 | ||
486 | for (const auto& callback : shared_ptr_this->getEventCallbacks()) { | 487 | for (const auto& callback : shared_ptr_this->getEventCallbacks_1_2()) { |
487 | if (!callback->eventDataPathScheduleUpdate(hidl_struct).isOk()) { | 488 | if (!callback->eventDataPathScheduleUpdate(hidl_struct).isOk()) { |
488 | LOG(ERROR) << "Failed to invoke the callback"; | 489 | LOG(ERROR) << "Failed to invoke the callback"; |
489 | } | 490 | } |
@@ -507,6 +508,7 @@ void WifiNanIface::invalidate() { | |||
507 | 508 | ||
508 | legacy_hal_.reset(); | 509 | legacy_hal_.reset(); |
509 | event_cb_handler_.invalidate(); | 510 | event_cb_handler_.invalidate(); |
511 | event_cb_handler_1_2_.invalidate(); | ||
510 | is_valid_ = false; | 512 | is_valid_ = false; |
511 | } | 513 | } |
512 | 514 | ||
@@ -514,10 +516,16 @@ bool WifiNanIface::isValid() { return is_valid_; } | |||
514 | 516 | ||
515 | std::string WifiNanIface::getName() { return ifname_; } | 517 | std::string WifiNanIface::getName() { return ifname_; } |
516 | 518 | ||
517 | std::set<sp<IWifiNanIfaceEventCallback>> WifiNanIface::getEventCallbacks() { | 519 | std::set<sp<V1_0::IWifiNanIfaceEventCallback>> |
520 | WifiNanIface::getEventCallbacks() { | ||
518 | return event_cb_handler_.getCallbacks(); | 521 | return event_cb_handler_.getCallbacks(); |
519 | } | 522 | } |
520 | 523 | ||
524 | std::set<sp<V1_2::IWifiNanIfaceEventCallback>> | ||
525 | WifiNanIface::getEventCallbacks_1_2() { | ||
526 | return event_cb_handler_1_2_.getCallbacks(); | ||
527 | } | ||
528 | |||
521 | Return<void> WifiNanIface::getName(getName_cb hidl_status_cb) { | 529 | Return<void> WifiNanIface::getName(getName_cb hidl_status_cb) { |
522 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, | 530 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, |
523 | &WifiNanIface::getNameInternal, hidl_status_cb); | 531 | &WifiNanIface::getNameInternal, hidl_status_cb); |
@@ -681,8 +689,11 @@ std::pair<WifiStatus, IfaceType> WifiNanIface::getTypeInternal() { | |||
681 | } | 689 | } |
682 | 690 | ||
683 | WifiStatus WifiNanIface::registerEventCallbackInternal( | 691 | WifiStatus WifiNanIface::registerEventCallbackInternal( |
684 | const sp<V1_0::IWifiNanIfaceEventCallback>& /*callback*/) { | 692 | const sp<V1_0::IWifiNanIfaceEventCallback>& callback) { |
685 | return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); | 693 | if (!event_cb_handler_.addCallback(callback)) { |
694 | return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); | ||
695 | } | ||
696 | return createWifiStatus(WifiStatusCode::SUCCESS); | ||
686 | } | 697 | } |
687 | 698 | ||
688 | WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t cmd_id) { | 699 | WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t cmd_id) { |
@@ -808,8 +819,12 @@ WifiStatus WifiNanIface::terminateDataPathRequestInternal( | |||
808 | } | 819 | } |
809 | 820 | ||
810 | WifiStatus WifiNanIface::registerEventCallback_1_2Internal( | 821 | WifiStatus WifiNanIface::registerEventCallback_1_2Internal( |
811 | const sp<IWifiNanIfaceEventCallback>& callback) { | 822 | const sp<V1_2::IWifiNanIfaceEventCallback>& callback) { |
812 | if (!event_cb_handler_.addCallback(callback)) { | 823 | sp<V1_0::IWifiNanIfaceEventCallback> callback_1_0 = callback; |
824 | if (!event_cb_handler_.addCallback(callback_1_0)) { | ||
825 | return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); | ||
826 | } | ||
827 | if (!event_cb_handler_1_2_.addCallback(callback)) { | ||
813 | return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); | 828 | return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); |
814 | } | 829 | } |
815 | return createWifiStatus(WifiStatusCode::SUCCESS); | 830 | return createWifiStatus(WifiStatusCode::SUCCESS); |
diff --git a/wifi/1.2/default/wifi_nan_iface.h b/wifi/1.2/default/wifi_nan_iface.h index a2dcf3a5..dba527b5 100644 --- a/wifi/1.2/default/wifi_nan_iface.h +++ b/wifi/1.2/default/wifi_nan_iface.h | |||
@@ -132,7 +132,7 @@ class WifiNanIface : public V1_2::IWifiNanIface { | |||
132 | uint32_t ndpInstanceId); | 132 | uint32_t ndpInstanceId); |
133 | 133 | ||
134 | WifiStatus registerEventCallback_1_2Internal( | 134 | WifiStatus registerEventCallback_1_2Internal( |
135 | const sp<IWifiNanIfaceEventCallback>& callback); | 135 | const sp<V1_2::IWifiNanIfaceEventCallback>& callback); |
136 | WifiStatus enableRequest_1_2Internal( | 136 | WifiStatus enableRequest_1_2Internal( |
137 | uint16_t cmd_id, const NanEnableRequest& msg1, | 137 | uint16_t cmd_id, const NanEnableRequest& msg1, |
138 | const NanConfigRequestSupplemental& msg2); | 138 | const NanConfigRequestSupplemental& msg2); |
@@ -140,13 +140,18 @@ class WifiNanIface : public V1_2::IWifiNanIface { | |||
140 | uint16_t cmd_id, const NanConfigRequest& msg, | 140 | uint16_t cmd_id, const NanConfigRequest& msg, |
141 | const NanConfigRequestSupplemental& msg2); | 141 | const NanConfigRequestSupplemental& msg2); |
142 | 142 | ||
143 | std::set<sp<IWifiNanIfaceEventCallback>> getEventCallbacks(); | 143 | // all 1_0 and descendant callbacks |
144 | std::set<sp<V1_0::IWifiNanIfaceEventCallback>> getEventCallbacks(); | ||
145 | // all 1_2 and descendant callbacks | ||
146 | std::set<sp<V1_2::IWifiNanIfaceEventCallback>> getEventCallbacks_1_2(); | ||
144 | 147 | ||
145 | std::string ifname_; | 148 | std::string ifname_; |
146 | std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; | 149 | std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; |
147 | bool is_valid_; | 150 | bool is_valid_; |
148 | hidl_callback_util::HidlCallbackHandler<IWifiNanIfaceEventCallback> | 151 | hidl_callback_util::HidlCallbackHandler<V1_0::IWifiNanIfaceEventCallback> |
149 | event_cb_handler_; | 152 | event_cb_handler_; |
153 | hidl_callback_util::HidlCallbackHandler<V1_2::IWifiNanIfaceEventCallback> | ||
154 | event_cb_handler_1_2_; | ||
150 | 155 | ||
151 | DISALLOW_COPY_AND_ASSIGN(WifiNanIface); | 156 | DISALLOW_COPY_AND_ASSIGN(WifiNanIface); |
152 | }; | 157 | }; |
diff --git a/wifi/1.2/vts/functional/Android.bp b/wifi/1.2/vts/functional/Android.bp index 918e4a45..c5a6e841 100644 --- a/wifi/1.2/vts/functional/Android.bp +++ b/wifi/1.2/vts/functional/Android.bp | |||
@@ -29,3 +29,18 @@ cc_test { | |||
29 | "android.hardware.wifi@1.2", | 29 | "android.hardware.wifi@1.2", |
30 | ], | 30 | ], |
31 | } | 31 | } |
32 | |||
33 | cc_test { | ||
34 | name: "VtsHalWifiNanV1_2TargetTest", | ||
35 | defaults: ["VtsHalTargetTestDefaults"], | ||
36 | srcs: [ | ||
37 | "VtsHalWifiV1_2TargetTest.cpp", | ||
38 | "wifi_nan_iface_hidl_test.cpp", | ||
39 | ], | ||
40 | static_libs: [ | ||
41 | "VtsHalWifiV1_0TargetTestUtil", | ||
42 | "android.hardware.wifi@1.0", | ||
43 | "android.hardware.wifi@1.1", | ||
44 | "android.hardware.wifi@1.2", | ||
45 | ], | ||
46 | } | ||
diff --git a/wifi/1.2/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.2/vts/functional/wifi_nan_iface_hidl_test.cpp new file mode 100644 index 00000000..cc36faea --- /dev/null +++ b/wifi/1.2/vts/functional/wifi_nan_iface_hidl_test.cpp | |||
@@ -0,0 +1,538 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Nanache License, Version 2.0 (the "License"); | ||
5 | * you may not use this file except in compliance with the License. | ||
6 | * You may obtain a copy of the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | * See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include <android-base/logging.h> | ||
18 | |||
19 | #include <android/hardware/wifi/1.2/IWifiNanIface.h> | ||
20 | #include <android/hardware/wifi/1.2/IWifiNanIfaceEventCallback.h> | ||
21 | |||
22 | #include <VtsHalHidlTargetTestBase.h> | ||
23 | #include <chrono> | ||
24 | #include <condition_variable> | ||
25 | #include <mutex> | ||
26 | |||
27 | #include "wifi_hidl_call_util.h" | ||
28 | #include "wifi_hidl_test_utils.h" | ||
29 | |||
30 | using namespace ::android::hardware::wifi::V1_0; | ||
31 | using namespace ::android::hardware::wifi::V1_2; | ||
32 | |||
33 | using ::android::hardware::Return; | ||
34 | using ::android::hardware::Void; | ||
35 | using ::android::sp; | ||
36 | |||
37 | #define TIMEOUT_PERIOD 10 | ||
38 | |||
39 | android::sp<android::hardware::wifi::V1_2::IWifiNanIface> | ||
40 | getWifiNanIface_1_2() { | ||
41 | return android::hardware::wifi::V1_2::IWifiNanIface::castFrom( | ||
42 | getWifiNanIface()); | ||
43 | } | ||
44 | |||
45 | /** | ||
46 | * Fixture to use for all NAN Iface HIDL interface tests. | ||
47 | */ | ||
48 | class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase { | ||
49 | public: | ||
50 | virtual void SetUp() override { | ||
51 | iwifiNanIface = getWifiNanIface_1_2(); | ||
52 | ASSERT_NE(nullptr, iwifiNanIface.get()); | ||
53 | ASSERT_EQ(WifiStatusCode::SUCCESS, | ||
54 | HIDL_INVOKE(iwifiNanIface, registerEventCallback_1_2, | ||
55 | new WifiNanIfaceEventCallback(*this)) | ||
56 | .code); | ||
57 | } | ||
58 | |||
59 | virtual void TearDown() override { stopWifi(); } | ||
60 | |||
61 | /* Used as a mechanism to inform the test about data/event callback */ | ||
62 | inline void notify() { | ||
63 | std::unique_lock<std::mutex> lock(mtx_); | ||
64 | count_++; | ||
65 | cv_.notify_one(); | ||
66 | } | ||
67 | |||
68 | enum CallbackType { | ||
69 | INVALID = -2, | ||
70 | ANY_CALLBACK = -1, | ||
71 | |||
72 | NOTIFY_CAPABILITIES_RESPONSE = 0, | ||
73 | NOTIFY_ENABLE_RESPONSE, | ||
74 | NOTIFY_CONFIG_RESPONSE, | ||
75 | NOTIFY_DISABLE_RESPONSE, | ||
76 | NOTIFY_START_PUBLISH_RESPONSE, | ||
77 | NOTIFY_STOP_PUBLISH_RESPONSE, | ||
78 | NOTIFY_START_SUBSCRIBE_RESPONSE, | ||
79 | NOTIFY_STOP_SUBSCRIBE_RESPONSE, | ||
80 | NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE, | ||
81 | NOTIFY_CREATE_DATA_INTERFACE_RESPONSE, | ||
82 | NOTIFY_DELETE_DATA_INTERFACE_RESPONSE, | ||
83 | NOTIFY_INITIATE_DATA_PATH_RESPONSE, | ||
84 | NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE, | ||
85 | NOTIFY_TERMINATE_DATA_PATH_RESPONSE, | ||
86 | |||
87 | EVENT_CLUSTER_EVENT, | ||
88 | EVENT_DISABLED, | ||
89 | EVENT_PUBLISH_TERMINATED, | ||
90 | EVENT_SUBSCRIBE_TERMINATED, | ||
91 | EVENT_MATCH, | ||
92 | EVENT_MATCH_EXPIRED, | ||
93 | EVENT_FOLLOWUP_RECEIVED, | ||
94 | EVENT_TRANSMIT_FOLLOWUP, | ||
95 | EVENT_DATA_PATH_REQUEST, | ||
96 | EVENT_DATA_PATH_CONFIRM, | ||
97 | EVENT_DATA_PATH_TERMINATED, | ||
98 | EVENT_DATA_PATH_CONFIRM_1_2, | ||
99 | EVENT_DATA_PATH_SCHEDULE_UPDATE | ||
100 | }; | ||
101 | |||
102 | /* Test code calls this function to wait for data/event callback */ | ||
103 | inline std::cv_status wait(CallbackType waitForCallbackType) { | ||
104 | std::unique_lock<std::mutex> lock(mtx_); | ||
105 | |||
106 | EXPECT_NE(INVALID, waitForCallbackType); // can't ASSERT in a | ||
107 | // non-void-returning method | ||
108 | |||
109 | callbackType = INVALID; | ||
110 | std::cv_status status = std::cv_status::no_timeout; | ||
111 | auto now = std::chrono::system_clock::now(); | ||
112 | while (count_ == 0) { | ||
113 | status = cv_.wait_until(lock, | ||
114 | now + std::chrono::seconds(TIMEOUT_PERIOD)); | ||
115 | if (status == std::cv_status::timeout) return status; | ||
116 | if (waitForCallbackType != ANY_CALLBACK && | ||
117 | callbackType != INVALID && | ||
118 | callbackType != waitForCallbackType) { | ||
119 | count_--; | ||
120 | } | ||
121 | } | ||
122 | count_--; | ||
123 | return status; | ||
124 | } | ||
125 | |||
126 | class WifiNanIfaceEventCallback | ||
127 | : public ::android::hardware::wifi::V1_2::IWifiNanIfaceEventCallback { | ||
128 | WifiNanIfaceHidlTest& parent_; | ||
129 | |||
130 | public: | ||
131 | WifiNanIfaceEventCallback(WifiNanIfaceHidlTest& parent) | ||
132 | : parent_(parent){}; | ||
133 | |||
134 | virtual ~WifiNanIfaceEventCallback() = default; | ||
135 | |||
136 | Return<void> notifyCapabilitiesResponse( | ||
137 | uint16_t id, const WifiNanStatus& status, | ||
138 | const NanCapabilities& capabilities) override { | ||
139 | parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE; | ||
140 | |||
141 | parent_.id = id; | ||
142 | parent_.status = status; | ||
143 | parent_.capabilities = capabilities; | ||
144 | |||
145 | parent_.notify(); | ||
146 | return Void(); | ||
147 | } | ||
148 | |||
149 | Return<void> notifyEnableResponse( | ||
150 | uint16_t id, const WifiNanStatus& status) override { | ||
151 | parent_.callbackType = NOTIFY_ENABLE_RESPONSE; | ||
152 | |||
153 | parent_.id = id; | ||
154 | parent_.status = status; | ||
155 | |||
156 | parent_.notify(); | ||
157 | return Void(); | ||
158 | } | ||
159 | |||
160 | Return<void> notifyConfigResponse( | ||
161 | uint16_t id, const WifiNanStatus& status) override { | ||
162 | parent_.callbackType = NOTIFY_CONFIG_RESPONSE; | ||
163 | |||
164 | parent_.id = id; | ||
165 | parent_.status = status; | ||
166 | |||
167 | parent_.notify(); | ||
168 | return Void(); | ||
169 | } | ||
170 | |||
171 | Return<void> notifyDisableResponse( | ||
172 | uint16_t id, const WifiNanStatus& status) override { | ||
173 | parent_.callbackType = NOTIFY_DISABLE_RESPONSE; | ||
174 | |||
175 | parent_.id = id; | ||
176 | parent_.status = status; | ||
177 | |||
178 | parent_.notify(); | ||
179 | return Void(); | ||
180 | } | ||
181 | |||
182 | Return<void> notifyStartPublishResponse(uint16_t id, | ||
183 | const WifiNanStatus& status, | ||
184 | uint8_t sessionId) override { | ||
185 | parent_.callbackType = NOTIFY_START_PUBLISH_RESPONSE; | ||
186 | |||
187 | parent_.id = id; | ||
188 | parent_.status = status; | ||
189 | parent_.sessionId = sessionId; | ||
190 | |||
191 | parent_.notify(); | ||
192 | return Void(); | ||
193 | } | ||
194 | |||
195 | Return<void> notifyStopPublishResponse( | ||
196 | uint16_t id, const WifiNanStatus& status) override { | ||
197 | parent_.callbackType = NOTIFY_STOP_PUBLISH_RESPONSE; | ||
198 | |||
199 | parent_.id = id; | ||
200 | parent_.status = status; | ||
201 | |||
202 | parent_.notify(); | ||
203 | return Void(); | ||
204 | } | ||
205 | |||
206 | Return<void> notifyStartSubscribeResponse(uint16_t id, | ||
207 | const WifiNanStatus& status, | ||
208 | uint8_t sessionId) override { | ||
209 | parent_.callbackType = NOTIFY_START_SUBSCRIBE_RESPONSE; | ||
210 | |||
211 | parent_.id = id; | ||
212 | parent_.status = status; | ||
213 | parent_.sessionId = sessionId; | ||
214 | |||
215 | parent_.notify(); | ||
216 | return Void(); | ||
217 | } | ||
218 | |||
219 | Return<void> notifyStopSubscribeResponse( | ||
220 | uint16_t id, const WifiNanStatus& status) override { | ||
221 | parent_.callbackType = NOTIFY_STOP_SUBSCRIBE_RESPONSE; | ||
222 | |||
223 | parent_.id = id; | ||
224 | parent_.status = status; | ||
225 | |||
226 | parent_.notify(); | ||
227 | return Void(); | ||
228 | } | ||
229 | |||
230 | Return<void> notifyTransmitFollowupResponse( | ||
231 | uint16_t id, const WifiNanStatus& status) override { | ||
232 | parent_.callbackType = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE; | ||
233 | |||
234 | parent_.id = id; | ||
235 | parent_.status = status; | ||
236 | |||
237 | parent_.notify(); | ||
238 | return Void(); | ||
239 | } | ||
240 | |||
241 | Return<void> notifyCreateDataInterfaceResponse( | ||
242 | uint16_t id, const WifiNanStatus& status) override { | ||
243 | parent_.callbackType = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE; | ||
244 | |||
245 | parent_.id = id; | ||
246 | parent_.status = status; | ||
247 | |||
248 | parent_.notify(); | ||
249 | return Void(); | ||
250 | } | ||
251 | |||
252 | Return<void> notifyDeleteDataInterfaceResponse( | ||
253 | uint16_t id, const WifiNanStatus& status) override { | ||
254 | parent_.callbackType = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE; | ||
255 | |||
256 | parent_.id = id; | ||
257 | parent_.status = status; | ||
258 | |||
259 | parent_.notify(); | ||
260 | return Void(); | ||
261 | } | ||
262 | |||
263 | Return<void> notifyInitiateDataPathResponse( | ||
264 | uint16_t id, const WifiNanStatus& status, | ||
265 | uint32_t ndpInstanceId) override { | ||
266 | parent_.callbackType = NOTIFY_INITIATE_DATA_PATH_RESPONSE; | ||
267 | |||
268 | parent_.id = id; | ||
269 | parent_.status = status; | ||
270 | parent_.ndpInstanceId = ndpInstanceId; | ||
271 | |||
272 | parent_.notify(); | ||
273 | return Void(); | ||
274 | } | ||
275 | |||
276 | Return<void> notifyRespondToDataPathIndicationResponse( | ||
277 | uint16_t id, const WifiNanStatus& status) override { | ||
278 | parent_.callbackType = | ||
279 | NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE; | ||
280 | |||
281 | parent_.id = id; | ||
282 | parent_.status = status; | ||
283 | |||
284 | parent_.notify(); | ||
285 | return Void(); | ||
286 | } | ||
287 | |||
288 | Return<void> notifyTerminateDataPathResponse( | ||
289 | uint16_t id, const WifiNanStatus& status) override { | ||
290 | parent_.callbackType = NOTIFY_TERMINATE_DATA_PATH_RESPONSE; | ||
291 | |||
292 | parent_.id = id; | ||
293 | parent_.status = status; | ||
294 | |||
295 | parent_.notify(); | ||
296 | return Void(); | ||
297 | } | ||
298 | |||
299 | Return<void> eventClusterEvent( | ||
300 | const NanClusterEventInd& event) override { | ||
301 | parent_.callbackType = EVENT_CLUSTER_EVENT; | ||
302 | |||
303 | parent_.nanClusterEventInd = event; | ||
304 | |||
305 | parent_.notify(); | ||
306 | return Void(); | ||
307 | } | ||
308 | |||
309 | Return<void> eventDisabled(const WifiNanStatus& status) override { | ||
310 | parent_.callbackType = EVENT_DISABLED; | ||
311 | |||
312 | parent_.status = status; | ||
313 | |||
314 | parent_.notify(); | ||
315 | return Void(); | ||
316 | } | ||
317 | |||
318 | Return<void> eventPublishTerminated( | ||
319 | uint8_t sessionId, const WifiNanStatus& status) override { | ||
320 | parent_.callbackType = EVENT_PUBLISH_TERMINATED; | ||
321 | |||
322 | parent_.sessionId = sessionId; | ||
323 | parent_.status = status; | ||
324 | |||
325 | parent_.notify(); | ||
326 | return Void(); | ||
327 | } | ||
328 | |||
329 | Return<void> eventSubscribeTerminated( | ||
330 | uint8_t sessionId, const WifiNanStatus& status) override { | ||
331 | parent_.callbackType = EVENT_SUBSCRIBE_TERMINATED; | ||
332 | |||
333 | parent_.sessionId = sessionId; | ||
334 | parent_.status = status; | ||
335 | |||
336 | parent_.notify(); | ||
337 | return Void(); | ||
338 | } | ||
339 | |||
340 | Return<void> eventMatch(const NanMatchInd& event) override { | ||
341 | parent_.callbackType = EVENT_MATCH; | ||
342 | |||
343 | parent_.nanMatchInd = event; | ||
344 | |||
345 | parent_.notify(); | ||
346 | return Void(); | ||
347 | } | ||
348 | |||
349 | Return<void> eventMatchExpired(uint8_t discoverySessionId, | ||
350 | uint32_t peerId) override { | ||
351 | parent_.callbackType = EVENT_MATCH_EXPIRED; | ||
352 | |||
353 | parent_.sessionId = discoverySessionId; | ||
354 | parent_.peerId = peerId; | ||
355 | |||
356 | parent_.notify(); | ||
357 | return Void(); | ||
358 | } | ||
359 | |||
360 | Return<void> eventFollowupReceived( | ||
361 | const NanFollowupReceivedInd& event) override { | ||
362 | parent_.callbackType = EVENT_FOLLOWUP_RECEIVED; | ||
363 | |||
364 | parent_.nanFollowupReceivedInd = event; | ||
365 | |||
366 | parent_.notify(); | ||
367 | return Void(); | ||
368 | } | ||
369 | |||
370 | Return<void> eventTransmitFollowup( | ||
371 | uint16_t id, const WifiNanStatus& status) override { | ||
372 | parent_.callbackType = EVENT_TRANSMIT_FOLLOWUP; | ||
373 | |||
374 | parent_.id = id; | ||
375 | parent_.status = status; | ||
376 | |||
377 | parent_.notify(); | ||
378 | return Void(); | ||
379 | } | ||
380 | |||
381 | Return<void> eventDataPathRequest( | ||
382 | const NanDataPathRequestInd& event) override { | ||
383 | parent_.callbackType = EVENT_DATA_PATH_REQUEST; | ||
384 | |||
385 | parent_.nanDataPathRequestInd = event; | ||
386 | |||
387 | parent_.notify(); | ||
388 | return Void(); | ||
389 | } | ||
390 | |||
391 | Return<void> eventDataPathConfirm( | ||
392 | const ::android::hardware::wifi::V1_0::NanDataPathConfirmInd& event) | ||
393 | override { | ||
394 | parent_.callbackType = EVENT_DATA_PATH_CONFIRM; | ||
395 | |||
396 | parent_.nanDataPathConfirmInd = event; | ||
397 | |||
398 | parent_.notify(); | ||
399 | return Void(); | ||
400 | } | ||
401 | |||
402 | Return<void> eventDataPathTerminated(uint32_t ndpInstanceId) override { | ||
403 | parent_.callbackType = EVENT_DATA_PATH_TERMINATED; | ||
404 | |||
405 | parent_.ndpInstanceId = ndpInstanceId; | ||
406 | |||
407 | parent_.notify(); | ||
408 | return Void(); | ||
409 | } | ||
410 | |||
411 | Return<void> eventDataPathConfirm_1_2( | ||
412 | const ::android::hardware::wifi::V1_2::NanDataPathConfirmInd& event) | ||
413 | override { | ||
414 | parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_2; | ||
415 | |||
416 | parent_.nanDataPathConfirmInd_1_2 = event; | ||
417 | |||
418 | parent_.notify(); | ||
419 | return Void(); | ||
420 | } | ||
421 | |||
422 | Return<void> eventDataPathScheduleUpdate( | ||
423 | const NanDataPathScheduleUpdateInd& event) override { | ||
424 | parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE; | ||
425 | |||
426 | parent_.nanDataPathScheduleUpdateInd = event; | ||
427 | |||
428 | parent_.notify(); | ||
429 | return Void(); | ||
430 | } | ||
431 | }; | ||
432 | |||
433 | private: | ||
434 | // synchronization objects | ||
435 | std::mutex mtx_; | ||
436 | std::condition_variable cv_; | ||
437 | int count_; | ||
438 | |||
439 | protected: | ||
440 | android::sp<::android::hardware::wifi::V1_2::IWifiNanIface> iwifiNanIface; | ||
441 | |||
442 | // Data from IWifiNanIfaceEventCallback callbacks: this is the collection of | ||
443 | // all arguments to all callbacks. They are set by the callback | ||
444 | // (notifications or events) and can be retrieved by tests. | ||
445 | CallbackType callbackType; | ||
446 | uint16_t id; | ||
447 | WifiNanStatus status; | ||
448 | NanCapabilities capabilities; | ||
449 | uint8_t sessionId; | ||
450 | uint32_t ndpInstanceId; | ||
451 | NanClusterEventInd nanClusterEventInd; | ||
452 | NanMatchInd nanMatchInd; | ||
453 | uint32_t peerId; | ||
454 | NanFollowupReceivedInd nanFollowupReceivedInd; | ||
455 | NanDataPathRequestInd nanDataPathRequestInd; | ||
456 | ::android::hardware::wifi::V1_0::NanDataPathConfirmInd | ||
457 | nanDataPathConfirmInd; | ||
458 | ::android::hardware::wifi::V1_2::NanDataPathConfirmInd | ||
459 | nanDataPathConfirmInd_1_2; | ||
460 | NanDataPathScheduleUpdateInd nanDataPathScheduleUpdateInd; | ||
461 | }; | ||
462 | |||
463 | /* | ||
464 | * Create: | ||
465 | * Ensures that an instance of the IWifiNanIface proxy object is | ||
466 | * successfully created. | ||
467 | */ | ||
468 | TEST(WifiNanIfaceHidlTestNoFixture, Create) { | ||
469 | ASSERT_NE(nullptr, getWifiNanIface_1_2().get()); | ||
470 | stopWifi(); | ||
471 | } | ||
472 | |||
473 | /* | ||
474 | * enableRequest_1_2InvalidArgs: validate that fails with invalid arguments | ||
475 | */ | ||
476 | TEST_F(WifiNanIfaceHidlTest, enableRequest_1_2InvalidArgs) { | ||
477 | uint16_t inputCmdId = 10; | ||
478 | NanEnableRequest nanEnableRequest = {}; | ||
479 | NanConfigRequestSupplemental nanConfigRequestSupp = {}; | ||
480 | ASSERT_EQ(WifiStatusCode::SUCCESS, | ||
481 | HIDL_INVOKE(iwifiNanIface, enableRequest_1_2, inputCmdId, | ||
482 | nanEnableRequest, nanConfigRequestSupp) | ||
483 | .code); | ||
484 | // wait for a callback | ||
485 | ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); | ||
486 | ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType); | ||
487 | ASSERT_EQ(id, inputCmdId); | ||
488 | ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS); | ||
489 | } | ||
490 | |||
491 | /* | ||
492 | * enableRequest_1_2ShimInvalidArgs: validate that fails with invalid arguments | ||
493 | * to the shim | ||
494 | */ | ||
495 | TEST_F(WifiNanIfaceHidlTest, enableRequest_1_2ShimInvalidArgs) { | ||
496 | uint16_t inputCmdId = 10; | ||
497 | NanEnableRequest nanEnableRequest = {}; | ||
498 | nanEnableRequest.configParams.numberOfPublishServiceIdsInBeacon = | ||
499 | 128; // must be <= 127 | ||
500 | NanConfigRequestSupplemental nanConfigRequestSupp = {}; | ||
501 | ASSERT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, | ||
502 | HIDL_INVOKE(iwifiNanIface, enableRequest_1_2, inputCmdId, | ||
503 | nanEnableRequest, nanConfigRequestSupp) | ||
504 | .code); | ||
505 | } | ||
506 | |||
507 | /* | ||
508 | * configRequest_1_2InvalidArgs: validate that fails with invalid arguments | ||
509 | */ | ||
510 | TEST_F(WifiNanIfaceHidlTest, configRequest_1_2InvalidArgs) { | ||
511 | uint16_t inputCmdId = 10; | ||
512 | NanConfigRequest nanConfigRequest = {}; | ||
513 | NanConfigRequestSupplemental nanConfigRequestSupp = {}; | ||
514 | ASSERT_EQ(WifiStatusCode::SUCCESS, | ||
515 | HIDL_INVOKE(iwifiNanIface, configRequest_1_2, inputCmdId, | ||
516 | nanConfigRequest, nanConfigRequestSupp) | ||
517 | .code); | ||
518 | // wait for a callback | ||
519 | ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE)); | ||
520 | ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callbackType); | ||
521 | ASSERT_EQ(id, inputCmdId); | ||
522 | ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS); | ||
523 | } | ||
524 | |||
525 | /* | ||
526 | * configRequest_1_2ShimInvalidArgs: validate that fails with invalid arguments | ||
527 | * to the shim | ||
528 | */ | ||
529 | TEST_F(WifiNanIfaceHidlTest, configRequest_1_2ShimInvalidArgs) { | ||
530 | uint16_t inputCmdId = 10; | ||
531 | NanConfigRequest nanConfigRequest = {}; | ||
532 | nanConfigRequest.numberOfPublishServiceIdsInBeacon = 128; // must be <= 127 | ||
533 | NanConfigRequestSupplemental nanConfigRequestSupp = {}; | ||
534 | ASSERT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, | ||
535 | HIDL_INVOKE(iwifiNanIface, configRequest_1_2, inputCmdId, | ||
536 | nanConfigRequest, nanConfigRequestSupp) | ||
537 | .code); | ||
538 | } | ||