diff options
author | Shawn Willden <swillden@google.com> | 2022-06-16 12:50:40 -0600 |
---|---|---|
committer | Justin Yun <justinyun@google.com> | 2022-06-17 10:49:46 +0900 |
commit | e5364d7617ffb1c787aa5ddb185727115ebbd88c (patch) | |
tree | 0741283bf392fb08e3a5d9582600ccf709a25e8a /security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp | |
parent | 987a7e3f304d381e2b0ed7c961169f4d6a553954 (diff) |
Read VSR level from correct property.
Bug: 235424890
Test: VtsHalKeymasterV4_0TargetTest & VtsAidlKeyMintTargetTest
Ignore-AOSP-First: Cherry-pick of aosp/2128833
Change-Id: I39109c097d129124097a303c3f108d015cb367e3
Merged-In: I39109c097d129124097a303c3f108d015cb367e3
Diffstat (limited to 'security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp')
-rw-r--r-- | security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp index 33945fd0e5..46db4f0c78 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp @@ -1461,25 +1461,28 @@ void verify_subject(const X509* cert, // } int get_vsr_api_level() { - int api_level = ::android::base::GetIntProperty("ro.board.api_level", -1); - if (api_level == -1) { - api_level = ::android::base::GetIntProperty("ro.board.first_api_level", -1); + int vendor_api_level = ::android::base::GetIntProperty("ro.vendor.api_level", -1); + if (vendor_api_level != -1) { + return vendor_api_level; } - if (api_level == -1) { - api_level = ::android::base::GetIntProperty("ro.vndk.version", -1); + + // Android S and older devices do not define ro.vendor.api_level + vendor_api_level = ::android::base::GetIntProperty("ro.board.api_level", -1); + if (vendor_api_level == -1) { + vendor_api_level = ::android::base::GetIntProperty("ro.board.first_api_level", -1); } - // We really should have a VSR API level by now. But on cuttlefish, and perhaps other weird - // devices, we may not. So, we use the SDK first or current API level if needed. If this goes - // wrong, it should go wrong in the direction of being too strict rather than too lenient, which - // should provoke someone to examine why we don't have proper VSR API level properties. - if (api_level == -1) { - api_level = ::android::base::GetIntProperty("ro.product.first_api_level", -1); + + int product_api_level = ::android::base::GetIntProperty("ro.product.first_api_level", -1); + if (product_api_level == -1) { + product_api_level = ::android::base::GetIntProperty("ro.build.version.sdk", -1); + EXPECT_NE(product_api_level, -1) << "Could not find ro.build.version.sdk"; } - if (api_level == -1) { - api_level = ::android::base::GetIntProperty("ro.build.version.sdk", -1); + + // VSR API level is the minimum of vendor_api_level and product_api_level. + if (vendor_api_level == -1 || vendor_api_level > product_api_level) { + return product_api_level; } - EXPECT_NE(api_level, -1) << "Could not find a VSR level, or equivalent."; - return api_level; + return vendor_api_level; } bool is_gsi_image() { |