summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-07 18:38:18 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-02-07 18:38:18 +0000
commit5344c862319a9a08731c14b8251dbec7a147245e (patch)
tree55cfb0a1ce0bf4dbd65453b794492c124a8817c7
parent16cb9081ee0bcc6fc03c5fb05696bafaac49c831 (diff)
parentf86842ad73ad6ddd041fc5935a573cac222d5b22 (diff)
downloadcts-snap-temp-L04000000958486361.tar.gz
Merge "Remove EmojiCompat requirements from system installed emoji font" into snap-temp-L04000000958486361snap-temp-L04000000958486361
-rw-r--r--tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java46
-rw-r--r--tests/tests/graphics/src/android/graphics/fonts/SystemEmojiTest.java2
2 files changed, 0 insertions, 48 deletions
diff --git a/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java b/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java
index 5ee09124e2a..fcaab4bc0b7 100644
--- a/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java
+++ b/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java
@@ -90,50 +90,4 @@ public class FontFileTestUtil {
}
return null;
}
-
- public static boolean containsEmojiCompatMetadata(File file) throws IOException {
- try (FileInputStream fis = new FileInputStream(file)) {
- final FileChannel fc = fis.getChannel();
- long size = fc.size();
- ByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, size)
- .order(ByteOrder.BIG_ENDIAN);
-
- int magicNumber = buffer.getInt(0);
-
- int fontOffset = 0;
- if (magicNumber == TTC_TAG) {
- throw new IOException("Emoji font is not expected to be in a font collection.");
- } else if (magicNumber != SFNT_VERSION_1 && magicNumber != SFNT_VERSION_OTTO) {
- throw new IOException("Unknown magic number: #" + magicNumber);
- }
-
- int numTables = buffer.getShort(fontOffset + 4); // offset to number of table
- int metaTableOffset = 0;
- for (int i = 0; i < numTables; ++i) {
- int tableEntryOffset = fontOffset + 12 + i * 16;
- int tableTag = buffer.getInt(tableEntryOffset);
- if (tableTag == META_TAG) {
- metaTableOffset = buffer.getInt(tableEntryOffset + 8);
- break;
- }
- }
-
- if (metaTableOffset == 0) {
- throw new IOException("name table not found.");
- }
-
- int dataMapsCount = buffer.getInt(metaTableOffset + 12);
-
- for (int i = 0; i < dataMapsCount; ++i) {
- int tag = buffer.getInt(metaTableOffset + 16 + 12 * i);
- int offset = buffer.getInt(metaTableOffset + 16 + 12 * i + 4);
- int dataLength = buffer.getInt(metaTableOffset + 16 + 12 * i + 8);
-
- if (tag == EMJI_TAG && dataLength != 0) {
- return true;
- }
- }
- }
- return false;
- }
}
diff --git a/tests/tests/graphics/src/android/graphics/fonts/SystemEmojiTest.java b/tests/tests/graphics/src/android/graphics/fonts/SystemEmojiTest.java
index f42da832bb4..a4d0ab48a12 100644
--- a/tests/tests/graphics/src/android/graphics/fonts/SystemEmojiTest.java
+++ b/tests/tests/graphics/src/android/graphics/fonts/SystemEmojiTest.java
@@ -47,8 +47,6 @@ public class SystemEmojiTest {
// NotoColorEmoji.ttf should be always available as a fallback font even if another emoji
// font files are installed in the system.
assertThat(emojiFont).isNotNull();
-
- assertThat(FontFileTestUtil.containsEmojiCompatMetadata(emojiFont)).isTrue();
}
public String getFontName(String chars) {