summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Seigo Nonaka <nona@google.com> 2024-02-08 11:55:54 +0900
committer Seigo Nonaka <nona@google.com> 2024-02-08 02:59:41 +0000
commitd2a11b3594f7e681e70e1432da26ab15b935268c (patch)
treef845bc1df6786e30d60704c546253647bf4f5e25
parent404ed228eb7c09b5d00030fa9a361d2383f747ca (diff)
Don't recycle byte[] for icu.Bidi
The slice of primitive array cannot be used for icu.Bidi, so do not recycle the arrays and always need to create new primitive array instance Bug: 324167048 Test: atest android.text.cts.LayoutUseBoundsTest Change-Id: If3e3bf9b51b5a246c7b633a3932e63f8bcb4014e
-rw-r--r--core/java/android/text/MeasuredParagraph.java8
1 files changed, 1 insertions, 7 deletions
diff --git a/core/java/android/text/MeasuredParagraph.java b/core/java/android/text/MeasuredParagraph.java
index 09f15c3aca3e..95d197433397 100644
--- a/core/java/android/text/MeasuredParagraph.java
+++ b/core/java/android/text/MeasuredParagraph.java
@@ -116,9 +116,6 @@ public class MeasuredParagraph {
// This is empty if mLtrWithoutBidi is true.
private @NonNull ByteArray mLevels = new ByteArray();
- // The bidi level for runs.
- private @NonNull ByteArray mRunLevels = new ByteArray();
-
private Bidi mBidi;
// The whole width of the text.
@@ -154,7 +151,6 @@ public class MeasuredParagraph {
reset();
mLevels.clearWithReleasingLargeArray();
mWidths.clearWithReleasingLargeArray();
- mRunLevels.clearWithReleasingLargeArray();
mFontMetrics.clearWithReleasingLargeArray();
mSpanEndCache.clearWithReleasingLargeArray();
}
@@ -167,7 +163,6 @@ public class MeasuredParagraph {
mCopiedBuffer = null;
mWholeWidth = 0;
mLevels.clear();
- mRunLevels.clear();
mWidths.clear();
mFontMetrics.clear();
mSpanEndCache.clear();
@@ -250,8 +245,7 @@ public class MeasuredParagraph {
}
// Reorder directionality run visually.
- mRunLevels.resize(bidi.getRunCount());
- byte[] levels = mRunLevels.getRawArray();
+ byte[] levels = new byte[bidi.getRunCount()];
for (int i = 0; i < bidi.getRunCount(); ++i) {
levels[i] = (byte) bidi.getRunLevel(i);
}