From 4c521b0745890516b37e1e1b6fc2523569528838 Mon Sep 17 00:00:00 2001 From: josephjang Date: Tue, 13 Oct 2020 13:40:45 +0800 Subject: [PATCH] authsecret: Notify LSS to generate secret In order to prevent storing testing secret to Citadel during authsecret testing, we try to notify lock setting service to generate PIN code send corresponding secret to Citadel before authsecret VTS testing. LSS will not generate new secret if it had ever generated PIN code/Password/Pattern before. Bug: 150929955 Bug: 163064036 atest VtsHalAuthSecretV1_0TargetTest Change-Id: I6b58bf90d16db16ce2a78d8b73298e042c049fc3 --- .../1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp b/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp index 0bff9df7dd..f27f26658a 100644 --- a/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp +++ b/authsecret/1.0/vts/functional/VtsHalAuthSecretV1_0TargetTest.cpp @@ -34,11 +34,19 @@ class AuthSecretHidlTest : public testing::TestWithParam { authsecret = IAuthSecret::getService(GetParam()); ASSERT_NE(authsecret, nullptr); + // Notify LSS to generate PIN code '1234' and corresponding secret. + (void)system("cmd lock_settings set-pin 1234"); + // All tests must enroll the correct secret first as this cannot be changed // without a factory reset and the order of tests could change. authsecret->primaryUserCredential(CORRECT_SECRET); } + static void TearDownTestSuite() { + // clean up PIN code after testing + (void)system("cmd lock_settings clear --old 1234"); + } + sp authsecret; hidl_vec CORRECT_SECRET{61, 93, 124, 240, 5, 0, 7, 201, 9, 129, 11, 12, 0, 14, 0, 16}; hidl_vec WRONG_SECRET{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};