summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2024-03-23 02:06:11 +0000
committerAndroid Build Cherrypicker Worker <android-build-cherrypicker-worker@google.com>2024-03-23 02:06:11 +0000
commitd7579be9ec95d10c30605df5298f942c7d503cdc (patch)
tree71fef40eea40b3449fb63fd50a04b99d9ce67c38
parent505e763ee88d57a11b2d34ba7a5df48fe341d7ce (diff)
downloadbase-d7579be9ec95d10c30605df5298f942c7d503cdc.tar.gz
Remove mini-keyctl usage from UpdatableSystemFontTest
Bug: 313005703 Test: atest UpdatableFontDirTest UpdatableSystemFontTest Test: atest GtsFontHostTestCases FontManagerTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d5e936166beea5a5a2b37ce0d9b1795c0438a2d3) Merged-In: Ib4a32a9bbb27ebd2e9a32dc308f79ec1c91332ce Change-Id: Ib4a32a9bbb27ebd2e9a32dc308f79ec1c91332ce
-rw-r--r--tests/UpdatableSystemFontTest/src/com/android/updatablesystemfont/UpdatableSystemFontTest.java17
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 {