From 2bb626a2975ef3398adbcb12fe50804cf71efc39 Mon Sep 17 00:00:00 2001 From: Eric Schwarzenbach Date: Wed, 6 Jun 2018 16:09:58 -0700 Subject: [PATCH 01/36] Call notify for voiceReg and dataReg VTS tests Bug: 80554443 Test: vts Change-Id: I19f7131f7b65323065f3c283a89668ff761815e3 --- radio/1.2/vts/functional/radio_response.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/radio/1.2/vts/functional/radio_response.cpp b/radio/1.2/vts/functional/radio_response.cpp index f6bead21e7..dab63a359f 100644 --- a/radio/1.2/vts/functional/radio_response.cpp +++ b/radio/1.2/vts/functional/radio_response.cpp @@ -745,13 +745,17 @@ Return RadioResponse_v1_2::getCellInfoListResponse_1_2( } Return RadioResponse_v1_2::getVoiceRegistrationStateResponse_1_2( - const RadioResponseInfo& /*info*/, + const RadioResponseInfo& info, const ::android::hardware::radio::V1_2::VoiceRegStateResult& /*voiceRegResponse*/) { + rspInfo = info; + parent_v1_2.notify(info.serial); return Void(); } Return RadioResponse_v1_2::getDataRegistrationStateResponse_1_2( - const RadioResponseInfo& /*info*/, + const RadioResponseInfo& info, const ::android::hardware::radio::V1_2::DataRegStateResult& /*dataRegResponse*/) { + rspInfo = info; + parent_v1_2.notify(info.serial); return Void(); -} \ No newline at end of file +} From 0ff41b94b30a0db0ce4a6a5b29600ced5853a762 Mon Sep 17 00:00:00 2001 From: sqian Date: Wed, 6 Jun 2018 22:35:20 -0700 Subject: [PATCH 02/36] Add setIndicationFilter response notification in 1.2 VTS Test: compile Bug: 109822806 Change-Id: I95102a148a26cab80235cc68ad83143a9bb6eb39 --- radio/1.2/vts/functional/radio_response.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/radio/1.2/vts/functional/radio_response.cpp b/radio/1.2/vts/functional/radio_response.cpp index f6bead21e7..e89e46798d 100644 --- a/radio/1.2/vts/functional/radio_response.cpp +++ b/radio/1.2/vts/functional/radio_response.cpp @@ -653,7 +653,9 @@ Return RadioResponse_v1_2::sendDeviceStateResponse(const RadioResponseInfo return Void(); } -Return RadioResponse_v1_2::setIndicationFilterResponse(const RadioResponseInfo& /*info*/) { +Return RadioResponse_v1_2::setIndicationFilterResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_2.notify(info.serial); return Void(); } From 79db3ec849c5f1142a0802dccfff6cbef564ff76 Mon Sep 17 00:00:00 2001 From: Hung-ying Tyan Date: Fri, 8 Jun 2018 17:53:48 +0800 Subject: [PATCH 03/36] Fix free() in keymaster VTS The buffer is allocated by OPENSSL_malloc() in X509_NAME_oneline(name, nullptr, 0). Should be reclaimed by OPENSSL_free() instead of free(). The patch is provided by vink.shen@mediatek.corp-partner.google.com Bug: 109708231 Test: build pass Change-Id: I66a864e3e28905eebac2e7d3a4517d4d5aaa39df --- keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp | 7 ++++--- keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp index 3a181a96b7..7cdf253be8 100644 --- a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -322,11 +323,11 @@ bool verify_chain(const hidl_vec>& chain) { char* cert_sub = X509_NAME_oneline(X509_get_subject_name(key_cert.get()), nullptr, 0); EXPECT_STREQ("/CN=Android Keystore Key", cert_sub) << "Cert " << i << " has wrong subject. (Possibly b/38394614)"; - free(cert_sub); + OPENSSL_free(cert_sub); } - free(cert_issuer); - free(signer_subj); + OPENSSL_free(cert_issuer); + OPENSSL_free(signer_subj); if (dump_Attestations) std::cout << bin2hex(chain[i]) << std::endl; } diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index bc33b2bfc2..202cf229f9 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -208,11 +209,11 @@ bool verify_chain(const hidl_vec>& chain) { char* cert_sub = X509_NAME_oneline(X509_get_subject_name(key_cert.get()), nullptr, 0); EXPECT_STREQ("/CN=Android Keystore Key", cert_sub) << "Cert " << i << " has wrong subject."; - free(cert_sub); + OPENSSL_free(cert_sub); } - free(cert_issuer); - free(signer_subj); + OPENSSL_free(cert_issuer); + OPENSSL_free(signer_subj); if (dump_Attestations) std::cout << bin2hex(chain[i]) << std::endl; } From 817848e59e18334a30f623ef143cf182716fd3fa Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Tue, 12 Jun 2018 15:23:39 -0700 Subject: [PATCH 04/36] Allow general errors for getImsiForApp(). This is to match it with other 1.0 tests where general errors are allowed. For newer tests we have decided to not allow these errors, but a failure for this old test is reported when run with SIM present. Test: run vts -m VtsHalRadioV1_0Target Bug: 109889468 Change-Id: If36083b7832706a50805932e8ba08e4eb397f3fe --- radio/1.0/vts/functional/radio_hidl_hal_icc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp index b764b13283..67e51ea79a 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp @@ -180,7 +180,8 @@ TEST_F(RadioHidlTest, getImsiForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); - EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15 if (radioRsp->rspInfo.error == RadioError::NONE) { From e3ff41fc12fb7a80ee533e4459035ef4545c174d Mon Sep 17 00:00:00 2001 From: Vishal Agarwal Date: Tue, 5 Jun 2018 18:42:01 -0700 Subject: [PATCH 05/36] Add VTS test to verify scheduling capability 2018+ devices must support GNSS capability scheduling Test results: go/vts-review-bucket/pi-dev/4267645 Bug: 109642198 Test: atest VtsHalGnssV1_0TargetTest Change-Id: I7394674abca8f8c40ab30403be6b41bbbb279956 --- gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp index 010a46dbc2..608ee70065 100644 --- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp @@ -472,6 +472,16 @@ TEST_F(GnssHalTest, MeasurementCapabilites) { } } +/* + * SchedulingCapabilities: + * Verifies that 2018+ hardware supports Scheduling capabilities. + */ +TEST_F(GnssHalTest, SchedulingCapabilities) { + if (info_called_count_ > 0 && last_info_.yearOfHw >= 2018) { + EXPECT_TRUE(last_capabilities_ & IGnssCallback::Capabilities::SCHEDULING); + } +} + int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); From 3a7e2cade3305d59f861c21206b5862de9d05d5c Mon Sep 17 00:00:00 2001 From: nagendra modadugu Date: Tue, 5 Jun 2018 11:05:19 -0700 Subject: [PATCH 06/36] Respect limited requirements for Strongbox KM implementations With this patch the KM VTS test apply the restricted requirements on supported key sizes, EC curves, and Digests to Strongbox keymaster implementations. Also amend tests to use Update(). Test: Yes it is Bug: 74519020 Change-Id: Ibec9c3398671f81dbc0ecf78e554726276160579 --- .../4.0/vts/functional/KeymasterHidlTest.cpp | 135 +++++++++++++++++- .../4.0/vts/functional/KeymasterHidlTest.h | 9 ++ .../functional/keymaster_hidl_hal_test.cpp | 103 ++++++++----- 3 files changed, 203 insertions(+), 44 deletions(-) diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp index e266a86ed9..c89abd90a3 100644 --- a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp +++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp @@ -16,6 +16,9 @@ #include "KeymasterHidlTest.h" +#include + +#include #include #include @@ -383,12 +386,18 @@ string KeymasterHidlTest::ProcessMessage(const HidlBuf& key_blob, KeyPurpose ope AuthorizationSet begin_out_params; EXPECT_EQ(ErrorCode::OK, Begin(operation, key_blob, in_params, &begin_out_params, &op_handle_)); + string output; + size_t consumed = 0; + AuthorizationSet update_params; + AuthorizationSet update_out_params; + EXPECT_EQ(ErrorCode::OK, + Update(op_handle_, update_params, message, &update_out_params, &output, &consumed)); + string unused; AuthorizationSet finish_params; AuthorizationSet finish_out_params; - string output; - EXPECT_EQ(ErrorCode::OK, - Finish(op_handle_, finish_params, message, unused, &finish_out_params, &output)); + EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, message.substr(consumed), unused, + &finish_out_params, &output)); op_handle_ = kOpHandleSentinel; out_params->push_back(begin_out_params); @@ -480,12 +489,20 @@ void KeymasterHidlTest::VerifyMessage(const HidlBuf& key_blob, const string& mes ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::VERIFY, key_blob, params, &begin_out_params, &op_handle_)); + string output; + AuthorizationSet update_params; + AuthorizationSet update_out_params; + size_t consumed; + ASSERT_EQ(ErrorCode::OK, + Update(op_handle_, update_params, message, &update_out_params, &output, &consumed)); + EXPECT_TRUE(output.empty()); + EXPECT_GT(consumed, 0U); + string unused; AuthorizationSet finish_params; AuthorizationSet finish_out_params; - string output; - EXPECT_EQ(ErrorCode::OK, - Finish(op_handle_, finish_params, message, signature, &finish_out_params, &output)); + EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, message.substr(consumed), signature, + &finish_out_params, &output)); op_handle_ = kOpHandleSentinel; EXPECT_TRUE(output.empty()); } @@ -585,6 +602,112 @@ std::pair KeymasterHidlTest::UpgradeKey(const HidlBuf& key_b }); return retval; } +std::vector KeymasterHidlTest::ValidKeySizes(Algorithm algorithm) { + switch (algorithm) { + case Algorithm::RSA: + switch (SecLevel()) { + case SecurityLevel::TRUSTED_ENVIRONMENT: + return {2048, 3072, 4096}; + case SecurityLevel::STRONGBOX: + return {2048}; + default: + CHECK(false) << "Invalid security level " << uint32_t(SecLevel()); + break; + } + break; + case Algorithm::EC: + switch (SecLevel()) { + case SecurityLevel::TRUSTED_ENVIRONMENT: + return {224, 256, 384, 521}; + case SecurityLevel::STRONGBOX: + return {256}; + default: + CHECK(false) << "Invalid security level " << uint32_t(SecLevel()); + break; + } + break; + case Algorithm::AES: + return {128, 256}; + case Algorithm::TRIPLE_DES: + return {168}; + case Algorithm::HMAC: { + std::vector retval((512 - 64) / 8 + 1); + uint32_t size = 64 - 8; + std::generate(retval.begin(), retval.end(), [&]() { return (size += 8); }); + return retval; + } + default: + CHECK(false) << "Invalid Algorithm: " << algorithm; + return {}; + } + CHECK(false) << "Should be impossible to get here"; + return {}; +} +std::vector KeymasterHidlTest::InvalidKeySizes(Algorithm algorithm) { + if (SecLevel() == SecurityLevel::TRUSTED_ENVIRONMENT) return {}; + CHECK(SecLevel() == SecurityLevel::STRONGBOX); + switch (algorithm) { + case Algorithm::RSA: + return {3072, 4096}; + case Algorithm::EC: + return {224, 384, 521}; + default: + return {}; + } +} + +std::vector KeymasterHidlTest::ValidCurves() { + if (securityLevel_ == SecurityLevel::STRONGBOX) { + return {EcCurve::P_256}; + } else { + return {EcCurve::P_224, EcCurve::P_256, EcCurve::P_384, EcCurve::P_521}; + } +} + +std::vector KeymasterHidlTest::InvalidCurves() { + if (SecLevel() == SecurityLevel::TRUSTED_ENVIRONMENT) return {}; + CHECK(SecLevel() == SecurityLevel::STRONGBOX); + return {EcCurve::P_224, EcCurve::P_384, EcCurve::P_521}; +} + +std::initializer_list KeymasterHidlTest::ValidDigests(bool withNone, bool withMD5) { + std::vector result; + switch (SecLevel()) { + case SecurityLevel::TRUSTED_ENVIRONMENT: + if (withNone) { + if (withMD5) + return {Digest::NONE, Digest::MD5, Digest::SHA1, + Digest::SHA_2_224, Digest::SHA_2_256, Digest::SHA_2_384, + Digest::SHA_2_512}; + else + return {Digest::NONE, Digest::SHA1, Digest::SHA_2_224, + Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512}; + } else { + if (withMD5) + return {Digest::MD5, Digest::SHA1, Digest::SHA_2_224, + Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512}; + else + return {Digest::SHA1, Digest::SHA_2_224, Digest::SHA_2_256, Digest::SHA_2_384, + Digest::SHA_2_512}; + } + break; + case SecurityLevel::STRONGBOX: + if (withNone) + return {Digest::NONE, Digest::SHA_2_256}; + else + return {Digest::SHA_2_256}; + break; + default: + CHECK(false) << "Invalid security level " << uint32_t(SecLevel()); + break; + } + CHECK(false) << "Should be impossible to get here"; + return {}; +} + +std::vector KeymasterHidlTest::InvalidDigests() { + return {}; +} } // namespace test } // namespace V4_0 diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.h b/keymaster/4.0/vts/functional/KeymasterHidlTest.h index 36d3fc21b7..94beb21d4d 100644 --- a/keymaster/4.0/vts/functional/KeymasterHidlTest.h +++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.h @@ -208,6 +208,15 @@ class KeymasterHidlTest : public ::testing::VtsHalHidlTargetTestBase { static bool IsSecure() { return securityLevel_ != SecurityLevel::SOFTWARE; } static SecurityLevel SecLevel() { return securityLevel_; } + std::vector ValidKeySizes(Algorithm algorithm); + std::vector InvalidKeySizes(Algorithm algorithm); + + std::vector ValidCurves(); + std::vector InvalidCurves(); + + std::initializer_list ValidDigests(bool withNone, bool withMD5); + std::vector InvalidDigests(); + HidlBuf key_blob_; KeyCharacteristics key_characteristics_; OperationHandle op_handle_ = kOpHandleSentinel; diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index 202cf229f9..450b3eb4e5 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -376,7 +376,7 @@ class NewKeyGenerationTest : public KeymasterHidlTest { * correct characteristics. */ TEST_F(NewKeyGenerationTest, Rsa) { - for (uint32_t key_size : {1024, 2048, 3072, 4096}) { + for (auto key_size : ValidKeySizes(Algorithm::RSA)) { HidlBuf key_blob; KeyCharacteristics key_characteristics; ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() @@ -405,6 +405,23 @@ TEST_F(NewKeyGenerationTest, Rsa) { } } +/* + * NewKeyGenerationTest.NoInvalidRsaSizes + * + * Verifies that keymaster cannot generate any RSA key sizes that are designated as invalid. + */ +TEST_F(NewKeyGenerationTest, NoInvalidRsaSizes) { + for (auto key_size : InvalidKeySizes(Algorithm::RSA)) { + HidlBuf key_blob; + KeyCharacteristics key_characteristics; + ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE, GenerateKey(AuthorizationSetBuilder() + .RsaSigningKey(key_size, 3) + .Digest(Digest::NONE) + .Padding(PaddingMode::NONE), + &key_blob, &key_characteristics)); + } +} + /* * NewKeyGenerationTest.RsaNoDefaultSize * @@ -425,7 +442,7 @@ TEST_F(NewKeyGenerationTest, RsaNoDefaultSize) { * correct characteristics. */ TEST_F(NewKeyGenerationTest, Ecdsa) { - for (uint32_t key_size : {224, 256, 384, 521}) { + for (auto key_size : ValidKeySizes(Algorithm::EC)) { HidlBuf key_blob; KeyCharacteristics key_characteristics; ASSERT_EQ( @@ -467,10 +484,18 @@ TEST_F(NewKeyGenerationTest, EcdsaDefaultSize) { /* * NewKeyGenerationTest.EcdsaInvalidSize * - * Verifies that failing to specify an invalid key size for EC key generation returns - * UNSUPPORTED_KEY_SIZE. + * Verifies that specifying an invalid key size for EC key generation returns UNSUPPORTED_KEY_SIZE. */ TEST_F(NewKeyGenerationTest, EcdsaInvalidSize) { + for (auto key_size : InvalidKeySizes(Algorithm::EC)) { + HidlBuf key_blob; + KeyCharacteristics key_characteristics; + ASSERT_EQ( + ErrorCode::UNSUPPORTED_KEY_SIZE, + GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(key_size).Digest(Digest::NONE), + &key_blob, &key_characteristics)); + } + ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE, GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(190).Digest(Digest::NONE))); } @@ -482,6 +507,8 @@ TEST_F(NewKeyGenerationTest, EcdsaInvalidSize) { * INVALID_ARGUMENT. */ TEST_F(NewKeyGenerationTest, EcdsaMismatchKeySize) { + if (SecLevel() == SecurityLevel::STRONGBOX) return; + ASSERT_EQ(ErrorCode::INVALID_ARGUMENT, GenerateKey(AuthorizationSetBuilder() .EcdsaSigningKey(224) @@ -495,7 +522,7 @@ TEST_F(NewKeyGenerationTest, EcdsaMismatchKeySize) { * Verifies that keymaster supports all required EC key sizes. */ TEST_F(NewKeyGenerationTest, EcdsaAllValidSizes) { - size_t valid_sizes[] = {224, 256, 384, 521}; + auto valid_sizes = ValidKeySizes(Algorithm::EC); for (size_t size : valid_sizes) { EXPECT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(size).Digest(Digest::NONE))) @@ -506,13 +533,12 @@ TEST_F(NewKeyGenerationTest, EcdsaAllValidSizes) { } /* - * NewKeyGenerationTest.EcdsaAllValidCurves + * NewKeyGenerationTest.EcdsaInvalidCurves * - * Verifies that keymaster supports all required EC curves. + * Verifies that keymaster does not support any curve designated as unsupported. */ TEST_F(NewKeyGenerationTest, EcdsaAllValidCurves) { - V4_0::EcCurve curves[] = {EcCurve::P_224, EcCurve::P_256, EcCurve::P_384, EcCurve::P_521}; - for (V4_0::EcCurve curve : curves) { + for (auto curve : ValidCurves()) { EXPECT_EQ( ErrorCode::OK, GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(curve).Digest(Digest::SHA_2_512))) @@ -529,8 +555,7 @@ TEST_F(NewKeyGenerationTest, EcdsaAllValidCurves) { * characteristics. */ TEST_F(NewKeyGenerationTest, Hmac) { - for (auto digest : {Digest::MD5, Digest::SHA1, Digest::SHA_2_224, Digest::SHA_2_256, - Digest::SHA_2_384, Digest::SHA_2_512}) { + for (auto digest : ValidDigests(false /* withNone */, true /* withMD5 */)) { HidlBuf key_blob; KeyCharacteristics key_characteristics; constexpr size_t key_size = 128; @@ -631,6 +656,8 @@ TEST_F(NewKeyGenerationTest, HmacCheckMinMacLengths) { * Verifies that keymaster rejects HMAC key generation with multiple specified digest algorithms. */ TEST_F(NewKeyGenerationTest, HmacMultipleDigests) { + if (SecLevel() == SecurityLevel::STRONGBOX) return; + ASSERT_EQ(ErrorCode::UNSUPPORTED_DIGEST, GenerateKey(AuthorizationSetBuilder() .HmacKey(128) @@ -665,7 +692,7 @@ typedef KeymasterHidlTest SigningOperationsTest; */ TEST_F(SigningOperationsTest, RsaSuccess) { ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() - .RsaSigningKey(1024, 65537) + .RsaSigningKey(2048, 65537) .Digest(Digest::NONE) .Padding(PaddingMode::NONE) .Authorization(TAG_NO_AUTH_REQUIRED))); @@ -681,7 +708,7 @@ TEST_F(SigningOperationsTest, RsaSuccess) { */ TEST_F(SigningOperationsTest, RsaPssSha256Success) { ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() - .RsaSigningKey(1024, 65537) + .RsaSigningKey(2048, 65537) .Digest(Digest::SHA_2_256) .Padding(PaddingMode::RSA_PSS) .Authorization(TAG_NO_AUTH_REQUIRED))); @@ -699,7 +726,7 @@ TEST_F(SigningOperationsTest, RsaPssSha256Success) { */ TEST_F(SigningOperationsTest, RsaPaddingNoneDoesNotAllowOther) { ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() - .RsaSigningKey(1024, 65537) + .RsaSigningKey(2048, 65537) .Digest(Digest::NONE) .Authorization(TAG_NO_AUTH_REQUIRED) .Padding(PaddingMode::NONE))); @@ -994,11 +1021,8 @@ TEST_F(SigningOperationsTest, RsaSignTooLargeMessage) { * Verifies that ECDSA operations succeed with all possible key sizes and hashes. */ TEST_F(SigningOperationsTest, EcdsaAllSizesAndHashes) { - for (auto key_size : {224, 256, 384, 521}) { - for (auto digest : { - Digest::SHA1, Digest::SHA_2_224, Digest::SHA_2_256, Digest::SHA_2_384, - Digest::SHA_2_512, - }) { + for (auto key_size : ValidKeySizes(Algorithm::EC)) { + for (auto digest : ValidDigests(false /* withNone */, false /* withMD5 */)) { ErrorCode error = GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .EcdsaSigningKey(key_size) @@ -1021,7 +1045,7 @@ TEST_F(SigningOperationsTest, EcdsaAllSizesAndHashes) { * Verifies that ECDSA operations succeed with all possible curves. */ TEST_F(SigningOperationsTest, EcdsaAllCurves) { - for (auto curve : {EcCurve::P_224, EcCurve::P_256, EcCurve::P_384, EcCurve::P_521}) { + for (auto curve : ValidCurves()) { ErrorCode error = GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .EcdsaSigningKey(curve) @@ -1076,8 +1100,7 @@ TEST_F(SigningOperationsTest, AesEcbSign) { * Verifies that HMAC works with all digests. */ TEST_F(SigningOperationsTest, HmacAllDigests) { - for (auto digest : {Digest::SHA1, Digest::SHA_2_224, Digest::SHA_2_256, Digest::SHA_2_384, - Digest::SHA_2_512}) { + for (auto digest : ValidDigests(false /* withNone */, false /* withMD5 */)) { ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .HmacKey(128) @@ -1308,15 +1331,15 @@ TEST_F(VerificationOperationsTest, RsaSuccess) { * Verifies RSA signature/verification for all padding modes and digests. */ TEST_F(VerificationOperationsTest, RsaAllPaddingsAndDigests) { - ASSERT_EQ(ErrorCode::OK, - GenerateKey(AuthorizationSetBuilder() + auto authorizations = AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .RsaSigningKey(2048, 65537) - .Digest(Digest::NONE, Digest::MD5, Digest::SHA1, Digest::SHA_2_224, - Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512) + .Digest(ValidDigests(true /* withNone */, true /* withMD5 */)) .Padding(PaddingMode::NONE) .Padding(PaddingMode::RSA_PSS) - .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN))); + .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN); + + ASSERT_EQ(ErrorCode::OK, GenerateKey(authorizations)); string message(128, 'a'); string corrupt_message(message); @@ -1324,8 +1347,7 @@ TEST_F(VerificationOperationsTest, RsaAllPaddingsAndDigests) { for (auto padding : {PaddingMode::NONE, PaddingMode::RSA_PSS, PaddingMode::RSA_PKCS1_1_5_SIGN}) { - for (auto digest : {Digest::NONE, Digest::MD5, Digest::SHA1, Digest::SHA_2_224, - Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512}) { + for (auto digest : ValidDigests(true /* withNone */, true /* withMD5 */)) { if (padding == PaddingMode::NONE && digest != Digest::NONE) { // Digesting only makes sense with padding. continue; @@ -1403,14 +1425,11 @@ TEST_F(VerificationOperationsTest, RsaAllPaddingsAndDigests) { * Verifies ECDSA signature/verification for all digests and curves. */ TEST_F(VerificationOperationsTest, EcdsaAllDigestsAndCurves) { - auto digests = { - Digest::NONE, Digest::SHA1, Digest::SHA_2_224, - Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512, - }; + auto digests = ValidDigests(true /* withNone */, false /* withMD5 */); string message = "1234567890"; string corrupt_message = "2234567890"; - for (auto curve : {EcCurve::P_224, EcCurve::P_256, EcCurve::P_384, EcCurve::P_521}) { + for (auto curve : ValidCurves()) { ErrorCode error = GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .EcdsaSigningKey(curve) @@ -1722,6 +1741,7 @@ TEST_F(ImportKeyTest, EcdsaSuccess) { * Verifies that importing and using an ECDSA P-521 key pair works correctly. */ TEST_F(ImportKeyTest, Ecdsa521Success) { + if (SecLevel() == SecurityLevel::STRONGBOX) return; ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .EcdsaSigningKey(521) @@ -2054,8 +2074,7 @@ TEST_F(EncryptionOperationsTest, RsaNoPaddingTooLarge) { * Verifies that RSA-OAEP encryption operations work, with all digests. */ TEST_F(EncryptionOperationsTest, RsaOaepSuccess) { - auto digests = {Digest::MD5, Digest::SHA1, Digest::SHA_2_224, - Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512}; + auto digests = ValidDigests(false /* withNone */, true /* withMD5 */); size_t key_size = 2048; // Need largish key for SHA-512 test. ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() @@ -2232,7 +2251,7 @@ TEST_F(EncryptionOperationsTest, RsaPkcs1TooLarge) { TEST_F(EncryptionOperationsTest, EcdsaEncrypt) { ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) - .EcdsaSigningKey(224) + .EcdsaSigningKey(256) .Digest(Digest::NONE))); auto params = AuthorizationSetBuilder().Digest(Digest::NONE); ASSERT_EQ(ErrorCode::UNSUPPORTED_PURPOSE, Begin(KeyPurpose::ENCRYPT, params)); @@ -2487,7 +2506,9 @@ TEST_F(EncryptionOperationsTest, AesIncremental) { for (size_t i = 0; i < message.size(); i += increment) { to_send.append(message.substr(i, increment)); EXPECT_EQ(ErrorCode::OK, Update(to_send, &ciphertext, &input_consumed)); + EXPECT_EQ(to_send.length(), input_consumed); to_send = to_send.substr(input_consumed); + EXPECT_EQ(0U, to_send.length()); switch (block_mode) { case BlockMode::ECB: @@ -2803,6 +2824,8 @@ TEST_F(EncryptionOperationsTest, AesGcmRoundTripSuccess) { ASSERT_EQ(ErrorCode::OK, Finish(op_handle_, update_params, message, "", &update_out_params, &ciphertext)); + ASSERT_EQ(ciphertext.length(), message.length() + 16); + // Grab nonce begin_params.push_back(begin_out_params); @@ -2814,7 +2837,7 @@ TEST_F(EncryptionOperationsTest, AesGcmRoundTripSuccess) { &plaintext, &input_consumed)); EXPECT_EQ(ciphertext.size(), input_consumed); EXPECT_EQ(ErrorCode::OK, Finish("", &plaintext)); - + EXPECT_EQ(message.length(), plaintext.length()); EXPECT_EQ(message, plaintext); } @@ -3701,6 +3724,8 @@ typedef KeymasterHidlTest MaxOperationsTest; * Verifies that the max uses per boot tag works correctly with AES keys. */ TEST_F(MaxOperationsTest, TestLimitAes) { + if (SecLevel() == SecurityLevel::STRONGBOX) return; + ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .AesEncryptionKey(128) @@ -3726,6 +3751,8 @@ TEST_F(MaxOperationsTest, TestLimitAes) { * Verifies that the max uses per boot tag works correctly with RSA keys. */ TEST_F(MaxOperationsTest, TestLimitRsa) { + if (SecLevel() == SecurityLevel::STRONGBOX) return; + ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .RsaSigningKey(1024, 65537) From eb159af99494bd26a3c6d41b88614eb0b832ba04 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 18 Jun 2018 14:39:01 -0700 Subject: [PATCH 07/36] health: Update README to remove .override [DO NOT MERGE] The .override module does not have correct rc and sepolicy file_contexts configured, so let's allow OEMs to keep healthd. If an OEM does want to remove healthd they can provide a device-specific health service impl. Test: none Bug: 110228707 Change-Id: I9ba32ae366df4ba58994ef0e3f9eb57cab5626f7 --- health/2.0/README | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/health/2.0/README b/health/2.0/README index 11e6a7aaf1..dfd965aa5a 100644 --- a/health/2.0/README +++ b/health/2.0/README @@ -6,12 +6,7 @@ Upgrading from health@1.0 HAL 1. If the device does not have a vendor-specific libhealthd AND does not implement storage-related APIs, just do the following: - 1.1 (recommended) To remove healthd from the build, - PRODUCT_PACKAGES += android.hardware.health@2.0-service.override - DEVICE_FRAMEWORK_MANIFEST_FILE += \ - system/libhidl/vintfdata/manifest_healthd_exclude.xml - 1.2 To keep healthd in the build, - PRODUCT_PACKAGES += android.hardware.health@2.0-service + PRODUCT_PACKAGES += android.hardware.health@2.0-service Otherwise, continue to Step 2. From 76fa88e7a01a5a0cb3588710dae7e35b002de124 Mon Sep 17 00:00:00 2001 From: Carmen Jackson Date: Thu, 14 Jun 2018 14:53:14 -0700 Subject: [PATCH 08/36] Add hwcomposer to the system-background cpuset for hal v2.2 This change was made for hal v2.1 but not cross-ported to 2.2. Bug: 110167043 Test: $ adb shell ps -A | grep composer system 630 ... android.hardware.graphics.composer@2.2-service $ adb shell cat /proc/630/cpuset /system-background Change-Id: I40b8a0386a7cf67fe64b1e0e40d81b78891faaca --- .../default/android.hardware.graphics.composer@2.2-service.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc b/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc index a41d902cc9..efe6dadbc2 100644 --- a/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc +++ b/graphics/composer/2.2/default/android.hardware.graphics.composer@2.2-service.rc @@ -4,3 +4,4 @@ service vendor.hwcomposer-2-2 /vendor/bin/hw/android.hardware.graphics.composer@ group graphics drmrpc capabilities SYS_NICE onrestart restart surfaceflinger + writepid /dev/cpuset/system-background/tasks From 7470cbd04dbb90ec4a6481d08db54c6a8c5f2efd Mon Sep 17 00:00:00 2001 From: sqian Date: Fri, 15 Jun 2018 14:24:31 -0700 Subject: [PATCH 09/36] Add REQUEST_NOT_SUPPORTED for changeIccPinForApp and changeIccPin2ForApp Bug: 110037298 Test: run vts -m VtsHalRadioV1_0Target Change-Id: Iaba800814c5a6950d086a2f105714d01fdaa14a4 --- radio/1.0/vts/functional/radio_hidl_hal_icc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp index 67e51ea79a..fe2b0c4ad8 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp @@ -136,7 +136,9 @@ TEST_F(RadioHidlTest, changeIccPinForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); } } } @@ -159,7 +161,9 @@ TEST_F(RadioHidlTest, changeIccPin2ForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); } } } From 4f0d19ebff1f4a3eb565d8432f44b561ebd4abe2 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Thu, 14 Jun 2018 14:17:58 -0700 Subject: [PATCH 10/36] Set the floor value of time estimate as 2017 Jan 01 00:00:00 GMT - The VTS test checks if the time estimate is a sane value. Thus, any arbitrary sane value is acceptable. Here we make it consistent to IGnssDebug.hal, where a comment mentions 2017 Jan 1 as an example of the value. Bug: 110094003 Test: make vts, and tested on device. Merged-In: Ic4f6b597a718ea3e98a67c7939f9e6930d44d224 Change-Id: Ic4f6b597a718ea3e98a67c7939f9e6930d44d224 (cherry picked from commit 5fa43c83e90ccd0f852c89feb0e071aad195d7b2) --- gnss/1.1/vts/functional/gnss_hal_test_cases.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index cce46f18e1..eeb9d0322c 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -428,7 +428,7 @@ TEST_F(GnssHalTest, GnssDebugValuesSanityTest) { EXPECT_GE(data.position.ageSeconds, 0); } - EXPECT_GE(data.time.timeEstimate, 1514764800000); // Jan 01 2018 00:00:00 + EXPECT_GE(data.time.timeEstimate, 1483228800000); // Jan 01 2017 00:00:00 GMT. EXPECT_GT(data.time.timeUncertaintyNs, 0); From a1c4e0ec5deaf3c6c4e8694afd67eb5a24bd0fa5 Mon Sep 17 00:00:00 2001 From: Janis Danisevskis Date: Tue, 19 Jun 2018 19:08:15 -0700 Subject: [PATCH 11/36] Relax HMAC computation check This KM4 key agreement check is causing some pain on early units that aren't completely provisioned in both locked and non-Green (unlocked) states. This doesn't impact KM3 devices (Pixel 2016/2017 etc.) Bug: 110301629 Change-Id: I5a737ac8a335863b1099c29cf3c0496adeb41e15 --- keymaster/4.0/support/Keymaster.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keymaster/4.0/support/Keymaster.cpp b/keymaster/4.0/support/Keymaster.cpp index 444298b5bb..9325cc0699 100644 --- a/keymaster/4.0/support/Keymaster.cpp +++ b/keymaster/4.0/support/Keymaster.cpp @@ -164,10 +164,10 @@ static void computeHmac(const Keymaster::KeymasterSet& keymasters, sharingCheck = curSharingCheck; firstKeymaster = false; } - CHECK(curSharingCheck == sharingCheck) - << "HMAC computation failed for " << *keymaster // - << " Expected: " << sharingCheck // - << " got: " << curSharingCheck; + if (curSharingCheck != sharingCheck) + LOG(WARNING) << "HMAC computation failed for " << *keymaster // + << " Expected: " << sharingCheck // + << " got: " << curSharingCheck; }); CHECK(rc.isOk()) << "Failed to communicate with " << *keymaster << " error: " << rc.description(); From a7587b5a7fdace0d193ad333e6f5cda8b995570b Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Fri, 15 Jun 2018 11:16:28 -0700 Subject: [PATCH 12/36] Allow REQUEST_NOT_SUPPORTED as an error for startNetworkScan We are trying to tighten the APIs. However for this case since the documentation was not updated, we are allowing NOT_SUPPORTED for now and will be cleaned up in a later release. Test: run vts -m VtsHalRadioV1_2Target Bug: 110118713 Change-Id: Id9dd3d7bac99bed36ceb9c906189f1fea78d5a2c --- .../1.2/vts/functional/radio_hidl_hal_api.cpp | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index 9284fd8fae..03911da6e6 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -43,7 +43,13 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan) { if (cardStatus.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::SIM_ABSENT})); } else if (cardStatus.base.cardState == CardState::PRESENT) { - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + // REQUEST_NOT_SUPPORTED should not be allowed as it is not an optional API. However, the + // comments in the hal were not updated to indicate that, hence allowing it as a valid + // error for now. This should be fixed correctly, possibly in a future version of the hal + // (b/110421924). This is being allowed because some vendors do not support + // this request on dual sim devices. + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -69,7 +75,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -105,7 +112,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -141,7 +149,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -177,7 +186,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -213,7 +223,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -249,7 +260,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -285,7 +297,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) { {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE( - CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -320,7 +333,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE, RadioError::SIM_ABSENT})); } else if (cardStatus.base.cardState == CardState::PRESENT) { - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -356,7 +370,8 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE, RadioError::SIM_ABSENT})); } else if (cardStatus.base.cardState == CardState::PRESENT) { - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } } From ae8da1b70ad563edb79f4f7429b704b54c1a9e19 Mon Sep 17 00:00:00 2001 From: Eran Messeri Date: Tue, 19 Jun 2018 17:12:04 +0100 Subject: [PATCH 13/36] Fixing Keymaster documentation. Keymaster HAL documentation documents the bootPatchLevel as having tag 718, while types.hal indicates the tag value for it is actually 719. Test: N/A Bug: 78104779 Change-Id: I0dde0b3c863081f2594e20466d8e82866a5f2d2e --- current.txt | 2 +- keymaster/4.0/IKeymasterDevice.hal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/current.txt b/current.txt index cc15322b83..c4d3463298 100644 --- a/current.txt +++ b/current.txt @@ -335,7 +335,7 @@ dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardwar 675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth 434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback c9e498f1ade5e26f00d290b4763a9671ec6720f915e7d592844b62e8cb1f9b5c android.hardware.health@2.0::types -201f9723353fdbd40bf3705537fb7e015e4c399879425e68688fe0f43606ea4d android.hardware.keymaster@4.0::IKeymasterDevice +6122abe9bc2e7868463d3787db2991c1e47cc01fe3e4cfb7293c5ba421ff8ad9 android.hardware.keymaster@4.0::IKeymasterDevice 1b7d2090c0a28b229d37c4b96160796b1f0d703950ac6ccc163fccd280830503 android.hardware.keymaster@4.0::types 6d5c646a83538f0f9d8438c259932509f4353410c6c76e56db0d6ca98b69c3bb android.hardware.media.bufferpool@1.0::IAccessor b8c7ed58aa8740361e63d0ce9e7c94227572a629f356958840b34809d2393a7c android.hardware.media.bufferpool@1.0::IClientManager diff --git a/keymaster/4.0/IKeymasterDevice.hal b/keymaster/4.0/IKeymasterDevice.hal index 74d13d8b0d..85a25c6d32 100644 --- a/keymaster/4.0/IKeymasterDevice.hal +++ b/keymaster/4.0/IKeymasterDevice.hal @@ -753,7 +753,7 @@ interface IKeymasterDevice { * attestationIdManufacturer [716] EXPLICIT OCTET_STRING OPTIONAL, * attestationIdModel [717] EXPLICIT OCTET_STRING OPTIONAL, * vendorPatchLevel [718] EXPLICIT INTEGER OPTIONAL, - * bootPatchLevel [718] EXPLICIT INTEGER OPTIONAL, + * bootPatchLevel [719] EXPLICIT INTEGER OPTIONAL, * } * * The above schema is mostly a straightforward translation of the IKeymasterDevice tag/value From 07eabef427ce8851f91a24ff29a4ab98e18ceff2 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 21 Jun 2018 02:42:31 +0100 Subject: [PATCH 14/36] Update power HAL to version 1.3. Adds new EXPENSIVE_RENDERING power hint. This adds a new library which does not affect any pre-existing targets unless they create and add a new binary which uses this. BUG: 110112323 Test: adb shell /data/nativetest/VtsHalPowerV1_3TargetTest/VtsHalPowerV1_3TargetTest Change-Id: I5fb33abbbe4c4958882a106dfa400ad74013e40d --- .../compatibility_matrix.3.xml | 2 +- current.txt | 2 + power/1.3/Android.bp | 21 ++++++ power/1.3/IPower.hal | 33 ++++++++++ power/1.3/types.hal | 28 ++++++++ power/1.3/vts/functional/Android.bp | 27 ++++++++ .../functional/VtsHalPowerV1_3TargetTest.cpp | 64 +++++++++++++++++++ 7 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 power/1.3/Android.bp create mode 100644 power/1.3/IPower.hal create mode 100644 power/1.3/types.hal create mode 100644 power/1.3/vts/functional/Android.bp create mode 100644 power/1.3/vts/functional/VtsHalPowerV1_3TargetTest.cpp diff --git a/compatibility_matrices/compatibility_matrix.3.xml b/compatibility_matrices/compatibility_matrix.3.xml index f271642fd1..9c6b12ad15 100644 --- a/compatibility_matrices/compatibility_matrix.3.xml +++ b/compatibility_matrices/compatibility_matrix.3.xml @@ -290,7 +290,7 @@ android.hardware.power - 1.0-2 + 1.0-3 IPower default diff --git a/current.txt b/current.txt index cc15322b83..8a45ca579b 100644 --- a/current.txt +++ b/current.txt @@ -348,6 +348,8 @@ e85f566698d2a2c28100e264fcf2c691a066756ddf8dd341d009ff50cfe10614 android.hardwar 5e278fcaa3287d397d8eebe1c22aaa28150f5caae1cf9381cd6dc32cb37899c5 android.hardware.nfc@1.1::types 163e115e833fc1d77cdd4a8cf0c833bb8b8d74fe35c880fe693101d17774926f android.hardware.power@1.2::IPower 7899b9305587b2d5cd74a3cc87e9090f58bf4ae74256ce3ee36e7ec011822840 android.hardware.power@1.2::types +5a464e6db53fad223986d655028a18185b73db8e2bfa9663f9042c9623eb0aa0 android.hardware.power@1.3::IPower +a54a28d39b892d27a3cb06829181c038edcdd9e8eef359543b01e4313ae59aa0 android.hardware.power@1.3::types ab132c990a62f0aca35871c092c22fb9c85d478e22124ef6a4d0a2302da76a9f android.hardware.radio@1.2::IRadio cda752aeabaabc20486a82ac57a3dd107785c006094a349bc5e224e8aa22a17c android.hardware.radio@1.2::IRadioIndication da8c6ae991c6a4b284cc6e445332e064e28ee8a09482ed5afff9d159ec6694b7 android.hardware.radio@1.2::IRadioResponse diff --git a/power/1.3/Android.bp b/power/1.3/Android.bp new file mode 100644 index 0000000000..65b75977f1 --- /dev/null +++ b/power/1.3/Android.bp @@ -0,0 +1,21 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.power@1.3", + root: "android.hardware", + srcs: [ + "types.hal", + "IPower.hal", + ], + interfaces: [ + "android.hardware.power@1.0", + "android.hardware.power@1.1", + "android.hardware.power@1.2", + "android.hidl.base@1.0", + ], + types: [ + "PowerHint", + ], + gen_java: true, +} + diff --git a/power/1.3/IPower.hal b/power/1.3/IPower.hal new file mode 100644 index 0000000000..18b00a30c7 --- /dev/null +++ b/power/1.3/IPower.hal @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hardware.power@1.3; + +import @1.2::IPower; + +interface IPower extends @1.2::IPower { + /** + * Called to pass hints on power requirements which + * may result in adjustment of power/performance parameters of the + * cpufreq governor and other controls. + * + * A particular platform may choose to ignore any hint. + * + * @param hint PowerHint which is passed + * @param data contains additional information about the hint + * and is described along with the comments for each of the hints. + */ + oneway powerHintAsync_1_3(PowerHint hint, int32_t data); +}; diff --git a/power/1.3/types.hal b/power/1.3/types.hal new file mode 100644 index 0000000000..658495cf63 --- /dev/null +++ b/power/1.3/types.hal @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hardware.power@1.3; + +import @1.2::PowerHint; + +/** Power hint identifiers passed to powerHintAsync_1_3() */ +enum PowerHint : @1.2::PowerHint { + /** + * This hint indicates that the device is about to enter a period of expensive rendering, and + * the GPU should be configured accordingly. The data parameter is always 1 when entering this + * state and 0 when leaving it. + */ + EXPENSIVE_RENDERING, +}; diff --git a/power/1.3/vts/functional/Android.bp b/power/1.3/vts/functional/Android.bp new file mode 100644 index 0000000000..34cdb60794 --- /dev/null +++ b/power/1.3/vts/functional/Android.bp @@ -0,0 +1,27 @@ +// +// Copyright (C) 2018 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_test { + name: "VtsHalPowerV1_3TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: ["VtsHalPowerV1_3TargetTest.cpp"], + static_libs: [ + "android.hardware.power@1.0", + "android.hardware.power@1.1", + "android.hardware.power@1.2", + "android.hardware.power@1.3", + ], +} diff --git a/power/1.3/vts/functional/VtsHalPowerV1_3TargetTest.cpp b/power/1.3/vts/functional/VtsHalPowerV1_3TargetTest.cpp new file mode 100644 index 0000000000..af1a1d86ab --- /dev/null +++ b/power/1.3/vts/functional/VtsHalPowerV1_3TargetTest.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "power_hidl_hal_test" +#include +#include + +#include +#include + +using ::android::sp; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::power::V1_3::IPower; +using ::android::hardware::power::V1_3::PowerHint; + +// Test environment for Power HIDL HAL. +class PowerHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { + public: + // get the test environment singleton + static PowerHidlEnvironment* Instance() { + static PowerHidlEnvironment* instance = new PowerHidlEnvironment; + return instance; + } + + virtual void registerTestServices() override { registerTestService(); } +}; + +class PowerHidlTest : public ::testing::VtsHalHidlTargetTestBase { + public: + virtual void SetUp() override { + power = ::testing::VtsHalHidlTargetTestBase::getService( + PowerHidlEnvironment::Instance()->getServiceName()); + ASSERT_NE(power, nullptr); + } + + sp power; +}; + +TEST_F(PowerHidlTest, PowerHintAsync_1_3) { + ASSERT_TRUE(power->powerHintAsync_1_3(PowerHint::EXPENSIVE_RENDERING, 0).isOk()); +} + +int main(int argc, char** argv) { + ::testing::AddGlobalTestEnvironment(PowerHidlEnvironment::Instance()); + ::testing::InitGoogleTest(&argc, argv); + PowerHidlEnvironment::Instance()->init(&argc, argv); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + return status; +} From 431eb118f84de14c94ec18f887197944ec17e712 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 22 Jun 2018 13:31:09 -0700 Subject: [PATCH 15/36] Fixed VTS failure in no SIM case Added RadioError::NONE as a possible return value for data call setup API. The data call could be setup for emergency purposes when no SIM inserted. Test: VTS Bug: 109767888 Change-Id: I4469c371f999b99d35f4078df000f05ee1f3c84d --- radio/1.2/vts/functional/radio_hidl_hal_api.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index 9284fd8fae..11a73c35e8 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -621,8 +621,9 @@ TEST_F(RadioHidlTest_v1_2, setupDataCall_1_2) { if (cardStatus.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_2->rspInfo.error, - {RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_ARGUMENTS, - RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW, RadioError::REQUEST_NOT_SUPPORTED})); + {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE, + RadioError::INVALID_ARGUMENTS, RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW, + RadioError::REQUEST_NOT_SUPPORTED})); } else if (cardStatus.base.cardState == CardState::PRESENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_2->rspInfo.error, From d898d0a4223df75225cfdf23e6f184166933cdb3 Mon Sep 17 00:00:00 2001 From: Shawn Willden Date: Tue, 19 Jun 2018 22:10:03 -0600 Subject: [PATCH 16/36] Fix attestation test. Bug: 77588764 Test: VtsHalKeymasterV4_0TargetTest Change-Id: Ibe264d08ae7b3333a6949761a92759f5305b3fcb --- keymaster/4.0/support/attestation_record.cpp | 29 ++++++++++-- .../include/keymasterV4_0/key_param_output.h | 4 ++ .../include/keymasterV4_0/keymaster_tags.h | 6 ++- .../vts/functional/VerificationTokenTest.cpp | 5 ++- .../functional/keymaster_hidl_hal_test.cpp | 45 +++++++++---------- 5 files changed, 58 insertions(+), 31 deletions(-) diff --git a/keymaster/4.0/support/attestation_record.cpp b/keymaster/4.0/support/attestation_record.cpp index 8f37d9c86f..6de0c1c629 100644 --- a/keymaster/4.0/support/attestation_record.cpp +++ b/keymaster/4.0/support/attestation_record.cpp @@ -49,12 +49,14 @@ typedef struct km_root_of_trust { ASN1_OCTET_STRING* verified_boot_key; ASN1_BOOLEAN* device_locked; ASN1_ENUMERATED* verified_boot_state; + ASN1_OCTET_STRING* verified_boot_hash; } KM_ROOT_OF_TRUST; ASN1_SEQUENCE(KM_ROOT_OF_TRUST) = { ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_key, ASN1_OCTET_STRING), ASN1_SIMPLE(KM_ROOT_OF_TRUST, device_locked, ASN1_BOOLEAN), ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_state, ASN1_ENUMERATED), + ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_hash, ASN1_OCTET_STRING), } ASN1_SEQUENCE_END(KM_ROOT_OF_TRUST); IMPLEMENT_ASN1_FUNCTIONS(KM_ROOT_OF_TRUST); @@ -77,11 +79,16 @@ typedef struct km_auth_list { ASN1_OCTET_STRING* application_id; ASN1_INTEGER* creation_date_time; ASN1_INTEGER* origin; - ASN1_NULL* rollback_resistant; + ASN1_NULL* rollback_resistance; KM_ROOT_OF_TRUST* root_of_trust; ASN1_INTEGER* os_version; ASN1_INTEGER* os_patchlevel; ASN1_OCTET_STRING* attestation_application_id; + ASN1_NULL* trusted_user_presence_required; + ASN1_NULL* trusted_confirmation_required; + ASN1_NULL* unlocked_device_required; + ASN1_INTEGER* vendor_patchlevel; + ASN1_INTEGER* boot_patchlevel; } KM_AUTH_LIST; ASN1_SEQUENCE(KM_AUTH_LIST) = { @@ -93,6 +100,7 @@ ASN1_SEQUENCE(KM_AUTH_LIST) = { ASN1_EXP_OPT(KM_AUTH_LIST, ec_curve, ASN1_INTEGER, TAG_EC_CURVE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, rsa_public_exponent, ASN1_INTEGER, TAG_RSA_PUBLIC_EXPONENT.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, rollback_resistance, ASN1_NULL, TAG_ROLLBACK_RESISTANCE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, active_date_time, ASN1_INTEGER, TAG_ACTIVE_DATETIME.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, origination_expire_date_time, ASN1_INTEGER, TAG_ORIGINATION_EXPIRE_DATETIME.maskedTag()), @@ -102,13 +110,19 @@ ASN1_SEQUENCE(KM_AUTH_LIST) = { ASN1_EXP_OPT(KM_AUTH_LIST, user_auth_type, ASN1_INTEGER, TAG_USER_AUTH_TYPE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, auth_timeout, ASN1_INTEGER, TAG_AUTH_TIMEOUT.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, allow_while_on_body, ASN1_NULL, TAG_ALLOW_WHILE_ON_BODY.maskedTag()), - ASN1_EXP_OPT(KM_AUTH_LIST, application_id, ASN1_OCTET_STRING, TAG_APPLICATION_ID.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, trusted_user_presence_required, ASN1_NULL, + TAG_TRUSTED_USER_PRESENCE_REQUIRED.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, trusted_confirmation_required, ASN1_NULL, + TAG_TRUSTED_CONFIRMATION_REQUIRED.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, unlocked_device_required, ASN1_NULL, + TAG_UNLOCKED_DEVICE_REQUIRED.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, creation_date_time, ASN1_INTEGER, TAG_CREATION_DATETIME.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, origin, ASN1_INTEGER, TAG_ORIGIN.maskedTag()), - ASN1_EXP_OPT(KM_AUTH_LIST, rollback_resistant, ASN1_NULL, TAG_ROLLBACK_RESISTANCE.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, root_of_trust, KM_ROOT_OF_TRUST, TAG_ROOT_OF_TRUST.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, os_version, ASN1_INTEGER, TAG_OS_VERSION.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, os_patchlevel, ASN1_INTEGER, TAG_OS_PATCHLEVEL.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, vendor_patchlevel, ASN1_INTEGER, TAG_VENDOR_PATCHLEVEL.maskedTag()), + ASN1_EXP_OPT(KM_AUTH_LIST, boot_patchlevel, ASN1_INTEGER, TAG_BOOT_PATCHLEVEL.maskedTag()), ASN1_EXP_OPT(KM_AUTH_LIST, attestation_application_id, ASN1_OCTET_STRING, TAG_ATTESTATION_APPLICATION_ID.maskedTag()), } ASN1_SEQUENCE_END(KM_AUTH_LIST); @@ -237,11 +251,18 @@ static ErrorCode extract_auth_list(const KM_AUTH_LIST* record, AuthorizationSet* copyAuthTag(record->os_version, TAG_OS_VERSION, auth_list); copyAuthTag(record->padding, TAG_PADDING, auth_list); copyAuthTag(record->purpose, TAG_PURPOSE, auth_list); - copyAuthTag(record->rollback_resistant, TAG_ROLLBACK_RESISTANCE, auth_list); + copyAuthTag(record->rollback_resistance, TAG_ROLLBACK_RESISTANCE, auth_list); copyAuthTag(record->rsa_public_exponent, TAG_RSA_PUBLIC_EXPONENT, auth_list); copyAuthTag(record->usage_expire_date_time, TAG_USAGE_EXPIRE_DATETIME, auth_list); copyAuthTag(record->user_auth_type, TAG_USER_AUTH_TYPE, auth_list); copyAuthTag(record->attestation_application_id, TAG_ATTESTATION_APPLICATION_ID, auth_list); + copyAuthTag(record->vendor_patchlevel, TAG_VENDOR_PATCHLEVEL, auth_list); + copyAuthTag(record->boot_patchlevel, TAG_BOOT_PATCHLEVEL, auth_list); + copyAuthTag(record->trusted_user_presence_required, TAG_TRUSTED_USER_PRESENCE_REQUIRED, + auth_list); + copyAuthTag(record->trusted_confirmation_required, TAG_TRUSTED_CONFIRMATION_REQUIRED, + auth_list); + copyAuthTag(record->unlocked_device_required, TAG_UNLOCKED_DEVICE_REQUIRED, auth_list); return ErrorCode::OK; } diff --git a/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h b/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h index 74be343602..6e2b691c37 100644 --- a/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h +++ b/keymaster/4.0/support/include/keymasterV4_0/key_param_output.h @@ -53,6 +53,10 @@ inline ::std::ostream& operator<<(::std::ostream& os, PaddingMode value) { return os << toString(value); } +inline ::std::ostream& operator<<(::std::ostream& os, SecurityLevel value) { + return os << toString(value); +} + template ::std::ostream& operator<<(::std::ostream& os, const NullOr& value) { if (!value.isOk()) { diff --git a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h index ce213bc127..9e7d252226 100644 --- a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h +++ b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h @@ -116,6 +116,7 @@ DECLARE_TYPED_TAG(AUTH_TIMEOUT); DECLARE_TYPED_TAG(BLOB_USAGE_REQUIREMENTS); DECLARE_TYPED_TAG(BLOCK_MODE); DECLARE_TYPED_TAG(BOOTLOADER_ONLY); +DECLARE_TYPED_TAG(BOOT_PATCHLEVEL); DECLARE_TYPED_TAG(CALLER_NONCE); DECLARE_TYPED_TAG(CONFIRMATION_TOKEN); DECLARE_TYPED_TAG(CREATION_DATETIME); @@ -141,12 +142,14 @@ DECLARE_TYPED_TAG(ROLLBACK_RESISTANCE); DECLARE_TYPED_TAG(ROOT_OF_TRUST); DECLARE_TYPED_TAG(RSA_PUBLIC_EXPONENT); DECLARE_TYPED_TAG(TRUSTED_CONFIRMATION_REQUIRED); +DECLARE_TYPED_TAG(TRUSTED_USER_PRESENCE_REQUIRED); DECLARE_TYPED_TAG(UNIQUE_ID); DECLARE_TYPED_TAG(UNLOCKED_DEVICE_REQUIRED); DECLARE_TYPED_TAG(USAGE_EXPIRE_DATETIME); DECLARE_TYPED_TAG(USER_AUTH_TYPE); DECLARE_TYPED_TAG(USER_ID); DECLARE_TYPED_TAG(USER_SECURE_ID); +DECLARE_TYPED_TAG(VENDOR_PATCHLEVEL); template struct MetaList {}; @@ -163,7 +166,8 @@ using all_tags_t = TAG_OS_VERSION_t, TAG_OS_PATCHLEVEL_t, TAG_UNIQUE_ID_t, TAG_ATTESTATION_CHALLENGE_t, TAG_ATTESTATION_APPLICATION_ID_t, TAG_RESET_SINCE_ID_ROTATION_t, TAG_PURPOSE_t, TAG_ALGORITHM_t, TAG_BLOCK_MODE_t, TAG_DIGEST_t, TAG_PADDING_t, - TAG_BLOB_USAGE_REQUIREMENTS_t, TAG_ORIGIN_t, TAG_USER_AUTH_TYPE_t, TAG_EC_CURVE_t>; + TAG_BLOB_USAGE_REQUIREMENTS_t, TAG_ORIGIN_t, TAG_USER_AUTH_TYPE_t, TAG_EC_CURVE_t, + TAG_BOOT_PATCHLEVEL_t, TAG_VENDOR_PATCHLEVEL_t, TAG_TRUSTED_USER_PRESENCE_REQUIRED_t>; template struct TypedTag2ValueType; diff --git a/keymaster/4.0/vts/functional/VerificationTokenTest.cpp b/keymaster/4.0/vts/functional/VerificationTokenTest.cpp index 6afba0c4c3..3876b16f3c 100644 --- a/keymaster/4.0/vts/functional/VerificationTokenTest.cpp +++ b/keymaster/4.0/vts/functional/VerificationTokenTest.cpp @@ -111,8 +111,9 @@ TEST_F(VerificationTokenTest, TestCreation) { EXPECT_GE(host_time_delta, time_to_sleep) << "We slept for " << time_to_sleep << " ms, the clock must have advanced by that much"; - EXPECT_LE(host_time_delta, time_to_sleep + 10) - << "The verifyAuthorization call took more than 10 ms? That's awful!"; + EXPECT_LE(host_time_delta, time_to_sleep + 20) + << "The verifyAuthorization call took " << (host_time_delta - time_to_sleep) + << " ms? That's awful!"; auto km_time_delta = result2.token.timestamp - result1.token.timestamp; diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index 450b3eb4e5..c327d9f8c3 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -182,7 +182,7 @@ X509* parse_cert_blob(const hidl_vec& blob) { } bool verify_chain(const hidl_vec>& chain) { - for (size_t i = 0; i < chain.size() - 1; ++i) { + for (size_t i = 0; i < chain.size(); ++i) { X509_Ptr key_cert(parse_cert_blob(chain[i])); X509_Ptr signing_cert; if (i < chain.size() - 1) { @@ -246,8 +246,7 @@ bool tag_in_list(const KeyParameter& entry) { // Attestations don't contain everything in key authorization lists, so we need to filter // the key lists to produce the lists that we expect to match the attestations. auto tag_list = { - Tag::INCLUDE_UNIQUE_ID, Tag::BLOB_USAGE_REQUIREMENTS, - Tag::EC_CURVE /* Tag::EC_CURVE will be included by KM2 implementations */, + Tag::INCLUDE_UNIQUE_ID, Tag::BLOB_USAGE_REQUIREMENTS, Tag::EC_CURVE, Tag::HARDWARE_TYPE, }; return std::find(tag_list.begin(), tag_list.end(), entry.tag) != tag_list.end(); } @@ -271,7 +270,7 @@ std::string make_string(const uint8_t (&a)[N]) { bool verify_attestation_record(const string& challenge, const string& app_id, AuthorizationSet expected_sw_enforced, - AuthorizationSet expected_tee_enforced, + AuthorizationSet expected_tee_enforced, SecurityLevel security_level, const hidl_vec& attestation_cert) { X509_Ptr cert(parse_cert_blob(attestation_cert)); EXPECT_TRUE(!!cert.get()); @@ -290,29 +289,27 @@ bool verify_attestation_record(const string& challenge, const string& app_id, HidlBuf att_challenge; HidlBuf att_unique_id; HidlBuf att_app_id; - EXPECT_EQ(ErrorCode::OK, - parse_attestation_record(attest_rec->data, // - attest_rec->length, // - &att_attestation_version, // - &att_attestation_security_level, // - &att_keymaster_version, // - &att_keymaster_security_level, // - &att_challenge, // - &att_sw_enforced, // - &att_tee_enforced, // - &att_unique_id)); - EXPECT_TRUE(att_attestation_version == 1 || att_attestation_version == 2); + auto error = parse_attestation_record(attest_rec->data, // + attest_rec->length, // + &att_attestation_version, // + &att_attestation_security_level, // + &att_keymaster_version, // + &att_keymaster_security_level, // + &att_challenge, // + &att_sw_enforced, // + &att_tee_enforced, // + &att_unique_id); + EXPECT_EQ(ErrorCode::OK, error); + if (error != ErrorCode::OK) return false; + + EXPECT_TRUE(att_attestation_version == 3); expected_sw_enforced.push_back(TAG_ATTESTATION_APPLICATION_ID, HidlBuf(app_id)); EXPECT_GE(att_keymaster_version, 3U); - EXPECT_EQ(KeymasterHidlTest::IsSecure() ? SecurityLevel::TRUSTED_ENVIRONMENT - : SecurityLevel::SOFTWARE, - att_keymaster_security_level); - EXPECT_EQ(KeymasterHidlTest::IsSecure() ? SecurityLevel::TRUSTED_ENVIRONMENT - : SecurityLevel::SOFTWARE, - att_attestation_security_level); + EXPECT_EQ(security_level, att_keymaster_security_level); + EXPECT_EQ(security_level, att_attestation_security_level); EXPECT_EQ(challenge.length(), att_challenge.size()); EXPECT_EQ(0, memcmp(challenge.data(), att_challenge.data(), challenge.length())); @@ -3827,7 +3824,7 @@ TEST_F(AttestationTest, RsaAttestation) { EXPECT_TRUE(verify_attestation_record("challenge", "foo", // key_characteristics_.softwareEnforced, // key_characteristics_.hardwareEnforced, // - cert_chain[0])); + SecLevel(), cert_chain[0])); } /* @@ -3874,7 +3871,7 @@ TEST_F(AttestationTest, EcAttestation) { EXPECT_TRUE(verify_attestation_record("challenge", "foo", // key_characteristics_.softwareEnforced, // key_characteristics_.hardwareEnforced, // - cert_chain[0])); + SecLevel(), cert_chain[0])); } /* From 529d2fffa02451406f013b354fd7c07164f619b1 Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Thu, 21 Jun 2018 11:46:42 -0700 Subject: [PATCH 17/36] Add docs for setSignalStrengthReportingCriteria Because setSignalStrengthReportingCriteria only supports a single measurement quantity, provide further clarification on the applicability of the API and how it may be used in various situations. Bug: 110121199 Test: compilation - docstring-only change Merged-In: If4236070fbc03368e5a78b0cf502cdc4a529a6ed Change-Id: If4236070fbc03368e5a78b0cf502cdc4a529a6ed --- current.txt | 3 +++ radio/1.2/IRadio.hal | 23 +++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/current.txt b/current.txt index cc15322b83..918039c3fa 100644 --- a/current.txt +++ b/current.txt @@ -380,3 +380,6 @@ e362203b941f18bd4cba29a62adfa02453ed00d6be5b72cdb6c4d7e0bf394a40 android.hardwar 21757d0e5dd4b7e4bd981a4a20531bca3c32271ad9777b17b74eb5a1ea508384 android.hardware.wifi.supplicant@1.1::ISupplicantStaIface cd4330c3196bda1d642a32abfe23a7d64ebfbda721940643af6867af3b3f0aa9 android.hardware.wifi.supplicant@1.1::ISupplicantStaIfaceCallback 10ff2fae516346b86121368ce5790d5accdfcb73983246b813f3d488b66db45a android.hardware.wifi.supplicant@1.1::ISupplicantStaNetwork + +# ABI preserving changes to HALs after Android P +1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal index 6463b0fcc0..87b0add5da 100644 --- a/radio/1.2/IRadio.hal +++ b/radio/1.2/IRadio.hal @@ -59,19 +59,30 @@ interface IRadio extends @1.1::IRadio { /** * Sets the signal strength reporting criteria. * - * The resulting reporting criteria are the AND of all the supplied criteria. + * The resulting reporting rules are the AND of all the supplied criteria. For each RAN + * The thresholdsDbm and hysteresisDb apply to only the following measured quantities: + * -GERAN - RSSI + * -CDMA2000 - RSSI + * -UTRAN - RSCP + * -EUTRAN - RSRP * - * Note: Reporting criteria must be individually set for each RAN. If unset, reporting criteria - * for that RAN are implementation-defined. + * Note: Reporting criteria must be individually set for each RAN. For any unset reporting + * criteria, the value is implementation-defined. * - * Response callback is IRadioResponse.setSignalStrengthReportingCriteriaResponse(). + * Note: As this mechanism generally only constrains reports based on one measured quantity per + * RAN, if multiple measured quantities must be used to trigger a report for a given RAN, the + * only valid field may be hysteresisMs: hysteresisDb and thresholdsDbm must be set to zero and + * length zero respectively. If either hysteresisDb or thresholdsDbm is set, then reports shall + * only be triggered by the respective measured quantity, subject to the applied constraints. + * + * Response callback is IRadioResponse.setSignalStrengthReportingCriteriaResponse() * * @param serial Serial number of request. * @param hysteresisMs A hysteresis time in milliseconds to prevent flapping. A value of 0 * disables hysteresis. * @param hysteresisDb An interval in dB defining the required magnitude change between reports. - * hysteresisDb must be smaller than the smallest threshold delta. An - * interval value of 0 disables hysteresis. + * hysteresisDb must be smaller than the smallest threshold delta. An interval value of 0 + * disables hysteresis. * @param thresholdsDbm A vector of trigger thresholds in dBm. A vector size of 0 disables the * use of thresholds for reporting. * @param accessNetwork The type of network for which to apply these thresholds. From c7896501db413c9a0fa44d2697da4079610075d8 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Mon, 25 Jun 2018 14:16:37 -0700 Subject: [PATCH 18/36] Allow NOT_SUPPORTED for setLinkCapacityReportingCriteria on GERAN. Test: run vts -m VtsHalRadioV1_2Target Bug: 110716988 Change-Id: I9a5f014d498db00d818870cbd73e119f66562ef1 --- .../1.2/vts/functional/radio_hidl_hal_api.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index 9284fd8fae..41a5e9d987 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -510,7 +510,11 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlK ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisDlKbps, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } /* @@ -531,7 +535,11 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlK ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisUlKbps, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } /* @@ -549,7 +557,10 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) { ALOGI("setLinkCapacityReportingCriteria_emptyParams, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } /* @@ -568,7 +579,10 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) { ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisUlKbps, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::NONE})); + // Allow REQUEST_NOT_SUPPORTED as setLinkCapacityReportingCriteria() may not be supported for + // GERAN + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } /* From 0fdd7cdc0eab249e0f0615fad1034231c09987dd Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Tue, 26 Jun 2018 09:17:33 +0100 Subject: [PATCH 19/36] Camera: Allow 3% ISO tolerance during ISO burst VTS The advertised ISO ranges may not be entirely supported on some devices. Expect a 3% tolerance when comparing the applied results versus the expected ISO value. Bug: 80025874 Test: run vts --skip-all-system-status-check --skip-preconditions --primary-abi-only --module VtsHalCameraProviderV2_4Target -l INFO Change-Id: Ibd2758e48a0924e81877e35dd27433669274fdb3 --- .../2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 95c7167c3b..f8022ae9e9 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -3643,6 +3643,7 @@ TEST_F(CameraHidlTest, processCaptureRequestBurstISO) { static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; uint64_t bufferId = 1; uint32_t frameNumber = 1; + float isoTol = .03f; ::android::hardware::hidl_vec settings; for (const auto& name : cameraDeviceNames) { @@ -3772,7 +3773,8 @@ TEST_F(CameraHidlTest, processCaptureRequestBurstISO) { ASSERT_TRUE(inflightReqs[i].collectedResult.exists(ANDROID_SENSOR_SENSITIVITY)); camera_metadata_entry_t isoResult = inflightReqs[i].collectedResult.find( ANDROID_SENSOR_SENSITIVITY); - ASSERT_TRUE(isoResult.data.i32[0] == isoValues[i]); + ASSERT_TRUE(std::abs(isoResult.data.i32[0] - isoValues[i]) <= + std::round(isoValues[i]*isoTol)); } ret = session->close(); From 6c9c6e62c193461ed0de4666d0995631ba39e009 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 21 Jun 2018 14:10:58 -0700 Subject: [PATCH 20/36] Allow getCapturePosition to return 0 frames for unprepared streams For device supporting getCapturePosition, VTS only allowed unprepared stream to return INVALID_STATE. Now also allow for the stream to return 0 frames similarly to the other non started states. Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target Bug: 110367728 Cherry-piked from: d01dc3edac9e92981e7ae419d0e7622f753acf94 Change-Id: Ibdf8df8cb8809e98c40a50035371df6893fe4da4 Signed-off-by: Kevin Rocard --- .../4.0/vts/functional/AudioPrimaryHidlHalTest.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp index c764ea625e..4aeefa65d3 100644 --- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp @@ -106,7 +106,10 @@ using namespace ::android::hardware::audio::common::test::utility; static auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED}; static auto okOrNotSupportedOrInvalidArgs = {Result::OK, Result::NOT_SUPPORTED, Result::INVALID_ARGUMENTS}; +static auto okOrInvalidStateOrNotSupported = {Result::OK, Result::INVALID_STATE, + Result::NOT_SUPPORTED}; static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED}; +static auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED}; class AudioHidlTestEnvironment : public ::Environment { public: @@ -949,8 +952,6 @@ TEST_IO_STREAM(RemoveNonExistingEffect, "Removing a non existing effect should f TEST_IO_STREAM(standby, "Make sure the stream can be put in stanby", ASSERT_OK(stream->standby())) // can not fail -static constexpr auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED}; - TEST_IO_STREAM(startNoMmap, "Starting a mmaped stream before mapping it should fail", ASSERT_RESULT(invalidStateOrNotSupported, stream->start())) @@ -1070,11 +1071,15 @@ TEST_P(InputStreamTest, GetInputFramesLost) { TEST_P(InputStreamTest, getCapturePosition) { doc::test( "The capture position of a non prepared stream should not be " - "retrievable"); + "retrievable or 0"); uint64_t frames; uint64_t time; ASSERT_OK(stream->getCapturePosition(returnIn(res, frames, time))); - ASSERT_RESULT(invalidStateOrNotSupported, res); + ASSERT_RESULT(okOrInvalidStateOrNotSupported, res); + if (res == Result::OK) { + ASSERT_EQ(0U, frames); + ASSERT_LE(0U, time); + } } TEST_P(InputStreamTest, updateSinkMetadata) { From cabe101cd2dc945b6b4ef4295f4fa650077d0c62 Mon Sep 17 00:00:00 2001 From: sqian Date: Wed, 6 Jun 2018 20:55:15 -0700 Subject: [PATCH 21/36] Handle radio API in low version VTS for high version service There are some request/response pair that could be replaced in higher-version hal. Radio service need to handle these request/response pair specific to version number. For example, e.g. getVoiceRegistrationStateResponse_1_2 replaces getVoiceRegistrationStateResponse for getVoiceRegistrationState in 1.2 radio service. We need to add util and update version number of IRadio service to check the version for testing the correct behavior. Bug: 109839239 Test: run vts Change-Id: I291690e77ea0e6e37fe75219e550f79fa44fb840 --- radio/1.0/vts/functional/Android.bp | 6 +++++ .../vts/functional/radio_hidl_hal_misc.cpp | 18 +++++++++------ .../vts/functional/radio_hidl_hal_test.cpp | 4 ++++ .../functional/radio_hidl_hal_utils_v1_0.h | 4 ++++ radio/1.0/vts/functional/vts_test_util.cpp | 18 +++++++++++++++ radio/1.0/vts/functional/vts_test_util.h | 23 +++++++++++++++++++ radio/1.1/vts/functional/Android.bp | 1 + .../vts/functional/radio_hidl_hal_test.cpp | 4 ++++ .../functional/radio_hidl_hal_utils_v1_1.h | 3 +++ .../vts/functional/radio_hidl_hal_test.cpp | 4 ++++ .../functional/radio_hidl_hal_utils_v1_2.h | 3 +++ radio/config/1.0/vts/functional/Android.bp | 3 +++ 12 files changed, 84 insertions(+), 7 deletions(-) diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp index afbb1c4b18..b959670017 100644 --- a/radio/1.0/vts/functional/Android.bp +++ b/radio/1.0/vts/functional/Android.bp @@ -31,6 +31,8 @@ cc_test { "VtsHalRadioV1_0TargetTest.cpp", "vts_test_util.cpp"], static_libs: [ + "android.hardware.radio@1.2", + "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], } @@ -44,6 +46,8 @@ cc_test { "VtsHalSapV1_0TargetTest.cpp", "vts_test_util.cpp"], static_libs: [ + "android.hardware.radio@1.2", + "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], } @@ -55,6 +59,8 @@ cc_library_static { "vts_test_util.cpp" ], shared_libs: [ + "android.hardware.radio@1.2", + "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], } diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp index bc03cf192d..5a5813d014 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp @@ -36,15 +36,19 @@ TEST_F(RadioHidlTest, getSignalStrength) { * Test IRadio.getVoiceRegistrationState() for the response returned. */ TEST_F(RadioHidlTest, getVoiceRegistrationState) { - serial = GetRandomSerialNumber(); + // The IRadio/IRadioResponse pair of this function is upgraded in 1.2. + // For radio version < 1.2, skip to test this function. + if (versionIRadio < v1_2) { + serial = GetRandomSerialNumber(); - radio->getVoiceRegistrationState(serial); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(serial, radioRsp->rspInfo.serial); + radio->getVoiceRegistrationState(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); + EXPECT_EQ(serial, radioRsp->rspInfo.serial); - if (cardStatus.cardState == CardState::ABSENT) { - EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); + if (cardStatus.cardState == CardState::ABSENT) { + EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); + } } } diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp index 96719d6d8d..fec66ca801 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp @@ -25,6 +25,10 @@ void RadioHidlTest::SetUp() { RadioHidlEnvironment::Instance()->getServiceName( hidl_string(RADIO_SERVICE_NAME))); } + + versionIRadio = getIRadioVersion(radio); + ASSERT_FALSE(unknown == versionIRadio); + ASSERT_NE(nullptr, radio.get()); radioRsp = new (std::nothrow) RadioResponse(*this); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h index f5ce072e47..edbeb7a39f 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h +++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h @@ -33,6 +33,7 @@ using namespace ::android::hardware::radio::V1_0; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; +using ::android::hardware::hidl_version; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::sp; @@ -536,6 +537,9 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase { /* Serial number for radio request */ int serial; + /* Version of radio service */ + hidl_version versionIRadio{0, 0}; + /* Update Sim Card Status */ void updateSimCardStatus(); diff --git a/radio/1.0/vts/functional/vts_test_util.cpp b/radio/1.0/vts/functional/vts_test_util.cpp index 7d15f35b2f..20ec99e248 100644 --- a/radio/1.0/vts/functional/vts_test_util.cpp +++ b/radio/1.0/vts/functional/vts_test_util.cpp @@ -54,3 +54,21 @@ int GetRandomSerialNumber() { } return testing::AssertionFailure() << "SapError:" + toString(err) + " is returned"; } + +hidl_version getIRadioVersion(sp<::android::hardware::radio::V1_0::IRadio> radio) { + if (::android::hardware::radio::V1_2::IRadio::castFrom(radio).withDefault(nullptr) != nullptr) { + ALOGI("Radio service version: 1.2"); + return v1_2; + } else if (::android::hardware::radio::V1_1::IRadio::castFrom(radio).withDefault(nullptr) != + nullptr) { + ALOGI("Radio service version: 1.1"); + return v1_1; + } else if (::android::hardware::radio::V1_0::IRadio::castFrom(radio).withDefault(nullptr) != + nullptr) { + ALOGI("Radio service version: 1.0"); + return v1_0; + } else { + ALOGI("Radio service version: unknown"); + return unknown; + } +} \ No newline at end of file diff --git a/radio/1.0/vts/functional/vts_test_util.h b/radio/1.0/vts/functional/vts_test_util.h index 826f0deae8..36ca18fcad 100644 --- a/radio/1.0/vts/functional/vts_test_util.h +++ b/radio/1.0/vts/functional/vts_test_util.h @@ -14,12 +14,20 @@ * limitations under the License. */ +#ifndef VTS_TEST_UTIL_H +#define VTS_TEST_UTIL_H 1 + #include #include +#include #include +#include +#include +using ::android::sp; +using ::android::hardware::hidl_version; using ::android::hardware::radio::V1_0::RadioError; using ::android::hardware::radio::V1_0::SapResultCode; using namespace std; @@ -32,6 +40,14 @@ enum CheckFlag { CHECK_SAP_ERROR = 4, }; +/* + * Radio hidl version parameters. + */ +const hidl_version v1_0(1, 0); +const hidl_version v1_1(1, 1); +const hidl_version v1_2(1, 2); +const hidl_version unknown(0, 0); + /* * Generate random serial number for radio test */ @@ -48,3 +64,10 @@ int GetRandomSerialNumber(); * vendor/devices implementations. */ ::testing::AssertionResult CheckAnyOfErrors(SapResultCode err, std::vector errors); + +/* + * Get the radio service version. + */ +hidl_version getIRadioVersion(sp<::android::hardware::radio::V1_0::IRadio> radio); + +#endif /*VTS_TEST_UTIL_H*/ \ No newline at end of file diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp index e7195ee7da..9d35796589 100644 --- a/radio/1.1/vts/functional/Android.bp +++ b/radio/1.1/vts/functional/Android.bp @@ -24,6 +24,7 @@ cc_test { "VtsHalRadioV1_1TargetTest.cpp"], static_libs: [ "RadioVtsTestUtilBase", + "android.hardware.radio@1.2", "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], diff --git a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp index 2f657b4e34..cc6b0e55c7 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp @@ -30,6 +30,10 @@ void RadioHidlTest_v1_1::SetUp() { ->getServiceName<::android::hardware::radio::V1_1::IRadio>( hidl_string(RADIO_SERVICE_NAME))); } + + versionIRadio = getIRadioVersion(radio_v1_1); + ASSERT_FALSE(unknown == versionIRadio); + ASSERT_NE(nullptr, radio_v1_1.get()); radioRsp_v1_1 = new (std::nothrow) RadioResponse_v1_1(*this); diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h index 925f4fc821..6125442a05 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h +++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h @@ -561,6 +561,9 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase { /* Serial number for radio request */ int serial; + /* Version of radio service */ + hidl_version versionIRadio{0, 0}; + /* Update Sim Card Status */ void updateSimCardStatus(); diff --git a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp index b34f138bbd..7a34d11dbf 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp @@ -30,6 +30,10 @@ void RadioHidlTest_v1_2::SetUp() { ->getServiceName<::android::hardware::radio::V1_2::IRadio>( hidl_string(RADIO_SERVICE_NAME))); } + + versionIRadio = getIRadioVersion(radio_v1_2); + ASSERT_FALSE(unknown == versionIRadio); + ASSERT_NE(nullptr, radio_v1_2.get()); radioRsp_v1_2 = new (std::nothrow) RadioResponse_v1_2(*this); diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h index 47122023a8..06be67c9bb 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h +++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h @@ -616,6 +616,9 @@ class RadioHidlTest_v1_2 : public ::testing::VtsHalHidlTargetTestBase { /* Serial number for radio request */ int serial; + /* Version of radio service */ + hidl_version versionIRadio{0, 0}; + /* Update Sim Card Status */ void updateSimCardStatus(); diff --git a/radio/config/1.0/vts/functional/Android.bp b/radio/config/1.0/vts/functional/Android.bp index aa8266ea3a..a1243a659a 100644 --- a/radio/config/1.0/vts/functional/Android.bp +++ b/radio/config/1.0/vts/functional/Android.bp @@ -27,6 +27,9 @@ cc_test { static_libs: [ "RadioVtsTestUtilBase", "android.hardware.radio.config@1.0", + "android.hardware.radio@1.2", + "android.hardware.radio@1.1", + "android.hardware.radio@1.0", ], header_libs: ["radio.util.header@1.0"], } From 7b75f015a7a7ebc40722fd4f36c9ca70e7e58e59 Mon Sep 17 00:00:00 2001 From: nagendra modadugu Date: Mon, 25 Jun 2018 19:56:35 -0700 Subject: [PATCH 22/36] keymaster: spec does not require that update produce output Remove out of spec enforcement on the amount of data returned by update, as this is not specified in the HAL. Bug: 109771020 Test: yes it is Change-Id: Ic41afbd01d51faf48d3c0fe090409ebcd257cc1e --- keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index 450b3eb4e5..f085fe38b7 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -3008,6 +3008,7 @@ TEST_F(EncryptionOperationsTest, AesGcmAadNoData) { * Verifies that AES GCM mode works when provided additional authenticated data in multiple chunks. */ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) { + const size_t tag_bits = 128; ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .AesEncryptionKey(128) @@ -3019,7 +3020,7 @@ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) { auto begin_params = AuthorizationSetBuilder() .BlockMode(BlockMode::GCM) .Padding(PaddingMode::NONE) - .Authorization(TAG_MAC_LENGTH, 128); + .Authorization(TAG_MAC_LENGTH, tag_bits); AuthorizationSet begin_out_params; auto update_params = @@ -3041,10 +3042,11 @@ TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) { EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params, &ciphertext, &input_consumed)); EXPECT_EQ(message.size(), input_consumed); - EXPECT_EQ(message.size(), ciphertext.size()); EXPECT_TRUE(update_out_params.empty()); EXPECT_EQ(ErrorCode::OK, Finish("" /* input */, &ciphertext)); + // Expect 128-bit (16-byte) tag appended to ciphertext. + EXPECT_EQ(message.size() + (tag_bits >> 3), ciphertext.size()); // Grab nonce. begin_params.push_back(begin_out_params); @@ -3100,7 +3102,6 @@ TEST_F(EncryptionOperationsTest, AesGcmAadOutOfOrder) { EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params, &ciphertext, &input_consumed)); EXPECT_EQ(message.size(), input_consumed); - EXPECT_EQ(message.size(), ciphertext.size()); EXPECT_TRUE(update_out_params.empty()); // More AAD From 0215d11cf266219245e27234d65e8f9eeac9f6c0 Mon Sep 17 00:00:00 2001 From: Shuo Qian Date: Wed, 27 Jun 2018 00:33:10 +0000 Subject: [PATCH 23/36] Revert "Handle radio API in low version VTS for high version service" This reverts commit cabe101cd2dc945b6b4ef4295f4fa650077d0c62. Bug: 109839239 Reason for revert: Treble/VTS backward compatibility Change-Id: Ibef1d91261fe6318c65fd617a2bee7f5d69bebae --- radio/1.0/vts/functional/Android.bp | 6 ----- .../vts/functional/radio_hidl_hal_misc.cpp | 18 ++++++--------- .../vts/functional/radio_hidl_hal_test.cpp | 4 ---- .../functional/radio_hidl_hal_utils_v1_0.h | 4 ---- radio/1.0/vts/functional/vts_test_util.cpp | 18 --------------- radio/1.0/vts/functional/vts_test_util.h | 23 ------------------- radio/1.1/vts/functional/Android.bp | 1 - .../vts/functional/radio_hidl_hal_test.cpp | 4 ---- .../functional/radio_hidl_hal_utils_v1_1.h | 3 --- .../vts/functional/radio_hidl_hal_test.cpp | 4 ---- .../functional/radio_hidl_hal_utils_v1_2.h | 3 --- radio/config/1.0/vts/functional/Android.bp | 3 --- 12 files changed, 7 insertions(+), 84 deletions(-) diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp index b959670017..afbb1c4b18 100644 --- a/radio/1.0/vts/functional/Android.bp +++ b/radio/1.0/vts/functional/Android.bp @@ -31,8 +31,6 @@ cc_test { "VtsHalRadioV1_0TargetTest.cpp", "vts_test_util.cpp"], static_libs: [ - "android.hardware.radio@1.2", - "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], } @@ -46,8 +44,6 @@ cc_test { "VtsHalSapV1_0TargetTest.cpp", "vts_test_util.cpp"], static_libs: [ - "android.hardware.radio@1.2", - "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], } @@ -59,8 +55,6 @@ cc_library_static { "vts_test_util.cpp" ], shared_libs: [ - "android.hardware.radio@1.2", - "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], } diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp index 5a5813d014..bc03cf192d 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp @@ -36,19 +36,15 @@ TEST_F(RadioHidlTest, getSignalStrength) { * Test IRadio.getVoiceRegistrationState() for the response returned. */ TEST_F(RadioHidlTest, getVoiceRegistrationState) { - // The IRadio/IRadioResponse pair of this function is upgraded in 1.2. - // For radio version < 1.2, skip to test this function. - if (versionIRadio < v1_2) { - serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); - radio->getVoiceRegistrationState(serial); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(serial, radioRsp->rspInfo.serial); + radio->getVoiceRegistrationState(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); + EXPECT_EQ(serial, radioRsp->rspInfo.serial); - if (cardStatus.cardState == CardState::ABSENT) { - EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); - } + if (cardStatus.cardState == CardState::ABSENT) { + EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error); } } diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp index fec66ca801..96719d6d8d 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp @@ -25,10 +25,6 @@ void RadioHidlTest::SetUp() { RadioHidlEnvironment::Instance()->getServiceName( hidl_string(RADIO_SERVICE_NAME))); } - - versionIRadio = getIRadioVersion(radio); - ASSERT_FALSE(unknown == versionIRadio); - ASSERT_NE(nullptr, radio.get()); radioRsp = new (std::nothrow) RadioResponse(*this); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h index edbeb7a39f..f5ce072e47 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h +++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h @@ -33,7 +33,6 @@ using namespace ::android::hardware::radio::V1_0; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; -using ::android::hardware::hidl_version; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::sp; @@ -537,9 +536,6 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase { /* Serial number for radio request */ int serial; - /* Version of radio service */ - hidl_version versionIRadio{0, 0}; - /* Update Sim Card Status */ void updateSimCardStatus(); diff --git a/radio/1.0/vts/functional/vts_test_util.cpp b/radio/1.0/vts/functional/vts_test_util.cpp index 20ec99e248..7d15f35b2f 100644 --- a/radio/1.0/vts/functional/vts_test_util.cpp +++ b/radio/1.0/vts/functional/vts_test_util.cpp @@ -54,21 +54,3 @@ int GetRandomSerialNumber() { } return testing::AssertionFailure() << "SapError:" + toString(err) + " is returned"; } - -hidl_version getIRadioVersion(sp<::android::hardware::radio::V1_0::IRadio> radio) { - if (::android::hardware::radio::V1_2::IRadio::castFrom(radio).withDefault(nullptr) != nullptr) { - ALOGI("Radio service version: 1.2"); - return v1_2; - } else if (::android::hardware::radio::V1_1::IRadio::castFrom(radio).withDefault(nullptr) != - nullptr) { - ALOGI("Radio service version: 1.1"); - return v1_1; - } else if (::android::hardware::radio::V1_0::IRadio::castFrom(radio).withDefault(nullptr) != - nullptr) { - ALOGI("Radio service version: 1.0"); - return v1_0; - } else { - ALOGI("Radio service version: unknown"); - return unknown; - } -} \ No newline at end of file diff --git a/radio/1.0/vts/functional/vts_test_util.h b/radio/1.0/vts/functional/vts_test_util.h index 36ca18fcad..826f0deae8 100644 --- a/radio/1.0/vts/functional/vts_test_util.h +++ b/radio/1.0/vts/functional/vts_test_util.h @@ -14,20 +14,12 @@ * limitations under the License. */ -#ifndef VTS_TEST_UTIL_H -#define VTS_TEST_UTIL_H 1 - #include #include -#include #include -#include -#include -using ::android::sp; -using ::android::hardware::hidl_version; using ::android::hardware::radio::V1_0::RadioError; using ::android::hardware::radio::V1_0::SapResultCode; using namespace std; @@ -40,14 +32,6 @@ enum CheckFlag { CHECK_SAP_ERROR = 4, }; -/* - * Radio hidl version parameters. - */ -const hidl_version v1_0(1, 0); -const hidl_version v1_1(1, 1); -const hidl_version v1_2(1, 2); -const hidl_version unknown(0, 0); - /* * Generate random serial number for radio test */ @@ -64,10 +48,3 @@ int GetRandomSerialNumber(); * vendor/devices implementations. */ ::testing::AssertionResult CheckAnyOfErrors(SapResultCode err, std::vector errors); - -/* - * Get the radio service version. - */ -hidl_version getIRadioVersion(sp<::android::hardware::radio::V1_0::IRadio> radio); - -#endif /*VTS_TEST_UTIL_H*/ \ No newline at end of file diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp index 9d35796589..e7195ee7da 100644 --- a/radio/1.1/vts/functional/Android.bp +++ b/radio/1.1/vts/functional/Android.bp @@ -24,7 +24,6 @@ cc_test { "VtsHalRadioV1_1TargetTest.cpp"], static_libs: [ "RadioVtsTestUtilBase", - "android.hardware.radio@1.2", "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], diff --git a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp index cc6b0e55c7..2f657b4e34 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp @@ -30,10 +30,6 @@ void RadioHidlTest_v1_1::SetUp() { ->getServiceName<::android::hardware::radio::V1_1::IRadio>( hidl_string(RADIO_SERVICE_NAME))); } - - versionIRadio = getIRadioVersion(radio_v1_1); - ASSERT_FALSE(unknown == versionIRadio); - ASSERT_NE(nullptr, radio_v1_1.get()); radioRsp_v1_1 = new (std::nothrow) RadioResponse_v1_1(*this); diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h index 6125442a05..925f4fc821 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h +++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h @@ -561,9 +561,6 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase { /* Serial number for radio request */ int serial; - /* Version of radio service */ - hidl_version versionIRadio{0, 0}; - /* Update Sim Card Status */ void updateSimCardStatus(); diff --git a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp index 7a34d11dbf..b34f138bbd 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp @@ -30,10 +30,6 @@ void RadioHidlTest_v1_2::SetUp() { ->getServiceName<::android::hardware::radio::V1_2::IRadio>( hidl_string(RADIO_SERVICE_NAME))); } - - versionIRadio = getIRadioVersion(radio_v1_2); - ASSERT_FALSE(unknown == versionIRadio); - ASSERT_NE(nullptr, radio_v1_2.get()); radioRsp_v1_2 = new (std::nothrow) RadioResponse_v1_2(*this); diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h index 06be67c9bb..47122023a8 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h +++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h @@ -616,9 +616,6 @@ class RadioHidlTest_v1_2 : public ::testing::VtsHalHidlTargetTestBase { /* Serial number for radio request */ int serial; - /* Version of radio service */ - hidl_version versionIRadio{0, 0}; - /* Update Sim Card Status */ void updateSimCardStatus(); diff --git a/radio/config/1.0/vts/functional/Android.bp b/radio/config/1.0/vts/functional/Android.bp index a1243a659a..aa8266ea3a 100644 --- a/radio/config/1.0/vts/functional/Android.bp +++ b/radio/config/1.0/vts/functional/Android.bp @@ -27,9 +27,6 @@ cc_test { static_libs: [ "RadioVtsTestUtilBase", "android.hardware.radio.config@1.0", - "android.hardware.radio@1.2", - "android.hardware.radio@1.1", - "android.hardware.radio@1.0", ], header_libs: ["radio.util.header@1.0"], } From c0e2e2b071df5cdff10193556163e2975f0b682c Mon Sep 17 00:00:00 2001 From: sqian Date: Wed, 27 Jun 2018 12:12:26 -0700 Subject: [PATCH 24/36] Fix missed refactor of serial Bug: 109822806 Test: run vts Change-Id: If88384699dbb4c2ddd1c580d2b35be38afd0f8e8 --- radio/1.2/vts/functional/radio_hidl_hal_api.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index 212913d3ac..a9865e53de 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -696,7 +696,7 @@ TEST_F(RadioHidlTest_v1_2, deactivateDataCall_1_2) { * Test IRadio.getCellInfoList() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getCellInfoList_1_2) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return res = radio_v1_2->getCellInfoList(serial); ASSERT_OK(res); @@ -714,7 +714,7 @@ TEST_F(RadioHidlTest_v1_2, getCellInfoList_1_2) { * Test IRadio.getVoiceRegistrationState() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getVoiceRegistrationState) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return res = radio_v1_2->getVoiceRegistrationState(serial); ASSERT_OK(res); @@ -732,7 +732,7 @@ TEST_F(RadioHidlTest_v1_2, getVoiceRegistrationState) { * Test IRadio.getDataRegistrationState() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return res = radio_v1_2->getDataRegistrationState(serial); ASSERT_OK(res); @@ -751,7 +751,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { * Test IRadio.getAvailableBandModes() for the response returned. */ TEST_F(RadioHidlTest_v1_2, getAvailableBandModes) { - int serial = GetRandomSerialNumber(); + serial = GetRandomSerialNumber(); Return res = radio_v1_2->getAvailableBandModes(serial); ASSERT_OK(res); From 72641e7ad014a011562c3fd16444b919d32aeb63 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 28 Jun 2018 18:00:05 -0700 Subject: [PATCH 25/36] Audio VTS was testing wrong uninitialized variable due to typo The test was testing a uninitialized variable instead of testing the result of the tested method. Bug: 110963314 Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target Change-Id: I9a212eef690ae627fd7f7dbfaf4a0b4047c491b3 Signed-off-by: Kevin Rocard --- audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp index 4aeefa65d3..0f8996fc5d 100644 --- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp @@ -558,11 +558,11 @@ TEST_F(AudioPrimaryHidlTest, SetConnectedState) { address.device = deviceType; auto ret = device->setConnectedState(address, state); ASSERT_TRUE(ret.isOk()); - if (res == Result::NOT_SUPPORTED) { + if (ret == Result::NOT_SUPPORTED) { doc::partialTest("setConnectedState is not supported"); return; } - ASSERT_OK(res); + ASSERT_OK(ret); } } } From bb372e5984a612cb6972e837662d64a90785fbd8 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Fri, 29 Jun 2018 16:21:32 -0700 Subject: [PATCH 26/36] Inject last location in InjectBestLocation VTS test Bug: 110626730 Test: run VTS on device. Change-Id: I6f57dd7f9164dacf011f25412e55fcd22821aca0 --- .../vts/functional/gnss_hal_test_cases.cpp | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index eeb9d0322c..52882c7ab1 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -353,23 +353,8 @@ TEST_F(GnssHalTest, BlacklistConstellation) { * Ensure successfully injecting a location. */ TEST_F(GnssHalTest, InjectBestLocation) { - GnssLocation gnssLocation = {.gnssLocationFlags = 0, // set below - .latitudeDegrees = 43.0, - .longitudeDegrees = -180, - .altitudeMeters = 1000, - .speedMetersPerSec = 0, - .bearingDegrees = 0, - .horizontalAccuracyMeters = 0.1, - .verticalAccuracyMeters = 0.1, - .speedAccuracyMetersPerSecond = 0.1, - .bearingAccuracyDegrees = 0.1, - .timestamp = 1534567890123L}; - gnssLocation.gnssLocationFlags |= - GnssLocationFlags::HAS_LAT_LONG | GnssLocationFlags::HAS_ALTITUDE | - GnssLocationFlags::HAS_SPEED | GnssLocationFlags::HAS_HORIZONTAL_ACCURACY | - GnssLocationFlags::HAS_VERTICAL_ACCURACY | GnssLocationFlags::HAS_SPEED_ACCURACY | - GnssLocationFlags::HAS_BEARING | GnssLocationFlags::HAS_BEARING_ACCURACY; - + StartAndCheckLocations(1); + GnssLocation gnssLocation = last_location_; CheckLocation(gnssLocation, true); auto result = gnss_hal_->injectBestLocation(gnssLocation); @@ -377,7 +362,7 @@ TEST_F(GnssHalTest, InjectBestLocation) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); - auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_ALL); + auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_POSITION); ASSERT_TRUE(resultVoid.isOk()); } From 84cff99b2fcae8757704b0384552aebe290165ed Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Mon, 2 Jul 2018 10:41:28 -0700 Subject: [PATCH 27/36] Delete time/position in InjectDelete instead of Delete_all - DELETE_ALL will delete XTRA. Bug: 110626730 Test: run VTS test on device. Change-Id: I4f01430f24f92238193d3de6b6fbb31e81e9f006 --- gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp index 608ee70065..c26f60a703 100644 --- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp @@ -404,7 +404,11 @@ TEST_F(GnssHalTest, InjectDelete) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); - auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_ALL); + auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_POSITION); + + ASSERT_TRUE(resultVoid.isOk()); + + resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_TIME); ASSERT_TRUE(resultVoid.isOk()); From 5ea5dda2c33f9d2f1db77d6b4493f0eb356c2937 Mon Sep 17 00:00:00 2001 From: WyattRiley Date: Thu, 28 Jun 2018 15:05:14 -0700 Subject: [PATCH 28/36] Improve VTS GNSS 1.1 reliability. Allow VTS test for low power mode to handle certain vendor issues that supply one extra location at the start of low power mode. Allow more time for GNSS first fix, and warmup as needed given limited VTS access to AGPS. Bug: 110626730 Bug: 110987651 Test: (TODO) Passes on device. Change-Id: Ieeefd7fcd45890b03dffbbee965e1d9b17805c4c --- gnss/1.1/vts/functional/gnss_hal_test.cpp | 11 +++--- gnss/1.1/vts/functional/gnss_hal_test.h | 9 +++-- .../vts/functional/gnss_hal_test_cases.cpp | 39 ++++++++++++++----- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/gnss/1.1/vts/functional/gnss_hal_test.cpp b/gnss/1.1/vts/functional/gnss_hal_test.cpp index 46d61e54e3..433f5cb4ea 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test.cpp @@ -83,6 +83,7 @@ void GnssHalTest::StopAndClearLocations() { */ while (wait(TIMEOUT_SEC) == std::cv_status::no_timeout) { } + location_called_count_ = 0; } void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) { @@ -97,17 +98,17 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po EXPECT_TRUE(result); } -bool GnssHalTest::StartAndGetSingleLocation() { +bool GnssHalTest::StartAndCheckFirstLocation() { auto result = gnss_hal_->start(); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result); /* - * GPS signals initially optional for this test, so don't expect fast fix, - * or no timeout, unless signal is present + * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS, + * so allow time to demodulate ephemeris over the air. */ - const int kFirstGnssLocationTimeoutSeconds = 15; + const int kFirstGnssLocationTimeoutSeconds = 75; wait(kFirstGnssLocationTimeoutSeconds); EXPECT_EQ(location_called_count_, 1); @@ -195,7 +196,7 @@ void GnssHalTest::StartAndCheckLocations(int count) { SetPositionMode(kMinIntervalMsec, kLowPowerMode); - EXPECT_TRUE(StartAndGetSingleLocation()); + EXPECT_TRUE(StartAndCheckFirstLocation()); for (int i = 1; i < count; i++) { EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec)); diff --git a/gnss/1.1/vts/functional/gnss_hal_test.h b/gnss/1.1/vts/functional/gnss_hal_test.h index 269366a9b9..64478b5b1c 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test.h +++ b/gnss/1.1/vts/functional/gnss_hal_test.h @@ -107,12 +107,15 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase { void SetUpGnssCallback(); /* - * StartAndGetSingleLocation: - * Helper function to get one Location and check fields + * StartAndCheckFirstLocation: + * Helper function to start location, and check the first one. + * + *

Note this leaves the Location request active, to enable Stop call vs. other call + * reordering tests. * * returns true if a location was successfully generated */ - bool StartAndGetSingleLocation(); + bool StartAndCheckFirstLocation(); /* * CheckLocation: diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index eeb9d0322c..541718fdf7 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -60,24 +60,46 @@ TEST_F(GnssHalTest, TestGnssMeasurementCallback) { */ TEST_F(GnssHalTest, GetLocationLowPower) { const int kMinIntervalMsec = 5000; - const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) + 1; - const int kNoLocationPeriodSec = 2; + const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2; + const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2; const int kLocationsToCheck = 5; const bool kLowPowerMode = true; + // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider + StartAndCheckLocations(5); + StopAndClearLocations(); + + // Start of Low Power Mode test SetPositionMode(kMinIntervalMsec, kLowPowerMode); - EXPECT_TRUE(StartAndGetSingleLocation()); + // Don't expect true - as without AGPS access + if (!StartAndCheckFirstLocation()) { + ALOGW("GetLocationLowPower test - no first low power location received."); + } for (int i = 1; i < kLocationsToCheck; i++) { // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and // ensure that no location is received yet + wait(kNoLocationPeriodSec); - EXPECT_EQ(location_called_count_, i); - EXPECT_EQ(std::cv_status::no_timeout, - wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)); - EXPECT_EQ(location_called_count_, i + 1); - CheckLocation(last_location_, true); + // Tolerate (ignore) one extra location right after the first one + // to handle startup edge case scheduling limitations in some implementations + if ((i == 1) && (location_called_count_ == 2)) { + CheckLocation(last_location_, true); + continue; // restart the quiet wait period after this too-fast location + } + EXPECT_LE(location_called_count_, i); + if (location_called_count_ != i) { + ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ", + location_called_count_, i); + } + + if (std::cv_status::no_timeout != + wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) { + ALOGW("GetLocationLowPower test - timeout awaiting location %d", i); + } else { + CheckLocation(last_location_, true); + } } StopAndClearLocations(); @@ -236,7 +258,6 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); - location_called_count_ = 0; StopAndClearLocations(); list_gnss_sv_status_.clear(); From 91cc8f4832882e8fa9baa04d717184636a57314d Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Mon, 2 Jul 2018 10:48:08 -0700 Subject: [PATCH 29/36] Tolerate 1 sv status in GNSS blacklist VTS test Bug: 110969497 Test: run VTS test on device. Change-Id: I26345bb62513da8530cb48672e5f59a915817cb4 --- gnss/1.1/vts/functional/gnss_hal_test_cases.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index eeb9d0322c..6226b572a7 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -177,7 +177,8 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); @@ -217,7 +218,8 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { location_called_count_ = 0; StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); for (const auto& gnss_sv_status : list_gnss_sv_status_) { @@ -242,7 +244,8 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) { StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); @@ -278,7 +281,8 @@ TEST_F(GnssHalTest, BlacklistConstellation) { StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); @@ -328,7 +332,8 @@ TEST_F(GnssHalTest, BlacklistConstellation) { location_called_count_ = 0; StartAndCheckLocations(kLocationsToAwait); - EXPECT_GE((int)list_gnss_sv_status_.size(), kLocationsToAwait); + // Tolerate 1 less sv status to handle edge cases in reporting. + EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(), kLocationsToAwait); for (const auto& gnss_sv_status : list_gnss_sv_status_) { From ec5aa6af4d8b330af6c8599830942e29294aa688 Mon Sep 17 00:00:00 2001 From: Ruchi Kandoi Date: Mon, 2 Jul 2018 13:20:34 -0700 Subject: [PATCH 30/36] Secure_element: vts: Modify openBasicChannel as per OMAPI standard CHANNEL_NOT_AVAILABLE should be returned when opening basic channel is not permitted on the secure element Test: Test with SIM1 HAL Bug: 110945797 Merged-In: I2dd4eafaf4c534b49a37690a9baadcc5ac93190c Change-Id: I2dd4eafaf4c534b49a37690a9baadcc5ac93190c --- .../1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp b/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp index 3ea3e8dcac..671923a616 100644 --- a/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp +++ b/secure_element/1.0/vts/functional/VtsHalSecureElementV1_0TargetTest.cpp @@ -173,7 +173,7 @@ TEST_F(SecureElementHidlTest, openBasicChannel) { se_->closeChannel(0); return; } - EXPECT_EQ(SecureElementStatus::UNSUPPORTED_OPERATION, statusReturned); + EXPECT_EQ(SecureElementStatus::CHANNEL_NOT_AVAILABLE, statusReturned); } /* From ec233bf692435c6cc1472bd2677bdf46d4befa94 Mon Sep 17 00:00:00 2001 From: Hsin-Yi Chen Date: Wed, 4 Jul 2018 10:35:01 +0800 Subject: [PATCH 31/36] Fix IUsb version number in vts test Bug: 110913709 Test: vts-tradefed run vts -m VtsHalUsbV1_1Target Change-Id: I9ae6add2fe8ff7138e07797c3a191b6dfe611948 Merged-In: I9ae6add2fe8ff7138e07797c3a191b6dfe611948 (cherry picked from commit b4193b855c745da6772607d32f5351300ac826e1) --- usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp index c990b237fe..caf9c695b9 100644 --- a/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp +++ b/usb/1.1/vts/functional/VtsHalUsbV1_1TargetTest.cpp @@ -31,8 +31,8 @@ #include #include +using ::android::hardware::usb::V1_1::IUsb; using ::android::hardware::usb::V1_1::IUsbCallback; -using ::android::hardware::usb::V1_0::IUsb; using ::android::hardware::usb::V1_0::PortDataRole; using ::android::hardware::usb::V1_0::PortMode; using ::android::hardware::usb::V1_1::PortMode_1_1; From 4ed0a216adc3bc9460d11d302ba53db9707ded44 Mon Sep 17 00:00:00 2001 From: sqian Date: Mon, 9 Jul 2018 14:45:12 -0700 Subject: [PATCH 32/36] Add SIM_PUK2 for Icc VTS tests Add SIM_PUK2 for supplyIccPin2ForApp and changeIccPin2ForApp if sim card is in the puk2 state. Bug: 111211929 Test: sanity Change-Id: I80d924cc4a61565887cbd2a65ee5927a42ad656e --- current.txt | 1 + radio/1.0/IRadioResponse.hal | 2 ++ radio/1.0/vts/functional/radio_hidl_hal_icc.cpp | 10 ++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/current.txt b/current.txt index cae8dbf2d2..33cf9346f5 100644 --- a/current.txt +++ b/current.txt @@ -385,3 +385,4 @@ cd4330c3196bda1d642a32abfe23a7d64ebfbda721940643af6867af3b3f0aa9 android.hardwar # ABI preserving changes to HALs after Android P 1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio +1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal index 27945cb07f..c1b16b7b83 100644 --- a/radio/1.0/IRadioResponse.hal +++ b/radio/1.0/IRadioResponse.hal @@ -88,6 +88,7 @@ interface IRadioResponse { * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:SIM_PUK2 */ oneway supplyIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries); @@ -141,6 +142,7 @@ interface IRadioResponse { * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:SIM_PUK2 */ oneway changeIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp index fe2b0c4ad8..308a882a89 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp @@ -90,7 +90,8 @@ TEST_F(RadioHidlTest, supplyIccPin2ForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::SIM_PUK2})); } } } @@ -161,9 +162,10 @@ TEST_F(RadioHidlTest, changeIccPin2ForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp->rspInfo.error, - {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::SIM_PUK2})); } } } From c0a06f34c88cf9dc017be6178113b35c3c7fc67e Mon Sep 17 00:00:00 2001 From: sqian Date: Thu, 12 Jul 2018 16:30:24 -0700 Subject: [PATCH 33/36] Add REQUEST_NOT_SUPPORTED for pin and pin2 Icc VTS Bug: 111222834 Test: sanity Change-Id: Ia3b96e83d6173c2c80bdbf7763a876883b167af9 --- radio/1.0/vts/functional/radio_hidl_hal_icc.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp index 308a882a89..5042c071e8 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp @@ -44,7 +44,9 @@ TEST_F(RadioHidlTest, supplyIccPinForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); } } } @@ -90,8 +92,10 @@ TEST_F(RadioHidlTest, supplyIccPin2ForApp) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(serial, radioRsp->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, - {RadioError::PASSWORD_INCORRECT, RadioError::SIM_PUK2})); + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp->rspInfo.error, + {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::SIM_PUK2})); } } } From 8284636fecaf9d679646416988762ce4b3ca685b Mon Sep 17 00:00:00 2001 From: Carter Hsu Date: Fri, 13 Jul 2018 10:41:29 +0800 Subject: [PATCH 34/36] audio: add wakelock capability for audiohalservice 1. wake_lock group 2. BLOCK_SUSPEND capability int pm_wake_lock(const char *buf) { const char *str = buf; struct wakelock *wl; u64 timeout_ns = 0; size_t len; int ret = 0; if (!capable(CAP_BLOCK_SUSPEND)) return -EPERM; Bug: 111018819 Test: manual Change-Id: I1283e4b1ab2b95e4e94df045240001485593f1ab Signed-off-by: Carter Hsu --- .../default/service/android.hardware.audio@2.0-service.rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc b/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc index 8217b946dc..6e91bccb3c 100644 --- a/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc +++ b/audio/common/all-versions/default/service/android.hardware.audio@2.0-service.rc @@ -2,7 +2,8 @@ service vendor.audio-hal-2-0 /vendor/bin/hw/android.hardware.audio@2.0-service class hal user audioserver # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) - group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock + capabilities BLOCK_SUSPEND ioprio rt 4 writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks # audioflinger restarts itself when it loses connection with the hal From cccd5bf1dd32c49ac6e10d870829b1ae40d19580 Mon Sep 17 00:00:00 2001 From: Hsin-Yi Chen Date: Fri, 20 Jul 2018 12:52:20 +0800 Subject: [PATCH 35/36] Fix ICameraDeviceCallback version in VTS test Test: ./VtsHalCameraProviderV2_4TargetTest --gtest_filter=CameraHidlTest.constructDefaultRequestSettings Bug: 111625570 Change-Id: I8ad02afb0e9c2131c240999c4a8c78a1f770e847 --- .../functional/VtsHalCameraProviderV2_4TargetTest.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index f8022ae9e9..1a245c4610 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -87,7 +87,6 @@ using ::android::hardware::camera::device::V3_2::ICameraDevice; using ::android::hardware::camera::device::V3_2::BufferCache; using ::android::hardware::camera::device::V3_2::CaptureRequest; using ::android::hardware::camera::device::V3_2::CaptureResult; -using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback; using ::android::hardware::camera::device::V3_2::ICameraDeviceSession; using ::android::hardware::camera::device::V3_2::NotifyMsg; using ::android::hardware::camera::device::V3_2::RequestTemplate; @@ -532,7 +531,7 @@ public: hidl_vec getCameraDeviceNames(sp provider); - struct EmptyDeviceCb : public ICameraDeviceCallback { + struct EmptyDeviceCb : public V3_4::ICameraDeviceCallback { virtual Return processCaptureResult( const hidl_vec& /*results*/) override { ALOGI("processCaptureResult callback"); @@ -540,6 +539,13 @@ public: return Void(); } + virtual Return processCaptureResult_3_4( + const hidl_vec& /*results*/) override { + ALOGI("processCaptureResult_3_4 callback"); + ADD_FAILURE(); // Empty callback should not reach here + return Void(); + } + virtual Return notify(const hidl_vec& /*msgs*/) override { ALOGI("notify callback"); ADD_FAILURE(); // Empty callback should not reach here From 736f04cf7f0414c213a274ffb200e360f2b830cc Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 20 Aug 2018 10:46:48 -0700 Subject: [PATCH 36/36] Add back keymaster@4.0 hash. This was changed after this branch was released. The originally released hash needs to be restored since that is what partners are building with. Bug: 112688384 Bug: 78104779 Test: m android.hardware.keymaster@4.0 (tests hashes) Change-Id: I0f59a493d7f17a13402d992495d1a259f6257077 Merged-In: I0f59a493d7f17a13402d992495d1a259f6257077 (cherry picked from commit ec720564dbdef01d14fcf46c46ea18294440358b) --- current.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/current.txt b/current.txt index 94c80fa400..267f6b0309 100644 --- a/current.txt +++ b/current.txt @@ -335,7 +335,8 @@ dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardwar 675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth 434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback c9e498f1ade5e26f00d290b4763a9671ec6720f915e7d592844b62e8cb1f9b5c android.hardware.health@2.0::types -6122abe9bc2e7868463d3787db2991c1e47cc01fe3e4cfb7293c5ba421ff8ad9 android.hardware.keymaster@4.0::IKeymasterDevice +201f9723353fdbd40bf3705537fb7e015e4c399879425e68688fe0f43606ea4d android.hardware.keymaster@4.0::IKeymasterDevice # b/112688384 +6122abe9bc2e7868463d3787db2991c1e47cc01fe3e4cfb7293c5ba421ff8ad9 android.hardware.keymaster@4.0::IKeymasterDevice # b/78104779 1b7d2090c0a28b229d37c4b96160796b1f0d703950ac6ccc163fccd280830503 android.hardware.keymaster@4.0::types 6d5c646a83538f0f9d8438c259932509f4353410c6c76e56db0d6ca98b69c3bb android.hardware.media.bufferpool@1.0::IAccessor b8c7ed58aa8740361e63d0ce9e7c94227572a629f356958840b34809d2393a7c android.hardware.media.bufferpool@1.0::IClientManager