diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-03-25 00:51:35 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-25 00:51:35 +0000 |
commit | 836300c33304e880b5d193a63a215e79350e2939 (patch) | |
tree | 71fef40eea40b3449fb63fd50a04b99d9ce67c38 | |
parent | 505e763ee88d57a11b2d34ba7a5df48fe341d7ce (diff) | |
parent | d7579be9ec95d10c30605df5298f942c7d503cdc (diff) | |
download | base-836300c33304e880b5d193a63a215e79350e2939.tar.gz |
Merge "Remove mini-keyctl usage from UpdatableSystemFontTest" into main
-rw-r--r-- | tests/UpdatableSystemFontTest/src/com/android/updatablesystemfont/UpdatableSystemFontTest.java | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/tests/UpdatableSystemFontTest/src/com/android/updatablesystemfont/UpdatableSystemFontTest.java b/tests/UpdatableSystemFontTest/src/com/android/updatablesystemfont/UpdatableSystemFontTest.java index ba9e4a831789..f82d9ca13938 100644 --- a/tests/UpdatableSystemFontTest/src/com/android/updatablesystemfont/UpdatableSystemFontTest.java +++ b/tests/UpdatableSystemFontTest/src/com/android/updatablesystemfont/UpdatableSystemFontTest.java @@ -130,14 +130,13 @@ public class UpdatableSystemFontTest { private static final Pattern PATTERN_SYSTEM_FONT_FILES = Pattern.compile("^/(system|product)/fonts/"); - private String mKeyId; private FontManager mFontManager; private UiDevice mUiDevice; @Before public void setUp() throws Exception { Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); - mKeyId = insertCert(CERT_PATH); + insertCert(CERT_PATH); mFontManager = context.getSystemService(FontManager.class); expectCommandToSucceed("cmd font clear"); mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); @@ -147,9 +146,6 @@ public class UpdatableSystemFontTest { public void tearDown() throws Exception { // Ignore errors because this may fail if updatable system font is not enabled. runShellCommand("cmd font clear", null); - if (mKeyId != null) { - expectCommandToSucceed("mini-keyctl unlink " + mKeyId + " .fs-verity"); - } } @Test @@ -369,20 +365,11 @@ public class UpdatableSystemFontTest { assertThat(isFileOpenedBy(fontPath, EMOJI_RENDERING_TEST_APP_ID)).isFalse(); } - private static String insertCert(String certPath) throws Exception { - Pair<String, String> result; - try (InputStream is = new FileInputStream(certPath)) { - result = runShellCommand("mini-keyctl padd asymmetric fsv_test .fs-verity", is); - } + private static void insertCert(String certPath) throws Exception { // /data/local/tmp is not readable by system server. Copy a cert file to /data/fonts final String copiedCert = "/data/fonts/debug_cert.der"; runShellCommand("cp " + certPath + " " + copiedCert, null); runShellCommand("cmd font install-debug-cert " + copiedCert, null); - // Assert that there are no errors. - assertThat(result.second).isEmpty(); - String keyId = result.first.trim(); - assertThat(keyId).matches("^\\d+$"); - return keyId; } private int updateFontFile(String fontPath, String signaturePath) throws IOException { |