From 43dd6e34bd2868cb9fae8e23e717e346d08caeea Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Fri, 29 May 2020 15:23:14 +0800 Subject: [PATCH] Allow unlocked in VTS VTS was running on a userdebug build GSI before Android 10. Starting from Android 10, VTS is switched to running on top of a user build GSI image, plus the device-specific boot-debug.img to allow adb root. https://source.android.com/compatibility/vts/vts-on-gsi So 'ro.build.type' will be 'user' because the value comes from /system/build.prop. Switching to using 'ro.debuggable' to decide whether we should check the device is locked or not. Note that 'ro.debuggable' will be '1' for userdebug/eng images or when a boot-debug.img is used. Bug: 154449286 Test: atest VtsHalKeymasterV4_0TargetTest Change-Id: If5a90d62f77489aa58f96e908553a052cf6d1e18 --- keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 6cbe4dafae..aa2de2a682 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -438,10 +438,10 @@ bool verify_attestation_record(const string& challenge, const string& app_id, EXPECT_TRUE(device_locked); } - // Check that the expected result from VBMeta matches the build type. Only a user build - // should have AVB reporting the device is locked. - EXPECT_NE(property_get("ro.build.type", property_value, ""), 0); - if (!strcmp(property_value, "user")) { + // Check that the device is locked if not debuggable, e.g., user build + // images in CTS. For VTS, debuggable images are used to allow adb root + // and the device is unlocked. + if (!property_get_bool("ro.debuggable", false)) { EXPECT_TRUE(device_locked); } else { EXPECT_FALSE(device_locked);