diff options
author | android-build-team Robot | 2018-03-28 02:27:17 -0500 |
---|---|---|
committer | android-build-team Robot | 2018-03-28 02:27:17 -0500 |
commit | 3855d757ecfd0bcecf19a7b0b6a4d1a21ce0c3a8 (patch) | |
tree | ff4352d3fd3188534f9ef8c472284196c4940e6c | |
parent | dd290657949086dbc0118c86c7c27f6a86660798 (diff) | |
parent | e095cdc7b602f4a2abd39f136560d549bd7b5155 (diff) | |
download | platform-hardware-interfaces-3855d757ecfd0bcecf19a7b0b6a4d1a21ce0c3a8.tar.gz platform-hardware-interfaces-3855d757ecfd0bcecf19a7b0b6a4d1a21ce0c3a8.tar.xz platform-hardware-interfaces-3855d757ecfd0bcecf19a7b0b6a4d1a21ce0c3a8.zip |
Snap for 4683893 from e095cdc7b602f4a2abd39f136560d549bd7b5155 to pi-release
Change-Id: I119b571c97c8e31fadcacba39ad3f4238331e9bd
-rw-r--r-- | audio/4.0/config/audio_policy_configuration.xsd | 2 | ||||
-rw-r--r-- | bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc | 1 | ||||
-rw-r--r-- | camera/metadata/3.3/types.hal | 30 | ||||
-rw-r--r-- | current.txt | 4 | ||||
-rw-r--r-- | drm/1.1/vts/functional/drm_hal_clearkey_test.cpp | 419 | ||||
-rw-r--r-- | wifi/1.2/default/tests/wifi_chip_unit_tests.cpp | 2 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_legacy_hal.cpp | 22 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_legacy_hal.h | 4 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_sta_iface.cpp | 16 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_sta_iface.h | 8 | ||||
-rw-r--r-- | wifi/supplicant/1.1/Android.bp | 2 | ||||
-rw-r--r-- | wifi/supplicant/1.1/ISupplicantStaIface.hal | 48 | ||||
-rw-r--r-- | wifi/supplicant/1.1/ISupplicantStaIfaceCallback.hal | 45 | ||||
-rw-r--r-- | wifi/supplicant/1.1/vts/functional/Android.bp | 1 | ||||
-rw-r--r-- | wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp | 5 | ||||
-rw-r--r-- | wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h | 4 | ||||
-rw-r--r-- | wifi/supplicant/1.1/vts/functional/supplicant_sta_iface_hidl_test.cpp | 139 |
17 files changed, 743 insertions, 9 deletions
diff --git a/audio/4.0/config/audio_policy_configuration.xsd b/audio/4.0/config/audio_policy_configuration.xsd index e5b44499..34c2b111 100644 --- a/audio/4.0/config/audio_policy_configuration.xsd +++ b/audio/4.0/config/audio_policy_configuration.xsd | |||
@@ -104,7 +104,7 @@ | |||
104 | <xs:element name="devicePorts" type="devicePorts" minOccurs="0"/> | 104 | <xs:element name="devicePorts" type="devicePorts" minOccurs="0"/> |
105 | <xs:element name="routes" type="routes" minOccurs="0"/> | 105 | <xs:element name="routes" type="routes" minOccurs="0"/> |
106 | </xs:sequence> | 106 | </xs:sequence> |
107 | <xs:attribute name="name" type="xsd:string" use="required"/> | 107 | <xs:attribute name="name" type="xs:string" use="required"/> |
108 | <xs:attribute name="halVersion" type="halVersion" use="required"/> | 108 | <xs:attribute name="halVersion" type="halVersion" use="required"/> |
109 | </xs:complexType> | 109 | </xs:complexType> |
110 | <xs:unique name="mixPortNameUniqueness"> | 110 | <xs:unique name="mixPortNameUniqueness"> |
diff --git a/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc b/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc index e1f5faa5..5a01ecc2 100644 --- a/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc +++ b/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc | |||
@@ -1,5 +1,6 @@ | |||
1 | service vendor.bluetooth-1-0 /vendor/bin/hw/android.hardware.bluetooth@1.0-service | 1 | service vendor.bluetooth-1-0 /vendor/bin/hw/android.hardware.bluetooth@1.0-service |
2 | class hal | 2 | class hal |
3 | capabilities NET_ADMIN SYS_NICE | ||
3 | user bluetooth | 4 | user bluetooth |
4 | group bluetooth | 5 | group bluetooth |
5 | writepid /dev/stune/foreground/tasks | 6 | writepid /dev/stune/foreground/tasks |
diff --git a/camera/metadata/3.3/types.hal b/camera/metadata/3.3/types.hal index 4f3f6781..0535be16 100644 --- a/camera/metadata/3.3/types.hal +++ b/camera/metadata/3.3/types.hal | |||
@@ -33,6 +33,8 @@ enum CameraMetadataSection : @3.2::CameraMetadataSection { | |||
33 | ANDROID_LOGICAL_MULTI_CAMERA = | 33 | ANDROID_LOGICAL_MULTI_CAMERA = |
34 | android.hardware.camera.metadata@3.2::CameraMetadataSection:ANDROID_SECTION_COUNT, | 34 | android.hardware.camera.metadata@3.2::CameraMetadataSection:ANDROID_SECTION_COUNT, |
35 | 35 | ||
36 | ANDROID_DISTORTION_CORRECTION, | ||
37 | |||
36 | ANDROID_SECTION_COUNT_3_3, | 38 | ANDROID_SECTION_COUNT_3_3, |
37 | 39 | ||
38 | VENDOR_SECTION_3_3 = 0x8000, | 40 | VENDOR_SECTION_3_3 = 0x8000, |
@@ -46,6 +48,8 @@ enum CameraMetadataSection : @3.2::CameraMetadataSection { | |||
46 | enum CameraMetadataSectionStart : android.hardware.camera.metadata@3.2::CameraMetadataSectionStart { | 48 | enum CameraMetadataSectionStart : android.hardware.camera.metadata@3.2::CameraMetadataSectionStart { |
47 | ANDROID_LOGICAL_MULTI_CAMERA_START = CameraMetadataSection:ANDROID_LOGICAL_MULTI_CAMERA << 16, | 49 | ANDROID_LOGICAL_MULTI_CAMERA_START = CameraMetadataSection:ANDROID_LOGICAL_MULTI_CAMERA << 16, |
48 | 50 | ||
51 | ANDROID_DISTORTION_CORRECTION_START = CameraMetadataSection:ANDROID_DISTORTION_CORRECTION << 16, | ||
52 | |||
49 | VENDOR_SECTION_START_3_3 = CameraMetadataSection:VENDOR_SECTION_3_3 << 16, | 53 | VENDOR_SECTION_START_3_3 = CameraMetadataSection:VENDOR_SECTION_3_3 << 16, |
50 | 54 | ||
51 | }; | 55 | }; |
@@ -164,6 +168,23 @@ enum CameraMetadataTag : @3.2::CameraMetadataTag { | |||
164 | 168 | ||
165 | ANDROID_LOGICAL_MULTI_CAMERA_END_3_3, | 169 | ANDROID_LOGICAL_MULTI_CAMERA_END_3_3, |
166 | 170 | ||
171 | /** android.distortionCorrection.mode [dynamic, enum, public] | ||
172 | * | ||
173 | * <p>Mode of operation for the lens distortion correction block.</p> | ||
174 | */ | ||
175 | ANDROID_DISTORTION_CORRECTION_MODE = CameraMetadataSectionStart:ANDROID_DISTORTION_CORRECTION_START, | ||
176 | |||
177 | /** android.distortionCorrection.availableModes [static, byte[], public] | ||
178 | * | ||
179 | * <p>List of distortion correction modes for ANDROID_DISTORTION_CORRECTION_MODE that are | ||
180 | * supported by this camera device.</p> | ||
181 | * | ||
182 | * @see ANDROID_DISTORTION_CORRECTION_MODE | ||
183 | */ | ||
184 | ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES, | ||
185 | |||
186 | ANDROID_DISTORTION_CORRECTION_END_3_3, | ||
187 | |||
167 | }; | 188 | }; |
168 | 189 | ||
169 | /* | 190 | /* |
@@ -234,3 +255,12 @@ enum CameraMetadataEnumAndroidLogicalMultiCameraSensorSyncType : uint32_t { | |||
234 | ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE, | 255 | ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE, |
235 | ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED, | 256 | ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED, |
236 | }; | 257 | }; |
258 | |||
259 | /** android.distortionCorrection.mode enumeration values | ||
260 | * @see ANDROID_DISTORTION_CORRECTION_MODE | ||
261 | */ | ||
262 | enum CameraMetadataEnumAndroidDistortionCorrectionMode : uint32_t { | ||
263 | ANDROID_DISTORTION_CORRECTION_MODE_OFF, | ||
264 | ANDROID_DISTORTION_CORRECTION_MODE_FAST, | ||
265 | ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY, | ||
266 | }; | ||
diff --git a/current.txt b/current.txt index c35fa924..71e2d912 100644 --- a/current.txt +++ b/current.txt | |||
@@ -307,7 +307,7 @@ eacf4e7491fc52c4db90898faddf25ec7bc72501b07ae8737434c47cb845128c android.hardwar | |||
307 | 4fb0725c36ed4f77a42b42e3f18d8b5f7919cb62b90098b23143a555aa7dd96d android.hardware.camera.device@3.4::ICameraDeviceCallback | 307 | 4fb0725c36ed4f77a42b42e3f18d8b5f7919cb62b90098b23143a555aa7dd96d android.hardware.camera.device@3.4::ICameraDeviceCallback |
308 | 812fa66aa10ba0cba27cfddc2fd7f0ee27a8ab65a1f15aa79fdad97d403e6a14 android.hardware.camera.device@3.4::ICameraDeviceSession | 308 | 812fa66aa10ba0cba27cfddc2fd7f0ee27a8ab65a1f15aa79fdad97d403e6a14 android.hardware.camera.device@3.4::ICameraDeviceSession |
309 | cc288f1f78d1e643eb3d3dbc16e1401d44033d8e6856761f5156814a29986ec7 android.hardware.camera.device@3.4::types | 309 | cc288f1f78d1e643eb3d3dbc16e1401d44033d8e6856761f5156814a29986ec7 android.hardware.camera.device@3.4::types |
310 | 26462f5a29bef30485f9264115e79e5f5eb6234951dfeb47424709a1b8936030 android.hardware.camera.metadata@3.3::types | 310 | 71ee1f46dac4df417d2950e4de760e4145038ae363fc11aeea487350bf603897 android.hardware.camera.metadata@3.3::types |
311 | 1a46aeae45b7a0e47f79b7207300532986f9d9cd7060779afc7a529f54d712ab android.hardware.confirmationui@1.0::IConfirmationResultCallback | 311 | 1a46aeae45b7a0e47f79b7207300532986f9d9cd7060779afc7a529f54d712ab android.hardware.confirmationui@1.0::IConfirmationResultCallback |
312 | 6d8347ff3cd7de471065ac3e8e68385073630cdeebe9f8fa58cb91cf44436c95 android.hardware.confirmationui@1.0::IConfirmationUI | 312 | 6d8347ff3cd7de471065ac3e8e68385073630cdeebe9f8fa58cb91cf44436c95 android.hardware.confirmationui@1.0::IConfirmationUI |
313 | a3ff916784dce87a56c757ab5c86433f0cdf562280999a5f978a6e8a0f3f19e7 android.hardware.confirmationui@1.0::types | 313 | a3ff916784dce87a56c757ab5c86433f0cdf562280999a5f978a6e8a0f3f19e7 android.hardware.confirmationui@1.0::types |
@@ -369,4 +369,6 @@ a9d733eb0d555f2a6cb79a212810e81b56ecba0e31a8ffe0916de086a29e4f88 android.hardwar | |||
369 | ee08280de21cb41e3ec26d6ed636c701b7f70516e71fb22f4fe60a13e603f406 android.hardware.wifi.hostapd@1.0::IHostapd | 369 | ee08280de21cb41e3ec26d6ed636c701b7f70516e71fb22f4fe60a13e603f406 android.hardware.wifi.hostapd@1.0::IHostapd |
370 | b2479cd7a417a1cf4f3a22db4e4579e21bac38fdcaf381e2bf10176d05397e01 android.hardware.wifi.hostapd@1.0::types | 370 | b2479cd7a417a1cf4f3a22db4e4579e21bac38fdcaf381e2bf10176d05397e01 android.hardware.wifi.hostapd@1.0::types |
371 | e362203b941f18bd4cba29a62adfa02453ed00d6be5b72cdb6c4d7e0bf394a40 android.hardware.wifi.supplicant@1.1::ISupplicant | 371 | e362203b941f18bd4cba29a62adfa02453ed00d6be5b72cdb6c4d7e0bf394a40 android.hardware.wifi.supplicant@1.1::ISupplicant |
372 | 21757d0e5dd4b7e4bd981a4a20531bca3c32271ad9777b17b74eb5a1ea508384 android.hardware.wifi.supplicant@1.1::ISupplicantStaIface | ||
373 | cd4330c3196bda1d642a32abfe23a7d64ebfbda721940643af6867af3b3f0aa9 android.hardware.wifi.supplicant@1.1::ISupplicantStaIfaceCallback | ||
372 | 10ff2fae516346b86121368ce5790d5accdfcb73983246b813f3d488b66db45a android.hardware.wifi.supplicant@1.1::ISupplicantStaNetwork | 374 | 10ff2fae516346b86121368ce5790d5accdfcb73983246b813f3d488b66db45a android.hardware.wifi.supplicant@1.1::ISupplicantStaNetwork |
diff --git a/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp index 061f2cd9..12466169 100644 --- a/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp +++ b/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp | |||
@@ -43,7 +43,6 @@ using ::android::hardware::drm::V1_0::DestinationBuffer; | |||
43 | using ::android::hardware::drm::V1_0::ICryptoPlugin; | 43 | using ::android::hardware::drm::V1_0::ICryptoPlugin; |
44 | using ::android::hardware::drm::V1_0::KeyedVector; | 44 | using ::android::hardware::drm::V1_0::KeyedVector; |
45 | using ::android::hardware::drm::V1_0::KeyValue; | 45 | using ::android::hardware::drm::V1_0::KeyValue; |
46 | using ::android::hardware::drm::V1_0::KeyRequestType; | ||
47 | using ::android::hardware::drm::V1_0::KeyType; | 46 | using ::android::hardware::drm::V1_0::KeyType; |
48 | using ::android::hardware::drm::V1_0::Mode; | 47 | using ::android::hardware::drm::V1_0::Mode; |
49 | using ::android::hardware::drm::V1_0::Pattern; | 48 | using ::android::hardware::drm::V1_0::Pattern; |
@@ -60,6 +59,8 @@ using ::android::hardware::drm::V1_1::HdcpLevel; | |||
60 | using ::android::hardware::drm::V1_1::ICryptoFactory; | 59 | using ::android::hardware::drm::V1_1::ICryptoFactory; |
61 | using ::android::hardware::drm::V1_1::IDrmFactory; | 60 | using ::android::hardware::drm::V1_1::IDrmFactory; |
62 | using ::android::hardware::drm::V1_1::IDrmPlugin; | 61 | using ::android::hardware::drm::V1_1::IDrmPlugin; |
62 | using ::android::hardware::drm::V1_1::KeyRequestType; | ||
63 | using ::android::hardware::drm::V1_1::SecureStopRelease; | ||
63 | using ::android::hardware::drm::V1_1::SecurityLevel; | 64 | using ::android::hardware::drm::V1_1::SecurityLevel; |
64 | using ::android::hardware::drm::V1_1::SecurityLevel; | 65 | using ::android::hardware::drm::V1_1::SecurityLevel; |
65 | 66 | ||
@@ -167,7 +168,6 @@ public: | |||
167 | SessionId openSession(SecurityLevel level); | 168 | SessionId openSession(SecurityLevel level); |
168 | void closeSession(const SessionId& sessionId); | 169 | void closeSession(const SessionId& sessionId); |
169 | hidl_vec<uint8_t> loadKeys(const SessionId& sessionId, const KeyType& type); | 170 | hidl_vec<uint8_t> loadKeys(const SessionId& sessionId, const KeyType& type); |
170 | sp<IMemory> getDecryptMemory(size_t size, size_t index); | ||
171 | 171 | ||
172 | private: | 172 | private: |
173 | sp<IDrmPlugin> createDrmPlugin(sp<IDrmFactory> drmFactory) { | 173 | sp<IDrmPlugin> createDrmPlugin(sp<IDrmFactory> drmFactory) { |
@@ -308,6 +308,125 @@ void DrmHalClearkeyTest::closeSession(const SessionId& sessionId) { | |||
308 | } | 308 | } |
309 | 309 | ||
310 | /** | 310 | /** |
311 | * Helper method to load keys for subsequent decrypt tests. | ||
312 | * These tests use predetermined key request/response to | ||
313 | * avoid requiring a round trip to a license server. | ||
314 | */ | ||
315 | hidl_vec<uint8_t> DrmHalClearkeyTest::loadKeys( | ||
316 | const SessionId& sessionId, const KeyType& type = KeyType::STREAMING) { | ||
317 | hidl_vec<uint8_t> initData = { | ||
318 | // BMFF box header (4 bytes size + 'pssh') | ||
319 | 0x00, 0x00, 0x00, 0x34, 0x70, 0x73, 0x73, 0x68, | ||
320 | // full box header (version = 1 flags = 0) | ||
321 | 0x01, 0x00, 0x00, 0x00, | ||
322 | // system id | ||
323 | 0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2, 0x4d, 0x02, 0xac, 0xe3, 0x3c, | ||
324 | 0x1e, 0x52, 0xe2, 0xfb, 0x4b, | ||
325 | // number of key ids | ||
326 | 0x00, 0x00, 0x00, 0x01, | ||
327 | // key id | ||
328 | 0x60, 0x06, 0x1e, 0x01, 0x7e, 0x47, 0x7e, 0x87, 0x7e, 0x57, 0xd0, | ||
329 | 0x0d, 0x1e, 0xd0, 0x0d, 0x1e, | ||
330 | // size of data, must be zero | ||
331 | 0x00, 0x00, 0x00, 0x00}; | ||
332 | |||
333 | hidl_vec<uint8_t> expectedKeyRequest = { | ||
334 | 0x7b, 0x22, 0x6b, 0x69, 0x64, 0x73, 0x22, 0x3a, 0x5b, 0x22, 0x59, 0x41, 0x59, 0x65, | ||
335 | 0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2d, 0x56, 0x39, 0x41, 0x4e, 0x48, 0x74, | ||
336 | 0x41, 0x4e, 0x48, 0x67, 0x22, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, | ||
337 | 0x22, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x22, 0x7d}; | ||
338 | |||
339 | hidl_vec<uint8_t> knownKeyResponse = { | ||
340 | 0x7b, 0x22, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x6b, 0x74, 0x79, 0x22, | ||
341 | 0x3a, 0x22, 0x6f, 0x63, 0x74, 0x22, 0x2c, 0x22, 0x6b, 0x69, 0x64, 0x22, 0x3a, 0x22, 0x59, | ||
342 | 0x41, 0x59, 0x65, 0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2d, 0x56, 0x39, 0x41, 0x4e, | ||
343 | 0x48, 0x74, 0x41, 0x4e, 0x48, 0x67, 0x22, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x22, 0x47, 0x6f, | ||
344 | 0x6f, 0x67, 0x6c, 0x65, 0x54, 0x65, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x42, 0x61, 0x73, 0x65, | ||
345 | 0x36, 0x34, 0x67, 0x67, 0x67, 0x22, 0x7d, 0x5d, 0x7d, 0x0a}; | ||
346 | |||
347 | hidl_string mimeType = "video/mp4"; | ||
348 | KeyedVector optionalParameters; | ||
349 | auto res = drmPlugin->getKeyRequest_1_1( | ||
350 | sessionId, initData, mimeType, type, optionalParameters, | ||
351 | [&](Status status, const hidl_vec<uint8_t>& request, | ||
352 | KeyRequestType requestType, const hidl_string&) { | ||
353 | EXPECT_EQ(Status::OK, status); | ||
354 | EXPECT_EQ(KeyRequestType::INITIAL, requestType); | ||
355 | EXPECT_EQ(request, expectedKeyRequest); | ||
356 | }); | ||
357 | EXPECT_OK(res); | ||
358 | |||
359 | hidl_vec<uint8_t> keySetId; | ||
360 | res = drmPlugin->provideKeyResponse( | ||
361 | sessionId, knownKeyResponse, | ||
362 | [&](Status status, const hidl_vec<uint8_t>& myKeySetId) { | ||
363 | EXPECT_EQ(Status::OK, status); | ||
364 | EXPECT_EQ(0u, myKeySetId.size()); | ||
365 | keySetId = myKeySetId; | ||
366 | }); | ||
367 | EXPECT_OK(res); | ||
368 | return keySetId; | ||
369 | } | ||
370 | |||
371 | /** | ||
372 | * Test openSession negative case: security level higher than supported | ||
373 | */ | ||
374 | TEST_F(DrmHalClearkeyTest, OpenSessionBadLevel) { | ||
375 | auto res = drmPlugin->openSession_1_1(SecurityLevel::HW_SECURE_ALL, | ||
376 | [&](Status status, const SessionId& /* id */) { | ||
377 | EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status); | ||
378 | }); | ||
379 | EXPECT_OK(res); | ||
380 | } | ||
381 | |||
382 | /** | ||
383 | * Test getKeyRequest_1_1 via loadKeys | ||
384 | */ | ||
385 | TEST_F(DrmHalClearkeyTest, GetKeyRequest) { | ||
386 | auto sessionId = openSession(); | ||
387 | loadKeys(sessionId); | ||
388 | closeSession(sessionId); | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * A get key request should fail if no sessionId is provided | ||
393 | */ | ||
394 | TEST_F(DrmHalClearkeyTest, GetKeyRequestNoSession) { | ||
395 | SessionId invalidSessionId; | ||
396 | hidl_vec<uint8_t> initData; | ||
397 | hidl_string mimeType = "video/mp4"; | ||
398 | KeyedVector optionalParameters; | ||
399 | auto res = drmPlugin->getKeyRequest_1_1( | ||
400 | invalidSessionId, initData, mimeType, KeyType::STREAMING, | ||
401 | optionalParameters, | ||
402 | [&](Status status, const hidl_vec<uint8_t>&, KeyRequestType, | ||
403 | const hidl_string&) { EXPECT_EQ(Status::BAD_VALUE, status); }); | ||
404 | EXPECT_OK(res); | ||
405 | } | ||
406 | |||
407 | /** | ||
408 | * The clearkey plugin doesn't support offline key requests. | ||
409 | * Test that the plugin returns the expected error code in | ||
410 | * this case. | ||
411 | */ | ||
412 | TEST_F(DrmHalClearkeyTest, GetKeyRequestOfflineKeyTypeNotSupported) { | ||
413 | auto sessionId = openSession(); | ||
414 | hidl_vec<uint8_t> initData; | ||
415 | hidl_string mimeType = "video/mp4"; | ||
416 | KeyedVector optionalParameters; | ||
417 | |||
418 | auto res = drmPlugin->getKeyRequest_1_1( | ||
419 | sessionId, initData, mimeType, KeyType::OFFLINE, optionalParameters, | ||
420 | [&](Status status, const hidl_vec<uint8_t>&, KeyRequestType, | ||
421 | const hidl_string&) { | ||
422 | // Clearkey plugin doesn't support offline key type | ||
423 | EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status); | ||
424 | }); | ||
425 | EXPECT_OK(res); | ||
426 | closeSession(sessionId); | ||
427 | } | ||
428 | |||
429 | /** | ||
311 | * Test that the plugin returns valid connected and max HDCP levels | 430 | * Test that the plugin returns valid connected and max HDCP levels |
312 | */ | 431 | */ |
313 | TEST_F(DrmHalClearkeyTest, GetHdcpLevels) { | 432 | TEST_F(DrmHalClearkeyTest, GetHdcpLevels) { |
@@ -322,6 +441,11 @@ TEST_F(DrmHalClearkeyTest, GetHdcpLevels) { | |||
322 | } | 441 | } |
323 | 442 | ||
324 | /** | 443 | /** |
444 | * Since getHdcpLevels only queries information there are no | ||
445 | * negative cases. | ||
446 | */ | ||
447 | |||
448 | /** | ||
325 | * Test that the plugin returns default open and max session counts | 449 | * Test that the plugin returns default open and max session counts |
326 | */ | 450 | */ |
327 | TEST_F(DrmHalClearkeyTest, GetDefaultSessionCounts) { | 451 | TEST_F(DrmHalClearkeyTest, GetDefaultSessionCounts) { |
@@ -373,6 +497,11 @@ TEST_F(DrmHalClearkeyTest, GetOpenSessionCounts) { | |||
373 | } | 497 | } |
374 | 498 | ||
375 | /** | 499 | /** |
500 | * Since getNumberOfSessions only queries information there are no | ||
501 | * negative cases. | ||
502 | */ | ||
503 | |||
504 | /** | ||
376 | * Test that the plugin returns the same security level | 505 | * Test that the plugin returns the same security level |
377 | * by default as when it is requested explicitly | 506 | * by default as when it is requested explicitly |
378 | */ | 507 | */ |
@@ -428,7 +557,7 @@ TEST_F(DrmHalClearkeyTest, GetSecurityLevelInvalidSessionId) { | |||
428 | /** | 557 | /** |
429 | * Test metrics are set appropriately for open and close operations. | 558 | * Test metrics are set appropriately for open and close operations. |
430 | */ | 559 | */ |
431 | TEST_F(DrmHalClearkeyTest, GetMetricsSuccess) { | 560 | TEST_F(DrmHalClearkeyTest, GetMetricsOpenClose) { |
432 | SessionId sessionId = openSession(); | 561 | SessionId sessionId = openSession(); |
433 | // The first close should be successful. | 562 | // The first close should be successful. |
434 | closeSession(sessionId); | 563 | closeSession(sessionId); |
@@ -449,8 +578,292 @@ TEST_F(DrmHalClearkeyTest, GetMetricsSuccess) { | |||
449 | (int64_t)Status::ERROR_DRM_SESSION_NOT_OPENED, | 578 | (int64_t)Status::ERROR_DRM_SESSION_NOT_OPENED, |
450 | "count", (int64_t)1)); | 579 | "count", (int64_t)1)); |
451 | }); | 580 | }); |
581 | EXPECT_OK(res); | ||
582 | } | ||
583 | |||
584 | /** | ||
585 | * Since getMetrics only queries information there are no | ||
586 | * negative cases. | ||
587 | */ | ||
588 | |||
589 | /** | ||
590 | * Test that there are no secure stop ids after clearing them | ||
591 | */ | ||
592 | TEST_F(DrmHalClearkeyTest, GetSecureStopIdsCleared) { | ||
593 | auto stat = drmPlugin->removeAllSecureStops(); | ||
594 | EXPECT_OK(stat); | ||
595 | |||
596 | bool ok = drmPlugin->getSecureStopIds( | ||
597 | [&](Status status, const hidl_vec<SecureStopId>& ids) { | ||
598 | EXPECT_EQ(Status::OK, status); | ||
599 | EXPECT_EQ(0u, ids.size()); | ||
600 | }).isOk(); | ||
601 | EXPECT_TRUE(ok); | ||
602 | } | ||
603 | |||
604 | /** | ||
605 | * Test that there are secure stop ids after loading keys once | ||
606 | */ | ||
607 | TEST_F(DrmHalClearkeyTest, GetSecureStopIdsOnce) { | ||
608 | auto stat = drmPlugin->removeAllSecureStops(); | ||
609 | EXPECT_OK(stat); | ||
610 | |||
611 | auto sessionId = openSession(); | ||
612 | loadKeys(sessionId); | ||
613 | closeSession(sessionId); | ||
614 | |||
615 | auto res = drmPlugin->getSecureStopIds( | ||
616 | [&](Status status, const hidl_vec<SecureStopId>& ids) { | ||
617 | EXPECT_EQ(Status::OK, status); | ||
618 | EXPECT_EQ(1u, ids.size()); | ||
619 | }); | ||
620 | EXPECT_OK(res); | ||
621 | |||
622 | stat = drmPlugin->removeAllSecureStops(); | ||
623 | EXPECT_OK(stat); | ||
624 | |||
625 | res = drmPlugin->getSecureStopIds( | ||
626 | [&](Status status, const hidl_vec<SecureStopId>& ids) { | ||
627 | EXPECT_EQ(Status::OK, status); | ||
628 | EXPECT_EQ(0u, ids.size()); | ||
629 | }); | ||
630 | EXPECT_OK(res); | ||
631 | } | ||
632 | |||
633 | /** | ||
634 | * Since getSecureStopIds only queries information there are no | ||
635 | * negative cases. | ||
636 | */ | ||
637 | |||
638 | /** | ||
639 | * Test that the clearkey plugin reports no secure stops when | ||
640 | * there are none. | ||
641 | */ | ||
642 | TEST_F(DrmHalClearkeyTest, GetNoSecureStops) { | ||
643 | auto stat = drmPlugin->removeAllSecureStops(); | ||
644 | EXPECT_OK(stat); | ||
645 | |||
646 | auto res = drmPlugin->getSecureStops( | ||
647 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
648 | EXPECT_EQ(Status::OK, status); | ||
649 | EXPECT_EQ(0u, stops.size()); | ||
650 | }); | ||
651 | EXPECT_OK(res); | ||
652 | } | ||
653 | |||
654 | /** | ||
655 | * Test get/remove of one secure stop | ||
656 | */ | ||
657 | TEST_F(DrmHalClearkeyTest, GetOneSecureStopAndRemoveIt) { | ||
658 | auto stat = drmPlugin->removeAllSecureStops(); | ||
659 | EXPECT_OK(stat); | ||
660 | |||
661 | auto sessionId = openSession(); | ||
662 | loadKeys(sessionId); | ||
663 | closeSession(sessionId); | ||
664 | |||
665 | auto res = drmPlugin->getSecureStops( | ||
666 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
667 | EXPECT_EQ(Status::OK, status); | ||
668 | EXPECT_EQ(1u, stops.size()); | ||
669 | }); | ||
670 | EXPECT_OK(res); | ||
671 | |||
672 | stat = drmPlugin->removeAllSecureStops(); | ||
673 | EXPECT_OK(stat); | ||
674 | |||
675 | res = drmPlugin->getSecureStops( | ||
676 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
677 | EXPECT_EQ(Status::OK, status); | ||
678 | EXPECT_EQ(0u, stops.size()); | ||
679 | }); | ||
680 | EXPECT_OK(res); | ||
452 | } | 681 | } |
453 | 682 | ||
683 | /** | ||
684 | * Since getSecureStops only queries information there are no | ||
685 | * negative cases. | ||
686 | */ | ||
687 | |||
688 | /** | ||
689 | * Test that there are no secure stops after clearing them | ||
690 | */ | ||
691 | TEST_F(DrmHalClearkeyTest, GetSecureStopsCleared) { | ||
692 | auto stat = drmPlugin->removeAllSecureStops(); | ||
693 | EXPECT_OK(stat); | ||
694 | |||
695 | auto res = drmPlugin->getSecureStops( | ||
696 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
697 | EXPECT_EQ(Status::OK, status); | ||
698 | EXPECT_EQ(0u, stops.size()); | ||
699 | }); | ||
700 | EXPECT_OK(res); | ||
701 | } | ||
702 | |||
703 | /** | ||
704 | * Test that there are secure stops after loading keys once | ||
705 | */ | ||
706 | TEST_F(DrmHalClearkeyTest, GetSecureStopsOnce) { | ||
707 | auto stat = drmPlugin->removeAllSecureStops(); | ||
708 | EXPECT_OK(stat); | ||
709 | |||
710 | auto sessionId = openSession(); | ||
711 | loadKeys(sessionId); | ||
712 | closeSession(sessionId); | ||
713 | |||
714 | auto res = drmPlugin->getSecureStops( | ||
715 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
716 | EXPECT_EQ(Status::OK, status); | ||
717 | EXPECT_EQ(1u, stops.size()); | ||
718 | }); | ||
719 | EXPECT_OK(res); | ||
720 | |||
721 | stat = drmPlugin->removeAllSecureStops(); | ||
722 | EXPECT_OK(stat); | ||
723 | |||
724 | res = drmPlugin->getSecureStops( | ||
725 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
726 | EXPECT_EQ(Status::OK, status); | ||
727 | EXPECT_EQ(0u, stops.size()); | ||
728 | }); | ||
729 | EXPECT_OK(res); | ||
730 | } | ||
731 | |||
732 | /** | ||
733 | * Since getSecureStops only queries information there are no | ||
734 | * negative cases. | ||
735 | */ | ||
736 | |||
737 | /** | ||
738 | * Test that releasing a secure stop with empty | ||
739 | * release message fails with the documented error | ||
740 | */ | ||
741 | TEST_F(DrmHalClearkeyTest, ReleaseEmptySecureStop) { | ||
742 | SecureStopRelease emptyRelease = {.opaqueData = hidl_vec<uint8_t>()}; | ||
743 | Status status = drmPlugin->releaseSecureStops(emptyRelease); | ||
744 | EXPECT_EQ(Status::BAD_VALUE, status); | ||
745 | } | ||
746 | |||
747 | /** | ||
748 | * Helper function to create a secure release message for | ||
749 | * a secure stop. The clearkey secure stop release format | ||
750 | * is just a count followed by the secure stop opaque data. | ||
751 | */ | ||
752 | SecureStopRelease makeSecureRelease(const SecureStop &stop) { | ||
753 | std::vector<uint8_t> stopData = stop.opaqueData; | ||
754 | std::vector<uint8_t> buffer; | ||
755 | std::string count = "0001"; | ||
756 | |||
757 | auto it = buffer.insert(buffer.begin(), count.begin(), count.end()); | ||
758 | buffer.insert(it + count.size(), stopData.begin(), stopData.end()); | ||
759 | SecureStopRelease release = { .opaqueData = hidl_vec<uint8_t>(buffer) }; | ||
760 | return release; | ||
761 | } | ||
762 | |||
763 | /** | ||
764 | * Test that releasing one secure stop works | ||
765 | */ | ||
766 | TEST_F(DrmHalClearkeyTest, ReleaseOneSecureStop) { | ||
767 | |||
768 | auto stat = drmPlugin->removeAllSecureStops(); | ||
769 | EXPECT_OK(stat); | ||
770 | |||
771 | auto sessionId = openSession(); | ||
772 | loadKeys(sessionId); | ||
773 | closeSession(sessionId); | ||
774 | |||
775 | SecureStopRelease release; | ||
776 | auto res = drmPlugin->getSecureStops( | ||
777 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
778 | EXPECT_EQ(Status::OK, status); | ||
779 | EXPECT_EQ(1u, stops.size()); | ||
780 | release = makeSecureRelease(stops[0]); | ||
781 | }); | ||
782 | EXPECT_OK(res); | ||
783 | |||
784 | stat = drmPlugin->releaseSecureStops(release); | ||
785 | EXPECT_OK(stat); | ||
786 | |||
787 | res = drmPlugin->getSecureStops( | ||
788 | [&](Status status, const hidl_vec<SecureStop>& stops) { | ||
789 | EXPECT_EQ(Status::OK, status); | ||
790 | EXPECT_EQ(0u, stops.size()); | ||
791 | }); | ||
792 | EXPECT_OK(res); | ||
793 | } | ||
794 | |||
795 | |||
796 | /** | ||
797 | * Test that removing a secure stop with an empty ID returns | ||
798 | * documented error | ||
799 | */ | ||
800 | TEST_F(DrmHalClearkeyTest, RemoveEmptySecureStopId) { | ||
801 | hidl_vec<uint8_t> emptyId; | ||
802 | auto stat = drmPlugin->removeSecureStop(emptyId); | ||
803 | EXPECT_OK(stat); | ||
804 | EXPECT_EQ(Status::BAD_VALUE, stat); | ||
805 | } | ||
806 | |||
807 | /** | ||
808 | * Test that removing a secure stop after it has already | ||
809 | * been removed fails with the documented error code. | ||
810 | */ | ||
811 | TEST_F(DrmHalClearkeyTest, RemoveRemovedSecureStopId) { | ||
812 | auto stat = drmPlugin->removeAllSecureStops(); | ||
813 | EXPECT_OK(stat); | ||
814 | |||
815 | auto sessionId = openSession(); | ||
816 | loadKeys(sessionId); | ||
817 | closeSession(sessionId); | ||
818 | SecureStopId ssid; | ||
819 | |||
820 | auto res = drmPlugin->getSecureStopIds( | ||
821 | [&](Status status, const hidl_vec<SecureStopId>& ids) { | ||
822 | EXPECT_EQ(Status::OK, status); | ||
823 | EXPECT_EQ(1u, ids.size()); | ||
824 | ssid = ids[0]; | ||
825 | }); | ||
826 | EXPECT_OK(res); | ||
827 | |||
828 | stat = drmPlugin->removeAllSecureStops(); | ||
829 | EXPECT_OK(stat); | ||
830 | |||
831 | Status status = drmPlugin->removeSecureStop(ssid); | ||
832 | EXPECT_EQ(Status::BAD_VALUE, status); | ||
833 | } | ||
834 | |||
835 | /** | ||
836 | * Test that removing a secure stop by id works | ||
837 | */ | ||
838 | TEST_F(DrmHalClearkeyTest, RemoveSecureStopById) { | ||
839 | auto stat = drmPlugin->removeAllSecureStops(); | ||
840 | EXPECT_OK(stat); | ||
841 | |||
842 | auto sessionId = openSession(); | ||
843 | loadKeys(sessionId); | ||
844 | closeSession(sessionId); | ||
845 | SecureStopId ssid; | ||
846 | |||
847 | auto res = drmPlugin->getSecureStopIds( | ||
848 | [&](Status status, const hidl_vec<SecureStopId>& ids) { | ||
849 | EXPECT_EQ(Status::OK, status); | ||
850 | EXPECT_EQ(1u, ids.size()); | ||
851 | ssid = ids[0]; | ||
852 | }); | ||
853 | EXPECT_OK(res); | ||
854 | |||
855 | stat = drmPlugin->removeSecureStop(ssid); | ||
856 | EXPECT_OK(stat); | ||
857 | |||
858 | res = drmPlugin->getSecureStopIds( | ||
859 | [&](Status status, const hidl_vec<SecureStopId>& ids) { | ||
860 | EXPECT_EQ(Status::OK, status); | ||
861 | EXPECT_EQ(0u, ids.size()); | ||
862 | }); | ||
863 | EXPECT_OK(res); | ||
864 | } | ||
865 | |||
866 | |||
454 | int main(int argc, char** argv) { | 867 | int main(int argc, char** argv) { |
455 | ::testing::AddGlobalTestEnvironment(DrmHidlEnvironment::Instance()); | 868 | ::testing::AddGlobalTestEnvironment(DrmHidlEnvironment::Instance()); |
456 | ::testing::InitGoogleTest(&argc, argv); | 869 | ::testing::InitGoogleTest(&argc, argv); |
diff --git a/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp index 27c8d60b..3928c9ab 100644 --- a/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp +++ b/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp | |||
@@ -146,7 +146,7 @@ class WifiChipTest : public Test { | |||
146 | } else if (type == IfaceType::STA) { | 146 | } else if (type == IfaceType::STA) { |
147 | chip_->createStaIface( | 147 | chip_->createStaIface( |
148 | [&iface_name](const WifiStatus& status, | 148 | [&iface_name](const WifiStatus& status, |
149 | const sp<IWifiStaIface>& iface) { | 149 | const sp<V1_0::IWifiStaIface>& iface) { |
150 | if (WifiStatusCode::SUCCESS == status.code) { | 150 | if (WifiStatusCode::SUCCESS == status.code) { |
151 | ASSERT_NE(iface.get(), nullptr); | 151 | ASSERT_NE(iface.get(), nullptr); |
152 | iface->getName([&iface_name](const WifiStatus& status, | 152 | iface->getName([&iface_name](const WifiStatus& status, |
diff --git a/wifi/1.2/default/wifi_legacy_hal.cpp b/wifi/1.2/default/wifi_legacy_hal.cpp index 84af9c48..c314e645 100644 --- a/wifi/1.2/default/wifi_legacy_hal.cpp +++ b/wifi/1.2/default/wifi_legacy_hal.cpp | |||
@@ -492,6 +492,28 @@ wifi_error WifiLegacyHal::setPacketFilter(const std::string& iface_name, | |||
492 | getIfaceHandle(iface_name), program.data(), program.size()); | 492 | getIfaceHandle(iface_name), program.data(), program.size()); |
493 | } | 493 | } |
494 | 494 | ||
495 | std::pair<wifi_error, std::vector<uint8_t>> | ||
496 | WifiLegacyHal::readApfPacketFilterData(const std::string& iface_name) { | ||
497 | if (global_func_table_.wifi_read_packet_filter == nullptr) { | ||
498 | return {WIFI_ERROR_NOT_SUPPORTED, {}}; | ||
499 | } | ||
500 | |||
501 | PacketFilterCapabilities caps; | ||
502 | wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( | ||
503 | getIfaceHandle(iface_name), &caps.version, &caps.max_len); | ||
504 | if (status != WIFI_SUCCESS) { | ||
505 | return {status, {}}; | ||
506 | } | ||
507 | |||
508 | // Size the buffer to read the entire program & work memory. | ||
509 | std::vector<uint8_t> buffer(caps.max_len); | ||
510 | |||
511 | status = global_func_table_.wifi_read_packet_filter( | ||
512 | getIfaceHandle(iface_name), /*src_offset=*/0, buffer.data(), | ||
513 | buffer.size()); | ||
514 | return {status, move(buffer)}; | ||
515 | } | ||
516 | |||
495 | std::pair<wifi_error, wifi_gscan_capabilities> | 517 | std::pair<wifi_error, wifi_gscan_capabilities> |
496 | WifiLegacyHal::getGscanCapabilities(const std::string& iface_name) { | 518 | WifiLegacyHal::getGscanCapabilities(const std::string& iface_name) { |
497 | wifi_gscan_capabilities caps; | 519 | wifi_gscan_capabilities caps; |
diff --git a/wifi/1.2/default/wifi_legacy_hal.h b/wifi/1.2/default/wifi_legacy_hal.h index dedbbf82..60905ab3 100644 --- a/wifi/1.2/default/wifi_legacy_hal.h +++ b/wifi/1.2/default/wifi_legacy_hal.h | |||
@@ -156,7 +156,7 @@ using on_radio_mode_change_callback = | |||
156 | * Class that encapsulates all legacy HAL interactions. | 156 | * Class that encapsulates all legacy HAL interactions. |
157 | * This class manages the lifetime of the event loop thread used by legacy HAL. | 157 | * This class manages the lifetime of the event loop thread used by legacy HAL. |
158 | * | 158 | * |
159 | * Note: aThere will only be a single instance of this class created in the Wifi | 159 | * Note: There will only be a single instance of this class created in the Wifi |
160 | * object and will be valid for the lifetime of the process. | 160 | * object and will be valid for the lifetime of the process. |
161 | */ | 161 | */ |
162 | class WifiLegacyHal { | 162 | class WifiLegacyHal { |
@@ -188,6 +188,8 @@ class WifiLegacyHal { | |||
188 | const std::string& iface_name); | 188 | const std::string& iface_name); |
189 | wifi_error setPacketFilter(const std::string& iface_name, | 189 | wifi_error setPacketFilter(const std::string& iface_name, |
190 | const std::vector<uint8_t>& program); | 190 | const std::vector<uint8_t>& program); |
191 | std::pair<wifi_error, std::vector<uint8_t>> readApfPacketFilterData( | ||
192 | const std::string& iface_name); | ||
191 | // Gscan functions. | 193 | // Gscan functions. |
192 | std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities( | 194 | std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities( |
193 | const std::string& iface_name); | 195 | const std::string& iface_name); |
diff --git a/wifi/1.2/default/wifi_sta_iface.cpp b/wifi/1.2/default/wifi_sta_iface.cpp index 6faf0093..ab99daa2 100644 --- a/wifi/1.2/default/wifi_sta_iface.cpp +++ b/wifi/1.2/default/wifi_sta_iface.cpp | |||
@@ -94,6 +94,13 @@ Return<void> WifiStaIface::installApfPacketFilter( | |||
94 | hidl_status_cb, cmd_id, program); | 94 | hidl_status_cb, cmd_id, program); |
95 | } | 95 | } |
96 | 96 | ||
97 | Return<void> WifiStaIface::readApfPacketFilterData( | ||
98 | readApfPacketFilterData_cb hidl_status_cb) { | ||
99 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, | ||
100 | &WifiStaIface::readApfPacketFilterDataInternal, | ||
101 | hidl_status_cb); | ||
102 | } | ||
103 | |||
97 | Return<void> WifiStaIface::getBackgroundScanCapabilities( | 104 | Return<void> WifiStaIface::getBackgroundScanCapabilities( |
98 | getBackgroundScanCapabilities_cb hidl_status_cb) { | 105 | getBackgroundScanCapabilities_cb hidl_status_cb) { |
99 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, | 106 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, |
@@ -297,6 +304,15 @@ WifiStatus WifiStaIface::installApfPacketFilterInternal( | |||
297 | return createWifiStatusFromLegacyError(legacy_status); | 304 | return createWifiStatusFromLegacyError(legacy_status); |
298 | } | 305 | } |
299 | 306 | ||
307 | std::pair<WifiStatus, std::vector<uint8_t>> | ||
308 | WifiStaIface::readApfPacketFilterDataInternal() { | ||
309 | const std::pair<legacy_hal::wifi_error, std::vector<uint8_t>> | ||
310 | legacy_status_and_data = | ||
311 | legacy_hal_.lock()->readApfPacketFilterData(ifname_); | ||
312 | return {createWifiStatusFromLegacyError(legacy_status_and_data.first), | ||
313 | std::move(legacy_status_and_data.second)}; | ||
314 | } | ||
315 | |||
300 | std::pair<WifiStatus, StaBackgroundScanCapabilities> | 316 | std::pair<WifiStatus, StaBackgroundScanCapabilities> |
301 | WifiStaIface::getBackgroundScanCapabilitiesInternal() { | 317 | WifiStaIface::getBackgroundScanCapabilitiesInternal() { |
302 | legacy_hal::wifi_error legacy_status; | 318 | legacy_hal::wifi_error legacy_status; |
diff --git a/wifi/1.2/default/wifi_sta_iface.h b/wifi/1.2/default/wifi_sta_iface.h index 423365cf..a2128882 100644 --- a/wifi/1.2/default/wifi_sta_iface.h +++ b/wifi/1.2/default/wifi_sta_iface.h | |||
@@ -18,8 +18,8 @@ | |||
18 | #define WIFI_STA_IFACE_H_ | 18 | #define WIFI_STA_IFACE_H_ |
19 | 19 | ||
20 | #include <android-base/macros.h> | 20 | #include <android-base/macros.h> |
21 | #include <android/hardware/wifi/1.0/IWifiStaIface.h> | ||
22 | #include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h> | 21 | #include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h> |
22 | #include <android/hardware/wifi/1.2/IWifiStaIface.h> | ||
23 | 23 | ||
24 | #include "hidl_callback_util.h" | 24 | #include "hidl_callback_util.h" |
25 | #include "wifi_legacy_hal.h" | 25 | #include "wifi_legacy_hal.h" |
@@ -34,7 +34,7 @@ using namespace android::hardware::wifi::V1_0; | |||
34 | /** | 34 | /** |
35 | * HIDL interface object used to control a STA Iface instance. | 35 | * HIDL interface object used to control a STA Iface instance. |
36 | */ | 36 | */ |
37 | class WifiStaIface : public V1_0::IWifiStaIface { | 37 | class WifiStaIface : public V1_2::IWifiStaIface { |
38 | public: | 38 | public: |
39 | WifiStaIface(const std::string& ifname, | 39 | WifiStaIface(const std::string& ifname, |
40 | const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal); | 40 | const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal); |
@@ -56,6 +56,8 @@ class WifiStaIface : public V1_0::IWifiStaIface { | |||
56 | Return<void> installApfPacketFilter( | 56 | Return<void> installApfPacketFilter( |
57 | uint32_t cmd_id, const hidl_vec<uint8_t>& program, | 57 | uint32_t cmd_id, const hidl_vec<uint8_t>& program, |
58 | installApfPacketFilter_cb hidl_status_cb) override; | 58 | installApfPacketFilter_cb hidl_status_cb) override; |
59 | Return<void> readApfPacketFilterData( | ||
60 | readApfPacketFilterData_cb hidl_status_cb) override; | ||
59 | Return<void> getBackgroundScanCapabilities( | 61 | Return<void> getBackgroundScanCapabilities( |
60 | getBackgroundScanCapabilities_cb hidl_status_cb) override; | 62 | getBackgroundScanCapabilities_cb hidl_status_cb) override; |
61 | Return<void> getValidFrequenciesForBand( | 63 | Return<void> getValidFrequenciesForBand( |
@@ -113,6 +115,8 @@ class WifiStaIface : public V1_0::IWifiStaIface { | |||
113 | getApfPacketFilterCapabilitiesInternal(); | 115 | getApfPacketFilterCapabilitiesInternal(); |
114 | WifiStatus installApfPacketFilterInternal( | 116 | WifiStatus installApfPacketFilterInternal( |
115 | uint32_t cmd_id, const std::vector<uint8_t>& program); | 117 | uint32_t cmd_id, const std::vector<uint8_t>& program); |
118 | std::pair<WifiStatus, std::vector<uint8_t>> | ||
119 | readApfPacketFilterDataInternal(); | ||
116 | std::pair<WifiStatus, StaBackgroundScanCapabilities> | 120 | std::pair<WifiStatus, StaBackgroundScanCapabilities> |
117 | getBackgroundScanCapabilitiesInternal(); | 121 | getBackgroundScanCapabilitiesInternal(); |
118 | std::pair<WifiStatus, std::vector<WifiChannelInMhz>> | 122 | std::pair<WifiStatus, std::vector<WifiChannelInMhz>> |
diff --git a/wifi/supplicant/1.1/Android.bp b/wifi/supplicant/1.1/Android.bp index fafd6ad4..832d1ad1 100644 --- a/wifi/supplicant/1.1/Android.bp +++ b/wifi/supplicant/1.1/Android.bp | |||
@@ -8,6 +8,8 @@ hidl_interface { | |||
8 | }, | 8 | }, |
9 | srcs: [ | 9 | srcs: [ |
10 | "ISupplicant.hal", | 10 | "ISupplicant.hal", |
11 | "ISupplicantStaIface.hal", | ||
12 | "ISupplicantStaIfaceCallback.hal", | ||
11 | "ISupplicantStaNetwork.hal", | 13 | "ISupplicantStaNetwork.hal", |
12 | ], | 14 | ], |
13 | interfaces: [ | 15 | interfaces: [ |
diff --git a/wifi/supplicant/1.1/ISupplicantStaIface.hal b/wifi/supplicant/1.1/ISupplicantStaIface.hal new file mode 100644 index 00000000..025cc6ab --- /dev/null +++ b/wifi/supplicant/1.1/ISupplicantStaIface.hal | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright 2018 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache 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 | package android.hardware.wifi.supplicant@1.1; | ||
18 | |||
19 | import @1.0::ISupplicantStaIface; | ||
20 | import @1.1::ISupplicantStaIfaceCallback; | ||
21 | import @1.0::SupplicantStatus; | ||
22 | |||
23 | /** | ||
24 | * Interface exposed by the supplicant for each station mode network | ||
25 | * interface (e.g wlan0) it controls. | ||
26 | */ | ||
27 | interface ISupplicantStaIface extends @1.0::ISupplicantStaIface { | ||
28 | |||
29 | /** | ||
30 | * Register for callbacks from this interface. | ||
31 | * | ||
32 | * These callbacks are invoked for events that are specific to this interface. | ||
33 | * Registration of multiple callback objects is supported. These objects must | ||
34 | * be automatically deleted when the corresponding client process is dead or | ||
35 | * if this interface is removed. | ||
36 | * | ||
37 | * @param callback An instance of the |ISupplicantStaIfaceCallback| HIDL | ||
38 | * interface object. | ||
39 | * @return status Status of the operation. | ||
40 | * Possible status codes: | ||
41 | * |SupplicantStatusCode.SUCCESS|, | ||
42 | * |SupplicantStatusCode.FAILURE_UNKNOWN|, | ||
43 | * |SupplicantStatusCode.FAILURE_IFACE_INVALID| | ||
44 | */ | ||
45 | registerCallback_1_1(ISupplicantStaIfaceCallback callback) | ||
46 | generates (SupplicantStatus status); | ||
47 | }; | ||
48 | |||
diff --git a/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.hal new file mode 100644 index 00000000..8b92ee5e --- /dev/null +++ b/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.hal | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright 2018 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache 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 | package android.hardware.wifi.supplicant@1.1; | ||
18 | |||
19 | import @1.0::ISupplicantStaIfaceCallback; | ||
20 | |||
21 | /** | ||
22 | * Callback Interface exposed by the supplicant service | ||
23 | * for each station mode interface (ISupplicantStaIface). | ||
24 | * | ||
25 | * Clients need to host an instance of this HIDL interface object and | ||
26 | * pass a reference of the object to the supplicant via the | ||
27 | * corresponding |ISupplicantStaIface.registerCallback_1_1| method. | ||
28 | */ | ||
29 | interface ISupplicantStaIfaceCallback extends @1.0::ISupplicantStaIfaceCallback { | ||
30 | |||
31 | /* EapErrorCode: Error code for EAP or EAP Method as per RFC-4186 */ | ||
32 | enum EapErrorCode : uint32_t { | ||
33 | SIM_GENERAL_FAILURE_AFTER_AUTH = 0, | ||
34 | SIM_TEMPORARILY_DENIED = 1026, | ||
35 | SIM_NOT_SUBSCRIBED = 1031, | ||
36 | SIM_GENERAL_FAILURE_BEFORE_AUTH = 16384, | ||
37 | SIM_VENDOR_SPECIFIC_EXPIRED_CERT = 16385, | ||
38 | }; | ||
39 | |||
40 | /** | ||
41 | * Used to indicate an EAP authentication failure. | ||
42 | */ | ||
43 | oneway onEapFailure_1_1(EapErrorCode errorCode); | ||
44 | }; | ||
45 | |||
diff --git a/wifi/supplicant/1.1/vts/functional/Android.bp b/wifi/supplicant/1.1/vts/functional/Android.bp index 3efe15d7..3e65453c 100644 --- a/wifi/supplicant/1.1/vts/functional/Android.bp +++ b/wifi/supplicant/1.1/vts/functional/Android.bp | |||
@@ -40,6 +40,7 @@ cc_test { | |||
40 | srcs: [ | 40 | srcs: [ |
41 | "VtsHalWifiSupplicantV1_1TargetTest.cpp", | 41 | "VtsHalWifiSupplicantV1_1TargetTest.cpp", |
42 | "supplicant_hidl_test.cpp", | 42 | "supplicant_hidl_test.cpp", |
43 | "supplicant_sta_iface_hidl_test.cpp", | ||
43 | "supplicant_sta_network_hidl_test.cpp", | 44 | "supplicant_sta_network_hidl_test.cpp", |
44 | ], | 45 | ], |
45 | static_libs: [ | 46 | static_libs: [ |
diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp index 3f177404..04a5ed9d 100644 --- a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp +++ b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "supplicant_hidl_test_utils_1_1.h" | 21 | #include "supplicant_hidl_test_utils_1_1.h" |
22 | 22 | ||
23 | using ::android::hardware::wifi::supplicant::V1_1::ISupplicant; | 23 | using ::android::hardware::wifi::supplicant::V1_1::ISupplicant; |
24 | using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface; | ||
24 | using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaNetwork; | 25 | using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaNetwork; |
25 | using ::android::sp; | 26 | using ::android::sp; |
26 | 27 | ||
@@ -28,6 +29,10 @@ sp<ISupplicant> getSupplicant_1_1() { | |||
28 | return ISupplicant::castFrom(getSupplicant()); | 29 | return ISupplicant::castFrom(getSupplicant()); |
29 | } | 30 | } |
30 | 31 | ||
32 | sp<ISupplicantStaIface> getSupplicantStaIface_1_1() { | ||
33 | return ISupplicantStaIface::castFrom(getSupplicantStaIface()); | ||
34 | } | ||
35 | |||
31 | sp<ISupplicantStaNetwork> createSupplicantStaNetwork_1_1() { | 36 | sp<ISupplicantStaNetwork> createSupplicantStaNetwork_1_1() { |
32 | return ISupplicantStaNetwork::castFrom(createSupplicantStaNetwork()); | 37 | return ISupplicantStaNetwork::castFrom(createSupplicantStaNetwork()); |
33 | } | 38 | } |
diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h index e7ce54ae..1c13325f 100644 --- a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h +++ b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h | |||
@@ -18,11 +18,15 @@ | |||
18 | #define SUPPLICANT_HIDL_TEST_UTILS_1_1_H | 18 | #define SUPPLICANT_HIDL_TEST_UTILS_1_1_H |
19 | 19 | ||
20 | #include <android/hardware/wifi/supplicant/1.1/ISupplicant.h> | 20 | #include <android/hardware/wifi/supplicant/1.1/ISupplicant.h> |
21 | #include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIface.h> | ||
21 | #include <android/hardware/wifi/supplicant/1.1/ISupplicantStaNetwork.h> | 22 | #include <android/hardware/wifi/supplicant/1.1/ISupplicantStaNetwork.h> |
22 | 23 | ||
23 | android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicant> | 24 | android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicant> |
24 | getSupplicant_1_1(); | 25 | getSupplicant_1_1(); |
25 | 26 | ||
27 | android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface> | ||
28 | getSupplicantStaIface_1_1(); | ||
29 | |||
26 | android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicantStaNetwork> | 30 | android::sp<android::hardware::wifi::supplicant::V1_1::ISupplicantStaNetwork> |
27 | createSupplicantStaNetwork_1_1(); | 31 | createSupplicantStaNetwork_1_1(); |
28 | 32 | ||
diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.1/vts/functional/supplicant_sta_iface_hidl_test.cpp new file mode 100644 index 00000000..c5e6319d --- /dev/null +++ b/wifi/supplicant/1.1/vts/functional/supplicant_sta_iface_hidl_test.cpp | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache 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 <VtsHalHidlTargetTestBase.h> | ||
20 | |||
21 | #include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIface.h> | ||
22 | |||
23 | #include "supplicant_hidl_test_utils.h" | ||
24 | #include "supplicant_hidl_test_utils_1_1.h" | ||
25 | |||
26 | using ::android::sp; | ||
27 | using ::android::hardware::hidl_array; | ||
28 | using ::android::hardware::hidl_string; | ||
29 | using ::android::hardware::hidl_vec; | ||
30 | using ::android::hardware::Return; | ||
31 | using ::android::hardware::Void; | ||
32 | using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface; | ||
33 | using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIfaceCallback; | ||
34 | using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus; | ||
35 | using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; | ||
36 | |||
37 | class SupplicantStaIfaceHidlTest | ||
38 | : public ::testing::VtsHalHidlTargetTestBase { | ||
39 | public: | ||
40 | virtual void SetUp() override { | ||
41 | startSupplicantAndWaitForHidlService(); | ||
42 | EXPECT_TRUE(turnOnExcessiveLogging()); | ||
43 | sta_iface_ = getSupplicantStaIface_1_1(); | ||
44 | ASSERT_NE(sta_iface_.get(), nullptr); | ||
45 | } | ||
46 | |||
47 | virtual void TearDown() override { stopSupplicant(); } | ||
48 | |||
49 | protected: | ||
50 | // ISupplicantStaIface object used for all tests in this fixture. | ||
51 | sp<ISupplicantStaIface> sta_iface_; | ||
52 | }; | ||
53 | |||
54 | class IfaceCallback : public ISupplicantStaIfaceCallback { | ||
55 | Return<void> onNetworkAdded(uint32_t /* id */) override { return Void(); } | ||
56 | Return<void> onNetworkRemoved(uint32_t /* id */) override { return Void(); } | ||
57 | Return<void> onStateChanged( | ||
58 | ISupplicantStaIfaceCallback::State /* newState */, | ||
59 | const hidl_array<uint8_t, 6>& /*bssid */, uint32_t /* id */, | ||
60 | const hidl_vec<uint8_t>& /* ssid */) override { | ||
61 | return Void(); | ||
62 | } | ||
63 | Return<void> onAnqpQueryDone( | ||
64 | const hidl_array<uint8_t, 6>& /* bssid */, | ||
65 | const ISupplicantStaIfaceCallback::AnqpData& /* data */, | ||
66 | const ISupplicantStaIfaceCallback::Hs20AnqpData& /* hs20Data */) | ||
67 | override { | ||
68 | return Void(); | ||
69 | } | ||
70 | virtual Return<void> onHs20IconQueryDone( | ||
71 | const hidl_array<uint8_t, 6>& /* bssid */, | ||
72 | const hidl_string& /* fileName */, | ||
73 | const hidl_vec<uint8_t>& /* data */) override { | ||
74 | return Void(); | ||
75 | } | ||
76 | virtual Return<void> onHs20SubscriptionRemediation( | ||
77 | const hidl_array<uint8_t, 6>& /* bssid */, | ||
78 | ISupplicantStaIfaceCallback::OsuMethod /* osuMethod */, | ||
79 | const hidl_string& /* url*/) override { | ||
80 | return Void(); | ||
81 | } | ||
82 | Return<void> onHs20DeauthImminentNotice( | ||
83 | const hidl_array<uint8_t, 6>& /* bssid */, uint32_t /* reasonCode */, | ||
84 | uint32_t /* reAuthDelayInSec */, | ||
85 | const hidl_string& /* url */) override { | ||
86 | return Void(); | ||
87 | } | ||
88 | Return<void> onDisconnected(const hidl_array<uint8_t, 6>& /* bssid */, | ||
89 | bool /* locallyGenerated */, | ||
90 | ISupplicantStaIfaceCallback::ReasonCode | ||
91 | /* reasonCode */) override { | ||
92 | return Void(); | ||
93 | } | ||
94 | Return<void> onAssociationRejected( | ||
95 | const hidl_array<uint8_t, 6>& /* bssid */, | ||
96 | ISupplicantStaIfaceCallback::StatusCode /* statusCode */, | ||
97 | bool /*timedOut */) override { | ||
98 | return Void(); | ||
99 | } | ||
100 | Return<void> onAuthenticationTimeout( | ||
101 | const hidl_array<uint8_t, 6>& /* bssid */) override { | ||
102 | return Void(); | ||
103 | } | ||
104 | Return<void> onBssidChanged( | ||
105 | ISupplicantStaIfaceCallback::BssidChangeReason /* reason */, | ||
106 | const hidl_array<uint8_t, 6>& /* bssid */) override { | ||
107 | return Void(); | ||
108 | } | ||
109 | Return<void> onEapFailure() override { return Void(); } | ||
110 | Return<void> onEapFailure_1_1( | ||
111 | ISupplicantStaIfaceCallback::EapErrorCode /* eapErrorCode */) override { | ||
112 | return Void(); | ||
113 | } | ||
114 | Return<void> onWpsEventSuccess() override { return Void(); } | ||
115 | Return<void> onWpsEventFail( | ||
116 | const hidl_array<uint8_t, 6>& /* bssid */, | ||
117 | ISupplicantStaIfaceCallback::WpsConfigError /* configError */, | ||
118 | ISupplicantStaIfaceCallback::WpsErrorIndication /* errorInd */) | ||
119 | override { | ||
120 | return Void(); | ||
121 | } | ||
122 | Return<void> onWpsEventPbcOverlap() override { return Void(); } | ||
123 | Return<void> onExtRadioWorkStart(uint32_t /* id */) override { | ||
124 | return Void(); | ||
125 | } | ||
126 | Return<void> onExtRadioWorkTimeout(uint32_t /* id*/) override { | ||
127 | return Void(); | ||
128 | } | ||
129 | }; | ||
130 | |||
131 | /* | ||
132 | * RegisterCallback_1_1 | ||
133 | */ | ||
134 | TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback_1_1) { | ||
135 | sta_iface_->registerCallback_1_1( | ||
136 | new IfaceCallback(), [](const SupplicantStatus& status) { | ||
137 | EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); | ||
138 | }); | ||
139 | } | ||