Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2a11b35 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

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
parent 404ed228
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -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);
            }