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

Commit 7ad77412 authored by Michael Hoisie's avatar Michael Hoisie Committed by Ang Li
Browse files

Remove Robolectric workaround for nGetRunCharacterAdvance change

A fix for Robolectric has been made at the same time and this
workaround can be removed.

Bug: 319192202
Test: SystemUIGoogleRobo2RNGTests
Change-Id: I57d0689d6bdc8af12d671fbb6f9cbe8ea90da085
parent 4ba6f93b
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -65,8 +65,6 @@ public class Paint {
    private long mNativeShader;
    private long mNativeColorFilter;

    private static boolean sIsRobolectric = Build.FINGERPRINT.equals("robolectric");

    // Use a Holder to allow static initialization of Paint in the boot image.
    private static class NoImagePreloadHolder {
        public static final NativeAllocationRegistry sRegistry =
@@ -3393,14 +3391,9 @@ public class Paint {
            return 0.0f;
        }

        if (sIsRobolectric) {
            return nGetRunCharacterAdvance(mNativePaint, text, start, end,
                    contextStart, contextEnd, isRtl, offset, advances, advancesIndex, drawBounds);
        } else {
        return nGetRunCharacterAdvance(mNativePaint, text, start, end, contextStart, contextEnd,
                isRtl, offset, advances, advancesIndex, drawBounds, runInfo);
    }
    }

    /**
     * @see #getRunCharacterAdvance(char[], int, int, int, int, boolean, int, float[], int)
+0 −12
Original line number Diff line number Diff line
@@ -578,16 +578,6 @@ namespace PaintGlue {
        return result;
    }

    // This method is kept for old Robolectric JNI signature used by SystemUIGoogleRoboRNGTests.
    static jfloat getRunCharacterAdvance___CIIIIZI_FI_F_ForRobolectric(
            JNIEnv* env, jclass cls, jlong paintHandle, jcharArray text, jint start, jint end,
            jint contextStart, jint contextEnd, jboolean isRtl, jint offset, jfloatArray advances,
            jint advancesIndex, jobject drawBounds) {
        return getRunCharacterAdvance___CIIIIZI_FI_F(env, cls, paintHandle, text, start, end,
                                                     contextStart, contextEnd, isRtl, offset,
                                                     advances, advancesIndex, drawBounds, nullptr);
    }

    static jint doOffsetForAdvance(const Paint* paint, const Typeface* typeface, const jchar buf[],
            jint start, jint count, jint bufSize, jboolean isRtl, jfloat advance) {
        minikin::Bidi bidiFlags = isRtl ? minikin::Bidi::FORCE_RTL : minikin::Bidi::FORCE_LTR;
@@ -1163,8 +1153,6 @@ static const JNINativeMethod methods[] = {
        {"nGetRunCharacterAdvance",
         "(J[CIIIIZI[FILandroid/graphics/RectF;Landroid/graphics/Paint$RunInfo;)F",
         (void*)PaintGlue::getRunCharacterAdvance___CIIIIZI_FI_F},
        {"nGetRunCharacterAdvance", "(J[CIIIIZI[FILandroid/graphics/RectF;)F",
         (void*)PaintGlue::getRunCharacterAdvance___CIIIIZI_FI_F_ForRobolectric},
        {"nGetOffsetForAdvance", "(J[CIIIIZF)I", (void*)PaintGlue::getOffsetForAdvance___CIIIIZF_I},
        {"nGetFontMetricsIntForText", "(J[CIIIIZLandroid/graphics/Paint$FontMetricsInt;)V",
         (void*)PaintGlue::getFontMetricsIntForText___C},